Mesa (pipe-format-simplify): Format layout cannot be used to distinguish scaled/normalised formats.

Michał Król michal at kemper.freedesktop.org
Tue Dec 8 10:58:27 PST 2009


Module: Mesa
Branch: pipe-format-simplify
Commit: 876a785a182d7987786377ff0a44ee40628254f3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=876a785a182d7987786377ff0a44ee40628254f3

Author: Michal Krol <michal at vmware.com>
Date:   Tue Dec  8 19:58:13 2009 +0100

Format layout cannot be used to distinguish scaled/normalised formats.

---

 src/gallium/drivers/nv50/nv50_vbo.c           |   18 ++++--------------
 src/gallium/drivers/r300/r300_state_inlines.h |    2 +-
 2 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_vbo.c b/src/gallium/drivers/nv50/nv50_vbo.c
index f3472f2..d1c9f3f 100644
--- a/src/gallium/drivers/nv50/nv50_vbo.c
+++ b/src/gallium/drivers/nv50/nv50_vbo.c
@@ -75,25 +75,15 @@ nv50_vbo_type_to_hw(enum pipe_format format)
 	case UTIL_FORMAT_TYPE_FLOAT:
 		return NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_FLOAT;
 	case UTIL_FORMAT_TYPE_UNSIGNED:
-		switch (desc->layout) {
-		case UTIL_FORMAT_LAYOUT_ARITH:
+		if (desc->channel[0].normalized) {
 			return NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_UNORM;
-		case UTIL_FORMAT_LAYOUT_ARRAY:
-			return NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_USCALED;
-		default:
-			return 0;
 		}
-		break;
+		return NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_USCALED;
 	case UTIL_FORMAT_TYPE_SIGNED:
-		switch (desc->layout) {
-		case UTIL_FORMAT_LAYOUT_ARITH:
+		if (desc->channel[0].normalized) {
 			return NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_SNORM;
-		case UTIL_FORMAT_LAYOUT_ARRAY:
-			return NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_SSCALED;
-		default:
-			return 0;
 		}
-		break;
+		return NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_SSCALED;
 	/*
 	case PIPE_FORMAT_TYPE_UINT:
 		return NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_UINT;
diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h
index 5c58655..7cd1f87 100644
--- a/src/gallium/drivers/r300/r300_state_inlines.h
+++ b/src/gallium/drivers/r300/r300_state_inlines.h
@@ -528,7 +528,7 @@ r300_translate_vertex_data_type(enum pipe_format format) {
     if (desc->type == UTIL_FORMAT_TYPE_SIGNED) {
         result |= R300_SIGNED;
     }
-    if (desc->layout == UTIL_FORMAT_LAYOUT_ARITH) {
+    if (desc->channel[0].normalized) {
         result |= R300_NORMALIZE;
     }
 



More information about the mesa-commit mailing list