Skip to content

[naga] Improve ForbiddenStageOperations error reporting for textureSample in Compute stage #6512

Open
@DavidPeicho

Description

Description

Using naga to convert a GLSL file using forbidden texture builtin in compute stage leads to a generic:

error: Entry point main at Compute is invalid
= Uses operations forbidden at this stage

Repro steps

Convert this glsl input with naga:

#version 440 core

layout(set = 0, binding = 0) uniform texture2D tex;
layout(set = 0, binding = 1) uniform sampler samp;

layout(local_size_x = 8, local_size_y = 8) in;
void
main()
{
  vec4 data = texture(sampler2D(tex, samp), vec2(0.0, 1.0));
}

Expected behavior

An error message stating that textureSample are forbidden in Compute stages, as written in the WGSL spec: https://www.w3.org/TR/WGSL/#texturesample

Current behavior

error: Entry point main at Compute is invalid
= Uses operations forbidden at this stage

Platform

MacOS, wgpu 23

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: validationIssues related to validation, diagnostics, and error handlingkind: diagnosticsError message should be better

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions