microsoft / microsoft/DirectXShaderCompiler

[SPIR-V] Assert reached when splatting a vector to a scalar inout param

Open
#6,795 1 comment 0 reactions 1 assignee View on GitHub

@s-perron is already working on this.

Since Jul 17, 2024.

bug spirv
Dominant language
C++
Stars
3.7k
Forks
900
Avg merge
2d 11h
Merged PRs (30d)
44

Description

Follow up from #6747 :

void bar (inout float p) { }

[numthreads(1, 1, 1)]
void main() {
    int3 a = 0;
    bar(a);
}
dxc -T cs_6_6 -E main -spirv -fcgl repro.hlsl
dxc: /home/nathan/projects/mainline/DirectXShaderCompiler/tools/clang/lib/SPIRV/SpirvEmitter.cpp:1364: clang::spirv::SpirvInstruction* clang::spirv::SpirvEmitter::castToType(clang::spirv::SpirvInstruction*, clang::QualType, clang::QualType, clang::SourceLocation, clang::SourceRange): Assertion `isVectorType(fromType, nullptr, &fromSize) == isVectorType(toType, nullptr, &toSize) && fromSize == toSize' failed.
Aborted (core dumped)

Passing a float to a inout float3 function parameter is allowed and only the first float. But seems like if a float3 is passed to a function only taking a inout float, it should be an error.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.