Branimir Karadžić 11 rokov pred
rodič
commit
21fff2de4b
4 zmenil súbory, kde vykonal 21 pridanie a 19 odobranie
  1. 11 9
      src/bgfx_p.h
  2. 4 4
      src/renderer_d3d11.cpp
  3. 3 3
      src/renderer_d3d9.cpp
  4. 3 3
      src/renderer_gl.cpp

+ 11 - 9
src/bgfx_p.h

@@ -1048,13 +1048,18 @@ namespace bgfx
 
 		union
 		{
-			uint32_t m_flags;
+			struct
+			{
+				uint32_t m_flags;
+			} m_draw;
+
 			struct
 			{
 				uint8_t  m_format;
 				uint8_t  m_access;
 				uint8_t  m_mip;
 			} m_compute;
+
 		} m_un;
 	};
 
@@ -1086,11 +1091,10 @@ namespace bgfx
 			for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++ii)
 			{
 				m_bind[ii].m_idx  = invalidHandle;
-				m_bind[ii].m_type = uint8_t(Binding::Texture);
-				m_bind[ii].m_un.m_flags = 0;
 			}
 		}
 
+		Binding  m_bind[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS];
 		uint64_t m_flags;
 		uint64_t m_stencil;
 		uint32_t m_rgba;
@@ -1112,7 +1116,6 @@ namespace bgfx
 		VertexDeclHandle   m_vertexDecl;
 		IndexBufferHandle  m_indexBuffer;
 		VertexBufferHandle m_instanceDataBuffer;
-		Binding m_bind[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS];
 	};
 
 	struct RenderCompute
@@ -1134,6 +1137,7 @@ namespace bgfx
 			}
 		}
 
+		Binding  m_bind[BGFX_MAX_COMPUTE_BINDINGS];
 		uint32_t m_constBegin;
 		uint32_t m_constEnd;
 		uint32_t m_matrix;
@@ -1143,8 +1147,6 @@ namespace bgfx
 		uint16_t m_numZ;
 		uint16_t m_num;
 		uint8_t  m_submitFlags;
-
-		Binding m_bind[BGFX_MAX_COMPUTE_BINDINGS];
 	};
 
 	union RenderItem
@@ -1386,9 +1388,9 @@ namespace bgfx
 
 		void setTexture(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint32_t _flags)
 		{
-			Binding& sampler     = m_draw.m_bind[_stage];
-			sampler.m_idx        = _handle.idx;
-			sampler.m_un.m_flags = (_flags&BGFX_SAMPLER_DEFAULT_FLAGS) ? BGFX_SAMPLER_DEFAULT_FLAGS : _flags;
+			Binding& sampler = m_draw.m_bind[_stage];
+			sampler.m_idx    = _handle.idx;
+			sampler.m_un.m_draw.m_flags = (_flags&BGFX_SAMPLER_DEFAULT_FLAGS) ? BGFX_SAMPLER_DEFAULT_FLAGS : _flags;
 
 			if (isValid(_sampler)
 			&& (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) || BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES) ) )

+ 4 - 4
src/renderer_d3d11.cpp

@@ -3445,18 +3445,18 @@ namespace bgfx
 					{
 						const Binding& sampler = draw.m_bind[stage];
 						Binding& current = currentState.m_bind[stage];
-						if (current.m_idx        != sampler.m_idx
-						||  current.m_un.m_flags != sampler.m_un.m_flags
+						if (current.m_idx != sampler.m_idx
+						||  current.m_un.m_draw.m_flags != sampler.m_un.m_draw.m_flags
 						||  programChanged)
 						{
 							if (invalidHandle != sampler.m_idx)
 							{
 								TextureD3D11& texture = m_textures[sampler.m_idx];
-								texture.commit(stage, sampler.m_un.m_flags);
+								texture.commit(stage, sampler.m_un.m_draw.m_flags);
 							}
 							else
 							{
-								m_textureStage.m_srv[stage] = NULL;
+								m_textureStage.m_srv[stage]     = NULL;
 								m_textureStage.m_sampler[stage] = NULL;
 							}
 

+ 3 - 3
src/renderer_d3d9.cpp

@@ -3170,13 +3170,13 @@ namespace bgfx
 					{
 						const Binding& sampler = draw.m_bind[stage];
 						Binding& current = currentState.m_bind[stage];
-						if (current.m_idx        != sampler.m_idx
-						||  current.m_un.m_flags != sampler.m_un.m_flags
+						if (current.m_idx != sampler.m_idx
+						||  current.m_un.m_draw.m_flags != sampler.m_un.m_draw.m_flags
 						||  programChanged)
 						{
 							if (invalidHandle != sampler.m_idx)
 							{
-								m_textures[sampler.m_idx].commit(stage, sampler.m_un.m_flags);
+								m_textures[sampler.m_idx].commit(stage, sampler.m_un.m_draw.m_flags);
 							}
 							else
 							{

+ 3 - 3
src/renderer_gl.cpp

@@ -4756,14 +4756,14 @@ namespace bgfx
 						{
 							const Binding& sampler = draw.m_bind[stage];
 							Binding& current = currentState.m_bind[stage];
-							if (current.m_idx        != sampler.m_idx
-							||  current.m_un.m_flags != sampler.m_un.m_flags
+							if (current.m_idx != sampler.m_idx
+							||  current.m_un.m_draw.m_flags != sampler.m_un.m_draw.m_flags
 							||  programChanged)
 							{
 								if (invalidHandle != sampler.m_idx)
 								{
 									TextureGL& texture = m_textures[sampler.m_idx];
-									texture.commit(stage, sampler.m_un.m_flags);
+									texture.commit(stage, sampler.m_un.m_draw.m_flags);
 								}
 							}