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

Swizzled l-values as output arguments not implemented. #1843

Closed
paulthomson opened this issue Jul 17, 2019 · 2 comments
Closed

Swizzled l-values as output arguments not implemented. #1843

paulthomson opened this issue Jul 17, 2019 · 2 comments

Comments

@paulthomson
Copy link

bug_report.zip

Issue found using GraphicsFuzz.

Tool versions:

  • glslangValidator commit hash: e383c5f

To reproduce:

glslangValidator -V shader.frag -o shader.frag.spv

The following shader files are included in the attached archive, some of which are also shown inline below:

  • 0_glsl/shader.frag

0_glsl/shader.frag:

#version 310 es
precision highp float;

mediump vec4 GLF_dead0gl_FragCoord;

void main()
{
 modf(vec4(1.0), GLF_dead0gl_FragCoord.gabr);
}

@cnorthrop
Copy link
Contributor

We just hit this issue using ANGLE with the Vulkan backend when running OpenGL ES 3.1 conformance tests.

ANGLE bug: https://bugs.chromium.org/p/angleproject/issues/detail?id=4402

deqp tests:

  KHR-GLES31.core.shader_bitfield_operation.frexp.*
  KHR-GLES31.core.shader_bitfield_operation.uaddCarry.*
  KHR-GLES31.core.shader_bitfield_operation.usubBorrow.*
  KHR-GLES31.core.shader_bitfield_operation.umulExtended.*
  KHR-GLES31.core.shader_bitfield_operation.imulExtended.*

Different built-ins, but same assert.

Here's an example shader:

#version 450 core

layout (local_size_x=1, local_size_y=1, local_size_z=1) in;

layout(set=0, binding=0, std430, column_major) buffer _uData
{
    uvec4 _uinUvec4;
    ivec4 _uinIvec4;
    vec4 _uinVec4;
    uvec4 _uin2Uvec4;
    ivec4 _uin2Ivec4;
    vec4 _uin2Vec4;
    int _uoffset;
    int _ubits;
    uvec4 _uoutUvec4;
    ivec4 _uoutIvec4;
    vec4 _uoutVec4;
    uvec4 _uout2Uvec4;
    ivec4 _uout2Ivec4;
    vec4 _uout2Vec4;
};

layout(set=0, binding=1) uniform ANGLEUniformBlock{
    uvec4 acbBufferOffsets;
} ANGLEUniforms;

void main()
{
    (_uoutVec4.xy = frexp(_uinVec4.xy, _uoutIvec4.xy));
}

From the comments, it seems this is missing functionality:

    // If swizzle exists, it is out-of-order or not full, we must load the target vector,
    // extract and insert elements to perform writeMask and/or swizzle.  This does not
    // go with getting a direct l-value pointer.
    assert(accessChain.swizzle.size() == 0);
    assert(accessChain.component == NoResult);

Similar to bug #773 as well.

Let us know if you need any more example shaders.

@johnkslang johnkslang changed the title -V assertion failure: spv::Id spv::Builder::accessChainGetLValue(): Assertion `accessChain.swizzle.size() == 0' failed. Swizzled l-values as output arguments not implemented. Feb 18, 2020
@johnkslang
Copy link
Member

What was missing was the case of built-in function-output parameters to a swizzled argument l-value. SPIR-V cannot represent these and so needs additional instructions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants