From 39793a262f055adf49e6bbd7b74728f744074e8e Mon Sep 17 00:00:00 2001
From: Ben Skeggs <skeggsb@gmail.com>
Date: Wed, 23 Jul 2008 14:14:55 +1000
Subject: nouveau: is_format_supported() interface changes

---
 src/gallium/drivers/nv04/nv04_screen.c | 15 ++++++---------
 src/gallium/drivers/nv10/nv10_screen.c | 15 ++++++---------
 src/gallium/drivers/nv30/nv30_screen.c | 15 ++++++---------
 src/gallium/drivers/nv40/nv40_screen.c | 15 ++++++---------
 src/gallium/drivers/nv50/nv50_screen.c | 13 +++++--------
 5 files changed, 29 insertions(+), 44 deletions(-)

(limited to 'src/gallium')

diff --git a/src/gallium/drivers/nv04/nv04_screen.c b/src/gallium/drivers/nv04/nv04_screen.c
index 9f34117b8c8..da09a3a5fe8 100644
--- a/src/gallium/drivers/nv04/nv04_screen.c
+++ b/src/gallium/drivers/nv04/nv04_screen.c
@@ -79,10 +79,11 @@ nv04_screen_get_paramf(struct pipe_screen *screen, int param)
 
 static boolean
 nv04_screen_is_format_supported(struct pipe_screen *screen,
-				enum pipe_format format, uint type)
+				enum pipe_format format,
+				enum pipe_texture_target target,
+				unsigned tex_usage, unsigned geom_flags)
 {
-	switch (type) {
-	case PIPE_SURFACE:
+	if (tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) {
 		switch (format) {
 		case PIPE_FORMAT_A8R8G8B8_UNORM:
 		case PIPE_FORMAT_R5G6B5_UNORM: 
@@ -91,8 +92,7 @@ nv04_screen_is_format_supported(struct pipe_screen *screen,
 		default:
 			break;
 		}
-		break;
-	case PIPE_TEXTURE:
+	} else {
 		switch (format) {
 		case PIPE_FORMAT_A8R8G8B8_UNORM:
 		case PIPE_FORMAT_X8R8G8B8_UNORM:
@@ -104,10 +104,7 @@ nv04_screen_is_format_supported(struct pipe_screen *screen,
 		default:
 			break;
 		}
-		break;
-	default:
-		assert(0);
-	};
+	}
 
 	return FALSE;
 }
diff --git a/src/gallium/drivers/nv10/nv10_screen.c b/src/gallium/drivers/nv10/nv10_screen.c
index 67787d8e9ce..403f7b98cde 100644
--- a/src/gallium/drivers/nv10/nv10_screen.c
+++ b/src/gallium/drivers/nv10/nv10_screen.c
@@ -82,10 +82,11 @@ nv10_screen_get_paramf(struct pipe_screen *screen, int param)
 
 static boolean
 nv10_screen_is_format_supported(struct pipe_screen *screen,
-				enum pipe_format format, uint type)
+				enum pipe_format format,
+				enum pipe_texture_target target,
+				unsigned tex_usage, unsigned geom_flags)
 {
-	switch (type) {
-	case PIPE_SURFACE:
+	if (tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) {
 		switch (format) {
 		case PIPE_FORMAT_A8R8G8B8_UNORM:
 		case PIPE_FORMAT_R5G6B5_UNORM: 
@@ -95,8 +96,7 @@ nv10_screen_is_format_supported(struct pipe_screen *screen,
 		default:
 			break;
 		}
-		break;
-	case PIPE_TEXTURE:
+	} else {
 		switch (format) {
 		case PIPE_FORMAT_A8R8G8B8_UNORM:
 		case PIPE_FORMAT_A1R5G5B5_UNORM:
@@ -109,10 +109,7 @@ nv10_screen_is_format_supported(struct pipe_screen *screen,
 		default:
 			break;
 		}
-		break;
-	default:
-		assert(0);
-	};
+	}
 
 	return FALSE;
 }
diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c
index b216a703187..0ffcd772351 100644
--- a/src/gallium/drivers/nv30/nv30_screen.c
+++ b/src/gallium/drivers/nv30/nv30_screen.c
@@ -86,10 +86,11 @@ nv30_screen_get_paramf(struct pipe_screen *pscreen, int param)
 
 static boolean
 nv30_screen_surface_format_supported(struct pipe_screen *pscreen,
-				     enum pipe_format format, uint type)
+				     enum pipe_format format,
+				     enum pipe_texture_target target,
+				     unsigned tex_usage, unsigned geom_flags)
 {
-	switch (type) {
-	case PIPE_SURFACE:
+	if (tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) {
 		switch (format) {
 		case PIPE_FORMAT_A8R8G8B8_UNORM:
 		case PIPE_FORMAT_R5G6B5_UNORM: 
@@ -99,8 +100,7 @@ nv30_screen_surface_format_supported(struct pipe_screen *pscreen,
 		default:
 			break;
 		}
-		break;
-	case PIPE_TEXTURE:
+	} else {
 		switch (format) {
 		case PIPE_FORMAT_A8R8G8B8_UNORM:
 		case PIPE_FORMAT_A1R5G5B5_UNORM:
@@ -116,10 +116,7 @@ nv30_screen_surface_format_supported(struct pipe_screen *pscreen,
 		default:
 			break;
 		}
-		break;
-	default:
-		assert(0);
-	};
+	}
 
 	return FALSE;
 }
diff --git a/src/gallium/drivers/nv40/nv40_screen.c b/src/gallium/drivers/nv40/nv40_screen.c
index ed0215b4862..3872c0a0c9b 100644
--- a/src/gallium/drivers/nv40/nv40_screen.c
+++ b/src/gallium/drivers/nv40/nv40_screen.c
@@ -91,10 +91,11 @@ nv40_screen_get_paramf(struct pipe_screen *pscreen, int param)
 
 static boolean
 nv40_screen_surface_format_supported(struct pipe_screen *pscreen,
-				     enum pipe_format format, uint type)
+				     enum pipe_format format,
+				     enum pipe_texture_target target,
+				     unsigned tex_usage, unsigned geom_flags)
 {
-	switch (type) {
-	case PIPE_SURFACE:
+	if (tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) {
 		switch (format) {
 		case PIPE_FORMAT_A8R8G8B8_UNORM:
 		case PIPE_FORMAT_R5G6B5_UNORM: 
@@ -104,8 +105,7 @@ nv40_screen_surface_format_supported(struct pipe_screen *pscreen,
 		default:
 			break;
 		}
-		break;
-	case PIPE_TEXTURE:
+	} else {
 		switch (format) {
 		case PIPE_FORMAT_A8R8G8B8_UNORM:
 		case PIPE_FORMAT_A1R5G5B5_UNORM:
@@ -125,10 +125,7 @@ nv40_screen_surface_format_supported(struct pipe_screen *pscreen,
 		default:
 			break;
 		}
-		break;
-	default:
-		assert(0);
-	};
+	}
 
 	return FALSE;
 }
diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c
index 2f3cf041d1c..996b0b3e8f2 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -34,10 +34,11 @@
 
 static boolean
 nv50_screen_is_format_supported(struct pipe_screen *pscreen,
-				enum pipe_format format, uint type)
+				enum pipe_format format,
+				enum pipe_texture_target target,
+				unsigned tex_usage, unsigned geom_flags)
 {
-	switch (type) {
-	case PIPE_SURFACE:
+	if (tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) {
 		switch (format) {
 		case PIPE_FORMAT_A8R8G8B8_UNORM:
 		case PIPE_FORMAT_R5G6B5_UNORM:
@@ -47,8 +48,7 @@ nv50_screen_is_format_supported(struct pipe_screen *pscreen,
 		default:
 			break;
 		}
-		break;
-	case PIPE_TEXTURE:
+	} else {
 		switch (format) {
 		case PIPE_FORMAT_A8R8G8B8_UNORM:
 		case PIPE_FORMAT_A1R5G5B5_UNORM:
@@ -62,9 +62,6 @@ nv50_screen_is_format_supported(struct pipe_screen *pscreen,
 		default:
 			break;
 		}
-		break;
-	default:
-		assert(0);
 	}
 
 	return FALSE;
-- 
cgit v1.2.3