summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/i915simple/i915_state.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/i915simple/i915_state.c')
-rw-r--r--src/gallium/drivers/i915simple/i915_state.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/gallium/drivers/i915simple/i915_state.c b/src/gallium/drivers/i915simple/i915_state.c
index e6c4671700..dbb33f2695 100644
--- a/src/gallium/drivers/i915simple/i915_state.c
+++ b/src/gallium/drivers/i915simple/i915_state.c
@@ -41,7 +41,6 @@
#include "i915_state_inlines.h"
#include "i915_fpc.h"
-
/* The i915 (and related graphics cores) do not support GL_CLAMP. The
* Intel drivers for "other operating systems" implement GL_CLAMP as
* GL_CLAMP_TO_EDGE, so the same is done here.
@@ -178,6 +177,7 @@ static void i915_bind_blend_state(struct pipe_context *pipe,
void *blend)
{
struct i915_context *i915 = i915_context(pipe);
+ draw_flush(i915->draw);
i915->blend = (struct i915_blend_state*)blend;
@@ -194,6 +194,7 @@ static void i915_set_blend_color( struct pipe_context *pipe,
const struct pipe_blend_color *blend_color )
{
struct i915_context *i915 = i915_context(pipe);
+ draw_flush(i915->draw);
i915->blend_color = *blend_color;
@@ -250,11 +251,17 @@ i915_create_sampler_state(struct pipe_context *pipe,
if (sampler->normalized_coords)
cso->state[1] |= SS3_NORMALIZED_COORDS;
- if (0) /* XXX not tested yet */
{
int minlod = (int) (16.0 * sampler->min_lod);
+ int maxlod = (int) (16.0 * sampler->max_lod);
minlod = CLAMP(minlod, 0, 16 * 11);
- cso->state[1] |= (minlod << SS3_MIN_LOD_SHIFT);
+ maxlod = CLAMP(maxlod, 0, 16 * 11);
+
+ if (minlod > maxlod)
+ maxlod = minlod;
+
+ cso->minlod = minlod;
+ cso->maxlod = maxlod;
}
{
@@ -280,6 +287,8 @@ static void i915_bind_sampler_states(struct pipe_context *pipe,
!memcmp(i915->sampler, sampler, num * sizeof(void *)))
return;
+ draw_flush(i915->draw);
+
for (i = 0; i < num; ++i)
i915->sampler[i] = sampler[i];
for (i = num; i < PIPE_MAX_SAMPLERS; ++i)
@@ -398,6 +407,7 @@ static void i915_bind_depth_stencil_state(struct pipe_context *pipe,
void *depth_stencil)
{
struct i915_context *i915 = i915_context(pipe);
+ draw_flush(i915->draw);
i915->depth_stencil = (const struct i915_depth_stencil_state *)depth_stencil;
@@ -415,6 +425,7 @@ static void i915_set_scissor_state( struct pipe_context *pipe,
const struct pipe_scissor_state *scissor )
{
struct i915_context *i915 = i915_context(pipe);
+ draw_flush(i915->draw);
memcpy( &i915->scissor, scissor, sizeof(*scissor) );
i915->dirty |= I915_NEW_SCISSOR;
@@ -451,6 +462,7 @@ static void
i915_bind_fs_state(struct pipe_context *pipe, void *shader)
{
struct i915_context *i915 = i915_context(pipe);
+ draw_flush(i915->draw);
i915->fs = (struct i915_fragment_shader*) shader;
@@ -506,6 +518,7 @@ static void i915_set_constant_buffer(struct pipe_context *pipe,
{
struct i915_context *i915 = i915_context(pipe);
struct pipe_winsys *ws = pipe->winsys;
+ draw_flush(i915->draw);
assert(shader < PIPE_SHADER_TYPES);
assert(index == 0);
@@ -574,6 +587,7 @@ static void i915_set_framebuffer_state(struct pipe_context *pipe,
const struct pipe_framebuffer_state *fb)
{
struct i915_context *i915 = i915_context(pipe);
+ draw_flush(i915->draw);
i915->framebuffer = *fb; /* struct copy */
@@ -586,6 +600,7 @@ static void i915_set_clip_state( struct pipe_context *pipe,
const struct pipe_clip_state *clip )
{
struct i915_context *i915 = i915_context(pipe);
+ draw_flush(i915->draw);
draw_set_clip_state(i915->draw, clip);
@@ -698,6 +713,10 @@ static void i915_set_vertex_buffers(struct pipe_context *pipe,
const struct pipe_vertex_buffer *buffers)
{
struct i915_context *i915 = i915_context(pipe);
+ /* Because we change state before the draw_set_vertex_buffers call
+ * we need a flush here, just to be sure.
+ */
+ draw_flush(i915->draw);
memcpy(i915->vertex_buffer, buffers, count * sizeof(buffers[0]));
i915->num_vertex_buffers = count;
@@ -711,6 +730,11 @@ static void i915_set_vertex_elements(struct pipe_context *pipe,
const struct pipe_vertex_element *elements)
{
struct i915_context *i915 = i915_context(pipe);
+ /* Because we change state before the draw_set_vertex_buffers call
+ * we need a flush here, just to be sure.
+ */
+ draw_flush(i915->draw);
+
i915->num_vertex_elements = count;
/* pass-through to draw module */
draw_set_vertex_elements(i915->draw, count, elements);