Skip to content

Reject taskPayloadSharedEXT on declarations without a variable - #4450

Merged
dnovillo merged 1 commit into
KhronosGroup:mainfrom
apollo-2006:task-payload-no-variable
Oct 9, 2026
Merged

dnovillo merged 1 commit into
KhronosGroup:mainfrom
apollo-2006:task-payload-no-variable

Conversation

@apollo-2006

Copy link
Copy Markdown
Contributor

Fixes #4004.

taskPayloadSharedEXT struct MyPayload { float x; }; only declares the struct type. declareTypeDefaults didn't look at the storage qualifier there, so it was silently dropped. As in the issue, MyPayload myPayloadData; afterwards is then a plain private global, and EmitMeshTasksEXT(1, 1, 1) compiles to OpEmitMeshTasksEXT %uint_1 %uint_1 %uint_1 with no payload. The same happened for taskPayloadSharedEXT float;.

This reports an error for taskPayloadSharedEXT in declareTypeDefaults, the path for declarations with no variable name:

ERROR: 0:7: 'taskPayloadSharedEXT' : can only be used when declaring a variable

taskPayloadSharedEXT struct P { float x; } p; and taskPayloadSharedEXT MyPayload myPayloadData; still compile, with the payload on OpEmitMeshTasksEXT.

Tests:

  • New spv.ext.meshTaskPayloadNoVariable.error.task covers both forms and fails without the change.
  • glslangtests (2097 tests) and Test/runtests pass.

I kept this to taskPayloadSharedEXT since that's what the issue asks for. While I was in there I noticed shared struct S { float x; }; is silently accepted the same way, and so are uniform and const. I'd be glad to look at those in a separate PR if that would be useful, and of course happy to adjust the wording of the error or move the check if you'd prefer it elsewhere.

A declaration like

    taskPayloadSharedEXT struct MyPayload { float x; };

declares only the struct type, so the qualifier was silently dropped.
A variable of that type declared later is then an ordinary private
global, and OpEmitMeshTasksEXT is generated without a payload operand.

Report an error for taskPayloadSharedEXT on any declaration that
declares no variable.

Fixes KhronosGroup#4004
@CLAassistant

CLAassistant commented Sep 27, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@dnovillo dnovillo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dnovillo
dnovillo merged commit 79c91f3 into KhronosGroup:main Oct 9, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

taskPayloadSharedEXT qualifier misplaced leads to silent issue

3 participants