[10/10] WineD3D: Sort out some limit confusion

Henri Verbeet hverbeet at gmail.com
Sat Aug 23 06:05:22 CDT 2008


2008/8/22 Stefan Dösinger <stefan at codeweavers.com>:
> +            glGetIntegerv(GL_MAX_TEXTURE_COORDS, &gl_max);
> +            gl_info->max_texture_coords = min(MAX_TEXTURES, gl_max);
> +            TRACE_(d3d_caps)("Max texture coords: %d\n", gl_info->max_texture_coords);
I don't know if this is intentional or not, but did you mean to use
gl_info->max_textures here?

> @@ -3172,7 +3172,7 @@ static void loadTexCoords(IWineD3DStateBlockImpl *stateblock, WineDirect3DVertex
>          return;
>      }
>
> -    for (textureNo = 0; textureNo < GL_LIMITS(texture_stages); ++textureNo) {
> +    for (textureNo = 0; textureNo < GL_LIMITS(texture_coords); ++textureNo) {
>          int coordIdx = stateblock->textureState[textureNo][WINED3DTSS_TEXCOORDINDEX];
>
>          mapped_stage = stateblock->wineD3DDevice->texUnitMap[textureNo];
Shouldn't that be testing mapped_stage against
GL_LIMITS(texture_coords) instead?

> -    if (GL_SUPPORT(NV_REGISTER_COMBINERS)) {
> -        /* The number of the mapped stages increases monotonically, so it's fine to use the last used one */
> -        for (textureNo = mapped_stage + 1; textureNo < GL_LIMITS(textures); ++textureNo) {
> -            GL_EXTCALL(glMultiTexCoord4fARB(GL_TEXTURE0_ARB + textureNo, 0, 0, 0, 1));
> -        }
> -    }
I'm probably missing something here, but why is it safe to remove that?

> @@ -420,7 +420,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, WineDirect3DVertexStridedData
>          }
>
>          /* Texture coords --------------------------- */
> -        for (textureNo = 0; textureNo < GL_LIMITS(texture_stages); ++textureNo) {
> +        for (textureNo = 0; textureNo < GL_LIMITS(texture_coords); ++textureNo) {
>
>              if (!GL_SUPPORT(ARB_MULTITEXTURE) && textureNo > 0) {
>                  FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
Similar to above, shouldn't this test texture_idx against
GL_LIMITS(texture_coords) instead of textureNo?

In the bigger picture, these various limits are pretty tricky to get
right, I wonder if it might make more sense to handle most of this
stuff in the tex unit map instead. That way we could be sure that if a
stage is mapped to a sampler that sampler is safe to use.


More information about the wine-devel mailing list