7#ifndef PXR_IMAGING_HD_ST_EXT_COMP_GPU_COMPUTATION_RESOURCE_H
8#define PXR_IMAGING_HD_ST_EXT_COMP_GPU_COMPUTATION_RESOURCE_H
11#include "pxr/imaging/hdSt/api.h"
12#include "pxr/imaging/hd/bufferSource.h"
13#include "pxr/imaging/hdSt/resourceBinder.h"
14#include "pxr/imaging/hdSt/extCompComputeShader.h"
15#include "pxr/imaging/hdSt/resourceRegistry.h"
19PXR_NAMESPACE_OPEN_SCOPE
21using HdStExtCompGpuComputationResourceSharedPtr =
22 std::shared_ptr<class HdStExtCompGpuComputationResource>;
23using HdStGLSLProgramSharedPtr= std::shared_ptr<class HdStGLSLProgram>;
24using HdBufferArrayRangeSharedPtrVector =
25 std::vector<HdBufferArrayRangeSharedPtr>;
57 HdBufferSpecVector
const &outputBufferSpecs,
58 HdSt_ExtCompComputeShaderSharedPtr
const &kernel,
59 HdBufferArrayRangeSharedPtrVector
const &inputs,
60 HdStResourceRegistrySharedPtr
const ®istry
67 HdBufferArrayRangeSharedPtrVector
const &
GetInputs()
const {
76 if (!_computeProgram) {
79 return _computeProgram;
86 if (!_computeProgram) {
89 return _resourceBinder;
98 HdBufferSpecVector _outputBufferSpecs;
99 HdSt_ExtCompComputeShaderSharedPtr _kernel;
100 HdStResourceRegistrySharedPtr _registry;
102 size_t _shaderSourceHash;
103 HdBufferArrayRangeSharedPtrVector _inputs;
104 HdStGLSLProgramSharedPtr _computeProgram;
105 HdSt_ResourceBinder _resourceBinder;
114PXR_NAMESPACE_CLOSE_SCOPE
A resource that represents the persistent GPU resources of an ExtComputation.
HdStGLSLProgramSharedPtr const & GetProgram()
Gets the GPU HdStGLSLProgram to run to execute the computation.
HdStExtCompGpuComputationResource(HdBufferSpecVector const &outputBufferSpecs, HdSt_ExtCompComputeShaderSharedPtr const &kernel, HdBufferArrayRangeSharedPtrVector const &inputs, HdStResourceRegistrySharedPtr const ®istry)
Creates a GPU computation resource that can bind resources matching the layout of the compute kernel.
HdBufferArrayRangeSharedPtrVector const & GetInputs() const
Gets the HdBufferArrayRange that inputs should be loaded into using the resource binder.
HdSt_ResourceBinder const & GetResourceBinder()
Gets the resource binder that matches the layout of the compute program.