Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix shader compile with metal in case decimal separator is comma #3467

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions pxr/imaging/hgiInterop/metal.mm
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,15 @@
// Determine if GLSL version 140 is supported by this context.
// We'll use this info to generate a GLSL shader source string
// with the proper version preprocessor string prepended
float glLanguageVersion;

sscanf((char *)glGetString(GL_SHADING_LANGUAGE_VERSION), "%f",
&glLanguageVersion);
int majorVersion = 0, minorVersion = 0;
sscanf((char *)glGetString(GL_SHADING_LANGUAGE_VERSION), "%d.%d",
&majorVersion, &minorVersion);
GLchar const * const versionTemplate = "#version %d\n";

// GL_SHADING_LANGUAGE_VERSION returns the version standard version form
// with decimals, but the GLSL version preprocessor directive simply
// uses integers (thus 1.10 should 110 and 1.40 should be 140, etc.)
// We multiply the floating point number by 100 to get a proper
// number for the GLSL preprocessor directive
GLuint version = 100 * glLanguageVersion;
GLuint version = 100 * majorVersion + minorVersion;

// Prepend our vertex shader source string with the supported GLSL version
// so the shader will work on ES, Legacy, and OpenGL 3.2 Core Profile
Expand Down