Switch D3D over to use ConvertBlendState

This commit is contained in:
Henrik Rydgard 2015-11-08 22:42:39 +01:00
parent 4a71d4cda2
commit bcd452179f
2 changed files with 65 additions and 445 deletions

View file

@ -31,41 +31,37 @@
namespace DX9 {
static const D3DBLEND aLookup[11] = {
static const D3DBLEND dxBlendFactorLookup[(size_t)BlendFactor::COUNT] = {
D3DBLEND_ZERO,
D3DBLEND_ONE,
D3DBLEND_SRCCOLOR,
D3DBLEND_INVSRCCOLOR,
D3DBLEND_DESTCOLOR,
D3DBLEND_INVDESTCOLOR,
D3DBLEND_SRCALPHA,
D3DBLEND_INVSRCALPHA,
D3DBLEND_DESTALPHA,
D3DBLEND_INVDESTALPHA,
D3DBLEND_SRCALPHA, // should be 2x
D3DBLEND_INVSRCALPHA, // should be 2x
D3DBLEND_DESTALPHA, // should be 2x
D3DBLEND_INVDESTALPHA, // should be 2x - and COLOR?
D3DBLEND_BLENDFACTOR, // FIXA
D3DBLEND_BLENDFACTOR,
D3DBLEND_INVBLENDFACTOR,
D3DBLEND_BLENDFACTOR,
D3DBLEND_INVBLENDFACTOR,
#if 0 // TODO: Requires D3D9Ex
D3DBLEND_SRCCOLOR2,
D3DBLEND_INVSRCCOLOR2,
#else
D3DBLEND_FORCE_DWORD,
D3DBLEND_FORCE_DWORD,
#endif
D3DBLEND_FORCE_DWORD,
};
static const D3DBLEND bLookup[11] = {
D3DBLEND_SRCCOLOR,
D3DBLEND_INVSRCCOLOR,
D3DBLEND_SRCALPHA,
D3DBLEND_INVSRCALPHA,
D3DBLEND_DESTALPHA,
D3DBLEND_INVDESTALPHA,
D3DBLEND_SRCALPHA, // should be 2x
D3DBLEND_INVSRCALPHA, // should be 2x
D3DBLEND_DESTALPHA, // should be 2x
D3DBLEND_INVDESTALPHA, // should be 2x
D3DBLEND_BLENDFACTOR, // FIXB
};
static const D3DBLENDOP eqLookup[] = {
static const D3DBLENDOP dxBlendEqLookup[(size_t)BlendEq::COUNT] = {
D3DBLENDOP_ADD,
D3DBLENDOP_SUBTRACT,
D3DBLENDOP_REVSUBTRACT,
D3DBLENDOP_MIN,
D3DBLENDOP_MAX,
D3DBLENDOP_ADD, // should be abs(diff)
};
static const D3DCULL cullingMode[] = {
@ -89,46 +85,6 @@ static const D3DSTENCILOP stencilOps[] = {
D3DSTENCILOP_KEEP, // reserved
};
static D3DBLEND toDualSource(D3DBLEND blendfunc) {
#if 0
switch (blendfunc) {
// TODO
case D3DBLEND_SRCALPHA:
return D3DBLEND_SRCCOLOR2;
case D3DBLEND_INVSRCALPHA:
return D3DBLEND_INVSRCCOLOR2;
default:
return blendfunc;
}
#else
return blendfunc;
#endif
}
static D3DBLEND blendColor2Func(u32 fix, bool &approx) {
if (fix == 0xFFFFFF)
return D3DBLEND_ONE;
if (fix == 0)
return D3DBLEND_ZERO;
// Otherwise, it's approximate if we pick ONE/ZERO.
approx = true;
const Vec3f fix3 = Vec3f::FromRGB(fix);
if (fix3.x >= 0.99 && fix3.y >= 0.99 && fix3.z >= 0.99)
return D3DBLEND_ONE;
else if (fix3.x <= 0.01 && fix3.y <= 0.01 && fix3.z <= 0.01)
return D3DBLEND_ZERO;
return D3DBLEND_UNK;
}
static inline bool blendColorSimilar(const Vec3f &a, const Vec3f &b, float margin = 0.1f) {
const Vec3f diff = a - b;
if (fabsf(diff.x) <= margin && fabsf(diff.y) <= margin && fabsf(diff.z) <= margin)
return true;
return false;
}
bool TransformDrawEngineDX9::ApplyShaderBlending() {
bool skipBlit = false;
@ -163,377 +119,6 @@ inline void TransformDrawEngineDX9::ResetShaderBlending() {
}
}
void TransformDrawEngineDX9::ApplyStencilReplaceAndLogicOp(ReplaceAlphaType replaceAlphaWithStencil) {
StencilValueType stencilType = STENCIL_VALUE_KEEP;
if (replaceAlphaWithStencil == REPLACE_ALPHA_YES) {
stencilType = ReplaceAlphaWithStencilType();
}
// Normally, we would add src + 0, but the logic op may have us do differently.
D3DBLEND srcBlend = D3DBLEND_ONE;
D3DBLEND dstBlend = D3DBLEND_ZERO;
D3DBLENDOP blendOp = D3DBLENDOP_ADD;
if (gstate.isLogicOpEnabled()) {
switch (gstate.getLogicOp())
{
case GE_LOGIC_CLEAR:
srcBlend = D3DBLEND_ZERO;
break;
case GE_LOGIC_AND:
case GE_LOGIC_AND_REVERSE:
WARN_LOG_REPORT_ONCE(d3dLogicOpAnd, G3D, "Unsupported AND logic op: %x", gstate.getLogicOp());
break;
case GE_LOGIC_COPY:
// This is the same as off.
break;
case GE_LOGIC_COPY_INVERTED:
// Handled in the shader.
break;
case GE_LOGIC_AND_INVERTED:
case GE_LOGIC_NOR:
case GE_LOGIC_NAND:
case GE_LOGIC_EQUIV:
// Handled in the shader.
WARN_LOG_REPORT_ONCE(d3dLogicOpAndInverted, G3D, "Attempted invert for logic op: %x", gstate.getLogicOp());
break;
case GE_LOGIC_INVERTED:
srcBlend = D3DBLEND_ONE;
dstBlend = D3DBLEND_ONE;
blendOp = D3DBLENDOP_SUBTRACT;
WARN_LOG_REPORT_ONCE(d3dLogicOpInverted, G3D, "Attempted inverse for logic op: %x", gstate.getLogicOp());
break;
case GE_LOGIC_NOOP:
srcBlend = D3DBLEND_ZERO;
dstBlend = D3DBLEND_ONE;
break;
case GE_LOGIC_XOR:
WARN_LOG_REPORT_ONCE(d3dLogicOpOrXor, G3D, "Unsupported XOR logic op: %x", gstate.getLogicOp());
break;
case GE_LOGIC_OR:
case GE_LOGIC_OR_INVERTED:
// Inverted in shader.
dstBlend = D3DBLEND_ONE;
WARN_LOG_REPORT_ONCE(d3dLogicOpOr, G3D, "Attempted or for logic op: %x", gstate.getLogicOp());
break;
case GE_LOGIC_OR_REVERSE:
WARN_LOG_REPORT_ONCE(d3dLogicOpOrReverse, G3D, "Unsupported OR REVERSE logic op: %x", gstate.getLogicOp());
break;
case GE_LOGIC_SET:
dstBlend = D3DBLEND_ONE;
WARN_LOG_REPORT_ONCE(d3dLogicOpSet, G3D, "Attempted set for logic op: %x", gstate.getLogicOp());
break;
}
}
// We're not blending, but we may still want to blend for stencil.
// This is only useful for INCR/DECR/INVERT. Others can write directly.
switch (stencilType) {
case STENCIL_VALUE_INCR_4:
case STENCIL_VALUE_INCR_8:
// We'll add the incremented value output by the shader.
dxstate.blendFunc.set(srcBlend, dstBlend, D3DBLEND_ONE, D3DBLEND_ONE);
dxstate.blendEquation.set(blendOp, D3DBLENDOP_ADD);
dxstate.blend.enable();
dxstate.blendSeparate.enable();
break;
case STENCIL_VALUE_DECR_4:
case STENCIL_VALUE_DECR_8:
// We'll subtract the incremented value output by the shader.
dxstate.blendFunc.set(srcBlend, dstBlend, D3DBLEND_ONE, D3DBLEND_ONE);
dxstate.blendEquation.set(blendOp, D3DBLENDOP_SUBTRACT);
dxstate.blend.enable();
dxstate.blendSeparate.enable();
break;
case STENCIL_VALUE_INVERT:
// The shader will output one, and reverse subtracting will essentially invert.
dxstate.blendFunc.set(srcBlend, dstBlend, D3DBLEND_ONE, D3DBLEND_ONE);
dxstate.blendEquation.set(blendOp, D3DBLENDOP_REVSUBTRACT);
dxstate.blend.enable();
dxstate.blendSeparate.enable();
break;
default:
if (srcBlend == D3DBLEND_ONE && dstBlend == D3DBLEND_ZERO && blendOp == D3DBLENDOP_ADD) {
dxstate.blend.disable();
} else {
dxstate.blendFunc.set(srcBlend, dstBlend, D3DBLEND_ONE, D3DBLEND_ZERO);
dxstate.blendEquation.set(blendOp, D3DBLENDOP_ADD);
dxstate.blend.enable();
dxstate.blendSeparate.enable();
}
break;
}
}
void TransformDrawEngineDX9::ApplyBlendState() {
// Blending is a bit complex to emulate. This is due to several reasons:
//
// * Doubled blend modes (src, dst, inversed) aren't supported in Direct3D.
// If possible, we double the src color or src alpha in the shader to account for these.
// These may clip incorrectly, so we avoid unfortunately.
// * Direct3D only has one arbitrary fixed color. We premultiply the other in the shader.
// * The written output alpha should actually be the stencil value. Alpha is not written.
// * We try to apply logical operations through blending.
//
// If we can't apply blending, we make a copy of the framebuffer and do it manually.
// Unfortunately, we can't really do this in Direct3D 9...
gstate_c.allowShaderBlend = false;
ReplaceBlendType replaceBlend = ReplaceBlendWithShader(gstate_c.allowShaderBlend, gstate.FrameBufFormat());
ReplaceAlphaType replaceAlphaWithStencil = ReplaceAlphaWithStencil(replaceBlend);
bool usePreSrc = false;
switch (replaceBlend) {
case REPLACE_BLEND_NO:
ResetShaderBlending();
// We may still want to do something about stencil -> alpha.
ApplyStencilReplaceAndLogicOp(replaceAlphaWithStencil);
return;
case REPLACE_BLEND_COPY_FBO:
if (ApplyShaderBlending()) {
// We may still want to do something about stencil -> alpha.
ApplyStencilReplaceAndLogicOp(replaceAlphaWithStencil);
return;
}
// Until next time, force it off.
gstate_c.allowShaderBlend = false;
break;
case REPLACE_BLEND_PRE_SRC:
case REPLACE_BLEND_PRE_SRC_2X_ALPHA:
usePreSrc = true;
break;
case REPLACE_BLEND_STANDARD:
case REPLACE_BLEND_2X_ALPHA:
case REPLACE_BLEND_2X_SRC:
break;
}
if (gstate.isLogicOpEnabled() && gstate.getLogicOp() != GE_LOGIC_COPY) {
WARN_LOG_REPORT_ONCE(logicOpBlend, G3D, "Logic op and blend enabled, unsupported.");
}
dxstate.blend.enable();
dxstate.blendSeparate.enable();
ResetShaderBlending();
GEBlendMode blendFuncEq = gstate.getBlendEq();
int blendFuncA = gstate.getBlendFuncA();
int blendFuncB = gstate.getBlendFuncB();
if (blendFuncA > GE_SRCBLEND_FIXA)
blendFuncA = GE_SRCBLEND_FIXA;
if (blendFuncB > GE_DSTBLEND_FIXB)
blendFuncB = GE_DSTBLEND_FIXB;
float constantAlpha = 1.0f;
D3DBLEND constantAlphaDX = D3DBLEND_ONE;
if (gstate.isStencilTestEnabled() && replaceAlphaWithStencil == REPLACE_ALPHA_NO) {
switch (ReplaceAlphaWithStencilType()) {
case STENCIL_VALUE_UNIFORM:
constantAlpha = (float) gstate.getStencilTestRef() * (1.0f / 255.0f);
break;
case STENCIL_VALUE_INCR_4:
case STENCIL_VALUE_DECR_4:
constantAlpha = 1.0f / 15.0f;
break;
case STENCIL_VALUE_INCR_8:
case STENCIL_VALUE_DECR_8:
constantAlpha = 1.0f / 255.0f;
break;
default:
break;
}
// Otherwise it will stay GL_ONE.
if (constantAlpha <= 0.0f) {
constantAlphaDX = D3DBLEND_ZERO;
} else if (constantAlpha < 1.0f) {
constantAlphaDX = D3DBLEND_BLENDFACTOR;
}
}
// Shortcut by using D3DBLEND_ONE where possible, no need to set blendcolor
bool approxFuncA = false;
D3DBLEND glBlendFuncA = blendFuncA == GE_SRCBLEND_FIXA ? blendColor2Func(gstate.getFixA(), approxFuncA) : aLookup[blendFuncA];
bool approxFuncB = false;
D3DBLEND glBlendFuncB = blendFuncB == GE_DSTBLEND_FIXB ? blendColor2Func(gstate.getFixB(), approxFuncB) : bLookup[blendFuncB];
if (gstate.FrameBufFormat() == GE_FORMAT_565) {
if (blendFuncA == GE_SRCBLEND_DSTALPHA || blendFuncA == GE_SRCBLEND_DOUBLEDSTALPHA) {
glBlendFuncA = D3DBLEND_ZERO;
}
if (blendFuncA == GE_SRCBLEND_INVDSTALPHA || blendFuncA == GE_SRCBLEND_DOUBLEINVDSTALPHA) {
glBlendFuncA = D3DBLEND_ONE;
}
if (blendFuncB == GE_DSTBLEND_DSTALPHA || blendFuncB == GE_DSTBLEND_DOUBLEDSTALPHA) {
glBlendFuncB = D3DBLEND_ZERO;
}
if (blendFuncB == GE_DSTBLEND_INVDSTALPHA || blendFuncB == GE_DSTBLEND_DOUBLEINVDSTALPHA) {
glBlendFuncB = D3DBLEND_ONE;
}
}
if (usePreSrc) {
glBlendFuncA = D3DBLEND_ONE;
// Need to pull in the fixed color.
if (blendFuncA == GE_SRCBLEND_FIXA) {
shaderManager_->DirtyUniform(DIRTY_SHADERBLEND);
}
}
if (replaceAlphaWithStencil == REPLACE_ALPHA_DUALSOURCE) {
glBlendFuncA = toDualSource(glBlendFuncA);
glBlendFuncB = toDualSource(glBlendFuncB);
}
auto setBlendColorv = [&](const Vec3f &c) {
const float blendColor[4] = {c.x, c.y, c.z, constantAlpha};
dxstate.blendColor.set(blendColor);
};
auto defaultBlendColor = [&]() {
if (constantAlphaDX == D3DBLEND_BLENDFACTOR) {
const float blendColor[4] = {1.0f, 1.0f, 1.0f, constantAlpha};
dxstate.blendColor.set(blendColor);
}
};
if (blendFuncA == GE_SRCBLEND_FIXA || blendFuncB == GE_DSTBLEND_FIXB) {
const Vec3f fixA = Vec3f::FromRGB(gstate.getFixA());
const Vec3f fixB = Vec3f::FromRGB(gstate.getFixB());
if (glBlendFuncA == D3DBLEND_UNK && glBlendFuncB != D3DBLEND_UNK) {
// Can use blendcolor trivially.
setBlendColorv(fixA);
glBlendFuncA = D3DBLEND_BLENDFACTOR;
} else if (glBlendFuncA != D3DBLEND_UNK && glBlendFuncB == D3DBLEND_UNK) {
// Can use blendcolor trivially.
setBlendColorv(fixB);
glBlendFuncB = D3DBLEND_BLENDFACTOR;
} else if (glBlendFuncA == D3DBLEND_UNK && glBlendFuncB == D3DBLEND_UNK) {
if (blendColorSimilar(fixA, Vec3f::AssignToAll(1.0f) - fixB)) {
glBlendFuncA = D3DBLEND_BLENDFACTOR;
glBlendFuncB = D3DBLEND_INVBLENDFACTOR;
setBlendColorv(fixA);
} else if (blendColorSimilar(fixA, fixB)) {
glBlendFuncA = D3DBLEND_BLENDFACTOR;
glBlendFuncB = D3DBLEND_BLENDFACTOR;
setBlendColorv(fixA);
} else {
DEBUG_LOG(G3D, "ERROR INVALID blendcolorstate: FixA=%06x FixB=%06x FuncA=%i FuncB=%i", gstate.getFixA(), gstate.getFixB(), gstate.getBlendFuncA(), gstate.getBlendFuncB());
// Let's approximate, at least. Close is better than totally off.
const bool nearZeroA = blendColorSimilar(fixA, Vec3f::AssignToAll(0.0f), 0.25f);
const bool nearZeroB = blendColorSimilar(fixB, Vec3f::AssignToAll(0.0f), 0.25f);
if (nearZeroA || blendColorSimilar(fixA, Vec3f::AssignToAll(1.0f), 0.25f)) {
glBlendFuncA = nearZeroA ? D3DBLEND_ZERO : D3DBLEND_ONE;
glBlendFuncB = D3DBLEND_BLENDFACTOR;
setBlendColorv(fixB);
} else {
// We need to pick something. Let's go with A as the fixed color.
glBlendFuncA = D3DBLEND_BLENDFACTOR;
glBlendFuncB = nearZeroB ? D3DBLEND_ZERO : D3DBLEND_ONE;
setBlendColorv(fixA);
}
}
} else {
// We optimized both, but that's probably not necessary, so let's pick one to be constant.
if (blendFuncA == GE_SRCBLEND_FIXA && !usePreSrc && approxFuncA) {
glBlendFuncA = D3DBLEND_BLENDFACTOR;
setBlendColorv(fixA);
} else if (approxFuncB) {
glBlendFuncB = D3DBLEND_BLENDFACTOR;
setBlendColorv(fixB);
} else {
defaultBlendColor();
}
}
} else {
defaultBlendColor();
}
// At this point, through all paths above, glBlendFuncA and glBlendFuncB will be set right somehow.
// The stencil-to-alpha in fragment shader doesn't apply here (blending is enabled), and we shouldn't
// do any blending in the alpha channel as that doesn't seem to happen on PSP. So, we attempt to
// apply the stencil to the alpha, since that's what should be stored.
D3DBLENDOP alphaEq = D3DBLENDOP_ADD;
if (replaceAlphaWithStencil != REPLACE_ALPHA_NO) {
// Let the fragment shader take care of it.
switch (ReplaceAlphaWithStencilType()) {
case STENCIL_VALUE_INCR_4:
case STENCIL_VALUE_INCR_8:
// We'll add the increment value.
dxstate.blendFunc.set(glBlendFuncA, glBlendFuncB, D3DBLEND_ONE, D3DBLEND_ONE);
break;
case STENCIL_VALUE_DECR_4:
case STENCIL_VALUE_DECR_8:
// Like add with a small value, but subtracting.
dxstate.blendFunc.set(glBlendFuncA, glBlendFuncB, D3DBLEND_ONE, D3DBLEND_ONE);
alphaEq = D3DBLENDOP_SUBTRACT;
break;
case STENCIL_VALUE_INVERT:
// This will subtract by one, effectively inverting the bits.
dxstate.blendFunc.set(glBlendFuncA, glBlendFuncB, D3DBLEND_ONE, D3DBLEND_ONE);
alphaEq = D3DBLENDOP_REVSUBTRACT;
break;
default:
dxstate.blendFunc.set(glBlendFuncA, glBlendFuncB, D3DBLEND_ONE, D3DBLEND_ZERO);
break;
}
} else if (gstate.isStencilTestEnabled()) {
switch (ReplaceAlphaWithStencilType()) {
case STENCIL_VALUE_KEEP:
dxstate.blendFunc.set(glBlendFuncA, glBlendFuncB, D3DBLEND_ZERO, D3DBLEND_ONE);
break;
case STENCIL_VALUE_ONE:
// This won't give one but it's our best shot...
dxstate.blendFunc.set(glBlendFuncA, glBlendFuncB, D3DBLEND_ONE, D3DBLEND_ONE);
break;
case STENCIL_VALUE_ZERO:
dxstate.blendFunc.set(glBlendFuncA, glBlendFuncB, D3DBLEND_ZERO, D3DBLEND_ZERO);
break;
case STENCIL_VALUE_UNIFORM:
// This won't give a correct value (it multiplies) but it may be better than random values.
// TODO: Does this work as the alpha component of the fixed blend factor?
dxstate.blendFunc.set(glBlendFuncA, glBlendFuncB, constantAlphaDX, D3DBLEND_ZERO);
break;
case STENCIL_VALUE_INCR_4:
case STENCIL_VALUE_INCR_8:
// This won't give a correct value always, but it will try to increase at least.
// TODO: Does this work as the alpha component of the fixed blend factor?
dxstate.blendFunc.set(glBlendFuncA, glBlendFuncB, constantAlphaDX, D3DBLEND_ONE);
break;
case STENCIL_VALUE_DECR_4:
case STENCIL_VALUE_DECR_8:
// This won't give a correct value always, but it will try to decrease at least.
// TODO: Does this work as the alpha component of the fixed blend factor?
dxstate.blendFunc.set(glBlendFuncA, glBlendFuncB, constantAlphaDX, D3DBLEND_ONE);
alphaEq = D3DBLENDOP_SUBTRACT;
break;
case STENCIL_VALUE_INVERT:
dxstate.blendFunc.set(glBlendFuncA, glBlendFuncB, D3DBLEND_ONE, D3DBLEND_ONE);
// If the output alpha is near 1, this will basically invert. It's our best shot.
alphaEq = D3DBLENDOP_REVSUBTRACT;
break;
}
} else {
// Retain the existing value when stencil testing is off.
dxstate.blendFunc.set(glBlendFuncA, glBlendFuncB, D3DBLEND_ZERO, D3DBLEND_ONE);
}
dxstate.blendEquation.set(eqLookup[blendFuncEq], alphaEq);
}
void TransformDrawEngineDX9::ApplyDrawState(int prim) {
// TODO: All this setup is soon so expensive that we'll need dirty flags, or simply do it in the command writes where we detect dirty by xoring. Silly to do all this work on every drawcall.
@ -548,7 +133,52 @@ void TransformDrawEngineDX9::ApplyDrawState(int prim) {
}
// Set blend - unless we need to do it in the shader.
ApplyBlendState();
GenericBlendState blendState;
ConvertBlendState(blendState);
bool useBufferedRendering = g_Config.iRenderingMode != FB_NON_BUFFERED_MODE;
ViewportAndScissor vpAndScissor;
ConvertViewportAndScissor(useBufferedRendering,
framebufferManager_->GetRenderWidth(), framebufferManager_->GetRenderHeight(),
framebufferManager_->GetTargetBufferWidth(), framebufferManager_->GetTargetBufferHeight(),
vpAndScissor);
if (blendState.applyShaderBlending) {
if (ApplyShaderBlending()) {
// We may still want to do something about stencil -> alpha.
ApplyStencilReplaceAndLogicOp(blendState.replaceAlphaWithStencil, blendState);
} else {
// Until next time, force it off.
gstate_c.allowShaderBlend = false;
}
} else if (blendState.resetShaderBlending) {
ResetShaderBlending();
}
if (blendState.enabled) {
dxstate.blend.enable();
dxstate.blendSeparate.enable();
dxstate.blendEquation.set(dxBlendEqLookup[(size_t)blendState.eqColor], dxBlendEqLookup[(size_t)blendState.eqAlpha]);
dxstate.blendFunc.set(
dxBlendFactorLookup[(size_t)blendState.srcColor], dxBlendFactorLookup[(size_t)blendState.dstColor],
dxBlendFactorLookup[(size_t)blendState.srcAlpha], dxBlendFactorLookup[(size_t)blendState.dstAlpha]);
if (blendState.dirtyShaderBlend) {
shaderManager_->DirtyUniform(DIRTY_SHADERBLEND);
}
if (blendState.useBlendColor) {
uint32_t color = blendState.blendColor;
const float col[4] = {
(float)((color & 0xFF) >> 0) * (1.0f / 255.0f),
(float)((color & 0xFF00) >> 8) * (1.0f / 255.0f),
(float)((color & 0xFF0000) >> 16) * (1.0f / 255.0f),
(float)((color & 0xFF000000) >> 24) * (1.0f / 255.0f),
};
dxstate.blendColor.set(col);
}
} else {
dxstate.blend.disable();
dxstate.blendSeparate.disable();
}
// Set Dither
if (gstate.isDitherEnabled()) {
@ -651,14 +281,6 @@ void TransformDrawEngineDX9::ApplyDrawState(int prim) {
}
}
bool useBufferedRendering = g_Config.iRenderingMode != FB_NON_BUFFERED_MODE;
ViewportAndScissor vpAndScissor;
ConvertViewportAndScissor(useBufferedRendering,
framebufferManager_->GetRenderWidth(), framebufferManager_->GetRenderHeight(),
framebufferManager_->GetTargetBufferWidth(), framebufferManager_->GetTargetBufferHeight(),
vpAndScissor);
if (vpAndScissor.scissorEnable) {
dxstate.scissorTest.enable();
dxstate.scissorRect.set(vpAndScissor.scissorX, vpAndScissor.scissorY, vpAndScissor.scissorX + vpAndScissor.scissorW, vpAndScissor.scissorY + vpAndScissor.scissorH);

View file

@ -192,10 +192,8 @@ private:
void ApplyDrawState(int prim);
void ApplyDrawStateLate();
void ApplyBlendState();
void ApplyStencilReplaceAndLogicOp(ReplaceAlphaType replaceAlphaWithStencil);
bool ApplyShaderBlending();
inline void ResetShaderBlending();
void ResetShaderBlending();
IDirect3DVertexDeclaration9 *SetupDecFmtForDraw(VSShader *vshader, const DecVtxFormat &decFmt, u32 pspFmt);