shaderc: Fix getUniformTypeName. (#3580)

This commit is contained in:
Branimir Karadžić
2026-02-04 18:01:52 -08:00
committed by GitHub
parent 011ede6b42
commit e22fac6794
2 changed files with 16 additions and 15 deletions

View File

@@ -133,7 +133,7 @@ CS_BIN = $(addprefix $(BUILD_INTERMEDIATE_DIR)/, $(addsuffix .bin, $(basename $(
BIN = $(VS_BIN) $(FS_BIN) $(CS_BIN) BIN = $(VS_BIN) $(FS_BIN) $(CS_BIN)
ASM = $(VS_ASM) $(FS_ASM) ASM = $(VS_ASM) $(FS_ASM)
ifeq ($(TARGET), $(filter $(TARGET),1 3 4 5 6 7)) ifeq ($(TARGET), $(filter $(TARGET),1 3 4 5 6 7 8))
BIN += $(CS_BIN) BIN += $(CS_BIN)
ASM += $(CS_ASM) ASM += $(CS_ASM)
endif endif

View File

@@ -319,16 +319,6 @@ namespace bgfx
NULL NULL
}; };
const char* s_uniformTypeName[] =
{
"int", "int",
NULL, NULL,
"vec4", "float4",
"mat3", "float3x3",
"mat4", "float4x4",
};
static_assert(BX_COUNTOF(s_uniformTypeName) == UniformType::Count*2);
static const char* s_allowedVertexShaderInputs[] = static const char* s_allowedVertexShaderInputs[] =
{ {
"a_position", "a_position",
@@ -471,7 +461,8 @@ namespace bgfx
{ {
return "linear"; return "linear";
} }
else if (0 == bx::strCmp(_glsl, "flat") )
if (0 == bx::strCmp(_glsl, "flat") )
{ {
return "nointerpolation"; return "nointerpolation";
} }
@@ -479,12 +470,22 @@ namespace bgfx
return _glsl; // centroid, noperspective return _glsl; // centroid, noperspective
} }
const char* s_uniformTypeName[] =
{
"int", "int",
NULL, NULL,
"vec4", "float4",
"mat3", "float3x3",
"mat4", "float4x4",
};
static_assert(BX_COUNTOF(s_uniformTypeName) == UniformType::Count*2);
const char* getUniformTypeName(UniformType::Enum _enum) const char* getUniformTypeName(UniformType::Enum _enum)
{ {
uint32_t idx = _enum & ~(kUniformFragmentBit|kUniformSamplerBit); const uint32_t idx = _enum & ~(kUniformFragmentBit|kUniformSamplerBit);
if (idx < UniformType::Count) if (idx < UniformType::Count)
{ {
return s_uniformTypeName[idx]; return s_uniformTypeName[idx*2+0];
} }
return "Unknown uniform type?!"; return "Unknown uniform type?!";