aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorAlejandro Piñeiro <[email protected]>2016-03-15 12:53:07 +0100
committerAlejandro Piñeiro <[email protected]>2016-05-17 07:34:40 +0200
commit71150b73c81a58dc06057ced561d10332aecc803 (patch)
tree830c6119b2555343f21c9e9dd12de18da975ae02 /src/mesa/drivers/dri
parentb1d74e9486d7233412e4aa7bc07a1efbb72e768e (diff)
i965: get the proper vertex surface type for doubles on gen8+
This commit adds support for PASSTHRU format when pushing double-precision attributes. Check glarray->Doubles in order to know if we should choose a format that does a conversion to float, or just passthru the 64-bit double. Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw_upload.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index 58e05166506..5af458368c8 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -37,7 +37,7 @@
#include "intel_batchbuffer.h"
#include "intel_buffer_objects.h"
-static const GLuint double_types[5] = {
+static const GLuint double_types_float[5] = {
0,
BRW_SURFACEFORMAT_R64_FLOAT,
BRW_SURFACEFORMAT_R64G64_FLOAT,
@@ -45,6 +45,14 @@ static const GLuint double_types[5] = {
BRW_SURFACEFORMAT_R64G64B64A64_FLOAT
};
+static const GLuint double_types_passthru[5] = {
+ 0,
+ BRW_SURFACEFORMAT_R64_PASSTHRU,
+ BRW_SURFACEFORMAT_R64G64_PASSTHRU,
+ BRW_SURFACEFORMAT_R64G64B64_PASSTHRU,
+ BRW_SURFACEFORMAT_R64G64B64A64_PASSTHRU
+};
+
static const GLuint float_types[5] = {
0,
BRW_SURFACEFORMAT_R32_FLOAT,
@@ -213,6 +221,22 @@ static const GLuint byte_types_scale[5] = {
BRW_SURFACEFORMAT_R8G8B8A8_SSCALED
};
+static GLuint
+double_types(struct brw_context *brw,
+ int size,
+ GLboolean doubles)
+{
+ /* From the BDW PRM, Volume 2d, page 588 (VERTEX_ELEMENT_STATE):
+ * "When SourceElementFormat is set to one of the *64*_PASSTHRU formats,
+ * 64-bit components are stored in the URB without any conversion."
+ * Also included on BDW PRM, Volume 7, page 470, table "Source Element
+ * Formats Supported in VF Unit"
+ * Previous PRMs don't include those references.
+ */
+ return (brw->gen >= 8 && doubles
+ ? double_types_passthru[size]
+ : double_types_float[size]);
+}
/**
* Given vertex array type/size/format/normalized info, return
@@ -245,7 +269,7 @@ brw_get_vertex_surface_type(struct brw_context *brw,
return BRW_SURFACEFORMAT_R11G11B10_FLOAT;
} else if (glarray->Normalized) {
switch (glarray->Type) {
- case GL_DOUBLE: return double_types[size];
+ case GL_DOUBLE: return double_types(brw, size, glarray->Doubles);
case GL_FLOAT: return float_types[size];
case GL_HALF_FLOAT: return half_float_types[size];
case GL_INT: return int_types_norm[size];
@@ -319,7 +343,7 @@ brw_get_vertex_surface_type(struct brw_context *brw,
}
assert(glarray->Format == GL_RGBA); /* sanity check */
switch (glarray->Type) {
- case GL_DOUBLE: return double_types[size];
+ case GL_DOUBLE: return double_types(brw, size, glarray->Doubles);
case GL_FLOAT: return float_types[size];
case GL_HALF_FLOAT: return half_float_types[size];
case GL_INT: return int_types_scale[size];