diff --git a/include/bgfx.h b/include/bgfx.h index 470118e90..d5b8abfff 100644 --- a/include/bgfx.h +++ b/include/bgfx.h @@ -72,6 +72,7 @@ namespace bgfx #define BGFX_STATE_POINT_SIZE_MASK UINT64_C(0x000ff00000000000) #define BGFX_STATE_SRGBWRITE UINT64_C(0x0010000000000000) +#define BGFX_STATE_MSAA UINT64_C(0x0020000000000000) #define BGFX_STATE_NONE UINT64_C(0x0000000000000000) #define BGFX_STATE_MASK UINT64_C(0xffffffffffffffff) @@ -81,6 +82,7 @@ namespace bgfx | BGFX_STATE_DEPTH_TEST_LESS \ | BGFX_STATE_DEPTH_WRITE \ | BGFX_STATE_CULL_CW \ + | BGFX_STATE_MSAA \ ) #define BGFX_CLEAR_NONE UINT8_C(0x00) diff --git a/src/renderer_d3d9.cpp b/src/renderer_d3d9.cpp index 16144ff49..afe5ffc5d 100644 --- a/src/renderer_d3d9.cpp +++ b/src/renderer_d3d9.cpp @@ -1659,7 +1659,7 @@ namespace bgfx 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_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) { @@ -1704,6 +1704,11 @@ namespace bgfx } #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) { uint32_t writeEnable = (newFlags&BGFX_STATE_ALPHA_WRITE) ? D3DCOLORWRITEENABLE_ALPHA : 0;