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_clip.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_constbuf.c9
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_rasterizer.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_scissor.c14
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_viewport.c12
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_bitmap.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_clear.c10
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_drawpixels.c4
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_fbo.c9
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_draw.c6
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp2
-rw-r--r--mesalib/src/mesa/state_tracker/st_program.c6
13 files changed, 41 insertions, 39 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_atom_clip.c b/mesalib/src/mesa/state_tracker/st_atom_clip.c
index 700899934..274b36a62 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_clip.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_clip.c
@@ -52,7 +52,7 @@ static void update_clip( struct st_context *st )
/* if we have a vertex shader that writes clip vertex we need to pass
the pre-projection transformed coordinates into the driver. */
if (st->vp) {
- if (ctx->Shader.CurrentVertexProgram)
+ if (ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX])
use_eye = TRUE;
}
diff --git a/mesalib/src/mesa/state_tracker/st_atom_constbuf.c b/mesalib/src/mesa/state_tracker/st_atom_constbuf.c
index 14cdfc6f9..a5013ed2c 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_constbuf.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_constbuf.c
@@ -218,7 +218,8 @@ static void st_bind_ubos(struct st_context *st,
static void bind_vs_ubos(struct st_context *st)
{
- struct gl_shader_program *prog = st->ctx->Shader.CurrentVertexProgram;
+ struct gl_shader_program *prog =
+ st->ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX];
if (!prog)
return;
@@ -237,7 +238,8 @@ const struct st_tracked_state st_bind_vs_ubos = {
static void bind_fs_ubos(struct st_context *st)
{
- struct gl_shader_program *prog = st->ctx->Shader.CurrentFragmentProgram;
+ struct gl_shader_program *prog =
+ st->ctx->Shader.CurrentProgram[MESA_SHADER_FRAGMENT];
if (!prog)
return;
@@ -256,7 +258,8 @@ const struct st_tracked_state st_bind_fs_ubos = {
static void bind_gs_ubos(struct st_context *st)
{
- struct gl_shader_program *prog = st->ctx->Shader.CurrentGeometryProgram;
+ struct gl_shader_program *prog =
+ st->ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY];
if (!prog)
return;
diff --git a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
index ca227dcfa..a4f3ffee3 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
@@ -223,7 +223,7 @@ static void update_raster_state( struct st_context *st )
raster->multisample = ctx->Multisample._Enabled;
/* _NEW_SCISSOR */
- raster->scissor = ctx->Scissor.Enabled;
+ raster->scissor = ctx->Scissor.EnableFlags;
/* _NEW_FRAG_CLAMP */
raster->clamp_fragment_color = !st->clamp_frag_color_in_shader &&
diff --git a/mesalib/src/mesa/state_tracker/st_atom_scissor.c b/mesalib/src/mesa/state_tracker/st_atom_scissor.c
index 539c423eb..a1f72da47 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_scissor.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_scissor.c
@@ -53,15 +53,15 @@ update_scissor( struct st_context *st )
scissor.maxx = fb->Width;
scissor.maxy = fb->Height;
- if (ctx->Scissor.Enabled) {
+ if (ctx->Scissor.EnableFlags & 1) {
/* need to be careful here with xmax or ymax < 0 */
- GLint xmax = MAX2(0, ctx->Scissor.X + ctx->Scissor.Width);
- GLint ymax = MAX2(0, ctx->Scissor.Y + ctx->Scissor.Height);
+ GLint xmax = MAX2(0, ctx->Scissor.ScissorArray[0].X + ctx->Scissor.ScissorArray[0].Width);
+ GLint ymax = MAX2(0, ctx->Scissor.ScissorArray[0].Y + ctx->Scissor.ScissorArray[0].Height);
- if (ctx->Scissor.X > (GLint)scissor.minx)
- scissor.minx = ctx->Scissor.X;
- if (ctx->Scissor.Y > (GLint)scissor.miny)
- scissor.miny = ctx->Scissor.Y;
+ if (ctx->Scissor.ScissorArray[0].X > (GLint)scissor.minx)
+ scissor.minx = ctx->Scissor.ScissorArray[0].X;
+ if (ctx->Scissor.ScissorArray[0].Y > (GLint)scissor.miny)
+ scissor.miny = ctx->Scissor.ScissorArray[0].Y;
if (xmax < (GLint) scissor.maxx)
scissor.maxx = xmax;
diff --git a/mesalib/src/mesa/state_tracker/st_atom_viewport.c b/mesalib/src/mesa/state_tracker/st_atom_viewport.c
index 7a1a689b7..8c6d679a0 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_viewport.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_viewport.c
@@ -62,12 +62,12 @@ update_viewport( struct st_context *st )
/* _NEW_VIEWPORT
*/
{
- GLfloat x = (GLfloat)ctx->Viewport.X;
- GLfloat y = (GLfloat)ctx->Viewport.Y;
- GLfloat z = ctx->Viewport.Near;
- GLfloat half_width = (GLfloat)ctx->Viewport.Width * 0.5f;
- GLfloat half_height = (GLfloat)ctx->Viewport.Height * 0.5f;
- GLfloat half_depth = (GLfloat)(ctx->Viewport.Far - ctx->Viewport.Near) * 0.5f;
+ GLfloat x = ctx->ViewportArray[0].X;
+ GLfloat y = ctx->ViewportArray[0].Y;
+ GLfloat z = ctx->ViewportArray[0].Near;
+ GLfloat half_width = ctx->ViewportArray[0].Width * 0.5f;
+ GLfloat half_height = ctx->ViewportArray[0].Height * 0.5f;
+ GLfloat half_depth = (GLfloat)(ctx->ViewportArray[0].Far - ctx->ViewportArray[0].Near) * 0.5f;
st->state.viewport.scale[0] = half_width;
st->state.viewport.scale[1] = half_height * yScale;
diff --git a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c
index 487a46164..874ff77b5 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_aux_vertex_buffer_slot(cso);
/* rasterizer state: just scissor */
- st->bitmap.rasterizer.scissor = ctx->Scissor.Enabled;
+ st->bitmap.rasterizer.scissor = ctx->Scissor.EnableFlags & 1;
cso_set_rasterizer(cso, &st->bitmap.rasterizer);
/* fragment shader state: TEX lookup program */
diff --git a/mesalib/src/mesa/state_tracker/st_cb_clear.c b/mesalib/src/mesa/state_tracker/st_cb_clear.c
index 28f9c83d5..97cc5a232 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_clear.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_clear.c
@@ -364,11 +364,11 @@ clear_with_quad(struct gl_context *ctx, unsigned clear_buffers)
static INLINE GLboolean
is_scissor_enabled(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
- return ctx->Scissor.Enabled &&
- (ctx->Scissor.X > 0 ||
- ctx->Scissor.Y > 0 ||
- (unsigned) ctx->Scissor.Width < rb->Width ||
- (unsigned) ctx->Scissor.Height < rb->Height);
+ return (ctx->Scissor.EnableFlags & 1) &&
+ (ctx->Scissor.ScissorArray[0].X > 0 ||
+ ctx->Scissor.ScissorArray[0].Y > 0 ||
+ (unsigned) ctx->Scissor.ScissorArray[0].Width < rb->Width ||
+ (unsigned) ctx->Scissor.ScissorArray[0].Height < rb->Height);
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
index 72cc9fa54..97f213077 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -713,7 +713,7 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
rasterizer.half_pixel_center = 1;
rasterizer.bottom_edge_rule = 1;
rasterizer.depth_clip = !ctx->Transform.DepthClamp;
- rasterizer.scissor = ctx->Scissor.Enabled;
+ rasterizer.scissor = ctx->Scissor.EnableFlags;
cso_set_rasterizer(cso, &rasterizer);
}
@@ -1364,7 +1364,7 @@ blit_copy_pixels(struct gl_context *ctx, GLint srcx, GLint srcy,
!ctx->Stencil.Enabled &&
!ctx->FragmentProgram.Enabled &&
!ctx->VertexProgram.Enabled &&
- !ctx->Shader.CurrentFragmentProgram &&
+ !ctx->Shader.CurrentProgram[MESA_SHADER_FRAGMENT] &&
ctx->DrawBuffer->_NumColorDrawBuffers == 1 &&
!ctx->Query.CondRenderQuery &&
!ctx->Query.CurrentOcclusionObject) {
diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
index 637f7ee98..780148487 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
@@ -544,6 +544,12 @@ st_validate_attachment(struct gl_context *ctx,
gl_format texFormat;
GLboolean valid;
+ /* Sanity check: we must be binding the surface as a (color) render target
+ * or depth/stencil target.
+ */
+ assert(bindings == PIPE_BIND_RENDER_TARGET ||
+ bindings == PIPE_BIND_DEPTH_STENCIL);
+
/* Only validate texture attachments for now, since
* st_renderbuffer_alloc_storage makes sure that
* the format is supported.
@@ -700,7 +706,8 @@ st_ReadBuffer(struct gl_context *ctx, GLenum buffer)
(void) buffer;
/* add the renderbuffer on demand */
- st_manager_add_color_renderbuffer(st, fb, fb->_ColorReadBufferIndex);
+ if (fb->_ColorReadBufferIndex >= 0)
+ st_manager_add_color_renderbuffer(st, fb, fb->_ColorReadBufferIndex);
}
diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c
index 77db6ab39..0ffc76263 100644
--- a/mesalib/src/mesa/state_tracker/st_context.c
+++ b/mesalib/src/mesa/state_tracker/st_context.c
@@ -240,7 +240,7 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe,
* driver prefers DP4 or MUL/MAD for vertex transformation.
*/
if (debug_get_option_mesa_mvp_dp4())
- ctx->ShaderCompilerOptions[MESA_SHADER_VERTEX].PreferDP4 = GL_TRUE;
+ ctx->ShaderCompilerOptions[MESA_SHADER_VERTEX].OptimizeForAOS = GL_TRUE;
return st_create_context_priv(ctx, pipe, options);
}
diff --git a/mesalib/src/mesa/state_tracker/st_draw.c b/mesalib/src/mesa/state_tracker/st_draw.c
index 46257e0f5..355c180f8 100644
--- a/mesalib/src/mesa/state_tracker/st_draw.c
+++ b/mesalib/src/mesa/state_tracker/st_draw.c
@@ -131,11 +131,7 @@ setup_index_buffer(struct st_context *st,
static void
check_uniforms(struct gl_context *ctx)
{
- struct gl_shader_program *shProg[3] = {
- ctx->Shader.CurrentVertexProgram,
- ctx->Shader.CurrentGeometryProgram,
- ctx->Shader.CurrentFragmentProgram,
- };
+ struct gl_shader_program **shProg = ctx->Shader.CurrentProgram;
unsigned j;
for (j = 0; j < 3; j++) {
diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index f1b354429..0871dd064 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -5312,7 +5312,7 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
_mesa_reference_program(ctx, &prog->_LinkedShaders[i]->Program,
linked_prog);
if (!ctx->Driver.ProgramStringNotify(ctx,
- _mesa_program_index_to_target(i),
+ _mesa_shader_stage_to_program(i),
linked_prog)) {
_mesa_reference_program(ctx, &prog->_LinkedShaders[i]->Program,
NULL);
diff --git a/mesalib/src/mesa/state_tracker/st_program.c b/mesalib/src/mesa/state_tracker/st_program.c
index 2d6d43099..7a15b23fa 100644
--- a/mesalib/src/mesa/state_tracker/st_program.c
+++ b/mesalib/src/mesa/state_tracker/st_program.c
@@ -1195,11 +1195,7 @@ st_get_gp_variant(struct st_context *st,
void
st_print_shaders(struct gl_context *ctx)
{
- struct gl_shader_program *shProg[3] = {
- ctx->Shader.CurrentVertexProgram,
- ctx->Shader.CurrentGeometryProgram,
- ctx->Shader.CurrentFragmentProgram,
- };
+ struct gl_shader_program **shProg = ctx->Shader.CurrentProgram;
unsigned j;
for (j = 0; j < 3; j++) {