diff options
Diffstat (limited to 'src/gpu/effect.cc')
| -rw-r--r-- | src/gpu/effect.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/gpu/effect.cc b/src/gpu/effect.cc index 1257090..2e93a11 100644 --- a/src/gpu/effect.cc +++ b/src/gpu/effect.cc @@ -2,6 +2,7 @@ #include "gpu/effect.h" #include "gpu/gpu.h" +#include "gpu/sampler_cache.h" #include "gpu/sequence.h" #include "util/fatal_error.h" @@ -72,6 +73,30 @@ std::string Effect::find_downstream_output( return ""; } +void Effect::run_fullscreen_pass(WGPUCommandEncoder encoder, + WGPURenderPipeline pipeline, + WGPUBindGroup bind_group, + WGPUTextureView output_view, + WGPULoadOp load_op) { + HEADLESS_RETURN_IF_NULL(encoder); + + WGPURenderPassColorAttachment color_attachment = {}; + gpu_init_color_attachment(color_attachment, output_view); + color_attachment.loadOp = load_op; + + WGPURenderPassDescriptor pass_desc = {}; + pass_desc.colorAttachmentCount = 1; + pass_desc.colorAttachments = &color_attachment; + + WGPURenderPassEncoder pass = + wgpuCommandEncoderBeginRenderPass(encoder, &pass_desc); + wgpuRenderPassEncoderSetPipeline(pass, pipeline); + wgpuRenderPassEncoderSetBindGroup(pass, 0, bind_group, 0, nullptr); + wgpuRenderPassEncoderDraw(pass, 3, 1, 0, 0); + wgpuRenderPassEncoderEnd(pass); + wgpuRenderPassEncoderRelease(pass); +} + void Effect::create_linear_sampler() { sampler_.set(gpu_create_linear_sampler(ctx_.device)); } |
