Fix compute shader descriptor binding validation errors#17
Open
cdas wants to merge 1 commit into
Open
Conversation
Problem: The ocean wave simulation was failing at runtime with Vulkan descriptor binding validation errors. Both spectrum_compute (writeonly) and spectrum_modulate (readonly) shaders were sharing the same descriptor set binding with conflicting access patterns. Solution: 1. Format Consistency: Fixed shader format mismatch (rgba16f → rgba32f) 2. Descriptor Resolution: Created separate descriptor sets for writeonly and readonly access patterns while sharing the same texture resource 3. GPU Synchronization: Added compute barrier between write and read operations Technical Impact: - Resolves all compute shader validation errors - Maintains scientific accuracy of FFT-based ocean wave simulation - Preserves GPU performance and follows Vulkan best practices - Added comprehensive CLAUDE.md documentation The ocean simulation now runs correctly with proper GPU resource synchronization while maintaining sophisticated oceanographic modeling. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This was referenced Apr 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The ocean wave simulation was failing at runtime with critical Vulkan descriptor binding validation errors:
Root Cause: Both
spectrum_compute(writeonly) andspectrum_modulate(readonly) shaders were sharing the same descriptor set binding (set=0, binding=0) with conflicting access patterns, violating Vulkan's strict descriptor validation rules.Solution
Implemented a comprehensive three-phase fix addressing multiple validation issues:
🔧 Phase 1: Format Consistency
spectrum_compute.glslrgba16f→rgba32fDATA_FORMAT_R32G32B32A32_SFLOAT)restrictqualifier from readonly image inspectrum_modulate.glsl🔧 Phase 2: Descriptor Binding Resolution
spectrum_write_set: forspectrum_compute(writeonly access)spectrum_read_set: forspectrum_modulate(readonly access)🔧 Phase 3: Proper GPU Synchronization
compute_list_add_barrier()) between spectrum write and read operations📚 Additional Improvements
create_texture_descriptor()helper functionCLAUDE.mdfor future developmentTechnical Impact
✅ Resolves all compute shader validation errors
✅ Maintains scientific accuracy of FFT-based ocean wave simulation
✅ Preserves GPU performance characteristics
✅ Follows Vulkan/Godot best practices for descriptor management
✅ Enables proper debugging and development workflow
Test Results
Files Changed
assets/shaders/compute/spectrum_compute.glsl- Format consistency fixassets/shaders/compute/spectrum_modulate.glsl- Readonly image declaration fixassets/water/wave_generator.gd- Descriptor binding and synchronization fixesassets/render_context.gd- Helper function for texture descriptorsCLAUDE.md- Comprehensive project documentationScientific Preservation
The fix maintains the sophisticated oceanographic modeling:
The ocean simulation now runs correctly with proper GPU resource synchronization while preserving all the advanced oceanographic science that makes this implementation unique.