summaryrefslogtreecommitdiff
path: root/src/effects/rotating_cube_effect.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/effects/rotating_cube_effect.cc')
-rw-r--r--src/effects/rotating_cube_effect.cc15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/effects/rotating_cube_effect.cc b/src/effects/rotating_cube_effect.cc
index 82f90c5..000d177 100644
--- a/src/effects/rotating_cube_effect.cc
+++ b/src/effects/rotating_cube_effect.cc
@@ -84,7 +84,7 @@ RotatingCube::RotatingCube(const GpuContext& ctx,
pipeline_desc.multisample.mask = 0xFFFFFFFF;
pipeline_desc.fragment = &fragment;
- pipeline_ = wgpuDeviceCreateRenderPipeline(ctx_.device, &pipeline_desc);
+ pipeline_.set(wgpuDeviceCreateRenderPipeline(ctx_.device, &pipeline_desc));
wgpuShaderModuleRelease(shader_module);
wgpuPipelineLayoutRelease(pipeline_layout);
@@ -103,17 +103,10 @@ RotatingCube::RotatingCube(const GpuContext& ctx,
.entryCount = 2,
.entries = entries,
};
- bind_group_ = wgpuDeviceCreateBindGroup(ctx_.device, &bg_desc);
+ bind_group_.set(wgpuDeviceCreateBindGroup(ctx_.device, &bg_desc));
wgpuBindGroupLayoutRelease(bgl);
}
-RotatingCube::~RotatingCube() {
- if (bind_group_)
- wgpuBindGroupRelease(bind_group_);
- if (pipeline_)
- wgpuRenderPipelineRelease(pipeline_);
-}
-
void RotatingCube::declare_nodes(NodeRegistry& registry) {
// Declare depth buffer node
registry.declare_node(depth_node_, NodeType::DEPTH24, -1, -1);
@@ -201,8 +194,8 @@ void RotatingCube::render(WGPUCommandEncoder encoder,
WGPURenderPassEncoder pass =
wgpuCommandEncoderBeginRenderPass(encoder, &pass_desc);
- wgpuRenderPassEncoderSetPipeline(pass, pipeline_);
- wgpuRenderPassEncoderSetBindGroup(pass, 0, bind_group_, 0, nullptr);
+ wgpuRenderPassEncoderSetPipeline(pass, pipeline_.get());
+ wgpuRenderPassEncoderSetBindGroup(pass, 0, bind_group_.get(), 0, nullptr);
wgpuRenderPassEncoderDraw(pass, 36, 1, 0, 0); // 36 vertices for cube
wgpuRenderPassEncoderEnd(pass);
wgpuRenderPassEncoderRelease(pass);