http://bugs.winehq.org/show_bug.cgi?id=20183
Summary: Black & White 2: texture corruption on higher resolutions Product: Wine Version: 1.1.29 Platform: PC-x86-64 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: directx-d3d AssignedTo: wine-bugs@winehq.org ReportedBy: xamaniqinqu@gmail.com
Description: The game 'Black & White 2' suffers from texture corruption when using higher resolutions. All resolutions above 1024x768 cause texture corruption including but not limited to: edgy black surfaces, stripes, terrain rendered in the wrong place. Wine keeps spitting out the following message ad nauseam:
fixme:d3d:state_pscale >>>>>>>>>>>>>>>>> GL_INVALID_VALUE (0x501) from glPointSize(...); @ state.c / 1489
Operating system: Gentoo GNU/Linux ~amd64 Graphics card: NVIDIA GeForce GTX 280 Graphics card driver version: 190.25 Wine version: 1.1.29 Native DLLs: d3dx9_25.dll, d3dx9_30.dll, d3dx9_36.dll
http://bugs.winehq.org/show_bug.cgi?id=20183
Vitaliy Margolen vitaliy@kievinfo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |DUPLICATE Alias|Itzamna |
--- Comment #1 from Vitaliy Margolen vitaliy@kievinfo.com 2009-09-27 11:30:07 --- Duplicate
*** This bug has been marked as a duplicate of bug 14939 ***
http://bugs.winehq.org/show_bug.cgi?id=20183
Vitaliy Margolen vitaliy@kievinfo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #2 from Vitaliy Margolen vitaliy@kievinfo.com 2009-09-27 11:30:15 --- Closing
http://bugs.winehq.org/show_bug.cgi?id=20183
Itzamna xamaniqinqu@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|CLOSED |UNCONFIRMED Resolution|DUPLICATE |
--- Comment #3 from Itzamna xamaniqinqu@gmail.com 2009-09-27 11:35:34 --- This game is NOT a duplicate of bug 14939.
First of all: this game is Black & White 2, not Black & White 1.
Second: Black & White 1 suffers texture corruption because of Wine's lack of S3TC compression:
fixme:d3d_surface:surface_convert_format Cannot find a conversion function from format WINED3DFMT_DXT1 to WINED3DFMT_A4R4G4B4
While Black & White 2 clearly gives a different error:
fixme:d3d:state_pscale >>>>>>>>>>>>>>>>> GL_INVALID_VALUE (0x501) from glPointSize(...); @ state.c / 1489
This bug was fixed around wine 1.1.25, but regressed later.
http://bugs.winehq.org/show_bug.cgi?id=20183
Ben Klein shacklein@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |shacklein@gmail.com
--- Comment #4 from Ben Klein shacklein@gmail.com 2009-09-27 18:14:23 --- (In reply to comment #3)
This game is NOT a duplicate of bug 14939.
First of all: this game is Black & White 2, not Black & White 1.
Agreed.
Second: Black & White 1 suffers texture corruption because of Wine's lack of S3TC compression:
Actually, it's the lack of DEcompression.
http://bugs.winehq.org/show_bug.cgi?id=20183
--- Comment #5 from Itzamna xamaniqinqu@gmail.com 2009-09-28 03:27:55 --- This bug is caused by invalid pixel point size scaling, which makes sense, as there are two characteristics:
1) the bug gets more severe at higher resolutions 2) the bug itself looks like pieces of terrain are unfolded and enlarged while it shouldn't be
The responsible code is part of function 'state_pscale' in ./dlls/wined3d/state.c:
static void state_pscale(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) { /* TODO: Group this with the viewport */ /* * POINTSCALEENABLE controls how point size value is treated. If set to * true, the point size is scaled with respect to height of viewport. * When set to false point size is in pixels. */
/* Default values */ GLfloat att[3] = {1.0f, 0.0f, 0.0f}; union { DWORD d; float f; } pointSize, A, B, C;
pointSize.d = stateblock->renderState[WINED3DRS_POINTSIZE]; A.d = stateblock->renderState[WINED3DRS_POINTSCALE_A]; B.d = stateblock->renderState[WINED3DRS_POINTSCALE_B]; C.d = stateblock->renderState[WINED3DRS_POINTSCALE_C];
if(stateblock->renderState[WINED3DRS_POINTSCALEENABLE]) { GLfloat scaleFactor; float h = stateblock->viewport.Height;
if(pointSize.f < GL_LIMITS(pointsizemin)) { /* * Minimum valid point size for OpenGL is driver specific. For Direct3D it is * 0.0f. This means that OpenGL will clamp really small point sizes to the * driver minimum. To correct for this we need to multiply by the scale factor when sizes * are less than 1.0f. scale_factor = 1.0f / point_size. */ scaleFactor = pointSize.f / GL_LIMITS(pointsizemin); /* Clamp the point size, don't rely on the driver to do it. MacOS says min point size * is 1.0, but then accepts points below that and draws too small points */ pointSize.f = GL_LIMITS(pointsizemin); } else if(pointSize.f > GL_LIMITS(pointsize)) { /* gl already scales the input to glPointSize, * d3d scales the result after the point size scale. * If the point size is bigger than the max size, use the * scaling to scale it bigger, and set the gl point size to max */ scaleFactor = pointSize.f / GL_LIMITS(pointsize); TRACE("scale: %f\n", scaleFactor); pointSize.f = GL_LIMITS(pointsize); } else { scaleFactor = 0.0f; } scaleFactor = pow(h * scaleFactor, 2);
att[0] = A.f / scaleFactor; att[1] = B.f / scaleFactor; att[2] = C.f / scaleFactor; }
if(GL_SUPPORT(ARB_POINT_PARAMETERS)) { GL_EXTCALL(glPointParameterfvARB)(GL_POINT_DISTANCE_ATTENUATION_ARB, att); checkGLcall("glPointParameterfvARB(GL_DISTANCE_ATTENUATION_ARB, ...)"); } else if(GL_SUPPORT(EXT_POINT_PARAMETERS)) { GL_EXTCALL(glPointParameterfvEXT)(GL_DISTANCE_ATTENUATION_EXT, att); checkGLcall("glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, ...)"); } else if(stateblock->renderState[WINED3DRS_POINTSCALEENABLE]) { WARN("POINT_PARAMETERS not supported in this version of opengl\n"); }
glPointSize(pointSize.f); checkGLcall("glPointSize(...);"); }
I'm trying to fix it, but I do not know what the minimal / maximal pixel point sizes allowed in OpenGL are. Can a developer please help me?
http://bugs.winehq.org/show_bug.cgi?id=20183
--- Comment #6 from Ben Klein shacklein@gmail.com 2009-09-28 04:00:44 --- (In reply to comment #5)
The responsible code is part of function 'state_pscale' in ./dlls/wined3d/state.c:
For future reference: copying large chunks of source into bug comments is unnecessary. An attachment or even just a line number will suffice.
http://bugs.winehq.org/show_bug.cgi?id=20183
--- Comment #7 from Itzamna xamaniqinqu@gmail.com 2009-09-28 09:19:24 --- (In reply to comment #6)
(In reply to comment #5)
The responsible code is part of function 'state_pscale' in ./dlls/wined3d/state.c:
For future reference: copying large chunks of source into bug comments is unnecessary. An attachment or even just a line number will suffice.
Are you going to say anything useful, or are you just going to pick on small omissions / inconveniences?
If you don't know what the pixel point scaling factor should be, kindly refrain from posting.
http://bugs.winehq.org/show_bug.cgi?id=20183
Itzamna xamaniqinqu@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|1.1.29 |1.1.30
http://bugs.winehq.org/show_bug.cgi?id=20183
Jeff Zaroyko jeffz@jeffz.name changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|1.1.30 |1.1.29
--- Comment #8 from Jeff Zaroyko jeffz@jeffz.name 2009-09-28 16:54:05 --- Please don't change the original reported version. A comment to say it's present in later versions is enough.
http://bugs.winehq.org/show_bug.cgi?id=20183
--- Comment #9 from Ben Klein shacklein@gmail.com 2009-09-28 17:15:29 --- (In reply to comment #7)
Are you going to say anything useful, or are you just going to pick on small omissions / inconveniences?
If you don't know what the pixel point scaling factor should be, kindly refrain from posting.
"Too much information" is not a "small omission". Quite the opposite. Proper use and etiquette of Bugzilla is still important. This is not a tool that only you use.
OpenGL docs should say what the minimum/maximum point sizes are.
http://bugs.winehq.org/show_bug.cgi?id=20183
--- Comment #10 from Itzamna xamaniqinqu@gmail.com 2009-09-28 17:32:02 --- @ Ben Klein: I am sorry, I am new to Bugzilla. Bear with me as I take you through the problem.
@ Jeff Zaroyko: I'm sorry - I also confirmed this bug to be present in 1.1.30.
I also researched the etiology: apparently, glPointSize returns a value of 0x501 (1 * 16^0 + 5 * 16^2 = 1281 in decimal numbers), while antialiasing is enabled. If antialiasing is enabled, OpenGL does not allow an infinite range of point sizes (source: http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/poin... ).
I do not know the range of valid point sizes, as it is defined in the program. The only constant about point size ranges is whether the driver allows point sizes < 0, and that differs among drivers too. I'm digging through the source code now to try and find the range of valid point sizes.
http://bugs.winehq.org/show_bug.cgi?id=20183
--- Comment #11 from Ben Klein shacklein@gmail.com 2009-09-28 17:37:25 --- (In reply to comment #10)
@ Ben Klein: I am sorry, I am new to Bugzilla. Bear with me as I take you through the problem.
Apology accepted. :)
If antialiasing is enabled, OpenGL does not allow an infinite range of point sizes (source: http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/poin...).
From your link:
To query the range of supported sizes ... call glGet with arguments GL_POINT_SIZE_RANGE ...
Maybe this will help.
http://bugs.winehq.org/show_bug.cgi?id=20183
--- Comment #12 from Itzamna xamaniqinqu@gmail.com 2009-09-28 18:17:38 --- I'll add:
glGetFloatv(GL_POINT_SIZE_RANGE, &min &max); printf("%f %f", min, max);
and see what I can come up with.
http://bugs.winehq.org/show_bug.cgi?id=20183
Paul Bredbury brebs@sent.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |brebs@sent.com
http://bugs.winehq.org/show_bug.cgi?id=20183
Wylda wylda@volny.cz changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |wylda@volny.cz Resolution| |FIXED
--- Comment #13 from Wylda wylda@volny.cz 2010-09-19 05:42:27 CDT ---
No texture corruptions here - works correctly in clean wine environment. Tested under: * wine-1.3.3 * nVidia GT240 v195.36.31 * full screen * highest graphical details * resolution 1900x1200 * Debian Squeeze 32bit * No need for coping d3dx9_25.dll and d3dx9_36.dll
Marking fixed. Also no replay for 1 year.
http://bugs.winehq.org/show_bug.cgi?id=20183
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #14 from Alexandre Julliard julliard@winehq.org 2010-10-01 13:56:57 CDT --- Closing bugs fixed in 1.3.4.