Skip to content

Assert when using spirv_literal parameter in spirv_instruction with set #4317

Description

@rdb

Using spirv_instruction(set=) (from GL_EXT_spirv_intrinsics) with a spirv_literal parameter results in an assertion error, whereas the spec doesn't specifically forbid this combination. I first thought this was a spec oversight and that only ids were allowed, but according to extension author @Tobski (see KhronosGroup/GLSL#330) it is intended to be allowed.

#version 450

#extension GL_EXT_spirv_intrinsics : enable

spirv_instruction(set = "GLSL.std.450", id = 1)
vec4 testExtInst(vec4 x, spirv_literal int lit);

layout(location = 0) in vec4 vecIn;
layout(location = 1) out vec4 vecOut;

void main()
{
    vecOut = testExtInst(vecIn, 1);
}

Run:

glslang -V --target-env vulkan1.0 test.vert

Result:

glslang: SPIRV/spvIR.h:110: void spv::Instruction::addIdOperand(spv::Id): Assertion `id' failed.
Aborted (core dumped)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions