Skip to content

Commit

Permalink
Add names for own shaders; Fix frustum pipeline error
Browse files Browse the repository at this point in the history
  • Loading branch information
nyorain committed Jun 16, 2023
1 parent cf367a5 commit b33a96a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/data/frustum.vert
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ layout(push_constant, row_major) uniform PCR {
// NOTE: offset = 76 already used by fragment shader.
} pcr;

layout(location = 0) out vec3 outPos;

void main() {
// Buffer-free cube line list generation. Needs 24 vertices in draw call
int mask = (1 << gl_VertexIndex);
Expand All @@ -24,5 +26,6 @@ void main() {
y *= z;
}

outPos = vec3(x, y, z);
gl_Position = pcr.viewProjMtx * vec4(x, y, z, 1.0);
}
2 changes: 1 addition & 1 deletion src/gui/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1532,7 +1532,7 @@ void CommandViewer::displayCommand() {
dlg_assertm(vertex, "TODO Graphics pipeline without vertex shader");
if(vertex) {
if(ImGui::Button("Debug vertex shader")) {
if(dcmd->state.pipe) {
if(dcmd->state->pipe) {
auto mod = copySpecializeSpirv(*vertex);
shaderDebugger_.select(vertex->stage, std::move(mod));
view_ = IOView::shader;
Expand Down
21 changes: 17 additions & 4 deletions src/gui/pipes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,23 @@ void initPipes(Device& dev,
VkPipelineLayout histogramPipeLayout,
Gui::Pipelines& dstPipes, bool manualSRGB) {
std::vector<vku::ShaderModule> modules;
auto createShaderMod = [&](span<const u32> spv) {
return modules.emplace_back(dev, spv).vkHandle();
auto createShaderModNamed = [&](span<const u32> spv, const char* name) {
auto ret = modules.emplace_back(dev, spv).vkHandle();
if(dev.dispatch.SetDebugUtilsObjectNameEXT) {
VkDebugUtilsObjectNameInfoEXT ni {};
ni.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
ni.pObjectName = name;
ni.objectHandle = handleToU64(ret);
ni.objectType = VK_OBJECT_TYPE_SHADER_MODULE;
dev.dispatch.SetDebugUtilsObjectNameEXT(dev.handle,
&ni);
}
return ret;
};

#define createShaderMod(spv) createShaderModNamed(spv, "vil:" #spv)
#define initStages(spv) initStagesNamed(spv, "vil:" #spv)

auto vertModule = createShaderMod(gui_vert_spv_data);

VkSpecializationMapEntry manualSRGBEntry {};
Expand All @@ -82,8 +95,8 @@ void initPipes(Device& dev,
srgbSpec.mapEntryCount = 1u;
srgbSpec.pMapEntries = &manualSRGBEntry;

auto initStages = [&](span<const u32> fragSpv) {
VkShaderModule fragModule = createShaderMod(fragSpv);
auto initStagesNamed = [&](span<const u32> fragSpv, const char* name) {
VkShaderModule fragModule = createShaderModNamed(fragSpv, name);

std::array<VkPipelineShaderStageCreateInfo, 2> ret {};
ret[0].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
Expand Down

0 comments on commit b33a96a

Please sign in to comment.