diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-14 15:14:25 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-14 15:14:25 +0100 |
| commit | 8ce27b7e15f0fc65c8ee78950c7501660b936178 (patch) | |
| tree | 391f32111b9a30a0156709b6c1ed2fae7b435d57 /src/gpu/pipeline_builder.h | |
| parent | e38be0dbf5816338ff97e2ee2f9adfff2902dc2b (diff) | |
style: Apply clang-format to codebase
Diffstat (limited to 'src/gpu/pipeline_builder.h')
| -rw-r--r-- | src/gpu/pipeline_builder.h | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/gpu/pipeline_builder.h b/src/gpu/pipeline_builder.h index 68e34ea..87b9190 100644 --- a/src/gpu/pipeline_builder.h +++ b/src/gpu/pipeline_builder.h @@ -1,7 +1,7 @@ // WGPU render pipeline builder - reduces pipeline creation boilerplate #pragma once -#include <vector> #include <string> +#include <vector> // Forward declarations (users must include gpu.h and shader_composer.h) struct WGPUDeviceImpl; @@ -13,8 +13,8 @@ typedef struct WGPURenderPipelineImpl* WGPURenderPipeline; struct WGPUShaderModuleImpl; typedef struct WGPUShaderModuleImpl* WGPUShaderModule; -#include "platform/platform.h" #include "gpu/shader_composer.h" +#include "platform/platform.h" class RenderPipelineBuilder { WGPUDevice device_; @@ -28,7 +28,7 @@ class RenderPipelineBuilder { bool has_blend_ = false; bool has_depth_ = false; -public: + public: explicit RenderPipelineBuilder(WGPUDevice device) : device_(device) { desc_.primitive.topology = WGPUPrimitiveTopology_TriangleList; desc_.primitive.cullMode = WGPUCullMode_None; @@ -70,7 +70,8 @@ public: return *this; } - RenderPipelineBuilder& depth(WGPUTextureFormat depth_fmt = WGPUTextureFormat_Depth24Plus) { + RenderPipelineBuilder& + depth(WGPUTextureFormat depth_fmt = WGPUTextureFormat_Depth24Plus) { has_depth_ = true; depth_.format = depth_fmt; depth_.depthWriteEnabled = WGPUOptionalBool_True; @@ -85,7 +86,8 @@ public: WGPURenderPipeline build() { color_.writeMask = WGPUColorWriteMask_All; - if (has_blend_) color_.blend = &blend_; + if (has_blend_) + color_.blend = &blend_; WGPUFragmentState fragment{}; fragment.module = shader_module_; @@ -96,13 +98,16 @@ public: WGPUPipelineLayoutDescriptor pl_desc{}; pl_desc.bindGroupLayoutCount = layouts_.size(); pl_desc.bindGroupLayouts = layouts_.data(); - WGPUPipelineLayout layout = wgpuDeviceCreatePipelineLayout(device_, &pl_desc); + WGPUPipelineLayout layout = + wgpuDeviceCreatePipelineLayout(device_, &pl_desc); desc_.layout = layout; desc_.fragment = &fragment; - if (has_depth_) desc_.depthStencil = &depth_; + if (has_depth_) + desc_.depthStencil = &depth_; - WGPURenderPipeline pipeline = wgpuDeviceCreateRenderPipeline(device_, &desc_); + WGPURenderPipeline pipeline = + wgpuDeviceCreateRenderPipeline(device_, &desc_); wgpuPipelineLayoutRelease(layout); return pipeline; } |
