From 619c54f49a45596cdd8a91a860ea6084765cdd0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Fri, 24 Aug 2018 15:44:03 +0200 Subject: [PATCH] wined3d: Add max_rt_count field to d3d_info. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/adapter_gl.c | 1 + dlls/wined3d/cs.c | 17 +++++++++-------- dlls/wined3d/device.c | 22 ++++++++++++++-------- dlls/wined3d/directx.c | 2 +- dlls/wined3d/wined3d_private.h | 1 + 5 files changed, 26 insertions(+), 17 deletions(-) diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c index 8c1cce457ed..af17df83cd0 100644 --- a/dlls/wined3d/adapter_gl.c +++ b/dlls/wined3d/adapter_gl.c @@ -3657,6 +3657,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter, adapter->vertex_pipe = select_vertex_implementation(gl_info, adapter->shader_backend); adapter->fragment_pipe = select_fragment_implementation(gl_info, adapter->shader_backend); + d3d_info->limits.max_rt_count = gl_info->limits.buffers; d3d_info->limits.pointsize_max = gl_info->limits.pointsize_max; adapter->shader_backend->shader_get_caps(gl_info, &shader_caps); diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 7bd51f4c2a1..ecfce418123 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -588,7 +588,7 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil) { - unsigned int rt_count = cs->device->adapter->gl_info.limits.buffers; + unsigned int rt_count = cs->device->adapter->d3d_info.limits.max_rt_count; const struct wined3d_state *state = &cs->device->state; const struct wined3d_viewport *vp = &state->viewports[0]; struct wined3d_rendertarget_view *view; @@ -839,6 +839,7 @@ void wined3d_cs_emit_dispatch_indirect(struct wined3d_cs *cs, static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) { + const struct wined3d_d3d_info *d3d_info = &cs->device->adapter->d3d_info; const struct wined3d_gl_info *gl_info = &cs->device->adapter->gl_info; const struct wined3d_shader *geometry_shader; struct wined3d_state *state = &cs->state; @@ -893,7 +894,7 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) if (state->textures[i]) wined3d_resource_release(&state->textures[i]->resource); } - for (i = 0; i < gl_info->limits.buffers; ++i) + for (i = 0; i < d3d_info->limits.max_rt_count; ++i) { if (state->fb->render_targets[i]) wined3d_resource_release(state->fb->render_targets[i]->resource); @@ -906,7 +907,7 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) } static void acquire_graphics_pipeline_resources(const struct wined3d_state *state, - BOOL indexed, const struct wined3d_gl_info *gl_info) + BOOL indexed, const struct wined3d_d3d_info *d3d_info) { unsigned int i; @@ -927,7 +928,7 @@ static void acquire_graphics_pipeline_resources(const struct wined3d_state *stat if (state->textures[i]) wined3d_resource_acquire(&state->textures[i]->resource); } - for (i = 0; i < gl_info->limits.buffers; ++i) + for (i = 0; i < d3d_info->limits.max_rt_count; ++i) { if (state->fb->render_targets[i]) wined3d_resource_acquire(state->fb->render_targets[i]->resource); @@ -943,7 +944,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, unsigned int base_vertex_idx, unsigned int start_idx, unsigned int index_count, unsigned int start_instance, unsigned int instance_count, BOOL indexed) { - const struct wined3d_gl_info *gl_info = &cs->device->adapter->gl_info; + const struct wined3d_d3d_info *d3d_info = &cs->device->adapter->d3d_info; const struct wined3d_state *state = &cs->device->state; struct wined3d_cs_draw *op; @@ -959,7 +960,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, unsigned op->parameters.u.direct.instance_count = instance_count; op->parameters.indexed = indexed; - acquire_graphics_pipeline_resources(state, indexed, gl_info); + acquire_graphics_pipeline_resources(state, indexed, d3d_info); cs->ops->submit(cs, WINED3D_CS_QUEUE_DEFAULT); } @@ -967,7 +968,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, unsigned void wined3d_cs_emit_draw_indirect(struct wined3d_cs *cs, GLenum primitive_type, unsigned int patch_vertex_count, struct wined3d_buffer *buffer, unsigned int offset, BOOL indexed) { - const struct wined3d_gl_info *gl_info = &cs->device->adapter->gl_info; + const struct wined3d_d3d_info *d3d_info = &cs->device->adapter->d3d_info; const struct wined3d_state *state = &cs->device->state; struct wined3d_cs_draw *op; @@ -980,7 +981,7 @@ void wined3d_cs_emit_draw_indirect(struct wined3d_cs *cs, GLenum primitive_type, op->parameters.u.indirect.offset = offset; op->parameters.indexed = indexed; - acquire_graphics_pipeline_resources(state, indexed, gl_info); + acquire_graphics_pipeline_resources(state, indexed, d3d_info); wined3d_resource_acquire(&buffer->resource); cs->ops->submit(cs, WINED3D_CS_QUEUE_DEFAULT); diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index ab67a967a3f..96b8d3c247d 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -970,7 +970,7 @@ static void device_init_swapchain_state(struct wined3d_device *device, struct wi BOOL ds_enable = swapchain->desc.enable_auto_depth_stencil; unsigned int i; - for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) + for (i = 0; i < device->adapter->d3d_info.limits.max_rt_count; ++i) { wined3d_device_set_rendertarget_view(device, i, NULL, FALSE); } @@ -1240,7 +1240,7 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) ERR("Something's still holding the auto depth/stencil view (%p).\n", view); } - for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) + for (i = 0; i < device->adapter->d3d_info.limits.max_rt_count; ++i) { wined3d_device_set_rendertarget_view(device, i, NULL, FALSE); } @@ -4380,11 +4380,14 @@ void CDECL wined3d_device_clear_unordered_access_view_uint(struct wined3d_device struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(const struct wined3d_device *device, unsigned int view_idx) { + unsigned int max_rt_count; + TRACE("device %p, view_idx %u.\n", device, view_idx); - if (view_idx >= device->adapter->gl_info.limits.buffers) + max_rt_count = device->adapter->d3d_info.limits.max_rt_count; + if (view_idx >= max_rt_count) { - WARN("Only %u render targets are supported.\n", device->adapter->gl_info.limits.buffers); + WARN("Only %u render targets are supported.\n", max_rt_count); return NULL; } @@ -4402,13 +4405,15 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device unsigned int view_idx, struct wined3d_rendertarget_view *view, BOOL set_viewport) { struct wined3d_rendertarget_view *prev; + unsigned int max_rt_count; TRACE("device %p, view_idx %u, view %p, set_viewport %#x.\n", device, view_idx, view, set_viewport); - if (view_idx >= device->adapter->gl_info.limits.buffers) + max_rt_count = device->adapter->d3d_info.limits.max_rt_count; + if (view_idx >= max_rt_count) { - WARN("Only %u render targets are supported.\n", device->adapter->gl_info.limits.buffers); + WARN("Only %u render targets are supported.\n", max_rt_count); return WINED3DERR_INVALIDCALL; } @@ -4706,6 +4711,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, const struct wined3d_swapchain_desc *swapchain_desc, const struct wined3d_display_mode *mode, wined3d_device_reset_cb callback, BOOL reset_state) { + const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info; struct wined3d_resource *resource, *cursor; struct wined3d_swapchain *swapchain; struct wined3d_view_desc view_desc; @@ -4739,7 +4745,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, state_unbind_resources(&device->state); } - for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) + for (i = 0; i < d3d_info->limits.max_rt_count; ++i) { wined3d_device_set_rendertarget_view(device, i, NULL, FALSE); } @@ -5038,7 +5044,7 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso if (device->d3d_initialized) { - for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) + for (i = 0; i < ARRAY_SIZE(device->fb.render_targets); ++i) { if ((rtv = device->fb.render_targets[i]) && rtv->resource == resource) ERR("Resource %p is still in use as render target %u.\n", resource, i); diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 774cd48caec..8fa3a2492df 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -2201,7 +2201,7 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte caps->AdapterOrdinalInGroup = 0; caps->NumberOfAdaptersInGroup = 1; - caps->NumSimultaneousRTs = gl_info->limits.buffers; + caps->NumSimultaneousRTs = d3d_info->limits.max_rt_count; caps->StretchRectFilterCaps = WINED3DPTFILTERCAPS_MINFPOINT | WINED3DPTFILTERCAPS_MAGFPOINT | diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index de0b4867de7..bc031890960 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -164,6 +164,7 @@ struct wined3d_d3d_limits unsigned int ffp_vertex_blend_matrices; unsigned int active_light_count; + unsigned int max_rt_count; float pointsize_max; };