[D3D12] DXBC: Fix 0*anything check with negated operands

This commit is contained in:
Triang3l 2019-01-12 18:52:06 +03:00
parent b8d1bb740b
commit 27a8e4259e
1 changed files with 16 additions and 10 deletions

View File

@ -1942,12 +1942,15 @@ uint32_t DxbcShaderTranslator::DxbcSourceOperandLength(
// totally invalid operand replaced by a literal. // totally invalid operand replaced by a literal.
return 5; return 5;
} }
// Apply both the operand negation and the usage negation (for subtraction) // Apply overrides (for instance, for subtraction). Xenos operand modifiers
// and absolute from both sources. // are ignored when forcing absolute value (though negated absolute can still
if (operand.is_negated) { // be forced in this case).
negate = !negate; if (!absolute) {
if (operand.is_negated) {
negate = !negate;
}
absolute |= operand.is_absolute_value;
} }
absolute |= operand.is_absolute_value;
// Modifier extension - neg/abs or non-uniform binding index. // Modifier extension - neg/abs or non-uniform binding index.
if (negate || absolute) { if (negate || absolute) {
++length; ++length;
@ -1981,12 +1984,15 @@ void DxbcShaderTranslator::UseDxbcSourceOperand(
(swizzle << D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE_SHIFT); (swizzle << D3D10_SB_OPERAND_4_COMPONENT_SWIZZLE_SHIFT);
} }
// Apply both the operand negation and the usage negation (for subtraction) // Apply overrides (for instance, for subtraction). Xenos operand modifiers
// and absolute value from both sources. // are ignored when forcing absolute value (though negated absolute can still
if (operand.is_negated) { // be forced in this case).
negate = !negate; if (!absolute) {
if (operand.is_negated) {
negate = !negate;
}
absolute |= operand.is_absolute_value;
} }
absolute |= operand.is_absolute_value;
// Build OperandToken1 for modifiers (negate, absolute, minimum precision, // Build OperandToken1 for modifiers (negate, absolute, minimum precision,
// non-uniform binding index) - if it has any, it will be non-zero. // non-uniform binding index) - if it has any, it will be non-zero.
// NOTE: AMD GPUs or drivers do NOT support non-uniform constant buffer // NOTE: AMD GPUs or drivers do NOT support non-uniform constant buffer