microsoft / microsoft/DirectXShaderCompiler

[SPIR-V] Fix bug using `Texture2D` with alias template for `SpirvType`

Open
#6,498 2 comments 0 reactions 1 assignee View on GitHub

@cassiebeckley is already working on this.

Since Apr 4, 2024.

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

Description

Description
For the (currently unmerged) SpirvType PR, Texture2D (and presumably other built-in types) cannot be used as an argument to an alias template for SpirvType

Steps to Reproduce

Compile

template<typename SomeType, uint Length>
using Array = vk::SpirvOpaqueType</* OpTypeArray */ 28, SomeType, vk::integral_constant<uint, Length> >;

void main() {
  Array<Texture2D, 4> image;
}

With the command

dxc -T ps_6_0 -E main -spirv

Actual Behavior
Error:

foo.hlsl:2:1: error: 'Texture2D<vector<float, 4> >' is an object and cannot be used as a type parameter
using Array = vk::SpirvOpaqueType</* OpTypeArray */ 28, SomeType, vk::integral_constant<uint, Length> >;
^
foo.hlsl:5:3: note: in instantiation of template type alias 'Array' requested here
  Array<Texture2D, 4> image;
  ^

Environment

  • DXC version libdxcompiler.so: 1.8(dev;4545-a97b48a5) (development version of #6156)
  • Host Operating System Linux

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.