aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/state_tracker')
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_array.c10
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_clip.c4
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_constbuf.c6
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_bitmap.c8
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_clear.c8
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_drawpixels.c8
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_drawtex.c5
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.c3
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.h3
-rw-r--r--mesalib/src/mesa/state_tracker/st_draw_feedback.c4
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c11
11 files changed, 46 insertions, 24 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_atom_array.c b/mesalib/src/mesa/state_tracker/st_atom_array.c
index ab46f1188..15f5d1c95 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_array.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_array.c
@@ -574,7 +574,13 @@ static void update_array(struct st_context *st)
num_velements = vpv->num_inputs;
}
- cso_set_vertex_buffers(st->cso_context, num_vbuffers, vbuffer);
+ cso_set_vertex_buffers(st->cso_context, 0, num_vbuffers, vbuffer);
+ if (st->last_num_vbuffers > num_vbuffers) {
+ /* Unbind remaining buffers, if any. */
+ cso_set_vertex_buffers(st->cso_context, num_vbuffers,
+ st->last_num_vbuffers - num_vbuffers, NULL);
+ }
+ st->last_num_vbuffers = num_vbuffers;
cso_set_vertex_elements(st->cso_context, num_velements, velements);
}
@@ -582,7 +588,7 @@ static void update_array(struct st_context *st)
const struct st_tracked_state st_update_array = {
"st_update_array", /* name */
{ /* dirty */
- (_NEW_PROGRAM | _NEW_BUFFER_OBJECT), /* mesa */
+ _NEW_BUFFER_OBJECT, /* mesa */
ST_NEW_VERTEX_ARRAYS | ST_NEW_VERTEX_PROGRAM, /* st */
},
update_array /* update */
diff --git a/mesalib/src/mesa/state_tracker/st_atom_clip.c b/mesalib/src/mesa/state_tracker/st_atom_clip.c
index a1a7e003a..8558d768f 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_clip.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_clip.c
@@ -67,8 +67,8 @@ static void update_clip( struct st_context *st )
const struct st_tracked_state st_update_clip = {
"st_update_clip", /* name */
{ /* dirty */
- (_NEW_TRANSFORM | _NEW_PROGRAM), /* mesa */
- 0, /* st */
+ _NEW_TRANSFORM, /* mesa */
+ ST_NEW_VERTEX_PROGRAM, /* st */
},
update_clip /* update */
};
diff --git a/mesalib/src/mesa/state_tracker/st_atom_constbuf.c b/mesalib/src/mesa/state_tracker/st_atom_constbuf.c
index fd9228583..580393e60 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_constbuf.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_constbuf.c
@@ -125,7 +125,7 @@ static void update_vs_constants(struct st_context *st )
const struct st_tracked_state st_update_vs_constants = {
"st_update_vs_constants", /* name */
{ /* dirty */
- (_NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS), /* mesa */
+ _NEW_PROGRAM_CONSTANTS, /* mesa */
ST_NEW_VERTEX_PROGRAM, /* st */
},
update_vs_constants /* update */
@@ -148,7 +148,7 @@ static void update_fs_constants(struct st_context *st )
const struct st_tracked_state st_update_fs_constants = {
"st_update_fs_constants", /* name */
{ /* dirty */
- (_NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS), /* mesa */
+ _NEW_PROGRAM_CONSTANTS, /* mesa */
ST_NEW_FRAGMENT_PROGRAM, /* st */
},
update_fs_constants /* update */
@@ -170,7 +170,7 @@ static void update_gs_constants(struct st_context *st )
const struct st_tracked_state st_update_gs_constants = {
"st_update_gs_constants", /* name */
{ /* dirty */
- (_NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS), /* mesa */
+ _NEW_PROGRAM_CONSTANTS, /* mesa */
ST_NEW_GEOMETRY_PROGRAM, /* st */
},
update_gs_constants /* update */
diff --git a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c
index b024ef0db..843dc5be3 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c
@@ -457,7 +457,7 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
cso_save_vertex_shader(cso);
cso_save_geometry_shader(cso);
cso_save_vertex_elements(cso);
- cso_save_vertex_buffers(cso);
+ cso_save_aux_vertex_buffer_slot(cso);
/* rasterizer state: just scissor */
st->bitmap.rasterizer.scissor = ctx->Scissor.Enabled;
@@ -526,7 +526,9 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
x, y, width, height, z, color, &vbuf, &offset);
if (vbuf) {
- util_draw_vertex_buffer(pipe, st->cso_context, vbuf, offset,
+ util_draw_vertex_buffer(pipe, st->cso_context, vbuf,
+ cso_get_aux_vertex_buffer_slot(st->cso_context),
+ offset,
PIPE_PRIM_TRIANGLE_FAN,
4, /* verts */
3); /* attribs/vert */
@@ -541,7 +543,7 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
cso_restore_vertex_shader(cso);
cso_restore_geometry_shader(cso);
cso_restore_vertex_elements(cso);
- cso_restore_vertex_buffers(cso);
+ cso_restore_aux_vertex_buffer_slot(cso);
cso_restore_stream_outputs(cso);
pipe_resource_reference(&vbuf, NULL);
diff --git a/mesalib/src/mesa/state_tracker/st_cb_clear.c b/mesalib/src/mesa/state_tracker/st_cb_clear.c
index 90eb0af4f..4aa0bc18f 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_clear.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_clear.c
@@ -176,7 +176,9 @@ draw_quad(struct st_context *st,
/* draw */
util_draw_vertex_buffer(pipe,
st->cso_context,
- vbuf, offset,
+ vbuf,
+ cso_get_aux_vertex_buffer_slot(st->cso_context),
+ offset,
PIPE_PRIM_TRIANGLE_FAN,
4, /* verts */
2); /* attribs/vert */
@@ -225,7 +227,7 @@ clear_with_quad(struct gl_context *ctx,
cso_save_vertex_shader(st->cso_context);
cso_save_geometry_shader(st->cso_context);
cso_save_vertex_elements(st->cso_context);
- cso_save_vertex_buffers(st->cso_context);
+ cso_save_aux_vertex_buffer_slot(st->cso_context);
/* blend state: RGBA masking */
{
@@ -325,7 +327,7 @@ clear_with_quad(struct gl_context *ctx,
cso_restore_vertex_shader(st->cso_context);
cso_restore_geometry_shader(st->cso_context);
cso_restore_vertex_elements(st->cso_context);
- cso_restore_vertex_buffers(st->cso_context);
+ cso_restore_aux_vertex_buffer_slot(st->cso_context);
cso_restore_stream_outputs(st->cso_context);
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
index 642011488..ff8a9dc43 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -637,7 +637,9 @@ draw_quad(struct gl_context *ctx, GLfloat x0, GLfloat y0, GLfloat z,
}
u_upload_unmap(st->uploader);
- util_draw_vertex_buffer(pipe, st->cso_context, buf, offset,
+ util_draw_vertex_buffer(pipe, st->cso_context, buf,
+ cso_get_aux_vertex_buffer_slot(st->cso_context),
+ offset,
PIPE_PRIM_QUADS,
4, /* verts */
3); /* attribs/vert */
@@ -683,7 +685,7 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
cso_save_vertex_shader(cso);
cso_save_geometry_shader(cso);
cso_save_vertex_elements(cso);
- cso_save_vertex_buffers(cso);
+ cso_save_aux_vertex_buffer_slot(cso);
if (write_stencil) {
cso_save_depth_stencil_alpha(cso);
cso_save_blend(cso);
@@ -808,7 +810,7 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
cso_restore_vertex_shader(cso);
cso_restore_geometry_shader(cso);
cso_restore_vertex_elements(cso);
- cso_restore_vertex_buffers(cso);
+ cso_restore_aux_vertex_buffer_slot(cso);
cso_restore_stream_outputs(cso);
if (write_stencil) {
cso_restore_depth_stencil_alpha(cso);
diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawtex.c b/mesalib/src/mesa/state_tracker/st_cb_drawtex.c
index e87de4406..269068da2 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_drawtex.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_drawtex.c
@@ -228,7 +228,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
cso_save_vertex_shader(cso);
cso_save_geometry_shader(cso);
cso_save_vertex_elements(cso);
- cso_save_vertex_buffers(cso);
+ cso_save_aux_vertex_buffer_slot(cso);
{
void *vs = lookup_shader(pipe, numAttribs,
@@ -266,6 +266,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
util_draw_vertex_buffer(pipe, cso, vbuffer,
+ cso_get_aux_vertex_buffer_slot(cso),
offset, /* offset */
PIPE_PRIM_TRIANGLE_FAN,
4, /* verts */
@@ -279,7 +280,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
cso_restore_vertex_shader(cso);
cso_restore_geometry_shader(cso);
cso_restore_vertex_elements(cso);
- cso_restore_vertex_buffers(cso);
+ cso_restore_aux_vertex_buffer_slot(cso);
cso_restore_stream_outputs(cso);
}
diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c
index da361d887..69bd50336 100644
--- a/mesalib/src/mesa/state_tracker/st_context.c
+++ b/mesalib/src/mesa/state_tracker/st_context.c
@@ -173,7 +173,8 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
memset(&st->velems_util_draw[i], 0, sizeof(struct pipe_vertex_element));
st->velems_util_draw[i].src_offset = i * 4 * sizeof(float);
st->velems_util_draw[i].instance_divisor = 0;
- st->velems_util_draw[i].vertex_buffer_index = 0;
+ st->velems_util_draw[i].vertex_buffer_index =
+ cso_get_aux_vertex_buffer_slot(st->cso_context);
st->velems_util_draw[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
}
diff --git a/mesalib/src/mesa/state_tracker/st_context.h b/mesalib/src/mesa/state_tracker/st_context.h
index c85d09cb5..2cc52773e 100644
--- a/mesalib/src/mesa/state_tracker/st_context.h
+++ b/mesalib/src/mesa/state_tracker/st_context.h
@@ -188,6 +188,9 @@ struct st_context
int force_msaa;
void *winsys_drawable_handle;
+ /* The number of vertex buffers from the last call of validate_arrays. */
+ unsigned last_num_vbuffers;
+
/* Active render condition. */
struct pipe_query *render_condition;
unsigned condition_mode;
diff --git a/mesalib/src/mesa/state_tracker/st_draw_feedback.c b/mesalib/src/mesa/state_tracker/st_draw_feedback.c
index a6c7d0eec..ae87fb28d 100644
--- a/mesalib/src/mesa/state_tracker/st_draw_feedback.c
+++ b/mesalib/src/mesa/state_tracker/st_draw_feedback.c
@@ -205,7 +205,7 @@ st_feedback_draw_vbo(struct gl_context *ctx,
#endif
}
- draw_set_vertex_buffers(draw, vp->num_inputs, vbuffers);
+ draw_set_vertex_buffers(draw, 0, vp->num_inputs, vbuffers);
draw_set_vertex_elements(draw, vp->num_inputs, velements);
memset(&ibuffer, 0, sizeof(ibuffer));
@@ -264,5 +264,5 @@ st_feedback_draw_vbo(struct gl_context *ctx,
draw_set_mapped_vertex_buffer(draw, attr, NULL);
pipe_resource_reference(&vbuffers[attr].buffer, NULL);
}
- draw_set_vertex_buffers(draw, 0, NULL);
+ draw_set_vertex_buffers(draw, 0, vp->num_inputs, NULL);
}
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index 0560f3a8a..887700568 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -377,6 +377,8 @@ void st_init_extensions(struct st_context *st)
/* GL_NV_point_sprite is not supported by gallium because we don't
* support the GL_POINT_SPRITE_R_MODE_NV option. */
{ o(MESA_texture_array), PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS },
+
+ { o(OES_standard_derivatives), PIPE_CAP_SM3 }
};
/* Required: render target and sampler support */
@@ -479,7 +481,6 @@ void st_init_extensions(struct st_context *st)
* Extensions that are supported by all Gallium drivers:
*/
ctx->Extensions.ARB_ES2_compatibility = GL_TRUE;
- ctx->Extensions.ARB_copy_buffer = GL_TRUE;
ctx->Extensions.ARB_draw_elements_base_vertex = GL_TRUE;
ctx->Extensions.ARB_explicit_attrib_location = GL_TRUE;
ctx->Extensions.ARB_fragment_coord_conventions = GL_TRUE;
@@ -498,7 +499,6 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.ARB_texture_storage = GL_TRUE;
ctx->Extensions.ARB_vertex_program = GL_TRUE;
ctx->Extensions.ARB_vertex_shader = GL_TRUE;
- ctx->Extensions.ARB_window_pos = GL_TRUE;
ctx->Extensions.EXT_blend_color = GL_TRUE;
ctx->Extensions.EXT_blend_func_separate = GL_TRUE;
@@ -522,7 +522,6 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.NV_blend_square = GL_TRUE;
ctx->Extensions.NV_fog_distance = GL_TRUE;
- ctx->Extensions.NV_texgen_reflection = GL_TRUE;
ctx->Extensions.NV_texture_env_combine4 = GL_TRUE;
ctx->Extensions.NV_texture_rectangle = GL_TRUE;
@@ -637,4 +636,10 @@ void st_init_extensions(struct st_context *st)
}
if (st->options.force_glsl_extensions_warn)
ctx->Const.ForceGLSLExtensionsWarn = 1;
+
+ ctx->Const.MinMapBufferAlignment =
+ screen->get_param(screen, PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT);
+ if (ctx->Const.MinMapBufferAlignment >= 64) {
+ ctx->Extensions.ARB_map_buffer_alignment = GL_TRUE;
+ }
}