summaryrefslogtreecommitdiff
path: root/src/gpu/texture_manager.h
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-09 14:28:46 +0100
committerskal <pascal.massimino@gmail.com>2026-02-09 14:28:46 +0100
commit9bb5fd64776ac8a7e4b012ac2de340ddfa09a2c9 (patch)
tree79b99e6196ca70df8ddf3b9b0809ea5770ee0280 /src/gpu/texture_manager.h
parent8d6f14793a1edc34644297e2b24248c00bbff3be (diff)
feat: GPU procedural Phase 4 - texture composition
Multi-input composite shaders with sampler support. - Dynamic bind group layouts (N input textures + 1 sampler) - dispatch_composite() for multi-input compute dispatch - create_gpu_composite_texture() API - gen_blend.wgsl and gen_mask.wgsl shaders Guarded with #if !defined(STRIP_GPU_COMPOSITE) for easy removal. Tests: - Blend two noise textures - Mask noise with grid - Multi-stage composite (composite of composites) Size: ~830 bytes (2 shaders + dispatch logic) handoff(Claude): GPU procedural Phase 4 complete
Diffstat (limited to 'src/gpu/texture_manager.h')
-rw-r--r--src/gpu/texture_manager.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/gpu/texture_manager.h b/src/gpu/texture_manager.h
index 63c2947..86d1f63 100644
--- a/src/gpu/texture_manager.h
+++ b/src/gpu/texture_manager.h
@@ -51,6 +51,17 @@ class TextureManager {
void create_gpu_grid_texture(const std::string& name,
const GpuProceduralParams& params);
+#if !defined(STRIP_GPU_COMPOSITE)
+ // GPU composite generation (multi-input textures)
+ void create_gpu_composite_texture(const std::string& name,
+ const std::string& shader_func,
+ const char* shader_code,
+ const void* uniform_data,
+ size_t uniform_size,
+ int width, int height,
+ const std::vector<std::string>& input_names);
+#endif
+
#if !defined(STRIP_ALL)
// On-demand lazy generation (stripped in final builds)
WGPUTextureView get_or_generate_gpu_texture(const std::string& name,
@@ -65,17 +76,29 @@ class TextureManager {
WGPUComputePipeline pipeline;
const char* shader_code;
size_t uniform_size;
+ int num_input_textures;
};
WGPUComputePipeline get_or_create_compute_pipeline(const std::string& func_name,
const char* shader_code,
- size_t uniform_size);
+ size_t uniform_size,
+ int num_input_textures = 0);
void dispatch_compute(const std::string& func_name, WGPUTexture target,
const GpuProceduralParams& params, const void* uniform_data,
size_t uniform_size);
+#if !defined(STRIP_GPU_COMPOSITE)
+ void dispatch_composite(const std::string& func_name, WGPUTexture target,
+ const GpuProceduralParams& params,
+ const void* uniform_data, size_t uniform_size,
+ const std::vector<WGPUTextureView>& input_views);
+#endif
+
WGPUDevice device_;
WGPUQueue queue_;
std::map<std::string, GpuTexture> textures_;
std::map<std::string, ComputePipelineInfo> compute_pipelines_;
+#if !defined(STRIP_GPU_COMPOSITE)
+ WGPUSampler linear_sampler_;
+#endif
};