Skip to content

Commit

Permalink
Fix warning and add shaderTable concept
Browse files Browse the repository at this point in the history
  • Loading branch information
nyorain committed Dec 16, 2024
1 parent 3339a38 commit b6dbf25
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/commandHook/record.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ struct CommandHookRecord {
IntrusivePtr<CommandHookState> state {};
OwnBuffer dummyBuf {};

// For capturing shader table from ray tracing shaders with patched
// shaders, we need to create a hooked shaderTable.
OwnBuffer shaderTable {};

// AccelStruct-related stuff.
// We need to hook every CmdBuildAccelerationStructure, making sure
// we store the state the accelStruct is built with.
Expand Down
49 changes: 49 additions & 0 deletions src/data/shaderTable.comp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#version 460

#extension GL_GOOGLE_include_directive : require

layout(local_size_x = 64) in;

layout(buffer_reference, std430, buffer_reference_align = 16) buffer Src {
uint vals[];
};

layout(buffer_reference, std430, buffer_reference_align = 16) buffer Dst {
uint vals[];
};

layout(buffer_reference, std430, buffer_reference_align = 16) buffer Mappings {
uint vals[];
};

layout(push_constant) uniform PCR {
uint stride;
uint size;
uint count;
Src src;
Dst dst;
Mappings mappings;
} pcr;

void main() {
const uint id = gl_GlobalInvocationID.x;
if(id >= pcr.count) {
return;
}

uint currEntry = 0u;
uint offset = id * pcr.stride;
uint mappingStride = 2 * pcr.size;
for(uint i = 0u; i < pcr.size; ++i) {
uint src = pcr.src.vals[offset + i];
while(src != pcr.mappings.vals[currEntry * mappingStride + i]) {
++currEntry;
}
}

for(uint i = 0u; i < pcr.size; ++i) {
uint src = pcr.mappings.vals[pcr.size + currEntry * mappingStride + i];
pcr.dst.vals[offset + i] = src;
}
}

1 change: 1 addition & 0 deletions src/gui/shaderEmulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1514,6 +1514,7 @@ void ShaderEmulation::drawCallstackTab() {
*/

void ShaderEmulation::updatePosition(bool moveCursor) {
(void) moveCursor;
/*
if(!spvm_.state->current_file) {
dlg_warn("Can't jump to debugging state, current_file is null");
Expand Down

0 comments on commit b6dbf25

Please sign in to comment.