24#ifndef PXR_IMAGING_HD_ST_EXT_COMP_GPU_COMPUTATION_RESOURCE_H
25#define PXR_IMAGING_HD_ST_EXT_COMP_GPU_COMPUTATION_RESOURCE_H
28#include "pxr/imaging/hdSt/api.h"
29#include "pxr/imaging/hd/bufferSource.h"
30#include "pxr/imaging/hdSt/resourceBinder.h"
31#include "pxr/imaging/hdSt/extCompComputeShader.h"
32#include "pxr/imaging/hdSt/resourceRegistry.h"
36PXR_NAMESPACE_OPEN_SCOPE
38using HdStExtCompGpuComputationResourceSharedPtr =
39 std::shared_ptr<class HdStExtCompGpuComputationResource>;
40using HdStGLSLProgramSharedPtr= std::shared_ptr<class HdStGLSLProgram>;
41using HdBufferArrayRangeSharedPtrVector =
42 std::vector<HdBufferArrayRangeSharedPtr>;
74 HdBufferSpecVector
const &outputBufferSpecs,
75 HdSt_ExtCompComputeShaderSharedPtr
const &kernel,
76 HdBufferArrayRangeSharedPtrVector
const &inputs,
77 HdStResourceRegistrySharedPtr
const ®istry
84 HdBufferArrayRangeSharedPtrVector
const &
GetInputs()
const {
93 if (!_computeProgram) {
96 return _computeProgram;
103 if (!_computeProgram) {
106 return _resourceBinder;
115 HdBufferSpecVector _outputBufferSpecs;
116 HdSt_ExtCompComputeShaderSharedPtr _kernel;
117 HdStResourceRegistrySharedPtr _registry;
119 size_t _shaderSourceHash;
120 HdBufferArrayRangeSharedPtrVector _inputs;
121 HdStGLSLProgramSharedPtr _computeProgram;
122 HdSt_ResourceBinder _resourceBinder;
131PXR_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.