microsoft / microsoft/DirectXShaderCompiler

"found unregistered decl" when compiling partial template specialization for SPIR-V

Open
#5,563 1 comment 1 reaction 1 assignee View on GitHub

@cassiebeckley is already working on this.

Since Sep 5, 2023.

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

Description

Description
Got message with request for new bug report during development for SPIR-V using HLSL 2021 features. Reduced reproduction to a small snippet with partial template specialization.

Steps to Reproduce
Shader Playground link: https://shader-playground.timjones.io/d89cc1395544165f3afe124c26429752
Compiling with -spirv -HV 2021

template <
   bool PARAM1,
   bool PARAM2>
struct TEST_STRUCT{};


template <bool PARAM1>
struct TEST_STRUCT<PARAM1, true> {
   static const bool FIELD = PARAM1;
};

struct PSInput
{
	float4 color : COLOR;
};

float4 PSMain(PSInput input) : SV_TARGET
{
	bool test = TEST_STRUCT<true, true>::FIELD;
	return input.color;
}

Actual Behavior

C:\local\Temp\3c0b2c72-ea2c-4f3d-b4fe-87dad7782596.hlsl:7:16: fatal error: found unregistered decl
template
^
note: please file a bug report on https://github.com/Microsoft/DirectXShaderCompiler/issues with source code if possible

Environment

  • DXC version: 1.7 - 1.7.0.3939 (5e080a772)
  • Host Operating System: Windows 10/Shader Playground

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.