Files
FlaxEngine/Source/Engine/GraphicsDevice/WebGPU/GPUShaderWebGPU.h
2026-02-26 12:23:07 +01:00

45 lines
1.1 KiB
C++

// Copyright (c) Wojciech Figat. All rights reserved.
#pragma once
#if GRAPHICS_API_WEBGPU
#include "Engine/Graphics/Shaders/GPUShader.h"
#include "Engine/Graphics/Shaders/GPUConstantBuffer.h"
#include "GPUDeviceWebGPU.h"
/// <summary>
/// Constant Buffer for Web GPU backend.
/// </summary>
class GPUConstantBufferWebGPU : public GPUResourceWebGPU<GPUConstantBuffer>
{
public:
GPUConstantBufferWebGPU(GPUDeviceWebGPU* device, uint32 size, const StringView& name) noexcept;
public:
GPUDataUploaderWebGPU::Allocation Allocation;
uint32 AllocationSize;
};
/// <summary>
/// Shader for Web GPU backend.
/// </summary>
class GPUShaderWebGPU : public GPUResourceWebGPU<GPUShader>
{
private:
Array<GPUConstantBufferWebGPU, FixedAllocation<GPU_MAX_CB_BINDED>> _cbs;
public:
GPUShaderWebGPU(GPUDeviceWebGPU* device, const StringView& name)
: GPUResourceWebGPU(device, name)
{
}
protected:
// [GPUShader]
GPUShaderProgram* CreateGPUShaderProgram(ShaderStage type, const GPUShaderProgramInitializer& initializer, Span<byte> bytecode, MemoryReadStream& stream) override;
void OnReleaseGPU() override;
};
#endif