Бранимир Караџић 6 years ago
parent
commit
de9a508409
6 changed files with 40 additions and 35 deletions
  1. 1 1
      bindings/cs/bgfx.cs
  2. 11 8
      bindings/d/types.d
  3. 1 1
      include/bgfx/bgfx.h
  4. 14 13
      include/bgfx/defines.h
  5. 4 3
      scripts/bgfx.idl
  6. 9 9
      src/bgfx_p.h

+ 1 - 1
bindings/cs/bgfx.cs

@@ -204,7 +204,7 @@ public static partial class bgfx
 	}
 	
 	[Flags]
-	public enum DiscardFlagsFlags : uint
+	public enum DiscardFlags : uint
 	{
 		/// <summary>
 		/// Discard only Index Buffer

+ 11 - 8
bindings/d/types.d

@@ -10,7 +10,7 @@ public import core.stdc.stdarg : va_list;
 
 extern(C) @nogc nothrow:
 
-enum uint BGFX_API_VERSION = 102;
+enum uint BGFX_API_VERSION = 103;
 
 alias bgfx_view_id_t = ushort;
 
@@ -75,13 +75,16 @@ enum ulong BGFX_STATE_CULL_CCW = 0x0000002000000000; /// Cull counter-clockwise
 enum ulong BGFX_STATE_CULL_SHIFT = 36; /// Culling mode bit shift
 enum ulong BGFX_STATE_CULL_MASK = 0x0000003000000000; /// Culling mode bit mask
 
-/// Rendering state discard. When state is preserved in submit, rendering states can be discarded on a finer grain.
-enum ubyte BGFX_DISCARD_FLAGS_INDEX_BUFFER = 0x01; /// Discard only Index Buffer
-enum ubyte BGFX_DISCARD_FLAGS_VERTEX_STREAMS = 0x02; /// Discard only Vertex Streams
-enum ubyte BGFX_DISCARD_FLAGS_TEXTURE_SAMPLERS = 0x04; /// Discard only texture samplers
-enum ubyte BGFX_DISCARD_FLAGS_COMPUTE = 0x08; /// Discard only Compute shader related state
-enum ubyte BGFX_DISCARD_FLAGS_STATE = 0x10; /// Discard only state
-enum ubyte BGFX_DISCARD_FLAGS_ALL = 0x1f; /// Discard every rendering states
+/**
+ * Rendering state discard. When state is preserved in submit, rendering states can be discarded
+ * on a finer grain.
+ */
+enum ubyte BGFX_DISCARD_INDEX_BUFFER = 0x01; /// Discard only Index Buffer
+enum ubyte BGFX_DISCARD_VERTEX_STREAMS = 0x02; /// Discard only Vertex Streams
+enum ubyte BGFX_DISCARD_TEXTURE_SAMPLERS = 0x04; /// Discard only texture samplers
+enum ubyte BGFX_DISCARD_COMPUTE = 0x08; /// Discard only Compute shader related state
+enum ubyte BGFX_DISCARD_STATE = 0x10; /// Discard only state
+enum ubyte BGFX_DISCARD_ALL = 0x1f; /// Discard every rendering states
 
 /// Alpha reference value.
 enum ulong BGFX_STATE_ALPHA_REF_SHIFT = 40; /// Alpha reference bit shift

+ 1 - 1
include/bgfx/bgfx.h

@@ -3985,7 +3985,7 @@ namespace bgfx
 	///
 	/// @attention C99 equivalent is `bgfx_discard`.
 	///
-	void discard(uint8_t flags = BGFX_DISCARD_FLAGS_ALL);
+	void discard(uint8_t flags = BGFX_DISCARD_ALL);
 
 	/// Blit 2D texture region between two 2D textures.
 	///

+ 14 - 13
include/bgfx/defines.h

@@ -15,7 +15,7 @@
 #ifndef BGFX_DEFINES_H_HEADER_GUARD
 #define BGFX_DEFINES_H_HEADER_GUARD
 
-#define BGFX_API_VERSION UINT32_C(102)
+#define BGFX_API_VERSION UINT32_C(103)
 
 /**
  * Color RGB/alpha/depth write. When it's not specified write will be disabled.
@@ -100,21 +100,22 @@
 #define BGFX_STATE_CULL_MASK                UINT64_C(0x0000003000000000) //!< Culling mode bit mask
 
 /**
- * Rendering state discard. When state is preserved in submit, rendering states can be discarded on a finer grain.
+ * Rendering state discard. When state is preserved in submit, rendering states can be discarded
+ * on a finer grain.
  *
  */
-#define BGFX_DISCARD_FLAGS_INDEX_BUFFER     UINT8_C(0x01) //!< Discard only Index Buffer
-#define BGFX_DISCARD_FLAGS_VERTEX_STREAMS   UINT8_C(0x02) //!< Discard only Vertex Streams
-#define BGFX_DISCARD_FLAGS_TEXTURE_SAMPLERS UINT8_C(0x04) //!< Discard only texture samplers
-#define BGFX_DISCARD_FLAGS_COMPUTE          UINT8_C(0x08) //!< Discard only Compute shader related state
-#define BGFX_DISCARD_FLAGS_STATE            UINT8_C(0x10) //!< Discard only state
+#define BGFX_DISCARD_INDEX_BUFFER           UINT8_C(0x01) //!< Discard only Index Buffer
+#define BGFX_DISCARD_VERTEX_STREAMS         UINT8_C(0x02) //!< Discard only Vertex Streams
+#define BGFX_DISCARD_TEXTURE_SAMPLERS       UINT8_C(0x04) //!< Discard only texture samplers
+#define BGFX_DISCARD_COMPUTE                UINT8_C(0x08) //!< Discard only Compute shader related state
+#define BGFX_DISCARD_STATE                  UINT8_C(0x10) //!< Discard only state
 /// Discard every rendering states
-#define BGFX_DISCARD_FLAGS_ALL (0 \
-	| BGFX_DISCARD_FLAGS_INDEX_BUFFER \
-	| BGFX_DISCARD_FLAGS_VERTEX_STREAMS \
-	| BGFX_DISCARD_FLAGS_TEXTURE_SAMPLERS \
-	| BGFX_DISCARD_FLAGS_COMPUTE \
-	| BGFX_DISCARD_FLAGS_STATE \
+#define BGFX_DISCARD_ALL (0 \
+	| BGFX_DISCARD_INDEX_BUFFER \
+	| BGFX_DISCARD_VERTEX_STREAMS \
+	| BGFX_DISCARD_TEXTURE_SAMPLERS \
+	| BGFX_DISCARD_COMPUTE \
+	| BGFX_DISCARD_STATE \
 	)
 
 

+ 4 - 3
scripts/bgfx.idl

@@ -1,7 +1,7 @@
 -- vim: syntax=lua
 -- bgfx interface
 
-version(102)
+version(103)
 
 typedef "bool"
 typedef "char"
@@ -83,8 +83,9 @@ flag.StateCull { bits = 64, shift = 36, range = 2, base = 1, desc = "Culling mod
 	.Ccw --- Cull counter-clockwise triangles.
 	()
 
---- Rendering state discard. When state is preserved in submit, rendering states can be discarded on a finer grain.
-flag.DiscardFlags { bits = 8, base = 1, desc = "Discard flags" }
+--- Rendering state discard. When state is preserved in submit, rendering states can be discarded
+--- on a finer grain.
+flag.Discard { bits = 8, base = 1, desc = "Discard flags" }
 	.IndexBuffer                                                                        --- Discard only Index Buffer
 	.VertexStreams                                                                      --- Discard only Vertex Streams
 	.TextureSamplers                                                                    --- Discard only texture samplers

+ 9 - 9
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_FLAGS_ALL)
+		void clear(uint8_t flags = BGFX_DISCARD_ALL)
 		{
-			if (flags & BGFX_DISCARD_FLAGS_TEXTURE_SAMPLERS)
+			if (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_FLAGS_ALL)
+		void clear(uint8_t flags = BGFX_DISCARD_ALL)
 		{
-			if (flags & BGFX_DISCARD_FLAGS_STATE)
+			if (flags & BGFX_DISCARD_STATE)
 			{
 				m_uniformBegin = 0;
 				m_uniformEnd   = 0;
@@ -1589,12 +1589,12 @@ constexpr uint64_t kSortKeyComputeProgramMask  = uint64_t(BGFX_CONFIG_MAX_PROGRA
 				m_occlusionQuery.idx     = kInvalidHandle;
 				m_uniformIdx = UINT8_MAX;
 			}
-			if (flags & BGFX_DISCARD_FLAGS_VERTEX_STREAMS)
+			if (flags & BGFX_DISCARD_VERTEX_STREAMS)
 			{
 				m_streamMask = 0;
 				m_stream[0].clear();
 			}
-			if (flags & BGFX_DISCARD_FLAGS_INDEX_BUFFER)
+			if (flags & BGFX_DISCARD_INDEX_BUFFER)
 			{
 				m_indexBuffer.idx = kInvalidHandle;
 			}
@@ -1638,9 +1638,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_FLAGS_ALL)
+		void clear(uint8_t flags = BGFX_DISCARD_ALL)
 		{
-			if (flags & BGFX_DISCARD_FLAGS_COMPUTE)
+			if (flags & BGFX_DISCARD_COMPUTE)
 			{
 				m_uniformBegin = 0;
 				m_uniformEnd   = 0;
@@ -2494,7 +2494,7 @@ constexpr uint64_t kSortKeyComputeProgramMask  = uint64_t(BGFX_CONFIG_MAX_PROGRA
 			bind.m_mip    = _mip;
 		}
 
-		void discard(uint8_t flags = BGFX_DISCARD_FLAGS_ALL)
+		void discard(uint8_t flags = BGFX_DISCARD_ALL)
 		{
 			if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) )
 			{