Dug through the functions and found where the shader compilation failure is occurring in the latest versions.
source/GcLib/directx/HLSL.cpp:RenderShaderLibrary::Initialize:449
D3DXCreateEffect.wine/dlls/d3dx9_36/effect.c:D3DXCreateEffect:6748
wine/dlls/d3dx9_36/effect.c:D3DXCreateEffectEx:6725wine/dlls/d3dx9_36/effect.c:d3dx9_effect_init:6650
"fx_2_0" is passed as target.wine/dlls/d3dcompiler_43/compiler.c:D3DCompile:596
target ("fx_2_0") is passed as profile.wine/dlls/d3dcompiler_43/compiler.c:D3DCompile2:535
compile_info.target_type is set to VKD3D_SHADER_TARGET_DXBC_TPF.compile_info.next is set to &preprocess_info.preprocess_info.next is set to &hlsl_infohlsl_info.type is set to VKD3D_SHADER_STRUCTURE_TYPE_HLSL_SOURCE_INFO.hlsl_info.profile is set to profile ("fx_2_0")&compile_info is passed as compile_info.vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c:vkd3d_shader_compile:1703
compile_info is passed as compile_info.vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c:compile_hlsl:1673
compile_info is passed as compile_infovkd3d/libs/vkd3d-shader/hlsl.c:hlsl_compile_shader:4382
target_type is set to compile_info->target_type.hlsl_source_info is set to vkd3d_find_struct(compile_info->next, HLSL_SOURCE_INFO), which goes through the linked list of compile_info->next until it finds a struct where member type is VKD3D_SHADER_STRUCTURE_TYPE_HLSL_SOURCE_INFO. This results in returning hlsl_info from the D3DCompile2 level.profile is set to hlsl_get_target_info(hlsl_source_info->profile). This returns the struct in hlsl_profile_info profiles related to hlsl_info.profile from the D3DCompile2 level.target_type != VKD3D_SHADER_TARGET_FX && profile->type == VKD3D_SHADER_TYPE_EFFECT is met, as target_type is VKD3D_SHADER_TARGET_DXBC_TPF and profile->type is VKD3D_SHADER_TYPE_EFFECT, resulting in the error.It seems that because the Wine repository is using vkd3d 1.10 where VKD3D_SHADER_TARGET_FX didn't exist yet, there's a mismatch between what Proton's Wine and vkd3d expect for compiling D3D effects, resulting in compile_info.target_type being set improperly.
Tested with the only changes being vkd3d being version 1.10 and commit e527d7c (the commit right before adding VKD3D_SHADER_TARGET_FX). The error is exactly the same as when testing with Proton versions up to 8.0-5, regarding an unexpected ':'.
Dug through vkd3d and found that the other error is a bug in its HLSL lexer.
This bug has already been fixed in Wine's GitLab repository. These changes should be mirrored ASAP so that Proton bleeding-edge can benefit from them.
The following is a technical explanation of why the bug currently affects this game.
Microsoft's documentation about Direct3D HLSL variable syntax indicates it is:
[Storage_Class] [Type_Modifier] Type Name[Index] [: Semantic] [: Packoffset] [: Register]; [Annotations] [= Initial_Value]
Of note are the parts for Semantic, Packoffset, and Register, known as the attributes. Nowhere on this page is it suggested that multiple attributes can't be used.
However, vkd3d's lexer, when encountering a variable declaration, deduces the following in libs/vkd3d-shader/hlsl.y:
hlsl_prog -> hlsl_prog declaration_statementdeclaration_statement -> declarationdeclaration -> variables_def_typed ';'variables_def_typed -> variable_def_typed | variables_def_typed ',' variable_defvariable_def_typed -> var_modifiers type variable_defvariable_def -> variable_declvariable_decl -> any_identifier arrays colon_attribute annotations_optcolon_attribute -> %empty | semantic | register_reservation | packoffset_reservationNone of the options for colon_attribute account for the possibility of more attributes, leaving the lexer to expect either a colon for variables_def_typed ',' variable_def to complete variables_def_typed, or a semicolon for variables_def_typed ';' to complete declaration.
This explains the error message for this game, since the _HLSL_INTERNAL_RENDER2D shader contains this statement:
float4x4 g_mWorld : WORLD : register(c0);
The lexer for vkd3d is expecting a semicolon or comma after the semantic attribute WORLD, hence the error: syntax error, unexpected ':', expecting ';' or ','.
It seems that because the Wine repository is using vkd3d 1.10 where
VKD3D_SHADER_TARGET_FXdidn't exist yet, there's a mismatch between what Proton's Wine and vkd3d expect for compiling D3D effects, resulting incompile_info.target_typebeing set improperly.
Similarly to vkd3d, Wine's GitLab repository has updated to vkd3d 1.13 (according to the commit messages, but config.h suggests it's still 1.12) and properly uses VKD3D_SHADER_TARGET_FX.
I attempted to cherry-pick the relevant changes to get a successful run. My changes and findings in order:
RenderShaderLibrary: Shader compile failed. [_HLSL_INTERNAL_RENDER2D]
E_NOTIMPL
<anonymous>:1:9: E5017: Aborting due to not yet implemented feature: Write fx 2.0 parameter class 0xc.
<anonymous>:1:996: E5017: Aborting due to not yet implemented feature: Write pass assignments.
<anonymous>:1:1117: E5017: Aborting due to not yet implemented feature: Write pass assignments.
vkd3d/libs/vkd3d-shader/fx.c:is_type_supported_fx_2:1154, which was fixed in 79aa75e9, so that was taken. This resulted in a new error message.RenderShaderLibrary: Shader compile failed. [_HLSL_INTERNAL_RENDER2D]
E_NOTIMPL
<anonymous>:1:9: E5017: Aborting due to not yet implemented feature: Writing fx_2_0 sampler objects initializers is not implemented.
<anonymous>:1:996: E5017: Aborting due to not yet implemented feature: Write pass assignments.
<anonymous>:1:1117: E5017: Aborting due to not yet implemented feature: Write pass assignments.
vkd3d/libs/vkd3d-shader/fx.c:write_fx_2_object_initializer:1089. Unfortunately, this is currently unresolved in both Wine's and Valve's latest commits.@yoshiweegee Thank you for this information. Our plan is (and has been for a while) to regularly update the vkd3d submodule, but we do not yet have it automatically updating from the master branch on winehq as you've noticed. I would recommend filing any bugs for vkd3d failures like you find in the winehq bugzilla with the selected "product" vkd3d - https://bugs.winehq.org/enter_bug.cgi?product=vkd3d :)
I believe it's technically already been reported as Bug 37676. Per your advice, I'll refer to my findings here in a comment for that bug report soon.
There's a workaround according to protonDB, replacing d3d DLLs using winetricks/protontricks. Dunno why but this works for many games. See also the above winehq bug report.
EDIT Thanks Prigoryan. Sorry for a low-quality comment.
@q-tan0x while the workaround you mentioned allows you to at least launch the game and start a run, neither the player's nor the enemies' bullets have collision, making the game unplayable still.
VKD3D_SHADER_TARGET_FXx3 2024-11VKD3D_SHADER_STRUCTURE_TYPE_HLSL_SOURCE_INFOx1 2024-11VKD3D_SHADER_TARGET_DXBC_TPFx1 2024-11VKD3D_SHADER_TYPE_EFFECTx1 2024-11
Compatibility Report
System Information
I confirm:
steam-3138390.log
Symptoms
Shortly after the game window becomes visible and adjusts its dimensions, an error dialogue appears with a report. It sometimes appears behind the game window. Clicking OK allows the game to exit gracefully. The config program is unaffected.
On tested Proton versions from 9.0-3 to current bleeding-edge, the message is:
On tested earlier Proton versions, the message is:
Both messages refer to the
_HLSL_INTERNAL_RENDER2Dshader defined within the game engine,Touhou Danmakufu ph3sx v1.33a-preTouhou Danmakufu ph3sx zlabel v1.33a-pre (master). The shader defined for v1.33a-pre can be found here.Reproduction