[Bug 24614] Multiple games crash or hang on startup due to D3DXAssembleShader not handling apostrophes in comments (Medieval II: Total War, Yu-Gi-Oh! ONLINE 3 client)('winetricks -q d3dx9_xx' is a workaround)

WineHQ Bugzilla wine-bugs at winehq.org
Sat Apr 17 05:02:51 CDT 2021


https://bugs.winehq.org/show_bug.cgi?id=24614

Anastasius Focht <focht at gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Medieval II: Total War      |Multiple games crash or
                   |(Sega) crashes on startup   |hang on startup due to
                   |or hangs (D3D ASM shader    |D3DXAssembleShader not
                   |comment parsing             |handling apostrophes in
                   |incomplete)('winetricks -q  |comments (Medieval II:
                   |d3dx9_36' is a workaround)  |Total War, Yu-Gi-Oh! ONLINE
                   |                            |3 client)('winetricks -q
                   |                            |d3dx9_xx' is a workaround)
           Keywords|                            |download
                URL|                            |https://archive.org/details
                   |                            |/yo3setup_20100709en

--- Comment #18 from Anastasius Focht <focht at gmx.net> ---
Hello folks,

when you are merging bugs, please always reflect that in the summary line.

It's as Dan said in comment #9 - the 'Medieval II: Total War' demo
(https://web.archive.org/web/20210417091753/https://dl.4players.de/f1/pc/medieval_2_tw/medieval2totalwardemogold.exe)
doesn't exhibit the problem, works fine here.

Adding the download from duplicate bug 27678 ("Yu-Gi-Oh! ONLINE 3 client shows
black screen on startup (D3DXAssembleShader doesn't handle apostrophes in
comments)") for reproduce.

https://archive.org/details/yo3setup_20100709en

--- snip ---
$ pwd
/home/focht/.wine/drive_c/Program Files (x86)/Konami/Yu-Gi-Oh! ONLINE 3

$ wine ./yo3.exe
...
0118:Call
d3dx9_40.D3DXAssembleShader(0076bca0,00000b7b,00000000,00000000,00000000,01b2f498,01b2f49c)
ret=00550bdf
0118:Call
d3dcompiler_47.D3DAssemble(0076bca0,00000b7b,00000000,00000000,00000000,00000000,01b2f498,01b2f49c)
ret=0113fd51
0118:trace:d3dcompiler:D3DAssemble data 0076BCA0, datasize 2939, filename
(null), defines 00000000, include 00000000, sflags 0, shader 01B2F498,
error_messages 01B2F49C. 
...
0118:trace:d3dcompiler:preprocess_shader Error during shader preprocessing
0118:trace:d3dcompiler:preprocess_shader Preprocessor messages:
":19:1: Warning: Newline in string constant encountered (started line
18)\n:20:1: Warning: Newline in string constant encountered (started line
18)\n:21:1: Warning: Newline in string constant encountered (started line
18)\n:22:1: Warning: Newline in string constant encountered (started line "...
...
0118:trace:d3dcompiler:D3DCreateBlob data_size 4220, blob 01B2F320 
...
0118:trace:d3dcompiler:preprocess_shader Shader source:
";Irrlicht Engine 0.10 D3D9 render path parallax mapping vertex shader\n; c0-3:
Transposed world matrix \n; c4: Eye position \n; c8-11: Transposed
worldViewProj matrix (Projection * View * World) \n; c12: Light01 position \n;
c13: x,y,z: Light01 color; .w: 1/LightRadius\xb2 \n; c14: Light02 "...
...
0118:Ret  d3dcompiler_47.D3DAssemble() retval=80004005 ret=0113fd51
0118:Ret  d3dx9_40.D3DXAssembleShader() retval=88760b59 ret=00550bdf
...
0118:Call KERNEL32.OutputDebugStringA(01936c00 "Vertex shader compilation
failed:\n") ret=005261c0
...
--- snip ---

Obviously still present.

I've extracted the vertex shader source in question from the binary:

--- snip ---
;Irrlicht Engine 0.10 D3D9 render path parallax mapping vertex shader
; c0-3: Transposed world matrix 
; c4: Eye position 
; c8-11: Transposed worldViewProj matrix (Projection * View * World) 
; c12: Light01 position 
; c13: x,y,z: Light01 color; .w: 1/LightRadius² 
; c14: Light02 position 
; c15: x,y,z: Light02 color; .w: 1/LightRadius² 
vs.1.1
dcl_position  v0              ; position 
dcl_normal    v1              ; normal 
dcl_color     v2              ; color 
dcl_texcoord0 v3              ; texture coord 
dcl_texcoord1 v4              ; tangent 
dcl_texcoord2 v5              ; binormal 

def c95, 0.5, 0.5, 0.5, 0.5   ; used for moving light vector to ps 
def c96, -1, 1, 1, 1   ; somewhere I've got a bug. flipping the vectors with
this fixes it. 

m4x4 oPos, v0, c8             ; transform position to clip space with
worldViewProj matrix

m3x3 r5, v4, c0               ; transform tangent U
m3x3 r7, v1, c0               ; transform normal W
m3x3 r6, v5, c0               ; transform binormal V

m4x4 r4, v0, c0               ; vertex into world position
add r2, c12, -r4              ; vtxpos - light1 pos
add r3, c14, -r4              ; vtxpos - light2 pos
add r1, -c4,  r4              ; eye - vtxpos 

dp3 r8.x, r5, r2              ; transform the light1 vector with U, V, W
dp3 r8.y, r6, r2   
dp3 r8.z, r7, r2   
dp3 r9.x, r5, r3              ; transform the light2 vector with U, V, W
dp3 r9.y, r6, r3   
dp3 r9.z, r7, r3   
dp3 r10.x, r5, r1             ; transform the eye vector with U, V, W
dp3 r10.y, r6, r1   
dp3 r10.z, r7, r1   

dp3 r8.w, r8, r8              ; normalize light vector 1 (r8)
rsq r8.w, r8.w    
mul r8, r8, r8.w  
;mul r8, r8, c96 
dp3 r9.w, r9, r9              ; normalize light vector 2 (r9)
rsq r9.w, r9.w    
mul r9, r9, r9.w  
;mul r9, r9, c96 
dp3 r10.w, r10, r10           ; normalize eye vector (r10)
rsq r10.w, r10.w    
mul r10, r10, r10.w  
mul r10, r10, c96 


mad oT2.xyz, r8.xyz, c95, c95 ; move light vector 1 from -1..1 into 0..1 
mad oT3.xyz, r9.xyz, c95, c95 ; move light vector 2 from -1..1 into 0..1 
mad oT4.xyz, r10.xyz, c95, c95 ; move eye vector from -1..1 into 0..1 

 ; calculate attenuation of light 1 
dp3 r2.x, r2.xyz, r2.xyz      ; r2.x = r2.x² + r2.y² + r2.z² 
mul r2.x, r2.x, c13.w         ; r2.x * attenutation 
rsq r2, r2.x                  ; r2.xyzw = 1/sqrt(r2.x * attenutation)
mul oD0, r2, c13              ; resulting light color = lightcolor *
attenuation 

 ; calculate attenuation of light 2 
dp3 r3.x, r3.xyz, r3.xyz      ; r3.x = r3.x² + r3.y² + r3.z² 
mul r3.x, r3.x, c15.w         ; r2.x * attenutation 
rsq r3, r3.x                  ; r2.xyzw = 1/sqrt(r2.x * attenutation)
mul oD1, r3, c15              ; resulting light color = lightcolor *
attenuation 

mov oT0.xy, v3.xy             ; move out texture coordinates 1
mov oT1.xy, v3.xy             ; move out texture coordinates 2
mov oD0.a, v2.a               ; move out original alpha value 
--- snip ---

Relevant comment line "; somewhere I've got a bug. "

$ wine --version
wine-6.6-196-g749f8c25e26

Regards

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


More information about the wine-bugs mailing list