diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index 8c7094094..25474514c 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -3367,18 +3367,10 @@ namespace bgfx { namespace d3d11 data = (const char*)m_uniforms[handle.idx]; } -#define CASE_IMPLEMENT_UNIFORM(_uniform, _dxsuffix, _type) \ - case UniformType::_uniform: \ - case UniformType::_uniform|kUniformFragmentBit: \ - { \ - setShaderUniform(uint8_t(type), loc, data, num); \ - } \ - break; - switch ( (uint32_t)type) { case UniformType::Mat3: - case UniformType::Mat3|kUniformFragmentBit: \ + case UniformType::Mat3|kUniformFragmentBit: { float* value = (float*)data; for (uint32_t ii = 0, count = num/3; ii < count; ++ii, loc += 3*16, value += 9) @@ -3401,9 +3393,16 @@ namespace bgfx { namespace d3d11 } break; - CASE_IMPLEMENT_UNIFORM(Sampler, I, int); - CASE_IMPLEMENT_UNIFORM(Vec4, F, float); - CASE_IMPLEMENT_UNIFORM(Mat4, F, float); + case UniformType::Sampler: + case UniformType::Sampler | kUniformFragmentBit: + case UniformType::Vec4: + case UniformType::Vec4 | kUniformFragmentBit: + case UniformType::Mat4: + case UniformType::Mat4 | kUniformFragmentBit: + { + setShaderUniform(uint8_t(type), loc, data, num); + } + break; case UniformType::End: break; @@ -3412,7 +3411,6 @@ namespace bgfx { namespace d3d11 BX_TRACE("%4d: INVALID 0x%08x, t %d, l %d, n %d, c %d", _uniformBuffer.getPos(), opcode, type, loc, num, copy); break; } -#undef CASE_IMPLEMENT_UNIFORM } } diff --git a/src/renderer_d3d12.cpp b/src/renderer_d3d12.cpp index 6dec7b342..26330ec54 100644 --- a/src/renderer_d3d12.cpp +++ b/src/renderer_d3d12.cpp @@ -3173,14 +3173,6 @@ namespace bgfx { namespace d3d12 data = (const char*)m_uniforms[handle.idx]; } -#define CASE_IMPLEMENT_UNIFORM(_uniform, _dxsuffix, _type) \ - case UniformType::_uniform: \ - case UniformType::_uniform|kUniformFragmentBit: \ - { \ - setShaderUniform(uint8_t(type), loc, data, num); \ - } \ - break; - switch ( (uint32_t)type) { case UniformType::Mat3: @@ -3207,9 +3199,16 @@ namespace bgfx { namespace d3d12 } break; - CASE_IMPLEMENT_UNIFORM(Sampler, I, int); - CASE_IMPLEMENT_UNIFORM(Vec4, F, float); - CASE_IMPLEMENT_UNIFORM(Mat4, F, float); + case UniformType::Sampler: + case UniformType::Sampler | kUniformFragmentBit: + case UniformType::Vec4: + case UniformType::Vec4 | kUniformFragmentBit: + case UniformType::Mat4: + case UniformType::Mat4 | kUniformFragmentBit: + { + setShaderUniform(uint8_t(type), loc, data, num); + } + break; case UniformType::End: break; @@ -3218,7 +3217,6 @@ namespace bgfx { namespace d3d12 BX_TRACE("%4d: INVALID 0x%08x, t %d, l %d, n %d, c %d", _uniformBuffer.getPos(), opcode, type, loc, num, copy); break; } -#undef CASE_IMPLEMENT_UNIFORM } } diff --git a/src/renderer_mtl.mm b/src/renderer_mtl.mm index 690e43fd3..0dfa6e9e8 100644 --- a/src/renderer_mtl.mm +++ b/src/renderer_mtl.mm @@ -1451,14 +1451,6 @@ namespace bgfx { namespace mtl data = (const char*)m_uniforms[handle.idx]; } -#define CASE_IMPLEMENT_UNIFORM(_uniform, _dxsuffix, _type) \ - case UniformType::_uniform: \ - case UniformType::_uniform|kUniformFragmentBit: \ - { \ - setShaderUniform(uint8_t(type), loc, data, num); \ - } \ - break; - switch ( (uint32_t)type) { case UniformType::Mat3: @@ -1485,9 +1477,16 @@ namespace bgfx { namespace mtl } break; - CASE_IMPLEMENT_UNIFORM(Sampler, I, int); - CASE_IMPLEMENT_UNIFORM(Vec4, F, float); - CASE_IMPLEMENT_UNIFORM(Mat4, F, float); + case UniformType::Sampler: + case UniformType::Sampler | kUniformFragmentBit: + case UniformType::Vec4: + case UniformType::Vec4 | kUniformFragmentBit: + case UniformType::Mat4: + case UniformType::Mat4 | kUniformFragmentBit: + { + setShaderUniform(uint8_t(type), loc, data, num); + } + break; case UniformType::End: break; @@ -1496,9 +1495,6 @@ namespace bgfx { namespace mtl BX_TRACE("%4d: INVALID 0x%08x, t %d, l %d, n %d, c %d", _uniformBuffer.getPos(), opcode, type, loc, num, copy); break; } - -#undef CASE_IMPLEMENT_UNIFORM - } } diff --git a/src/renderer_vk.cpp b/src/renderer_vk.cpp index d4268ef77..0d568f3c6 100644 --- a/src/renderer_vk.cpp +++ b/src/renderer_vk.cpp @@ -4057,14 +4057,6 @@ VK_IMPORT_DEVICE data = (const char*)m_uniforms[handle.idx]; } -#define CASE_IMPLEMENT_UNIFORM(_uniform, _dxsuffix, _type) \ - case UniformType::_uniform: \ - case UniformType::_uniform|kUniformFragmentBit: \ - { \ - setShaderUniform(uint8_t(type), loc, data, num); \ - } \ - break; - switch ( (uint32_t)type) { case UniformType::Mat3: @@ -4095,9 +4087,15 @@ VK_IMPORT_DEVICE case UniformType::Sampler|kUniformFragmentBit: // do nothing, but VkDescriptorSetImageInfo would be set before drawing break; -// CASE_IMPLEMENT_UNIFORM(Sampler, I, int); - CASE_IMPLEMENT_UNIFORM(Vec4, F, float); - CASE_IMPLEMENT_UNIFORM(Mat4, F, float); + + case UniformType::Vec4: + case UniformType::Vec4 | kUniformFragmentBit: + case UniformType::Mat4: + case UniformType::Mat4 | kUniformFragmentBit: + { + setShaderUniform(uint8_t(type), loc, data, num); + } + break; case UniformType::End: break; @@ -4106,7 +4104,6 @@ VK_IMPORT_DEVICE BX_TRACE("%4d: INVALID 0x%08x, t %d, l %d, n %d, c %d", _uniformBuffer.getPos(), opcode, type, loc, num, copy); break; } -#undef CASE_IMPLEMENT_UNIFORM } }