]> git.cworth.org Git - apitrace/commitdiff
gl: Handle ClearBufferData blobs.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Sun, 11 Nov 2012 00:58:21 +0000 (00:58 +0000)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Sun, 11 Nov 2012 00:58:21 +0000 (00:58 +0000)
helpers/glsize.hpp
specs/glapi.py

index 9d39a3b717f6f812aee787d58a3be5a73623ad6d..fe267e1aa8a49d2b0a736368ea4c511ad1ef62f2 100644 (file)
@@ -617,12 +617,12 @@ _align(X x, Y y) {
     return (x + (y - 1)) & ~(y - 1);
 }
 
-static inline size_t
-_gl_image_size(GLenum format, GLenum type, GLsizei width, GLsizei height, GLsizei depth, GLboolean has_unpack_subimage) {
+static inline void
+_gl_format_size(GLenum format, GLenum type,
+                unsigned & bits_per_element, unsigned & bits_per_pixel)
+{
     unsigned num_channels = _gl_format_channels(format);
 
-    unsigned bits_per_element;
-    unsigned bits_per_pixel;
     switch (type) {
     case GL_BITMAP:
         bits_per_pixel = bits_per_element = 1;
@@ -677,6 +677,22 @@ _gl_image_size(GLenum format, GLenum type, GLsizei width, GLsizei height, GLsize
         bits_per_pixel = bits_per_element = 0;
         break;
     }
+}
+
+static inline size_t
+_glClearBufferData_size(GLenum format, GLenum type) {
+    unsigned bits_per_element;
+    unsigned bits_per_pixel;
+    _gl_format_size(format, type, bits_per_element, bits_per_pixel);
+    return (bits_per_pixel + 7)/8;
+}
+
+static inline size_t
+_gl_image_size(GLenum format, GLenum type, GLsizei width, GLsizei height, GLsizei depth, GLboolean has_unpack_subimage) {
+
+    unsigned bits_per_element;
+    unsigned bits_per_pixel;
+    _gl_format_size(format, type, bits_per_element, bits_per_pixel);
 
     GLint alignment = 4;
     GLint row_length = 0;
index 9378721a0c6e0f89bdeb33ea8364cd035b2fb31c..257fe2efbc3f7a56076a7868984884a5b3b9f537 100644 (file)
@@ -1357,10 +1357,10 @@ glapi.addFunctions([
     GlFunction(Void, "glGetObjectPtrLabel", [(OpaquePointer(Const(Void)), "ptr"), (GLsizei, "bufSize"), Out(Pointer(GLsizei), "length"), Out(Array(GLchar, "bufSize"), "label")], sideeffects=False),
 
     # GL_ARB_clear_buffer_object
-    GlFunction(Void, "glClearBufferData", [(GLenum, "target"), (GLenum, "internalformat"), (GLenum, "format"), (GLenum, "type"), (OpaqueArray(Const(Void), "_glClearBufferData_size(format, type)"), "data")]),
-    GlFunction(Void, "glClearBufferSubData", [(GLenum, "target"), (GLenum, "internalformat"), (GLintptr, "offset"), (GLsizeiptr, "size"), (GLenum, "format"), (GLenum, "type"), (OpaqueArray(Const(Void), "_glClearBufferSubData_size(format, type)"), "data")]),
-    GlFunction(Void, "glClearNamedBufferDataEXT", [(GLbuffer, "buffer"), (GLenum, "internalformat"), (GLenum, "format"), (GLenum, "type"), (OpaqueArray(Const(Void), "_glClearNamedBufferDataEXT_size(format, type)"), "data")]),
-    GlFunction(Void, "glClearNamedBufferSubDataEXT", [(GLbuffer, "buffer"), (GLenum, "internalformat"), (GLenum, "format"), (GLenum, "type"), (GLsizeiptr, "offset"), (GLsizeiptr, "size"), (OpaqueArray(Const(Void), "_glClearNamedBufferSubDataEXT_size(format, type)"), "data")]),
+    GlFunction(Void, "glClearBufferData", [(GLenum, "target"), (GLenum, "internalformat"), (GLenum, "format"), (GLenum, "type"), (Blob(Const(Void), "_glClearBufferData_size(format, type)"), "data")]),
+    GlFunction(Void, "glClearBufferSubData", [(GLenum, "target"), (GLenum, "internalformat"), (GLintptr, "offset"), (GLsizeiptr, "size"), (GLenum, "format"), (GLenum, "type"), (Blob(Const(Void), "_glClearBufferData_size(format, type)"), "data")]),
+    GlFunction(Void, "glClearNamedBufferDataEXT", [(GLbuffer, "buffer"), (GLenum, "internalformat"), (GLenum, "format"), (GLenum, "type"), (Blob(Const(Void), "_glClearBufferData_size(format, type)"), "data")]),
+    GlFunction(Void, "glClearNamedBufferSubDataEXT", [(GLbuffer, "buffer"), (GLenum, "internalformat"), (GLenum, "format"), (GLenum, "type"), (GLsizeiptr, "offset"), (GLsizeiptr, "size"), (Blob(Const(Void), "_glClearBufferData_size(format, type)"), "data")]),
 
     # GL_ARB_compute_shader
     GlFunction(Void, "glDispatchCompute", [(GLuint, "num_groups_x"), (GLuint, "num_groups_y"), (GLuint, "num_groups_z")]),