summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/softpipe
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/softpipe')
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_depth_test.c24
-rw-r--r--src/gallium/drivers/softpipe/sp_screen.c10
-rw-r--r--src/gallium/drivers/softpipe/sp_tex_sample.c63
-rw-r--r--src/gallium/drivers/softpipe/sp_texture.c2
-rw-r--r--src/gallium/drivers/softpipe/sp_tile_cache.c6
-rw-r--r--src/gallium/drivers/softpipe/sp_video_context.c1
6 files changed, 69 insertions, 37 deletions
diff --git a/src/gallium/drivers/softpipe/sp_quad_depth_test.c b/src/gallium/drivers/softpipe/sp_quad_depth_test.c
index dab9565443..4815a0d49f 100644
--- a/src/gallium/drivers/softpipe/sp_quad_depth_test.c
+++ b/src/gallium/drivers/softpipe/sp_quad_depth_test.c
@@ -73,8 +73,8 @@ get_depth_stencil_values( struct depth_data *data,
data->bzzzz[j] = tile->data.depth32[y][x];
}
break;
- case PIPE_FORMAT_X8Z24_UNORM:
- case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_Z24X8_UNORM:
+ case PIPE_FORMAT_Z24S8_UNORM:
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);
@@ -82,8 +82,8 @@ get_depth_stencil_values( struct depth_data *data,
data->stencilVals[j] = tile->data.depth32[y][x] >> 24;
}
break;
- case PIPE_FORMAT_Z24X8_UNORM:
- case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_X8Z24_UNORM:
+ case PIPE_FORMAT_S8Z24_UNORM:
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);
@@ -146,8 +146,8 @@ convert_quad_depth( struct depth_data *data,
}
}
break;
- case PIPE_FORMAT_X8Z24_UNORM:
- case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_Z24X8_UNORM:
+ case PIPE_FORMAT_Z24S8_UNORM:
{
float scale = (float) ((1 << 24) - 1);
@@ -156,8 +156,8 @@ convert_quad_depth( struct depth_data *data,
}
}
break;
- case PIPE_FORMAT_Z24X8_UNORM:
- case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_X8Z24_UNORM:
+ case PIPE_FORMAT_S8Z24_UNORM:
{
float scale = (float) ((1 << 24) - 1);
@@ -189,7 +189,7 @@ write_depth_stencil_values( struct depth_data *data,
tile->data.depth16[y][x] = (ushort) data->bzzzz[j];
}
break;
- case PIPE_FORMAT_X8Z24_UNORM:
+ case PIPE_FORMAT_Z24X8_UNORM:
case PIPE_FORMAT_Z32_UNORM:
for (j = 0; j < QUAD_SIZE; j++) {
int x = quad->input.x0 % TILE_SIZE + (j & 1);
@@ -197,21 +197,21 @@ write_depth_stencil_values( struct depth_data *data,
tile->data.depth32[y][x] = data->bzzzz[j];
}
break;
- case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_Z24S8_UNORM:
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->stencilVals[j] << 24) | data->bzzzz[j];
}
break;
- case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_S8Z24_UNORM:
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] << 8) | data->stencilVals[j];
}
break;
- case PIPE_FORMAT_Z24X8_UNORM:
+ case PIPE_FORMAT_X8Z24_UNORM:
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);
diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
index 87415f4340..6ec63fe698 100644
--- a/src/gallium/drivers/softpipe/sp_screen.c
+++ b/src/gallium/drivers/softpipe/sp_screen.c
@@ -152,17 +152,17 @@ softpipe_is_format_supported( struct pipe_screen *screen,
switch(format) {
case PIPE_FORMAT_L16_UNORM:
- case PIPE_FORMAT_YCBCR_REV:
- case PIPE_FORMAT_YCBCR:
+ case PIPE_FORMAT_YUYV:
+ case PIPE_FORMAT_UYVY:
case PIPE_FORMAT_DXT1_RGB:
case PIPE_FORMAT_DXT1_RGBA:
case PIPE_FORMAT_DXT3_RGBA:
case PIPE_FORMAT_DXT5_RGBA:
case PIPE_FORMAT_Z32_FLOAT:
case PIPE_FORMAT_R8G8_SNORM:
- case PIPE_FORMAT_B6UG5SR5S_NORM:
- case PIPE_FORMAT_X8UB8UG8SR8S_NORM:
- case PIPE_FORMAT_A8B8G8R8_SNORM:
+ case PIPE_FORMAT_R5SG5SB6U_NORM:
+ case PIPE_FORMAT_R8SG8SB8UX8U_NORM:
+ case PIPE_FORMAT_R8G8B8A8_SNORM:
case PIPE_FORMAT_NONE:
return FALSE;
default:
diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c
index ecd6b39863..ef7ccf4189 100644
--- a/src/gallium/drivers/softpipe/sp_tex_sample.c
+++ b/src/gallium/drivers/softpipe/sp_tex_sample.c
@@ -55,7 +55,7 @@
static INLINE float
frac(float f)
{
- return f - util_ifloor(f);
+ return f - floorf(f);
}
@@ -201,11 +201,9 @@ wrap_nearest_mirror_repeat(const float s[4], unsigned size, int icoord[4])
const float max = 1.0F - min;
for (ch = 0; ch < 4; ch++) {
const int flr = util_ifloor(s[ch]);
- float u;
+ float u = frac(s[ch]);
if (flr & 1)
- u = 1.0F - (s[ch] - (float) flr);
- else
- u = s[ch] - (float) flr;
+ u = 1.0F - u;
if (u < min)
icoord[ch] = 0;
else if (u > max)
@@ -358,11 +356,9 @@ wrap_linear_mirror_repeat(const float s[4], unsigned size,
uint ch;
for (ch = 0; ch < 4; ch++) {
const int flr = util_ifloor(s[ch]);
- float u;
+ float u = frac(s[ch]);
if (flr & 1)
- u = 1.0F - (s[ch] - (float) flr);
- else
- u = s[ch] - (float) flr;
+ u = 1.0F - u;
u = u * size - 0.5F;
icoord0[ch] = util_ifloor(u);
icoord1[ch] = icoord0[ch] + 1;
@@ -441,8 +437,7 @@ wrap_linear_mirror_clamp_to_border(const float s[4], unsigned size,
/**
- * For RECT textures / unnormalized texcoords
- * Only a subset of wrap modes supported.
+ * PIPE_TEX_WRAP_CLAMP for nearest sampling, unnormalized coords.
*/
static void
wrap_nearest_unorm_clamp(const float s[4], unsigned size, int icoord[4])
@@ -456,7 +451,7 @@ wrap_nearest_unorm_clamp(const float s[4], unsigned size, int icoord[4])
/**
- * Handles clamp_to_edge and clamp_to_border:
+ * PIPE_TEX_WRAP_CLAMP_TO_BORDER for nearest sampling, unnormalized coords.
*/
static void
wrap_nearest_unorm_clamp_to_border(const float s[4], unsigned size,
@@ -464,14 +459,27 @@ wrap_nearest_unorm_clamp_to_border(const float s[4], unsigned size,
{
uint ch;
for (ch = 0; ch < 4; ch++) {
+ icoord[ch]= util_ifloor( CLAMP(s[ch], -0.5F, (float) size + 0.5F) );
+ }
+}
+
+
+/**
+ * PIPE_TEX_WRAP_CLAMP_TO_EDGE for nearest sampling, unnormalized coords.
+ */
+static void
+wrap_nearest_unorm_clamp_to_edge(const float s[4], unsigned size,
+ int icoord[4])
+{
+ uint ch;
+ for (ch = 0; ch < 4; ch++) {
icoord[ch]= util_ifloor( CLAMP(s[ch], 0.5F, (float) size - 0.5F) );
}
}
/**
- * For RECT textures / unnormalized texcoords.
- * Only a subset of wrap modes supported.
+ * PIPE_TEX_WRAP_CLAMP for linear sampling, unnormalized coords.
*/
static void
wrap_linear_unorm_clamp(const float s[4], unsigned size,
@@ -488,13 +496,36 @@ wrap_linear_unorm_clamp(const float s[4], unsigned size,
}
+/**
+ * PIPE_TEX_WRAP_CLAMP_TO_BORDER for linear sampling, unnormalized coords.
+ */
static void
wrap_linear_unorm_clamp_to_border(const float s[4], unsigned size,
int icoord0[4], int icoord1[4], float w[4])
{
uint ch;
for (ch = 0; ch < 4; ch++) {
- float u = CLAMP(s[ch], 0.5F, (float) size - 0.5F);
+ float u = CLAMP(s[ch], -0.5F, (float) size + 0.5F);
+ u -= 0.5F;
+ icoord0[ch] = util_ifloor(u);
+ icoord1[ch] = icoord0[ch] + 1;
+ if (icoord1[ch] > (int) size - 1)
+ icoord1[ch] = size - 1;
+ w[ch] = frac(u);
+ }
+}
+
+
+/**
+ * PIPE_TEX_WRAP_CLAMP_TO_EDGE for linear sampling, unnormalized coords.
+ */
+static void
+wrap_linear_unorm_clamp_to_edge(const float s[4], unsigned size,
+ int icoord0[4], int icoord1[4], float w[4])
+{
+ uint ch;
+ for (ch = 0; ch < 4; ch++) {
+ float u = CLAMP(s[ch], +0.5F, (float) size - 0.5F);
u -= 0.5F;
icoord0[ch] = util_ifloor(u);
icoord1[ch] = icoord0[ch] + 1;
@@ -1711,6 +1742,7 @@ get_nearest_unorm_wrap(unsigned mode)
case PIPE_TEX_WRAP_CLAMP:
return wrap_nearest_unorm_clamp;
case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
+ return wrap_nearest_unorm_clamp_to_edge;
case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
return wrap_nearest_unorm_clamp_to_border;
default:
@@ -1754,6 +1786,7 @@ get_linear_unorm_wrap(unsigned mode)
case PIPE_TEX_WRAP_CLAMP:
return wrap_linear_unorm_clamp;
case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
+ return wrap_linear_unorm_clamp_to_edge;
case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
return wrap_linear_unorm_clamp_to_border;
default:
diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c
index 44710d9992..6ea060023d 100644
--- a/src/gallium/drivers/softpipe/sp_texture.c
+++ b/src/gallium/drivers/softpipe/sp_texture.c
@@ -427,7 +427,7 @@ softpipe_video_surface_create(struct pipe_screen *screen,
memset(&template, 0, sizeof(struct pipe_texture));
template.target = PIPE_TEXTURE_2D;
- template.format = PIPE_FORMAT_X8R8G8B8_UNORM;
+ template.format = PIPE_FORMAT_B8G8R8X8_UNORM;
template.last_level = 0;
/* vl_mpeg12_mc_renderer expects this when it's initialized with pot_buffers=true */
template.width0 = util_next_power_of_two(width);
diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c
index 1b50bd7ffe..3b30954ac8 100644
--- a/src/gallium/drivers/softpipe/sp_tile_cache.c
+++ b/src/gallium/drivers/softpipe/sp_tile_cache.c
@@ -162,10 +162,10 @@ sp_tile_cache_set_surface(struct softpipe_tile_cache *tc,
PIPE_TRANSFER_READ_WRITE,
0, 0, ps->width, ps->height);
- tc->depth_stencil = (ps->format == PIPE_FORMAT_S8Z24_UNORM ||
- ps->format == PIPE_FORMAT_X8Z24_UNORM ||
- ps->format == PIPE_FORMAT_Z24S8_UNORM ||
+ tc->depth_stencil = (ps->format == PIPE_FORMAT_Z24S8_UNORM ||
ps->format == PIPE_FORMAT_Z24X8_UNORM ||
+ ps->format == PIPE_FORMAT_S8Z24_UNORM ||
+ ps->format == PIPE_FORMAT_X8Z24_UNORM ||
ps->format == PIPE_FORMAT_Z16_UNORM ||
ps->format == PIPE_FORMAT_Z32_UNORM ||
ps->format == PIPE_FORMAT_S8_UNORM);
diff --git a/src/gallium/drivers/softpipe/sp_video_context.c b/src/gallium/drivers/softpipe/sp_video_context.c
index 272ad40a90..242aaac466 100644
--- a/src/gallium/drivers/softpipe/sp_video_context.c
+++ b/src/gallium/drivers/softpipe/sp_video_context.c
@@ -176,7 +176,6 @@ init_pipe_state(struct sp_mpeg12_context *ctx)
rast.line_stipple_factor = 0;
rast.line_stipple_pattern = 0;
rast.line_last_pixel = 0;
- rast.bypass_vs_clip_and_viewport = 0;
rast.line_width = 1;
rast.point_smooth = 0;
rast.point_quad_rasterization = 0;