summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/r300/r300_context.c
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2010-06-21 00:42:06 +0200
committerMarek Olšák <maraeo@gmail.com>2010-06-21 04:07:11 +0200
commitd82f6253331abf09ca714b844b1a9179ed8050b3 (patch)
tree22f4004ee529baa4aaa7e71d48db232d335131d9 /src/gallium/drivers/r300/r300_context.c
parent646e9c2fd7b5974480fcbed0bef7281b4d4a0e65 (diff)
r300g: fix the KIL opcode for r3xx-r4xx (v4)
Diffstat (limited to 'src/gallium/drivers/r300/r300_context.c')
-rw-r--r--src/gallium/drivers/r300/r300_context.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 0fae19dfd7..ee86f8230f 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -23,6 +23,7 @@
#include "draw/draw_context.h"
#include "util/u_memory.h"
+#include "util/u_sampler.h"
#include "util/u_simple_list.h"
#include "util/u_upload_mgr.h"
@@ -42,6 +43,12 @@ static void r300_destroy_context(struct pipe_context* context)
struct r300_query *query, *temp;
struct r300_atom *atom;
+ if (r300->texkill_sampler) {
+ pipe_sampler_view_reference(
+ (struct pipe_sampler_view**)r300->texkill_sampler,
+ NULL);
+ }
+
util_blitter_destroy(r300->blitter);
draw_destroy(r300->draw);
@@ -251,6 +258,35 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
r300_init_states(&r300->context);
+ /* The KIL opcode needs the first texture unit to be enabled
+ * on r3xx-r4xx. In order to calm down the CS checker, we bind this
+ * dummy texture there. */
+ if (!r300->screen->caps.is_r500) {
+ struct pipe_resource *tex;
+ struct pipe_resource rtempl = {{0}};
+ struct pipe_sampler_view vtempl = {{0}};
+
+ rtempl.target = PIPE_TEXTURE_2D;
+ rtempl.format = PIPE_FORMAT_I8_UNORM;
+ rtempl.bind = PIPE_BIND_SAMPLER_VIEW;
+ rtempl.width0 = 1;
+ rtempl.height0 = 1;
+ rtempl.depth0 = 1;
+ tex = screen->resource_create(screen, &rtempl);
+
+ u_sampler_view_default_template(&vtempl, tex, tex->format);
+
+ r300->texkill_sampler = (struct r300_sampler_view*)
+ r300->context.create_sampler_view(&r300->context, tex, &vtempl);
+
+ pipe_resource_reference(&tex, NULL);
+
+ /* This will make sure that the dummy texture is set up
+ * from the beginning even if an application does not use
+ * textures. */
+ r300->textures_state.dirty = TRUE;
+ }
+
return &r300->context;
no_upload_ib: