[PATCH 2/5] wined3d: Get rid of the contained_*s_consts_* arrays.

Matteo Bruni matteo.mystral at gmail.com
Tue Feb 11 11:42:45 CST 2020


On Tue, Feb 11, 2020 at 5:33 PM Henri Verbeet <hverbeet at gmail.com> wrote:
>
> On Mon, 10 Feb 2020 at 23:07, Matteo Bruni <mbruni at codeweavers.com> wrote:
> > @@ -1308,10 +1274,13 @@ static void wined3d_bitmask_set_bits(DWORD *bitmask, unsigned int offset, unsign
> >  HRESULT CDECL wined3d_stateblock_set_vs_consts_f(struct wined3d_stateblock *stateblock,
> >          unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants)
> >  {
> > +    const struct wined3d_d3d_info *d3d_info = &stateblock->device->adapter->d3d_info;
> > +
> >      TRACE("stateblock %p, start_idx %u, count %u, constants %p.\n",
> >              stateblock, start_idx, count, constants);
> >
> > -    if (!constants || start_idx >= WINED3D_MAX_VS_CONSTS_F || count > WINED3D_MAX_VS_CONSTS_F - start_idx)
> > +    if (!constants || start_idx >= d3d_info->limits.vs_uniform_count
> > +            || count > d3d_info->limits.vs_uniform_count - start_idx)
> >          return WINED3DERR_INVALIDCALL;
> >
> >      memcpy(&stateblock->stateblock_state.vs_consts_f[start_idx], constants, count * sizeof(*constants));
> > @@ -1374,10 +1343,13 @@ void CDECL wined3d_stateblock_set_pixel_shader(struct wined3d_stateblock *stateb
> >  HRESULT CDECL wined3d_stateblock_set_ps_consts_f(struct wined3d_stateblock *stateblock,
> >          unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants)
> >  {
> > +    const struct wined3d_d3d_info *d3d_info = &stateblock->device->adapter->d3d_info;
> > +
> >      TRACE("stateblock %p, start_idx %u, count %u, constants %p.\n",
> >              stateblock, start_idx, count, constants);
> >
> > -    if (!constants || start_idx >= WINED3D_MAX_PS_CONSTS_F || count > WINED3D_MAX_PS_CONSTS_F - start_idx)
> > +    if (!constants || start_idx >= d3d_info->limits.ps_uniform_count
> > +            || count > d3d_info->limits.ps_uniform_count - start_idx)
> >          return WINED3DERR_INVALIDCALL;
> >
> >      memcpy(&stateblock->stateblock_state.ps_consts_f[start_idx], constants, count * sizeof(*constants));
>
> Those seem like unrelated changes.

Somewhat. In this same patch I'm moving wined3d_stateblock_capture()
to using ARRAY_SIZE(stateblock->changed.?s_consts_f), this makes sure
we're not flagging constants >= d3d_info->limits.?s_uniform_count but
still < WINED3D_MAX_?S_CONSTS_F. It's certainly not a big deal, let me
know how you prefer that I update the patch (options that I can think
of: split these changes out to a separate patch, don't change the loop
bounds in wined3d_stateblock_capture(), drop these changes entirely).



More information about the wine-devel mailing list