Repository navigation
Description
Description
I'm using Vulkan + HLSL workflow. After editing shader in RenderDoc and press compile there is a compilation error:
Running "D:/Development/VulkanSDK/1.3.290.0/Bin/dxc.exe" -T ps_6_0 -E PS -spirv -fspv-target-env=vulkan1.1 -Fo C:/Users/Goshido/AppData/Local/Temp/shader_output C:/Users/Goshido/AppData/Local/Temp/shader_input
error: missing entry point definition
Process crashed with code -2147467259.
Output file is 0 bytesI also noticed that SPIR-V blobs produced by DXC v1.8.2407.10013 a2a220bc616ca28848ec0af77ad33a09f92fa43a showed exactly the same compilation flag information in RenderDoc:
-T {hlsl_stage2}_6_0 -E {entry_point} -spirv -fspv-target-env={vulkan_ver} -E PS -T ps_6_8 -HV 2021 -spirv
-fvk-use-dx-layout -fspv-reduce-load-size -fspv-target-env=vulkan1.1 -enable-16bit-types -WX -I tools\editor\hlsl
-I tools\editor\include -I app\src\main\hlsl -I app\src\main\cpp\include\pbr -Od -fspv-debug=vulkan-with-source
-Fo tools\editor\editor-assets\shaders\blit.ps.spv -Qembed_debugNow SPIR-V blobs compiled by recent DXC v1.8.2407.10091 75ff50caa046a054747ae15b5c1910a4c8aa1917 shows less information:
-T {hlsl_stage2}_6_0 -E {entry_point} -spirv -fspv-target-env={vulkan_ver}Steps to Reproduce
- Take the following shader code:
blit_program.ps:
#include "blit_program.inc"
#include "color_space.ps"
#include "srgb_program.inc"
// 1.0H / 2.4H
#define INVERSE_GAMMA 4.16667e-1F
[[vk::constant_id ( CONST_INVERSE_GAMMA )]]
float const g_inverseGamma = INVERSE_GAMMA;
[[vk::binding ( BIND_IMAGE, SET_BLIT )]]
Texture2D<float32_t4> g_image: register ( t0 );
[[vk::binding ( BIND_SAMPLER, SET_BLIT )]]
SamplerState g_sampler: register ( s0 );
struct InputData
{
[[vk::location ( ATT_SLOT_UV )]]
noperspective float32_t2 _uv: UV;
};
//----------------------------------------------------------------------------------------------------------------------
float32_t4 PS ( in InputData inputData ): SV_Target0
{
float16_t3 const color = (float16_t3)g_image.SampleLevel ( g_sampler, inputData._uv, 0.0F ).xyz;
return float32_t4 ( LinearToSRGB ( color, (float16_t)g_inverseGamma ), 1.0F );
}color_space.ps:
#ifndef COLOR_SPACE_PS
#define COLOR_SPACE_PS
float32_t3 LinearToSRGB ( in float16_t3 ldr, in float16_t inverseGamma )
{
// See https://entropymine.com/imageworsener/srgbformula/
float16_t3 const a = ldr * 12.92H;
float16_t3 const b = 1.055H * pow ( ldr, inverseGamma ) - 0.055H;
return (float32_t3)lerp ( a, b, (float16_t3)( ldr > 3.1308e-3H ) );
}
#endif // COLOR_SPACE_PSblit_program.inc:
#ifndef BLIT_PROGRAM_INC
#define BLIT_PROGRAM_INC
#define ATT_SLOT_UV 0
#define SET_BLIT 0
#define BIND_IMAGE 0
#define BIND_SAMPLER 1
#endif // BLIT_PROGRAM_INCsrgb_program.inc:
#ifndef SRGB_PROGRAM_INC
#define SRGB_PROGRAM_INC
#define CONST_INVERSE_GAMMA 0
#endif // SRGB_PROGRAM_INC- Compile it with the following flags:
dxc.exe ^
-HV 2021 ^
-spirv ^
-fvk-use-dx-layout ^
-fspv-reduce-load-size ^
-fspv-target-env=vulkan1.1 ^
-enable-16bit-types ^
-WX ^
-I tools\editor\hlsl ^
-I tools\editor\include ^
-I app\src\main\hlsl ^
-I app\src\main\cpp\include\pbr ^
-Od ^
-fspv-debug=vulkan-with-source ^
-E PS ^
-T ps_6_8 ^
-Fo tools\editor\editor-assets\shaders\blit.ps.spv ^
tools\editor\hlsl\blit.ps- Use this program and made capture.
- Try to edit program
blit_program.psby multiplyingcolorvariable by0.5H.
...
float32_t4 PS ( in InputData inputData ): SV_Target0
{
float16_t3 const color = (float16_t3)g_image.SampleLevel ( g_sampler, inputData._uv, 0.0F ).xyz;
return float32_t4 ( LinearToSRGB ( color * 0.5H, (float16_t)g_inverseGamma ), 1.0F ); <--------------------------
}- Press apply changes.
Actual Behavior
Compilation fails:
Running "D:/Development/VulkanSDK/1.3.290.0/Bin/dxc.exe" -T ps_6_0 -E PS -spirv
-fspv-target-env=vulkan1.1 -Fo C:/Users/Goshido/AppData/Local/Temp/shader_output
C:/Users/Goshido/AppData/Local/Temp/shader_input
error: missing entry point definition
Process crashed with code -2147467259.
Output file is 0 bytesExpected: Compilation success.
Would you kindly help?
Environment
git submodule update --inithas been invoked before buildhctbuildbuild parameters:-official -rel -x64 -vs2022 -speak-up -no-dxilconv -spirv- Visual Studio 2022 Community components were up to date.
- Windows 11 Pro (23H2, Build 22631.4169)
dxc.exev1.8.2407.10091 executable, commit SHA-175ff50caa046a054747ae15b5c1910a4c8aa1917- RenderDoc v1.35
Additional information
Here is blobs from old and new DXC: SPIR-V blobs.zip.
The video with problem:
RenderDoc.v1.35-Issue-001.mp4
Initially I created issue for RenderDoc: #3448. Issue has been closed because it's not RenderDoc issue in the first place.
Metadata
Metadata
Assignees
Type
Projects
- StatusShow more project fieldsDone
- StatusShow more project fieldsTriaged
Activity
s-perron commentedon Oct 2, 2024
The main difference between the "good" version and the "bad" version is that the "bad" version now includes the
DebugSourcefor two files that were not included before. I personally do not see any problems with the debug instructions.It could be that there is a new code pattern that renderdoc is not use to. Without know the details on where renderdoc is failing, I cannot know how the source should be changed. I've asked someone else who know more about the debug instructions to look at it.
Goshido commentedon Oct 2, 2024
Roger. I gonna notify Baldur Karlsson (@baldurk) . Maybe he could help to resolve the issue.
baldurk commentedon Oct 2, 2024
I diffed the blobs and aside from noise with SSA values the problem shows up immediately for me. Yes there are new
DebugSourceand associated instructions, but the blob underDXC 1.8.2407.10091 75ff50is missingDebugFunctionDefinitionwhich is present in the blob underDXC 1.8.2407.10013 a2a220bc6.Without this instruction the information in
DebugEntrywhich refers to theDebugFunctioncan be tied to the actualOpFunction/OpEntryPointso the command line is missing.The debuginfo spec explicitly calls out that this is necessary for entry points:
s-perron commentedon Oct 2, 2024
FYI: Steve Urquhart (@SteveUrquhart)
s-perron commentedon Oct 4, 2024
This is a regression caused by #6758.
DXC generates two function based on the entry point in the HLSL. One is
src_<name>. This is the actual code from the HLSL, but it is not the entry point from the spir-v perspective. DXC will wrap this function inside another one call<name>, which is the real entry point. Its purpose is to connect the SPIR-V interface with the HLSL interface. For example, in HLSL inputs are parameters to the function, but in SPIR-V they are global variables.Before that commit, we correctly generated the
DebugFunctionDefinitionin the wrapper. After that commit, theDebugFunctionDefinitionis generated insrc_<name>. Thensrc_<name>gets inlined, and when the function is deleted, the debug information for it is deleted. That is how we end up with noDebugFunctionDefinition.As Baldur Karlsson (@baldurk) pointed out, the spec mandates that
DebugFunctionDefinitionmust be in the real entry point. I think we need to revert #6758. I'll talk to Steve Urquhart (@SteveUrquhart) about that.s-perron commentedon Oct 8, 2024
A fix should be coming soon.
SteveUrquhart commentedon Oct 14, 2024
This is fixed by #6966, sorry for the regression.
Goshido commentedon Nov 20, 2024
I tested the latest DXC version 1.8.2407.10115,
9b9442cd86c242aa0c030be3beea0fb1d0df7a1f. The issue with missing shader editing feature is gone. Thx! 👍The issue could be closed.
Update submodules: DirectX-Headers to 61c77189, SPIRV-Headers to 5c60…
Update submodules: DirectX-Headers to 61c77189, SPIRV-Headers to 5c60…
Update submodules: DirectX-Headers to 61c77189, SPIRV-Headers to fb13…