summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nv50
diff options
context:
space:
mode:
authorChristoph Bumiller <[email protected]>2010-04-29 23:15:05 +0200
committerChristoph Bumiller <[email protected]>2010-04-30 22:50:42 +0200
commit75ee309ca9f467ba80a88b07735fb2d654a8c433 (patch)
treeecba3fa62d5f92fa903e520e6a56cedfe1ea6e3f /src/gallium/drivers/nv50
parent6df1e5c4aa980d52e98b991e6cdbd20a3c746845 (diff)
nv50: relax restriction on surface_copy format equality a bit
Diffstat (limited to 'src/gallium/drivers/nv50')
-rw-r--r--src/gallium/drivers/nv50/nv50_surface.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c
index c2d9e835260..d905d95354f 100644
--- a/src/gallium/drivers/nv50/nv50_surface.c
+++ b/src/gallium/drivers/nv50/nv50_surface.c
@@ -31,6 +31,27 @@
#include "util/u_tile.h"
#include "util/u_format.h"
+/* return TRUE for formats that can be converted among each other by NV50_2D */
+static INLINE boolean
+nv50_2d_format_faithful(enum pipe_format format)
+{
+ switch (format) {
+ case PIPE_FORMAT_B8G8R8A8_UNORM:
+ case PIPE_FORMAT_B8G8R8X8_UNORM:
+ case PIPE_FORMAT_B8G8R8A8_SRGB:
+ case PIPE_FORMAT_B8G8R8X8_SRGB:
+ case PIPE_FORMAT_B5G6R5_UNORM:
+ case PIPE_FORMAT_B5G5R5A1_UNORM:
+ case PIPE_FORMAT_B10G10R10A2_UNORM:
+ case PIPE_FORMAT_R8_UNORM:
+ case PIPE_FORMAT_R32G32B32A32_FLOAT:
+ case PIPE_FORMAT_R32G32B32_FLOAT:
+ return TRUE;
+ default:
+ return FALSE;
+ }
+}
+
static INLINE int
nv50_format(enum pipe_format format)
{
@@ -47,9 +68,12 @@ nv50_format(enum pipe_format format)
return NV50_2D_DST_FORMAT_R5G6B5_UNORM;
case PIPE_FORMAT_B5G5R5A1_UNORM:
return NV50_2D_DST_FORMAT_A1R5G5B5_UNORM;
+ case PIPE_FORMAT_B10G10R10A2_UNORM:
+ return NV50_2D_DST_FORMAT_A2R10G10B10_UNORM;
case PIPE_FORMAT_A8_UNORM:
case PIPE_FORMAT_I8_UNORM:
case PIPE_FORMAT_L8_UNORM:
+ case PIPE_FORMAT_R8_UNORM:
return NV50_2D_DST_FORMAT_R8_UNORM;
case PIPE_FORMAT_R32G32B32A32_FLOAT:
return NV50_2D_DST_FORMAT_R32G32B32A32_FLOAT;
@@ -178,7 +202,9 @@ nv50_surface_copy(struct pipe_context *pipe,
struct nv50_context *nv50 = nv50_context(pipe);
struct nv50_screen *screen = nv50->screen;
- assert(src->format == dest->format);
+ assert((src->format == dest->format) ||
+ (nv50_2d_format_faithful(src->format) &&
+ nv50_2d_format_faithful(dest->format)));
nv50_surface_do_copy(screen, dest, destx, desty, src, srcx,
srcy, width, height);