aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util
diff options
context:
space:
mode:
authorChristian König <[email protected]>2011-02-28 23:59:53 +0100
committerChristian König <[email protected]>2011-02-28 23:59:53 +0100
commitb97e41c7b18c363a303693fb841fe606b1106fe6 (patch)
tree5329179ac070a8e3ecc3d3e51c020e004f5b32af /src/gallium/auxiliary/util
parent77217af40d67612d1f1089ca188393d27a8a038f (diff)
parent5f44fab5a6ba99c287da8d01fa584763bff2565b (diff)
Merge remote branch 'origin/master' into pipe-video
Diffstat (limited to 'src/gallium/auxiliary/util')
-rw-r--r--src/gallium/auxiliary/util/u_gen_mipmap.c47
-rw-r--r--src/gallium/auxiliary/util/u_vbuf_mgr.c5
2 files changed, 45 insertions, 7 deletions
diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c
index 3b6342ad8d1..4f1b0e71934 100644
--- a/src/gallium/auxiliary/util/u_gen_mipmap.c
+++ b/src/gallium/auxiliary/util/u_gen_mipmap.c
@@ -67,7 +67,7 @@ struct gen_mipmap_state
struct pipe_vertex_element velem[2];
void *vs;
- void *fs1d, *fs2d, *fs3d, *fsCube;
+ void *fs1d, *fs2d, *fs3d, *fsCube, *fs1da, *fs2da;
struct pipe_resource *vbuf; /**< quad vertices */
unsigned vbuf_slot;
@@ -1321,6 +1321,13 @@ util_create_gen_mipmap(struct pipe_context *pipe,
TGSI_INTERPOLATE_LINEAR);
ctx->fsCube = util_make_fragment_tex_shader(pipe, TGSI_TEXTURE_CUBE,
TGSI_INTERPOLATE_LINEAR);
+ if (pipe->screen->get_param(pipe->screen, PIPE_CAP_ARRAY_TEXTURES)) {
+ ctx->fs1da = util_make_fragment_tex_shader(pipe, TGSI_TEXTURE_1D_ARRAY,
+ TGSI_INTERPOLATE_LINEAR);
+ ctx->fs2da = util_make_fragment_tex_shader(pipe, TGSI_TEXTURE_2D_ARRAY,
+ TGSI_INTERPOLATE_LINEAR);
+ }
+
/* vertex data that doesn't change */
for (i = 0; i < 4; i++) {
@@ -1390,8 +1397,25 @@ set_vertex_data(struct gen_mipmap_state *ctx,
util_map_texcoords2d_onto_cubemap(layer, &st[0][0], 2,
&ctx->vertices[0][1][0], 8);
}
- else {
- /* 1D/2D/3D */
+ else if (tex_target == PIPE_TEXTURE_1D_ARRAY) {
+ /* 1D texture array */
+ ctx->vertices[0][1][0] = 0.0f; /*s*/
+ ctx->vertices[0][1][1] = r; /*t*/
+ ctx->vertices[0][1][2] = 0.0f; /*r*/
+
+ ctx->vertices[1][1][0] = 1.0f;
+ ctx->vertices[1][1][1] = r;
+ ctx->vertices[1][1][2] = 0.0f;
+
+ ctx->vertices[2][1][0] = 1.0f;
+ ctx->vertices[2][1][1] = r;
+ ctx->vertices[2][1][2] = 0.0f;
+
+ ctx->vertices[3][1][0] = 0.0f;
+ ctx->vertices[3][1][1] = r;
+ ctx->vertices[3][1][2] = 0.0f;
+ } else {
+ /* 1D/2D/3D/2D array */
ctx->vertices[0][1][0] = 0.0f; /*s*/
ctx->vertices[0][1][1] = 0.0f; /*t*/
ctx->vertices[0][1][2] = r; /*r*/
@@ -1427,6 +1451,10 @@ util_destroy_gen_mipmap(struct gen_mipmap_state *ctx)
{
struct pipe_context *pipe = ctx->pipe;
+ if (ctx->fs2da)
+ pipe->delete_fs_state(pipe, ctx->fs2da);
+ if (ctx->fs1da)
+ pipe->delete_fs_state(pipe, ctx->fs1da);
pipe->delete_fs_state(pipe, ctx->fsCube);
pipe->delete_fs_state(pipe, ctx->fs3d);
pipe->delete_fs_state(pipe, ctx->fs2d);
@@ -1499,7 +1527,11 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
fs = ctx->fsCube;
break;
case PIPE_TEXTURE_1D_ARRAY:
+ fs = ctx->fs1da;
+ break;
case PIPE_TEXTURE_2D_ARRAY:
+ fs = ctx->fs2da;
+ break;
default:
assert(0);
fs = ctx->fs2d;
@@ -1555,6 +1587,8 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
if (pt->target == PIPE_TEXTURE_3D)
nr_layers = u_minify(pt->depth0, dstLevel);
+ else if (pt->target == PIPE_TEXTURE_2D_ARRAY || pt->target == PIPE_TEXTURE_1D_ARRAY)
+ nr_layers = pt->array_size;
else
nr_layers = 1;
@@ -1564,11 +1598,12 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
/* in theory with geom shaders and driver with full layer support
could do that in one go. */
layer = i;
- offset = 1.0f / (float)(nr_layers * 2);
/* XXX hmm really? */
rcoord = (float)layer / (float)nr_layers + 1.0f / (float)(nr_layers * 2);
- }
- else
+ } else if (pt->target == PIPE_TEXTURE_2D_ARRAY || pt->target == PIPE_TEXTURE_1D_ARRAY) {
+ layer = i;
+ rcoord = (float)layer;
+ } else
layer = face;
memset(&surf_templ, 0, sizeof(surf_templ));
diff --git a/src/gallium/auxiliary/util/u_vbuf_mgr.c b/src/gallium/auxiliary/util/u_vbuf_mgr.c
index dec8dd717e8..3cf8ee0831d 100644
--- a/src/gallium/auxiliary/util/u_vbuf_mgr.c
+++ b/src/gallium/auxiliary/util/u_vbuf_mgr.c
@@ -531,7 +531,10 @@ static void u_vbuf_upload_buffers(struct u_vbuf_mgr_priv *mgr,
unsigned first, size;
boolean flushed;
- if (vb->stride) {
+ if (mgr->ve->ve[i].instance_divisor) {
+ first = 0;
+ size = vb->buffer->width0;
+ } else if (vb->stride) {
first = vb->stride * min_index;
size = vb->stride * count;
} else {