Skip to content

Commit

Permalink
WebGL fails to compile shaders with out variables that are arrays and…
Browse files Browse the repository at this point in the history
… start with underscore

rdar://126944294

Reviewed by Chris Dumez.

Integrates upstream commit:
commit e0e91b8cbb2e096d2d009cd0d1fbe20d785f2263
Author: Kimmo Kinnunen <kkinnunen@apple.com>
Date:   Mon Apr 22 18:11:30 2024 -0700
Metal: Fix rewritten out variables with underscores

Fix compilation in case of output variables start with underscores.
Make name emission always emit MSL name ANGLE_{name}, so that GLSL `_e`
and `e` cannot clash. This regressed in angleproject:8558.

Bug: b/335744344
Change-Id: Ibae4dba4a24888acc1461582e69d48218ba11176

Originally-landed-as: bce91c8033e3. rdar://128091308
Canonical link: https://commits.webkit.org/278880@main
  • Loading branch information
kkinnunen-apple authored and robert-jenner committed May 16, 2024
1 parent 9bf347a commit d3ad1d8
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions Source/ThirdParty/ANGLE/src/tests/gl_tests/GLSLTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19201,36 +19201,6 @@ void main()
EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::green);
}

// Test that struct declarations are introduced into the correct scope.
TEST_P(GLSLTest, NestedReturnedStructs)
{
const char kFragmentShader[] = R"(precision mediump float;
struct Foo { float v; } foo(float bar);

void main()
{
gl_FragColor = vec4(1, 0, 0, 1);
float v = foo(foo(0.5).v).v;
if (v == 0.5)
{
gl_FragColor = vec4(0, 1, 0, 1);
}
}

Foo foo(float bar)
{
Foo f;
f.v = bar;
return f;
})";

ANGLE_GL_PROGRAM(program, essl1_shaders::vs::Simple(), kFragmentShader);
glUseProgram(program);

drawQuad(program, essl1_shaders::PositionAttrib(), 0.5f, 1.0f, true);
EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::green);
}

// Test that underscores in array names work with out arrays.
TEST_P(GLSLTest_ES3, UnderscoresWorkWithOutArrays)
{
Expand Down

0 comments on commit d3ad1d8

Please sign in to comment.