wined3d: Pass a wined3d_device_context to wined3d_device_get_rendertarget_view().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-04-19 23:38:07 -05:00 committed by Alexandre Julliard
parent 797520db8f
commit 40e1072117
10 changed files with 24 additions and 22 deletions

View File

@ -2054,6 +2054,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMGetRenderTargets(ID3D11D
UINT render_target_view_count, ID3D11RenderTargetView **render_target_views,
ID3D11DepthStencilView **depth_stencil_view)
{
struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext1(iface);
struct d3d_device *device = device_from_immediate_ID3D11DeviceContext1(iface);
struct wined3d_rendertarget_view *wined3d_view;
@ -2068,7 +2069,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMGetRenderTargets(ID3D11D
for (i = 0; i < render_target_view_count; ++i)
{
if (!(wined3d_view = wined3d_device_get_rendertarget_view(device->wined3d_device, i))
if (!(wined3d_view = wined3d_device_context_get_rendertarget_view(context->wined3d_context, i))
|| !(view_impl = wined3d_rendertarget_view_get_parent(wined3d_view)))
{
render_target_views[i] = NULL;
@ -5417,7 +5418,8 @@ static void STDMETHODCALLTYPE d3d10_device_OMGetRenderTargets(ID3D10Device1 *ifa
for (i = 0; i < view_count; ++i)
{
if (!(wined3d_view = wined3d_device_get_rendertarget_view(device->wined3d_device, i))
if (!(wined3d_view = wined3d_device_context_get_rendertarget_view(
device->immediate_context.wined3d_context, i))
|| !(view_impl = wined3d_rendertarget_view_get_parent(wined3d_view)))
{
render_target_views[i] = NULL;

View File

@ -1505,7 +1505,7 @@ static HRESULT WINAPI d3d8_device_SetRenderTarget(IDirect3DDevice8 *iface,
/* If no render target is passed in check the size against the current RT */
if (!render_target)
{
if (!(original_rtv = wined3d_device_get_rendertarget_view(device->wined3d_device, 0)))
if (!(original_rtv = wined3d_device_context_get_rendertarget_view(device->immediate_context, 0)))
{
wined3d_mutex_unlock();
return D3DERR_NOTFOUND;
@ -1570,7 +1570,7 @@ static HRESULT WINAPI d3d8_device_GetRenderTarget(IDirect3DDevice8 *iface, IDire
return D3DERR_INVALIDCALL;
wined3d_mutex_lock();
if ((wined3d_rtv = wined3d_device_get_rendertarget_view(device->wined3d_device, 0)))
if ((wined3d_rtv = wined3d_device_context_get_rendertarget_view(device->immediate_context, 0)))
{
/* We want the sub resource parent here, since the view itself may be
* internal to wined3d and may not have a parent. */
@ -1737,7 +1737,7 @@ static HRESULT WINAPI d3d8_device_SetViewport(IDirect3DDevice8 *iface, const D3D
TRACE("iface %p, viewport %p.\n", iface, viewport);
wined3d_mutex_lock();
if (!(rtv = wined3d_device_get_rendertarget_view(device->wined3d_device, 0)))
if (!(rtv = wined3d_device_context_get_rendertarget_view(device->immediate_context, 0)))
{
wined3d_mutex_unlock();
return D3DERR_NOTFOUND;

View File

@ -1151,7 +1151,7 @@ static HRESULT d3d9_device_reset(struct d3d9_device *device,
}
}
rtv = wined3d_device_get_rendertarget_view(device->wined3d_device, 0);
rtv = wined3d_device_context_get_rendertarget_view(device->immediate_context, 0);
device->render_targets[0] = wined3d_rendertarget_view_get_sub_resource_parent(rtv);
for (i = 1; i < ARRAY_SIZE(device->render_targets); ++i)
device->render_targets[i] = NULL;
@ -2060,7 +2060,7 @@ static HRESULT WINAPI d3d9_device_GetRenderTarget(IDirect3DDevice9Ex *iface, DWO
}
wined3d_mutex_lock();
if ((wined3d_rtv = wined3d_device_get_rendertarget_view(device->wined3d_device, idx)))
if ((wined3d_rtv = wined3d_device_context_get_rendertarget_view(device->immediate_context, idx)))
{
/* We want the sub resource parent here, since the view itself may be
* internal to wined3d and may not have a parent. */
@ -4852,7 +4852,7 @@ HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wine
* generation). */
wined3d_mutex_lock();
device->render_targets[0] = wined3d_rendertarget_view_get_sub_resource_parent(
wined3d_device_get_rendertarget_view(device->wined3d_device, 0));
wined3d_device_context_get_rendertarget_view(device->immediate_context, 0));
wined3d_mutex_unlock();
IDirect3D9Ex_AddRef(&parent->IDirect3D9Ex_iface);

View File

@ -931,7 +931,7 @@ static HRESULT ddraw_set_cooperative_level(struct ddraw *ddraw, HWND window,
goto done;
}
rtv = wined3d_device_get_rendertarget_view(ddraw->wined3d_device, 0);
rtv = wined3d_device_context_get_rendertarget_view(ddraw->immediate_context, 0);
/* Rendering to ddraw->wined3d_frontbuffer. */
if (rtv && !wined3d_rendertarget_view_get_sub_resource_parent(rtv))
rtv = NULL;

View File

@ -3434,7 +3434,7 @@ static void d3d_device_sync_rendertarget(struct d3d_device *device)
if (device->hardware_device)
return;
if ((rtv = wined3d_device_get_rendertarget_view(device->wined3d_device, 0)))
if ((rtv = wined3d_device_context_get_rendertarget_view(device->immediate_context, 0)))
ddraw_surface_get_draw_texture(wined3d_rendertarget_view_get_parent(rtv), DDRAW_SURFACE_RW);
if ((rtv = wined3d_device_get_depth_stencil_view(device->wined3d_device)))
@ -5359,7 +5359,7 @@ static HRESULT d3d_device7_SetViewport(IDirect3DDevice7 *iface, D3DVIEWPORT7 *vi
return DDERR_INVALIDPARAMS;
wined3d_mutex_lock();
if (!(rtv = wined3d_device_get_rendertarget_view(device->wined3d_device, 0)))
if (!(rtv = wined3d_device_context_get_rendertarget_view(device->immediate_context, 0)))
{
wined3d_mutex_unlock();
return DDERR_INVALIDCAPS;

View File

@ -1343,7 +1343,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface1_Flip(IDirectDrawSurface *
if (dst_impl->sub_resource_idx)
ERR("Invalid sub-resource index %u on surface %p.\n", dst_impl->sub_resource_idx, dst_impl);
texture = dst_impl->wined3d_texture;
rtv = wined3d_device_get_rendertarget_view(dst_impl->ddraw->wined3d_device, 0);
rtv = wined3d_device_context_get_rendertarget_view(dst_impl->ddraw->immediate_context, 0);
dst_ddraw_texture = wined3d_texture_get_parent(dst_impl->wined3d_texture);
texture_memory = dst_ddraw_texture->texture_memory;
draw_texture = dst_impl->draw_texture;

View File

@ -406,7 +406,7 @@ static HRESULT WINAPI d3d_viewport_SetViewport(IDirect3DViewport3 *iface, D3DVIE
if (device->version > 1)
{
if (!(rtv = wined3d_device_get_rendertarget_view(device->wined3d_device, 0)))
if (!(rtv = wined3d_device_context_get_rendertarget_view(device->immediate_context, 0)))
{
wined3d_mutex_unlock();
return DDERR_INVALIDCAPS;
@ -1035,7 +1035,7 @@ static HRESULT WINAPI d3d_viewport_SetViewport2(IDirect3DViewport3 *iface, D3DVI
if (device->version > 1)
{
if (!(rtv = wined3d_device_get_rendertarget_view(device->wined3d_device, 0)))
if (!(rtv = wined3d_device_context_get_rendertarget_view(device->immediate_context, 0)))
{
wined3d_mutex_unlock();
return DDERR_INVALIDCAPS;

View File

@ -5391,21 +5391,21 @@ void CDECL wined3d_device_context_issue_query(struct wined3d_device_context *con
query->state = QUERY_SIGNALLED;
}
struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(const struct wined3d_device *device,
unsigned int view_idx)
struct wined3d_rendertarget_view * CDECL wined3d_device_context_get_rendertarget_view(
const struct wined3d_device_context *context, unsigned int view_idx)
{
unsigned int max_rt_count;
TRACE("device %p, view_idx %u.\n", device, view_idx);
TRACE("context %p, view_idx %u.\n", context, view_idx);
max_rt_count = device->adapter->d3d_info.limits.max_rt_count;
max_rt_count = context->device->adapter->d3d_info.limits.max_rt_count;
if (view_idx >= max_rt_count)
{
WARN("Only %u render targets are supported.\n", max_rt_count);
return NULL;
}
return device->cs->c.state->fb.render_targets[view_idx];
return context->state->fb.render_targets[view_idx];
}
struct wined3d_rendertarget_view * CDECL wined3d_device_get_depth_stencil_view(const struct wined3d_device *device)

View File

@ -85,7 +85,6 @@
@ cdecl wined3d_device_get_ps_sampler(ptr long)
@ cdecl wined3d_device_get_raster_status(ptr long ptr)
@ cdecl wined3d_device_get_render_state(ptr long)
@ cdecl wined3d_device_get_rendertarget_view(ptr long)
@ cdecl wined3d_device_get_software_vertex_processing(ptr)
@ cdecl wined3d_device_get_state(ptr)
@ cdecl wined3d_device_get_stream_output(ptr long ptr)
@ -169,6 +168,7 @@
@ cdecl wined3d_device_context_get_constant_buffer(ptr long long)
@ cdecl wined3d_device_context_get_depth_stencil_state(ptr ptr)
@ cdecl wined3d_device_context_get_rasterizer_state(ptr)
@ cdecl wined3d_device_context_get_rendertarget_view(ptr long)
@ cdecl wined3d_device_context_get_sampler(ptr long long)
@ cdecl wined3d_device_context_get_scissor_rects(ptr ptr ptr)
@ cdecl wined3d_device_context_get_shader(ptr long)

View File

@ -2418,8 +2418,6 @@ struct wined3d_sampler * __cdecl wined3d_device_get_ps_sampler(const struct wine
HRESULT __cdecl wined3d_device_get_raster_status(const struct wined3d_device *device,
UINT swapchain_idx, struct wined3d_raster_status *raster_status);
DWORD __cdecl wined3d_device_get_render_state(const struct wined3d_device *device, enum wined3d_render_state state);
struct wined3d_rendertarget_view * __cdecl wined3d_device_get_rendertarget_view(const struct wined3d_device *device,
unsigned int view_idx);
BOOL __cdecl wined3d_device_get_software_vertex_processing(const struct wined3d_device *device);
struct wined3d_state * __cdecl wined3d_device_get_state(struct wined3d_device *device);
struct wined3d_buffer * __cdecl wined3d_device_get_stream_output(struct wined3d_device *device,
@ -2564,6 +2562,8 @@ struct wined3d_depth_stencil_state * __cdecl wined3d_device_context_get_depth_st
const struct wined3d_device_context *context, unsigned int *stencil_ref);
struct wined3d_rasterizer_state * __cdecl wined3d_device_context_get_rasterizer_state(
struct wined3d_device_context *context);
struct wined3d_rendertarget_view * __cdecl wined3d_device_context_get_rendertarget_view(
const struct wined3d_device_context *context, unsigned int view_idx);
struct wined3d_sampler * __cdecl wined3d_device_context_get_sampler(const struct wined3d_device_context *context,
enum wined3d_shader_type shader_type, unsigned int idx);
void __cdecl wined3d_device_context_get_scissor_rects(const struct wined3d_device_context *context,