[D3D12] Alphatest fix and HLSL style cleanup
This commit is contained in:
parent
285de2a521
commit
90a36e3818
|
@ -1438,7 +1438,7 @@ void D3D12CommandProcessor::UpdateSystemConstantValues(
|
|||
system_constants_.ssaa_inv_scale[1] = ssaa_inv_scale_y;
|
||||
|
||||
// Alpha test.
|
||||
int32_t alpha_test = 0;
|
||||
int32_t alpha_test;
|
||||
if (rb_colorcontrol & 0x8) {
|
||||
uint32_t alpha_test_function = rb_colorcontrol & 0x7;
|
||||
// 0: Never - fail in [-inf, +inf].
|
||||
|
@ -1449,7 +1449,7 @@ void D3D12CommandProcessor::UpdateSystemConstantValues(
|
|||
// 5: Not equal - fail in [ref, ref].
|
||||
// 6: Greater or equal - pass in [ref, +inf].
|
||||
// 7: Always - pass in [-inf, +inf].
|
||||
int32_t alpha_test = (alpha_test_function & 0x2) ? 1 : -1;
|
||||
alpha_test = (alpha_test_function & 0x2) ? 1 : -1;
|
||||
uint32_t alpha_test_range_start =
|
||||
(alpha_test_function == 1 || alpha_test_function == 2 ||
|
||||
alpha_test_function == 5 || alpha_test_function == 6)
|
||||
|
|
|
@ -403,10 +403,10 @@ std::vector<uint8_t> HlslShaderTranslator::CompleteTranslation() {
|
|||
} else if (is_pixel_shader()) {
|
||||
source.Append(
|
||||
// Apply the exponent bias.
|
||||
" xe_color_output[0] *= xe_color_exp_bias.x;\n"
|
||||
" xe_color_output[1] *= xe_color_exp_bias.y;\n"
|
||||
" xe_color_output[2] *= xe_color_exp_bias.z;\n"
|
||||
" xe_color_output[3] *= xe_color_exp_bias.w;\n"
|
||||
" xe_color_output[0u] *= xe_color_exp_bias.x;\n"
|
||||
" xe_color_output[1u] *= xe_color_exp_bias.y;\n"
|
||||
" xe_color_output[2u] *= xe_color_exp_bias.z;\n"
|
||||
" xe_color_output[3u] *= xe_color_exp_bias.w;\n"
|
||||
// Perform alpha test - check if the alpha is within the specified
|
||||
// bounds (inclusively), fail or pass depending on comparison mode and
|
||||
// on the results of the bound test.
|
||||
|
@ -414,7 +414,7 @@ std::vector<uint8_t> HlslShaderTranslator::CompleteTranslation() {
|
|||
" bool xe_alpha_test_failed =\n"
|
||||
" xe_color_output[0u].a >= xe_alpha_test_range.x &&\n"
|
||||
" xe_color_output[0u].a <= xe_alpha_test_range.y;\n"
|
||||
" [flatten] if (xe_alpha_test > 0) {\n"
|
||||
" if (xe_alpha_test > 0) {\n"
|
||||
" xe_alpha_test_failed = !xe_alpha_test_failed;\n"
|
||||
" }\n"
|
||||
" if (xe_alpha_test_failed) {\n"
|
||||
|
@ -423,10 +423,10 @@ std::vector<uint8_t> HlslShaderTranslator::CompleteTranslation() {
|
|||
" }\n"
|
||||
// Remap guest color outputs to host render targets because null render
|
||||
// target descriptors are broken.
|
||||
" xe_output.colors[0] = xe_color_output[xe_color_output_map.r];\n"
|
||||
" xe_output.colors[1] = xe_color_output[xe_color_output_map.g];\n"
|
||||
" xe_output.colors[2] = xe_color_output[xe_color_output_map.b];\n"
|
||||
" xe_output.colors[3] = xe_color_output[xe_color_output_map.a];\n");
|
||||
" xe_output.colors[0u] = xe_color_output[xe_color_output_map.r];\n"
|
||||
" xe_output.colors[1u] = xe_color_output[xe_color_output_map.g];\n"
|
||||
" xe_output.colors[2u] = xe_color_output[xe_color_output_map.b];\n"
|
||||
" xe_output.colors[3u] = xe_color_output[xe_color_output_map.a];\n");
|
||||
}
|
||||
// TODO(Triang3l): Gamma if needed.
|
||||
source.Append(
|
||||
|
|
Loading…
Reference in New Issue