summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/vl
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2013-04-30 14:40:40 +0200
committerChristian König <christian.koenig@amd.com>2013-05-01 13:33:46 +0200
commit7d2f2a0c890b1993532a45c8c392c28950ddc06e (patch)
tree73245f57a60fc400dd78061dbcd43c26a5046ad7 /src/gallium/auxiliary/vl
parente27f87b549cf2d4cfef97958ff175862fdf494b0 (diff)
vl/buffer: use 2D_ARRAY instead of 3D textures
Signed-off-by: Christian König <christian.koenig@amd.com>
Diffstat (limited to 'src/gallium/auxiliary/vl')
-rw-r--r--src/gallium/auxiliary/vl/vl_compositor.c12
-rw-r--r--src/gallium/auxiliary/vl/vl_video_buffer.c23
-rw-r--r--src/gallium/auxiliary/vl/vl_video_buffer.h7
3 files changed, 22 insertions, 20 deletions
diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c
index 1c393a99de6..62f593a3203 100644
--- a/src/gallium/auxiliary/vl/vl_compositor.c
+++ b/src/gallium/auxiliary/vl/vl_compositor.c
@@ -152,7 +152,7 @@ create_frag_shader_video_buffer(struct vl_compositor *c)
* fragment = csc * texel
*/
for (i = 0; i < 3; ++i)
- ureg_TEX(shader, ureg_writemask(texel, TGSI_WRITEMASK_X << i), TGSI_TEXTURE_3D, tc, sampler[i]);
+ ureg_TEX(shader, ureg_writemask(texel, TGSI_WRITEMASK_X << i), TGSI_TEXTURE_2D_ARRAY, tc, sampler[i]);
ureg_MOV(shader, ureg_writemask(texel, TGSI_WRITEMASK_W), ureg_imm1f(shader, 1.0f));
@@ -207,7 +207,7 @@ create_frag_shader_weave(struct vl_compositor *c)
i_tc[i], ureg_imm1f(shader, 0.5f));
ureg_ROUND(shader, ureg_writemask(t_tc[i], TGSI_WRITEMASK_YZ), ureg_src(t_tc[i]));
ureg_MOV(shader, ureg_writemask(t_tc[i], TGSI_WRITEMASK_W),
- ureg_imm1f(shader, i ? -0.25f : 0.25f));
+ ureg_imm1f(shader, i ? 1.0f : 0.0f));
ureg_ADD(shader, ureg_writemask(t_tc[i], TGSI_WRITEMASK_YZ),
ureg_src(t_tc[i]), ureg_imm1f(shader, 0.5f));
ureg_MUL(shader, ureg_writemask(t_tc[i], TGSI_WRITEMASK_Y),
@@ -227,7 +227,7 @@ create_frag_shader_weave(struct vl_compositor *c)
TGSI_SWIZZLE_X, j ? TGSI_SWIZZLE_Z : TGSI_SWIZZLE_Y, TGSI_SWIZZLE_W, TGSI_SWIZZLE_W);
ureg_TEX(shader, ureg_writemask(t_texel[i], TGSI_WRITEMASK_X << j),
- TGSI_TEXTURE_3D, src, sampler[j]);
+ TGSI_TEXTURE_2D_ARRAY, src, sampler[j]);
}
/* calculate linear interpolation factor
@@ -558,7 +558,7 @@ static INLINE struct u_rect
default_rect(struct vl_compositor_layer *layer)
{
struct pipe_resource *res = layer->sampler_views[0]->texture;
- struct u_rect rect = { 0, res->width0, 0, res->height0 * res->depth0 };
+ struct u_rect rect = { 0, res->width0, 0, res->height0 * res->array_size };
return rect;
}
@@ -902,14 +902,14 @@ vl_compositor_set_buffer_layer(struct vl_compositor_state *s,
break;
case VL_COMPOSITOR_BOB_TOP:
- s->layers[layer].zw.x = 0.25f;
+ s->layers[layer].zw.x = 0.0f;
s->layers[layer].src.tl.y += half_a_line;
s->layers[layer].src.br.y += half_a_line;
s->layers[layer].fs = c->fs_video_buffer;
break;
case VL_COMPOSITOR_BOB_BOTTOM:
- s->layers[layer].zw.x = 0.75f;
+ s->layers[layer].zw.x = 1.0f;
s->layers[layer].src.tl.y -= half_a_line;
s->layers[layer].src.br.y -= half_a_line;
s->layers[layer].fs = c->fs_video_buffer;
diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.c b/src/gallium/auxiliary/vl/vl_video_buffer.c
index d61dab22c2d..220c3ea632f 100644
--- a/src/gallium/auxiliary/vl/vl_video_buffer.c
+++ b/src/gallium/auxiliary/vl/vl_video_buffer.c
@@ -216,15 +216,16 @@ void
vl_vide_buffer_template(struct pipe_resource *templ,
const struct pipe_video_buffer *tmpl,
enum pipe_format resource_format,
- unsigned depth, unsigned usage, unsigned plane)
+ unsigned array_size, unsigned usage,
+ unsigned plane)
{
memset(templ, 0, sizeof(*templ));
- templ->target = depth > 1 ? PIPE_TEXTURE_3D : PIPE_TEXTURE_2D;
+ templ->target = array_size > 1 ? PIPE_TEXTURE_2D_ARRAY : PIPE_TEXTURE_2D;
templ->format = resource_format;
templ->width0 = tmpl->width;
templ->height0 = tmpl->height;
- templ->depth0 = depth;
- templ->array_size = 1;
+ templ->depth0 = 1;
+ templ->array_size = array_size;
templ->bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
templ->usage = usage;
@@ -349,15 +350,15 @@ vl_video_buffer_surfaces(struct pipe_video_buffer *buffer)
struct vl_video_buffer *buf = (struct vl_video_buffer *)buffer;
struct pipe_surface surf_templ;
struct pipe_context *pipe;
- unsigned i, j, depth, surf;
+ unsigned i, j, array_size, surf;
assert(buf);
pipe = buf->base.context;
- depth = buffer->interlaced ? 2 : 1;
+ array_size = buffer->interlaced ? 2 : 1;
for (i = 0, surf = 0; i < VL_NUM_COMPONENTS; ++i) {
- for (j = 0; j < depth; ++j, ++surf) {
+ for (j = 0; j < array_size; ++j, ++surf) {
assert(surf < (VL_NUM_COMPONENTS * 2));
if (!buf->resources[i]) {
@@ -433,7 +434,7 @@ struct pipe_video_buffer *
vl_video_buffer_create_ex(struct pipe_context *pipe,
const struct pipe_video_buffer *tmpl,
const enum pipe_format resource_formats[VL_NUM_COMPONENTS],
- unsigned depth, unsigned usage)
+ unsigned array_size, unsigned usage)
{
struct pipe_resource res_tmpl;
struct pipe_resource *resources[VL_NUM_COMPONENTS];
@@ -443,7 +444,7 @@ vl_video_buffer_create_ex(struct pipe_context *pipe,
memset(resources, 0, sizeof resources);
- vl_vide_buffer_template(&res_tmpl, tmpl, resource_formats[0], depth, usage, 0);
+ vl_vide_buffer_template(&res_tmpl, tmpl, resource_formats[0], array_size, usage, 0);
resources[0] = pipe->screen->resource_create(pipe->screen, &res_tmpl);
if (!resources[0])
goto error;
@@ -453,7 +454,7 @@ vl_video_buffer_create_ex(struct pipe_context *pipe,
return vl_video_buffer_create_ex2(pipe, tmpl, resources);
}
- vl_vide_buffer_template(&res_tmpl, tmpl, resource_formats[1], depth, usage, 1);
+ vl_vide_buffer_template(&res_tmpl, tmpl, resource_formats[1], array_size, usage, 1);
resources[1] = pipe->screen->resource_create(pipe->screen, &res_tmpl);
if (!resources[1])
goto error;
@@ -461,7 +462,7 @@ vl_video_buffer_create_ex(struct pipe_context *pipe,
if (resource_formats[2] == PIPE_FORMAT_NONE)
return vl_video_buffer_create_ex2(pipe, tmpl, resources);
- vl_vide_buffer_template(&res_tmpl, tmpl, resource_formats[2], depth, usage, 2);
+ vl_vide_buffer_template(&res_tmpl, tmpl, resource_formats[2], array_size, usage, 2);
resources[2] = pipe->screen->resource_create(pipe->screen, &res_tmpl);
if (!resources[2])
goto error;
diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.h b/src/gallium/auxiliary/vl/vl_video_buffer.h
index 6e2f8b8291a..e666011aea1 100644
--- a/src/gallium/auxiliary/vl/vl_video_buffer.h
+++ b/src/gallium/auxiliary/vl/vl_video_buffer.h
@@ -98,7 +98,8 @@ void
vl_vide_buffer_template(struct pipe_resource *templ,
const struct pipe_video_buffer *templat,
enum pipe_format resource_format,
- unsigned depth, unsigned usage, unsigned plane);
+ unsigned array_size, unsigned usage,
+ unsigned plane);
/**
* creates a video buffer, can be used as a standard implementation for pipe->create_video_buffer
@@ -108,13 +109,13 @@ vl_video_buffer_create(struct pipe_context *pipe,
const struct pipe_video_buffer *templat);
/**
- * extended create function, gets depth, usage and formats for each plane seperately
+ * extended create function, gets array_size, usage and formats for each plane seperately
*/
struct pipe_video_buffer *
vl_video_buffer_create_ex(struct pipe_context *pipe,
const struct pipe_video_buffer *templat,
const enum pipe_format resource_formats[VL_NUM_COMPONENTS],
- unsigned depth, unsigned usage);
+ unsigned array_size, unsigned usage);
/**
* even more extended create function, provide the pipe_resource for each plane