summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2010-02-10 19:59:53 +0000
committerJosé Fonseca <jfonseca@vmware.com>2010-02-10 20:12:44 +0000
commitb44c444a0fd203004612cab86ac78ae3bef2794b (patch)
tree36037a48e4a32bf9fcb32371b94cd55a080c1b0a
parent96728bb4f3e078c190da066868dede611685f6aa (diff)
llvmpipe: Map rendertargets when bound as textures.
Fixes gearbox segfault (fdo 25960). Corruption remains.
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index 6601fa61b9..538492beba 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -45,6 +45,8 @@
#include "lp_fence.h"
#include "lp_rast.h"
#include "lp_setup_context.h"
+#include "lp_screen.h"
+#include "lp_winsys.h"
#include "draw/draw_context.h"
#include "draw/draw_vbuf.h"
@@ -472,11 +474,20 @@ lp_setup_set_sampler_textures( struct setup_context *setup,
jit_tex->width = tex->width0;
jit_tex->height = tex->height0;
jit_tex->stride = lp_tex->stride[0];
- if(!lp_tex->dt)
+ if(!lp_tex->dt) {
jit_tex->data = lp_tex->data;
- else
- /* FIXME: map the rendertarget */
- assert(0);
+ }
+ else {
+ /*
+ * XXX: Where should this be unmapped?
+ */
+
+ struct llvmpipe_screen *screen = llvmpipe_screen(tex->screen);
+ struct llvmpipe_winsys *winsys = screen->winsys;
+ jit_tex->data = winsys->displaytarget_map(winsys, lp_tex->dt,
+ PIPE_BUFFER_USAGE_CPU_READ);
+ assert(jit_tex->data);
+ }
/* the scene references this texture */
{