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;
18 PrimitiveType primitiveType;
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 size_t renderPipelineHash(EffectHandle effect,
42 InputLayoutHandle inputLayoutHandle,
43 PrimitiveType primitiveType,
44 RasterizerStateHandle rasterizeStateHandle,
45 DepthStencilStateHandle depthStencilStateHandle,
46 BlendStateHandle blendStateHandle,
47 RenderTargetHandle renderTargetHandle,
48 DepthStencilHandle depthStencilHandle);
49 RenderPipelineHandle loadRenderPipeline(EffectHandle effect,
50 InputLayoutHandle inputLayoutHandle,
51 PrimitiveType primitiveType,
52 RasterizerStateHandle rasterizeStateHandle,
53 DepthStencilStateHandle depthStencilStateHandle,
54 BlendStateHandle blendStateHandle,
55 RenderTargetHandle renderTargetHandle,
56 DepthStencilHandle depthStencilHandle);
57 ComputePipelineHandle loadComputePipeline(EffectHandle effect);
58
59 virtual void releaseRenderPipeline(RenderPipelineHandle /*psoHandle*/) override {} // TODO
60 virtual void releaseComputePipeline(ComputePipelineHandle /*psoHandle*/) override {} // TODO
61 virtual void releaseResources() override {}
62
63 GraphicsDeviceWebGPU *graphics_device = nullptr;
64
65 std::unordered_map<size_t, RenderPipelineHandle> renderPipelineHashMap;
67
68 std::unordered_map<size_t, ComputePipelineHandle> computePipelineHashMap;
70 };
71}
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
PrimitiveType
Primitive types for interpreting vertex data sent to the graphics pipeline.
Definition: Common.h:112