[PATCH v2 3/6] d3d9: Use wined3d_stateblock_get_state() in d3d9_device_GetRenderState().

Matteo Bruni matteo.mystral at gmail.com
Tue Dec 10 02:34:22 CST 2019


On Thu, Nov 28, 2019 at 6:54 AM Zebediah Figura <z.figura12 at gmail.com> wrote:
>
> Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
> ---
>  dlls/d3d9/device.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
> index 2d66c569938..51b7f4d6f59 100644
> --- a/dlls/d3d9/device.c
> +++ b/dlls/d3d9/device.c
> @@ -2329,6 +2329,7 @@ static HRESULT WINAPI d3d9_device_GetRenderState(IDirect3DDevice9Ex *iface,
>          D3DRENDERSTATETYPE state, DWORD *value)
>  {
>      struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
> +    const struct wined3d_stateblock_state *device_state;
>      struct wined3d_color factor;
>
>      TRACE("iface %p, state %#x, value %p.\n", iface, state, value);
> @@ -2344,7 +2345,8 @@ static HRESULT WINAPI d3d9_device_GetRenderState(IDirect3DDevice9Ex *iface,
>      }
>
>      wined3d_mutex_lock();
> -    *value = wined3d_device_get_render_state(device->wined3d_device, state);
> +    device_state = wined3d_stateblock_get_state(device->state);
> +    *value = device_state->rs[state];
>      wined3d_mutex_unlock();
>
>      return D3D_OK;

Just a couple of comments WRT potential future improvements. Obviously
they apply to the other d3d* versions too.

The state for the stateblock isn't going to change from underneath so
it could be stored in the d3d9 device once and for all instead of
getting it from wined3d every time it's needed. It doesn't matter a
lot I guess (and it's certainly not urgent anyway), especially for
those Get*() methods, but it would be one less inter-module function
call per API call.



More information about the wine-devel mailing list