Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d11/device.c | 1 - dlls/d3d11/state.c | 1 + dlls/wined3d/device.c | 2 ++ dlls/wined3d/state.c | 7 ++----- include/wine/wined3d.h | 1 + 5 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index e09527d5a7..2a764897a9 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -740,7 +740,6 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetBlendState(ID3D11Devi { const D3D11_RENDER_TARGET_BLEND_DESC *d = &desc->RenderTarget[0];
- wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DESTBLEND, d->DestBlend); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_BLENDOP, d->BlendOp); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SEPARATEALPHABLENDENABLE, TRUE); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SRCBLENDALPHA, d->SrcBlendAlpha); diff --git a/dlls/d3d11/state.c b/dlls/d3d11/state.c index 1cc579c86a..4d5bd8d94e 100644 --- a/dlls/d3d11/state.c +++ b/dlls/d3d11/state.c @@ -391,6 +391,7 @@ HRESULT d3d_blend_state_create(struct d3d_device *device, const D3D11_BLEND_DESC wined3d_desc.alpha_to_coverage = desc->AlphaToCoverageEnable; wined3d_desc.enable = desc->RenderTarget[0].BlendEnable; wined3d_desc.src = desc->RenderTarget[0].SrcBlend; + wined3d_desc.dst = desc->RenderTarget[0].DestBlend;
/* 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 54efdb05a7..d7175284cf 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3583,6 +3583,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, case WINED3D_RS_BLENDFACTOR: case WINED3D_RS_ALPHABLENDENABLE: case WINED3D_RS_SRCBLEND: + case WINED3D_RS_DESTBLEND: set_blend_state = TRUE; break;
@@ -3655,6 +3656,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, desc.alpha_to_coverage = TRUE; desc.enable = state->rs[WINED3D_RS_ALPHABLENDENABLE]; desc.src = state->rs[WINED3D_RS_SRCBLEND]; + desc.dst = state->rs[WINED3D_RS_DESTBLEND];
if (wined3d_bitmap_is_set(changed->renderState, WINED3D_RS_BLENDFACTOR)) wined3d_color_from_d3dcolor(&colour, state->rs[WINED3D_RS_BLENDFACTOR]); diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index aa85193bdd..8de2945bf5 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -557,8 +557,7 @@ static void state_blend(struct wined3d_context *context, const struct wined3d_st gl_info->gl_ops.gl.p_glEnable(GL_BLEND); checkGLcall("glEnable(GL_BLEND)");
- gl_blend_from_d3d(&src_blend, &dst_blend, b->desc.src, - state->render_states[WINED3D_RS_DESTBLEND], rt_format); + gl_blend_from_d3d(&src_blend, &dst_blend, b->desc.src, b->desc.dst, rt_format);
/* Re-apply BLENDOP(ALPHA) because of a possible SEPARATEALPHABLENDENABLE change */ if (!isStateDirty(context, STATE_RENDER(WINED3D_RS_BLENDOP))) @@ -4503,7 +4502,6 @@ const struct wined3d_state_entry_template misc_state_template[] = { STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING, { STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING, state_uav_warn }, WINED3D_GL_EXT_NONE }, { 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_DESTBLEND), { STATE_BLEND, NULL }, 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_SRCBLENDALPHA), { STATE_BLEND, NULL }, WINED3D_GL_EXT_NONE }, @@ -5417,8 +5415,7 @@ static void validate_state_table(struct wined3d_state_entry *state_table) { 1, 1}, { 3, 3}, { 8, 8}, - { 17, 19}, - { 21, 22}, + { 17, 22}, { 27, 27}, { 42, 45}, { 47, 47}, diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 923f184d96..4473da13dd 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2031,6 +2031,7 @@ struct wined3d_blend_state_desc BOOL alpha_to_coverage; BOOL enable; enum wined3d_blend src; + enum wined3d_blend dst; };
struct wined3d_rasterizer_state_desc
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d11/device.c | 1 - dlls/d3d11/state.c | 1 + dlls/wined3d/device.c | 2 ++ dlls/wined3d/state.c | 24 +++++++++++------------- include/wine/wined3d.h | 1 + 5 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 2a764897a9..3ed4c704fc 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -740,7 +740,6 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetBlendState(ID3D11Devi { const D3D11_RENDER_TARGET_BLEND_DESC *d = &desc->RenderTarget[0];
- wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_BLENDOP, d->BlendOp); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SEPARATEALPHABLENDENABLE, TRUE); 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); diff --git a/dlls/d3d11/state.c b/dlls/d3d11/state.c index 4d5bd8d94e..693bb3df83 100644 --- a/dlls/d3d11/state.c +++ b/dlls/d3d11/state.c @@ -392,6 +392,7 @@ HRESULT d3d_blend_state_create(struct d3d_device *device, const D3D11_BLEND_DESC wined3d_desc.enable = desc->RenderTarget[0].BlendEnable; wined3d_desc.src = desc->RenderTarget[0].SrcBlend; wined3d_desc.dst = desc->RenderTarget[0].DestBlend; + wined3d_desc.op = desc->RenderTarget[0].BlendOp;
/* 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 d7175284cf..5bb9542891 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3584,6 +3584,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, case WINED3D_RS_ALPHABLENDENABLE: case WINED3D_RS_SRCBLEND: case WINED3D_RS_DESTBLEND: + case WINED3D_RS_BLENDOP: set_blend_state = TRUE; break;
@@ -3657,6 +3658,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, desc.enable = state->rs[WINED3D_RS_ALPHABLENDENABLE]; desc.src = state->rs[WINED3D_RS_SRCBLEND]; desc.dst = state->rs[WINED3D_RS_DESTBLEND]; + desc.op = state->rs[WINED3D_RS_BLENDOP];
if (wined3d_bitmap_is_set(changed->renderState, WINED3D_RS_BLENDFACTOR)) wined3d_color_from_d3dcolor(&colour, state->rs[WINED3D_RS_BLENDFACTOR]); diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 8de2945bf5..8999ab1696 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -390,11 +390,6 @@ static void state_ambient(struct wined3d_context *context, const struct wined3d_ checkGLcall("glLightModel for MODEL_AMBIENT"); }
-static void state_blendop_w(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) -{ - WARN("Unsupported in local OpenGL implementation: glBlendEquation\n"); -} - static GLenum gl_blend_op(const struct wined3d_gl_info *gl_info, enum wined3d_blend_op op) { switch (op) @@ -418,12 +413,18 @@ static GLenum gl_blend_op(const struct wined3d_gl_info *gl_info, enum wined3d_bl } }
-static void state_blendop(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) +static void blendop(const struct wined3d_state *state, const struct wined3d_gl_info *gl_info) { - const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info; + const struct wined3d_blend_state *b = state->blend_state; GLenum blend_equation_alpha = GL_FUNC_ADD_EXT; GLenum blend_equation = GL_FUNC_ADD_EXT;
+ if (!gl_info->supported[WINED3D_GL_BLEND_EQUATION]) + { + WARN("Unsupported in local OpenGL implementation: glBlendEquation.\n"); + return; + } + /* 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]) @@ -432,7 +433,7 @@ static void state_blendop(struct wined3d_context *context, const struct wined3d_ return; }
- blend_equation = gl_blend_op(gl_info, state->render_states[WINED3D_RS_BLENDOP]); + blend_equation = gl_blend_op(gl_info, b->desc.op); blend_equation_alpha = gl_blend_op(gl_info, state->render_states[WINED3D_RS_BLENDOPALPHA]); TRACE("blend_equation %#x, blend_equation_alpha %#x.\n", blend_equation, blend_equation_alpha);
@@ -559,9 +560,7 @@ static void state_blend(struct wined3d_context *context, const struct wined3d_st
gl_blend_from_d3d(&src_blend, &dst_blend, b->desc.src, b->desc.dst, rt_format);
- /* Re-apply BLENDOP(ALPHA) because of a possible SEPARATEALPHABLENDENABLE change */ - if (!isStateDirty(context, STATE_RENDER(WINED3D_RS_BLENDOP))) - state_blendop(context, state, STATE_RENDER(WINED3D_RS_BLENDOPALPHA)); + blendop(state, gl_info);
if (state->render_states[WINED3D_RS_SEPARATEALPHABLENDENABLE]) { @@ -4649,8 +4648,6 @@ const struct wined3d_state_entry_template misc_state_template[] = { STATE_RENDER(WINED3D_RS_DEBUGMONITORTOKEN), { STATE_RENDER(WINED3D_RS_DEBUGMONITORTOKEN), state_debug_monitor }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE), { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE), state_colorwrite0 }, EXT_DRAW_BUFFERS2 }, { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE), { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE), state_colorwrite }, WINED3D_GL_EXT_NONE }, - { STATE_RENDER(WINED3D_RS_BLENDOP), { STATE_RENDER(WINED3D_RS_BLENDOP), state_blendop }, WINED3D_GL_BLEND_EQUATION }, - { STATE_RENDER(WINED3D_RS_BLENDOP), { STATE_RENDER(WINED3D_RS_BLENDOP), state_blendop_w }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE1), { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE1), state_colorwrite1 }, EXT_DRAW_BUFFERS2 }, { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE1), { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE), NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE2), { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE2), state_colorwrite2 }, EXT_DRAW_BUFFERS2 }, @@ -5422,6 +5419,7 @@ static void validate_state_table(struct wined3d_state_entry *state_table) { 61, 127}, {149, 150}, {169, 169}, + {171, 171}, {174, 177}, {193, 193}, {195, 197}, diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 4473da13dd..858440960b 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2032,6 +2032,7 @@ struct wined3d_blend_state_desc BOOL enable; enum wined3d_blend src; enum wined3d_blend dst; + enum wined3d_blend_op op; };
struct wined3d_rasterizer_state_desc
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d11/device.c | 1 - dlls/d3d11/state.c | 1 + dlls/wined3d/device.c | 10 ++++++++++ dlls/wined3d/state.c | 5 ++--- include/wine/wined3d.h | 1 + 5 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 3ed4c704fc..9b8b49f357 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -741,7 +741,6 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetBlendState(ID3D11Devi 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_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); } diff --git a/dlls/d3d11/state.c b/dlls/d3d11/state.c index 693bb3df83..231978b8a5 100644 --- a/dlls/d3d11/state.c +++ b/dlls/d3d11/state.c @@ -393,6 +393,7 @@ HRESULT d3d_blend_state_create(struct d3d_device *device, const D3D11_BLEND_DESC wined3d_desc.src = desc->RenderTarget[0].SrcBlend; wined3d_desc.dst = desc->RenderTarget[0].DestBlend; wined3d_desc.op = desc->RenderTarget[0].BlendOp; + wined3d_desc.src_alpha = desc->RenderTarget[0].SrcBlendAlpha;
/* 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 5bb9542891..303122c2e0 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3585,6 +3585,7 @@ 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_SRCBLENDALPHA: set_blend_state = TRUE; break;
@@ -3644,6 +3645,7 @@ 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; @@ -3659,6 +3661,14 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, desc.src = state->rs[WINED3D_RS_SRCBLEND]; desc.dst = state->rs[WINED3D_RS_DESTBLEND]; desc.op = state->rs[WINED3D_RS_BLENDOP]; + if (state->rs[WINED3D_RS_SEPARATEALPHABLENDENABLE]) + { + desc.src_alpha = state->rs[WINED3D_RS_SRCBLENDALPHA]; + } + else + { + desc.src_alpha = state->rs[WINED3D_RS_SRCBLEND]; + }
if (wined3d_bitmap_is_set(changed->renderState, WINED3D_RS_BLENDFACTOR)) wined3d_color_from_d3dcolor(&colour, state->rs[WINED3D_RS_BLENDFACTOR]); diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 8999ab1696..e0cbf82e14 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -573,8 +573,7 @@ static void state_blend(struct wined3d_context *context, const struct wined3d_st return; }
- gl_blend_from_d3d(&src_blend_alpha, &dst_blend_alpha, - state->render_states[WINED3D_RS_SRCBLENDALPHA], + gl_blend_from_d3d(&src_blend_alpha, &dst_blend_alpha, b->desc.src_alpha, state->render_states[WINED3D_RS_DESTBLENDALPHA], rt_format);
GL_EXTCALL(glBlendFuncSeparate(src_blend, dst_blend, src_blend_alpha, dst_blend_alpha)); @@ -4503,7 +4502,6 @@ const struct wined3d_state_entry_template misc_state_template[] = { 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_SRCBLENDALPHA), { STATE_BLEND, NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_DESTBLENDALPHA), { STATE_BLEND, NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_DESTBLENDALPHA), { STATE_BLEND, NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_BLENDOPALPHA), { STATE_BLEND, NULL }, WINED3D_GL_EXT_NONE }, @@ -5423,6 +5421,7 @@ static void validate_state_table(struct wined3d_state_entry *state_table) {174, 177}, {193, 193}, {195, 197}, + {207, 207}, { 0, 0}, }; static const DWORD simple_states[] = diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 858440960b..e45e4109b8 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2033,6 +2033,7 @@ struct wined3d_blend_state_desc enum wined3d_blend src; enum wined3d_blend dst; enum wined3d_blend_op op; + enum wined3d_blend src_alpha; };
struct wined3d_rasterizer_state_desc
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=66894
Your paranoid android.
=== debiant (32 bit Chinese:China report) ===
d3d11: d3d11.c:16860: Test failed: Got {-1.00787401e+000, 0.00000000e+000, 1.00000000e+000, 5.03937006e-001}, expected {-1.00000000e+000, 0.00000000e+000, 1.00000000e+000, 5.03937006e-001} at (0, 0), sub-resource 0.
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d11/device.c | 1 - dlls/d3d11/state.c | 1 + dlls/wined3d/device.c | 3 +++ dlls/wined3d/state.c | 7 ++----- include/wine/wined3d.h | 1 + 5 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 9b8b49f357..31f66d12e9 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -741,7 +741,6 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetBlendState(ID3D11Devi 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_DESTBLENDALPHA, d->DestBlendAlpha); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_BLENDOPALPHA, d->BlendOpAlpha); } wined3d_device_set_render_state(device->wined3d_device, diff --git a/dlls/d3d11/state.c b/dlls/d3d11/state.c index 231978b8a5..aa94bc2569 100644 --- a/dlls/d3d11/state.c +++ b/dlls/d3d11/state.c @@ -394,6 +394,7 @@ HRESULT d3d_blend_state_create(struct d3d_device *device, const D3D11_BLEND_DESC wined3d_desc.dst = desc->RenderTarget[0].DestBlend; wined3d_desc.op = desc->RenderTarget[0].BlendOp; wined3d_desc.src_alpha = desc->RenderTarget[0].SrcBlendAlpha; + wined3d_desc.dst_alpha = desc->RenderTarget[0].DestBlendAlpha;
/* 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 303122c2e0..8ee7f8da34 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3586,6 +3586,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, case WINED3D_RS_DESTBLEND: case WINED3D_RS_BLENDOP: case WINED3D_RS_SRCBLENDALPHA: + case WINED3D_RS_DESTBLENDALPHA: set_blend_state = TRUE; break;
@@ -3664,10 +3665,12 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, if (state->rs[WINED3D_RS_SEPARATEALPHABLENDENABLE]) { desc.src_alpha = state->rs[WINED3D_RS_SRCBLENDALPHA]; + desc.dst_alpha = state->rs[WINED3D_RS_DESTBLENDALPHA]; } else { desc.src_alpha = state->rs[WINED3D_RS_SRCBLEND]; + desc.dst_alpha = state->rs[WINED3D_RS_DESTBLEND]; }
if (wined3d_bitmap_is_set(changed->renderState, WINED3D_RS_BLENDFACTOR)) diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index e0cbf82e14..17adf984c5 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -573,8 +573,7 @@ static void state_blend(struct wined3d_context *context, const struct wined3d_st return; }
- gl_blend_from_d3d(&src_blend_alpha, &dst_blend_alpha, b->desc.src_alpha, - state->render_states[WINED3D_RS_DESTBLENDALPHA], rt_format); + gl_blend_from_d3d(&src_blend_alpha, &dst_blend_alpha, b->desc.src_alpha, b->desc.dst_alpha, rt_format);
GL_EXTCALL(glBlendFuncSeparate(src_blend, dst_blend, src_blend_alpha, dst_blend_alpha)); checkGLcall("glBlendFuncSeparate"); @@ -4502,8 +4501,6 @@ const struct wined3d_state_entry_template misc_state_template[] = { 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_DESTBLENDALPHA), { STATE_BLEND, NULL }, WINED3D_GL_EXT_NONE }, - { STATE_RENDER(WINED3D_RS_DESTBLENDALPHA), { 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 }, @@ -5421,7 +5418,7 @@ static void validate_state_table(struct wined3d_state_entry *state_table) {174, 177}, {193, 193}, {195, 197}, - {207, 207}, + {207, 208}, { 0, 0}, }; static const DWORD simple_states[] = diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index e45e4109b8..4c32ce977f 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2034,6 +2034,7 @@ struct wined3d_blend_state_desc enum wined3d_blend dst; enum wined3d_blend_op op; enum wined3d_blend src_alpha; + enum wined3d_blend dst_alpha; };
struct wined3d_rasterizer_state_desc
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
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
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=66892
Your paranoid android.
=== debiant (32 bit Chinese:China report) ===
Report validation errors: d3d11:d3d11 has no test summary line (early exit of the main process?) d3d11:d3d11 has unaccounted for failure messages d3d11:d3d11 has unaccounted for todo messages d3d11:d3d11 has unaccounted for skip messages d3d11:d3d11 returned success despite having failures