case GL_UNSIGNED_INT:
case GL_FLOAT:
case GL_4_BYTES:
+ case GL_FIXED:
return 4;
case GL_DOUBLE:
return 8;
default:
- OS::DebugMessage("apitrace: warning: %s: unknown GLenum 0x%04X\n", __FUNCTION__, type);
+ os::log("apitrace: warning: %s: unknown GLenum 0x%04X\n", __FUNCTION__, type);
return 0;
}
}
numElems = 1;
break;
default:
- OS::DebugMessage("apitrace: warning: %s: unknown GLenum 0x%04X\n", __FUNCTION__, type);
+ os::log("apitrace: warning: %s: unknown GLenum 0x%04X\n", __FUNCTION__, type);
elemType = GL_NONE;
numElems = 0;
return;
}
}
} else {
- OS::DebugMessage("apitrace: warning: %s: unknown GLenum 0x%04X\n", __FUNCTION__, type);
+ os::log("apitrace: warning: %s: unknown GLenum 0x%04X\n", __FUNCTION__, type);
}
if (__element_array_buffer) {
static inline GLuint
__glDrawArraysIndirect_maxindex(const GLvoid *indirect) {
- OS::DebugMessage("apitrace: warning: %s: unsupported\n", __FUNCTION__);
+ os::log("apitrace: warning: %s: unsupported\n", __FUNCTION__);
return 0;
}
static inline GLuint
__glDrawElementsIndirect_maxindex(GLenum type, const GLvoid *indirect) {
- OS::DebugMessage("apitrace: warning: %s: unsupported\n", __FUNCTION__);
+ os::log("apitrace: warning: %s: unsupported\n", __FUNCTION__);
return 0;
}
channels = 4;
break;
default:
- OS::DebugMessage("apitrace: warning: %s: unknown GLenum 0x%04X\n", __FUNCTION__, target);
+ os::log("apitrace: warning: %s: unknown GLenum 0x%04X\n", __FUNCTION__, target);
return 0;
}
channels = 4;
break;
default:
- OS::DebugMessage("apitrace: warning: %s: unknown GLenum 0x%04X\n", __FUNCTION__, target);
+ os::log("apitrace: warning: %s: unknown GLenum 0x%04X\n", __FUNCTION__, target);
return 0;
}
case GL_CMYKA_EXT:
return 5;
default:
- OS::DebugMessage("apitrace: warning: %s: unexpected format GLenum 0x%04X\n", __FUNCTION__, format);
+ os::log("apitrace: warning: %s: unexpected format GLenum 0x%04X\n", __FUNCTION__, format);
return 0;
}
}
}
static inline size_t
-__gl_image_size(GLenum format, GLenum type, GLsizei width, GLsizei height, GLsizei depth) {
+__gl_image_size(GLenum format, GLenum type, GLsizei width, GLsizei height, GLsizei depth, GLboolean has_unpack_subimage) {
unsigned num_channels = __gl_format_channels(format);
unsigned bits_per_pixel;
bits_per_pixel = 64;
break;
default:
- OS::DebugMessage("apitrace: warning: %s: unexpected type GLenum 0x%04X\n", __FUNCTION__, type);
+ os::log("apitrace: warning: %s: unexpected type GLenum 0x%04X\n", __FUNCTION__, type);
bits_per_pixel = 0;
break;
}
GLint skip_pixels = 0;
GLint skip_images = 0;
- __glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment);
- __glGetIntegerv(GL_UNPACK_ROW_LENGTH, &row_length);
- __glGetIntegerv(GL_UNPACK_IMAGE_HEIGHT, &image_height);
- __glGetIntegerv(GL_UNPACK_SKIP_ROWS, &skip_rows);
- __glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &skip_pixels);
- __glGetIntegerv(GL_UNPACK_SKIP_IMAGES, &skip_images);
+ __glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment);
+ if (has_unpack_subimage) {
+ __glGetIntegerv(GL_UNPACK_ROW_LENGTH, &row_length);
+ __glGetIntegerv(GL_UNPACK_IMAGE_HEIGHT, &image_height);
+ __glGetIntegerv(GL_UNPACK_SKIP_ROWS, &skip_rows);
+ __glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &skip_pixels);
+ __glGetIntegerv(GL_UNPACK_SKIP_IMAGES, &skip_images);
+ }
if (row_length <= 0) {
row_length = width;
return size;
}
-#define __glTexImage3D_size(format, type, width, height, depth) __gl_image_size(format, type, width, height, depth)
-#define __glTexImage2D_size(format, type, width, height) __gl_image_size(format, type, width, height, 1)
-#define __glTexImage1D_size(format, type, width) __gl_image_size(format, type, width, 1, 1)
+// note that can_unpack_subimage() is generated by gltrace.py
+#define __glTexImage3D_size(format, type, width, height, depth) __gl_image_size(format, type, width, height, depth, can_unpack_subimage())
+#define __glTexImage2D_size(format, type, width, height) __gl_image_size(format, type, width, height, 1, can_unpack_subimage())
+#define __glTexImage1D_size(format, type, width) __gl_image_size(format, type, width, 1, 1, can_unpack_subimage())
#define __glTexSubImage3D_size(format, type, width, height, depth) __glTexImage3D_size(format, type, width, height, depth)
#define __glTexSubImage2D_size(format, type, width, height) __glTexImage2D_size(format, type, width, height)
case GL_STENCIL:
return 1;
default:
- OS::DebugMessage("apitrace: warning: %s: unexpected buffer GLenum 0x%04X\n", __FUNCTION__, buffer);
+ os::log("apitrace: warning: %s: unexpected buffer GLenum 0x%04X\n", __FUNCTION__, buffer);
return 0;
}
}
}
+/*
+ * (key, value) attribute list, terminated by the given terminator.
+ */
+template<class T>
+static inline size_t
+__AttribList_size(const T *pAttribList, T terminator)
+{
+ size_t size = 0;
+
+ if (pAttribList) {
+ while (pAttribList[size] != terminator)
+ size += 2;
+ // terminator also counts
+ size++;
+ }
+
+ return size;
+}
+
+
#endif /* _GL_SIZE_HPP_ */