From 5e5130666009a1ae56fd87f164efca9be2608add Mon Sep 17 00:00:00 2001 From: Triang3l Date: Wed, 14 Nov 2018 16:45:31 +0300 Subject: [PATCH] [D3D12] Integer texture comment and UpdateSystemConstantValues cleanup --- src/xenia/gpu/d3d12/d3d12_command_processor.cc | 8 +++----- src/xenia/gpu/d3d12/texture_cache.h | 10 +++++++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/xenia/gpu/d3d12/d3d12_command_processor.cc b/src/xenia/gpu/d3d12/d3d12_command_processor.cc index 21ab704fd..f097df267 100644 --- a/src/xenia/gpu/d3d12/d3d12_command_processor.cc +++ b/src/xenia/gpu/d3d12/d3d12_command_processor.cc @@ -1629,6 +1629,7 @@ void D3D12CommandProcessor::UpdateSystemConstantValues( uint32_t rb_surface_info = regs[XE_GPU_REG_RB_SURFACE_INFO].u32; uint32_t rb_colorcontrol = regs[XE_GPU_REG_RB_COLORCONTROL].u32; uint32_t rb_alpha_ref = regs[XE_GPU_REG_RB_ALPHA_REF].u32; + uint32_t rb_color_mask = regs[XE_GPU_REG_RB_COLOR_MASK].u32; bool dirty = false; @@ -1860,9 +1861,7 @@ void D3D12CommandProcessor::UpdateSystemConstantValues( system_constants_.alpha_test = alpha_test; // Color exponent bias and output index mapping or ROV writing. - uint32_t rb_color_mask = regs[XE_GPU_REG_RB_COLOR_MASK].u32; - bool colorcontrol_blend_enable = - (regs[XE_GPU_REG_RB_COLORCONTROL].u32 & 0x20) == 0; + bool colorcontrol_blend_enable = (rb_colorcontrol & 0x20) == 0; for (uint32_t i = 0; i < 4; ++i) { uint32_t color_info, blend_control; switch (i) { @@ -1965,8 +1964,7 @@ void D3D12CommandProcessor::UpdateSystemConstantValues( // Depth/stencil testing and blend constant for ROV blending. if (IsROVUsedForEDRAM()) { - uint32_t depth_base_dwords = - (regs[XE_GPU_REG_RB_DEPTH_INFO].u32 & 0xFFF) * 1280; + uint32_t depth_base_dwords = (rb_depth_info & 0xFFF) * 1280; dirty |= system_constants_.edram_depth_base_dwords != depth_base_dwords; system_constants_.edram_depth_base_dwords = depth_base_dwords; diff --git a/src/xenia/gpu/d3d12/texture_cache.h b/src/xenia/gpu/d3d12/texture_cache.h index 3bc1341ac..c9571a0a1 100644 --- a/src/xenia/gpu/d3d12/texture_cache.h +++ b/src/xenia/gpu/d3d12/texture_cache.h @@ -215,7 +215,11 @@ class TextureCache { // created if both unsigned and signed are used. LoadMode load_mode_snorm; - // TODO(Triang3l): Integer formats. + // Do NOT add integer DXGI formats to this - they are not filterable, can + // only be read with Load, not Sample! If any game is seen using num_format + // 1 for fixed-point formats (for floating-point, it's normally set to 1 + // though), add a constant buffer containing multipliers for the + // textures and multiplication to the tfetch implementation. // Uncompression info for when the regular host format for this texture is // block-compressed, but the size is not block-aligned, and thus such @@ -393,8 +397,8 @@ class TextureCache { }; // Whether the signed version of the texture has a different representation on - // the host than its unsigned version (for example, if it's a normalized or an - // integer texture emulated with a larger host pixel format). + // the host than its unsigned version (for example, if it's a fixed-point + // texture emulated with a larger host pixel format). static inline bool IsSignedVersionSeparate(TextureFormat format) { const HostFormat& host_format = host_formats_[uint32_t(format)]; return host_format.load_mode_snorm != LoadMode::kUnknown &&