From d1bc1c68dcaa78cd26e7ac08af8f961afafa74e1 Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 20 Oct 2020 11:07:56 +0100 Subject: [PATCH] Increase warning level on SPIR-V debugging source files --- .../shaders/spirv/renderdoc_spirv.vcxproj | 21 +++++++++++++--- .../driver/shaders/spirv/spirv_debug.cpp | 24 +++++++++---------- .../shaders/spirv/spirv_debug_setup.cpp | 14 +++++------ 3 files changed, 36 insertions(+), 23 deletions(-) diff --git a/renderdoc/driver/shaders/spirv/renderdoc_spirv.vcxproj b/renderdoc/driver/shaders/spirv/renderdoc_spirv.vcxproj index 5049b3fa3..127c076e2 100644 --- a/renderdoc/driver/shaders/spirv/renderdoc_spirv.vcxproj +++ b/renderdoc/driver/shaders/spirv/renderdoc_spirv.vcxproj @@ -157,9 +157,24 @@ precompiled.h precompiled.h - - - + + Level4 + Use + precompiled.h + precompiled.h + + + Level4 + Use + precompiled.h + precompiled.h + + + Level4 + Use + precompiled.h + precompiled.h + Level4 Use diff --git a/renderdoc/driver/shaders/spirv/spirv_debug.cpp b/renderdoc/driver/shaders/spirv/spirv_debug.cpp index 28e3a8a17..ee7e0cda2 100644 --- a/renderdoc/driver/shaders/spirv/spirv_debug.cpp +++ b/renderdoc/driver/shaders/spirv/spirv_debug.cpp @@ -876,11 +876,11 @@ void ThreadState::StepNext(ShaderDebugState *state, const rdcarray for(size_t i = 0; i < construct.constituents.size(); i++) { ShaderVariable &mem = var.members[i]; - var.members[i] = GetSrc(construct.constituents[i]); + mem = GetSrc(construct.constituents[i]); if(!type.children[i].name.empty()) - var.members[i].name = type.children[i].name; + mem.name = type.children[i].name; else - var.members[i].name = StringFormat::Fmt("_child%zu", i); + mem.name = StringFormat::Fmt("_child%zu", i); } } else if(type.type == DataType::VectorType) @@ -888,8 +888,8 @@ void ThreadState::StepNext(ShaderDebugState *state, const rdcarray RDCASSERT(construct.constituents.size() <= 4); var.type = type.scalar().Type(); - var.rows = 1; - var.columns = RDCMAX(1U, type.vector().count); + var.rows = 1U; + var.columns = RDCMAX(1U, type.vector().count) & 0xff; // it is possible to construct larger vectors from a collection of scalars and smaller // vectors. @@ -913,8 +913,8 @@ void ThreadState::StepNext(ShaderDebugState *state, const rdcarray { // matrices are constructed from a list of columns var.type = type.scalar().Type(); - var.columns = RDCMAX(1U, type.matrix().count); - var.rows = RDCMAX(1U, type.vector().count); + var.columns = RDCMAX(1U, type.matrix().count) & 0xff; + var.rows = RDCMAX(1U, type.vector().count) & 0xff; RDCASSERTEQUAL(var.columns, construct.constituents.size()); @@ -949,7 +949,7 @@ void ThreadState::StepNext(ShaderDebugState *state, const rdcarray var.type = type.scalar().Type(); var.rows = 1; - var.columns = RDCMAX(1U, (uint32_t)shuffle.components.size()); + var.columns = RDCMAX(1U, (uint32_t)shuffle.components.size()) & 0xff; ShaderVariable src1 = GetSrc(shuffle.vector1); ShaderVariable src2 = GetSrc(shuffle.vector2); @@ -1200,7 +1200,7 @@ void ThreadState::StepNext(ShaderDebugState *state, const rdcarray } var.type = type.scalar().Type(); - var.columns = type.vector().count; + var.columns = type.vector().count & 0xff; var.value = ShaderValue(); byte *b = bytes.data(); @@ -2332,7 +2332,7 @@ void ThreadState::StepNext(ShaderDebugState *state, const rdcarray } result.rows = 1; - result.columns = RDCMAX(1U, resultType.vector().count); + result.columns = RDCMAX(1U, resultType.vector().count) & 0xff; SetDst(opdata.result, result); break; @@ -2409,7 +2409,7 @@ void ThreadState::StepNext(ShaderDebugState *state, const rdcarray } result.rows = 1; - result.columns = RDCMAX(1U, resultType.vector().count); + result.columns = RDCMAX(1U, resultType.vector().count) & 0xff; SetDst(read.result, result); break; @@ -2540,7 +2540,7 @@ void ThreadState::StepNext(ShaderDebugState *state, const rdcarray result.type = resultType.scalar().Type(); result.rows = 1; - result.columns = RDCMAX(1U, resultType.vector().count); + result.columns = RDCMAX(1U, resultType.vector().count) & 0xff; result.value.u64v[0] = global.clock; diff --git a/renderdoc/driver/shaders/spirv/spirv_debug_setup.cpp b/renderdoc/driver/shaders/spirv/spirv_debug_setup.cpp index 0b279e035..5115a1caf 100644 --- a/renderdoc/driver/shaders/spirv/spirv_debug_setup.cpp +++ b/renderdoc/driver/shaders/spirv/spirv_debug_setup.cpp @@ -1542,7 +1542,7 @@ ShaderVariable Debugger::ReadFromPointer(const ShaderVariable &ptr) const uint32_t scalar0 = (uint32_t)ptr.value.u64v[Scalar0VariableSlot]; uint32_t scalar1 = (uint32_t)ptr.value.u64v[Scalar1VariableSlot]; - ShaderValue val; + ShaderValue val = {}; if(ret.rows > 1) { @@ -1637,8 +1637,6 @@ void Debugger::WriteThroughPointer(const ShaderVariable &ptr, const ShaderVariab rdcspv::Id::fromWord(uint32_t(ptr.value.u64v[BufferPointerTypeIdVariableSlot])); uint64_t byteOffset = ptr.value.u64v[BufferPointerByteOffsetVariableSlot]; - const DataType &type = dataTypes[typeId]; - BindpointIndex bind = storage->GetBinding(); bind.arrayIndex = (uint32_t)ptr.value.u64v[ArrayVariableSlot]; @@ -1974,10 +1972,10 @@ uint32_t Debugger::WalkVariable( if(outVar) { outVar->type = type.scalar().Type(); - outVar->rows = 1; - outVar->columns = RDCMAX(1U, type.vector().count); + outVar->rows = 1U; + outVar->columns = RDCMAX(1U, type.vector().count) & 0xff; } - numLocations = 1; + numLocations = 1U; break; } case DataType::MatrixType: @@ -1985,8 +1983,8 @@ uint32_t Debugger::WalkVariable( if(outVar) { outVar->type = type.scalar().Type(); - outVar->columns = RDCMAX(1U, type.matrix().count); - outVar->rows = RDCMAX(1U, type.vector().count); + outVar->columns = RDCMAX(1U, type.matrix().count) & 0xff; + outVar->rows = RDCMAX(1U, type.vector().count) & 0xff; } numLocations = var.rows; break;