mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-20 19:54:19 +01:00
[d3d9, dxso] Remove AlphaTestEnable spec constant
Go based on the func we already have. Avoids wasting a spec const.
This commit is contained in:
parent
ada463badc
commit
242b7b6d9c
@ -5674,8 +5674,7 @@ namespace dxvk {
|
||||
: VK_COMPARE_OP_ALWAYS;
|
||||
|
||||
EmitCs([cAlphaOp = alphaOp] (DxvkContext* ctx) {
|
||||
ctx->setSpecConstant(VK_PIPELINE_BIND_POINT_GRAPHICS, D3D9SpecConstantId::AlphaTestEnable, cAlphaOp != VK_COMPARE_OP_ALWAYS);
|
||||
ctx->setSpecConstant(VK_PIPELINE_BIND_POINT_GRAPHICS, D3D9SpecConstantId::AlphaCompareOp, cAlphaOp);
|
||||
ctx->setSpecConstant(VK_PIPELINE_BIND_POINT_GRAPHICS, D3D9SpecConstantId::AlphaCompareOp, cAlphaOp);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -2211,12 +2211,7 @@ namespace dxvk {
|
||||
uint32_t floatPtr = m_module.defPointerType(m_floatType, spv::StorageClassPushConstant);
|
||||
|
||||
// Declare spec constants for render states
|
||||
uint32_t alphaTestId = m_module.specConstBool(false);
|
||||
uint32_t alphaFuncId = m_module.specConst32(m_module.defIntType(32, 0), 0);
|
||||
|
||||
m_module.setDebugName(alphaTestId, "alpha_test");
|
||||
m_module.decorateSpecId(alphaTestId, getSpecId(D3D9SpecConstantId::AlphaTestEnable));
|
||||
|
||||
m_module.setDebugName(alphaFuncId, "alpha_func");
|
||||
m_module.decorateSpecId(alphaFuncId, getSpecId(D3D9SpecConstantId::AlphaCompareOp));
|
||||
|
||||
@ -2241,8 +2236,9 @@ namespace dxvk {
|
||||
uint32_t atestSkipLabel = m_module.allocateId();
|
||||
|
||||
// if (alpha_test) { ... }
|
||||
uint32_t isNotAlways = m_module.opINotEqual(boolType, alphaFuncId, m_module.constu32(VK_COMPARE_OP_ALWAYS));
|
||||
m_module.opSelectionMerge(atestSkipLabel, spv::SelectionControlMaskNone);
|
||||
m_module.opBranchConditional(alphaTestId, atestBeginLabel, atestSkipLabel);
|
||||
m_module.opBranchConditional(isNotAlways, atestBeginLabel, atestSkipLabel);
|
||||
m_module.opLabel(atestBeginLabel);
|
||||
|
||||
// Load alpha component
|
||||
@ -2294,8 +2290,6 @@ namespace dxvk {
|
||||
atestVariables.data());
|
||||
uint32_t atestDiscard = m_module.opLogicalNot(boolType, atestResult);
|
||||
|
||||
atestResult = m_module.opLogicalNot(boolType, atestResult);
|
||||
|
||||
// if (do_discard) { ... }
|
||||
m_module.opSelectionMerge(atestKeepLabel, spv::SelectionControlMaskNone);
|
||||
m_module.opBranchConditional(atestDiscard, atestDiscardLabel, atestKeepLabel);
|
||||
|
@ -5,19 +5,18 @@
|
||||
namespace dxvk {
|
||||
|
||||
enum D3D9SpecConstantId : uint32_t {
|
||||
AlphaTestEnable = 0,
|
||||
AlphaCompareOp = 1,
|
||||
SamplerType = 2,
|
||||
FogEnabled = 3,
|
||||
VertexFogMode = 4,
|
||||
PixelFogMode = 5,
|
||||
AlphaCompareOp = 0,
|
||||
SamplerType = 1,
|
||||
FogEnabled = 2,
|
||||
VertexFogMode = 3,
|
||||
PixelFogMode = 4,
|
||||
|
||||
PointMode = 6,
|
||||
ProjectionType = 7,
|
||||
PointMode = 5,
|
||||
ProjectionType = 6,
|
||||
|
||||
VertexShaderBools = 8,
|
||||
PixelShaderBools = 9,
|
||||
Fetch4 = 10
|
||||
VertexShaderBools = 7,
|
||||
PixelShaderBools = 8,
|
||||
Fetch4 = 9
|
||||
};
|
||||
|
||||
}
|
@ -3555,13 +3555,7 @@ void DxsoCompiler::emitControlFlowGenericLoop(
|
||||
uint32_t floatType = m_module.defFloatType(32);
|
||||
uint32_t floatPtr = m_module.defPointerType(floatType, spv::StorageClassPushConstant);
|
||||
|
||||
// Declare spec constants for render states
|
||||
uint32_t alphaTestId = m_module.specConstBool(false);
|
||||
uint32_t alphaFuncId = m_module.specConst32(m_module.defIntType(32, 0), 0);
|
||||
|
||||
m_module.setDebugName (alphaTestId, "alpha_test");
|
||||
m_module.decorateSpecId (alphaTestId, getSpecId(D3D9SpecConstantId::AlphaTestEnable));
|
||||
|
||||
m_module.setDebugName (alphaFuncId, "alpha_func");
|
||||
m_module.decorateSpecId (alphaFuncId, getSpecId(D3D9SpecConstantId::AlphaCompareOp));
|
||||
|
||||
@ -3592,9 +3586,10 @@ void DxsoCompiler::emitControlFlowGenericLoop(
|
||||
uint32_t atestKeepLabel = m_module.allocateId();
|
||||
uint32_t atestSkipLabel = m_module.allocateId();
|
||||
|
||||
// if (alpha_test) { ... }
|
||||
// if (alpha_func != ALWAYS) { ... }
|
||||
uint32_t isNotAlways = m_module.opINotEqual(boolType, alphaFuncId, m_module.constu32(VK_COMPARE_OP_ALWAYS));
|
||||
m_module.opSelectionMerge(atestSkipLabel, spv::SelectionControlMaskNone);
|
||||
m_module.opBranchConditional(alphaTestId, atestBeginLabel, atestSkipLabel);
|
||||
m_module.opBranchConditional(isNotAlways, atestBeginLabel, atestSkipLabel);
|
||||
m_module.opLabel(atestBeginLabel);
|
||||
|
||||
// Load alpha component
|
||||
@ -3661,8 +3656,6 @@ void DxsoCompiler::emitControlFlowGenericLoop(
|
||||
atestVariables.data());
|
||||
uint32_t atestDiscard = m_module.opLogicalNot(boolType, atestResult);
|
||||
|
||||
atestResult = m_module.opLogicalNot(boolType, atestResult);
|
||||
|
||||
// if (do_discard) { ... }
|
||||
m_module.opSelectionMerge(atestKeepLabel, spv::SelectionControlMaskNone);
|
||||
m_module.opBranchConditional(atestDiscard, atestDiscardLabel, atestKeepLabel);
|
||||
|
Loading…
x
Reference in New Issue
Block a user