Mesa (master): i965: bring back type_size_vec4_times_4()

Timothy Arceri tarceri at kemper.freedesktop.org
Wed Jul 20 23:11:09 UTC 2016


Module: Mesa
Branch: master
Commit: 09e46f99ad465ab253de3fc321f39062cfbe1984
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=09e46f99ad465ab253de3fc321f39062cfbe1984

Author: Timothy Arceri <timothy.arceri at collabora.com>
Date:   Tue Jul 19 15:13:51 2016 +1000

i965: bring back type_size_vec4_times_4()

We will use this for output varyings. To make component
packing simpler we will just treat all varyings as vec4s.

Reviewed-by: Alejandro Piñeiro <apinheiro at igalia.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/drivers/dri/i965/brw_fs.cpp   | 13 +++++++++++++
 src/mesa/drivers/dri/i965/brw_shader.h |  1 +
 2 files changed, 14 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 4344a3a..53e7183 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -509,6 +509,19 @@ type_size_scalar(const struct glsl_type *type)
    return 0;
 }
 
+/**
+ * Returns the number of scalar components needed to store type, assuming
+ * that vectors are padded out to vec4.
+ *
+ * This has the packing rules of type_size_vec4(), but counts components
+ * similar to type_size_scalar().
+ */
+extern "C" int
+type_size_vec4_times_4(const struct glsl_type *type)
+{
+   return 4 * type_size_vec4(type);
+}
+
 /* Attribute arrays are loaded as one vec4 per element (or matrix column),
  * except for double-precision types, which are loaded as one dvec4.
  */
diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h
index dd9eb2d..e61c080 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.h
+++ b/src/mesa/drivers/dri/i965/brw_shader.h
@@ -294,6 +294,7 @@ struct gl_linked_shader *brw_new_shader(gl_shader_stage stage);
 int type_size_scalar(const struct glsl_type *type);
 int type_size_vec4(const struct glsl_type *type);
 int type_size_dvec4(const struct glsl_type *type);
+int type_size_vec4_times_4(const struct glsl_type *type);
 int type_size_vs_input(const struct glsl_type *type);
 
 unsigned tesslevel_outer_components(GLenum tes_primitive_mode);




More information about the mesa-commit mailing list