Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d11/d3d11_private.h | 2 ++ dlls/d3d11/device.c | 39 ++++++++++++++++++++------------------ 2 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/dlls/d3d11/d3d11_private.h b/dlls/d3d11/d3d11_private.h index a64d6975f85..5a812e1b254 100644 --- a/dlls/d3d11/d3d11_private.h +++ b/dlls/d3d11/d3d11_private.h @@ -546,6 +546,8 @@ struct d3d11_immediate_context ID3D11Multithread ID3D11Multithread_iface; LONG refcount;
+ struct wined3d_device_context *wined3d_context; + struct wined3d_private_store private_store; };
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index c8ec35a59c0..6a30ab313f0 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -512,7 +512,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_PSSetShaderResources(ID3D1 static void STDMETHODCALLTYPE d3d11_immediate_context_PSSetShader(ID3D11DeviceContext1 *iface, ID3D11PixelShader *shader, ID3D11ClassInstance *const *class_instances, UINT class_instance_count) { - struct d3d_device *device = device_from_immediate_ID3D11DeviceContext1(iface); + struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext1(iface); struct d3d_pixel_shader *ps = unsafe_impl_from_ID3D11PixelShader(shader);
TRACE("iface %p, shader %p, class_instances %p, class_instance_count %u.\n", @@ -522,7 +522,8 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_PSSetShader(ID3D11DeviceCo FIXME("Dynamic linking is not implemented yet.\n");
wined3d_mutex_lock(); - wined3d_device_set_pixel_shader(device->wined3d_device, ps ? ps->wined3d_shader : NULL); + wined3d_device_context_set_shader(context->wined3d_context, WINED3D_SHADER_TYPE_PIXEL, + ps ? ps->wined3d_shader : NULL); wined3d_mutex_unlock(); }
@@ -549,7 +550,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_PSSetSamplers(ID3D11Device static void STDMETHODCALLTYPE d3d11_immediate_context_VSSetShader(ID3D11DeviceContext1 *iface, ID3D11VertexShader *shader, ID3D11ClassInstance *const *class_instances, UINT class_instance_count) { - struct d3d_device *device = device_from_immediate_ID3D11DeviceContext1(iface); + struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext1(iface); struct d3d_vertex_shader *vs = unsafe_impl_from_ID3D11VertexShader(shader);
TRACE("iface %p, shader %p, class_instances %p, class_instance_count %u.\n", @@ -559,7 +560,8 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_VSSetShader(ID3D11DeviceCo FIXME("Dynamic linking is not implemented yet.\n");
wined3d_mutex_lock(); - wined3d_device_set_vertex_shader(device->wined3d_device, vs ? vs->wined3d_shader : NULL); + wined3d_device_context_set_shader(context->wined3d_context, WINED3D_SHADER_TYPE_VERTEX, + vs ? vs->wined3d_shader : NULL); wined3d_mutex_unlock(); }
@@ -737,7 +739,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_GSSetConstantBuffers(ID3D1 static void STDMETHODCALLTYPE d3d11_immediate_context_GSSetShader(ID3D11DeviceContext1 *iface, ID3D11GeometryShader *shader, ID3D11ClassInstance *const *class_instances, UINT class_instance_count) { - struct d3d_device *device = device_from_immediate_ID3D11DeviceContext1(iface); + struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext1(iface); struct d3d_geometry_shader *gs = unsafe_impl_from_ID3D11GeometryShader(shader);
TRACE("iface %p, shader %p, class_instances %p, class_instance_count %u.\n", @@ -747,7 +749,8 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_GSSetShader(ID3D11DeviceCo FIXME("Dynamic linking is not implemented yet.\n");
wined3d_mutex_lock(); - wined3d_device_set_geometry_shader(device->wined3d_device, gs ? gs->wined3d_shader : NULL); + wined3d_device_context_set_shader(context->wined3d_context, WINED3D_SHADER_TYPE_GEOMETRY, + gs ? gs->wined3d_shader : NULL); wined3d_mutex_unlock(); }
@@ -1425,7 +1428,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_HSSetShaderResources(ID3D1 static void STDMETHODCALLTYPE d3d11_immediate_context_HSSetShader(ID3D11DeviceContext1 *iface, ID3D11HullShader *shader, ID3D11ClassInstance *const *class_instances, UINT class_instance_count) { - struct d3d_device *device = device_from_immediate_ID3D11DeviceContext1(iface); + struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext1(iface); struct d3d11_hull_shader *hs = unsafe_impl_from_ID3D11HullShader(shader);
TRACE("iface %p, shader %p, class_instances %p, class_instance_count %u.\n", @@ -1435,7 +1438,8 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_HSSetShader(ID3D11DeviceCo FIXME("Dynamic linking is not implemented yet.\n");
wined3d_mutex_lock(); - wined3d_device_set_hull_shader(device->wined3d_device, hs ? hs->wined3d_shader : NULL); + wined3d_device_context_set_shader(context->wined3d_context, WINED3D_SHADER_TYPE_HULL, + hs ? hs->wined3d_shader : NULL); wined3d_mutex_unlock(); }
@@ -1492,7 +1496,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_DSSetShaderResources(ID3D1 static void STDMETHODCALLTYPE d3d11_immediate_context_DSSetShader(ID3D11DeviceContext1 *iface, ID3D11DomainShader *shader, ID3D11ClassInstance *const *class_instances, UINT class_instance_count) { - struct d3d_device *device = device_from_immediate_ID3D11DeviceContext1(iface); + struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext1(iface); struct d3d11_domain_shader *ds = unsafe_impl_from_ID3D11DomainShader(shader);
TRACE("iface %p, shader %p, class_instances %p, class_instance_count %u.\n", @@ -1502,7 +1506,8 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_DSSetShader(ID3D11DeviceCo FIXME("Dynamic linking is not implemented yet.\n");
wined3d_mutex_lock(); - wined3d_device_set_domain_shader(device->wined3d_device, ds ? ds->wined3d_shader : NULL); + wined3d_device_context_set_shader(context->wined3d_context, WINED3D_SHADER_TYPE_DOMAIN, + ds ? ds->wined3d_shader : NULL); wined3d_mutex_unlock(); }
@@ -1579,7 +1584,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_CSSetUnorderedAccessViews( static void STDMETHODCALLTYPE d3d11_immediate_context_CSSetShader(ID3D11DeviceContext1 *iface, ID3D11ComputeShader *shader, ID3D11ClassInstance *const *class_instances, UINT class_instance_count) { - struct d3d_device *device = device_from_immediate_ID3D11DeviceContext1(iface); + struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext1(iface); struct d3d11_compute_shader *cs = unsafe_impl_from_ID3D11ComputeShader(shader);
TRACE("iface %p, shader %p, class_instances %p, class_instance_count %u.\n", @@ -1589,7 +1594,8 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_CSSetShader(ID3D11DeviceCo FIXME("Dynamic linking is not implemented yet.\n");
wined3d_mutex_lock(); - wined3d_device_set_compute_shader(device->wined3d_device, cs ? cs->wined3d_shader : NULL); + wined3d_device_context_set_shader(context->wined3d_context, WINED3D_SHADER_TYPE_COMPUTE, + cs ? cs->wined3d_shader : NULL); wined3d_mutex_unlock(); }
@@ -2577,6 +2583,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_CSGetConstantBuffers(ID3D1
static void STDMETHODCALLTYPE d3d11_immediate_context_ClearState(ID3D11DeviceContext1 *iface) { + struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext1(iface); struct d3d_device *device = device_from_immediate_ID3D11DeviceContext1(iface); static const float blend_factor[] = {1.0f, 1.0f, 1.0f, 1.0f}; unsigned int i, j; @@ -2584,12 +2591,6 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_ClearState(ID3D11DeviceCon TRACE("iface %p.\n", iface);
wined3d_mutex_lock(); - wined3d_device_set_vertex_shader(device->wined3d_device, NULL); - wined3d_device_set_hull_shader(device->wined3d_device, NULL); - wined3d_device_set_domain_shader(device->wined3d_device, NULL); - wined3d_device_set_geometry_shader(device->wined3d_device, NULL); - wined3d_device_set_pixel_shader(device->wined3d_device, NULL); - wined3d_device_set_compute_shader(device->wined3d_device, NULL); for (i = 0; i < D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT; ++i) { wined3d_device_set_vs_sampler(device->wined3d_device, i, NULL); @@ -2610,6 +2611,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_ClearState(ID3D11DeviceCon } for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i) { + wined3d_device_context_set_shader(context->wined3d_context, i, NULL); for (j = 0; j < D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; ++j) wined3d_device_set_constant_buffer(device->wined3d_device, i, j, NULL); } @@ -6458,6 +6460,7 @@ static void CDECL device_parent_wined3d_device_created(struct wined3d_device_par
wined3d_device_incref(wined3d_device); device->wined3d_device = wined3d_device; + device->immediate_context.wined3d_context = wined3d_device_get_immediate_context(wined3d_device);
device->feature_level = d3d_feature_level_from_wined3d(wined3d_device_get_feature_level(wined3d_device));
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/device.c | 46 +++++++++++++++++++++++---------------- dlls/wined3d/wined3d.spec | 1 + include/wine/wined3d.h | 2 ++ 3 files changed, 30 insertions(+), 19 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 1edbd23e7e4..338b489c9b9 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -2107,27 +2107,13 @@ void CDECL wined3d_device_context_set_shader(struct wined3d_device_context *cont wined3d_shader_decref(prev); }
-void CDECL wined3d_device_set_vertex_shader(struct wined3d_device *device, struct wined3d_shader *shader) -{ - TRACE("device %p, shader %p.\n", device, shader); - - return wined3d_device_context_set_shader(&device->cs->c, WINED3D_SHADER_TYPE_VERTEX, shader); -} - -struct wined3d_shader * CDECL wined3d_device_get_vertex_shader(const struct wined3d_device *device) -{ - TRACE("device %p.\n", device); - - return device->cs->c.state->shader[WINED3D_SHADER_TYPE_VERTEX]; -} - -void CDECL wined3d_device_set_constant_buffer(struct wined3d_device *device, - enum wined3d_shader_type type, UINT idx, struct wined3d_buffer *buffer) +void CDECL wined3d_device_context_set_constant_buffer(struct wined3d_device_context *context, + enum wined3d_shader_type type, unsigned int idx, struct wined3d_buffer *buffer) { - struct wined3d_state *state = device->cs->c.state; + struct wined3d_state *state = context->state; struct wined3d_buffer *prev;
- TRACE("device %p, type %#x, idx %u, buffer %p.\n", device, type, idx, buffer); + TRACE("context %p, type %#x, idx %u, buffer %p.\n", context, type, idx, buffer);
if (idx >= MAX_CONSTANT_BUFFERS) { @@ -2142,11 +2128,33 @@ void CDECL wined3d_device_set_constant_buffer(struct wined3d_device *device, if (buffer) wined3d_buffer_incref(buffer); state->cb[type][idx] = buffer; - wined3d_device_context_emit_set_constant_buffer(&device->cs->c, type, idx, buffer); + wined3d_device_context_emit_set_constant_buffer(context, type, idx, buffer); if (prev) wined3d_buffer_decref(prev); }
+void CDECL wined3d_device_set_vertex_shader(struct wined3d_device *device, struct wined3d_shader *shader) +{ + TRACE("device %p, shader %p.\n", device, shader); + + return wined3d_device_context_set_shader(&device->cs->c, WINED3D_SHADER_TYPE_VERTEX, shader); +} + +struct wined3d_shader * CDECL wined3d_device_get_vertex_shader(const struct wined3d_device *device) +{ + TRACE("device %p.\n", device); + + return device->cs->c.state->shader[WINED3D_SHADER_TYPE_VERTEX]; +} + +void CDECL wined3d_device_set_constant_buffer(struct wined3d_device *device, + enum wined3d_shader_type type, UINT idx, struct wined3d_buffer *buffer) +{ + TRACE("device %p, type %#x, idx %u, buffer %p.\n", device, type, idx, buffer); + + return wined3d_device_context_set_constant_buffer(&device->cs->c, type, idx, buffer); +} + struct wined3d_buffer * CDECL wined3d_device_get_constant_buffer(const struct wined3d_device *device, enum wined3d_shader_type shader_type, unsigned int idx) { diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index f5fa1d3d7e5..d88817d6551 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -167,6 +167,7 @@ @ cdecl wined3d_device_update_texture(ptr ptr ptr) @ cdecl wined3d_device_validate_device(ptr ptr)
+@ cdecl wined3d_device_context_set_constant_buffer(ptr long long ptr) @ cdecl wined3d_device_context_set_shader(ptr long ptr)
@ cdecl wined3d_output_find_closest_matching_mode(ptr ptr) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index ba9e8642ea2..0bdf53c651e 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2549,6 +2549,8 @@ HRESULT __cdecl wined3d_device_update_texture(struct wined3d_device *device, struct wined3d_texture *src_texture, struct wined3d_texture *dst_texture); HRESULT __cdecl wined3d_device_validate_device(const struct wined3d_device *device, DWORD *num_passes);
+void __cdecl wined3d_device_context_set_constant_buffer(struct wined3d_device_context *context, + enum wined3d_shader_type type, unsigned int idx, struct wined3d_buffer *buffer); void __cdecl wined3d_device_context_set_shader(struct wined3d_device_context *context, enum wined3d_shader_type type, struct wined3d_shader *shader);
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d11/device.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 6a30ab313f0..6a6744d22af 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -425,7 +425,7 @@ static void d3d11_immediate_context_get_constant_buffers(ID3D11DeviceContext1 *i static void d3d11_immediate_context_set_constant_buffers(ID3D11DeviceContext1 *iface, enum wined3d_shader_type type, UINT start_slot, UINT buffer_count, ID3D11Buffer *const *buffers) { - struct d3d_device *device = device_from_immediate_ID3D11DeviceContext1(iface); + struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext1(iface); unsigned int i;
wined3d_mutex_lock(); @@ -433,7 +433,7 @@ static void d3d11_immediate_context_set_constant_buffers(ID3D11DeviceContext1 *i { struct d3d_buffer *buffer = unsafe_impl_from_ID3D11Buffer(buffers[i]);
- wined3d_device_set_constant_buffer(device->wined3d_device, type, start_slot + i, + wined3d_device_context_set_constant_buffer(context->wined3d_context, type, start_slot + i, buffer ? buffer->wined3d_buffer : NULL); } wined3d_mutex_unlock(); @@ -2613,7 +2613,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_ClearState(ID3D11DeviceCon { wined3d_device_context_set_shader(context->wined3d_context, i, NULL); for (j = 0; j < D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; ++j) - wined3d_device_set_constant_buffer(device->wined3d_device, i, j, NULL); + wined3d_device_context_set_constant_buffer(context->wined3d_context, i, j, NULL); } for (i = 0; i < D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT; ++i) {
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=86838
Your paranoid android.
=== debiant2 (build log) ===
error: patch failed: dlls/d3d11/device.c:425 Task: Patch failed to apply
=== debiant2 (build log) ===
error: patch failed: dlls/d3d11/device.c:425 Task: Patch failed to apply
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/cs.c | 8 ++++---- dlls/wined3d/device.c | 4 ++-- dlls/wined3d/wined3d_private.h | 5 +++-- 3 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 43f1d04dd0f..4d50ecba23b 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -1651,18 +1651,18 @@ static void wined3d_cs_exec_set_blend_state(struct wined3d_cs *cs, const void *d device_invalidate_state(cs->c.device, STATE_SAMPLE_MASK); }
-void wined3d_cs_emit_set_blend_state(struct wined3d_cs *cs, struct wined3d_blend_state *state, - const struct wined3d_color *blend_factor, unsigned int sample_mask) +void wined3d_device_context_emit_set_blend_state(struct wined3d_device_context *context, + struct wined3d_blend_state *state, const struct wined3d_color *blend_factor, unsigned int sample_mask) { struct wined3d_cs_set_blend_state *op;
- op = wined3d_device_context_require_space(&cs->c, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT); + op = wined3d_device_context_require_space(context, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT); op->opcode = WINED3D_CS_OP_SET_BLEND_STATE; op->state = state; op->factor = *blend_factor; op->sample_mask = sample_mask;
- wined3d_device_context_submit(&cs->c, WINED3D_CS_QUEUE_DEFAULT); + wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT); }
static void wined3d_cs_exec_set_depth_stencil_state(struct wined3d_cs *cs, const void *data) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 338b489c9b9..8ea7351f5fc 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1756,7 +1756,7 @@ void CDECL wined3d_device_set_blend_state(struct wined3d_device *device, state->blend_state = blend_state; state->blend_factor = *blend_factor; state->sample_mask = sample_mask; - wined3d_cs_emit_set_blend_state(device->cs, blend_state, blend_factor, sample_mask); + wined3d_device_context_emit_set_blend_state(&device->cs->c, blend_state, blend_factor, sample_mask); if (prev) wined3d_blend_state_decref(prev); } @@ -2041,7 +2041,7 @@ void CDECL wined3d_device_set_state(struct wined3d_device *device, struct wined3 wined3d_cs_emit_set_render_state(device->cs, i, state->render_states[i]); }
- wined3d_cs_emit_set_blend_state(device->cs, state->blend_state, &state->blend_factor, state->sample_mask); + wined3d_device_context_emit_set_blend_state(context, state->blend_state, &state->blend_factor, state->sample_mask); wined3d_cs_emit_set_depth_stencil_state(device->cs, state->depth_stencil_state, state->stencil_ref); wined3d_cs_emit_set_rasterizer_state(device->cs, state->rasterizer_state); } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 6fc743e74db..7dfa7d2211b 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -4741,8 +4741,6 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw const RECT *dst_rect, HWND dst_window_override, unsigned int swap_interval, DWORD flags) DECLSPEC_HIDDEN; void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags) DECLSPEC_HIDDEN; void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) DECLSPEC_HIDDEN; -void wined3d_cs_emit_set_blend_state(struct wined3d_cs *cs, struct wined3d_blend_state *state, - const struct wined3d_color *blend_factor, unsigned int sample_mask) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const struct wined3d_vec4 *plane) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture *texture, @@ -4810,6 +4808,9 @@ static inline void wined3d_cs_push_constants(struct wined3d_cs *cs, enum wined3d cs->c.ops->push_constants(&cs->c, p, start_idx, count, constants); }
+void wined3d_device_context_emit_set_blend_state(struct wined3d_device_context *context, + struct wined3d_blend_state *state, const struct wined3d_color *blend_factor, + unsigned int sample_mask) DECLSPEC_HIDDEN; void wined3d_device_context_emit_set_constant_buffer(struct wined3d_device_context *context, enum wined3d_shader_type type, UINT cb_idx, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN; void wined3d_device_context_emit_set_shader(struct wined3d_device_context *context, enum wined3d_shader_type type,
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=86839
Your paranoid android.
=== debiant2 (build log) ===
error: patch failed: dlls/d3d11/device.c:425 error: patch failed: dlls/wined3d/cs.c:1651 error: patch failed: dlls/wined3d/device.c:1756 error: patch failed: dlls/wined3d/wined3d_private.h:4741 Task: Patch failed to apply
=== debiant2 (build log) ===
error: patch failed: dlls/d3d11/device.c:425 error: patch failed: dlls/wined3d/cs.c:1651 error: patch failed: dlls/wined3d/device.c:1756 error: patch failed: dlls/wined3d/wined3d_private.h:4741 Task: Patch failed to apply
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/device.c | 41 ++++++++++++++++++++++++--------------- dlls/wined3d/wined3d.spec | 1 + include/wine/wined3d.h | 2 ++ 3 files changed, 28 insertions(+), 16 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 8ea7351f5fc..d5179f68cd6 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1740,25 +1740,10 @@ static void resolve_depth_buffer(struct wined3d_device *device) void CDECL wined3d_device_set_blend_state(struct wined3d_device *device, struct wined3d_blend_state *blend_state, const struct wined3d_color *blend_factor, unsigned int sample_mask) { - struct wined3d_state *state = device->cs->c.state; - struct wined3d_blend_state *prev; - TRACE("device %p, blend_state %p, blend_factor %s, sample_mask %#x.\n", device, blend_state, debug_color(blend_factor), sample_mask);
- prev = state->blend_state; - if (prev == blend_state && !memcmp(blend_factor, &state->blend_factor, sizeof(*blend_factor)) - && sample_mask == state->sample_mask) - return; - - if (blend_state) - wined3d_blend_state_incref(blend_state); - state->blend_state = blend_state; - state->blend_factor = *blend_factor; - state->sample_mask = sample_mask; - wined3d_device_context_emit_set_blend_state(&device->cs->c, blend_state, blend_factor, sample_mask); - if (prev) - wined3d_blend_state_decref(prev); + wined3d_device_context_set_blend_state(&device->cs->c, blend_state, blend_factor, sample_mask); }
struct wined3d_blend_state * CDECL wined3d_device_get_blend_state(const struct wined3d_device *device, @@ -2133,6 +2118,30 @@ void CDECL wined3d_device_context_set_constant_buffer(struct wined3d_device_cont wined3d_buffer_decref(prev); }
+void CDECL wined3d_device_context_set_blend_state(struct wined3d_device_context *context, + struct wined3d_blend_state *blend_state, const struct wined3d_color *blend_factor, unsigned int sample_mask) +{ + struct wined3d_state *state = context->state; + struct wined3d_blend_state *prev; + + TRACE("context %p, blend_state %p, blend_factor %p, sample_mask %#x.\n", + context, blend_state, blend_factor, sample_mask); + + prev = state->blend_state; + if (prev == blend_state && !memcmp(blend_factor, &state->blend_factor, sizeof(*blend_factor)) + && sample_mask == state->sample_mask) + return; + + if (blend_state) + wined3d_blend_state_incref(blend_state); + state->blend_state = blend_state; + state->blend_factor = *blend_factor; + state->sample_mask = sample_mask; + wined3d_device_context_emit_set_blend_state(context, blend_state, blend_factor, sample_mask); + if (prev) + wined3d_blend_state_decref(prev); +} + void CDECL wined3d_device_set_vertex_shader(struct wined3d_device *device, struct wined3d_shader *shader) { TRACE("device %p, shader %p.\n", device, shader); diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index d88817d6551..17cff7ffb9f 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -167,6 +167,7 @@ @ cdecl wined3d_device_update_texture(ptr ptr ptr) @ cdecl wined3d_device_validate_device(ptr ptr)
+@ cdecl wined3d_device_context_set_blend_state(ptr ptr ptr long) @ cdecl wined3d_device_context_set_constant_buffer(ptr long long ptr) @ cdecl wined3d_device_context_set_shader(ptr long ptr)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 0bdf53c651e..ead427a13f6 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2549,6 +2549,8 @@ HRESULT __cdecl wined3d_device_update_texture(struct wined3d_device *device, struct wined3d_texture *src_texture, struct wined3d_texture *dst_texture); HRESULT __cdecl wined3d_device_validate_device(const struct wined3d_device *device, DWORD *num_passes);
+void __cdecl wined3d_device_context_set_blend_state(struct wined3d_device_context *context, + struct wined3d_blend_state *state, const struct wined3d_color *blend_factor, unsigned int sample_mask); void __cdecl wined3d_device_context_set_constant_buffer(struct wined3d_device_context *context, enum wined3d_shader_type type, unsigned int idx, struct wined3d_buffer *buffer); void __cdecl wined3d_device_context_set_shader(struct wined3d_device_context *context,
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=86840
Your paranoid android.
=== debiant2 (build log) ===
error: patch failed: dlls/d3d11/device.c:425 error: patch failed: dlls/wined3d/cs.c:1651 error: patch failed: dlls/wined3d/device.c:1756 error: patch failed: dlls/wined3d/wined3d_private.h:4741 error: patch failed: dlls/wined3d/device.c:1740 error: patch failed: dlls/wined3d/wined3d.spec:167 error: patch failed: include/wine/wined3d.h:2549 Task: Patch failed to apply
=== debiant2 (build log) ===
error: patch failed: dlls/d3d11/device.c:425 error: patch failed: dlls/wined3d/cs.c:1651 error: patch failed: dlls/wined3d/device.c:1756 error: patch failed: dlls/wined3d/wined3d_private.h:4741 error: patch failed: dlls/wined3d/device.c:1740 error: patch failed: dlls/wined3d/wined3d.spec:167 error: patch failed: include/wine/wined3d.h:2549 Task: Patch failed to apply
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d11/device.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 6a6744d22af..6f98227bef3 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -1000,7 +1000,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetRenderTargetsAndUnord static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetBlendState(ID3D11DeviceContext1 *iface, ID3D11BlendState *blend_state, const float blend_factor[4], UINT sample_mask) { - struct d3d_device *device = device_from_immediate_ID3D11DeviceContext1(iface); + struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext1(iface); static const float default_blend_factor[] = {1.0f, 1.0f, 1.0f, 1.0f}; struct d3d_blend_state *blend_state_impl;
@@ -1012,10 +1012,10 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetBlendState(ID3D11Devi
wined3d_mutex_lock(); if (!(blend_state_impl = unsafe_impl_from_ID3D11BlendState(blend_state))) - wined3d_device_set_blend_state(device->wined3d_device, NULL, + wined3d_device_context_set_blend_state(context->wined3d_context, NULL, (const struct wined3d_color *)blend_factor, sample_mask); else - wined3d_device_set_blend_state(device->wined3d_device, blend_state_impl->wined3d_state, + wined3d_device_context_set_blend_state(context->wined3d_context, blend_state_impl->wined3d_state, (const struct wined3d_color *)blend_factor, sample_mask); wined3d_mutex_unlock(); }
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
On Wed, 10 Mar 2021 at 03:09, Zebediah Figura z.figura12@gmail.com wrote:
dlls/d3d11/device.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
For what it's worth, this gets rid of the only external usage of wined3d_device_context_set_blend_state(), which would allow it to be removed from the public API. If your intention is to get rid of internal usage as well, and then simply remove the entire function, that's fine too.
On 3/10/21 7:55 AM, Henri Verbeet wrote:
On Wed, 10 Mar 2021 at 03:09, Zebediah Figura z.figura12@gmail.com wrote:
dlls/d3d11/device.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
For what it's worth, this gets rid of the only external usage of wined3d_device_context_set_blend_state(), which would allow it to be removed from the public API. If your intention is to get rid of internal usage as well, and then simply remove the entire function, that's fine too.
I intend to do something like that eventually, but haven't gotten there yet.
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=86841
Your paranoid android.
=== debiant2 (build log) ===
error: patch failed: dlls/d3d11/device.c:425 error: patch failed: dlls/wined3d/cs.c:1651 error: patch failed: dlls/wined3d/device.c:1756 error: patch failed: dlls/wined3d/wined3d_private.h:4741 error: patch failed: dlls/wined3d/device.c:1740 error: patch failed: dlls/wined3d/wined3d.spec:167 error: patch failed: include/wine/wined3d.h:2549 error: patch failed: dlls/d3d11/device.c:1000 Task: Patch failed to apply
=== debiant2 (build log) ===
error: patch failed: dlls/d3d11/device.c:425 error: patch failed: dlls/wined3d/cs.c:1651 error: patch failed: dlls/wined3d/device.c:1756 error: patch failed: dlls/wined3d/wined3d_private.h:4741 error: patch failed: dlls/wined3d/device.c:1740 error: patch failed: dlls/wined3d/wined3d.spec:167 error: patch failed: include/wine/wined3d.h:2549 error: patch failed: dlls/d3d11/device.c:1000 Task: Patch failed to apply