Fix for #2822 -- points rendering error on Apple silicon (#3079)

* Add pointsize to SPIRV-Cross output before writing

Adds 
float bgfx_metal_pointSize [[point_size]] = 1;
to xlatMtlMain_out, ensuring that it always has a value.

* Update shaderc_metal.cpp

Only apply patch to vertex shaders
This commit is contained in:
rnbhatt 2023-04-12 13:16:58 -04:00 committed by GitHub
parent c3e3053935
commit fda8a3705f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

View File

@ -638,6 +638,17 @@ namespace bgfx { namespace metal
}
std::string source = msl.compile();
// fix https://github.com/bkaradzic/bgfx/issues/2822
// insert struct member which declares point size, defaulted to 1
if (_options.shaderType == 'v'){
auto findName = "xlatMtlMain_out\n{";
auto pos = source.find(findName);
if (pos != std::string::npos){
pos += strlen(findName);
source.insert(pos, "\n\tfloat bgfx_metal_pointSize [[point_size]] = 1;");
}
}
if ('c' == _options.shaderType)
{