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,
33 const GfVec4f& color = s_computeDebugColor) override;
34
35 HGIGL_API
36 void PopDebugGroup() override;
37
38 HGIGL_API
40 const char* label,
41 const GfVec4f& color = s_markerDebugColor) override;
42
43 HGIGL_API
44 void BindPipeline(HgiComputePipelineHandle pipeline) override;
45
46 HGIGL_API
47 void BindResources(HgiResourceBindingsHandle resources) override;
48
49 HGIGL_API
52 uint32_t bindIndex,
53 uint32_t byteSize,
54 const void* data) override;
55
56 HGIGL_API
57 void Dispatch(int dimX, int dimY) override;
58
59 HGIGL_API
60 void InsertMemoryBarrier(HgiMemoryBarrier barrier) override;
61
62 HGIGL_API
63 HgiComputeDispatch GetDispatchMethod() const override;
64
65protected:
66 friend class HgiGL;
67
68 HGIGL_API
70
71 HGIGL_API
72 bool _Submit(Hgi* hgi, HgiSubmitWaitType wait) override;
73
74private:
75 HgiGLComputeCmds() = delete;
76 HgiGLComputeCmds & operator=(const HgiGLComputeCmds&) = delete;
77 HgiGLComputeCmds(const HgiGLComputeCmds&) = delete;
78
79 HgiGLOpsVector _ops;
80 int _pushStack;
81 GfVec3i _localWorkGroupSize;
82
83 // Cmds is used only one frame so storing multi-frame state on will not
84 // survive.
85};
86
87PXR_NAMESPACE_CLOSE_SCOPE
88
89#endif
Basic type for a vector of 3 int components.
Definition: vec3i.h:44
Basic type for a vector of 4 float components.
Definition: vec4f.h:46
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 InsertDebugMarker(const char *label, const GfVec4f &color=s_markerDebugColor) override
Insert a debug marker.
HGIGL_API void PushDebugGroup(const char *label, const GfVec4f &color=s_computeDebugColor) override
Push a debug scope.
HGIGL_API void BindPipeline(HgiComputePipelineHandle pipeline) override
Bind a pipeline state object.
HGIGL_API void PopDebugGroup() override
Pop the last debug scope.
HGIGL_API void SetConstantValues(HgiComputePipelineHandle pipeline, uint32_t bindIndex, uint32_t byteSize, const void *data) override
Set Push / Function constants.
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.