AaronGhost/glslsmith-bugs-tracker

ANGLE seems to uncorrectly translate swizzles with index acces

AaronGhost opened this issue · 0 comments

Description

A shader trigger an error in the spir-v translation.

#version 310 es

layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
layout(std430, binding = 0) buffer buffer_0 {
 int ext_0[7];
};

void main()
{
  ivec2 var_1[1] = ivec2[1](ivec2(0, 0));
  ext_0[var_1[0].yx[0]] = 1;
}

ANGLE output:

WARN: angle_spirv_utils.cpp:26 (ValidateSpirvMessage): Level2: The type of Vector 1 must be OpTypeVector.
  %28 = OpVectorShuffle %v2int %27 %27 1 0

WARN: angle_spirv_utils.cpp:41 (Validate): Invalid SPIR-V:
; SPIR-V
; Version: 1.0
; Generator: Google ANGLE Shader Compiler; 1
; Bound: 32
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %15 "main"
OpExecutionMode %15 LocalSize 1 1 1
OpSource GLSL 450
OpName %6 "_ubuffer_0"
OpMemberName %6 0 "_uext_0"
OpName %8 ""
OpName %10 "ANGLEUniformBlock"
OpMemberName %10 0 "acbBufferOffsets"
OpName %12 "ANGLEUniforms"
OpName %15 "main"
OpName %23 "_uvar_1"
OpDecorate %5 ArrayStride 4
OpMemberDecorate %6 0 Offset 0
OpDecorate %6 BufferBlock
OpDecorate %8 DescriptorSet 0
OpDecorate %8 Binding 0
OpMemberDecorate %10 0 Offset 0
OpDecorate %10 Block
%2 = OpTypeInt 32 1
%3 = OpTypeInt 32 0
%4 = OpConstant %3 7
%5 = OpTypeArray %2 %4
%6 = OpTypeStruct %5
%9 = OpTypeVector %3 4
%10 = OpTypeStruct %9
%13 = OpTypeVoid
%17 = OpTypeVector %2 2
%18 = OpConstantNull %17
%19 = OpConstant %3 1
%20 = OpTypeArray %17 %19
%21 = OpConstantNull %20
%24 = OpConstant %3 0
%29 = OpConstant %2 1
%7 = OpTypePointer Uniform %6
%11 = OpTypePointer PushConstant %10
%22 = OpTypePointer Function %20
%25 = OpTypePointer Function %2
%30 = OpTypePointer Uniform %2
%14 = OpTypeFunction %13
%8 = OpVariable %7 Uniform
%12 = OpVariable %11 PushConstant
%15 = OpFunction %13 None %14
%16 = OpLabel
%23 = OpVariable %22 Function %21
%26 = OpAccessChain %25 %23 %24 %24
%27 = OpLoad %2 %26
%28 = OpVectorShuffle %17 %27 %27 1 0
%31 = OpAccessChain %30 %8 %24 %28
OpStore %31 %29
OpReturn
OpFunctionEnd

ERR: OutputSPIRV.cpp:6358 (getSpirv): 	! Assert failed in getSpirv (../../src/compiler/translator/OutputSPIRV.cpp:6358): spirv::Validate(result)
FATAL: OutputSPIRV.cpp:6358 (getSpirv): 	! Assert failed in getSpirv (../../src/compiler/translator/OutputSPIRV.cpp:6358): spirv::Validate(result)
Illegal instruction (core dumped)

Code link

For the related code in the shadertrap test format, see: angle/crash/shader33.shadertrap