http://bugs.winehq.org/show_bug.cgi?id=14031
Summary: Max Payne 2: GL_INVALID_OPERATION in texture_activate_dimensions Product: Wine Version: 1.0.0 Platform: PC-x86-64 URL: http://www.rockstargames.com/maxpayne2/mp2_downloads.htm l OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: directx-d3d AssignedTo: wine-bugs@winehq.org ReportedBy: liquid.acid@gmx.net CC: alexd4@inbox.lv
Created an attachment (id=14243) --> (http://bugs.winehq.org/attachment.cgi?id=14243) max payne 2 demo run (large parts but out because they were identical)
Hi there,
I'm currently trying to get the Max Payne 2 demo running on my nvidia Geforce FX 5900 based system. It has some issues with mirror reflections, bullettime postprocessing and some other bugs already mentioned on the tracker.
I don't know how much this is related, but during the game wine spits out a lot of messages on the console. During some normal length gaming sessions (should have been around 20 minutes) I already got a >100MB logfile, without any tracing activated, just running wine with no options.
The errors are of this type: fixme:d3d:texture_activate_dimensions >>>>>>>>>>>>>>>>> GL_INVALID_OPERATION (0x502) from glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, ...) @ utils.c / 3410
In fact I shouldn't say "this type", it's always exactly this line.
I'm going to attach a modified log (cut out most of the log, because this message repeats endlessly) so you have bit more context.
I'm adding Alexander to CC because he probably knows why this happens ;-)
Naturally I also did some research:
From dlls/wined3d/utils.c:
if(GL_SUPPORT(NV_TEXTURE_SHADER2)) { glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, bumpmap ? GL_OFFSET_TEXTURE_2D_NV : GL_TEXTURE_2D); checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, ...)");
These are line 3408 - 3410.
Links to NV texture shader extension docs: http://www.opengl.org/registry/specs/NV/texture_shader.txt http://www.opengl.org/registry/specs/NV/texture_shader2.txt (I still have to take a deeper look)
"GL_INVALID_OPERATION is generated if glTexEnv is executed between the execution of glBegin and the corresponding execution of glEnd."
In case NV_texture_shader doesn't change glTexEnv so much that also other conditions can lead to GL_INVALID_OPERATION there should be some problems in the calling function of texture_activate_dimensions.
Any way of outputting the call stack from texture_activate_dimensions?
Cheers, Tobias
http://bugs.winehq.org/show_bug.cgi?id=14031
Tobias Jakobi liquid.acid@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jb.faq@gmx.de Keywords| |download
http://bugs.winehq.org/show_bug.cgi?id=14031
--- Comment #1 from Alexander Dorofeyev alexd4@inbox.lv 2008-06-21 09:21:14 --- Unfortunately, as of now I know very little about shaders, so where shaders are involved I can't help much, I'm afraid. Stefan or Roderick may know more about this. I may hazard a guess that some advanced d3d9 features are poorly supported on Geforce FX series GPUs, because some opengl features emulation relies on are not present on them and/or an alternative codepath is needed that is not implemented.
With functions applyign states call stack usually is quite useless. State changes made by some d3d calls are cached internally by wined3d then are applied when it becomes necessary - usually before primitives are rendered or something. If you are interested in collecting more info on this bug, hacking the function to print some values is more useful. state and bumpmap are the ones that are important there.
http://bugs.winehq.org/show_bug.cgi?id=14031
--- Comment #2 from Tobias Jakobi liquid.acid@gmx.net 2008-06-21 14:41:35 --- (In reply to comment #1)
Unfortunately, as of now I know very little about shaders, so where shaders are involved I can't help much, I'm afraid. Stefan or Roderick may know more about this. I may hazard a guess that some advanced d3d9 features are poorly supported on Geforce FX series GPUs, because some opengl features emulation relies on are not present on them and/or an alternative codepath is needed that is not implemented.
Thanks, so I should CC them? I'm asking this because it seems like I'm forcing the people to look at this bug...
With functions applyign states call stack usually is quite useless. State changes made by some d3d calls are cached internally by wined3d then are applied when it becomes necessary - usually before primitives are rendered or something. If you are interested in collecting more info on this bug, hacking the function to print some values is more useful. state and bumpmap are the ones that are important there.
I added FIXME("NV_TEXTURE_SHADER_NV debug: bump is %u and active texture unit is %x\n", bumpmap, gl_nv_texture_shader_debug_helper()); in front of the glTexEnv call.
It turned out that when the call fails I have this configuration: fixme:d3d:texture_activate_dimensions NV_TEXTURE_SHADER_NV debug: bump is 0 and active texture unit is 84c4 fixme:d3d:texture_activate_dimensions >>>>>>>>>>>>>>>>> GL_INVALID_OPERATION (0x502) from glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, ...) @ utils.c / 3427
84c4 is GL_TEXTURE4_ARB, so it's always this texture unit which does trouble. As you can see bump is always zero when this happens, so the call glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_2D) is failing.
Quote from texture_shader.txt: 1) INVALID_OPERATION is generated when TexEnv is called and the PREVIOUS_TEXTURE_INPUT_NV parameter for texture unit i is assigned the value TEXTUREi_ARB where f i is greater than or equal to the current active texture unit. Could be the problem...
2) INVALID_OPERATION is generated when TexEnv is called and the SHADER_OPERATION_NV parameter for texture unit 0 is assigned one of OFFSET_TEXTURE_2D_NV, OFFSET_TEXTURE_2D_SCALE_NV, OFFSET_TEXTURE_RECTANGLE_NV, OFFSET_TEXTURE_RECTANGLE_SCALE_NV, DEPENDENT_AR_TEXTURE_2D_NV, DEPENDENT_GB_TEXTURE_2D_NV, DOT_PRODUCT_NV, DOT_PRODUCT_DEPTH_REPLACE_NV, DOT_PRODUCT_TEXTURE_2D_NV, DOT_PRODUCT_TEXTURE_RECTANGLE_NV, DOT_PRODUCT_TEXTURE_CUBE_MAP_NV, DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV, DOT_PRODUCT_REFLECT_CUBE_MAP_NV. or DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV. No, coz we're calling it with GL_TEXTURE_2D
3) INVALID_OPERATION is generated when TexEnv is called and the SHADER_OPERATION_NV parameter for texture unit 1 is assigned one of DOT_PRODUCT_DEPTH_REPLACE_NV, DOT_PRODUCT_TEXTURE_2D_NV, DOT_PRODUCT_TEXTURE_RECTANGLE_NV, DOT_PRODUCT_TEXTURE_CUBE_MAP_NV, DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV, DOT_PRODUCT_REFLECT_CUBE_MAP_NV, or DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV. No, same as above...
4) INVALID_OPERATION is generated when TexEnv is called and the SHADER_OPERATION_NV parameter for texture unit 2 is assigned one of DOT_PRODUCT_TEXTURE_CUBE_MAP_NV, DOT_PRODUCT_REFLECT_CUBE_MAP_NV, or DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV. Again no...
5) INVALID_OPERATION is generated when TexEnv is called and the SHADER_OPERATION_NV parameter for texture unit n-1 (where n is the number of supported texture units) is assigned either DOT_PRODUCT_NV or DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV. Another no!
Quote from texture_shader.txt: (nothing here, because it's almost identical)
So if it's no enclosing glBegin/glEnd pair it should be a problem like the one described in (1).
Ah yes Alexander, you meant stage not state, right?
Greets, Tobias
http://bugs.winehq.org/show_bug.cgi?id=14031
--- Comment #3 from Roderick Colenbrander thunderbird2k@gmx.net 2008-06-22 14:23:28 --- The number of texture units which can be addressed by 'fixed function' calls is limited to 4 on geforcefx and higher cards. Because texture unit 4 (counted from 0) is above this limit, you are getting an invalid operation error.
See http://developer.nvidia.com/object/General_FAQ.html#t6 for more information. I'm not sure what we should do about it. Likely we should port this over to glsl or in the future.
http://bugs.winehq.org/show_bug.cgi?id=14031
Tobias Jakobi liquid.acid@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |stefandoesinger@gmx.at
--- Comment #4 from Tobias Jakobi liquid.acid@gmx.net 2008-06-22 14:42:26 --- Adding Stefan Dösinger to CC (advice from Roderick).
http://bugs.winehq.org/show_bug.cgi?id=14031
--- Comment #5 from Tobias Jakobi liquid.acid@gmx.net 2008-07-16 17:53:49 --- Reconfirming with wine-1.1.0
http://bugs.winehq.org/show_bug.cgi?id=14031
--- Comment #6 from Tobias Jakobi liquid.acid@gmx.net 2008-07-17 14:50:55 --- Also this seems to be a regression, the error message doesn't show up when wine-0.9.56 is used.
Doing a regression test later...
http://bugs.winehq.org/show_bug.cgi?id=14031
--- Comment #7 from Tobias Jakobi liquid.acid@gmx.net 2008-07-22 15:27:27 --- Hmm, this also doesn't anymore with latest wine git master. Doing a check which commit fixed (?) this (or is it just that the GL error is now shown?)
Greets, Tobias
http://bugs.winehq.org/show_bug.cgi?id=14031
Tobias Jakobi liquid.acid@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |FIXED
--- Comment #8 from Tobias Jakobi liquid.acid@gmx.net 2008-07-25 13:17:44 --- "Inverse" regression testing revealed that this commit fixed the problem: [51e64b3fe95afb3246c8690d9ea1e7b4c38ce2b4] wined3d: Move fixed function texture dimension updates to the fragment pipeline.
Link: http://source.winehq.org/git/wine.git/?a=commit;h=51e64b3fe95afb3246c8690d9e...
Resolving to FIXED!
http://bugs.winehq.org/show_bug.cgi?id=14031
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #9 from Alexandre Julliard julliard@winehq.org 2008-08-22 10:47:26 --- Closing bugs fixed in 1.1.3.