summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/softpipe/sp_quad_depth_test.c
diff options
context:
space:
mode:
authorMorgan Armand <morgan.devel@gmail.com>2011-12-07 21:30:48 +0100
committerDave Airlie <airlied@redhat.com>2012-01-03 16:19:08 +0000
commite763b6e78825f11aa3e9e2368ba8fc47313a7848 (patch)
treef3bebf70b127e91378c52ebc3c070a3e8f09cb8e /src/gallium/drivers/softpipe/sp_quad_depth_test.c
parent2ae591bdf13f02f23471ea302b55eaccbb810dd7 (diff)
softpipe: remove the 32bits limitation on depth(-stencil) formats
This patch remove the 32bits limitation. As a side effect, it bring the support for the GL_ARB_depth_buffer_float extension. No regression have been found on piglit, and all tests for GL_ARB_depth_buffer_float pass successfully. Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_quad_depth_test.c')
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_depth_test.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/src/gallium/drivers/softpipe/sp_quad_depth_test.c b/src/gallium/drivers/softpipe/sp_quad_depth_test.c
index 4cf378e68e4..529a5ad5a4e 100644
--- a/src/gallium/drivers/softpipe/sp_quad_depth_test.c
+++ b/src/gallium/drivers/softpipe/sp_quad_depth_test.c
@@ -32,6 +32,7 @@
#include "pipe/p_defines.h"
#include "util/u_format.h"
+#include "util/u_math.h"
#include "util/u_memory.h"
#include "tgsi/tgsi_scan.h"
#include "sp_context.h"
@@ -102,6 +103,21 @@ get_depth_stencil_values( struct depth_data *data,
data->stencilVals[j] = tile->data.stencil8[y][x];
}
break;
+ case PIPE_FORMAT_Z32_FLOAT:
+ for (j = 0; j < QUAD_SIZE; j++) {
+ int x = quad->input.x0 % TILE_SIZE + (j & 1);
+ int y = quad->input.y0 % TILE_SIZE + (j >> 1);
+ data->bzzzz[j] = tile->data.depth32[y][x];
+ }
+ break;
+ case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT:
+ for (j = 0; j < QUAD_SIZE; j++) {
+ int x = quad->input.x0 % TILE_SIZE + (j & 1);
+ int y = quad->input.y0 % TILE_SIZE + (j >> 1);
+ data->bzzzz[j] = tile->data.depth64[y][x] & 0xffffffff;
+ data->stencilVals[j] = (tile->data.depth64[y][x] >> 32) & 0xff;
+ }
+ break;
default:
assert(0);
}
@@ -182,6 +198,17 @@ convert_quad_depth( struct depth_data *data,
}
}
break;
+ case PIPE_FORMAT_Z32_FLOAT:
+ case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT:
+ {
+ union fi fui;
+
+ for (j = 0; j < QUAD_SIZE; j++) {
+ fui.f = quad->output.depth[j];
+ data->qzzzz[j] = fui.ui;
+ }
+ }
+ break;
default:
assert(0);
}
@@ -207,6 +234,8 @@ convert_quad_stencil( struct depth_data *data,
case PIPE_FORMAT_X8Z24_UNORM:
case PIPE_FORMAT_S8_UINT_Z24_UNORM:
case PIPE_FORMAT_S8_UINT:
+ case PIPE_FORMAT_Z32_FLOAT:
+ case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT:
for (j = 0; j < QUAD_SIZE; j++) {
data->shader_stencil_refs[j] = ((unsigned)(quad->output.stencil[j]));
}
@@ -272,7 +301,20 @@ write_depth_stencil_values( struct depth_data *data,
tile->data.stencil8[y][x] = data->stencilVals[j];
}
break;
-
+ case PIPE_FORMAT_Z32_FLOAT:
+ for (j = 0; j < QUAD_SIZE; j++) {
+ int x = quad->input.x0 % TILE_SIZE + (j & 1);
+ int y = quad->input.y0 % TILE_SIZE + (j >> 1);
+ tile->data.depth32[y][x] = data->bzzzz[j];
+ }
+ break;
+ case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT:
+ for (j = 0; j < QUAD_SIZE; j++) {
+ int x = quad->input.x0 % TILE_SIZE + (j & 1);
+ int y = quad->input.y0 % TILE_SIZE + (j >> 1);
+ tile->data.depth64[y][x] = (uint64_t)data->bzzzz[j] | ((uint64_t)data->stencilVals[j] << 32);
+ }
+ break;
default:
assert(0);
}