Skip to content

Commit

Permalink
Fix reading of position-relative subpass inputs. Closes #2247
Browse files Browse the repository at this point in the history
  • Loading branch information
baldurk committed Apr 16, 2021
1 parent cf487e2 commit 8591d85
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions renderdoc/driver/shaders/spirv/spirv_debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2715,12 +2715,12 @@ void ThreadState::StepNext(ShaderDebugState *state, const rdcarray<ThreadState>
if(texType & DebugAPIWrapper::Subpass_Texture)
{
// get current position
ShaderVariable curCoord;
ShaderVariable curCoord(rdcstr(), 0.0f, 0.0f, 0.0f, 0.0f);
debugger.GetAPIWrapper()->FillInputValue(curCoord, ShaderBuiltin::Position, 0, 0);

// co-ords are relative to the current position
setUintComp(coord, 0, uintComp(coord, 0) + uintComp(curCoord, 0));
setUintComp(coord, 1, uintComp(coord, 1) + uintComp(curCoord, 1));
setUintComp(coord, 0, uintComp(coord, 0) + (uint32_t)floatComp(curCoord, 0));
setUintComp(coord, 1, uintComp(coord, 1) + (uint32_t)floatComp(curCoord, 1));

// do it with samplegather as ImageFetch rather than a Read which caches the whole texture
// on the CPU for no reason (since we can't write to it)
Expand Down
3 changes: 2 additions & 1 deletion renderdoc/driver/vulkan/vk_shaderdebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3964,7 +3964,8 @@ ShaderDebugTrace *VulkanReplay::DebugPixel(uint32_t eventId, uint32_t x, uint32_
std::map<ShaderBuiltin, ShaderVariable> &builtins = apiWrapper->builtin_inputs;
builtins[ShaderBuiltin::DeviceIndex] = ShaderVariable(rdcstr(), 0U, 0U, 0U, 0U);
builtins[ShaderBuiltin::DrawIndex] = ShaderVariable(rdcstr(), draw->drawIndex, 0U, 0U, 0U);
builtins[ShaderBuiltin::Position] = ShaderVariable(rdcstr(), x, y, 0U, 0U);
builtins[ShaderBuiltin::Position] =
ShaderVariable(rdcstr(), float(x) + 0.5f, float(y) + 0.5f, 0.0f, 0.0f);

// If the pipe contains a geometry shader, then Primitive ID cannot be used in the pixel
// shader without being emitted from the geometry shader. For now, check if this semantic
Expand Down

0 comments on commit 8591d85

Please sign in to comment.