Commit 243475b9 authored by Bas Nieuwenhuizen's avatar Bas Nieuwenhuizen Committed by Marge Bot
Browse files

gallium/vl: Use format plane count for sampler view creation.



Extra memory planes don't need a sampler.
Reviewed-and-Tested-by: Leo Liu's avatarLeo Liu <leo.liu@amd.com>
Part-of: <mesa/mesa!10815>
parent 720ee494
...@@ -219,6 +219,7 @@ static struct pipe_sampler_view ** ...@@ -219,6 +219,7 @@ static struct pipe_sampler_view **
vl_video_buffer_sampler_view_planes(struct pipe_video_buffer *buffer) vl_video_buffer_sampler_view_planes(struct pipe_video_buffer *buffer)
{ {
struct vl_video_buffer *buf = (struct vl_video_buffer *)buffer; struct vl_video_buffer *buf = (struct vl_video_buffer *)buffer;
unsigned num_planes = util_format_get_num_planes(buffer->buffer_format);
struct pipe_sampler_view sv_templ; struct pipe_sampler_view sv_templ;
struct pipe_context *pipe; struct pipe_context *pipe;
unsigned i; unsigned i;
...@@ -227,7 +228,7 @@ vl_video_buffer_sampler_view_planes(struct pipe_video_buffer *buffer) ...@@ -227,7 +228,7 @@ vl_video_buffer_sampler_view_planes(struct pipe_video_buffer *buffer)
pipe = buf->base.context; pipe = buf->base.context;
for (i = 0; i < buf->num_planes; ++i ) { for (i = 0; i < num_planes; ++i ) {
if (!buf->sampler_view_planes[i]) { if (!buf->sampler_view_planes[i]) {
memset(&sv_templ, 0, sizeof(sv_templ)); memset(&sv_templ, 0, sizeof(sv_templ));
u_sampler_view_default_template(&sv_templ, buf->resources[i], buf->resources[i]->format); u_sampler_view_default_template(&sv_templ, buf->resources[i], buf->resources[i]->format);
...@@ -244,7 +245,7 @@ vl_video_buffer_sampler_view_planes(struct pipe_video_buffer *buffer) ...@@ -244,7 +245,7 @@ vl_video_buffer_sampler_view_planes(struct pipe_video_buffer *buffer)
return buf->sampler_view_planes; return buf->sampler_view_planes;
error: error:
for (i = 0; i < buf->num_planes; ++i ) for (i = 0; i < num_planes; ++i )
pipe_sampler_view_reference(&buf->sampler_view_planes[i], NULL); pipe_sampler_view_reference(&buf->sampler_view_planes[i], NULL);
return NULL; return NULL;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment