Removed srcalphasat from dst blend mode.

This commit is contained in:
bkaradzic 2012-08-07 22:25:25 -07:00
parent 055891a42d
commit 38b75c9470
3 changed files with 30 additions and 30 deletions

View file

@ -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[] =

View file

@ -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) );
}

View file

@ -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
{