Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d11/device.c | 7 ------- dlls/d3d11/state.c | 1 + dlls/wined3d/device.c | 5 ++++- dlls/wined3d/state.c | 13 +++++-------- include/wine/wined3d.h | 1 + 5 files changed, 11 insertions(+), 16 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 31f66d12e9..20056dac46 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -736,13 +736,6 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetBlendState(ID3D11Devi wined3d_device_set_blend_state(device->wined3d_device, blend_state_impl->wined3d_state, (const struct wined3d_color *)blend_factor); desc = &blend_state_impl->desc; - if (desc->RenderTarget[0].BlendEnable) - { - const D3D11_RENDER_TARGET_BLEND_DESC *d = &desc->RenderTarget[0]; - - wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SEPARATEALPHABLENDENABLE, TRUE); - wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_BLENDOPALPHA, d->BlendOpAlpha); - } wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_COLORWRITEENABLE, desc->RenderTarget[0].RenderTargetWriteMask); wined3d_device_set_render_state(device->wined3d_device, diff --git a/dlls/d3d11/state.c b/dlls/d3d11/state.c index aa94bc2569..3bd10dd547 100644 --- a/dlls/d3d11/state.c +++ b/dlls/d3d11/state.c @@ -395,6 +395,7 @@ HRESULT d3d_blend_state_create(struct d3d_device *device, const D3D11_BLEND_DESC wined3d_desc.op = desc->RenderTarget[0].BlendOp; wined3d_desc.src_alpha = desc->RenderTarget[0].SrcBlendAlpha; wined3d_desc.dst_alpha = desc->RenderTarget[0].DestBlendAlpha; + wined3d_desc.op_alpha = desc->RenderTarget[0].BlendOpAlpha;
/* We cannot fail after creating a wined3d_blend_state object. It * would lead to double free. */ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 8ee7f8da34..d94b1e2f2d 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3585,8 +3585,10 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, case WINED3D_RS_SRCBLEND: case WINED3D_RS_DESTBLEND: case WINED3D_RS_BLENDOP: + case WINED3D_RS_SEPARATEALPHABLENDENABLE: case WINED3D_RS_SRCBLENDALPHA: case WINED3D_RS_DESTBLENDALPHA: + case WINED3D_RS_BLENDOPALPHA: set_blend_state = TRUE; break;
@@ -3646,7 +3648,6 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, }
if (set_blend_state || changed->alpha_to_coverage - || wined3d_bitmap_is_set(changed->renderState, WINED3D_RS_SEPARATEALPHABLENDENABLE) || wined3d_bitmap_is_set(changed->renderState, WINED3D_RS_ADAPTIVETESS_Y)) { struct wined3d_blend_state *blend_state; @@ -3666,11 +3667,13 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, { desc.src_alpha = state->rs[WINED3D_RS_SRCBLENDALPHA]; desc.dst_alpha = state->rs[WINED3D_RS_DESTBLENDALPHA]; + desc.op_alpha = state->rs[WINED3D_RS_BLENDOPALPHA]; } else { desc.src_alpha = state->rs[WINED3D_RS_SRCBLEND]; desc.dst_alpha = state->rs[WINED3D_RS_DESTBLEND]; + desc.op_alpha = state->rs[WINED3D_RS_BLENDOP]; }
if (wined3d_bitmap_is_set(changed->renderState, WINED3D_RS_BLENDFACTOR)) diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 17adf984c5..19f47f834e 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -426,18 +426,17 @@ static void blendop(const struct wined3d_state *state, const struct wined3d_gl_i }
/* BLENDOPALPHA requires GL_EXT_blend_equation_separate, so make sure it is around */ - if (state->render_states[WINED3D_RS_BLENDOPALPHA] - && !gl_info->supported[EXT_BLEND_EQUATION_SEPARATE]) + if (b->desc.op_alpha && !gl_info->supported[EXT_BLEND_EQUATION_SEPARATE]) { WARN("Unsupported in local OpenGL implementation: glBlendEquationSeparate.\n"); return; }
blend_equation = gl_blend_op(gl_info, b->desc.op); - blend_equation_alpha = gl_blend_op(gl_info, state->render_states[WINED3D_RS_BLENDOPALPHA]); + blend_equation_alpha = gl_blend_op(gl_info, b->desc.op_alpha); TRACE("blend_equation %#x, blend_equation_alpha %#x.\n", blend_equation, blend_equation_alpha);
- if (state->render_states[WINED3D_RS_SEPARATEALPHABLENDENABLE]) + if (b->desc.op != b->desc.op_alpha) { GL_EXTCALL(glBlendEquationSeparate(blend_equation, blend_equation_alpha)); checkGLcall("glBlendEquationSeparate"); @@ -562,7 +561,7 @@ static void state_blend(struct wined3d_context *context, const struct wined3d_st
blendop(state, gl_info);
- if (state->render_states[WINED3D_RS_SEPARATEALPHABLENDENABLE]) + if (b->desc.src != b->desc.src_alpha || b->desc.dst != b->desc.dst_alpha) { GLenum src_blend_alpha, dst_blend_alpha;
@@ -4500,8 +4499,6 @@ const struct wined3d_state_entry_template misc_state_template[] = { STATE_STREAM_OUTPUT, { STATE_STREAM_OUTPUT, state_so, }, WINED3D_GL_VERSION_3_2 }, { STATE_STREAM_OUTPUT, { STATE_STREAM_OUTPUT, state_so_warn, }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_EDGEANTIALIAS), { STATE_RENDER(WINED3D_RS_EDGEANTIALIAS), state_line_antialias}, WINED3D_GL_EXT_NONE }, - { STATE_RENDER(WINED3D_RS_SEPARATEALPHABLENDENABLE), { STATE_BLEND, NULL }, WINED3D_GL_EXT_NONE }, - { STATE_RENDER(WINED3D_RS_BLENDOPALPHA), { STATE_BLEND, NULL }, WINED3D_GL_EXT_NONE }, { STATE_BLEND, { STATE_BLEND, blend }, 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 }, @@ -5418,7 +5415,7 @@ static void validate_state_table(struct wined3d_state_entry *state_table) {174, 177}, {193, 193}, {195, 197}, - {207, 208}, + {206, 209}, { 0, 0}, }; static const DWORD simple_states[] = diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 4c32ce977f..a97a7e8201 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2035,6 +2035,7 @@ struct wined3d_blend_state_desc enum wined3d_blend_op op; enum wined3d_blend src_alpha; enum wined3d_blend dst_alpha; + enum wined3d_blend_op op_alpha; };
struct wined3d_rasterizer_state_desc