KhronosGroup / KhronosGroup/Vulkan-ValidationLayers

Remove SetCode() copy in shader instrumentation

Open
#9,242 0 comments 0 reactions 0 assignees View on GitHub
Enhancement
Dominant language
C++
Stars
1k
Forks
504
Avg merge
11h 35m
Merged PRs (30d)
224

Description

We have this code

```c++
// TODO - This makes a copy, but could save on Chassis stack instead (then remove function from VUL).
// The core issue is we always use std::vector but Safe Struct manages its own version of the pCode
// memory. It would be much harder to change everything from std::vector and instead to adjust Safe Struct to not
// double-free the memory on us. If making any changes, we have to consider a case where the user inlines the
// fragment shader, but use a normal VkShaderModule in the vertex shader.
modified_shader_module_ci->SetCode(instrumented_spirv);
```

What is needed is a way in VUL to allow the safe struct to let us manage the memory

Contributor guide

Open the contributing guide

Research direction

Start by tracing the shader instrumentation code around modified_shader_module_ci->SetCode(instrumented_spirv), then inspect the VUL safe-struct ownership of pCode and the mixed inline-fragment and normal-vertex shader case described in the issue. Done means VUL can let the safe struct use caller-managed memory without the SetCode copy or a double-free.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics, devtools
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.