[D3D12] Always write original shader source in DXBC if PIX is attached
This commit is contained in:
parent
8ec813de82
commit
d18e63e6e2
|
@ -72,7 +72,8 @@ PipelineCache::PipelineCache(D3D12CommandProcessor* command_processor,
|
|||
auto provider = command_processor_->GetD3D12Context()->GetD3D12Provider();
|
||||
|
||||
shader_translator_ = std::make_unique<DxbcShaderTranslator>(
|
||||
provider->GetAdapterVendorID(), edram_rov_used_);
|
||||
provider->GetAdapterVendorID(), edram_rov_used_,
|
||||
provider->GetGraphicsAnalysis() != nullptr);
|
||||
|
||||
if (edram_rov_used_) {
|
||||
depth_only_pixel_shader_ =
|
||||
|
|
|
@ -81,8 +81,10 @@ constexpr uint32_t DxbcShaderTranslator::kCbufferIndexUnallocated;
|
|||
constexpr uint32_t DxbcShaderTranslator::kCfExecBoolConstantNone;
|
||||
|
||||
DxbcShaderTranslator::DxbcShaderTranslator(uint32_t vendor_id,
|
||||
bool edram_rov_used)
|
||||
bool edram_rov_used,
|
||||
bool force_emit_source_map)
|
||||
: vendor_id_(vendor_id), edram_rov_used_(edram_rov_used) {
|
||||
emit_source_map_ = force_emit_source_map || cvars::dxbc_source_map;
|
||||
// Don't allocate again and again for the first shader.
|
||||
shader_code_.reserve(8192);
|
||||
shader_object_.reserve(16384);
|
||||
|
@ -1963,7 +1965,7 @@ std::vector<uint8_t> DxbcShaderTranslator::CompleteTranslation() {
|
|||
}
|
||||
|
||||
void DxbcShaderTranslator::EmitInstructionDisassembly() {
|
||||
if (!cvars::dxbc_source_map) {
|
||||
if (!emit_source_map_) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2955,7 +2957,7 @@ void DxbcShaderTranslator::ProcessLabel(uint32_t cf_index) {
|
|||
|
||||
void DxbcShaderTranslator::ProcessExecInstructionBegin(
|
||||
const ParsedExecInstruction& instr) {
|
||||
if (cvars::dxbc_source_map) {
|
||||
if (emit_source_map_) {
|
||||
instruction_disassembly_buffer_.Reset();
|
||||
instr.Disassemble(&instruction_disassembly_buffer_);
|
||||
// Will be emitted by UpdateExecConditionals.
|
||||
|
@ -3006,7 +3008,7 @@ void DxbcShaderTranslator::ProcessLoopStartInstruction(
|
|||
// Loop control is outside execs - actually close the last exec.
|
||||
CloseExecConditionals();
|
||||
|
||||
if (cvars::dxbc_source_map) {
|
||||
if (emit_source_map_) {
|
||||
instruction_disassembly_buffer_.Reset();
|
||||
instr.Disassemble(&instruction_disassembly_buffer_);
|
||||
EmitInstructionDisassembly();
|
||||
|
@ -3118,7 +3120,7 @@ void DxbcShaderTranslator::ProcessLoopEndInstruction(
|
|||
// Loop control is outside execs - actually close the last exec.
|
||||
CloseExecConditionals();
|
||||
|
||||
if (cvars::dxbc_source_map) {
|
||||
if (emit_source_map_) {
|
||||
instruction_disassembly_buffer_.Reset();
|
||||
instr.Disassemble(&instruction_disassembly_buffer_);
|
||||
EmitInstructionDisassembly();
|
||||
|
@ -3276,7 +3278,7 @@ void DxbcShaderTranslator::ProcessLoopEndInstruction(
|
|||
|
||||
void DxbcShaderTranslator::ProcessJumpInstruction(
|
||||
const ParsedJumpInstruction& instr) {
|
||||
if (cvars::dxbc_source_map) {
|
||||
if (emit_source_map_) {
|
||||
instruction_disassembly_buffer_.Reset();
|
||||
instr.Disassemble(&instruction_disassembly_buffer_);
|
||||
// Will be emitted by UpdateExecConditionals.
|
||||
|
@ -3305,7 +3307,7 @@ void DxbcShaderTranslator::ProcessJumpInstruction(
|
|||
|
||||
void DxbcShaderTranslator::ProcessAllocInstruction(
|
||||
const ParsedAllocInstruction& instr) {
|
||||
if (cvars::dxbc_source_map) {
|
||||
if (emit_source_map_) {
|
||||
instruction_disassembly_buffer_.Reset();
|
||||
instr.Disassemble(&instruction_disassembly_buffer_);
|
||||
EmitInstructionDisassembly();
|
||||
|
|
|
@ -55,7 +55,8 @@ namespace gpu {
|
|||
// 0 for NaN.
|
||||
class DxbcShaderTranslator : public ShaderTranslator {
|
||||
public:
|
||||
DxbcShaderTranslator(uint32_t vendor_id, bool edram_rov_used);
|
||||
DxbcShaderTranslator(uint32_t vendor_id, bool edram_rov_used,
|
||||
bool force_emit_source_map = false);
|
||||
~DxbcShaderTranslator() override;
|
||||
|
||||
// Constant buffer bindings in space 0.
|
||||
|
@ -1874,6 +1875,10 @@ class DxbcShaderTranslator : public ShaderTranslator {
|
|||
// Buffer for instruction disassembly comments.
|
||||
StringBuffer instruction_disassembly_buffer_;
|
||||
|
||||
// Whether to write comments with the original Xenos instructions to the
|
||||
// output.
|
||||
bool emit_source_map_;
|
||||
|
||||
// Vendor ID of the GPU manufacturer, for toggling unsupported features.
|
||||
uint32_t vendor_id_;
|
||||
|
||||
|
|
|
@ -2425,7 +2425,7 @@ void DxbcShaderTranslator::ProcessAluInstruction(
|
|||
return;
|
||||
}
|
||||
|
||||
if (cvars::dxbc_source_map) {
|
||||
if (emit_source_map_) {
|
||||
instruction_disassembly_buffer_.Reset();
|
||||
instr.Disassemble(&instruction_disassembly_buffer_);
|
||||
// Will be emitted by UpdateInstructionPredication.
|
||||
|
|
|
@ -322,7 +322,7 @@ void DxbcShaderTranslator::ProcessVertexFetchInstruction(
|
|||
}
|
||||
uint32_t result_write_mask = (1 << result_component_count) - 1;
|
||||
|
||||
if (cvars::dxbc_source_map) {
|
||||
if (emit_source_map_) {
|
||||
instruction_disassembly_buffer_.Reset();
|
||||
instr.Disassemble(&instruction_disassembly_buffer_);
|
||||
// Will be emitted by UpdateInstructionPredication.
|
||||
|
@ -1162,7 +1162,7 @@ void DxbcShaderTranslator::ArrayCoordToCubeDirection(uint32_t reg) {
|
|||
|
||||
void DxbcShaderTranslator::ProcessTextureFetchInstruction(
|
||||
const ParsedTextureFetchInstruction& instr) {
|
||||
if (cvars::dxbc_source_map) {
|
||||
if (emit_source_map_) {
|
||||
instruction_disassembly_buffer_.Reset();
|
||||
instr.Disassemble(&instruction_disassembly_buffer_);
|
||||
// Will be emitted later explicitly or by UpdateInstructionPredication.
|
||||
|
|
Loading…
Reference in New Issue