diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-16 15:15:40 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-16 15:15:40 +0100 |
| commit | 42de5c4e5aeb486b4afb5b73bcb6a9d5ba567cbd (patch) | |
| tree | db7febab2d795343cb7b9925b47d78ea911da303 /src/gpu/headless_gpu.cc | |
| parent | ce2f70d30094cad87606f480a317328d60595bdc (diff) | |
fix(headless): add nullptr checks for GPU resource creation
- NodeRegistry::create_texture: skip texture creation when device is nullptr
- Post-process helpers: skip pipeline/bind group creation in headless mode
- SamplerCache: return nullptr for headless mode
- BindGroupLayoutBuilder/BindGroupBuilder: skip creation with null device
- RenderPipelineBuilder: skip shader module and pipeline creation in headless
- PlaceholderEffect: skip sampler creation in headless mode
- RotatingCubeEffect: early return in constructor for headless mode
WIP: Some effects (GaussianBlur, etc.) still need headless checks
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'src/gpu/headless_gpu.cc')
| -rw-r--r-- | src/gpu/headless_gpu.cc | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/gpu/headless_gpu.cc b/src/gpu/headless_gpu.cc index c4de577..e6995b2 100644 --- a/src/gpu/headless_gpu.cc +++ b/src/gpu/headless_gpu.cc @@ -78,6 +78,57 @@ WGPUSurface gpu_get_surface() { return nullptr; } +TextureWithView gpu_create_texture_2d(WGPUDevice device, uint32_t width, + uint32_t height, WGPUTextureFormat format, + WGPUTextureUsage usage, + uint32_t mip_levels) { + (void)device; + (void)width; + (void)height; + (void)format; + (void)usage; + (void)mip_levels; + return {nullptr, nullptr}; +} + +TextureWithView gpu_create_storage_texture_2d(WGPUDevice device, uint32_t width, + uint32_t height, + WGPUTextureFormat format) { + (void)device; + (void)width; + (void)height; + (void)format; + return {nullptr, nullptr}; +} + +TextureWithView gpu_create_post_process_texture(WGPUDevice device, + uint32_t width, uint32_t height, + WGPUTextureFormat format) { + (void)device; + (void)width; + (void)height; + (void)format; + return {nullptr, nullptr}; +} + +WGPUTextureView gpu_create_mip_view(WGPUTexture texture, + WGPUTextureFormat format, + uint32_t mip_level) { + (void)texture; + (void)format; + (void)mip_level; + return nullptr; +} + +WGPUTextureView gpu_create_texture_view_2d(WGPUTexture texture, + WGPUTextureFormat format, + uint32_t mip_levels) { + (void)texture; + (void)format; + (void)mip_levels; + return nullptr; +} + #if !defined(STRIP_ALL) void gpu_simulate_until(float time, float bpm) { (void)time; |
