[PATCH 2/7] wined3d: Don't consider texture rectangles for buffers.

Matteo Bruni matteo.mystral at gmail.com
Tue Jun 1 12:05:38 CDT 2021


On Tue, Jun 1, 2021 at 6:54 PM Henri Verbeet <hverbeet at gmail.com> wrote:
>
> On Mon, 31 May 2021 at 21:13, Matteo Bruni <mbruni at codeweavers.com> wrote:
> > @@ -141,15 +141,15 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
> >                  WARN("Format %s cannot be used for texturing.\n", debug_d3dformat(format->id));
> >                  continue;
> >              }
> > -        }
> > -        if (((width & (width - 1)) || (height & (height - 1)))
> > +            if (((width & (width - 1)) || (height & (height - 1)))
> >                  && !d3d_info->texture_npot
> >                  && !gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT]
> >                  && gl_type == WINED3D_GL_RES_TYPE_TEX_2D)
> > -        {
> > -            TRACE("Skipping 2D texture type to try texture rectangle.\n");
> > -            tex_2d_ok = TRUE;
> > -            continue;
> > +            {
> > +                TRACE("Skipping 2D texture type to try texture rectangle.\n");
> > +                tex_2d_ok = TRUE;
> > +                continue;
> > +            }
> >          }
> >          break;
> >      }
>
> Does this make a difference? Buffer resources would fail the "gl_type
> == WINED3D_GL_RES_TYPE_TEX_2D" check, and in terms of performance,
> well, don't create resources in your rendering loop. Still, this would
> be fine, except that now you've messed up the indentation of the
> if-statement. Note that instead of the "if (type !=
> WINED3D_RTYPE_BUFFER) { ... }" block above, you could just "if (type
> == WINED3D_RTYPE_BUFFER) break;", and save some indentation.

That's what happens when I write patches on the Mac :/
Yeah, it shouldn't affect anything but it seemed pointless to have
that sit out of the if (type != WINED3D_RTYPE_BUFFER){} block.

But indeed, it's even nicer to flip the condition entirely.



More information about the wine-devel mailing list