summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nv30/nv30_state_fb.c
diff options
context:
space:
mode:
authorPatrice Mandin <pmandin@caramail.com>2008-12-12 17:22:41 +0100
committerPatrice Mandin <pmandin@caramail.com>2008-12-12 17:22:41 +0100
commit6432d03c3d7ae21312e983fe41f4df7d66f7a3bf (patch)
tree2dce6b7da378f6811264bad571dde3c7ab14edfb /src/gallium/drivers/nv30/nv30_state_fb.c
parentfd2492d24447e461f36982da268caf0317885967 (diff)
nouveau: remove useless NOUVEAU_BO_SWIZZLED flag, copy/paste nv40 work to swizzle textures
Diffstat (limited to 'src/gallium/drivers/nv30/nv30_state_fb.c')
-rw-r--r--src/gallium/drivers/nv30/nv30_state_fb.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/src/gallium/drivers/nv30/nv30_state_fb.c b/src/gallium/drivers/nv30/nv30_state_fb.c
index d93e2bb5c8..c549b17656 100644
--- a/src/gallium/drivers/nv30/nv30_state_fb.c
+++ b/src/gallium/drivers/nv30/nv30_state_fb.c
@@ -1,5 +1,31 @@
#include "nv30_context.h"
+static INLINE int log2i(int i)
+{
+ int r = 0;
+
+ if (i & 0xffff0000) {
+ i >>= 16;
+ r += 16;
+ }
+ if (i & 0x0000ff00) {
+ i >>= 8;
+ r += 8;
+ }
+ if (i & 0x000000f0) {
+ i >>= 4;
+ r += 4;
+ }
+ if (i & 0x0000000c) {
+ i >>= 2;
+ r += 2;
+ }
+ if (i & 0x00000002) {
+ r += 1;
+ }
+ return r;
+}
+
static boolean
nv30_state_framebuffer_validate(struct nv30_context *nv30)
{
@@ -31,7 +57,18 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30)
zeta = fb->zsbuf;
}
- rt_format = NV34TCL_RT_FORMAT_TYPE_LINEAR;
+ if (!(rt[0]->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
+ assert(!(fb->width & (fb->width - 1)) && !(fb->height & (fb->height - 1)));
+ for (i = 1; i < fb->num_cbufs; i++)
+ assert(!(rt[i]->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR));
+
+ /* FIXME: NV34TCL_RT_FORMAT_LOG2_[WIDTH/HEIGHT] */
+ rt_format = NV34TCL_RT_FORMAT_TYPE_SWIZZLED |
+ log2i(fb->width) << 16 /*NV34TCL_RT_FORMAT_LOG2_WIDTH_SHIFT*/ |
+ log2i(fb->height) << 24 /*NV34TCL_RT_FORMAT_LOG2_HEIGHT_SHIFT*/;
+ }
+ else
+ rt_format = NV34TCL_RT_FORMAT_TYPE_LINEAR;
switch (colour_format) {
case PIPE_FORMAT_A8R8G8B8_UNORM: