summaryrefslogtreecommitdiff
path: root/src/gpu/texture_manager.h
diff options
context:
space:
mode:
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_;
};