summaryrefslogtreecommitdiff
path: root/src/gpu/texture_manager.h
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-09 14:08:52 +0100
committerskal <pascal.massimino@gmail.com>2026-02-09 14:08:52 +0100
commit8398b3de477c45098ade454fe1eeff79a755a1fb (patch)
treefed9674aab680629d94bcae9ea4b28831bc8f41d /src/gpu/texture_manager.h
parentdd41b296f9299ce1269005452d5db8d2854ac61b (diff)
refactor: Unify TextureManager compute pipeline management
Replace individual pipeline pointers with map-based system. - Changed from 3 pointers to std::map<string, ComputePipelineInfo> - Unified get_or_create_compute_pipeline() for lazy init - Unified dispatch_compute() for all shaders - Simplified create_gpu_*_texture() methods (~390 lines removed) handoff(Claude): GPU procedural texture refactoring complete
Diffstat (limited to 'src/gpu/texture_manager.h')
-rw-r--r--src/gpu/texture_manager.h23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/gpu/texture_manager.h b/src/gpu/texture_manager.h
index b2dea84..63c2947 100644
--- a/src/gpu/texture_manager.h
+++ b/src/gpu/texture_manager.h
@@ -61,16 +61,21 @@ class TextureManager {
WGPUTextureView get_texture_view(const std::string& name);
private:
- void dispatch_noise_compute(WGPUTexture target,
- const GpuProceduralParams& params);
- void dispatch_perlin_compute(WGPUTexture target,
- const GpuProceduralParams& params);
- void dispatch_grid_compute(WGPUTexture target,
- const GpuProceduralParams& params);
+ struct ComputePipelineInfo {
+ WGPUComputePipeline pipeline;
+ const char* shader_code;
+ size_t uniform_size;
+ };
+
+ WGPUComputePipeline get_or_create_compute_pipeline(const std::string& func_name,
+ const char* shader_code,
+ size_t uniform_size);
+ void dispatch_compute(const std::string& func_name, WGPUTexture target,
+ const GpuProceduralParams& params, const void* uniform_data,
+ size_t uniform_size);
+
WGPUDevice device_;
WGPUQueue queue_;
std::map<std::string, GpuTexture> textures_;
- WGPUComputePipeline noise_compute_pipeline_ = nullptr;
- WGPUComputePipeline perlin_compute_pipeline_ = nullptr;
- WGPUComputePipeline grid_compute_pipeline_ = nullptr;
+ std::map<std::string, ComputePipelineInfo> compute_pipelines_;
};