summaryrefslogtreecommitdiff
path: root/src/gpu/effect.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/effect.cc')
-rw-r--r--src/gpu/effect.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/gpu/effect.cc b/src/gpu/effect.cc
index 752dd84..cd4bc16 100644
--- a/src/gpu/effect.cc
+++ b/src/gpu/effect.cc
@@ -14,6 +14,7 @@ Effect::Effect(const GpuContext& ctx, const std::vector<std::string>& inputs,
FATAL_CHECK(!outputs.empty(), "Effect must have at least one output\n");
FATAL_CHECK(start_time <= end_time, "Invalid time range: %f > %f\n",
start_time, end_time);
+ HEADLESS_RETURN_IF_NULL(ctx_.device);
}
void Effect::dispatch_render(WGPUCommandEncoder encoder,
@@ -55,3 +56,21 @@ void Effect::blit_input_to_output(WGPUCommandEncoder encoder,
wgpuCommandEncoderCopyTextureToTexture(encoder, &src_copy, &dst_copy,
&extent);
}
+
+void Effect::init_uniforms_buffer() {
+ uniforms_buffer_.init(ctx_.device);
+}
+
+void Effect::create_linear_sampler() {
+ sampler_ = gpu_create_linear_sampler(ctx_.device);
+}
+
+void Effect::create_nearest_sampler() {
+ sampler_ = gpu_create_nearest_sampler(ctx_.device);
+}
+
+void Effect::create_dummy_scene_texture() {
+ TextureWithView dummy = gpu_create_dummy_scene_texture(ctx_.device);
+ dummy_texture_ = dummy.texture;
+ dummy_texture_view_ = dummy.view;
+}