protonscr

東方聖戦影 ~ Forlorn Souls of Wicked Past Demo

protonopen appid 3138390Game compatibility - Unofficial
ValveSoftware/Proton#8190 · opened 2024-10-24 by yoshiweegee · updated 2025-04-16 · 9 comments · github · game page · search this game
Yyoshiweegee 2024-10-24 github

Compatibility Report

  • Name of the game with compatibility issues: 東方聖戦影 ~ Forlorn Souls of Wicked Past Demo
  • Steam AppID of the game: 3138390

System Information

I confirm:

  • [x] that I haven't found an existing compatibility report for this game.
  • [x] that I have checked whether there are updates for my system available.

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:

RenderShaderLibrary: Shader compile failed. [_HLSL_INTERNAL_RENDER2D]
        E_INVALIDARG
        E5020: The 'fx_2_0' target profile is only compatible with the 'fx' target type.

On tested earlier Proton versions, the message is:

RenderShaderLibrary: Shader compile failed. [_HLSL_INTERNAL_RENDER2D]
        E_FAIL
        <anonymous>:1:62: E5000: syntax error, unexpected ':', expecting ';' or ','
\

Both messages refer to the _HLSL_INTERNAL_RENDER2D shader defined within the game engine, Touhou Danmakufu ph3sx v1.33a-pre Touhou Danmakufu ph3sx zlabel v1.33a-pre (master). The shader defined for v1.33a-pre can be found here.

Reproduction

  1. Start the game (not the config program)
  2. Wait for the window to become visible and adjust its dimensions
  3. Observe the error dialogue. It may be hidden behind the game window.
Yyoshiweegee 2024-11-07 github

Dug through the functions and found where the shader compilation failure is occurring in the latest versions.

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.

Yyoshiweegee 2024-11-08 github

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 ':'.

Yyoshiweegee 2024-11-08 github

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_statement
  • declaration_statement -> declaration
  • declaration -> variables_def_typed ';'
  • variables_def_typed -> variable_def_typed | variables_def_typed ',' variable_def
  • variable_def_typed -> var_modifiers type variable_def
  • variable_def -> variable_decl
  • variable_decl -> any_identifier arrays colon_attribute annotations_opt
  • colon_attribute -> %empty | semantic | register_reservation | packoffset_reservation

None 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 ','.

Yyoshiweegee 2024-11-09 github

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.

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.

Yyoshiweegee 2024-11-11 github

I attempted to cherry-pick the relevant changes to get a successful run. My changes and findings in order:

  • For Wine, d01ae151 was taken to use the expected shader target. This resulted in the same error message regarding an unexpected colon.
  • For vkd3d, 5ea946aa was taken to allow multiple colon-separated attributes. 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: 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.
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.
Aalasky17 2024-11-12 github

@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 :)

Yyoshiweegee 2024-11-13 github

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.

Qq-tan0x 2025-04-16 github

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.

PPrigoryan 2025-04-16 github

@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.