summaryrefslogtreecommitdiff
path: root/lib/mesa/src/gallium/drivers/svga/svga_resource_texture.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mesa/src/gallium/drivers/svga/svga_resource_texture.c')
-rw-r--r--lib/mesa/src/gallium/drivers/svga/svga_resource_texture.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/mesa/src/gallium/drivers/svga/svga_resource_texture.c b/lib/mesa/src/gallium/drivers/svga/svga_resource_texture.c
index f2ab20edb..d7d15f99e 100644
--- a/lib/mesa/src/gallium/drivers/svga/svga_resource_texture.c
+++ b/lib/mesa/src/gallium/drivers/svga/svga_resource_texture.c
@@ -1,5 +1,5 @@
/**********************************************************
- * Copyright 2008-2009 VMware, Inc. All rights reserved.
+ * Copyright 2008-2023 VMware, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -209,7 +209,9 @@ svga_resource_get_handle(struct pipe_screen *screen,
if (texture->target == PIPE_BUFFER)
return false;
- assert(svga_texture(texture)->key.cachable == 0);
+ SVGA_DBG(DEBUG_DMA, "%s: texture=%p cachable=%d\n", __FUNCTION__,
+ texture, svga_texture(texture)->key.cachable);
+
svga_texture(texture)->key.cachable = 0;
stride = util_format_get_nblocksx(texture->format, texture->width0) *
@@ -355,7 +357,7 @@ svga_texture_transfer_map_direct(struct svga_context *svga,
else {
assert(usage & PIPE_MAP_WRITE);
if ((usage & PIPE_MAP_UNSYNCHRONIZED) == 0) {
- if (svga_is_texture_dirty(tex, st->slice, level)) {
+ if (svga_is_texture_level_dirty(tex, st->slice, level)) {
/*
* do a surface flush if the subresource has been modified
* in this command buffer.
@@ -565,14 +567,15 @@ svga_texture_transfer_map(struct pipe_context *pipe,
!(st->base.usage & PIPE_MAP_READ);
boolean was_rendered_to =
svga_was_texture_rendered_to(svga_texture(texture));
+ boolean is_dirty = svga_is_texture_dirty(svga_texture(texture));
- /* If the texture was already rendered to and upload buffer
- * is supported, then we will use upload buffer to
+ /* If the texture was already rendered to or has pending changes and
+ * upload buffer is supported, then we will use upload buffer to
* avoid the need to read back the texture content; otherwise,
* we'll first try to map directly to the GB surface, if it is blocked,
* then we'll try the upload buffer.
*/
- if (was_rendered_to && can_use_upload) {
+ if ((was_rendered_to || is_dirty) && can_use_upload) {
map = svga_texture_transfer_map_upload(svga, st);
}
else {