mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-11 23:54:18 +00:00
Added a shader workaround for GPUs on older Android devices
This commit is contained in:
parent
501d7299a6
commit
2e08db47ff
1 changed files with 27 additions and 2 deletions
|
|
@ -81,8 +81,33 @@ String OpenGLHelpers::translateVertexShaderToV3 (const String& code)
|
|||
{
|
||||
#if JUCE_OPENGL3
|
||||
if (OpenGLShaderProgram::getLanguageVersion() > 1.2)
|
||||
return JUCE_GLSL_VERSION "\n" + code.replace ("attribute", "in")
|
||||
.replace ("varying", "out");
|
||||
{
|
||||
String output;
|
||||
|
||||
#if JUCE_ANDROID
|
||||
{
|
||||
int numAttributes = 0;
|
||||
|
||||
for (int p = code.indexOf (0, "attribute "); p >= 0; p = code.indexOf (p + 1, "attribute "))
|
||||
numAttributes++;
|
||||
|
||||
int last = 0;
|
||||
|
||||
for (int p = code.indexOf (0, "attribute "); p >= 0; p = code.indexOf (p + 1, "attribute "))
|
||||
{
|
||||
output += code.substring (last, p) + String ("layout(location=") + String (--numAttributes) + ") in ";
|
||||
|
||||
last = p + 10;
|
||||
}
|
||||
|
||||
output += code.substring (last);
|
||||
}
|
||||
#else
|
||||
output = code.replace ("attribute", "in");
|
||||
#endif
|
||||
|
||||
return JUCE_GLSL_VERSION "\n" + output.replace ("varying", "out");
|
||||
}
|
||||
#endif
|
||||
|
||||
return code;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue