summaryrefslogtreecommitdiff
path: root/helpers
diff options
context:
space:
mode:
authorJosé Fonseca <jose.r.fonseca@gmail.com>2012-11-11 00:58:21 +0000
committerJosé Fonseca <jose.r.fonseca@gmail.com>2012-11-11 00:58:21 +0000
commitdf20f3357343ffec18c3f23ceded1774adb4904c (patch)
tree10ad1b695abd61a7f5d1e39f12c4bd000e44f291 /helpers
parent2b4fc3f4c1204f190f9b7b264d68912d3a49d80d (diff)
gl: Handle ClearBufferData blobs.
Diffstat (limited to 'helpers')
-rw-r--r--helpers/glsize.hpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/helpers/glsize.hpp b/helpers/glsize.hpp
index 9d39a3b7..fe267e1a 100644
--- a/helpers/glsize.hpp
+++ b/helpers/glsize.hpp
@@ -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;