* cleanup

remove unused macro parameters

* de-macro CASE_IMPLEMENT_UNIFORM in d3d11, d3d12, mtl, vk

* fix whitespace

* remove undef of macro that was deleted

* collapse switch statements
This commit is contained in:
James Fulop 2021-08-14 06:57:30 -07:00 committed by GitHub
parent e8281f8656
commit 82ed74ddb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 51 deletions

View File

@ -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
}
}

View File

@ -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
}
}

View File

@ -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
}
}

View File

@ -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
}
}