summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/glformats.h
diff options
context:
space:
mode:
authorPaul Berry <stereotype441@gmail.com>2012-12-11 19:14:33 -0800
committerPaul Berry <stereotype441@gmail.com>2012-12-13 10:09:03 -0800
commit6267853055e4ecb5ce0580316c4aa77935f541d3 (patch)
tree55039101fe5f59b747e8914acd815a095e3b0369 /src/mesa/main/glformats.h
parent11cea472466f731fa9c44d56f1643dec26e6601c (diff)
downloadexternal_mesa3d-6267853055e4ecb5ce0580316c4aa77935f541d3.zip
external_mesa3d-6267853055e4ecb5ce0580316c4aa77935f541d3.tar.gz
external_mesa3d-6267853055e4ecb5ce0580316c4aa77935f541d3.tar.bz2
mesa: Fix computation of default vertex attrib stride for 2_10_10_10 formats.
Previously, if the client program didn't specify a stride when setting up a vertex attribute, we used _mesa_sizeof_type() to compute the size of the type, and multiplied it by the number of components. This didn't work for the 2_10_10_10 formats, since _mesa_sizeof_type() returns -1 for those types, resulting in all kinds of havoc, since it was causing the hardware to be programmed with a negative stride value. This patch adds a new function _mesa_bytes_per_vertex_attrib(), which is similar to the existing function _mesa_bytes_per_pixel(), but which computes the size of a vertex attribute based on the type and the number of formats. For packed formats (currently only the 2_10_10_10 formats), it verifies that the number of components is correct and returns the size of the packed format. For unpacked formats, it returns the size of the type times the number of components. In addition, this patch adds an assertion so that if we ever forget to update _mesa_bytes_per_vertex_attrib() when adding a new vertex format, we'll see the problem quickly rather than having to debug a subtle conformance test failure. Fixes GLES3 conformance tests vertex_type_2_10_10_10_rev_{conversion,divisor,stride_pointer}.test. Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src/mesa/main/glformats.h')
-rw-r--r--src/mesa/main/glformats.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mesa/main/glformats.h b/src/mesa/main/glformats.h
index 5d09951..ccfb5e1 100644
--- a/src/mesa/main/glformats.h
+++ b/src/mesa/main/glformats.h
@@ -49,6 +49,9 @@ _mesa_components_in_format( GLenum format );
extern GLint
_mesa_bytes_per_pixel( GLenum format, GLenum type );
+extern GLint
+_mesa_bytes_per_vertex_attrib(GLint comps, GLenum type);
+
extern GLboolean
_mesa_is_type_integer(GLenum type);