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_framebuffer.c1
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_rasterizer.c3
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_condrender.c11
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_eglimage.c8
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_fbo.c3
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texture.c14
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.c25
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.h8
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c33
-rw-r--r--mesalib/src/mesa/state_tracker/st_gen_mipmap.c9
-rw-r--r--mesalib/src/mesa/state_tracker/st_manager.c17
-rw-r--r--mesalib/src/mesa/state_tracker/st_manager.h3
12 files changed, 48 insertions, 87 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_atom_framebuffer.c b/mesalib/src/mesa/state_tracker/st_atom_framebuffer.c
index a10dbfbd0..3df8691f4 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_framebuffer.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_framebuffer.c
@@ -71,7 +71,6 @@ update_renderbuffer_surface(struct st_context *st,
struct pipe_surface surf_tmpl;
memset(&surf_tmpl, 0, sizeof(surf_tmpl));
surf_tmpl.format = format;
- surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
surf_tmpl.u.tex.level = level;
surf_tmpl.u.tex.first_layer = strb->rtt_face + strb->rtt_slice;
surf_tmpl.u.tex.last_layer = strb->rtt_face + strb->rtt_slice;
diff --git a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
index d9e9d21f6..f20df9e9b 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
@@ -230,8 +230,7 @@ static void update_raster_state( struct st_context *st )
raster->line_stipple_factor = ctx->Line.StippleFactor - 1;
/* _NEW_MULTISAMPLE */
- if (ctx->Multisample._Enabled || st->force_msaa)
- raster->multisample = 1;
+ raster->multisample = ctx->Multisample._Enabled;
/* _NEW_SCISSOR */
if (ctx->Scissor.Enabled)
diff --git a/mesalib/src/mesa/state_tracker/st_cb_condrender.c b/mesalib/src/mesa/state_tracker/st_cb_condrender.c
index 1ced560e1..3a5835ecd 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_condrender.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_condrender.c
@@ -38,6 +38,7 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
+#include "cso_cache/cso_context.h"
#include "st_context.h"
#include "st_cb_queryobj.h"
#include "st_cb_condrender.h"
@@ -53,7 +54,6 @@ st_BeginConditionalRender(struct gl_context *ctx, struct gl_query_object *q,
{
struct st_query_object *stq = st_query_object(q);
struct st_context *st = st_context(ctx);
- struct pipe_context *pipe = st->pipe;
uint m;
st_flush_bitmap_cache(st);
@@ -76,10 +76,7 @@ st_BeginConditionalRender(struct gl_context *ctx, struct gl_query_object *q,
m = PIPE_RENDER_COND_WAIT;
}
- st->render_condition = stq->pq;
- st->condition_mode = m;
-
- pipe->render_condition(pipe, stq->pq, m);
+ cso_set_render_condition(st->cso_context, stq->pq, m);
}
@@ -90,13 +87,11 @@ static void
st_EndConditionalRender(struct gl_context *ctx, struct gl_query_object *q)
{
struct st_context *st = st_context(ctx);
- struct pipe_context *pipe = st->pipe;
(void) q;
st_flush_bitmap_cache(st);
- pipe->render_condition(pipe, NULL, 0);
- st->render_condition = NULL;
+ cso_set_render_condition(st->cso_context, NULL, 0);
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_eglimage.c b/mesalib/src/mesa/state_tracker/st_cb_eglimage.c
index 0679e7d44..8c78e5ef4 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_eglimage.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_eglimage.c
@@ -76,10 +76,8 @@ st_egl_image_target_renderbuffer_storage(struct gl_context *ctx,
struct st_context *st = st_context(ctx);
struct st_renderbuffer *strb = st_renderbuffer(rb);
struct pipe_surface *ps;
- unsigned usage;
- usage = PIPE_BIND_RENDER_TARGET;
- ps = st_manager_get_egl_image_surface(st, (void *) image_handle, usage);
+ ps = st_manager_get_egl_image_surface(st, (void *) image_handle);
if (ps) {
strb->Base.Width = ps->width;
strb->Base.Height = ps->height;
@@ -146,10 +144,8 @@ st_egl_image_target_texture_2d(struct gl_context *ctx, GLenum target,
{
struct st_context *st = st_context(ctx);
struct pipe_surface *ps;
- unsigned usage;
- usage = PIPE_BIND_SAMPLER_VIEW;
- ps = st_manager_get_egl_image_surface(st, (void *) image_handle, usage);
+ ps = st_manager_get_egl_image_surface(st, (void *) image_handle);
if (ps) {
st_bind_surface(ctx, target, texObj, texImage, ps);
pipe_surface_reference(&ps, NULL);
diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
index ae280bfa9..bf206b025 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
@@ -206,7 +206,7 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx,
if (!strb->texture)
return FALSE;
- u_surface_default_template(&surf_tmpl, strb->texture, templ.bind);
+ u_surface_default_template(&surf_tmpl, strb->texture);
strb->surface = pipe->create_surface(pipe,
strb->texture,
&surf_tmpl);
@@ -444,7 +444,6 @@ st_render_texture(struct gl_context *ctx,
memset(&surf_tmpl, 0, sizeof(surf_tmpl));
surf_tmpl.format = ctx->Color.sRGBEnabled
? strb->texture->format : util_format_linear(strb->texture->format);
- surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
surf_tmpl.u.tex.level = strb->rtt_level;
surf_tmpl.u.tex.first_layer = strb->rtt_face + strb->rtt_slice;
surf_tmpl.u.tex.last_layer = strb->rtt_face + strb->rtt_slice;
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c
index ae069eb2c..bf13526d2 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c
@@ -60,7 +60,6 @@
#include "pipe/p_shader_tokens.h"
#include "util/u_tile.h"
#include "util/u_blit.h"
-#include "util/u_blitter.h"
#include "util/u_format.h"
#include "util/u_surface.h"
#include "util/u_sampler.h"
@@ -1089,14 +1088,8 @@ st_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
goto fallback;
}
- /* Disable conditional rendering. */
- if (st->render_condition) {
- pipe->render_condition(pipe, NULL, 0);
- }
-
memset(&surf_tmpl, 0, sizeof(surf_tmpl));
surf_tmpl.format = util_format_linear(stImage->pt->format);
- surf_tmpl.usage = dst_usage;
surf_tmpl.u.tex.level = stImage->base.Level;
surf_tmpl.u.tex.first_layer = stImage->base.Face + destZ;
surf_tmpl.u.tex.last_layer = stImage->base.Face + destZ;
@@ -1115,13 +1108,6 @@ st_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
0.0, PIPE_TEX_MIPFILTER_NEAREST,
color_writemask, 0);
pipe_surface_reference(&dest_surface, NULL);
-
- /* Restore conditional rendering state. */
- if (st->render_condition) {
- pipe->render_condition(pipe, st->render_condition,
- st->condition_mode);
- }
-
return;
fallback:
diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c
index 69bd50336..368a30b68 100644
--- a/mesalib/src/mesa/state_tracker/st_context.c
+++ b/mesalib/src/mesa/state_tracker/st_context.c
@@ -27,9 +27,12 @@
#include "main/imports.h"
#include "main/accum.h"
+#include "main/api_exec.h"
#include "main/context.h"
#include "main/samplerobj.h"
#include "main/shaderobj.h"
+#include "main/version.h"
+#include "main/vtxfmt.h"
#include "program/prog_cache.h"
#include "vbo/vbo.h"
#include "glapi/glapi.h"
@@ -97,22 +100,6 @@ void st_invalidate_state(struct gl_context * ctx, GLuint new_state)
_vbo_InvalidateState(ctx, new_state);
}
-
-/**
- * Check for multisample env var override.
- */
-int
-st_get_msaa(void)
-{
- const char *msaa = _mesa_getenv("__GL_FSAA_MODE");
- if (msaa)
- return atoi(msaa);
- return 0;
-}
-
-
-
-
static struct st_context *
st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
const struct st_config_options *options)
@@ -193,7 +180,6 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
st->pixel_xfer.cache = _mesa_new_program_cache();
- st->force_msaa = st_get_msaa();
st->has_stencil_export =
screen->get_param(screen, PIPE_CAP_SHADER_STENCIL_EXPORT);
@@ -201,6 +187,11 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
st_init_limits(st);
st_init_extensions(st);
+ _mesa_compute_version(ctx);
+
+ _mesa_initialize_exec_table(ctx);
+ _mesa_initialize_vbo_vtxfmt(ctx);
+
return st;
}
diff --git a/mesalib/src/mesa/state_tracker/st_context.h b/mesalib/src/mesa/state_tracker/st_context.h
index 2cc52773e..eeb7f0c4f 100644
--- a/mesalib/src/mesa/state_tracker/st_context.h
+++ b/mesalib/src/mesa/state_tracker/st_context.h
@@ -185,16 +185,11 @@ struct st_context
struct cso_context *cso_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;
-
int32_t draw_stamp;
int32_t read_stamp;
@@ -265,9 +260,6 @@ st_fb_orientation(const struct gl_framebuffer *fb)
#define ST_CALLOC_STRUCT(T) (struct T *) calloc(1, sizeof(struct T))
-extern int
-st_get_msaa(void);
-
extern struct st_context *
st_create_context(gl_api api, struct pipe_context *pipe,
const struct gl_config *visual,
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index 93ef7a91c..262cc3d6c 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -494,6 +494,14 @@ void st_init_extensions(struct st_context *st)
PIPE_FORMAT_B10G10R10A2_SSCALED } },
};
+ static const struct st_extension_format_mapping tbo_rgb32[] = {
+ { {o(ARB_texture_buffer_object_rgb32) },
+ { PIPE_FORMAT_R32G32B32_FLOAT,
+ PIPE_FORMAT_R32G32B32_UINT,
+ PIPE_FORMAT_R32G32B32_SINT,
+ } },
+ };
+
/*
* Extensions that are supported by all Gallium drivers:
*/
@@ -570,10 +578,7 @@ void st_init_extensions(struct st_context *st)
glsl_feature_level = screen->get_param(screen, PIPE_CAP_GLSL_FEATURE_LEVEL);
if (glsl_feature_level >= 140) {
- if (ctx->API == API_OPENGL_CORE)
- ctx->Const.GLSLVersion = 140;
- else
- ctx->Const.GLSLVersion = 130;
+ ctx->Const.GLSLVersion = 140;
} else if (glsl_feature_level >= 130) {
ctx->Const.GLSLVersion = 130;
} else {
@@ -664,6 +669,24 @@ void st_init_extensions(struct st_context *st)
if (ctx->Const.MinMapBufferAlignment >= 64) {
ctx->Extensions.ARB_map_buffer_alignment = GL_TRUE;
}
- if (screen->get_param(screen, PIPE_CAP_TEXTURE_BUFFER_OBJECTS))
+ if (screen->get_param(screen, PIPE_CAP_TEXTURE_BUFFER_OBJECTS)) {
ctx->Extensions.ARB_texture_buffer_object = GL_TRUE;
+ init_format_extensions(st, tbo_rgb32, Elements(tbo_rgb32),
+ PIPE_BUFFER, PIPE_BIND_SAMPLER_VIEW);
+ }
+
+
+ /* Unpacking a varying in the fragment shader costs 1 texture indirection.
+ * If the number of available texture indirections is very limited, then we
+ * prefer to disable varying packing rather than run the risk of varying
+ * packing preventing a shader from running.
+ */
+ if (screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT,
+ PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS) <= 8) {
+ /* We can't disable varying packing if transform feedback is available,
+ * because transform feedback code assumes a packed varying layout.
+ */
+ if (!ctx->Extensions.EXT_transform_feedback)
+ ctx->Const.DisableVaryingPacking = GL_TRUE;
+ }
}
diff --git a/mesalib/src/mesa/state_tracker/st_gen_mipmap.c b/mesalib/src/mesa/state_tracker/st_gen_mipmap.c
index c09261312..8ce2e06a2 100644
--- a/mesalib/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/mesalib/src/mesa/state_tracker/st_gen_mipmap.c
@@ -93,18 +93,9 @@ st_render_mipmap(struct st_context *st,
psv = st_create_texture_sampler_view(pipe, stObj->pt);
- /* Disable conditional rendering. */
- if (st->render_condition) {
- pipe->render_condition(pipe, NULL, 0);
- }
-
util_gen_mipmap(st->gen_mipmap, psv, face, baseLevel, lastLevel,
PIPE_TEX_FILTER_LINEAR);
- if (st->render_condition) {
- pipe->render_condition(pipe, st->render_condition, st->condition_mode);
- }
-
pipe_sampler_view_reference(&psv, NULL);
return TRUE;
diff --git a/mesalib/src/mesa/state_tracker/st_manager.c b/mesalib/src/mesa/state_tracker/st_manager.c
index b065db0ac..30f5ca5ed 100644
--- a/mesalib/src/mesa/state_tracker/st_manager.c
+++ b/mesalib/src/mesa/state_tracker/st_manager.c
@@ -224,8 +224,7 @@ st_framebuffer_validate(struct st_framebuffer *stfb,
continue;
}
- u_surface_default_template(&surf_tmpl, textures[i],
- PIPE_BIND_RENDER_TARGET);
+ u_surface_default_template(&surf_tmpl, textures[i]);
ps = st->pipe->create_surface(st->pipe, textures[i], &surf_tmpl);
if (ps) {
pipe_surface_reference(&strb->surface, ps);
@@ -285,7 +284,6 @@ st_framebuffer_add_renderbuffer(struct st_framebuffer *stfb,
{
struct gl_renderbuffer *rb;
enum pipe_format format;
- int samples;
boolean sw;
if (!stfb->iface)
@@ -313,11 +311,7 @@ st_framebuffer_add_renderbuffer(struct st_framebuffer *stfb,
if (format == PIPE_FORMAT_NONE)
return FALSE;
- samples = stfb->iface->visual->samples;
- if (!samples)
- samples = st_get_msaa();
-
- rb = st_new_renderbuffer_fb(format, samples, sw);
+ rb = st_new_renderbuffer_fb(format, stfb->iface->visual->samples, sw);
if (!rb)
return FALSE;
@@ -653,8 +647,6 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
/* need to perform version check */
if (attribs->major > 1 || attribs->minor > 0) {
- _mesa_compute_version(st->ctx);
-
/* Is the actual version less than the requested version?
*/
if (st->ctx->Version < attribs->major * 10 + attribs->minor) {
@@ -797,8 +789,7 @@ st_manager_flush_frontbuffer(struct st_context *st)
* FIXME: I think this should operate on resources, not surfaces
*/
struct pipe_surface *
-st_manager_get_egl_image_surface(struct st_context *st,
- void *eglimg, unsigned usage)
+st_manager_get_egl_image_surface(struct st_context *st, void *eglimg)
{
struct st_manager *smapi =
(struct st_manager *) st->iface.st_context_private;
@@ -812,7 +803,7 @@ st_manager_get_egl_image_surface(struct st_context *st,
if (!smapi->get_egl_image(smapi, eglimg, &stimg))
return NULL;
- u_surface_default_template(&surf_tmpl, stimg.texture, usage);
+ u_surface_default_template(&surf_tmpl, stimg.texture);
surf_tmpl.u.tex.level = stimg.level;
surf_tmpl.u.tex.first_layer = stimg.layer;
surf_tmpl.u.tex.last_layer = stimg.layer;
diff --git a/mesalib/src/mesa/state_tracker/st_manager.h b/mesalib/src/mesa/state_tracker/st_manager.h
index 6a9497839..f729cff1f 100644
--- a/mesalib/src/mesa/state_tracker/st_manager.h
+++ b/mesalib/src/mesa/state_tracker/st_manager.h
@@ -36,8 +36,7 @@
struct st_context;
struct pipe_surface *
-st_manager_get_egl_image_surface(struct st_context *st,
- void *eglimg, unsigned usage);
+st_manager_get_egl_image_surface(struct st_context *st, void *eglimg);
void
st_manager_flush_frontbuffer(struct st_context *st);