[Bug 25528] New: HLSL shader not translated correctly (uniform variables)

wine-bugs at winehq.org wine-bugs at winehq.org
Wed Dec 15 14:05:32 CST 2010


http://bugs.winehq.org/show_bug.cgi?id=25528

           Summary: HLSL shader not translated correctly (uniform
                    variables)
           Product: Wine
           Version: 1.3.5
          Platform: x86
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: directx-d3d
        AssignedTo: wine-bugs at winehq.org
        ReportedBy: knight666+wine at gmail.com


Created an attachment (id=32501)
 --> (http://bugs.winehq.org/attachment.cgi?id=32501)
Program run in a normal way

I was trying to run the game "Sexy Beach Zero" (hmmyes) and it runs great. But
when you load any of the 3D scenes, the body model isn't bound correctly to her
and is stationary at (0, 0, 0) in the scene.

I checked the log and found a lot of these:

err:d3d_shader:set_glsl_shader_program >>>>>>>>>>>>>>>>> GL_INVALID_OPERATION
(0x502) from Find glsl program uniform locations @ glsl_shader.c / 4435
err:d3d_shader:set_glsl_shader_program >>>>>>>>>>>>>>>>> GL_INVALID_OPERATION
(0x502) from glUseProgramObjectARB(programId) @ glsl_shader.c / 4449
err:d3d_shader:hardcode_local_constants >>>>>>>>>>>>>>>>> GL_INVALID_OPERATION
(0x502) from Hardcoding local constants @ glsl_shader.c / 3955
err:d3d_shader:shader_glsl_select >>>>>>>>>>>>>>>>> GL_INVALID_OPERATION
(0x502) from glUseProgramObjectARB @ glsl_shader.c / 4618
trace:d3d_constants:shader_glsl_load_constantsI Loading local constants 0: 2,
0, 0, 0
err:d3d_shader:shader_glsl_load_constantsI >>>>>>>>>>>>>>>>>
GL_INVALID_OPERATION (0x502) from glUniform4ivARB @ glsl_shader.c / 598
err:d3d_shader:shader_glsl_load_constants >>>>>>>>>>>>>>>>>
GL_INVALID_OPERATION (0x502) from glUniform4fvARB @ glsl_shader.c / 769

(After this it repeats the last 4 lines)

Perfectly willing to chip my teeth on this bug, I downloaded the latest Wine
git to check the source.

I ran the game again with the following command:

WINEDEBUG=trace+d3d_constants wine "Sexy Beach Zero English.exe" &> ~/sbz2.log

The log now returns this:

fixme:d3d_shader:print_glsl_info_log Error received from GLSL shader #10:
fixme:d3d_shader:print_glsl_info_log     Vertex info
fixme:d3d_shader:print_glsl_info_log     -----------
fixme:d3d_shader:print_glsl_info_log     0(35) : warning C1068: array index out
of bounds

Repeat the array index out of bounds warning plenty of times.

Going deeper, I ran the game like this:

WINEDEBUG=trace+d3d_shader wine "Sexy Beach Zero English.exe" &> ~/sbz.log

Part of the offending HLSL shader:

def *c822* = 1.000000, 3.000000, 0.000000, 0.000000
def c823 = 0.500000, 0.000000, 0.000000, 0.000000
def c824 = -1.000000, -2.000000, -3.000000, -4.000000
defi i0 = 5, 0, 0, 0

frc r0, v2
slt r1, -r0, r0
add r2, -r0, v2
slt r0, v2, -v2
mad r0, r0, r1, r2
mul r0, r0, *c822*.y

Emphasis marked with *'s.

uniform vec4 *VC[256]*;
// snip
void main() {
R0.xyzw = (fract(attrib2.xyzw));
R1.xyzw = (vec4(lessThan(-R0.xyzw, R0.xyzw)));
R2.xyzw = (-R0.xyzw + attrib2.xyzw);
R0.xyzw = (vec4(lessThan(attrib2.xyzw, -attrib2.xyzw)));
R0.xyzw = ((R0.xyzw * R1.xyzw) + R2.xyzw);
R0.xyzw = (R0.xyzw * *VC[822]*.yyyy);

This is where the "array index out of bounds" warning comes from. The shader
translator should have converted "c822" to a uniform, but instead put it in an
array.

I got hopelessly lost in the Wine source, I couldn't find the error myself,
unfortunately. :(

Hopefully this helps someone more knowledgeable with these things!

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
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