Permalink
Browse files

All: Only convert raster state if dirty

  • Loading branch information...
hrydgard committed Jan 30, 2017
1 parent e2b179d commit e439055a32818c2cd7cfefbad340832713bbdb05
@@ -780,7 +780,7 @@ void FramebufferManagerCommon::DrawFramebufferToOutput(const u8 *srcPixels, GEBu
DrawActiveTexture(x, y, w, h, (float)pixelWidth_, (float)pixelHeight_, u0, v0, u1, v1, uvRotation, flags);
}
gstate_c.Dirty(DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE);
gstate_c.Dirty(DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE | DIRTY_RASTER_STATE);
}
void FramebufferManagerCommon::DownloadFramebufferOnSwitch(VirtualFramebuffer *vfb) {
@@ -211,7 +211,7 @@ void FramebufferManagerD3D11::DisableState() {
context_->OMSetBlendState(stockD3D11.blendStateDisabledWithColorMask[0xF], nullptr, 0xFFFFFFFF);
context_->RSSetState(stockD3D11.rasterStateNoCull);
context_->OMSetDepthStencilState(stockD3D11.depthStencilDisabled, 0xFF);
gstate_c.Dirty(DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE);
gstate_c.Dirty(DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE | DIRTY_RASTER_STATE);
}
void FramebufferManagerD3D11::CompilePostShader() {
@@ -433,7 +433,7 @@ void FramebufferManagerD3D11::DrawActiveTexture(float x, float y, float w, float
UINT offset = 0;
context_->IASetVertexBuffers(0, 1, &quadBuffer_, &stride, &offset);
context_->Draw(4, 0);
gstate_c.Dirty(DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE);
gstate_c.Dirty(DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE | DIRTY_RASTER_STATE);
}
void FramebufferManagerD3D11::Bind2DShader() {
@@ -510,7 +510,7 @@ void FramebufferManagerD3D11::ReformatFramebufferFrom(VirtualFramebuffer *vfb, G
}
RebindFramebuffer();
gstate_c.Dirty(DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE);
gstate_c.Dirty(DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE | DIRTY_RASTER_STATE);
}
static void CopyPixelDepthOnly(u32 *dstp, const u32 *srcp, size_t c) {
@@ -713,7 +713,7 @@ void FramebufferManagerD3D11::SimpleBlit(
context_->IASetVertexBuffers(0, 1, &quadBuffer_, &stride, &offset);
context_->Draw(4, 0);
gstate_c.Dirty(DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE);
gstate_c.Dirty(DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE | DIRTY_RASTER_STATE);
}
void FramebufferManagerD3D11::BlitFramebuffer(VirtualFramebuffer *dst, int dstX, int dstY, VirtualFramebuffer *src, int srcX, int srcY, int w, int h, int bpp) {
@@ -275,7 +275,8 @@ void DrawEngineD3D11::ApplyDrawState(int prim) {
}
}
{
if (gstate_c.IsDirty(DIRTY_RASTER_STATE)) {
gstate_c.Clean(DIRTY_RASTER_STATE);
keys_.raster.value = 0;
if (gstate.isModeClear()) {
keys_.raster.cullMode = D3D11_CULL_NONE;
@@ -394,7 +394,7 @@ class TextureShaderApplierD3D11 {
context_->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
context_->IASetVertexBuffers(0, 1, &vbuffer_, &stride_, &offset_);
context_->Draw(4, 0);
gstate_c.Dirty(DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE);
gstate_c.Dirty(DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE | DIRTY_RASTER_STATE);
}
protected:
@@ -198,7 +198,8 @@ void DrawEngineDX9::ApplyDrawState(int prim) {
bool enableStencilTest = !g_Config.bDisableStencilTest;
{
if (gstate_c.IsDirty(DIRTY_RASTER_STATE)) {
gstate_c.Clean(DIRTY_RASTER_STATE);
// Set Dither
if (gstate.isDitherEnabled()) {
dxstate.dither.enable();
View
@@ -692,6 +692,8 @@ void GPU_GLES::Execute_Prim(u32 op, u32 diff) {
void GPU_GLES::Execute_VertexType(u32 op, u32 diff) {
if (diff & (GE_VTYPE_TC_MASK | GE_VTYPE_THROUGH_MASK)) {
gstate_c.Dirty(DIRTY_UVSCALEOFFSET);
if (diff & GE_VTYPE_THROUGH_MASK)
gstate_c.Dirty(DIRTY_RASTER_STATE);
}
}
@@ -711,6 +713,8 @@ void GPU_GLES::Execute_VertexTypeSkinning(u32 op, u32 diff) {
gstate_c.deferredVertTypeDirty = 0;
}
}
if (diff & GE_VTYPE_THROUGH_MASK)
gstate_c.Dirty(DIRTY_RASTER_STATE);
}
void GPU_GLES::Execute_Bezier(u32 op, u32 diff) {
@@ -253,7 +253,9 @@ void DrawEngineGLES::ApplyDrawState(int prim) {
}
}
{
if (gstate_c.IsDirty(DIRTY_RASTER_STATE)) {
gstate_c.Clean(DIRTY_RASTER_STATE);
// Dither
if (gstate.isDitherEnabled()) {
glstate.dither.enable();
View
@@ -94,9 +94,9 @@ const CommonCommandTableEntry commonCommandTable[] = {
// Simple render state changes. Handled in StateMapping.cpp.
{ GE_CMD_OFFSETX, FLAG_FLUSHBEFOREONCHANGE },
{ GE_CMD_OFFSETY, FLAG_FLUSHBEFOREONCHANGE },
{ GE_CMD_CULL, FLAG_FLUSHBEFOREONCHANGE },
{ GE_CMD_CULLFACEENABLE, FLAG_FLUSHBEFOREONCHANGE },
{ GE_CMD_DITHERENABLE, FLAG_FLUSHBEFOREONCHANGE },
{ GE_CMD_CULL, FLAG_FLUSHBEFOREONCHANGE, DIRTY_RASTER_STATE },
{ GE_CMD_CULLFACEENABLE, FLAG_FLUSHBEFOREONCHANGE, DIRTY_RASTER_STATE },
{ GE_CMD_DITHERENABLE, FLAG_FLUSHBEFOREONCHANGE, DIRTY_RASTER_STATE },
{ GE_CMD_STENCILOP, FLAG_FLUSHBEFOREONCHANGE, DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE },
{ GE_CMD_STENCILTESTENABLE, FLAG_FLUSHBEFOREONCHANGE, DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE },
{ GE_CMD_ALPHABLENDENABLE, FLAG_FLUSHBEFOREONCHANGE, DIRTY_BLEND_STATE },
@@ -234,7 +234,8 @@ void DrawEngineVulkan::ConvertStateToVulkanKey(FramebufferManagerVulkan &fbManag
}
}
{
if (gstate_c.IsDirty(DIRTY_RASTER_STATE)) {
gstate_c.Clean(DIRTY_RASTER_STATE);
if (gstate.isModeClear()) {
key.cullMode = VK_CULL_MODE_NONE;
} else {

0 comments on commit e439055

Please sign in to comment.