summaryrefslogtreecommitdiff
path: root/src/gpu/sampler_cache.h
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-16 15:15:40 +0100
committerskal <pascal.massimino@gmail.com>2026-02-16 15:15:40 +0100
commit42de5c4e5aeb486b4afb5b73bcb6a9d5ba567cbd (patch)
treedb7febab2d795343cb7b9925b47d78ea911da303 /src/gpu/sampler_cache.h
parentce2f70d30094cad87606f480a317328d60595bdc (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/sampler_cache.h')
-rw-r--r--src/gpu/sampler_cache.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gpu/sampler_cache.h b/src/gpu/sampler_cache.h
index 7149921..b3fdb19 100644
--- a/src/gpu/sampler_cache.h
+++ b/src/gpu/sampler_cache.h
@@ -39,6 +39,11 @@ class SamplerCache {
}
WGPUSampler get_or_create(WGPUDevice device, const SamplerSpec& spec) {
+ // Headless mode: skip sampler creation
+ if (device == nullptr) {
+ return nullptr;
+ }
+
auto it = cache_.find(spec);
if (it != cache_.end())
return it->second;