diff options
author | Christian König <[email protected]> | 2011-04-24 19:20:33 +0200 |
---|---|---|
committer | Christian König <[email protected]> | 2011-04-24 19:29:34 +0200 |
commit | 3ea7e2713c836f23d59c4034385609e371a94c8d (patch) | |
tree | 523a78de983e49e031a566873703f5db2edf3d2d /src/gallium/auxiliary/vl/vl_context.c | |
parent | b54909910c04313fb45c4e8f39091ad73ec329f3 (diff) |
[g3dvl] start supporting different render target formats
Let's start with NV12, but anything else shouldn't be much of a problem any more.
Diffstat (limited to 'src/gallium/auxiliary/vl/vl_context.c')
-rw-r--r-- | src/gallium/auxiliary/vl/vl_context.c | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/src/gallium/auxiliary/vl/vl_context.c b/src/gallium/auxiliary/vl/vl_context.c index 1240b0b4c32..be28bb507e6 100644 --- a/src/gallium/auxiliary/vl/vl_context.c +++ b/src/gallium/auxiliary/vl/vl_context.c @@ -35,6 +35,18 @@ #include "vl_compositor.h" #include "vl_mpeg12_decoder.h" +const enum pipe_format const_resource_formats_YV12[3] = { + PIPE_FORMAT_R8_UNORM, + PIPE_FORMAT_R8_UNORM, + PIPE_FORMAT_R8_UNORM +}; + +const enum pipe_format const_resource_formats_NV12[3] = { + PIPE_FORMAT_R8_UNORM, + PIPE_FORMAT_R8G8_UNORM, + PIPE_FORMAT_NONE +}; + static void vl_context_destroy(struct pipe_video_context *context) { @@ -202,19 +214,28 @@ vl_context_create_buffer(struct pipe_video_context *context, enum pipe_video_chroma_format chroma_format, unsigned width, unsigned height) { - const enum pipe_format resource_formats[3] = { - PIPE_FORMAT_R8_UNORM, - PIPE_FORMAT_R8_UNORM, - PIPE_FORMAT_R8_UNORM - }; - struct vl_context *ctx = (struct vl_context*)context; struct pipe_video_buffer *result; unsigned buffer_width, buffer_height; + const enum pipe_format *resource_formats; + assert(context); assert(width > 0 && height > 0); - assert(buffer_format == PIPE_FORMAT_YV12); + + switch(buffer_format) { + case PIPE_FORMAT_YV12: + resource_formats = const_resource_formats_YV12; + break; + + case PIPE_FORMAT_NV12: + resource_formats = const_resource_formats_NV12; + break; + + default: + assert(0); + return NULL; + } buffer_width = ctx->pot_buffers ? util_next_power_of_two(width) : width; buffer_height = ctx->pot_buffers ? util_next_power_of_two(height) : height; |