Бранимир Караџић 6 роки тому
батько
коміт
b14f9dc280
6 змінених файлів з 32 додано та 26 видалено
  1. 2 2
      bindings/cs/bgfx.cs
  2. 4 4
      bindings/d/funcs.d
  3. 6 2
      include/bgfx/bgfx.h
  4. 2 2
      include/bgfx/c99/bgfx.h
  5. 4 4
      scripts/bgfx.idl
  6. 14 12
      src/bgfx_p.h

+ 2 - 2
bindings/cs/bgfx.cs

@@ -4011,7 +4011,7 @@ public static partial class bgfx
 	/// Discard previously set state for draw or compute call.
 	/// </summary>
 	///
-	/// <param name="_flags">rendering states to discard</param>
+	/// <param name="_flags">Draw/compute states to discard.</param>
 	///
 	[DllImport(DllName, EntryPoint="bgfx_encoder_discard", CallingConvention = CallingConvention.Cdecl)]
 	public static extern unsafe void encoder_discard(Encoder* _this, byte _flags);
@@ -4526,7 +4526,7 @@ public static partial class bgfx
 	/// Discard previously set state for draw or compute call.
 	/// </summary>
 	///
-	/// <param name="_flags">rendering states to discard</param>
+	/// <param name="_flags">Draw/compute states to discard.</param>
 	///
 	[DllImport(DllName, EntryPoint="bgfx_discard", CallingConvention = CallingConvention.Cdecl)]
 	public static extern unsafe void discard(byte _flags);

+ 4 - 4
bindings/d/funcs.d

@@ -1573,7 +1573,7 @@ version(BindBgfx_Static)
 	/**
 	 * Discard previously set state for draw or compute call.
 	 * Params:
-	 * _flags = rendering states to discard
+	 * _flags = Draw/compute states to discard.
 	 */
 	void bgfx_encoder_discard(bgfx_encoder_t* _this, byte _flags);
 	
@@ -2032,7 +2032,7 @@ version(BindBgfx_Static)
 	/**
 	 * Discard previously set state for draw or compute call.
 	 * Params:
-	 * _flags = rendering states to discard
+	 * _flags = Draw/compute states to discard.
 	 */
 	void bgfx_discard(byte _flags);
 	
@@ -3769,7 +3769,7 @@ else
 		/**
 		 * Discard previously set state for draw or compute call.
 		 * Params:
-		 * _flags = rendering states to discard
+		 * _flags = Draw/compute states to discard.
 		 */
 		alias da_bgfx_encoder_discard = void function(bgfx_encoder_t* _this, byte _flags);
 		da_bgfx_encoder_discard bgfx_encoder_discard;
@@ -4270,7 +4270,7 @@ else
 		/**
 		 * Discard previously set state for draw or compute call.
 		 * Params:
-		 * _flags = rendering states to discard
+		 * _flags = Draw/compute states to discard.
 		 */
 		alias da_bgfx_discard = void function(byte _flags);
 		da_bgfx_discard bgfx_discard;

+ 6 - 2
include/bgfx/bgfx.h

@@ -1588,9 +1588,11 @@ namespace bgfx
 
 		/// Discard all previously set state for draw or compute call.
 		///
+		/// @param[in] _flags Draw/compute states to discard.
+		///
 		/// @attention C99 equivalent is `bgfx_encoder_discard`.
 		///
-		void discard(uint8_t flags);
+		void discard(uint8_t _flags = BGFX_DISCARD_ALL);
 
 		/// Blit texture 2D region between two 2D textures.
 		///
@@ -3983,9 +3985,11 @@ namespace bgfx
 
 	/// Discard all previously set state for draw or compute call.
 	///
+	/// @param[in] _flags Draw/compute states to discard.
+	///
 	/// @attention C99 equivalent is `bgfx_discard`.
 	///
-	void discard(uint8_t flags = BGFX_DISCARD_ALL);
+	void discard(uint8_t _flags = BGFX_DISCARD_ALL);
 
 	/// Blit 2D texture region between two 2D textures.
 	///

+ 2 - 2
include/bgfx/c99/bgfx.h

@@ -2672,7 +2672,7 @@ BGFX_C_API void bgfx_encoder_dispatch_indirect(bgfx_encoder_t* _this, bgfx_view_
 /**
  * Discard previously set state for draw or compute call.
  *
- * @param[in] _flags rendering states to discard
+ * @param[in] _flags Draw/compute states to discard.
  *
  */
 BGFX_C_API void bgfx_encoder_discard(bgfx_encoder_t* _this, uint8_t _flags);
@@ -3190,7 +3190,7 @@ BGFX_C_API void bgfx_dispatch_indirect(bgfx_view_id_t _id, bgfx_program_handle_t
 /**
  * Discard previously set state for draw or compute call.
  *
- * @param[in] _flags rendering states to discard
+ * @param[in] _flags Draw/compute states to discard.
  *
  */
 BGFX_C_API void bgfx_discard(uint8_t _flags);

+ 4 - 4
scripts/bgfx.idl

@@ -2452,8 +2452,8 @@ func.Encoder.dispatch { cname = "dispatch_indirect" }
 --- Discard previously set state for draw or compute call.
 func.Encoder.discard
 	"void"
-	.flags   "uint8_t"     --- rendering states to discard
-	 { default = "Default" }
+	.flags   "uint8_t"     --- Draw/compute states to discard.
+	 { default = "BGFX_DISCARD_ALL" }
 
 --- Blit 2D texture region between two 2D textures.
 ---
@@ -2964,8 +2964,8 @@ func.dispatch { cname = "dispatch_indirect" }
 --- Discard previously set state for draw or compute call.
 func.discard
 	"void"
-	.flags   "uint8_t"     --- rendering states to discard
-	 { default = "Default" }
+	.flags   "uint8_t"     --- Draw/compute states to discard.
+	 { default = "BGFX_DISCARD_ALL" }
 
 --- Blit 2D texture region between two 2D textures.
 ---

+ 14 - 12
src/bgfx_p.h

@@ -1543,9 +1543,9 @@ constexpr uint64_t kSortKeyComputeProgramMask  = uint64_t(BGFX_CONFIG_MAX_PROGRA
 
 	BX_ALIGN_DECL_CACHE_LINE(struct) RenderBind
 	{
-		void clear(uint8_t flags = BGFX_DISCARD_ALL)
+		void clear(uint8_t _flags = BGFX_DISCARD_ALL)
 		{
-			if (flags & BGFX_DISCARD_TEXTURE_SAMPLERS)
+			if (0 != (_flags & BGFX_DISCARD_TEXTURE_SAMPLERS) )
 			{
 				for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++ii)
 				{
@@ -1562,9 +1562,9 @@ constexpr uint64_t kSortKeyComputeProgramMask  = uint64_t(BGFX_CONFIG_MAX_PROGRA
 
 	BX_ALIGN_DECL_CACHE_LINE(struct) RenderDraw
 	{
-		void clear(uint8_t flags = BGFX_DISCARD_ALL)
+		void clear(uint8_t _flags = BGFX_DISCARD_ALL)
 		{
-			if (flags & BGFX_DISCARD_STATE)
+			if (0 != (_flags & BGFX_DISCARD_STATE) )
 			{
 				m_uniformBegin = 0;
 				m_uniformEnd   = 0;
@@ -1589,12 +1589,14 @@ constexpr uint64_t kSortKeyComputeProgramMask  = uint64_t(BGFX_CONFIG_MAX_PROGRA
 				m_occlusionQuery.idx     = kInvalidHandle;
 				m_uniformIdx = UINT8_MAX;
 			}
-			if (flags & BGFX_DISCARD_VERTEX_STREAMS)
+
+			if (0 != (_flags & BGFX_DISCARD_VERTEX_STREAMS) )
 			{
 				m_streamMask = 0;
 				m_stream[0].clear();
 			}
-			if (flags & BGFX_DISCARD_INDEX_BUFFER)
+
+			if (0 != (_flags & BGFX_DISCARD_INDEX_BUFFER) )
 			{
 				m_indexBuffer.idx = kInvalidHandle;
 			}
@@ -1638,9 +1640,9 @@ constexpr uint64_t kSortKeyComputeProgramMask  = uint64_t(BGFX_CONFIG_MAX_PROGRA
 
 	BX_ALIGN_DECL_CACHE_LINE(struct) RenderCompute
 	{
-		void clear(uint8_t flags = BGFX_DISCARD_ALL)
+		void clear(uint8_t _flags = BGFX_DISCARD_ALL)
 		{
-			if (flags & BGFX_DISCARD_COMPUTE)
+			if (0 != (_flags & BGFX_DISCARD_COMPUTE) )
 			{
 				m_uniformBegin = 0;
 				m_uniformEnd   = 0;
@@ -2494,7 +2496,7 @@ constexpr uint64_t kSortKeyComputeProgramMask  = uint64_t(BGFX_CONFIG_MAX_PROGRA
 			bind.m_mip    = _mip;
 		}
 
-		void discard(uint8_t flags = BGFX_DISCARD_ALL)
+		void discard(uint8_t _flags = BGFX_DISCARD_ALL)
 		{
 			if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) )
 			{
@@ -2502,9 +2504,9 @@ constexpr uint64_t kSortKeyComputeProgramMask  = uint64_t(BGFX_CONFIG_MAX_PROGRA
 			}
 
 			m_discard = false;
-			m_draw.clear(flags);
-			m_compute.clear(flags);
-			m_bind.clear(flags);
+			m_draw.clear(_flags);
+			m_compute.clear(_flags);
+			m_bind.clear(_flags);
 		}
 
 		void submit(ViewId _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, uint32_t _depth, bool _preserveState);