examples fix: CLEW crash, print a message for unsupported GPU kernel

- Fix crashes on glEvalLimit and glStencilViewer with CLEW
- Currently GPU patch evaluation only supports BSpline patches.
  raise an error message in glEvalLimit for the unsupported combinations
  until GregoryBasis evaluation will be added to them.
This commit is contained in:
Takahito Tejima 2015-06-03 14:19:49 -07:00
parent 89bbf53763
commit 45d8b1de54
3 changed files with 18 additions and 5 deletions

View File

@ -869,10 +869,19 @@ display() {
g_hud.DrawString(10, -20, "FPS : %3.1f", fps);
if (g_drawMode==kFACEVARYING) {
static char msg[] = "Face-varying interpolation not implemented yet";
g_hud.DrawString(g_width/2-20/2*8, g_height/2, msg);
static char msg[] =
"ERROR: Face-varying interpolation hasn't been supported yet.";
g_hud.DrawString(g_width/4, g_height/4, 1, 0, 0, msg);
}
if (g_endCap != kEndCapBSplineBasis &&
(g_kernel != kCPU && g_kernel != kOPENMP && g_kernel != kTBB)) {
static char msg[] =
"ERROR: This kernel only supports BSpline basis patches.";
g_hud.DrawString(g_width/4, g_height/4+20, 1, 0, 0, msg);
}
g_hud.Flush();
}
@ -1124,7 +1133,9 @@ initHUD() {
g_hud.AddPullDownButton(compute_pulldown, "CUDA", kCUDA);
#endif
#ifdef OPENSUBDIV_HAS_OPENCL
if (CLDeviceContext::HAS_CL_VERSION_1_1()) {
g_hud.AddPullDownButton(compute_pulldown, "OpenCL", kCL);
}
#endif
#ifdef OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK
g_hud.AddPullDownButton(compute_pulldown, "GL XFB", kGLXFB);

View File

@ -652,7 +652,7 @@ int main(int argc, char ** argv) {
// prep GPU kernel
#ifdef OPENSUBDIV_HAS_OPENCL
if (kernel == "CL") {
if (kernel == "CL" && CLDeviceContext::HAS_CL_VERSION_1_1()) {
if (g_clDeviceContext.IsInitialized() == false) {
if (g_clDeviceContext.Initialize() == false) {
std::cout << "Error in initializing OpenCL\n";

View File

@ -960,7 +960,9 @@ initHUD() {
g_hud.AddPullDownButton(compute_pulldown, "CUDA", kCUDA);
#endif
#ifdef OPENSUBDIV_HAS_OPENCL
if (CLDeviceContext::HAS_CL_VERSION_1_1()) {
g_hud.AddPullDownButton(compute_pulldown, "OpenCL", kCL);
}
#endif
#ifdef OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK
g_hud.AddPullDownButton(compute_pulldown, "GL XFB", kGLXFB);