From 38b75c9470bb593bf696cf696e9faf20da8c23b4 Mon Sep 17 00:00:00 2001 From: bkaradzic Date: Tue, 7 Aug 2012 22:25:25 -0700 Subject: [PATCH] Removed srcalphasat from dst blend mode. --- src/renderer_d3d11.cpp | 2 +- src/renderer_d3d9.cpp | 30 +++++++++++++++--------------- src/renderer_gl.cpp | 28 ++++++++++++++-------------- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index bc27c5b1..ca46bcb8 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -37,7 +37,7 @@ namespace bgfx { D3D11_BLEND_INV_DEST_ALPHA, D3D11_BLEND_INV_DEST_ALPHA }, { D3D11_BLEND_DEST_COLOR, D3D11_BLEND_DEST_ALPHA }, { D3D11_BLEND_INV_DEST_COLOR, D3D11_BLEND_INV_DEST_ALPHA }, - { D3D11_BLEND_SRC_ALPHA_SAT, D3D11_BLEND_SRC_ALPHA_SAT }, + { D3D11_BLEND_SRC_ALPHA_SAT, D3D11_BLEND_ONE }, }; static const D3D11_COMPARISON_FUNC s_depthFunc[] = diff --git a/src/renderer_d3d9.cpp b/src/renderer_d3d9.cpp index 0f0dc678..ca265c0f 100644 --- a/src/renderer_d3d9.cpp +++ b/src/renderer_d3d9.cpp @@ -42,20 +42,20 @@ namespace bgfx { D3DMULTISAMPLE_16_SAMPLES, 0 }, }; - static const D3DBLEND s_blendFactor[] = + static const D3DBLEND s_blendFactor[][2] = { - (D3DBLEND)0, // ignored - D3DBLEND_ZERO, - D3DBLEND_ONE, - D3DBLEND_SRCCOLOR, - D3DBLEND_INVSRCCOLOR, - D3DBLEND_SRCALPHA, - D3DBLEND_INVSRCALPHA, - D3DBLEND_DESTALPHA, - D3DBLEND_INVDESTALPHA, - D3DBLEND_DESTCOLOR, - D3DBLEND_INVDESTCOLOR, - D3DBLEND_SRCALPHASAT, + { (D3DBLEND)0, (D3DBLEND)0 }, // ignored + { D3DBLEND_ZERO, D3DBLEND_ZERO }, + { D3DBLEND_ONE, D3DBLEND_ONE }, + { D3DBLEND_SRCCOLOR, D3DBLEND_SRCCOLOR }, + { D3DBLEND_INVSRCCOLOR, D3DBLEND_INVSRCCOLOR }, + { D3DBLEND_SRCALPHA, D3DBLEND_SRCALPHA }, + { D3DBLEND_INVSRCALPHA, D3DBLEND_INVSRCALPHA }, + { D3DBLEND_DESTALPHA, D3DBLEND_DESTALPHA }, + { D3DBLEND_INVDESTALPHA, D3DBLEND_INVDESTALPHA }, + { D3DBLEND_DESTCOLOR, D3DBLEND_DESTCOLOR }, + { D3DBLEND_INVDESTCOLOR, D3DBLEND_INVDESTCOLOR }, + { D3DBLEND_SRCALPHASAT, D3DBLEND_ONE }, }; static const D3DCMPFUNC s_depthFunc[] = @@ -2030,8 +2030,8 @@ namespace bgfx uint32_t src = blend&0xf; uint32_t dst = (blend>>4)&0xf; - DX_CHECK(device->SetRenderState(D3DRS_SRCBLEND, s_blendFactor[src]) ); - DX_CHECK(device->SetRenderState(D3DRS_DESTBLEND, s_blendFactor[dst]) ); + DX_CHECK(device->SetRenderState(D3DRS_SRCBLEND, s_blendFactor[src][0]) ); + DX_CHECK(device->SetRenderState(D3DRS_DESTBLEND, s_blendFactor[dst][1]) ); // DX_CHECK(device->SetRenderState(D3DRS_SRCBLENDALPHA, D3DBLEND_SRCALPHA) ); // DX_CHECK(device->SetRenderState(D3DRS_DESTBLENDALPHA, D3DBLEND_INVSRCALPHA) ); } diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index b3624ea0..b8822af5 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -663,20 +663,20 @@ namespace bgfx GL_FLOAT, }; - static const GLenum s_blendFactor[] = + static const GLenum s_blendFactor[][2] = { - 0, // ignored - GL_ZERO, - GL_ONE, - GL_SRC_COLOR, - GL_ONE_MINUS_SRC_COLOR, - GL_SRC_ALPHA, - GL_ONE_MINUS_SRC_ALPHA, - GL_DST_ALPHA, - GL_ONE_MINUS_DST_ALPHA, - GL_DST_COLOR, - GL_ONE_MINUS_DST_COLOR, - GL_SRC_ALPHA_SATURATE, + { 0, 0 }, // ignored + { GL_ZERO, GL_ZERO }, + { GL_ONE, GL_ONE }, + { GL_SRC_COLOR, GL_SRC_COLOR }, + { GL_ONE_MINUS_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR }, + { GL_SRC_ALPHA, GL_SRC_ALPHA }, + { GL_ONE_MINUS_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA }, + { GL_DST_ALPHA, GL_DST_ALPHA }, + { GL_ONE_MINUS_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA }, + { GL_DST_COLOR, GL_DST_COLOR }, + { GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_DST_COLOR }, + { GL_SRC_ALPHA_SATURATE, GL_ONE }, }; static const GLenum s_depthFunc[] = @@ -2131,7 +2131,7 @@ namespace bgfx uint32_t src = blend&0xf; uint32_t dst = (blend>>4)&0xf; GL_CHECK(glEnable(GL_BLEND) ); - GL_CHECK(glBlendFunc(s_blendFactor[src], s_blendFactor[dst]) ); + GL_CHECK(glBlendFunc(s_blendFactor[src][0], s_blendFactor[dst][1]) ); } else {