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

Henri Verbeet hverbeet at gmail.com
Tue Feb 11 10:32:50 CST 2020


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.



More information about the wine-devel mailing list