wined3d: Only register the np2 texture fixup if needed.

This commit is contained in:
Stefan Dösinger 2008-07-05 16:07:00 -05:00 committed by Alexandre Julliard
parent e86a1d623a
commit 8bb11dad76
1 changed files with 13 additions and 2 deletions

View File

@ -2355,7 +2355,7 @@ static void sampler_texmatrix(DWORD state, IWineD3DStateBlockImpl *stateblock, W
* The mapped stage is alrady active because the sampler() function below, which is part of the
* misc pipeline
*/
if(!GL_SUPPORT(ARB_TEXTURE_NON_POWER_OF_TWO) && sampler < MAX_TEXTURES) {
if(sampler < MAX_TEXTURES) {
if(stateblock->textureDimensions[sampler] == GL_TEXTURE_2D ||
stateblock->textureDimensions[sampler] == GL_TEXTURE_RECTANGLE_ARB) {
if(((IWineD3DTextureImpl *)texture)->baseTexture.pow2Matrix[0] != 1.0 ||
@ -4345,14 +4345,25 @@ const struct StateEntryTemplate ffp_vertexstate_template[] = {
{ STATE_RENDER(WINED3DRS_POINTSIZE_MAX), { STATE_RENDER(WINED3DRS_POINTSIZE_MAX), state_psizemax_arb }, ARB_POINT_PARAMETERS },
{ STATE_RENDER(WINED3DRS_POINTSIZE_MAX), { STATE_RENDER(WINED3DRS_POINTSIZE_MAX), state_psizemax_ext }, EXT_POINT_PARAMETERS },
{ STATE_RENDER(WINED3DRS_POINTSIZE_MAX), { STATE_RENDER(WINED3DRS_POINTSIZE_MAX), state_psizemax_w }, 0 },
/* Samplers for NP2 texture matrix adjustions */
/* Samplers for NP2 texture matrix adjustions. They are not needed if GL_ARB_texture_non_power_of_two is supported,
* so register a NULL state handler in that case to get the vertex part of sampler() skipped(VTF is handled in the misc states.
* otherwise, register sampler_texmatrix, which takes care of updating the texture matrix
*/
{ STATE_SAMPLER(0), { 0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO },
{ STATE_SAMPLER(0), { STATE_SAMPLER(0), sampler_texmatrix }, 0 },
{ STATE_SAMPLER(1), { 0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO },
{ STATE_SAMPLER(1), { STATE_SAMPLER(1), sampler_texmatrix }, 0 },
{ STATE_SAMPLER(2), { 0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO },
{ STATE_SAMPLER(2), { STATE_SAMPLER(2), sampler_texmatrix }, 0 },
{ STATE_SAMPLER(3), { 0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO },
{ STATE_SAMPLER(3), { STATE_SAMPLER(3), sampler_texmatrix }, 0 },
{ STATE_SAMPLER(4), { 0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO },
{ STATE_SAMPLER(4), { STATE_SAMPLER(4), sampler_texmatrix }, 0 },
{ STATE_SAMPLER(5), { 0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO },
{ STATE_SAMPLER(5), { STATE_SAMPLER(5), sampler_texmatrix }, 0 },
{ STATE_SAMPLER(6), { 0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO },
{ STATE_SAMPLER(6), { STATE_SAMPLER(6), sampler_texmatrix }, 0 },
{ STATE_SAMPLER(7), { 0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO },
{ STATE_SAMPLER(7), { STATE_SAMPLER(7), sampler_texmatrix }, 0 },
{0 /* Terminate */, { 0, 0 }, 0 },
};