All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ops.h
1 //
2 // Copyright 2020 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef PXR_IMAGING_HGIGL_OPS_H
25 #define PXR_IMAGING_HGIGL_OPS_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/base/gf/vec4i.h"
29 
30 #include "pxr/imaging/hgi/buffer.h"
31 #include "pxr/imaging/hgi/blitCmdsOps.h"
32 #include "pxr/imaging/hgi/graphicsCmdsDesc.h"
33 #include "pxr/imaging/hgi/graphicsPipeline.h"
34 #include "pxr/imaging/hgi/resourceBindings.h"
35 
36 #include "pxr/imaging/hgiGL/api.h"
37 #include "pxr/imaging/hgiGL/device.h"
38 
39 #include <cstdint>
40 #include <functional>
41 #include <vector>
42 
43 PXR_NAMESPACE_OPEN_SCOPE
44 
45 using HgiGLOpsFn = std::function<void(void)>;
46 
70 class HgiGLOps
71 {
72 public:
73  HGIGL_API
74  static HgiGLOpsFn PushDebugGroup(const char* label);
75 
76  HGIGL_API
77  static HgiGLOpsFn PopDebugGroup();
78 
79  HGIGL_API
80  static HgiGLOpsFn CopyTextureGpuToCpu(HgiTextureGpuToCpuOp const& copyOp);
81 
82  HGIGL_API
83  static HgiGLOpsFn CopyTextureCpuToGpu(HgiTextureCpuToGpuOp const& copyOp);
84 
85  HGIGL_API
86  static HgiGLOpsFn CopyBufferGpuToGpu(HgiBufferGpuToGpuOp const& copyOp);
87 
88  HGIGL_API
89  static HgiGLOpsFn CopyBufferCpuToGpu(HgiBufferCpuToGpuOp const& copyOp);
90 
91  HGIGL_API
92  static HgiGLOpsFn CopyBufferGpuToCpu(HgiBufferGpuToCpuOp const& copyOp);
93 
94  HGIGL_API
95  static HgiGLOpsFn CopyTextureToBuffer(HgiTextureToBufferOp const& copyOp);
96 
97  HGIGL_API
98  static HgiGLOpsFn CopyBufferToTexture(HgiBufferToTextureOp const& copyOp);
99 
100  HGIGL_API
101  static HgiGLOpsFn ResolveFramebuffer(
102  HgiGLDevice* device,
103  HgiGraphicsCmdsDesc const &graphicsCmds);
104 
105  HGIGL_API
106  static HgiGLOpsFn SetViewport(GfVec4i const& vp);
107 
108  HGIGL_API
109  static HgiGLOpsFn SetScissor(GfVec4i const& sc);
110 
111  HGIGL_API
112  static HgiGLOpsFn BindPipeline(HgiGraphicsPipelineHandle pipeline);
113 
114  HGIGL_API
115  static HgiGLOpsFn BindPipeline(HgiComputePipelineHandle pipeline);
116 
117  HGIGL_API
118  static HgiGLOpsFn BindResources(HgiResourceBindingsHandle resources);
119 
120  HGIGL_API
121  static HgiGLOpsFn SetConstantValues(
122  HgiGraphicsPipelineHandle pipeline,
123  HgiShaderStage stages,
124  uint32_t bindIndex,
125  uint32_t byteSize,
126  const void* data);
127 
128  HGIGL_API
129  static HgiGLOpsFn SetConstantValues(
130  HgiComputePipelineHandle pipeline,
131  uint32_t bindIndex,
132  uint32_t byteSize,
133  const void* data);
134 
135  HGIGL_API
136  static HgiGLOpsFn BindVertexBuffers(
137  uint32_t firstBinding,
138  HgiBufferHandleVector const& buffers,
139  std::vector<uint32_t> const& byteOffsets);
140 
141  HGIGL_API
142  static HgiGLOpsFn Draw(
143  HgiPrimitiveType primitiveType,
144  uint32_t vertexCount,
145  uint32_t firstVertex,
146  uint32_t instanceCount);
147 
148  HGIGL_API
149  static HgiGLOpsFn DrawIndirect(
150  HgiPrimitiveType primitiveType,
151  HgiBufferHandle const& drawParameterBuffer,
152  uint32_t drawBufferOffset,
153  uint32_t drawCount,
154  uint32_t stride);
155 
156  HGIGL_API
157  static HgiGLOpsFn DrawIndexed(
158  HgiPrimitiveType primitiveType,
159  HgiBufferHandle const& indexBuffer,
160  uint32_t indexCount,
161  uint32_t indexBufferByteOffset,
162  uint32_t vertexOffset,
163  uint32_t instanceCount);
164 
165  HGIGL_API
166  static HgiGLOpsFn DrawIndexedIndirect(
167  HgiPrimitiveType primitiveType,
168  HgiBufferHandle const& indexBuffer,
169  HgiBufferHandle const& drawParameterBuffer,
170  uint32_t drawBufferOffset,
171  uint32_t drawCount,
172  uint32_t stride);
173 
174  HGIGL_API
175  static HgiGLOpsFn BindFramebufferOp(
176  HgiGLDevice* device,
177  HgiGraphicsCmdsDesc const& desc);
178 
179  HGIGL_API
180  static HgiGLOpsFn Dispatch(int dimX, int dimY);
181 
182  HGIGL_API
183  static HgiGLOpsFn GenerateMipMaps(HgiTextureHandle const& texture);
184 
185  HGIGL_API
186  static HgiGLOpsFn MemoryBarrier(HgiMemoryBarrier barrier);
187 
188 };
189 
190 PXR_NAMESPACE_CLOSE_SCOPE
191 
192 #endif
Basic type for a vector of 4 int components.
Definition: vec4i.h:61
Describes the properties needed to copy buffer data from CPU to GPU.
Definition: blitCmdsOps.h:190
Describes the properties needed to copy GPU buffer data into a GPU texture.
Definition: blitCmdsOps.h:314
Describes the properties needed to copy texture data from GPU to CPU.
Definition: blitCmdsOps.h:67
Describes the properties to begin a HgiGraphicsCmds.
Describes the properties needed to copy buffer data from GPU to CPU.
Definition: blitCmdsOps.h:230
Describes the properties needed to copy texture data from CPU to GPU.
Definition: blitCmdsOps.h:110
Describes the properties needed to copy buffer data from GPU to GPU.
Definition: blitCmdsOps.h:150
Describes the properties needed to copy GPU texture data into a GPU buffer.
Definition: blitCmdsOps.h:270
A collection of functions used by cmds objects to do deferred cmd recording.
Definition: ops.h:70