Cogs.Core
PipelineStatesWebGPU.h
1#pragma once
2
3#include "CommonWebGPU.h"
4
5#include "../Base/ResourceMap.h"
6#include "../IPipelineStates.h"
7
8#include <unordered_map>
9
10namespace Cogs {
11 class GraphicsDeviceWebGPU;
12
14 {
15 size_t hash;
16 EffectHandle effect;
17 InputLayoutHandle inputLayoutHandle;
19 RasterizerStateHandle rasterizeStateHandle;
20 DepthStencilStateHandle depthStencilStateHandle;
21 BlendStateHandle blendStateHandle;
22 RenderTargetHandle renderTargetHandle;
23 DepthStencilHandle depthStencilHandle;
24
25 WGPURenderPipeline pipeline;
26 WGPUBindGroupLayout layout;
27 };
29 {
30 size_t hash;
31 EffectHandle effect;
32
33 WGPUComputePipeline pipeline;
34 WGPUBindGroupLayout layout;
35 };
36
38
39 void initialize(GraphicsDeviceWebGPU *device);
40
41 RenderPipelineHandle loadRenderPipeline(EffectHandle effect,
42 InputLayoutHandle inputLayoutHandle,
44 RasterizerStateHandle rasterizeStateHandle,
45 DepthStencilStateHandle depthStencilStateHandle,
46 BlendStateHandle blendStateHandle,
47 RenderTargetHandle renderTargetHandle,
48 DepthStencilHandle depthStencilHandle);
49 ComputePipelineHandle loadComputePipeline(EffectHandle effect);
50
51 virtual void releaseRenderPipeline(RenderPipelineHandle /*psoHandle*/) override {} // TODO
52 virtual void releaseComputePipeline(ComputePipelineHandle /*psoHandle*/) override {} // TODO
53 virtual void releaseResources() override {}
54
55 GraphicsDeviceWebGPU *graphics_device = nullptr;
56
57 std::unordered_map<size_t, RenderPipelineHandle> renderPipelineHashMap;
59
60 std::unordered_map<size_t, ComputePipelineHandle> computePipelineHashMap;
62 };
63}
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
EPrimitiveType
Primitive type enumeration.
Definition: Common.h:114