Loading...
Searching...
No Matches
computeCmds.h
1//
2// Copyright 2020 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_IMAGING_HGI_GL_COMPUTE_CMDS_H
8#define PXR_IMAGING_HGI_GL_COMPUTE_CMDS_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hgi/computeCmds.h"
12#include "pxr/imaging/hgi/computePipeline.h"
13#include "pxr/imaging/hgiGL/api.h"
14#include "pxr/imaging/hgiGL/hgi.h"
15#include <cstdint>
16
17PXR_NAMESPACE_OPEN_SCOPE
18
20
25class HgiGLComputeCmds final : public HgiComputeCmds
26{
27public:
28 HGIGL_API
29 ~HgiGLComputeCmds() override;
30
31 HGIGL_API
32 void PushDebugGroup(const char* label) override;
33
34 HGIGL_API
35 void PopDebugGroup() override;
36
37 HGIGL_API
38 void BindPipeline(HgiComputePipelineHandle pipeline) override;
39
40 HGIGL_API
41 void BindResources(HgiResourceBindingsHandle resources) override;
42
43 HGIGL_API
46 uint32_t bindIndex,
47 uint32_t byteSize,
48 const void* data) override;
49
50 HGIGL_API
51 void Dispatch(int dimX, int dimY) override;
52
53 HGIGL_API
54 void InsertMemoryBarrier(HgiMemoryBarrier barrier) override;
55
56 HGIGL_API
57 HgiComputeDispatch GetDispatchMethod() const override;
58
59protected:
60 friend class HgiGL;
61
62 HGIGL_API
64
65 HGIGL_API
66 bool _Submit(Hgi* hgi, HgiSubmitWaitType wait) override;
67
68private:
69 HgiGLComputeCmds() = delete;
70 HgiGLComputeCmds & operator=(const HgiGLComputeCmds&) = delete;
71 HgiGLComputeCmds(const HgiGLComputeCmds&) = delete;
72
73 HgiGLOpsVector _ops;
74 int _pushStack;
75 GfVec3i _localWorkGroupSize;
76
77 // Cmds is used only one frame so storing multi-frame state on will not
78 // survive.
79};
80
81PXR_NAMESPACE_CLOSE_SCOPE
82
83#endif
Basic type for a vector of 3 int components.
Definition: vec3i.h:44
A graphics API independent abstraction of compute commands.
Definition: computeCmds.h:29
OpenGL implementation of HgiComputeCmds.
Definition: computeCmds.h:26
HGIGL_API void InsertMemoryBarrier(HgiMemoryBarrier barrier) override
Inserts a barrier so that data written to memory by commands before the barrier is available to comma...
HGIGL_API void Dispatch(int dimX, int dimY) override
Execute a compute shader with provided thread group count in each dimension.
HGIGL_API HgiComputeDispatch GetDispatchMethod() const override
Returns the dispatch method for this encoder.
HGIGL_API void BindResources(HgiResourceBindingsHandle resources) override
Bind resources such as textures and uniform buffers.
HGIGL_API void BindPipeline(HgiComputePipelineHandle pipeline) override
Bind a pipeline state object.
HGIGL_API void PopDebugGroup() override
Pop the last debug marker.
HGIGL_API void SetConstantValues(HgiComputePipelineHandle pipeline, uint32_t bindIndex, uint32_t byteSize, const void *data) override
Set Push / Function constants.
HGIGL_API void PushDebugGroup(const char *label) override
Push a debug marker.
OpenGL implementation of GPU device.
Definition: device.h:29
OpenGL implementation of the Hydra Graphics Interface.
Definition: hgi.h:55
Handle that contains a hgi object and unique id.
Definition: handle.h:33
Hydra Graphics Interface.
Definition: hgi.h:95
Describes the properties to construct a HgiComputeCmds.