From 50359b03c9ff5f729a131ca04527beb735ecd8e7 Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 28 Apr 2020 15:51:53 +0100 Subject: [PATCH] Be more specific about the 'invalid' bindpoint we want to ignore --- renderdoc/driver/shaders/spirv/spirv_debug.cpp | 4 +++- renderdoc/driver/shaders/spirv/spirv_debug.h | 2 ++ renderdoc/driver/vulkan/vk_shaderdebug.cpp | 9 ++++----- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/renderdoc/driver/shaders/spirv/spirv_debug.cpp b/renderdoc/driver/shaders/spirv/spirv_debug.cpp index 35c1c2a15..39901224c 100644 --- a/renderdoc/driver/shaders/spirv/spirv_debug.cpp +++ b/renderdoc/driver/shaders/spirv/spirv_debug.cpp @@ -61,6 +61,8 @@ static bool ContainsNaNInf(const ShaderVariable &val) namespace rdcspv { +const BindpointIndex DebugAPIWrapper::invalidBind = BindpointIndex(-12345, -12345, ~0U); + ThreadState::ThreadState(uint32_t workgroupIdx, Debugger &debug, const GlobalState &globalState) : debugger(debug), global(globalState) { @@ -2187,7 +2189,7 @@ void ThreadState::StepNext(ShaderDebugState *state, const rdcarray result.type = resultType.scalar().Type(); - BindpointIndex samplerIndex = BindpointIndex(-1, -1, ~0U); + BindpointIndex samplerIndex = DebugAPIWrapper::invalidBind; if(sampler.type == VarType::Sampler || sampler.type == VarType::ReadOnlyResource) samplerIndex = sampler.GetBinding(); diff --git a/renderdoc/driver/shaders/spirv/spirv_debug.h b/renderdoc/driver/shaders/spirv/spirv_debug.h index b84e8c972..06c8158fe 100644 --- a/renderdoc/driver/shaders/spirv/spirv_debug.h +++ b/renderdoc/driver/shaders/spirv/spirv_debug.h @@ -76,6 +76,8 @@ public: Buffer_Texture = 0x10, }; + static const BindpointIndex invalidBind; + virtual bool CalculateSampleGather(ThreadState &lane, Op opcode, TextureType texType, BindpointIndex imageBind, BindpointIndex samplerBind, const ShaderVariable &uv, const ShaderVariable &ddxCalc, diff --git a/renderdoc/driver/vulkan/vk_shaderdebug.cpp b/renderdoc/driver/vulkan/vk_shaderdebug.cpp index 445413b91..c513433f6 100644 --- a/renderdoc/driver/vulkan/vk_shaderdebug.cpp +++ b/renderdoc/driver/vulkan/vk_shaderdebug.cpp @@ -506,15 +506,14 @@ public: const bool sintTex = (texType & DebugAPIWrapper::SInt_Texture) != 0; // fetch the right type of descriptor depending on if we're buffer or not - BindpointIndex invalidIndex(-1, -1, ~0U); bool valid = true; rdcstr access = StringFormat::Fmt("performing %s operation", ToStr(opcode).c_str()); const VkDescriptorImageInfo &imageInfo = - buffer ? GetDescriptor(access, invalidIndex, valid) + buffer ? GetDescriptor(access, invalidBind, valid) : GetDescriptor(access, imageBind, valid); const VkBufferView &bufferView = buffer ? GetDescriptor(access, imageBind, valid) - : GetDescriptor(access, invalidIndex, valid); + : GetDescriptor(access, invalidBind, valid); // fetch the sampler (if there's no sampler, this will silently return dummy data without // marking invalid @@ -1234,13 +1233,13 @@ private: { static T dummy = {}; - if(index.bindset < 0) + if(index == invalidBind) { // invalid index, return a dummy data but don't mark as invalid return dummy; } - if(index.bindset >= m_DescSets.count()) + if(index.bindset < 0 || index.bindset >= m_DescSets.count()) { m_pDriver->AddDebugMessage( MessageCategory::Execution, MessageSeverity::High, MessageSource::RuntimeWarning,