Skip to content

Commit 93857b7

Browse files
committed
[SPIR-V] Add payload to OpEmitMeshTasksEXT
This commit fixes the missing payload parameter for the OpEmitMeshTasksEXT instruction. Errors such as the passed variable storage class or type are already tested. Fixes #7082 Co-Authored-By: baldurk@baldurk.org
1 parent d72e2b1 commit 93857b7

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

tools/clang/lib/SPIRV/SpirvEmitter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13012,15 +13012,15 @@ void SpirvEmitter::processDispatchMesh(const CallExpr *callExpr) {
1301213012
: spv::StorageClass::Output;
1301313013
auto *payloadArg = doExpr(args[3]);
1301413014
bool isValid = false;
13015-
const VarDecl *param = nullptr;
13015+
SpirvInstruction *param = nullptr;
1301613016
if (const auto *implCastExpr = dyn_cast<CastExpr>(args[3])) {
1301713017
if (const auto *arg = dyn_cast<DeclRefExpr>(implCastExpr->getSubExpr())) {
1301813018
if (const auto *paramDecl = dyn_cast<VarDecl>(arg->getDecl())) {
1301913019
if (paramDecl->hasAttr<HLSLGroupSharedAttr>()) {
1302013020
isValid = declIdMapper.createPayloadStageVars(
1302113021
sigPoint, sc, paramDecl, /*asInput=*/false, paramDecl->getType(),
1302213022
"out.var", &payloadArg);
13023-
param = paramDecl;
13023+
param = declIdMapper.getDeclEvalInfo(paramDecl, paramDecl->getLocation());
1302413024
}
1302513025
}
1302613026
}
@@ -13037,7 +13037,7 @@ void SpirvEmitter::processDispatchMesh(const CallExpr *callExpr) {
1303713037

1303813038
if (featureManager.isExtensionEnabled(Extension::EXT_mesh_shader)) {
1303913039
// for EXT_mesh_shader, create opEmitMeshTasksEXT.
13040-
spvBuilder.createEmitMeshTasksEXT(threadX, threadY, threadZ, loc, nullptr,
13040+
spvBuilder.createEmitMeshTasksEXT(threadX, threadY, threadZ, loc, param,
1304113041
range);
1304213042
} else {
1304313043
// for NV_mesh_shader, set TaskCountNV = threadX * threadY * threadZ.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// RUN: %dxc -E main -T as_6_8 -spirv %s -E main -fspv-target-env=vulkan1.1spirv1.4 | FileCheck %s
2+
3+
struct S {
4+
uint a;
5+
};
6+
7+
groupshared S s;
8+
// CHECK: %s = OpVariable {{.*}} TaskPayloadWorkgroupEXT
9+
10+
[numthreads(1, 1, 1)]
11+
void main()
12+
{
13+
// CHECK: OpEmitMeshTasksEXT %uint_1 %uint_1 %uint_1 %s
14+
DispatchMesh(1, 1, 1, s);
15+
}

0 commit comments

Comments
 (0)