projects
/
profile
/
ivi
/
mesa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d105654
)
r600g: split flushed depth texture creation and flushing
author
Marek Olšák
<maraeo@gmail.com>
Mon, 25 Jun 2012 10:45:32 +0000
(12:45 +0200)
committer
Marek Olšák
<maraeo@gmail.com>
Mon, 25 Jun 2012 21:53:49 +0000
(23:53 +0200)
src/gallium/drivers/r600/evergreen_state.c
patch
|
blob
|
history
src/gallium/drivers/r600/r600_blit.c
patch
|
blob
|
history
src/gallium/drivers/r600/r600_resource.h
patch
|
blob
|
history
src/gallium/drivers/r600/r600_state.c
patch
|
blob
|
history
src/gallium/drivers/r600/r600_texture.c
patch
|
blob
|
history
diff --git
a/src/gallium/drivers/r600/evergreen_state.c
b/src/gallium/drivers/r600/evergreen_state.c
index
b618ca8
..
d6ed20d
100644
(file)
--- a/
src/gallium/drivers/r600/evergreen_state.c
+++ b/
src/gallium/drivers/r600/evergreen_state.c
@@
-988,8
+988,12
@@
static struct pipe_sampler_view *evergreen_create_sampler_view(struct pipe_conte
}
if (tmp->is_depth && !tmp->is_flushing_texture) {
}
if (tmp->is_depth && !tmp->is_flushing_texture) {
- r600_
texture_depth_flush(ctx, texture, TRUE
);
+ r600_
init_flushed_depth_texture(ctx, texture
);
tmp = tmp->flushed_depth_texture;
tmp = tmp->flushed_depth_texture;
+ if (!tmp) {
+ FREE(view);
+ return NULL;
+ }
}
endian = r600_colorformat_endian_swap(format);
}
endian = r600_colorformat_endian_swap(format);
@@
-1310,8
+1314,9
@@
static void evergreen_cb(struct r600_context *rctx, struct r600_pipe_state *rsta
rctx->have_depth_fb = TRUE;
if (rtex->is_depth && !rtex->is_flushing_texture) {
rctx->have_depth_fb = TRUE;
if (rtex->is_depth && !rtex->is_flushing_texture) {
- r600_
texture_depth_flush(&rctx->context, state->cbufs[cb]->texture, TRUE
);
+ r600_
init_flushed_depth_texture(&rctx->context, state->cbufs[cb]->texture
);
rtex = rtex->flushed_depth_texture;
rtex = rtex->flushed_depth_texture;
+ assert(rtex);
}
/* XXX quite sure for dx10+ hw don't need any offset hacks */
}
/* XXX quite sure for dx10+ hw don't need any offset hacks */
diff --git
a/src/gallium/drivers/r600/r600_blit.c
b/src/gallium/drivers/r600/r600_blit.c
index
1122f3e
..
6437f31
100644
(file)
--- a/
src/gallium/drivers/r600/r600_blit.c
+++ b/
src/gallium/drivers/r600/r600_blit.c
@@
-342,7
+342,7
@@
static void r600_resource_copy_region(struct pipe_context *ctx,
}
if (rsrc->is_depth && !rsrc->is_flushing_texture)
}
if (rsrc->is_depth && !rsrc->is_flushing_texture)
- r600_texture_depth_flush(ctx, src
, FALSE
);
+ r600_texture_depth_flush(ctx, src);
restore_orig[0] = restore_orig[1] = FALSE;
restore_orig[0] = restore_orig[1] = FALSE;
diff --git
a/src/gallium/drivers/r600/r600_resource.h
b/src/gallium/drivers/r600/r600_resource.h
index
d401e40
..
13fce00
100644
(file)
--- a/
src/gallium/drivers/r600/r600_resource.h
+++ b/
src/gallium/drivers/r600/r600_resource.h
@@
-87,7
+87,10
@@
static INLINE struct r600_resource *r600_resource(struct pipe_resource *r)
return (struct r600_resource*)r;
}
return (struct r600_resource*)r;
}
-int r600_texture_depth_flush(struct pipe_context *ctx, struct pipe_resource *texture, boolean just_create);
+void r600_init_flushed_depth_texture(struct pipe_context *ctx,
+ struct pipe_resource *texture);
+void r600_texture_depth_flush(struct pipe_context *ctx,
+ struct pipe_resource *texture);
/* r600_texture.c texture transfer functions. */
struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx,
/* r600_texture.c texture transfer functions. */
struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx,
diff --git
a/src/gallium/drivers/r600/r600_state.c
b/src/gallium/drivers/r600/r600_state.c
index
fc75781
..
3ac9b8d
100644
(file)
--- a/
src/gallium/drivers/r600/r600_state.c
+++ b/
src/gallium/drivers/r600/r600_state.c
@@
-1000,8
+1000,12
@@
static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c
}
if (tmp->is_depth && !tmp->is_flushing_texture) {
}
if (tmp->is_depth && !tmp->is_flushing_texture) {
- r600_
texture_depth_flush(ctx, texture, TRUE
);
+ r600_
init_flushed_depth_texture(ctx, texture
);
tmp = tmp->flushed_depth_texture;
tmp = tmp->flushed_depth_texture;
+ if (!tmp) {
+ FREE(view);
+ return NULL;
+ }
}
endian = r600_colorformat_endian_swap(format);
}
endian = r600_colorformat_endian_swap(format);
diff --git
a/src/gallium/drivers/r600/r600_texture.c
b/src/gallium/drivers/r600/r600_texture.c
index
fe9a923
..
10f47ec
100644
(file)
--- a/
src/gallium/drivers/r600/r600_texture.c
+++ b/
src/gallium/drivers/r600/r600_texture.c
@@
-728,14
+728,14
@@
struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen,
stride, 0, buf, FALSE, &surface);
}
stride, 0, buf, FALSE, &surface);
}
-
int r600_texture_depth_flush
(struct pipe_context *ctx,
-
struct pipe_resource *texture, boolean just_creat
e)
+
void r600_init_flushed_depth_texture
(struct pipe_context *ctx,
+
struct pipe_resource *textur
e)
{
struct r600_resource_texture *rtex = (struct r600_resource_texture*)texture;
struct pipe_resource resource;
if (rtex->flushed_depth_texture)
{
struct r600_resource_texture *rtex = (struct r600_resource_texture*)texture;
struct pipe_resource resource;
if (rtex->flushed_depth_texture)
- goto out;
+ return; /* it's ready */
resource.target = texture->target;
resource.format = texture->format;
resource.target = texture->target;
resource.format = texture->format;
@@
-752,18
+752,25
@@
int r600_texture_depth_flush(struct pipe_context *ctx,
rtex->flushed_depth_texture = (struct r600_resource_texture *)ctx->screen->resource_create(ctx->screen, &resource);
if (rtex->flushed_depth_texture == NULL) {
R600_ERR("failed to create temporary texture to hold untiled copy\n");
rtex->flushed_depth_texture = (struct r600_resource_texture *)ctx->screen->resource_create(ctx->screen, &resource);
if (rtex->flushed_depth_texture == NULL) {
R600_ERR("failed to create temporary texture to hold untiled copy\n");
- return
-ENOMEM
;
+ return;
}
((struct r600_resource_texture *)rtex->flushed_depth_texture)->is_flushing_texture = TRUE;
}
((struct r600_resource_texture *)rtex->flushed_depth_texture)->is_flushing_texture = TRUE;
-out:
- if (just_create)
- return 0;
+}
+
+void r600_texture_depth_flush(struct pipe_context *ctx,
+ struct pipe_resource *texture)
+{
+ struct r600_resource_texture *rtex = (struct r600_resource_texture*)texture;
+
+ r600_init_flushed_depth_texture(ctx, texture);
+
+ if (!rtex->flushed_depth_texture)
+ return; /* error */
/* XXX: only do this if the depth texture has actually changed:
*/
r600_blit_uncompress_depth(ctx, rtex);
/* XXX: only do this if the depth texture has actually changed:
*/
r600_blit_uncompress_depth(ctx, rtex);
- return 0;
}
/* Needs adjustment for pixelformat:
}
/* Needs adjustment for pixelformat:
@@
-783,7
+790,6
@@
struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx,
struct r600_resource_texture *rtex = (struct r600_resource_texture*)texture;
struct pipe_resource resource;
struct r600_transfer *trans;
struct r600_resource_texture *rtex = (struct r600_resource_texture*)texture;
struct pipe_resource resource;
struct r600_transfer *trans;
- int r;
boolean use_staging_texture = FALSE;
/* We cannot map a tiled texture directly because the data is
boolean use_staging_texture = FALSE;
/* We cannot map a tiled texture directly because the data is
@@
-828,8
+834,8
@@
struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx,
*/
/* XXX: when discard is true, no need to read back from depth texture
*/
*/
/* XXX: when discard is true, no need to read back from depth texture
*/
- r
= r600_texture_depth_flush(ctx, texture, FALSE
);
- if (
r < 0
) {
+ r
600_texture_depth_flush(ctx, texture
);
+ if (
!rtex->flushed_depth_texture
) {
R600_ERR("failed to create temporary texture to hold untiled copy\n");
pipe_resource_reference(&trans->transfer.resource, NULL);
FREE(trans);
R600_ERR("failed to create temporary texture to hold untiled copy\n");
pipe_resource_reference(&trans->transfer.resource, NULL);
FREE(trans);