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_format_s3tc.h"
31 #include "util/u_math.h"
32 #include "util/u_inlines.h"
33 #include "util/u_memory.h"
34 #include "pipebuffer/pb_buffer.h"
35 #include "radeonsi_pipe.h"
36 #include "r600_resource.h"
39 /* Copy from a full GPU texture to a transfer's staging one. */
40 static void r600_copy_to_staging_texture(struct pipe_context
*ctx
, struct r600_transfer
*rtransfer
)
42 struct pipe_transfer
*transfer
= (struct pipe_transfer
*)rtransfer
;
43 struct pipe_resource
*texture
= transfer
->resource
;
45 ctx
->resource_copy_region(ctx
, rtransfer
->staging_texture
,
46 0, 0, 0, 0, texture
, transfer
->level
,
51 /* Copy from a transfer's staging texture to a full GPU one. */
52 static void r600_copy_from_staging_texture(struct pipe_context
*ctx
, struct r600_transfer
*rtransfer
)
54 struct pipe_transfer
*transfer
= (struct pipe_transfer
*)rtransfer
;
55 struct pipe_resource
*texture
= transfer
->resource
;
58 sbox
.x
= sbox
.y
= sbox
.z
= 0;
59 sbox
.width
= transfer
->box
.width
;
60 sbox
.height
= transfer
->box
.height
;
61 /* XXX that might be wrong */
63 ctx
->resource_copy_region(ctx
, texture
, transfer
->level
,
64 transfer
->box
.x
, transfer
->box
.y
, transfer
->box
.z
,
65 rtransfer
->staging_texture
,
69 static unsigned r600_texture_get_offset(struct r600_resource_texture
*rtex
,
70 unsigned level
, unsigned layer
)
72 return rtex
->surface
.level
[level
].offset
+
73 layer
* rtex
->surface
.level
[level
].slice_size
;
76 static int r600_init_surface(struct radeon_surface
*surface
,
77 const struct pipe_resource
*ptex
,
78 unsigned array_mode
, bool is_transfer
)
80 surface
->npix_x
= ptex
->width0
;
81 surface
->npix_y
= ptex
->height0
;
82 surface
->npix_z
= ptex
->depth0
;
83 surface
->blk_w
= util_format_get_blockwidth(ptex
->format
);
84 surface
->blk_h
= util_format_get_blockheight(ptex
->format
);
86 surface
->array_size
= 1;
87 surface
->last_level
= ptex
->last_level
;
88 surface
->bpe
= util_format_get_blocksize(ptex
->format
);
89 /* align byte per element on dword */
90 if (surface
->bpe
== 3) {
93 surface
->nsamples
= 1;
96 case V_009910_ARRAY_1D_TILED_THIN1
:
97 surface
->flags
|= RADEON_SURF_SET(RADEON_SURF_MODE_1D
, MODE
);
99 case V_009910_ARRAY_2D_TILED_THIN1
:
100 surface
->flags
|= RADEON_SURF_SET(RADEON_SURF_MODE_2D
, MODE
);
102 case V_009910_ARRAY_LINEAR_ALIGNED
:
103 surface
->flags
|= RADEON_SURF_SET(RADEON_SURF_MODE_LINEAR_ALIGNED
, MODE
);
105 case V_009910_ARRAY_LINEAR_GENERAL
:
107 surface
->flags
|= RADEON_SURF_SET(RADEON_SURF_MODE_LINEAR
, MODE
);
110 switch (ptex
->target
) {
111 case PIPE_TEXTURE_1D
:
112 surface
->flags
|= RADEON_SURF_SET(RADEON_SURF_TYPE_1D
, TYPE
);
114 case PIPE_TEXTURE_RECT
:
115 case PIPE_TEXTURE_2D
:
116 surface
->flags
|= RADEON_SURF_SET(RADEON_SURF_TYPE_2D
, TYPE
);
118 case PIPE_TEXTURE_3D
:
119 surface
->flags
|= RADEON_SURF_SET(RADEON_SURF_TYPE_3D
, TYPE
);
121 case PIPE_TEXTURE_1D_ARRAY
:
122 surface
->flags
|= RADEON_SURF_SET(RADEON_SURF_TYPE_1D_ARRAY
, TYPE
);
123 surface
->array_size
= ptex
->array_size
;
125 case PIPE_TEXTURE_2D_ARRAY
:
126 surface
->flags
|= RADEON_SURF_SET(RADEON_SURF_TYPE_2D_ARRAY
, TYPE
);
127 surface
->array_size
= ptex
->array_size
;
129 case PIPE_TEXTURE_CUBE
:
130 surface
->flags
|= RADEON_SURF_SET(RADEON_SURF_TYPE_CUBEMAP
, TYPE
);
136 if (ptex
->bind
& PIPE_BIND_SCANOUT
) {
137 surface
->flags
|= RADEON_SURF_SCANOUT
;
139 if (util_format_is_depth_and_stencil(ptex
->format
) && !is_transfer
) {
140 surface
->flags
|= RADEON_SURF_ZBUFFER
;
141 surface
->flags
|= RADEON_SURF_SBUFFER
;
147 static int r600_setup_surface(struct pipe_screen
*screen
,
148 struct r600_resource_texture
*rtex
,
150 unsigned pitch_in_bytes_override
)
152 struct r600_screen
*rscreen
= (struct r600_screen
*)screen
;
155 r
= rscreen
->ws
->surface_init(rscreen
->ws
, &rtex
->surface
);
159 if (pitch_in_bytes_override
&& pitch_in_bytes_override
!= rtex
->surface
.level
[0].pitch_bytes
) {
160 /* old ddx on evergreen over estimate alignment for 1d, only 1 level
163 rtex
->surface
.level
[0].nblk_x
= pitch_in_bytes_override
/ rtex
->surface
.bpe
;
164 rtex
->surface
.level
[0].pitch_bytes
= pitch_in_bytes_override
;
165 rtex
->surface
.level
[0].slice_size
= pitch_in_bytes_override
* rtex
->surface
.level
[0].nblk_y
;
166 if (rtex
->surface
.flags
& RADEON_SURF_SBUFFER
) {
167 rtex
->surface
.stencil_offset
= rtex
->surface
.level
[0].slice_size
;
173 /* Figure out whether u_blitter will fallback to a transfer operation.
174 * If so, don't use a staging resource.
176 static boolean
permit_hardware_blit(struct pipe_screen
*screen
,
177 const struct pipe_resource
*res
)
181 if (util_format_is_depth_or_stencil(res
->format
))
182 bind
= PIPE_BIND_DEPTH_STENCIL
;
184 bind
= PIPE_BIND_RENDER_TARGET
;
186 /* hackaround for S3TC */
187 if (util_format_is_compressed(res
->format
))
190 if (!screen
->is_format_supported(screen
,
197 if (!screen
->is_format_supported(screen
,
201 PIPE_BIND_SAMPLER_VIEW
))
204 switch (res
->usage
) {
205 case PIPE_USAGE_STREAM
:
206 case PIPE_USAGE_STAGING
:
214 static boolean
r600_texture_get_handle(struct pipe_screen
* screen
,
215 struct pipe_resource
*ptex
,
216 struct winsys_handle
*whandle
)
218 struct r600_resource_texture
*rtex
= (struct r600_resource_texture
*)ptex
;
219 struct si_resource
*resource
= &rtex
->resource
;
220 struct radeon_surface
*surface
= &rtex
->surface
;
221 struct r600_screen
*rscreen
= (struct r600_screen
*)screen
;
223 rscreen
->ws
->buffer_set_tiling(resource
->buf
,
225 surface
->level
[0].mode
>= RADEON_SURF_MODE_1D
?
226 RADEON_LAYOUT_TILED
: RADEON_LAYOUT_LINEAR
,
227 surface
->level
[0].mode
>= RADEON_SURF_MODE_2D
?
228 RADEON_LAYOUT_TILED
: RADEON_LAYOUT_LINEAR
,
229 surface
->bankw
, surface
->bankh
,
231 surface
->stencil_tile_split
,
233 surface
->level
[0].pitch_bytes
);
235 return rscreen
->ws
->buffer_get_handle(resource
->buf
,
236 surface
->level
[0].pitch_bytes
, whandle
);
239 static void r600_texture_destroy(struct pipe_screen
*screen
,
240 struct pipe_resource
*ptex
)
242 struct r600_resource_texture
*rtex
= (struct r600_resource_texture
*)ptex
;
243 struct si_resource
*resource
= &rtex
->resource
;
245 if (rtex
->flushed_depth_texture
)
246 si_resource_reference((struct si_resource
**)&rtex
->flushed_depth_texture
, NULL
);
248 pb_reference(&resource
->buf
, NULL
);
252 static void *si_texture_transfer_map(struct pipe_context
*ctx
,
253 struct pipe_resource
*texture
,
256 const struct pipe_box
*box
,
257 struct pipe_transfer
**ptransfer
)
259 struct r600_context
*rctx
= (struct r600_context
*)ctx
;
260 struct r600_resource_texture
*rtex
= (struct r600_resource_texture
*)texture
;
261 struct pipe_resource resource
;
262 struct r600_transfer
*trans
;
264 boolean use_staging_texture
= FALSE
;
265 struct radeon_winsys_cs_handle
*buf
;
266 enum pipe_format format
= texture
->format
;
270 /* We cannot map a tiled texture directly because the data is
271 * in a different order, therefore we do detiling using a blit.
273 * Also, use a temporary in GTT memory for read transfers, as
274 * the CPU is much happier reading out of cached system memory
275 * than uncached VRAM.
277 if (rtex
->surface
.level
[level
].mode
!= RADEON_SURF_MODE_LINEAR_ALIGNED
&&
278 rtex
->surface
.level
[level
].mode
!= RADEON_SURF_MODE_LINEAR
)
279 use_staging_texture
= TRUE
;
281 /* XXX: Use a staging texture for uploads if the underlying BO
282 * is busy. No interface for checking that currently? so do
283 * it eagerly whenever the transfer doesn't require a readback
286 if ((usage
& PIPE_TRANSFER_WRITE
) &&
287 !(usage
& (PIPE_TRANSFER_READ
|
288 PIPE_TRANSFER_DONTBLOCK
|
289 PIPE_TRANSFER_UNSYNCHRONIZED
)))
290 use_staging_texture
= TRUE
;
292 if (!permit_hardware_blit(ctx
->screen
, texture
) ||
293 (texture
->flags
& R600_RESOURCE_FLAG_TRANSFER
))
294 use_staging_texture
= FALSE
;
296 if (use_staging_texture
&& (usage
& PIPE_TRANSFER_MAP_DIRECTLY
))
299 trans
= CALLOC_STRUCT(r600_transfer
);
302 pipe_resource_reference(&trans
->transfer
.resource
, texture
);
303 trans
->transfer
.level
= level
;
304 trans
->transfer
.usage
= usage
;
305 trans
->transfer
.box
= *box
;
307 /* XXX: only readback the rectangle which is being mapped?
309 /* XXX: when discard is true, no need to read back from depth texture
311 r
= r600_texture_depth_flush(ctx
, texture
, FALSE
);
313 R600_ERR("failed to create temporary texture to hold untiled copy\n");
314 pipe_resource_reference(&trans
->transfer
.resource
, NULL
);
318 trans
->transfer
.stride
= rtex
->flushed_depth_texture
->surface
.level
[level
].pitch_bytes
;
319 trans
->offset
= r600_texture_get_offset(rtex
->flushed_depth_texture
, level
, box
->z
);
320 } else if (use_staging_texture
) {
321 resource
.target
= PIPE_TEXTURE_2D
;
322 resource
.format
= texture
->format
;
323 resource
.width0
= box
->width
;
324 resource
.height0
= box
->height
;
326 resource
.array_size
= 1;
327 resource
.last_level
= 0;
328 resource
.nr_samples
= 0;
329 resource
.usage
= PIPE_USAGE_STAGING
;
331 resource
.flags
= R600_RESOURCE_FLAG_TRANSFER
;
332 /* For texture reading, the temporary (detiled) texture is used as
333 * a render target when blitting from a tiled texture. */
334 if (usage
& PIPE_TRANSFER_READ
) {
335 resource
.bind
|= PIPE_BIND_RENDER_TARGET
;
337 /* For texture writing, the temporary texture is used as a sampler
338 * when blitting into a tiled texture. */
339 if (usage
& PIPE_TRANSFER_WRITE
) {
340 resource
.bind
|= PIPE_BIND_SAMPLER_VIEW
;
342 /* Create the temporary texture. */
343 trans
->staging_texture
= ctx
->screen
->resource_create(ctx
->screen
, &resource
);
344 if (trans
->staging_texture
== NULL
) {
345 R600_ERR("failed to create temporary texture to hold untiled copy\n");
346 pipe_resource_reference(&trans
->transfer
.resource
, NULL
);
351 trans
->transfer
.stride
= ((struct r600_resource_texture
*)trans
->staging_texture
)
352 ->surface
.level
[0].pitch_bytes
;
353 if (usage
& PIPE_TRANSFER_READ
) {
354 r600_copy_to_staging_texture(ctx
, trans
);
355 /* Always referenced in the blit. */
356 radeonsi_flush(ctx
, NULL
, 0);
359 trans
->transfer
.stride
= rtex
->surface
.level
[level
].pitch_bytes
;
360 trans
->transfer
.layer_stride
= rtex
->surface
.level
[level
].slice_size
;
361 trans
->offset
= r600_texture_get_offset(rtex
, level
, box
->z
);
364 if (trans
->staging_texture
) {
365 buf
= si_resource(trans
->staging_texture
)->cs_buf
;
367 struct r600_resource_texture
*rtex
= (struct r600_resource_texture
*)texture
;
369 if (rtex
->flushed_depth_texture
)
370 buf
= rtex
->flushed_depth_texture
->resource
.cs_buf
;
372 buf
= si_resource(texture
)->cs_buf
;
374 offset
= trans
->offset
+
375 box
->y
/ util_format_get_blockheight(format
) * trans
->transfer
.stride
+
376 box
->x
/ util_format_get_blockwidth(format
) * util_format_get_blocksize(format
);
379 if (!(map
= rctx
->ws
->buffer_map(buf
, rctx
->cs
, usage
))) {
380 pipe_resource_reference(&trans
->staging_texture
, NULL
);
381 pipe_resource_reference(&trans
->transfer
.resource
, NULL
);
386 *ptransfer
= &trans
->transfer
;
390 static void si_texture_transfer_unmap(struct pipe_context
*ctx
,
391 struct pipe_transfer
* transfer
)
393 struct r600_transfer
*rtransfer
= (struct r600_transfer
*)transfer
;
394 struct r600_context
*rctx
= (struct r600_context
*)ctx
;
395 struct radeon_winsys_cs_handle
*buf
;
396 struct pipe_resource
*texture
= transfer
->resource
;
397 struct r600_resource_texture
*rtex
= (struct r600_resource_texture
*)texture
;
399 if (rtransfer
->staging_texture
) {
400 buf
= si_resource(rtransfer
->staging_texture
)->cs_buf
;
402 struct r600_resource_texture
*rtex
= (struct r600_resource_texture
*)transfer
->resource
;
404 if (rtex
->flushed_depth_texture
) {
405 buf
= rtex
->flushed_depth_texture
->resource
.cs_buf
;
407 buf
= si_resource(transfer
->resource
)->cs_buf
;
410 rctx
->ws
->buffer_unmap(buf
);
412 if (rtransfer
->staging_texture
) {
413 if (transfer
->usage
& PIPE_TRANSFER_WRITE
) {
414 r600_copy_from_staging_texture(ctx
, rtransfer
);
416 pipe_resource_reference(&rtransfer
->staging_texture
, NULL
);
419 if (rtex
->depth
&& !rtex
->is_flushing_texture
) {
420 if ((transfer
->usage
& PIPE_TRANSFER_WRITE
) && rtex
->flushed_depth_texture
)
421 r600_blit_push_depth(ctx
, rtex
);
424 pipe_resource_reference(&transfer
->resource
, NULL
);
428 static const struct u_resource_vtbl r600_texture_vtbl
=
430 r600_texture_get_handle
, /* get_handle */
431 r600_texture_destroy
, /* resource_destroy */
432 si_texture_transfer_map
, /* transfer_map */
433 u_default_transfer_flush_region
,/* transfer_flush_region */
434 si_texture_transfer_unmap
, /* transfer_unmap */
435 NULL
/* transfer_inline_write */
438 static struct r600_resource_texture
*
439 r600_texture_create_object(struct pipe_screen
*screen
,
440 const struct pipe_resource
*base
,
442 unsigned pitch_in_bytes_override
,
443 unsigned max_buffer_size
,
444 struct pb_buffer
*buf
,
446 struct radeon_surface
*surface
)
448 struct r600_resource_texture
*rtex
;
449 struct si_resource
*resource
;
450 struct r600_screen
*rscreen
= (struct r600_screen
*)screen
;
453 rtex
= CALLOC_STRUCT(r600_resource_texture
);
457 resource
= &rtex
->resource
;
458 resource
->b
.b
= *base
;
459 resource
->b
.vtbl
= &r600_texture_vtbl
;
460 pipe_reference_init(&resource
->b
.b
.reference
, 1);
461 resource
->b
.b
.screen
= screen
;
462 rtex
->pitch_override
= pitch_in_bytes_override
;
463 rtex
->real_format
= base
->format
;
465 /* only mark depth textures the HW can hit as depth textures */
466 if (util_format_is_depth_or_stencil(rtex
->real_format
) && permit_hardware_blit(screen
, base
))
469 rtex
->surface
= *surface
;
470 r
= r600_setup_surface(screen
, rtex
, array_mode
, pitch_in_bytes_override
);
476 /* Now create the backing buffer. */
477 if (!buf
&& alloc_bo
) {
478 unsigned base_align
= rtex
->surface
.bo_alignment
;
479 unsigned size
= rtex
->surface
.bo_size
;
481 base_align
= rtex
->surface
.bo_alignment
;
482 if (!si_init_resource(rscreen
, resource
, size
, base_align
, base
->bind
, base
->usage
)) {
488 resource
->cs_buf
= rscreen
->ws
->buffer_get_cs_handle(buf
);
489 resource
->domains
= RADEON_DOMAIN_GTT
| RADEON_DOMAIN_VRAM
;
495 struct pipe_resource
*si_texture_create(struct pipe_screen
*screen
,
496 const struct pipe_resource
*templ
)
498 struct r600_screen
*rscreen
= (struct r600_screen
*)screen
;
499 struct radeon_surface surface
;
500 unsigned array_mode
= V_009910_ARRAY_LINEAR_ALIGNED
;
504 if (!(templ
->flags
& R600_RESOURCE_FLAG_TRANSFER
) &&
505 !(templ
->bind
& PIPE_BIND_SCANOUT
)) {
506 if (permit_hardware_blit(screen
, templ
)) {
507 array_mode
= V_009910_ARRAY_2D_TILED_THIN1
;
512 r
= r600_init_surface(&surface
, templ
, array_mode
,
513 templ
->flags
& R600_RESOURCE_FLAG_TRANSFER
);
517 r
= rscreen
->ws
->surface_best(rscreen
->ws
, &surface
);
521 return (struct pipe_resource
*)r600_texture_create_object(screen
, templ
, array_mode
,
522 0, 0, NULL
, TRUE
, &surface
);
525 static struct pipe_surface
*r600_create_surface(struct pipe_context
*pipe
,
526 struct pipe_resource
*texture
,
527 const struct pipe_surface
*surf_tmpl
)
529 struct r600_resource_texture
*rtex
= (struct r600_resource_texture
*)texture
;
530 struct r600_surface
*surface
= CALLOC_STRUCT(r600_surface
);
531 unsigned level
= surf_tmpl
->u
.tex
.level
;
533 assert(surf_tmpl
->u
.tex
.first_layer
== surf_tmpl
->u
.tex
.last_layer
);
537 /* offset = r600_texture_get_offset(rtex, level, surf_tmpl->u.tex.first_layer);*/
538 pipe_reference_init(&surface
->base
.reference
, 1);
539 pipe_resource_reference(&surface
->base
.texture
, texture
);
540 surface
->base
.context
= pipe
;
541 surface
->base
.format
= surf_tmpl
->format
;
542 surface
->base
.width
= rtex
->surface
.level
[level
].npix_x
;
543 surface
->base
.height
= rtex
->surface
.level
[level
].npix_y
;
544 surface
->base
.usage
= surf_tmpl
->usage
;
545 surface
->base
.texture
= texture
;
546 surface
->base
.u
.tex
.first_layer
= surf_tmpl
->u
.tex
.first_layer
;
547 surface
->base
.u
.tex
.last_layer
= surf_tmpl
->u
.tex
.last_layer
;
548 surface
->base
.u
.tex
.level
= level
;
550 return &surface
->base
;
553 static void r600_surface_destroy(struct pipe_context
*pipe
,
554 struct pipe_surface
*surface
)
556 pipe_resource_reference(&surface
->texture
, NULL
);
560 struct pipe_resource
*si_texture_from_handle(struct pipe_screen
*screen
,
561 const struct pipe_resource
*templ
,
562 struct winsys_handle
*whandle
)
564 struct r600_screen
*rscreen
= (struct r600_screen
*)screen
;
565 struct pb_buffer
*buf
= NULL
;
567 unsigned array_mode
= V_009910_ARRAY_LINEAR_ALIGNED
;
568 enum radeon_bo_layout micro
, macro
;
569 struct radeon_surface surface
;
572 /* Support only 2D textures without mipmaps */
573 if ((templ
->target
!= PIPE_TEXTURE_2D
&& templ
->target
!= PIPE_TEXTURE_RECT
) ||
574 templ
->depth0
!= 1 || templ
->last_level
!= 0)
577 buf
= rscreen
->ws
->buffer_from_handle(rscreen
->ws
, whandle
, &stride
);
581 rscreen
->ws
->buffer_get_tiling(buf
, µ
, ¯o
,
582 &surface
.bankw
, &surface
.bankh
,
584 &surface
.stencil_tile_split
,
587 if (macro
== RADEON_LAYOUT_TILED
)
588 array_mode
= V_009910_ARRAY_2D_TILED_THIN1
;
589 else if (micro
== RADEON_LAYOUT_TILED
)
590 array_mode
= V_009910_ARRAY_1D_TILED_THIN1
;
592 array_mode
= V_009910_ARRAY_LINEAR_ALIGNED
;
594 r
= r600_init_surface(&surface
, templ
, array_mode
, 0);
598 return (struct pipe_resource
*)r600_texture_create_object(screen
, templ
, array_mode
,
599 stride
, 0, buf
, FALSE
, &surface
);
602 int r600_texture_depth_flush(struct pipe_context
*ctx
,
603 struct pipe_resource
*texture
, boolean just_create
)
605 struct r600_resource_texture
*rtex
= (struct r600_resource_texture
*)texture
;
606 struct pipe_resource resource
;
608 if (rtex
->flushed_depth_texture
)
611 resource
.target
= texture
->target
;
612 resource
.format
= texture
->format
;
613 resource
.width0
= texture
->width0
;
614 resource
.height0
= texture
->height0
;
615 resource
.depth0
= texture
->depth0
;
616 resource
.array_size
= texture
->array_size
;
617 resource
.last_level
= texture
->last_level
;
618 resource
.nr_samples
= texture
->nr_samples
;
619 resource
.usage
= PIPE_USAGE_DYNAMIC
;
620 resource
.bind
= texture
->bind
| PIPE_BIND_DEPTH_STENCIL
;
621 resource
.flags
= R600_RESOURCE_FLAG_TRANSFER
| texture
->flags
;
623 rtex
->flushed_depth_texture
= (struct r600_resource_texture
*)ctx
->screen
->resource_create(ctx
->screen
, &resource
);
624 if (rtex
->flushed_depth_texture
== NULL
) {
625 R600_ERR("failed to create temporary texture to hold untiled copy\n");
629 ((struct r600_resource_texture
*)rtex
->flushed_depth_texture
)->is_flushing_texture
= TRUE
;
634 /* XXX: only do this if the depth texture has actually changed:
636 si_blit_uncompress_depth(ctx
, rtex
);
640 void si_init_surface_functions(struct r600_context
*r600
)
642 r600
->context
.create_surface
= r600_create_surface
;
643 r600
->context
.surface_destroy
= r600_surface_destroy
;