Skip to content

Commit cb59615

Browse files
committed
Fix code alignment and remove trailing whitespace
Aligns variable declarations and inline comments to improve code readability. Removes trailing whitespace from empty lines. Human: [Commits history] Update: Support more than one joint in .arm files Also adds names to the joints based on the Blender names. Add support for loading .arm files from Blender/Armory for GPU skinning # Conflicts: # framework/rendering/subpasses/forward_subpass.cpp # framework/scene_graph/components/sub_mesh.cpp Fix compute shader derivatives sample descriptor set update timing Moves descriptor set writes to prepare() to ensure resources are updated before first use, addressing potential rendering issues from accessing uninitialized descriptors. Enhance compute shader derivatives sample with practical visualization Extends the compute shader derivatives sample to demonstrate a practical use case: gradient-based edge detection on a procedural radial pattern. Adds a two-stage rendering pipeline where a compute shader calculates spatial derivatives and gradient magnitude, writing to a storage image, then a graphics pipeline displays the result using a fullscreen triangle technique. Includes comprehensive documentation explaining derivative computation, rendering architecture, and the fullscreen triangle optimization. Requires shader storage image read/write features and shader draw parameters extension. Revert "add shader quad control sample demonstrating VK_KHR_shader_quad_control features." This reverts commit d9524ac. add shader quad control sample demonstrating VK_KHR_shader_quad_control features. Add compute shader derivatives sample for Vulkan extension Introduce a sample demonstrating the `VK_KHR_compute_shader_derivatives` extension. Includes new shader, CMake, and Vulkan application files showcasing the use of derivative instructions in compute shaders with quad-based derivative groups. bash might not work with nmake let's try nmake try to diagnose what's happening. try to diagnose what's happening. astc can't find sys/time.h when using sccache. [Message] [Diff] --- a/samples/extensions/compute_shader_derivatives/compute_shader_derivatives.cpp +++ b/samples/extensions/compute_shader_derivatives/compute_shader_derivatives.cpp @@ -175,9 +175,9 @@ // Require quads derivative group (the sample shader uses layout(derivative_group_quadsNV/derivative_group_quads_khr)) REQUEST_REQUIRED_FEATURE(gpu, VkPhysicalDeviceComputeShaderDerivativesFeaturesKHR, computeDerivativeGroupQuads); // Users may switch to the linear mode by changing the shader qualifier - + // Storage image read/write without format (required for storage images without explicit format qualifiers) - gpu.get_mutable_requested_features().shaderStorageImageReadWithoutFormat = VK_TRUE; + gpu.get_mutable_requested_features().shaderStorageImageReadWithoutFormat = VK_TRUE; gpu.get_mutable_requested_features().shaderStorageImageWriteWithoutFormat = VK_TRUE; } @@ -335,7 +335,7 @@ color_blend_ci.pAttachments = &blend_attachment; // Dynamic state - VkDynamicState dynamic_states[] = {VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR}; + VkDynamicState dynamic_states[] = {VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR}; VkPipelineDynamicStateCreateInfo dynamic_ci{VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO}; dynamic_ci.dynamicStateCount = 2; dynamic_ci.pDynamicStates = dynamic_states; @@ -435,7 +435,7 @@ // Begin render pass to display the computed image and GUI VkClearValue clear_values[2]; - clear_values[0].color = {{0.0f, 0.0f, 0.0f, 1.0f}}; // Clear to black (will be covered by image) + clear_values[0].color = {{0.0f, 0.0f, 0.0f, 1.0f}}; // Clear to black (will be covered by image) clear_values[1].depthStencil = {1.0f, 0}; VkRenderPassBeginInfo render_pass_begin_info = vkb::initializers::render_pass_begin_info(); @@ -464,7 +464,7 @@ // Render the computed image as a fullscreen quad vkCmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, graphics_pipeline); vkCmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, graphics_pipeline_layout, 0, 1, &graphics_descriptor_set, 0, nullptr); - vkCmdDraw(cmd, 3, 1, 0, 0); // Draw fullscreen triangle (3 vertices) + vkCmdDraw(cmd, 3, 1, 0, 0); // Draw fullscreen triangle (3 vertices) // Draw the GUI overlay on top draw_ui(cmd); @@ -501,7 +501,7 @@ drawer.text("- Red/Yellow: Edges (high gradient magnitude)"); drawer.text("- Gradient magnitude = sqrt(dx^2 + dy^2)"); drawer.text(""); - + drawer.text("This demonstrates edge detection using compute shader"); drawer.text("derivatives, useful for LOD selection, filtering, and"); drawer.text("spatial analysis in compute pipelines.");
1 parent 164d342 commit cb59615

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

samples/extensions/compute_shader_derivatives/compute_shader_derivatives.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,9 @@ void ComputeShaderDerivatives::request_gpu_features(vkb::core::PhysicalDeviceC &
175175
// Require quads derivative group (the sample shader uses layout(derivative_group_quadsNV/derivative_group_quads_khr))
176176
REQUEST_REQUIRED_FEATURE(gpu, VkPhysicalDeviceComputeShaderDerivativesFeaturesKHR, computeDerivativeGroupQuads);
177177
// Users may switch to the linear mode by changing the shader qualifier
178-
178+
179179
// Storage image read/write without format (required for storage images without explicit format qualifiers)
180-
gpu.get_mutable_requested_features().shaderStorageImageReadWithoutFormat = VK_TRUE;
180+
gpu.get_mutable_requested_features().shaderStorageImageReadWithoutFormat = VK_TRUE;
181181
gpu.get_mutable_requested_features().shaderStorageImageWriteWithoutFormat = VK_TRUE;
182182
}
183183

@@ -335,7 +335,7 @@ void ComputeShaderDerivatives::create_graphics_pipeline()
335335
color_blend_ci.pAttachments = &blend_attachment;
336336

337337
// Dynamic state
338-
VkDynamicState dynamic_states[] = {VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR};
338+
VkDynamicState dynamic_states[] = {VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR};
339339
VkPipelineDynamicStateCreateInfo dynamic_ci{VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO};
340340
dynamic_ci.dynamicStateCount = 2;
341341
dynamic_ci.pDynamicStates = dynamic_states;
@@ -435,7 +435,7 @@ void ComputeShaderDerivatives::render(float delta_time)
435435

436436
// Begin render pass to display the computed image and GUI
437437
VkClearValue clear_values[2];
438-
clear_values[0].color = {{0.0f, 0.0f, 0.0f, 1.0f}}; // Clear to black (will be covered by image)
438+
clear_values[0].color = {{0.0f, 0.0f, 0.0f, 1.0f}}; // Clear to black (will be covered by image)
439439
clear_values[1].depthStencil = {1.0f, 0};
440440

441441
VkRenderPassBeginInfo render_pass_begin_info = vkb::initializers::render_pass_begin_info();
@@ -464,7 +464,7 @@ void ComputeShaderDerivatives::render(float delta_time)
464464
// Render the computed image as a fullscreen quad
465465
vkCmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, graphics_pipeline);
466466
vkCmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, graphics_pipeline_layout, 0, 1, &graphics_descriptor_set, 0, nullptr);
467-
vkCmdDraw(cmd, 3, 1, 0, 0); // Draw fullscreen triangle (3 vertices)
467+
vkCmdDraw(cmd, 3, 1, 0, 0); // Draw fullscreen triangle (3 vertices)
468468

469469
// Draw the GUI overlay on top
470470
draw_ui(cmd);
@@ -501,7 +501,7 @@ void ComputeShaderDerivatives::on_update_ui_overlay(vkb::Drawer &drawer)
501501
drawer.text("- Red/Yellow: Edges (high gradient magnitude)");
502502
drawer.text("- Gradient magnitude = sqrt(dx^2 + dy^2)");
503503
drawer.text("");
504-
504+
505505
drawer.text("This demonstrates edge detection using compute shader");
506506
drawer.text("derivatives, useful for LOD selection, filtering, and");
507507
drawer.text("spatial analysis in compute pipelines.");

0 commit comments

Comments
 (0)