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