[D3D12] Make RG16/RGBA16 RTVs range switchable

This commit is contained in:
Triang3l 2019-01-29 14:39:04 +03:00
parent cb99afffcb
commit 57e8f05234
3 changed files with 14 additions and 3 deletions

View File

@ -2319,9 +2319,10 @@ void D3D12CommandProcessor::UpdateSystemConstantValues(
// -32...32 range and expect shaders to give -32...32 values, but they're // -32...32 range and expect shaders to give -32...32 values, but they're
// emulated using normalized RG16/RGBA16 when not using the ROV, so the // emulated using normalized RG16/RGBA16 when not using the ROV, so the
// value returned from the shader needs to be divided by 32 (blending will // value returned from the shader needs to be divided by 32 (blending will
// be incorrect in this case, but there's no other way without using ROV). // be incorrect in this case, but there's no other way without using ROV,
// though there's an option to limit the range to -1...1).
// http://www.students.science.uu.nl/~3220516/advancedgraphics/papers/inferred_lighting.pdf // http://www.students.science.uu.nl/~3220516/advancedgraphics/papers/inferred_lighting.pdf
if (!IsROVUsedForEDRAM()) { if (!IsROVUsedForEDRAM() && FLAGS_d3d12_16bit_rtv_full_range) {
color_exp_bias -= 5; color_exp_bias -= 5;
} }
} }

View File

@ -25,6 +25,9 @@
#include "xenia/gpu/texture_util.h" #include "xenia/gpu/texture_util.h"
#include "xenia/ui/d3d12/d3d12_util.h" #include "xenia/ui/d3d12/d3d12_util.h"
DEFINE_bool(d3d12_16bit_rtv_full_range, true,
"Use full -32...32 range for RG16 and RGBA16 render targets "
"(at the expense of blending correctness) without ROV.");
DEFINE_bool(d3d12_resolution_scale_resolve_edge_clamp, true, DEFINE_bool(d3d12_resolution_scale_resolve_edge_clamp, true,
"When using resolution scale, apply the hack that duplicates the " "When using resolution scale, apply the hack that duplicates the "
"right/lower subpixel in the left and top sides of render target " "right/lower subpixel in the left and top sides of render target "
@ -1171,9 +1174,12 @@ bool RenderTargetCache::ResolveCopy(SharedMemory* shared_memory,
// sampling the host render target gives 1/32 of what is actually stored // sampling the host render target gives 1/32 of what is actually stored
// there on the guest side. // there on the guest side.
// http://www.students.science.uu.nl/~3220516/advancedgraphics/papers/inferred_lighting.pdf // http://www.students.science.uu.nl/~3220516/advancedgraphics/papers/inferred_lighting.pdf
if (command_processor_->IsROVUsedForEDRAM() ||
FLAGS_d3d12_16bit_rtv_full_range) {
dest_exp_bias += 5; dest_exp_bias += 5;
} }
} }
}
bool dest_swap = !is_depth && ((dest_info >> 24) & 0x1); bool dest_swap = !is_depth && ((dest_info >> 24) & 0x1);
// Get the destination location. // Get the destination location.

View File

@ -10,6 +10,8 @@
#ifndef XENIA_GPU_D3D12_RENDER_TARGET_CACHE_H_ #ifndef XENIA_GPU_D3D12_RENDER_TARGET_CACHE_H_
#define XENIA_GPU_D3D12_RENDER_TARGET_CACHE_H_ #define XENIA_GPU_D3D12_RENDER_TARGET_CACHE_H_
#include <gflags/gflags.h>
#include <unordered_map> #include <unordered_map>
#include "xenia/gpu/d3d12/d3d12_shader.h" #include "xenia/gpu/d3d12/d3d12_shader.h"
@ -20,6 +22,8 @@
#include "xenia/memory.h" #include "xenia/memory.h"
#include "xenia/ui/d3d12/d3d12_api.h" #include "xenia/ui/d3d12/d3d12_api.h"
DECLARE_bool(d3d12_16bit_rtv_full_range);
namespace xe { namespace xe {
namespace gpu { namespace gpu {
namespace d3d12 { namespace d3d12 {