From 3d4dd7a06e87ed7ea554c167802ff057a6c313dc Mon Sep 17 00:00:00 2001 From: Daniel Ansorregui Date: Thu, 18 Oct 2018 02:11:13 +0330 Subject: [PATCH] wined3d: Store the blend factor as a struct wined3d_color. Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3d11/d3d11_private.h | 1 - dlls/d3d11/device.c | 23 ++++++----------------- dlls/d3d9/device.c | 39 ++++++++++++++++++++++++++++++++------- dlls/wined3d/cs.c | 15 ++++++++++++--- dlls/wined3d/device.c | 29 ++++++++++++++++++++--------- dlls/wined3d/state.c | 17 +++++++++-------- dlls/wined3d/stateblock.c | 27 +++++++++++++++++++++++++-- dlls/wined3d/utils.c | 3 ++- dlls/wined3d/wined3d.spec | 4 ++-- dlls/wined3d/wined3d_private.h | 12 +++++++++--- include/wine/wined3d.h | 7 ++++--- 11 files changed, 121 insertions(+), 56 deletions(-) diff --git a/dlls/d3d11/d3d11_private.h b/dlls/d3d11/d3d11_private.h index e26554afabf..771e923a5c1 100644 --- a/dlls/d3d11/d3d11_private.h +++ b/dlls/d3d11/d3d11_private.h @@ -539,7 +539,6 @@ struct d3d_device struct wine_rb_tree rasterizer_states; struct wine_rb_tree sampler_states; - float blend_factor[4]; struct d3d_depthstencil_state *depth_stencil_state; UINT stencil_ref; }; diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 157ff0341ae..e4c2c80e00b 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -710,11 +710,11 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetBlendState(ID3D11Devi blend_factor = default_blend_factor; wined3d_mutex_lock(); - memcpy(device->blend_factor, blend_factor, 4 * sizeof(*blend_factor)); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_MULTISAMPLEMASK, sample_mask); if (!(blend_state_impl = unsafe_impl_from_ID3D11BlendState(blend_state))) { - wined3d_device_set_blend_state(device->wined3d_device, NULL); + wined3d_device_set_blend_state(device->wined3d_device, NULL, + (const struct wined3d_color *)blend_factor); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_ALPHABLENDENABLE, FALSE); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_COLORWRITEENABLE, D3D11_COLOR_WRITE_ENABLE_ALL); @@ -728,7 +728,8 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetBlendState(ID3D11Devi return; } - wined3d_device_set_blend_state(device->wined3d_device, blend_state_impl->wined3d_state); + wined3d_device_set_blend_state(device->wined3d_device, blend_state_impl->wined3d_state, + (const struct wined3d_color *)blend_factor); desc = &blend_state_impl->desc; wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_ALPHABLENDENABLE, desc->RenderTarget[0].BlendEnable); @@ -743,13 +744,6 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetBlendState(ID3D11Devi wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SRCBLENDALPHA, d->SrcBlendAlpha); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DESTBLENDALPHA, d->DestBlendAlpha); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_BLENDOPALPHA, d->BlendOpAlpha); - - if (memcmp(blend_factor, default_blend_factor, sizeof(default_blend_factor)) - && (d->SrcBlend == D3D11_BLEND_BLEND_FACTOR || d->SrcBlend == D3D11_BLEND_INV_BLEND_FACTOR - || d->DestBlend == D3D11_BLEND_BLEND_FACTOR || d->DestBlend == D3D11_BLEND_INV_BLEND_FACTOR - || d->SrcBlendAlpha == D3D11_BLEND_BLEND_FACTOR || d->SrcBlendAlpha == D3D11_BLEND_INV_BLEND_FACTOR - || d->DestBlendAlpha == D3D11_BLEND_BLEND_FACTOR || d->DestBlendAlpha == D3D11_BLEND_INV_BLEND_FACTOR)) - FIXME("Ignoring blend factor %s.\n", debug_float4(blend_factor)); } wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_COLORWRITEENABLE, desc->RenderTarget[0].RenderTargetWriteMask); @@ -1942,7 +1936,8 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMGetBlendState(ID3D11Devi iface, blend_state, blend_factor, sample_mask); wined3d_mutex_lock(); - if ((wined3d_state = wined3d_device_get_blend_state(device->wined3d_device))) + if ((wined3d_state = wined3d_device_get_blend_state(device->wined3d_device, + (struct wined3d_color *)blend_factor))) { blend_state_impl = wined3d_blend_state_get_parent(wined3d_state); ID3D11BlendState_AddRef(*blend_state = &blend_state_impl->ID3D11BlendState_iface); @@ -1951,7 +1946,6 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMGetBlendState(ID3D11Devi { *blend_state = NULL; } - memcpy(blend_factor, device->blend_factor, 4 * sizeof(*blend_factor)); *sample_mask = wined3d_device_get_render_state(device->wined3d_device, WINED3D_RS_MULTISAMPLEMASK); wined3d_mutex_unlock(); } @@ -6190,11 +6184,6 @@ void d3d_device_init(struct d3d_device *device, void *outer_unknown) d3d11_immediate_context_init(&device->immediate_context, device); ID3D11DeviceContext1_Release(&device->immediate_context.ID3D11DeviceContext1_iface); - device->blend_factor[0] = 1.0f; - device->blend_factor[1] = 1.0f; - device->blend_factor[2] = 1.0f; - device->blend_factor[3] = 1.0f; - wine_rb_init(&device->blend_states, d3d_blend_state_compare); wine_rb_init(&device->depthstencil_states, d3d_depthstencil_state_compare); wine_rb_init(&device->rasterizer_states, d3d_rasterizer_state_compare); diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index a31360886b6..a3f410a7b97 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -32,6 +32,14 @@ const struct wined3d_parent_ops d3d9_null_wined3d_parent_ops = d3d9_null_wined3d_object_destroyed, }; +static void wined3d_color_from_d3dcolor(struct wined3d_color *wined3d_colour, D3DCOLOR d3d_colour) +{ + wined3d_colour->r = ((d3d_colour >> 16) & 0xff) / 255.0f; + wined3d_colour->g = ((d3d_colour >> 8) & 0xff) / 255.0f; + wined3d_colour->b = (d3d_colour & 0xff) / 255.0f; + wined3d_colour->a = ((d3d_colour >> 24) & 0xff) / 255.0f; +} + D3DFORMAT d3dformat_from_wined3dformat(enum wined3d_format_id format) { BYTE *c = (BYTE *)&format; @@ -1980,14 +1988,8 @@ static void d3d9_rts_flag_auto_gen_mipmap(struct d3d9_device *device) static HRESULT WINAPI d3d9_device_Clear(IDirect3DDevice9Ex *iface, DWORD rect_count, const D3DRECT *rects, DWORD flags, D3DCOLOR color, float z, DWORD stencil) { - const struct wined3d_color c = - { - ((color >> 16) & 0xff) / 255.0f, - ((color >> 8) & 0xff) / 255.0f, - (color & 0xff) / 255.0f, - ((color >> 24) & 0xff) / 255.0f, - }; struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); + struct wined3d_color c; HRESULT hr; TRACE("iface %p, rect_count %u, rects %p, flags %#x, color 0x%08x, z %.8e, stencil %u.\n", @@ -1999,6 +2001,7 @@ static HRESULT WINAPI d3d9_device_Clear(IDirect3DDevice9Ex *iface, DWORD rect_co rect_count = 0; } + wined3d_color_from_d3dcolor(&c, color); wined3d_mutex_lock(); hr = wined3d_device_clear(device->wined3d_device, rect_count, (const RECT *)rects, flags, &c, z, stencil); if (SUCCEEDED(hr)) @@ -2217,9 +2220,20 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_SetRenderState(IDirect3DDevi D3DRENDERSTATETYPE state, DWORD value) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); + struct wined3d_color factor; TRACE("iface %p, state %#x, value %#x.\n", iface, state, value); + if (state == D3DRS_BLENDFACTOR) + { + wined3d_color_from_d3dcolor(&factor, value); + wined3d_mutex_lock(); + wined3d_device_set_blend_state(device->wined3d_device, NULL, &factor); + wined3d_mutex_unlock(); + + return D3D_OK; + } + wined3d_mutex_lock(); wined3d_device_set_render_state(device->wined3d_device, state, value); wined3d_mutex_unlock(); @@ -2231,9 +2245,20 @@ static HRESULT WINAPI d3d9_device_GetRenderState(IDirect3DDevice9Ex *iface, D3DRENDERSTATETYPE state, DWORD *value) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); + struct wined3d_color factor; TRACE("iface %p, state %#x, value %p.\n", iface, state, value); + if (state == D3DRS_BLENDFACTOR) + { + wined3d_mutex_lock(); + wined3d_device_get_blend_state(device->wined3d_device, &factor); + wined3d_mutex_unlock(); + *value = D3DCOLOR_COLORVALUE(factor.r, factor.g, factor.b, factor.a); + + return D3D_OK; + } + wined3d_mutex_lock(); *value = wined3d_device_get_render_state(device->wined3d_device, state); wined3d_mutex_unlock(); diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index af1dbef84ce..fc3e47e3298 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -264,6 +264,7 @@ struct wined3d_cs_set_blend_state { enum wined3d_cs_op opcode; struct wined3d_blend_state *state; + struct wined3d_color factor; }; struct wined3d_cs_set_rasterizer_state @@ -1539,18 +1540,26 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type static void wined3d_cs_exec_set_blend_state(struct wined3d_cs *cs, const void *data) { const struct wined3d_cs_set_blend_state *op = data; + struct wined3d_state *state = &cs->state; - cs->state.blend_state = op->state; - device_invalidate_state(cs->device, STATE_BLEND); + if (state->blend_state != op->state) + { + state->blend_state = op->state; + device_invalidate_state(cs->device, STATE_BLEND); + } + state->blend_factor = op->factor; + device_invalidate_state(cs->device, STATE_BLEND_FACTOR); } -void wined3d_cs_emit_set_blend_state(struct wined3d_cs *cs, struct wined3d_blend_state *state) +void wined3d_cs_emit_set_blend_state(struct wined3d_cs *cs, struct wined3d_blend_state *state, + const struct wined3d_color *blend_factor) { struct wined3d_cs_set_blend_state *op; op = cs->ops->require_space(cs, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT); op->opcode = WINED3D_CS_OP_SET_BLEND_STATE; op->state = state; + op->factor = *blend_factor; cs->ops->submit(cs, WINED3D_CS_QUEUE_DEFAULT); } diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index b90df20a7da..b50d6677ab2 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1968,29 +1968,40 @@ static void resolve_depth_buffer(struct wined3d_device *device) src_view->resource, src_view->sub_resource_idx, dst_resource->format->id); } -void CDECL wined3d_device_set_blend_state(struct wined3d_device *device, struct wined3d_blend_state *blend_state) +void CDECL wined3d_device_set_blend_state(struct wined3d_device *device, + struct wined3d_blend_state *blend_state, const struct wined3d_color *blend_factor) { + struct wined3d_state *state = device->update_state; struct wined3d_blend_state *prev; - TRACE("device %p, blend_state %p.\n", device, blend_state); + TRACE("device %p, blend_state %p, blend_factor %s.\n", device, blend_state, debug_color(blend_factor)); - prev = device->update_state->blend_state; - if (prev == blend_state) + if (device->recording) + device->recording->changed.blend_state = TRUE; + + prev = state->blend_state; + if (prev == blend_state && !memcmp(blend_factor, &state->blend_factor, sizeof(*blend_factor))) return; if (blend_state) wined3d_blend_state_incref(blend_state); - device->update_state->blend_state = blend_state; - wined3d_cs_emit_set_blend_state(device->cs, blend_state); + state->blend_state = blend_state; + state->blend_factor = *blend_factor; + if (!device->recording) + wined3d_cs_emit_set_blend_state(device->cs, blend_state, blend_factor); if (prev) wined3d_blend_state_decref(prev); } -struct wined3d_blend_state * CDECL wined3d_device_get_blend_state(const struct wined3d_device *device) +struct wined3d_blend_state * CDECL wined3d_device_get_blend_state(const struct wined3d_device *device, + struct wined3d_color *blend_factor) { - TRACE("device %p.\n", device); + const struct wined3d_state *state = &device->state; + + TRACE("device %p, blend_factor %p.\n", device, blend_factor); - return device->state.blend_state; + *blend_factor = state->blend_factor; + return state->blend_state; } void CDECL wined3d_device_set_rasterizer_state(struct wined3d_device *device, diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 375bc6562ab..fc076bb962a 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -597,20 +597,19 @@ static void state_blend(struct wined3d_context *context, const struct wined3d_st context_apply_state(context, state, STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP)); } -static void state_blendfactor_w(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) +static void state_blend_factor_w(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { WARN("Unsupported in local OpenGL implementation: glBlendColor.\n"); } -static void state_blendfactor(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) +static void state_blend_factor(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { + const struct wined3d_color *factor = &state->blend_factor; const struct wined3d_gl_info *gl_info = context->gl_info; - struct wined3d_color color; - TRACE("Setting blend factor to %#x.\n", state->render_states[WINED3D_RS_BLENDFACTOR]); + TRACE("Setting blend factor to %s.\n", debug_color(factor)); - wined3d_color_from_d3dcolor(&color, state->render_states[WINED3D_RS_BLENDFACTOR]); - GL_EXTCALL(glBlendColor(color.r, color.g, color.b, color.a)); + GL_EXTCALL(glBlendColor(factor->r, factor->g, factor->b, factor->a)); checkGLcall("glBlendColor"); } @@ -4539,6 +4538,8 @@ const struct StateEntryTemplate misc_state_template[] = { STATE_RENDER(WINED3D_RS_DESTBLENDALPHA), { STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_BLENDOPALPHA), { STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE }, { STATE_BLEND, { STATE_BLEND, state_blend_object }, WINED3D_GL_EXT_NONE }, + { STATE_BLEND_FACTOR, { STATE_BLEND_FACTOR, state_blend_factor }, EXT_BLEND_COLOR }, + { STATE_BLEND_FACTOR, { STATE_BLEND_FACTOR, state_blend_factor_w}, WINED3D_GL_EXT_NONE }, { STATE_STREAMSRC, { STATE_STREAMSRC, streamsrc }, WINED3D_GL_EXT_NONE }, { STATE_VDECL, { STATE_VDECL, vdecl_miscpart }, WINED3D_GL_EXT_NONE }, { STATE_RASTERIZER, { STATE_RASTERIZER, rasterizer_cc }, ARB_CLIP_CONTROL }, @@ -4689,8 +4690,6 @@ const struct StateEntryTemplate misc_state_template[] = { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE2), { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE), NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE3), { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE3), state_colorwrite3 }, EXT_DRAW_BUFFERS2 }, { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE3), { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE), NULL }, WINED3D_GL_EXT_NONE }, - { STATE_RENDER(WINED3D_RS_BLENDFACTOR), { STATE_RENDER(WINED3D_RS_BLENDFACTOR), state_blendfactor }, EXT_BLEND_COLOR }, - { STATE_RENDER(WINED3D_RS_BLENDFACTOR), { STATE_RENDER(WINED3D_RS_BLENDFACTOR), state_blendfactor_w }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_DEPTHBIAS), { STATE_RENDER(WINED3D_RS_DEPTHBIAS), state_depthbias }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_ZVISIBLE), { STATE_RENDER(WINED3D_RS_ZVISIBLE), state_zvisible }, WINED3D_GL_EXT_NONE }, /* Samplers */ @@ -5453,6 +5452,7 @@ static void validate_state_table(struct StateEntry *state_table) {149, 150}, {169, 169}, {177, 177}, + {193, 193}, {196, 197}, { 0, 0}, }; @@ -5488,6 +5488,7 @@ static void validate_state_table(struct StateEntry *state_table) STATE_POINT_ENABLE, STATE_COLOR_KEY, STATE_BLEND, + STATE_BLEND_FACTOR, }; unsigned int i, current; diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 45a4008ac45..0b2ce50ecd7 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -35,7 +35,6 @@ static const DWORD pixel_states_render[] = WINED3D_RS_ALPHAREF, WINED3D_RS_ALPHATESTENABLE, WINED3D_RS_ANTIALIASEDLINEENABLE, - WINED3D_RS_BLENDFACTOR, WINED3D_RS_BLENDOP, WINED3D_RS_BLENDOPALPHA, WINED3D_RS_BACK_STENCILFAIL, @@ -209,6 +208,7 @@ static void stateblock_savedstates_set_all(struct wined3d_saved_states *states, states->pixelShader = 1; states->vertexShader = 1; states->scissorRect = 1; + states->blend_state = 1; /* Fixed size arrays */ states->streamSource = 0xffff; @@ -236,6 +236,7 @@ static void stateblock_savedstates_set_pixel(struct wined3d_saved_states *states unsigned int i; states->pixelShader = 1; + states->blend_state = 1; for (i = 0; i < ARRAY_SIZE(pixel_states_render); ++i) { @@ -839,6 +840,21 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock) SetRectEmpty(stateblock->state.scissor_rects); } + if (stateblock->changed.blend_state + && (src_state->blend_state != stateblock->state.blend_state + || memcmp(&src_state->blend_factor, &stateblock->state.blend_factor, + sizeof(stateblock->state.blend_factor)))) + { + TRACE("Updating blend state.\n"); + + if (src_state->blend_state) + wined3d_blend_state_incref(src_state->blend_state); + if (stateblock->state.blend_state) + wined3d_blend_state_decref(stateblock->state.blend_state); + stateblock->state.blend_state = src_state->blend_state; + stateblock->state.blend_factor = src_state->blend_factor; + } + map = stateblock->changed.streamSource; for (i = 0; map; map >>= 1, ++i) { @@ -1074,6 +1090,9 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock) wined3d_device_set_scissor_rects(device, stateblock->state.scissor_rect_count, stateblock->state.scissor_rects); + if (stateblock->changed.blend_state) + wined3d_device_set_blend_state(device, stateblock->state.blend_state, &stateblock->state.blend_factor); + map = stateblock->changed.streamSource; for (i = 0; map; map >>= 1, ++i) { @@ -1255,7 +1274,6 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d state->render_states[WINED3D_RS_COLORWRITEENABLE1] = 0x0000000f; state->render_states[WINED3D_RS_COLORWRITEENABLE2] = 0x0000000f; state->render_states[WINED3D_RS_COLORWRITEENABLE3] = 0x0000000f; - state->render_states[WINED3D_RS_BLENDFACTOR] = 0xffffffff; state->render_states[WINED3D_RS_SRGBWRITEENABLE] = 0; state->render_states[WINED3D_RS_DEPTHBIAS] = 0; state->render_states[WINED3D_RS_WRAP8] = 0; @@ -1314,6 +1332,11 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d /* TODO: Vertex offset in the presampled displacement map. */ state->sampler_states[i][WINED3D_SAMP_DMAP_OFFSET] = 0; } + + state->blend_factor.r = 1.0f; + state->blend_factor.g = 1.0f; + state->blend_factor.b = 1.0f; + state->blend_factor.a = 1.0f; } void state_init(struct wined3d_state *state, struct wined3d_fb_state *fb, diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index da01bbb0b65..9ddfd5c2059 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -4762,7 +4762,6 @@ const char *debug_d3drenderstate(enum wined3d_render_state state) D3DSTATE_TO_STR(WINED3D_RS_COLORWRITEENABLE1); D3DSTATE_TO_STR(WINED3D_RS_COLORWRITEENABLE2); D3DSTATE_TO_STR(WINED3D_RS_COLORWRITEENABLE3); - D3DSTATE_TO_STR(WINED3D_RS_BLENDFACTOR); D3DSTATE_TO_STR(WINED3D_RS_SRGBWRITEENABLE); D3DSTATE_TO_STR(WINED3D_RS_DEPTHBIAS); D3DSTATE_TO_STR(WINED3D_RS_WRAP8); @@ -5011,6 +5010,8 @@ const char *debug_d3dstate(DWORD state) return "STATE_STREAM_OUTPUT"; if (STATE_IS_BLEND(state)) return "STATE_BLEND"; + if (STATE_IS_BLEND_FACTOR(state)) + return "STATE_BLEND_FACTOR"; return wine_dbg_sprintf("UNKNOWN_STATE(%#x)", state); } diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index 7944387bcab..ee70221191e 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -57,7 +57,7 @@ @ cdecl wined3d_device_evict_managed_resources(ptr) @ cdecl wined3d_device_get_available_texture_mem(ptr) @ cdecl wined3d_device_get_base_vertex_index(ptr) -@ cdecl wined3d_device_get_blend_state(ptr) +@ cdecl wined3d_device_get_blend_state(ptr ptr) @ cdecl wined3d_device_get_clip_plane(ptr long ptr) @ cdecl wined3d_device_get_clip_status(ptr ptr) @ cdecl wined3d_device_get_compute_shader(ptr) @@ -129,7 +129,7 @@ @ cdecl wined3d_device_resolve_sub_resource(ptr ptr long ptr long long) @ cdecl wined3d_device_restore_fullscreen_window(ptr ptr ptr) @ cdecl wined3d_device_set_base_vertex_index(ptr long) -@ cdecl wined3d_device_set_blend_state(ptr ptr) +@ cdecl wined3d_device_set_blend_state(ptr ptr ptr) @ cdecl wined3d_device_set_clip_plane(ptr long ptr) @ cdecl wined3d_device_set_clip_status(ptr ptr) @ cdecl wined3d_device_set_compute_shader(ptr ptr) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index c3761860b0b..d5bf61271e9 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1645,7 +1645,10 @@ enum wined3d_pipeline #define STATE_BLEND (STATE_STREAM_OUTPUT + 1) #define STATE_IS_BLEND(a) ((a) == STATE_BLEND) -#define STATE_COMPUTE_OFFSET (STATE_BLEND + 1) +#define STATE_BLEND_FACTOR (STATE_BLEND + 1) +#define STATE_IS_BLEND_FACTOR(a) ((a) == STATE_BLEND_FACTOR) + +#define STATE_COMPUTE_OFFSET (STATE_BLEND_FACTOR + 1) #define STATE_COMPUTE_SHADER (STATE_COMPUTE_OFFSET) #define STATE_IS_COMPUTE_SHADER(a) ((a) == STATE_COMPUTE_SHADER) @@ -2934,6 +2937,7 @@ struct wined3d_state DWORD render_states[WINEHIGHEST_RENDER_STATE + 1]; struct wined3d_blend_state *blend_state; + struct wined3d_color blend_factor; struct wined3d_rasterizer_state *rasterizer_state; }; @@ -3504,7 +3508,8 @@ struct wined3d_saved_states DWORD pixelShader : 1; DWORD vertexShader : 1; DWORD scissorRect : 1; - DWORD padding : 5; + DWORD blend_state : 1; + DWORD padding : 4; }; struct StageState { @@ -3646,7 +3651,8 @@ 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) DECLSPEC_HIDDEN; +void wined3d_cs_emit_set_blend_state(struct wined3d_cs *cs, struct wined3d_blend_state *state, + const struct wined3d_color *blend_factor) 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, diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index c62d3640e58..95549e96cb4 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -388,7 +388,6 @@ enum wined3d_render_state WINED3D_RS_COLORWRITEENABLE1 = 190, WINED3D_RS_COLORWRITEENABLE2 = 191, WINED3D_RS_COLORWRITEENABLE3 = 192, - WINED3D_RS_BLENDFACTOR = 193, WINED3D_RS_SRGBWRITEENABLE = 194, WINED3D_RS_DEPTHBIAS = 195, WINED3D_RS_WRAP8 = 198, @@ -2264,7 +2263,8 @@ HRESULT __cdecl wined3d_device_end_stateblock(struct wined3d_device *device, str void __cdecl wined3d_device_evict_managed_resources(struct wined3d_device *device); UINT __cdecl wined3d_device_get_available_texture_mem(const struct wined3d_device *device); INT __cdecl wined3d_device_get_base_vertex_index(const struct wined3d_device *device); -struct wined3d_blend_state * __cdecl wined3d_device_get_blend_state(const struct wined3d_device *device); +struct wined3d_blend_state * __cdecl wined3d_device_get_blend_state(const struct wined3d_device *device, + struct wined3d_color *blend_factor); HRESULT __cdecl wined3d_device_get_clip_plane(const struct wined3d_device *device, UINT plane_idx, struct wined3d_vec4 *plane); HRESULT __cdecl wined3d_device_get_clip_status(const struct wined3d_device *device, @@ -2379,7 +2379,8 @@ void __cdecl wined3d_device_resolve_sub_resource(struct wined3d_device *device, void __cdecl wined3d_device_restore_fullscreen_window(struct wined3d_device *device, HWND window, const RECT *window_rect); void __cdecl wined3d_device_set_base_vertex_index(struct wined3d_device *device, INT base_index); -void __cdecl wined3d_device_set_blend_state(struct wined3d_device *device, struct wined3d_blend_state *blend_state); +void __cdecl wined3d_device_set_blend_state(struct wined3d_device *device, struct wined3d_blend_state *blend_state, + const struct wined3d_color *blend_factor); HRESULT __cdecl wined3d_device_set_clip_plane(struct wined3d_device *device, UINT plane_idx, const struct wined3d_vec4 *plane); HRESULT __cdecl wined3d_device_set_clip_status(struct wined3d_device *device, -- 2.11.4.GIT