Branimir Karadžić 10 роки тому
батько
коміт
f82f99b2a6
6 змінених файлів з 20 додано та 20 видалено
  1. 1 1
      include/bgfx.h
  2. 6 6
      src/renderer_d3d11.cpp
  3. 1 1
      src/renderer_d3d11.h
  4. 10 10
      src/renderer_d3d12.cpp
  5. 1 1
      src/renderer_d3d12.h
  6. 1 1
      src/renderer_gl.cpp

+ 1 - 1
include/bgfx.h

@@ -594,7 +594,7 @@ namespace bgfx
 		void decode(Attrib::Enum _attrib, uint8_t& _num, AttribType::Enum& _type, bool& _normalized, bool& _asInt) const;
 
 		/// Returns true if VertexDecl contains attribute.
-		bool has(Attrib::Enum _attrib) const { return 0xff != m_attributes[_attrib]; }
+		bool has(Attrib::Enum _attrib) const { return UINT16_MAX != m_attributes[_attrib]; }
 
 		/// Returns relative attribute offset from the vertex.
 		uint16_t getOffset(Attrib::Enum _attrib) const { return m_offset[_attrib]; }

+ 6 - 6
src/renderer_d3d11.cpp

@@ -306,7 +306,7 @@ namespace bgfx { namespace d3d11
 
 		for (uint32_t attr = 0; attr < Attrib::Count; ++attr)
 		{
-			if (0xff != _decl.m_attributes[attr])
+			if (UINT16_MAX != _decl.m_attributes[attr])
 			{
 				memcpy(elem, &s_attrib[attr], sizeof(D3D11_INPUT_ELEMENT_DESC) );
 
@@ -2049,13 +2049,13 @@ BX_PRAGMA_DIAGNOSTIC_POP();
 
 				VertexDecl decl;
 				memcpy(&decl, &_vertexDecl, sizeof(VertexDecl) );
-				const uint8_t* attrMask = _program.m_vsh->m_attrMask;
+				const uint16_t* attrMask = _program.m_vsh->m_attrMask;
 
 				for (uint32_t ii = 0; ii < Attrib::Count; ++ii)
 				{
-					uint8_t mask = attrMask[ii];
-					uint8_t attr = (decl.m_attributes[ii] & mask);
-					decl.m_attributes[ii] = attr == 0 ? 0xff : attr == 0xff ? 0 : attr;
+					uint16_t mask = attrMask[ii];
+					uint16_t attr = (decl.m_attributes[ii] & mask);
+					decl.m_attributes[ii] = attr == 0 ? UINT16_MAX : attr == UINT16_MAX ? 0 : attr;
 				}
 
 				D3D11_INPUT_ELEMENT_DESC* elem = fillVertexDecl(vertexElements, decl);
@@ -3234,7 +3234,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
 
 			if (Attrib::Count != attr)
 			{
-				m_attrMask[attr] = 0xff;
+				m_attrMask[attr] = UINT16_MAX;
 			}
 		}
 

+ 1 - 1
src/renderer_d3d11.h

@@ -215,7 +215,7 @@ namespace bgfx { namespace d3d11
 		ConstantBuffer* m_constantBuffer;
 
 		PredefinedUniform m_predefined[PredefinedUniform::Count];
-		uint8_t m_attrMask[Attrib::Count];
+		uint16_t m_attrMask[Attrib::Count];
 
 		uint32_t m_hash;
 

+ 10 - 10
src/renderer_d3d12.cpp

@@ -289,7 +289,7 @@ namespace bgfx { namespace d3d12
 
 		for (uint32_t attr = 0; attr < Attrib::Count; ++attr)
 		{
-			if (0xff != _decl.m_attributes[attr])
+			if (UINT16_MAX != _decl.m_attributes[attr])
 			{
 				memcpy(elem, &s_attrib[attr], sizeof(D3D12_INPUT_ELEMENT_DESC) );
 
@@ -1821,13 +1821,13 @@ data.NumQualityLevels = 0;
 		{
 			VertexDecl decl;
 			memcpy(&decl, &_vertexDecl, sizeof(VertexDecl) );
-			const uint8_t* attrMask = _program.m_vsh->m_attrMask;
+			const uint16_t* attrMask = _program.m_vsh->m_attrMask;
 
 			for (uint32_t ii = 0; ii < Attrib::Count; ++ii)
 			{
-				uint8_t mask = attrMask[ii];
-				uint8_t attr = (decl.m_attributes[ii] & mask);
-				decl.m_attributes[ii] = attr == 0 ? 0xff : attr == 0xff ? 0 : attr;
+				uint16_t mask = attrMask[ii];
+				uint16_t attr = (decl.m_attributes[ii] & mask);
+				decl.m_attributes[ii] = attr == 0 ? UINT16_MAX : attr == UINT16_MAX ? 0 : attr;
 			}
 
 			D3D12_INPUT_ELEMENT_DESC* elem = fillVertexDecl(_vertexElements, decl);
@@ -1939,13 +1939,13 @@ data.NumQualityLevels = 0;
 
 			VertexDecl decl;
 			memcpy(&decl, &m_vertexDecls[_declIdx], sizeof(VertexDecl) );
-			const uint8_t* attrMask = program.m_vsh->m_attrMask;
+			const uint16_t* attrMask = program.m_vsh->m_attrMask;
 
 			for (uint32_t ii = 0; ii < Attrib::Count; ++ii)
 			{
-				uint8_t mask = attrMask[ii];
-				uint8_t attr = (decl.m_attributes[ii] & mask);
-				decl.m_attributes[ii] = attr == 0 ? 0xff : attr == 0xff ? 0 : attr;
+				uint16_t mask = attrMask[ii];
+				uint16_t attr = (decl.m_attributes[ii] & mask);
+				decl.m_attributes[ii] = attr == 0 ? UINT16_MAX : attr == UINT16_MAX ? 0 : attr;
 			}
 
 			bx::HashMurmur2A murmur;
@@ -2947,7 +2947,7 @@ data.NumQualityLevels = 0;
 
 			if (Attrib::Count != attr)
 			{
-				m_attrMask[attr] = 0xff;
+				m_attrMask[attr] = UINT16_MAX;
 			}
 		}
 

+ 1 - 1
src/renderer_d3d12.h

@@ -183,7 +183,7 @@ namespace bgfx { namespace d3d12
 		ConstantBuffer* m_constantBuffer;
 
 		PredefinedUniform m_predefined[PredefinedUniform::Count];
-		uint8_t m_attrMask[Attrib::Count];
+		uint16_t m_attrMask[Attrib::Count];
 
 		uint32_t m_hash;
 		uint16_t m_numUniforms;

+ 1 - 1
src/renderer_gl.cpp

@@ -3455,7 +3455,7 @@ namespace bgfx { namespace gl
 
 			if (-1 != loc)
 			{
-				if (0xff != _vertexDecl.m_attributes[attr])
+				if (UINT16_MAX != _vertexDecl.m_attributes[attr])
 				{
 					GL_CHECK(glEnableVertexAttribArray(loc) );
 					GL_CHECK(glVertexAttribDivisor(loc, 0) );