http://bugs.winehq.org/show_bug.cgi?id=59687 Bug ID: 59687 Summary: 'const' variable modifier causes null return-value in vertex shader Product: Wine Version: 11.6 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: d3d Assignee: wine-bugs@list.winehq.org Reporter: bczhc0@126.com Distribution: --- Created attachment 80789 --> http://bugs.winehq.org/attachment.cgi?id=80789 trace-ok.log Take this HLSL code which basically is a hello-triangle. ```hlsl struct VsOut { float4 pos : SV_Position; }; static const float2 VERTICES[3] = { float2(0.0, 0.5), float2(-0.5, -0.5), float2(0.5, -0.5) }; static const float4 RED = float4(1.0, 0.0, 0.0, 1.0); VsOut vs_main(uint vid : SV_VertexID) { float2 position = VERTICES[min(vid, 2u)]; VsOut output = { float4(position, 0.0, 1.0) }; return output; } float4 fs_main() : SV_Target { return RED; } ``` I have this wgpu program: https://gist.github.com/bczhc/e8d11db2280ffd20fee43fb1fed7410e to run and render this shader. (Sorry I'm not familiar with hlsl and windows programming so I just now only able to write the wgpu program to demonstrate it and suppose it may not be related to wgpu anyway) To compile and run it, do: ```bash # ensure to put it in a cargo project first cargo build --target x86_64-pc-windows-gnu # run WINEPREFIX=`pwd`/prefix WGPU_BACKEND=dx12 wine target/x86_64-pc-windows-gnu/debug/demo.exe the-hlsl-above.hlsl vs_main ``` It will display a red triangle. However, modify this line `VsOut output = { float4(position, 0.0, 1.0) };` to `const VsOut output = { float4(position, 0.0, 1.0) };`, then compile the Rust program then run it using wine again, the red triangle will not show. Or, if that line is left as is but you add another const variable, like this: ```hlsl VsOut vs_main(uint vid : SV_VertexID) { float2 position = VERTICES[min(vid, 2u)]; VsOut output = { float4(position, 0.0, 1.0) }; const VsOut output1 = output; return output1; } ``` The red triangle is also not able to display. This is originally reported as a wgpu issue here: https://github.com/gfx-rs/wgpu/issues/9056. At that time, only proton has this issue (wine is okay). However now with wine 11.6 I tested it again, wine has this issue either. So I suspect this is an upstream vkd3d hlsl compiler issue then? I haven't done the bisect yet because I haven't managed how to properly compile this project and substitute it for wine. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.