summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej Cencora <m.cencora@gmail.com>2009-11-03 23:27:25 +0100
committerMaciej Cencora <m.cencora@gmail.com>2009-11-04 19:46:11 +0100
commit4f79442d8fc1c972e1d2056b999d7cc565624e31 (patch)
tree28291303aaa46e35adce98bb5b11562eaaf771d1
parentdcd84d05e6bc39ae61e9eb3b717d0a1d79358234 (diff)
r300g: texrect WIPr300g-vbo
-rw-r--r--src/gallium/drivers/r300/r300_context.h1
-rw-r--r--src/gallium/drivers/r300/r300_emit.c31
-rw-r--r--src/gallium/drivers/r300/r300_state.c3
3 files changed, 33 insertions, 2 deletions
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index 660fb308d1..869e944387 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -87,6 +87,7 @@ struct r300_rs_block {
};
struct r300_sampler_state {
+ struct pipe_sampler_state base;
uint32_t filter0; /* R300_TX_FILTER0: 0x4400 */
uint32_t filter1; /* R300_TX_FILTER1: 0x4440 */
uint32_t border_color; /* R300_TX_BORDER_COLOR: 0x45c0 */
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index f0a5e65a3b..06927e21ae 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -123,12 +123,25 @@ void r300_emit_dsa_state(struct r300_context* r300,
END_CS;
}
+static void get_tex_size_no_border(
+ struct r300_context * r300,
+ unsigned tex_id,
+ unsigned * width,
+ unsigned * height)
+{
+ struct r300_texture *tex = r300->textures[tex_id];
+ struct r300_sampler_state *sampler = r300->sampler_states[tex_id];
+ *width = tex->tex.width[0] - 2 * (sampler->base.wrap_s == PIPE_TEX_WRAP_CLAMP_TO_BORDER);
+ *height = tex->tex.height[0] - 2 * (sampler->base.wrap_t == PIPE_TEX_WRAP_CLAMP_TO_BORDER);
+}
+
static const float * get_shader_constant(
struct r300_context * r300,
struct rc_constant * constant,
struct r300_constant_buffer * externals)
{
static const float zero[4] = { 0.0, 0.0, 0.0, 0.0 };
+ static float tmp_buf[4] = { 0.0, 0.0, 0.0, 0.0 };
switch(constant->Type) {
case RC_CONSTANT_EXTERNAL:
return externals->constants[constant->u.External];
@@ -136,6 +149,24 @@ static const float * get_shader_constant(
case RC_CONSTANT_IMMEDIATE:
return constant->u.Immediate;
+ case RC_CONSTANT_STATE:
+ switch (constant->u.State[0])
+ {
+ case RC_STATE_R300_TEXRECT_FACTOR:
+ {
+ unsigned width2, height2;
+ get_tex_size_no_border(r300, constant->u.State[1], &width2, &height2);
+ tmp_buf[0] = 1.0 / width2;
+ tmp_buf[1] = 1.0 / height2;
+ tmp_buf[2] = tmp_buf[3] = 1.0;
+ break;
+ }
+ default:
+ assert(0);
+ break;
+ }
+ return tmp_buf;
+
default:
debug_printf("r300: Implementation error: Unhandled constant type %i\n",
constant->Type);
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index f45687c313..1700d1d469 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -471,6 +471,7 @@ static void*
{
struct r300_context* r300 = r300_context(pipe);
struct r300_sampler_state* sampler = CALLOC_STRUCT(r300_sampler_state);
+ sampler->base = *state;
int lod_bias;
sampler->filter0 |=
@@ -536,8 +537,6 @@ static void r300_set_sampler_textures(struct pipe_context* pipe,
if (count > 8) {
return;
}
-
- r300->context.flush(&r300->context, 0, NULL);
for (i = 0; i < count; i++) {
if (r300->textures[i] != (struct r300_texture*)texture[i]) {