GPUComputePipeline.h [plain text]
#pragma once
#if ENABLE(WEBGPU)
#include "GPUPipeline.h"
#include "GPUProgrammableStageDescriptor.h"
#include "WHLSLPrepare.h"
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
#include <wtf/RetainPtr.h>
OBJC_PROTOCOL(MTLComputePipelineState);
namespace WebCore {
class GPUDevice;
class GPUErrorScopes;
class GPUPipelineLayout;
struct GPUComputePipelineDescriptor;
using PlatformComputePipeline = MTLComputePipelineState;
using PlatformComputePipelineSmartPtr = RetainPtr<MTLComputePipelineState>;
class GPUComputePipeline final : public GPUPipeline {
public:
virtual ~GPUComputePipeline();
static RefPtr<GPUComputePipeline> tryCreate(const GPUDevice&, const GPUComputePipelineDescriptor&, GPUErrorScopes&);
bool isComputePipeline() const { return true; }
bool recompile(const GPUDevice&, GPUProgrammableStageDescriptor&& computeStage);
const PlatformComputePipeline* platformComputePipeline() const { return m_platformComputePipeline.get(); }
WHLSL::ComputeDimensions computeDimensions() const { return m_computeDimensions; }
private:
GPUComputePipeline(PlatformComputePipelineSmartPtr&&, WHLSL::ComputeDimensions, const RefPtr<GPUPipelineLayout>&);
PlatformComputePipelineSmartPtr m_platformComputePipeline;
WHLSL::ComputeDimensions m_computeDimensions { 0, 0, 0 };
RefPtr<GPUPipelineLayout> m_layout;
};
}
SPECIALIZE_TYPE_TRAITS_GPUPIPELINE(WebCore::GPUComputePipeline, isComputePipeline())
#endif // ENABLE(WEBGPU)