2 * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21 * USE OR OTHER DEALINGS IN THE SOFTWARE.
28 #include <pipe/p_screen.h>
29 #include <util/u_format.h>
30 #include <util/u_math.h>
31 #include <util/u_inlines.h>
32 #include <util/u_memory.h>
33 #include "state_tracker/drm_driver.h"
34 #include "r600_pipe.h"
35 #include "r600_resource.h"
36 #include "r600_state_inlines.h"
38 #include "r600_formats.h"
40 extern struct u_resource_vtbl r600_texture_vtbl
;
42 /* Copy from a tiled texture to a detiled one. */
43 static void r600_copy_from_tiled_texture(struct pipe_context
*ctx
, struct r600_transfer
*rtransfer
)
45 struct pipe_transfer
*transfer
= (struct pipe_transfer
*)rtransfer
;
46 struct pipe_resource
*texture
= transfer
->resource
;
47 struct pipe_subresource subdst
;
51 ctx
->resource_copy_region(ctx
, rtransfer
->linear_texture
,
52 subdst
, 0, 0, 0, texture
, transfer
->sr
,
53 transfer
->box
.x
, transfer
->box
.y
, transfer
->box
.z
,
54 transfer
->box
.width
, transfer
->box
.height
);
58 /* Copy from a detiled texture to a tiled one. */
59 static void r600_copy_into_tiled_texture(struct pipe_context
*ctx
, struct r600_transfer
*rtransfer
)
61 struct pipe_transfer
*transfer
= (struct pipe_transfer
*)rtransfer
;
62 struct pipe_resource
*texture
= transfer
->resource
;
63 struct pipe_subresource subsrc
;
67 ctx
->resource_copy_region(ctx
, texture
, transfer
->sr
,
68 transfer
->box
.x
, transfer
->box
.y
, transfer
->box
.z
,
69 rtransfer
->linear_texture
, subsrc
,
71 transfer
->box
.width
, transfer
->box
.height
);
73 ctx
->flush(ctx
, 0, NULL
);
76 static unsigned r600_texture_get_offset(struct r600_resource_texture
*rtex
,
77 unsigned level
, unsigned zslice
,
80 unsigned offset
= rtex
->offset
[level
];
82 switch (rtex
->resource
.base
.b
.target
) {
85 return offset
+ zslice
* rtex
->layer_size
[level
];
86 case PIPE_TEXTURE_CUBE
:
88 return offset
+ face
* rtex
->layer_size
[level
];
90 assert(zslice
== 0 && face
== 0);
95 static unsigned r600_texture_get_stride(struct pipe_screen
*screen
,
96 struct r600_resource_texture
*rtex
,
99 struct pipe_resource
*ptex
= &rtex
->resource
.base
.b
;
100 struct radeon
*radeon
= (struct radeon
*)screen
->winsys
;
101 enum chip_class chipc
= r600_get_family_class(radeon
);
102 unsigned width
, stride
;
104 if (rtex
->pitch_override
)
105 return rtex
->pitch_override
;
107 width
= u_minify(ptex
->width0
, level
);
109 stride
= util_format_get_stride(ptex
->format
, align(width
, 64));
110 if (chipc
== EVERGREEN
)
111 stride
= align(stride
, 512);
113 stride
= align(stride
, 256);
117 static unsigned r600_texture_get_nblocksy(struct pipe_screen
*screen
,
118 struct r600_resource_texture
*rtex
,
121 struct pipe_resource
*ptex
= &rtex
->resource
.base
.b
;
124 height
= u_minify(ptex
->height0
, level
);
125 height
= util_next_power_of_two(height
);
126 return util_format_get_nblocksy(ptex
->format
, height
);
129 /* Get a width in pixels from a stride in bytes. */
130 static unsigned pitch_to_width(enum pipe_format format
,
131 unsigned pitch_in_bytes
)
133 return (pitch_in_bytes
/ util_format_get_blocksize(format
)) *
134 util_format_get_blockwidth(format
);
137 static void r600_setup_miptree(struct pipe_screen
*screen
,
138 struct r600_resource_texture
*rtex
)
140 struct pipe_resource
*ptex
= &rtex
->resource
.base
.b
;
141 struct radeon
*radeon
= (struct radeon
*)screen
->winsys
;
142 enum chip_class chipc
= r600_get_family_class(radeon
);
143 unsigned pitch
, size
, layer_size
, i
, offset
;
146 for (i
= 0, offset
= 0; i
<= ptex
->last_level
; i
++) {
147 pitch
= r600_texture_get_stride(screen
, rtex
, i
);
148 nblocksy
= r600_texture_get_nblocksy(screen
, rtex
, i
);
150 layer_size
= pitch
* nblocksy
;
152 if (ptex
->target
== PIPE_TEXTURE_CUBE
) {
154 size
= layer_size
* 8;
156 size
= layer_size
* 6;
159 size
= layer_size
* u_minify(ptex
->depth0
, i
);
160 rtex
->offset
[i
] = offset
;
161 rtex
->layer_size
[i
] = layer_size
;
162 rtex
->pitch_in_bytes
[i
] = pitch
;
163 rtex
->pitch_in_pixels
[i
] = pitch_to_width(ptex
->format
, pitch
);
169 static struct r600_resource_texture
*
170 r600_texture_create_object(struct pipe_screen
*screen
,
171 const struct pipe_resource
*base
,
173 unsigned pitch_in_bytes_override
,
174 unsigned max_buffer_size
,
177 struct r600_resource_texture
*rtex
;
178 struct r600_resource
*resource
;
179 struct radeon
*radeon
= (struct radeon
*)screen
->winsys
;
181 rtex
= CALLOC_STRUCT(r600_resource_texture
);
185 resource
= &rtex
->resource
;
186 resource
->base
.b
= *base
;
187 resource
->base
.vtbl
= &r600_texture_vtbl
;
188 pipe_reference_init(&resource
->base
.b
.reference
, 1);
189 resource
->base
.b
.screen
= screen
;
191 resource
->domain
= r600_domain_from_usage(resource
->base
.b
.bind
);
192 rtex
->pitch_override
= pitch_in_bytes_override
;
193 rtex
->array_mode
= array_mode
;
195 r600_setup_miptree(screen
, rtex
);
197 resource
->size
= rtex
->size
;
200 resource
->bo
= r600_bo(radeon
, rtex
->size
, 4096, 0);
209 struct pipe_resource
*r600_texture_create(struct pipe_screen
*screen
,
210 const struct pipe_resource
*templ
)
212 unsigned array_mode
= 0;
214 return (struct pipe_resource
*)r600_texture_create_object(screen
, templ
, array_mode
,
219 static void r600_texture_destroy(struct pipe_screen
*screen
,
220 struct pipe_resource
*ptex
)
222 struct r600_resource_texture
*rtex
= (struct r600_resource_texture
*)ptex
;
223 struct r600_resource
*resource
= &rtex
->resource
;
224 struct radeon
*radeon
= (struct radeon
*)screen
->winsys
;
226 if (rtex
->flushed_depth_texture
)
227 pipe_resource_reference((struct pipe_resource
**)&rtex
->flushed_depth_texture
, NULL
);
230 r600_bo_reference(radeon
, &resource
->bo
, NULL
);
235 static struct pipe_surface
*r600_get_tex_surface(struct pipe_screen
*screen
,
236 struct pipe_resource
*texture
,
237 unsigned face
, unsigned level
,
238 unsigned zslice
, unsigned flags
)
240 struct r600_resource_texture
*rtex
= (struct r600_resource_texture
*)texture
;
241 struct pipe_surface
*surface
= CALLOC_STRUCT(pipe_surface
);
246 offset
= r600_texture_get_offset(rtex
, level
, zslice
, face
);
247 pipe_reference_init(&surface
->reference
, 1);
248 pipe_resource_reference(&surface
->texture
, texture
);
249 surface
->format
= texture
->format
;
250 surface
->width
= u_minify(texture
->width0
, level
);
251 surface
->height
= u_minify(texture
->height0
, level
);
252 surface
->offset
= offset
;
253 surface
->usage
= flags
;
254 surface
->zslice
= zslice
;
255 surface
->texture
= texture
;
256 surface
->face
= face
;
257 surface
->level
= level
;
261 static void r600_tex_surface_destroy(struct pipe_surface
*surface
)
263 pipe_resource_reference(&surface
->texture
, NULL
);
268 struct pipe_resource
*r600_texture_from_handle(struct pipe_screen
*screen
,
269 const struct pipe_resource
*templ
,
270 struct winsys_handle
*whandle
)
272 struct radeon
*rw
= (struct radeon
*)screen
->winsys
;
273 struct r600_bo
*bo
= NULL
;
275 /* Support only 2D textures without mipmaps */
276 if ((templ
->target
!= PIPE_TEXTURE_2D
&& templ
->target
!= PIPE_TEXTURE_RECT
) ||
277 templ
->depth0
!= 1 || templ
->last_level
!= 0)
280 bo
= r600_bo_handle(rw
, whandle
->handle
);
285 return (struct pipe_resource
*)r600_texture_create_object(screen
, templ
, 0,
291 static unsigned int r600_texture_is_referenced(struct pipe_context
*context
,
292 struct pipe_resource
*texture
,
293 unsigned face
, unsigned level
)
296 return PIPE_REFERENCED_FOR_READ
| PIPE_REFERENCED_FOR_WRITE
;
299 int (*r600_blit_uncompress_depth_ptr
)(struct pipe_context
*ctx
, struct r600_resource_texture
*texture
);
301 int r600_texture_depth_flush(struct pipe_context
*ctx
,
302 struct pipe_resource
*texture
)
304 struct r600_resource_texture
*rtex
= (struct r600_resource_texture
*)texture
;
305 struct pipe_resource resource
;
307 if (rtex
->flushed_depth_texture
)
310 resource
.target
= PIPE_TEXTURE_2D
;
311 resource
.format
= texture
->format
;
312 resource
.width0
= texture
->width0
;
313 resource
.height0
= texture
->height0
;
315 resource
.last_level
= 0;
316 resource
.nr_samples
= 0;
317 resource
.usage
= PIPE_USAGE_DYNAMIC
;
321 resource
.bind
|= PIPE_BIND_DEPTH_STENCIL
;
323 rtex
->flushed_depth_texture
= (struct r600_resource_texture
*)ctx
->screen
->resource_create(ctx
->screen
, &resource
);
324 if (rtex
->flushed_depth_texture
== NULL
) {
325 R600_ERR("failed to create temporary texture to hold untiled copy\n");
330 r600_blit_uncompress_depth_ptr(ctx
, rtex
);
334 struct pipe_transfer
* r600_texture_get_transfer(struct pipe_context
*ctx
,
335 struct pipe_resource
*texture
,
336 struct pipe_subresource sr
,
338 const struct pipe_box
*box
)
340 struct r600_resource_texture
*rtex
= (struct r600_resource_texture
*)texture
;
341 struct pipe_resource resource
;
342 struct r600_transfer
*trans
;
345 trans
= CALLOC_STRUCT(r600_transfer
);
348 pipe_resource_reference(&trans
->transfer
.resource
, texture
);
349 trans
->transfer
.sr
= sr
;
350 trans
->transfer
.usage
= usage
;
351 trans
->transfer
.box
= *box
;
353 r
= r600_texture_depth_flush(ctx
, texture
);
355 R600_ERR("failed to create temporary texture to hold untiled copy\n");
356 pipe_resource_reference(&trans
->transfer
.resource
, NULL
);
360 } else if (rtex
->tiled
) {
361 resource
.target
= PIPE_TEXTURE_2D
;
362 resource
.format
= texture
->format
;
363 resource
.width0
= box
->width
;
364 resource
.height0
= box
->height
;
366 resource
.last_level
= 0;
367 resource
.nr_samples
= 0;
368 resource
.usage
= PIPE_USAGE_DYNAMIC
;
371 /* For texture reading, the temporary (detiled) texture is used as
372 * a render target when blitting from a tiled texture. */
373 if (usage
& PIPE_TRANSFER_READ
) {
374 resource
.bind
|= PIPE_BIND_RENDER_TARGET
;
376 /* For texture writing, the temporary texture is used as a sampler
377 * when blitting into a tiled texture. */
378 if (usage
& PIPE_TRANSFER_WRITE
) {
379 resource
.bind
|= PIPE_BIND_SAMPLER_VIEW
;
381 /* Create the temporary texture. */
382 trans
->linear_texture
= ctx
->screen
->resource_create(ctx
->screen
, &resource
);
383 if (trans
->linear_texture
== NULL
) {
384 R600_ERR("failed to create temporary texture to hold untiled copy\n");
385 pipe_resource_reference(&trans
->transfer
.resource
, NULL
);
390 trans
->transfer
.stride
=
391 ((struct r600_resource_texture
*)trans
->linear_texture
)->pitch_in_bytes
[0];
392 if (usage
& PIPE_TRANSFER_READ
) {
393 /* We cannot map a tiled texture directly because the data is
394 * in a different order, therefore we do detiling using a blit. */
395 r600_copy_from_tiled_texture(ctx
, trans
);
396 /* Always referenced in the blit. */
397 ctx
->flush(ctx
, 0, NULL
);
399 return &trans
->transfer
;
401 trans
->transfer
.stride
= rtex
->pitch_in_bytes
[sr
.level
];
402 trans
->offset
= r600_texture_get_offset(rtex
, sr
.level
, box
->z
, sr
.face
);
403 return &trans
->transfer
;
406 void r600_texture_transfer_destroy(struct pipe_context
*ctx
,
407 struct pipe_transfer
*transfer
)
409 struct r600_transfer
*rtransfer
= (struct r600_transfer
*)transfer
;
410 struct r600_resource_texture
*rtex
= (struct r600_resource_texture
*)transfer
->resource
;
412 if (rtransfer
->linear_texture
) {
413 if (transfer
->usage
& PIPE_TRANSFER_WRITE
) {
414 r600_copy_into_tiled_texture(ctx
, rtransfer
);
416 pipe_resource_reference(&rtransfer
->linear_texture
, NULL
);
418 if (rtex
->flushed_depth_texture
) {
419 pipe_resource_reference((struct pipe_resource
**)&rtex
->flushed_depth_texture
, NULL
);
421 pipe_resource_reference(&transfer
->resource
, NULL
);
425 void* r600_texture_transfer_map(struct pipe_context
*ctx
,
426 struct pipe_transfer
* transfer
)
428 struct r600_transfer
*rtransfer
= (struct r600_transfer
*)transfer
;
430 enum pipe_format format
= transfer
->resource
->format
;
431 struct radeon
*radeon
= (struct radeon
*)ctx
->screen
->winsys
;
435 if (rtransfer
->linear_texture
) {
436 bo
= ((struct r600_resource
*)rtransfer
->linear_texture
)->bo
;
438 struct r600_resource_texture
*rtex
= (struct r600_resource_texture
*)transfer
->resource
;
440 if (rtex
->flushed_depth_texture
)
441 bo
= ((struct r600_resource
*)rtex
->flushed_depth_texture
)->bo
;
443 bo
= ((struct r600_resource
*)transfer
->resource
)->bo
;
445 offset
= rtransfer
->offset
+
446 transfer
->box
.y
/ util_format_get_blockheight(format
) * transfer
->stride
+
447 transfer
->box
.x
/ util_format_get_blockwidth(format
) * util_format_get_blocksize(format
);
449 map
= r600_bo_map(radeon
, bo
, 0, ctx
);
457 void r600_texture_transfer_unmap(struct pipe_context
*ctx
,
458 struct pipe_transfer
* transfer
)
460 struct r600_transfer
*rtransfer
= (struct r600_transfer
*)transfer
;
461 struct radeon
*radeon
= (struct radeon
*)ctx
->screen
->winsys
;
464 if (rtransfer
->linear_texture
) {
465 bo
= ((struct r600_resource
*)rtransfer
->linear_texture
)->bo
;
467 struct r600_resource_texture
*rtex
= (struct r600_resource_texture
*)transfer
->resource
;
469 if (rtex
->flushed_depth_texture
) {
470 bo
= ((struct r600_resource
*)rtex
->flushed_depth_texture
)->bo
;
472 bo
= ((struct r600_resource
*)transfer
->resource
)->bo
;
475 r600_bo_unmap(radeon
, bo
);
478 struct u_resource_vtbl r600_texture_vtbl
=
480 u_default_resource_get_handle
, /* get_handle */
481 r600_texture_destroy
, /* resource_destroy */
482 r600_texture_is_referenced
, /* is_resource_referenced */
483 r600_texture_get_transfer
, /* get_transfer */
484 r600_texture_transfer_destroy
, /* transfer_destroy */
485 r600_texture_transfer_map
, /* transfer_map */
486 u_default_transfer_flush_region
,/* transfer_flush_region */
487 r600_texture_transfer_unmap
, /* transfer_unmap */
488 u_default_transfer_inline_write
/* transfer_inline_write */
491 void r600_init_screen_texture_functions(struct pipe_screen
*screen
)
493 screen
->get_tex_surface
= r600_get_tex_surface
;
494 screen
->tex_surface_destroy
= r600_tex_surface_destroy
;
497 static unsigned r600_get_swizzle_combined(const unsigned char *swizzle_format
,
498 const unsigned char *swizzle_view
)
501 unsigned char swizzle
[4];
503 const uint32_t swizzle_shift
[4] = {
506 const uint32_t swizzle_bit
[4] = {
511 /* Combine two sets of swizzles. */
512 for (i
= 0; i
< 4; i
++) {
513 swizzle
[i
] = swizzle_view
[i
] <= UTIL_FORMAT_SWIZZLE_W
?
514 swizzle_format
[swizzle_view
[i
]] : swizzle_view
[i
];
517 memcpy(swizzle
, swizzle_format
, 4);
521 for (i
= 0; i
< 4; i
++) {
522 switch (swizzle
[i
]) {
523 case UTIL_FORMAT_SWIZZLE_Y
:
524 result
|= swizzle_bit
[1] << swizzle_shift
[i
];
526 case UTIL_FORMAT_SWIZZLE_Z
:
527 result
|= swizzle_bit
[2] << swizzle_shift
[i
];
529 case UTIL_FORMAT_SWIZZLE_W
:
530 result
|= swizzle_bit
[3] << swizzle_shift
[i
];
532 case UTIL_FORMAT_SWIZZLE_0
:
533 result
|= V_038010_SQ_SEL_0
<< swizzle_shift
[i
];
535 case UTIL_FORMAT_SWIZZLE_1
:
536 result
|= V_038010_SQ_SEL_1
<< swizzle_shift
[i
];
538 default: /* UTIL_FORMAT_SWIZZLE_X */
539 result
|= swizzle_bit
[0] << swizzle_shift
[i
];
545 /* texture format translate */
546 uint32_t r600_translate_texformat(enum pipe_format format
,
547 const unsigned char *swizzle_view
,
548 uint32_t *word4_p
, uint32_t *yuv_format_p
)
550 uint32_t result
= 0, word4
= 0, yuv_format
= 0;
551 const struct util_format_description
*desc
;
552 boolean uniform
= TRUE
;
554 const uint32_t sign_bit
[4] = {
555 S_038010_FORMAT_COMP_X(V_038010_SQ_FORMAT_COMP_SIGNED
),
556 S_038010_FORMAT_COMP_Y(V_038010_SQ_FORMAT_COMP_SIGNED
),
557 S_038010_FORMAT_COMP_Z(V_038010_SQ_FORMAT_COMP_SIGNED
),
558 S_038010_FORMAT_COMP_W(V_038010_SQ_FORMAT_COMP_SIGNED
)
560 desc
= util_format_description(format
);
562 word4
|= r600_get_swizzle_combined(desc
->swizzle
, swizzle_view
);
564 /* Colorspace (return non-RGB formats directly). */
565 switch (desc
->colorspace
) {
566 /* Depth stencil formats */
567 case UTIL_FORMAT_COLORSPACE_ZS
:
569 case PIPE_FORMAT_Z16_UNORM
:
572 case PIPE_FORMAT_X24S8_USCALED
:
573 word4
|= S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_INT
);
574 case PIPE_FORMAT_Z24X8_UNORM
:
575 case PIPE_FORMAT_Z24_UNORM_S8_USCALED
:
578 case PIPE_FORMAT_S8X24_USCALED
:
579 word4
|= S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_INT
);
580 case PIPE_FORMAT_X8Z24_UNORM
:
581 case PIPE_FORMAT_S8_USCALED_Z24_UNORM
:
584 case PIPE_FORMAT_S8_USCALED
:
585 result
= V_0280A0_COLOR_8
;
586 word4
|= S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_INT
);
592 case UTIL_FORMAT_COLORSPACE_YUV
:
593 yuv_format
|= (1 << 30);
595 case PIPE_FORMAT_UYVY
:
596 case PIPE_FORMAT_YUYV
:
600 goto out_unknown
; /* TODO */
602 case UTIL_FORMAT_COLORSPACE_SRGB
:
603 word4
|= S_038010_FORCE_DEGAMMA(1);
604 if (format
== PIPE_FORMAT_L8A8_SRGB
|| format
== PIPE_FORMAT_L8_SRGB
)
605 goto out_unknown
; /* fails for some reason - TODO */
612 /* S3TC formats. TODO */
613 if (desc
->layout
== UTIL_FORMAT_LAYOUT_S3TC
) {
618 for (i
= 0; i
< desc
->nr_channels
; i
++) {
619 if (desc
->channel
[i
].type
== UTIL_FORMAT_TYPE_SIGNED
) {
620 word4
|= sign_bit
[i
];
624 /* R8G8Bx_SNORM - TODO CxV8U8 */
628 /* See whether the components are of the same size. */
629 for (i
= 1; i
< desc
->nr_channels
; i
++) {
630 uniform
= uniform
&& desc
->channel
[0].size
== desc
->channel
[i
].size
;
633 /* Non-uniform formats. */
635 switch(desc
->nr_channels
) {
637 if (desc
->channel
[0].size
== 5 &&
638 desc
->channel
[1].size
== 6 &&
639 desc
->channel
[2].size
== 5) {
645 if (desc
->channel
[0].size
== 5 &&
646 desc
->channel
[1].size
== 5 &&
647 desc
->channel
[2].size
== 5 &&
648 desc
->channel
[3].size
== 1) {
649 result
= FMT_1_5_5_5
;
652 if (desc
->channel
[0].size
== 10 &&
653 desc
->channel
[1].size
== 10 &&
654 desc
->channel
[2].size
== 10 &&
655 desc
->channel
[3].size
== 2) {
656 result
= FMT_10_10_10_2
;
664 /* Find the first non-VOID channel. */
665 for (i
= 0; i
< 4; i
++) {
666 if (desc
->channel
[i
].type
!= UTIL_FORMAT_TYPE_VOID
) {
674 /* uniform formats */
675 switch (desc
->channel
[i
].type
) {
676 case UTIL_FORMAT_TYPE_UNSIGNED
:
677 case UTIL_FORMAT_TYPE_SIGNED
:
678 if (!desc
->channel
[i
].normalized
&&
679 desc
->colorspace
!= UTIL_FORMAT_COLORSPACE_SRGB
) {
683 switch (desc
->channel
[i
].size
) {
685 switch (desc
->nr_channels
) {
690 result
= FMT_4_4_4_4
;
695 switch (desc
->nr_channels
) {
703 result
= FMT_8_8_8_8
;
708 switch (desc
->nr_channels
) {
716 result
= FMT_16_16_16_16
;
722 case UTIL_FORMAT_TYPE_FLOAT
:
723 switch (desc
->channel
[i
].size
) {
725 switch (desc
->nr_channels
) {
727 result
= FMT_16_FLOAT
;
730 result
= FMT_16_16_FLOAT
;
733 result
= FMT_16_16_16_16_FLOAT
;
738 switch (desc
->nr_channels
) {
740 result
= FMT_32_FLOAT
;
743 result
= FMT_32_32_FLOAT
;
746 result
= FMT_32_32_32_32_FLOAT
;
756 *yuv_format_p
= yuv_format
;
759 // R600_ERR("Unable to handle texformat %d %s\n", format, util_format_name(format));