From 5f0df6d1fa5704d44ce23961b8ba0c0a85cc7d97 Mon Sep 17 00:00:00 2001 From: Triang3l Date: Sun, 16 Sep 2018 15:57:22 +0300 Subject: [PATCH] [D3D12] Pipeline debug name, DXBC norm16 vertex fix --- src/xenia/gpu/d3d12/pipeline_cache.cc | 15 ++++++++++++++- src/xenia/gpu/dxbc_shader_translator.cc | 8 ++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/xenia/gpu/d3d12/pipeline_cache.cc b/src/xenia/gpu/d3d12/pipeline_cache.cc index e136fd250..d62ede59d 100644 --- a/src/xenia/gpu/d3d12/pipeline_cache.cc +++ b/src/xenia/gpu/d3d12/pipeline_cache.cc @@ -19,6 +19,7 @@ #include "xenia/base/assert.h" #include "xenia/base/logging.h" #include "xenia/base/profiling.h" +#include "xenia/base/string.h" #include "xenia/gpu/d3d12/d3d12_command_processor.h" #include "xenia/gpu/gpu_flags.h" @@ -692,7 +693,19 @@ PipelineCache::Pipeline* PipelineCache::GetPipeline(uint64_t hash_key) { XELOGE("Failed to create graphics pipeline state"); return nullptr; } - // TODO(Triang3l): Set the name for the pipeline, with shader hashes. + + std::wstring name; + if (update_shader_stages_regs_.pixel_shader != nullptr) { + name = xe::format_string( + L"VS %.16I64X, PS %.16I64X, PL %.16I64X", + update_shader_stages_regs_.vertex_shader->ucode_data_hash(), + update_shader_stages_regs_.pixel_shader->ucode_data_hash(), hash_key); + } else { + name = xe::format_string( + L"VS %.16I64X, PL %.16I64X", + update_shader_stages_regs_.vertex_shader->ucode_data_hash(), hash_key); + } + state->SetName(name.c_str()); // Add to cache with the hash key for reuse. Pipeline* pipeline = new Pipeline; diff --git a/src/xenia/gpu/dxbc_shader_translator.cc b/src/xenia/gpu/dxbc_shader_translator.cc index f8efd984c..e81383668 100644 --- a/src/xenia/gpu/dxbc_shader_translator.cc +++ b/src/xenia/gpu/dxbc_shader_translator.cc @@ -3017,8 +3017,9 @@ void DxbcShaderTranslator::ProcessVertexFetchInstruction( extract_widths[3] = 16; extract_offsets[1] = extract_offsets[3] = 16; extract_swizzle = 0b01010000; - normalize_scales[0] = normalize_scales[1] = - instr.attributes.is_signed ? (1.0f / 32767.0f) : (1.0f / 65535.0f); + normalize_scales[0] = normalize_scales[1] = normalize_scales[2] = + normalize_scales[3] = instr.attributes.is_signed ? (1.0f / 32767.0f) + : (1.0f / 65535.0f); break; case VertexFormat::k_16_16_FLOAT: extract_signed = false; @@ -3041,6 +3042,9 @@ void DxbcShaderTranslator::ProcessVertexFetchInstruction( instr.attributes.is_signed ? (1.0f / 2147483647.0f) : (1.0f / 4294967295.0f); break; + default: + // 32-bit float. + break; } // Extract components from packed data if needed.