Added BGFX_STATE_MSAA to allow non-AA rendering to MSAA surface.

This commit is contained in:
bkaradzic 2012-06-02 15:07:35 -07:00
parent a134ea9d1a
commit 50a6e41549
2 changed files with 8 additions and 1 deletions

View File

@ -72,6 +72,7 @@ namespace bgfx
#define BGFX_STATE_POINT_SIZE_MASK UINT64_C(0x000ff00000000000) #define BGFX_STATE_POINT_SIZE_MASK UINT64_C(0x000ff00000000000)
#define BGFX_STATE_SRGBWRITE UINT64_C(0x0010000000000000) #define BGFX_STATE_SRGBWRITE UINT64_C(0x0010000000000000)
#define BGFX_STATE_MSAA UINT64_C(0x0020000000000000)
#define BGFX_STATE_NONE UINT64_C(0x0000000000000000) #define BGFX_STATE_NONE UINT64_C(0x0000000000000000)
#define BGFX_STATE_MASK UINT64_C(0xffffffffffffffff) #define BGFX_STATE_MASK UINT64_C(0xffffffffffffffff)
@ -81,6 +82,7 @@ namespace bgfx
| BGFX_STATE_DEPTH_TEST_LESS \ | BGFX_STATE_DEPTH_TEST_LESS \
| BGFX_STATE_DEPTH_WRITE \ | BGFX_STATE_DEPTH_WRITE \
| BGFX_STATE_CULL_CW \ | BGFX_STATE_CULL_CW \
| BGFX_STATE_MSAA \
) )
#define BGFX_CLEAR_NONE UINT8_C(0x00) #define BGFX_CLEAR_NONE UINT8_C(0x00)

View File

@ -1659,7 +1659,7 @@ namespace bgfx
if ( (BGFX_STATE_CULL_MASK|BGFX_STATE_DEPTH_WRITE|BGFX_STATE_DEPTH_TEST_MASK if ( (BGFX_STATE_CULL_MASK|BGFX_STATE_DEPTH_WRITE|BGFX_STATE_DEPTH_TEST_MASK
|BGFX_STATE_ALPHA_MASK|BGFX_STATE_ALPHA_WRITE|BGFX_STATE_RGB_WRITE |BGFX_STATE_ALPHA_MASK|BGFX_STATE_ALPHA_WRITE|BGFX_STATE_RGB_WRITE
|BGFX_STATE_BLEND_MASK|BGFX_STATE_ALPHA_REF_MASK|BGFX_STATE_PT_MASK |BGFX_STATE_BLEND_MASK|BGFX_STATE_ALPHA_REF_MASK|BGFX_STATE_PT_MASK
|BGFX_STATE_POINT_SIZE_MASK|BGFX_STATE_SRGBWRITE) & changedFlags) |BGFX_STATE_POINT_SIZE_MASK|BGFX_STATE_SRGBWRITE|BGFX_STATE_MSAA) & changedFlags)
{ {
if (BGFX_STATE_CULL_MASK & changedFlags) if (BGFX_STATE_CULL_MASK & changedFlags)
{ {
@ -1704,6 +1704,11 @@ namespace bgfx
} }
#endif // BX_PLATFORM_WINDOWS #endif // BX_PLATFORM_WINDOWS
if (BGFX_STATE_MSAA & changedFlags)
{
DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, (newFlags&BGFX_STATE_MSAA) == BGFX_STATE_MSAA) );
}
if ( (BGFX_STATE_ALPHA_WRITE|BGFX_STATE_RGB_WRITE) & changedFlags) if ( (BGFX_STATE_ALPHA_WRITE|BGFX_STATE_RGB_WRITE) & changedFlags)
{ {
uint32_t writeEnable = (newFlags&BGFX_STATE_ALPHA_WRITE) ? D3DCOLORWRITEENABLE_ALPHA : 0; uint32_t writeEnable = (newFlags&BGFX_STATE_ALPHA_WRITE) ? D3DCOLORWRITEENABLE_ALPHA : 0;