зеркало из https://github.com/AvaloniaUI/angle.git
Vulkan: SPIR-V Gen: Fix crash in array of struct constant
Bug: chromium:1260690 Change-Id: I51fe85a2ebc23c3fcaa3c961c4ebf84688bbed31 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3226309 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
This commit is contained in:
Родитель
9a323cd05e
Коммит
7f87a326e8
|
@ -4835,8 +4835,10 @@ void OutputSPIRVTraverser::visitConstantUnion(TIntermConstantUnion *node)
|
|||
// constructed.
|
||||
if (parentAggregate->isConstructor())
|
||||
{
|
||||
const TStructure *structure = parentAggregate->getType().getStruct();
|
||||
if (structure != nullptr)
|
||||
const TType &parentType = parentAggregate->getType();
|
||||
const TStructure *structure = parentType.getStruct();
|
||||
|
||||
if (structure != nullptr && !parentType.isArray())
|
||||
{
|
||||
expectedBasicType = structure->fields()[childIndex]->type()->getBasicType();
|
||||
}
|
||||
|
|
|
@ -14198,6 +14198,30 @@ void main()
|
|||
ASSERT_GL_NO_ERROR();
|
||||
}
|
||||
|
||||
// Regression test for a crash in SPIR-V output when faced with an array of struct constant.
|
||||
TEST_P(GLSLTest_ES3, ArrayOfStructConstantBug)
|
||||
{
|
||||
constexpr char kFS[] = R"(#version 300 es
|
||||
struct S {
|
||||
int foo;
|
||||
};
|
||||
void main() {
|
||||
S a[3];
|
||||
a = S[3](S(0), S(1), S(2));
|
||||
})";
|
||||
|
||||
GLuint shader = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
|
||||
const char *sourceArray[1] = {kFS};
|
||||
GLint lengths[1] = {static_cast<GLint>(sizeof(kFS) - 1)};
|
||||
glShaderSource(shader, 1, sourceArray, lengths);
|
||||
glCompileShader(shader);
|
||||
|
||||
GLint compileResult;
|
||||
glGetShaderiv(shader, GL_COMPILE_STATUS, &compileResult);
|
||||
EXPECT_NE(compileResult, 0);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
ANGLE_INSTANTIATE_TEST_ES2_AND_ES3_AND(GLSLTest, WithGlslang(ES2_VULKAN()));
|
||||
|
|
Загрузка…
Ссылка в новой задаче