2012-12-13 18:22:30 +00:00
|
|
|
//
|
2013-09-26 19:04:57 +00:00
|
|
|
// Copyright 2013 Pixar
|
2012-12-13 18:22:30 +00:00
|
|
|
//
|
2013-09-26 19:04:57 +00:00
|
|
|
// Licensed under the Apache License, Version 2.0 (the "Apache License")
|
|
|
|
// with the following modification; you may not use this file except in
|
|
|
|
// compliance with the Apache License and the following modification to it:
|
|
|
|
// Section 6. Trademarks. is deleted and replaced with:
|
2012-12-13 18:22:30 +00:00
|
|
|
//
|
2013-09-26 19:04:57 +00:00
|
|
|
// 6. Trademarks. This License does not grant permission to use the trade
|
|
|
|
// names, trademarks, service marks, or product names of the Licensor
|
|
|
|
// and its affiliates, except as required to comply with Section 4(c) of
|
|
|
|
// the License and to reproduce the content of the NOTICE file.
|
2012-12-13 18:22:30 +00:00
|
|
|
//
|
2013-09-26 19:04:57 +00:00
|
|
|
// You may obtain a copy of the Apache License at
|
2012-12-13 18:22:30 +00:00
|
|
|
//
|
2013-09-26 19:04:57 +00:00
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
2013-07-18 21:19:50 +00:00
|
|
|
//
|
2013-09-26 19:04:57 +00:00
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the Apache License with the above modification is
|
|
|
|
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
// KIND, either express or implied. See the Apache License for the specific
|
|
|
|
// language governing permissions and limitations under the Apache License.
|
2012-12-13 18:22:30 +00:00
|
|
|
//
|
2013-09-26 19:04:57 +00:00
|
|
|
|
2012-12-13 18:22:30 +00:00
|
|
|
#ifndef OSD_D3D11_COMPUTE_KERNEL_BUNDLE_H
|
|
|
|
#define OSD_D3D11_COMPUTE_KERNEL_BUNDLE_H
|
|
|
|
|
|
|
|
#include "../version.h"
|
|
|
|
|
|
|
|
#include "../osd/nonCopyable.h"
|
2013-05-17 20:30:43 +00:00
|
|
|
#include "../osd/vertexDescriptor.h"
|
2012-12-13 18:22:30 +00:00
|
|
|
|
|
|
|
struct ID3D11Buffer;
|
|
|
|
struct ID3D11ClassInstance;
|
|
|
|
struct ID3D11ClassLinkage;
|
|
|
|
struct ID3D11ComputeShader;
|
|
|
|
struct ID3D11DeviceContext;
|
|
|
|
|
|
|
|
namespace OpenSubdiv {
|
|
|
|
namespace OPENSUBDIV_VERSION {
|
|
|
|
|
2013-05-17 02:53:49 +00:00
|
|
|
class OsdD3D11ComputeKernelBundle : OsdNonCopyable<OsdD3D11ComputeKernelBundle> {
|
2012-12-13 18:22:30 +00:00
|
|
|
|
2013-05-17 02:53:49 +00:00
|
|
|
public:
|
|
|
|
/// Constructor
|
|
|
|
OsdD3D11ComputeKernelBundle(ID3D11DeviceContext *deviceContext);
|
|
|
|
|
|
|
|
/// Destructor
|
|
|
|
~OsdD3D11ComputeKernelBundle();
|
2012-12-13 18:22:30 +00:00
|
|
|
|
2013-05-17 02:53:49 +00:00
|
|
|
bool Compile(int numVertexElements, int numVaryingElements);
|
2012-12-13 18:22:30 +00:00
|
|
|
|
2013-05-17 02:53:49 +00:00
|
|
|
void ApplyBilinearFaceVerticesKernel(
|
|
|
|
int vertexOffset, int tableOffset, int start, int end);
|
2012-12-13 18:22:30 +00:00
|
|
|
|
2013-05-17 02:53:49 +00:00
|
|
|
void ApplyBilinearEdgeVerticesKernel(
|
|
|
|
int vertexOffset, int tableOffset, int start, int end);
|
2012-12-13 18:22:30 +00:00
|
|
|
|
2013-05-17 02:53:49 +00:00
|
|
|
void ApplyBilinearVertexVerticesKernel(
|
|
|
|
int vertexOffset, int tableOffset, int start, int end);
|
2012-12-13 18:22:30 +00:00
|
|
|
|
2013-05-17 02:53:49 +00:00
|
|
|
void ApplyCatmarkFaceVerticesKernel(
|
|
|
|
int vertexOffset, int tableOffset, int start, int end);
|
2012-12-13 18:22:30 +00:00
|
|
|
|
2013-05-17 02:53:49 +00:00
|
|
|
void ApplyCatmarkEdgeVerticesKernel(
|
|
|
|
int vertexOffset, int tableOffset, int start, int end);
|
2012-12-13 18:22:30 +00:00
|
|
|
|
2013-05-17 02:53:49 +00:00
|
|
|
void ApplyCatmarkVertexVerticesKernelB(
|
|
|
|
int vertexOffset, int tableOffset, int start, int end);
|
2012-12-13 18:22:30 +00:00
|
|
|
|
2013-05-17 02:53:49 +00:00
|
|
|
void ApplyCatmarkVertexVerticesKernelA(
|
|
|
|
int vertexOffset, int tableOffset, int start, int end, bool pass);
|
2012-12-13 18:22:30 +00:00
|
|
|
|
2013-05-17 02:53:49 +00:00
|
|
|
void ApplyLoopEdgeVerticesKernel(
|
|
|
|
int vertexOffset, int tableOffset, int start, int end);
|
2012-12-13 18:22:30 +00:00
|
|
|
|
2013-05-17 02:53:49 +00:00
|
|
|
void ApplyLoopVertexVerticesKernelB(
|
|
|
|
int vertexOffset, int tableOffset, int start, int end);
|
2012-12-13 18:22:30 +00:00
|
|
|
|
2013-05-17 02:53:49 +00:00
|
|
|
void ApplyLoopVertexVerticesKernelA(
|
|
|
|
int vertexOffset, int tableOffset, int start, int end, bool pass);
|
2012-12-13 18:22:30 +00:00
|
|
|
|
2013-05-17 02:53:49 +00:00
|
|
|
void ApplyEditAdd(int primvarOffset, int primvarWidth,
|
|
|
|
int vertexOffset, int tableOffset, int start, int end);
|
2012-12-13 18:22:30 +00:00
|
|
|
|
2013-05-17 02:53:49 +00:00
|
|
|
struct Match {
|
2012-12-13 18:22:30 +00:00
|
|
|
|
2013-05-17 02:53:49 +00:00
|
|
|
/// Constructor
|
|
|
|
Match(int numVertexElements, int numVaryingElements)
|
|
|
|
: vdesc(numVertexElements, numVaryingElements) {
|
|
|
|
}
|
2012-12-13 18:22:30 +00:00
|
|
|
|
2013-05-17 02:53:49 +00:00
|
|
|
bool operator() (OsdD3D11ComputeKernelBundle const *kernel) {
|
|
|
|
return vdesc == kernel->_vdesc;
|
|
|
|
}
|
2012-12-13 18:22:30 +00:00
|
|
|
|
2013-05-17 02:53:49 +00:00
|
|
|
OsdVertexDescriptor vdesc;
|
|
|
|
};
|
2012-12-13 18:22:30 +00:00
|
|
|
|
2013-05-17 02:53:49 +00:00
|
|
|
friend struct Match;
|
2012-12-13 18:22:30 +00:00
|
|
|
|
2013-05-17 02:53:49 +00:00
|
|
|
protected:
|
|
|
|
struct KernelCB;
|
|
|
|
void dispatchCompute(ID3D11ClassInstance * kernel, KernelCB const & args);
|
2012-12-13 18:22:30 +00:00
|
|
|
|
2013-05-17 02:53:49 +00:00
|
|
|
ID3D11DeviceContext * _deviceContext;
|
2012-12-13 18:22:30 +00:00
|
|
|
|
2013-05-17 02:53:49 +00:00
|
|
|
ID3D11ComputeShader * _computeShader;
|
|
|
|
ID3D11ClassLinkage * _classLinkage;
|
|
|
|
|
|
|
|
|
|
|
|
ID3D11Buffer * _kernelCB; // constant buffer
|
|
|
|
|
|
|
|
|
|
|
|
ID3D11ClassInstance * _kernelComputeFace; // general face-vertex kernel (all schemes)
|
|
|
|
|
|
|
|
ID3D11ClassInstance * _kernelComputeEdge; // edge-vertex kernel (catmark + loop schemes)
|
|
|
|
|
|
|
|
ID3D11ClassInstance * _kernelComputeBilinearEdge; // edge-vertex kernel (bilinear scheme)
|
|
|
|
|
|
|
|
ID3D11ClassInstance * _kernelComputeVertex; // vertex-vertex kernel (bilinear scheme)
|
|
|
|
|
|
|
|
ID3D11ClassInstance * _kernelComputeVertexA; // vertex-vertex kernel A (catmark + loop schemes)
|
|
|
|
|
|
|
|
ID3D11ClassInstance * _kernelComputeCatmarkVertexB; // vertex-vertex kernel B (catmark scheme)
|
|
|
|
|
|
|
|
ID3D11ClassInstance * _kernelComputeLoopVertexB; // vertex-vertex kernel B (loop scheme)
|
|
|
|
|
|
|
|
ID3D11ClassInstance * _kernelEditAdd; // hedit kernel (add)
|
|
|
|
|
|
|
|
int _workGroupSize;
|
|
|
|
|
|
|
|
OsdVertexDescriptor _vdesc;
|
|
|
|
};
|
2012-12-13 18:22:30 +00:00
|
|
|
|
|
|
|
} // end namespace OPENSUBDIV_VERSION
|
|
|
|
using namespace OPENSUBDIV_VERSION;
|
|
|
|
|
|
|
|
} // end namespace OpenSubdiv
|
|
|
|
|
|
|
|
#endif // OSD_D3D11_COMPUTE_KERNEL_BUNDLE_H
|