/* * Callback function for debug output. */ static void APIENTRY DebugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const void *userParam) { const char* sourceStr = "Source: Unknown"; const char* typeStr = "Type: Unknown"; const char* severityStr = "Severity: Unknown"; switch (severity) { case QGL_DEBUG_SEVERITY_NOTIFICATION: return; case GL_DEBUG_SEVERITY_HIGH_ARB: severityStr = "Severity: High"; break; case GL_DEBUG_SEVERITY_MEDIUM_ARB: severityStr = "Severity: Medium"; break; case GL_DEBUG_SEVERITY_LOW_ARB: severityStr = "Severity: Low"; break; } switch (source) { #define SRCCASE(X) case GL_DEBUG_SOURCE_ ## X ## _ARB: sourceStr = "Source: " #X; break; SRCCASE(API); SRCCASE(WINDOW_SYSTEM); SRCCASE(SHADER_COMPILER); SRCCASE(THIRD_PARTY); SRCCASE(APPLICATION); SRCCASE(OTHER); #undef SRCCASE } switch(type) { #define TYPECASE(X) case GL_DEBUG_TYPE_ ## X ## _ARB: typeStr = "Type: " #X; break; TYPECASE(ERROR); TYPECASE(DEPRECATED_BEHAVIOR); TYPECASE(UNDEFINED_BEHAVIOR); TYPECASE(PORTABILITY); TYPECASE(PERFORMANCE); TYPECASE(OTHER); #undef TYPECASE } // use PRINT_ALL - this is only called with gl3_debugcontext != 0 anyway. R_Printf(PRINT_ALL, "GLDBG %s %s %s: %s\n", sourceStr, typeStr, severityStr, message); }
bool ImageBuf::copy_pixels (int xbegin, int xend, int ybegin, int yend, D *r) const { // Caveat: serious hack here. To avoid duplicating code, use a // #define. Furthermore, exploit the CType<> template to construct // the right C data type for the given BASETYPE. #define TYPECASE(B) \ case B : copy_pixels_<CType<B>::type,D>(*this, xbegin, xend, ybegin, yend, (D *)r); return true switch (spec().format.basetype) { TYPECASE (TypeDesc::UINT8); TYPECASE (TypeDesc::INT8); TYPECASE (TypeDesc::UINT16); TYPECASE (TypeDesc::INT16); TYPECASE (TypeDesc::UINT); TYPECASE (TypeDesc::INT); TYPECASE (TypeDesc::HALF); TYPECASE (TypeDesc::FLOAT); TYPECASE (TypeDesc::DOUBLE); TYPECASE (TypeDesc::UINT64); TYPECASE (TypeDesc::INT64); } return false; #undef TYPECASE }
bool ImageBuf::get_pixel_channels (int xbegin, int xend, int ybegin, int yend, int zbegin, int zend, int chbegin, int chend, TypeDesc format, void *result, stride_t xstride, stride_t ystride, stride_t zstride) const { // For each possible base type that the user wants for a destination // type, call a template specialization. #define TYPECASE(B) \ case B : return get_pixel_channels<CType<B>::type> ( \ xbegin, xend, ybegin, yend, zbegin, zend, \ chbegin, chend, (CType<B>::type *)result, \ xstride, ystride, zstride) switch (format.basetype) { TYPECASE (TypeDesc::UINT8); TYPECASE (TypeDesc::INT8); TYPECASE (TypeDesc::UINT16); TYPECASE (TypeDesc::INT16); TYPECASE (TypeDesc::UINT); TYPECASE (TypeDesc::INT); TYPECASE (TypeDesc::HALF); TYPECASE (TypeDesc::FLOAT); TYPECASE (TypeDesc::DOUBLE); TYPECASE (TypeDesc::UINT64); TYPECASE (TypeDesc::INT64); } return false; #undef TYPECASE }