mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2025-01-13 09:50:09 +00:00
Adding TBB Compute back-end to glViewer
This commit is contained in:
parent
d57df0eae0
commit
ac72015310
@ -62,6 +62,11 @@ OpenSubdiv::OsdCpuComputeController *g_cpuComputeController = NULL;
|
|||||||
OpenSubdiv::OsdOmpComputeController *g_ompComputeController = NULL;
|
OpenSubdiv::OsdOmpComputeController *g_ompComputeController = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef OPENSUBDIV_HAS_TBB
|
||||||
|
#include <osd/tbbComputeController.h>
|
||||||
|
OpenSubdiv::OsdTbbComputeController *g_tbbComputeController = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef OPENSUBDIV_HAS_GCD
|
#ifdef OPENSUBDIV_HAS_GCD
|
||||||
#include <osd/gcdComputeController.h>
|
#include <osd/gcdComputeController.h>
|
||||||
OpenSubdiv::OsdGcdComputeController *g_gcdComputeController = NULL;
|
OpenSubdiv::OsdGcdComputeController *g_gcdComputeController = NULL;
|
||||||
@ -136,11 +141,12 @@ typedef OpenSubdiv::HbrHalfedge<OpenSubdiv::OsdVertex> OsdHbrHalfedge;
|
|||||||
|
|
||||||
enum KernelType { kCPU = 0,
|
enum KernelType { kCPU = 0,
|
||||||
kOPENMP = 1,
|
kOPENMP = 1,
|
||||||
kGCD = 2,
|
kTBB = 2,
|
||||||
kCUDA = 3,
|
kGCD = 3,
|
||||||
kCL = 4,
|
kCUDA = 4,
|
||||||
kGLSL = 5,
|
kCL = 5,
|
||||||
kGLSLCompute = 6 };
|
kGLSL = 6,
|
||||||
|
kGLSLCompute = 7 };
|
||||||
|
|
||||||
enum DisplayStyle { kWire = 0,
|
enum DisplayStyle { kWire = 0,
|
||||||
kShaded,
|
kShaded,
|
||||||
@ -576,6 +582,8 @@ getKernelName(int kernel) {
|
|||||||
return "CPU";
|
return "CPU";
|
||||||
else if (kernel == kOPENMP)
|
else if (kernel == kOPENMP)
|
||||||
return "OpenMP";
|
return "OpenMP";
|
||||||
|
else if (kernel == kTBB)
|
||||||
|
return "TBB";
|
||||||
else if (kernel == kGCD)
|
else if (kernel == kGCD)
|
||||||
return "GCD";
|
return "GCD";
|
||||||
else if (kernel == kCUDA)
|
else if (kernel == kCUDA)
|
||||||
@ -662,6 +670,20 @@ createOsdMesh( const std::string &shape, int level, int kernel, Scheme scheme=kC
|
|||||||
numVaryingElements,
|
numVaryingElements,
|
||||||
level, bits);
|
level, bits);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef OPENSUBDIV_HAS_TBB
|
||||||
|
} else if (kernel == kTBB) {
|
||||||
|
if (not g_tbbComputeController) {
|
||||||
|
g_tbbComputeController = new OpenSubdiv::OsdTbbComputeController();
|
||||||
|
}
|
||||||
|
g_mesh = new OpenSubdiv::OsdMesh<OpenSubdiv::OsdCpuGLVertexBuffer,
|
||||||
|
OpenSubdiv::OsdTbbComputeController,
|
||||||
|
OpenSubdiv::OsdGLDrawContext>(
|
||||||
|
g_tbbComputeController,
|
||||||
|
hmesh,
|
||||||
|
numVertexElements,
|
||||||
|
numVaryingElements,
|
||||||
|
level, bits);
|
||||||
|
#endif
|
||||||
#ifdef OPENSUBDIV_HAS_GCD
|
#ifdef OPENSUBDIV_HAS_GCD
|
||||||
} else if (kernel == kGCD) {
|
} else if (kernel == kGCD) {
|
||||||
if (not g_gcdComputeController) {
|
if (not g_gcdComputeController) {
|
||||||
@ -1444,6 +1466,10 @@ uninitGL() {
|
|||||||
delete g_ompComputeController;
|
delete g_ompComputeController;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef OPENSUBDIV_HAS_TBB
|
||||||
|
delete g_tbbComputeController;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef OPENSUBDIV_HAS_GCD
|
#ifdef OPENSUBDIV_HAS_GCD
|
||||||
delete g_gcdComputeController;
|
delete g_gcdComputeController;
|
||||||
#endif
|
#endif
|
||||||
@ -1634,22 +1660,25 @@ initHUD()
|
|||||||
#ifdef OPENSUBDIV_HAS_OPENMP
|
#ifdef OPENSUBDIV_HAS_OPENMP
|
||||||
g_hud.AddRadioButton(0, "OPENMP", false, 10, 30, callbackKernel, kOPENMP, 'k');
|
g_hud.AddRadioButton(0, "OPENMP", false, 10, 30, callbackKernel, kOPENMP, 'k');
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef OPENSUBDIV_HAS_TBB
|
||||||
|
g_hud.AddRadioButton(0, "TBB", false, 10, 50, callbackKernel, kTBB, 'k');
|
||||||
|
#endif
|
||||||
#ifdef OPENSUBDIV_HAS_GCD
|
#ifdef OPENSUBDIV_HAS_GCD
|
||||||
g_hud.AddRadioButton(0, "GCD", false, 10, 50, callbackKernel, kGCD, 'k');
|
g_hud.AddRadioButton(0, "GCD", false, 10, 70, callbackKernel, kGCD, 'k');
|
||||||
#endif
|
#endif
|
||||||
#ifdef OPENSUBDIV_HAS_CUDA
|
#ifdef OPENSUBDIV_HAS_CUDA
|
||||||
g_hud.AddRadioButton(0, "CUDA", false, 10, 70, callbackKernel, kCUDA, 'k');
|
g_hud.AddRadioButton(0, "CUDA", false, 10, 90, callbackKernel, kCUDA, 'k');
|
||||||
#endif
|
#endif
|
||||||
#ifdef OPENSUBDIV_HAS_OPENCL
|
#ifdef OPENSUBDIV_HAS_OPENCL
|
||||||
g_hud.AddRadioButton(0, "OPENCL", false, 10, 90, callbackKernel, kCL, 'k');
|
g_hud.AddRadioButton(0, "OPENCL", false, 10, 110, callbackKernel, kCL, 'k');
|
||||||
#endif
|
#endif
|
||||||
#ifdef OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK
|
#ifdef OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK
|
||||||
g_hud.AddRadioButton(0, "GLSL TransformFeedback", false, 10, 110, callbackKernel, kGLSL, 'k');
|
g_hud.AddRadioButton(0, "GLSL TransformFeedback", false, 10, 130, callbackKernel, kGLSL, 'k');
|
||||||
#endif
|
#endif
|
||||||
#ifdef OPENSUBDIV_HAS_GLSL_COMPUTE
|
#ifdef OPENSUBDIV_HAS_GLSL_COMPUTE
|
||||||
// Must also check at run time for OpenGL 4.3
|
// Must also check at run time for OpenGL 4.3
|
||||||
if (GLEW_VERSION_4_3) {
|
if (GLEW_VERSION_4_3) {
|
||||||
g_hud.AddRadioButton(0, "GLSL Compute", false, 10, 130, callbackKernel, kGLSLCompute, 'k');
|
g_hud.AddRadioButton(0, "GLSL Compute", false, 10, 150, callbackKernel, kGLSLCompute, 'k');
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user