aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-04-30 11:11:16 +0200
committermarha <marha@users.sourceforge.net>2012-04-30 11:11:16 +0200
commit0f0386d4e90cb0769eddc04b18742d5a9a72ea05 (patch)
treea8a5fb11e78c4afe6637c5adfa0d2224208f7314 /mesalib/src/mesa
parentcd27f58626705bcb561115b8e5b0d1430df83fa6 (diff)
parent762b7fde3d57d3a151f98535fd31516b7e823bc0 (diff)
downloadvcxsrv-0f0386d4e90cb0769eddc04b18742d5a9a72ea05.tar.gz
vcxsrv-0f0386d4e90cb0769eddc04b18742d5a9a72ea05.tar.bz2
vcxsrv-0f0386d4e90cb0769eddc04b18742d5a9a72ea05.zip
Merge remote-tracking branch 'origin/released'
Conflicts: pixman/pixman/pixman-mmx.c xorg-server/glx/glapi_gentable.c
Diffstat (limited to 'mesalib/src/mesa')
-rw-r--r--mesalib/src/mesa/main/version.c1
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_drawpixels.c10
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.c32
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.h3
-rw-r--r--mesalib/src/mesa/state_tracker/st_draw.c16
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c8
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec.h3
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_array.c38
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_draw.c2
-rw-r--r--mesalib/src/mesa/vbo/vbo_save_draw.c2
10 files changed, 77 insertions, 38 deletions
diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c
index 5b8b65ddf..09a930cf2 100644
--- a/mesalib/src/mesa/main/version.c
+++ b/mesalib/src/mesa/main/version.c
@@ -124,6 +124,7 @@ compute_version(struct gl_context *ctx)
ctx->Extensions.EXT_texture_sRGB);
const GLboolean ver_3_0 = (ver_2_1 &&
ctx->Const.GLSLVersion >= 130 &&
+ ctx->Const.MaxSamples >= 4 &&
ctx->Extensions.ARB_color_buffer_float &&
ctx->Extensions.ARB_depth_buffer_float &&
ctx->Extensions.ARB_half_float_pixel &&
diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
index 5e078a85e..9a3f22465 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -1509,7 +1509,15 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
readY = srcy;
readW = width;
readH = height;
- _mesa_clip_readpixels(ctx, &readX, &readY, &readW, &readH, &pack);
+ if (!_mesa_clip_readpixels(ctx, &readX, &readY, &readW, &readH, &pack)) {
+ /* The source region is completely out of bounds. Do nothing.
+ * The GL spec says "Results of copies from outside the window,
+ * or from regions of the window that are not exposed, are
+ * hardware dependent and undefined."
+ */
+ return;
+ }
+
readW = MAX2(0, readW);
readH = MAX2(0, readH);
diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c
index 0245fd92b..19d9da131 100644
--- a/mesalib/src/mesa/state_tracker/st_context.c
+++ b/mesalib/src/mesa/state_tracker/st_context.c
@@ -65,6 +65,7 @@
#include "util/u_inlines.h"
#include "util/u_upload_mgr.h"
#include "cso_cache/cso_context.h"
+#include "util/u_vbuf.h"
DEBUG_GET_ONCE_BOOL_OPTION(mesa_mvp_dp4, "MESA_MVP_DP4", FALSE)
@@ -111,6 +112,29 @@ st_get_msaa(void)
}
+static void st_init_vbuf(struct st_context *st)
+{
+ struct u_vbuf_caps caps;
+
+ u_vbuf_get_caps(st->pipe->screen, &caps);
+
+ /* Create u_vbuf if there is anything unsupported. */
+ if (!caps.buffer_offset_unaligned ||
+ !caps.buffer_stride_unaligned ||
+ !caps.velem_src_offset_unaligned ||
+ !caps.format_fixed32 ||
+ !caps.format_float16 ||
+ !caps.format_float64 ||
+ !caps.format_norm32 ||
+ !caps.format_scaled32 ||
+ !caps.user_vertex_buffers) {
+ /* XXX user vertex buffers are always uploaded regardless of the CAP. */
+ st->vbuf = u_vbuf_create(st->pipe, &caps);
+ cso_install_vbuf(st->cso_context, st->vbuf);
+ }
+}
+
+
static struct st_context *
st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe )
{
@@ -134,6 +158,7 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe )
st->uploader = u_upload_create(st->pipe, 65536, 4, PIPE_BIND_VERTEX_BUFFER);
st->cso_context = cso_create_context(pipe);
+ st_init_vbuf(st);
st_init_atoms( st );
st_init_bitmap(st);
st_init_clear(st);
@@ -245,6 +270,7 @@ static void st_destroy_context_priv( struct st_context *st )
void st_destroy_context( struct st_context *st )
{
struct pipe_context *pipe = st->pipe;
+ struct u_vbuf *vbuf = st->vbuf;
struct cso_context *cso = st->cso_context;
struct gl_context *ctx = st->ctx;
GLuint i;
@@ -275,7 +301,13 @@ void st_destroy_context( struct st_context *st )
_mesa_free_context_data(ctx);
+ /* This will free the st_context too, so 'st' must not be accessed
+ * afterwards. */
st_destroy_context_priv(st);
+ st = NULL;
+
+ if (vbuf)
+ u_vbuf_destroy(vbuf);
cso_destroy_context(cso);
diff --git a/mesalib/src/mesa/state_tracker/st_context.h b/mesalib/src/mesa/state_tracker/st_context.h
index e3d65d97a..3ec98ada1 100644
--- a/mesalib/src/mesa/state_tracker/st_context.h
+++ b/mesalib/src/mesa/state_tracker/st_context.h
@@ -41,6 +41,7 @@ struct gen_mipmap_state;
struct st_context;
struct st_fragment_program;
struct u_upload_mgr;
+struct u_vbuf;
#define ST_NEW_MESA (1 << 0) /* Mesa state has changed */
@@ -73,6 +74,8 @@ struct st_context
struct pipe_context *pipe;
struct u_upload_mgr *uploader;
+ struct u_vbuf *vbuf;
+
struct draw_context *draw; /**< For selection/feedback/rastpos only */
struct draw_stage *feedback_stage; /**< For GL_FEEDBACK rendermode */
struct draw_stage *selection_stage; /**< For GL_SELECT rendermode */
diff --git a/mesalib/src/mesa/state_tracker/st_draw.c b/mesalib/src/mesa/state_tracker/st_draw.c
index 0a35ab2be..edab76bf5 100644
--- a/mesalib/src/mesa/state_tracker/st_draw.c
+++ b/mesalib/src/mesa/state_tracker/st_draw.c
@@ -795,7 +795,8 @@ find_sub_primitives(const void *elements, unsigned element_size,
* sub-primitives.
*/
static void
-handle_fallback_primitive_restart(struct pipe_context *pipe,
+handle_fallback_primitive_restart(struct cso_context *cso,
+ struct pipe_context *pipe,
const struct _mesa_index_buffer *ib,
struct pipe_index_buffer *ibuffer,
struct pipe_draw_info *orig_info)
@@ -851,7 +852,7 @@ handle_fallback_primitive_restart(struct pipe_context *pipe,
info.start = sub_prims[i].start;
info.count = sub_prims[i].count;
if (u_trim_pipe_prim(info.mode, &info.count)) {
- pipe->draw_vbo(pipe, &info);
+ cso_draw_vbo(cso, &info);
}
}
}
@@ -1075,7 +1076,7 @@ st_draw_vbo(struct gl_context *ctx,
}
setup_index_buffer(ctx, ib, &ibuffer);
- pipe->set_index_buffer(pipe, &ibuffer);
+ cso_set_index_buffer(st->cso_context, &ibuffer);
util_draw_init_info(&info);
if (ib) {
@@ -1110,20 +1111,21 @@ st_draw_vbo(struct gl_context *ctx,
}
if (info.count_from_stream_output) {
- pipe->draw_vbo(pipe, &info);
+ cso_draw_vbo(st->cso_context, &info);
}
else if (info.primitive_restart) {
if (st->sw_primitive_restart) {
/* Handle primitive restart for drivers that doesn't support it */
- handle_fallback_primitive_restart(pipe, ib, &ibuffer, &info);
+ handle_fallback_primitive_restart(st->cso_context, pipe, ib,
+ &ibuffer, &info);
}
else {
/* don't trim, restarts might be inside index list */
- pipe->draw_vbo(pipe, &info);
+ cso_draw_vbo(st->cso_context, &info);
}
}
else if (u_trim_pipe_prim(info.mode, &info.count))
- pipe->draw_vbo(pipe, &info);
+ cso_draw_vbo(st->cso_context, &info);
}
pipe_resource_reference(&ibuffer.buffer, NULL);
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index 34e0329be..1b4bca681 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -459,12 +459,6 @@ void st_init_extensions(struct st_context *st)
/* Required: vertex fetch support. */
static const struct st_extension_format_mapping vertex_mapping[] = {
- { { o(ARB_ES2_compatibility) },
- { PIPE_FORMAT_R32G32B32A32_FIXED } },
-
- { { o(ARB_half_float_vertex) },
- { PIPE_FORMAT_R16G16B16A16_FLOAT } },
-
{ { o(ARB_vertex_type_2_10_10_10_rev) },
{ PIPE_FORMAT_R10G10B10A2_UNORM,
PIPE_FORMAT_B10G10R10A2_UNORM,
@@ -479,6 +473,7 @@ 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;
@@ -486,6 +481,7 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.ARB_fragment_program = GL_TRUE;
ctx->Extensions.ARB_fragment_shader = GL_TRUE;
ctx->Extensions.ARB_half_float_pixel = GL_TRUE;
+ ctx->Extensions.ARB_half_float_vertex = GL_TRUE;
ctx->Extensions.ARB_map_buffer_range = GL_TRUE;
ctx->Extensions.ARB_sampler_objects = GL_TRUE;
ctx->Extensions.ARB_shader_objects = GL_TRUE;
diff --git a/mesalib/src/mesa/vbo/vbo_exec.h b/mesalib/src/mesa/vbo/vbo_exec.h
index 5cdf5ced9..be9f3d78d 100644
--- a/mesalib/src/mesa/vbo/vbo_exec.h
+++ b/mesalib/src/mesa/vbo/vbo_exec.h
@@ -189,7 +189,8 @@ static inline void
vbo_draw_method(struct vbo_exec_context *exec, enum draw_method method)
{
if (exec->last_draw_method != method) {
- exec->ctx->NewState |= _NEW_ARRAY;
+ struct gl_context *ctx = exec->ctx;
+ ctx->Driver.UpdateState(ctx, _NEW_ARRAY);
exec->last_draw_method = method;
}
}
diff --git a/mesalib/src/mesa/vbo/vbo_exec_array.c b/mesalib/src/mesa/vbo/vbo_exec_array.c
index f95e062fb..2dcfb8e5b 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_array.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_array.c
@@ -438,14 +438,6 @@ recalculate_input_bindings(struct gl_context *ctx)
inputs[VERT_ATTRIB_GENERIC(i)] = &vbo->currval[VBO_ATTRIB_GENERIC0+i];
const_inputs |= VERT_BIT_GENERIC(i);
}
-
- /* There is no need to make _NEW_ARRAY dirty here for the TnL program,
- * because it already takes care of invalidating the state necessary
- * to revalidate vertex arrays. Not marking the state as dirty also
- * improves performance (quite significantly in some apps).
- */
- if (!ctx->VertexProgram._MaintainTnlProgram)
- ctx->NewState |= _NEW_ARRAY;
break;
case VP_NV:
@@ -472,8 +464,6 @@ recalculate_input_bindings(struct gl_context *ctx)
inputs[VERT_ATTRIB_GENERIC(i)] = &vbo->currval[VBO_ATTRIB_GENERIC0+i];
const_inputs |= VERT_BIT_GENERIC(i);
}
-
- ctx->NewState |= _NEW_ARRAY;
break;
case VP_ARB:
@@ -512,11 +502,11 @@ recalculate_input_bindings(struct gl_context *ctx)
}
inputs[VERT_ATTRIB_GENERIC0] = inputs[0];
- ctx->NewState |= _NEW_ARRAY;
break;
}
_mesa_set_varying_vp_inputs( ctx, VERT_BIT_ALL & (~const_inputs) );
+ ctx->Driver.UpdateState(ctx, _NEW_ARRAY);
}
@@ -640,11 +630,11 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count)
_mesa_debug(ctx, "glDrawArrays(%s, %d, %d)\n",
_mesa_lookup_enum_by_nr(mode), start, count);
+ FLUSH_CURRENT(ctx, 0);
+
if (!_mesa_validate_DrawArrays( ctx, mode, start, count ))
return;
- FLUSH_CURRENT( ctx, 0 );
-
if (0)
check_draw_arrays_data(ctx, start, count);
@@ -669,11 +659,11 @@ vbo_exec_DrawArraysInstanced(GLenum mode, GLint start, GLsizei count,
_mesa_debug(ctx, "glDrawArraysInstanced(%s, %d, %d, %d)\n",
_mesa_lookup_enum_by_nr(mode), start, count, numInstances);
+ FLUSH_CURRENT(ctx, 0);
+
if (!_mesa_validate_DrawArraysInstanced(ctx, mode, start, count, numInstances))
return;
- FLUSH_CURRENT( ctx, 0 );
-
if (0)
check_draw_arrays_data(ctx, start, count);
@@ -761,8 +751,6 @@ vbo_validated_drawrangeelements(struct gl_context *ctx, GLenum mode,
struct _mesa_index_buffer ib;
struct _mesa_prim prim[1];
- FLUSH_CURRENT( ctx, 0 );
-
vbo_bind_arrays(ctx);
ib.count = count;
@@ -838,6 +826,8 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
_mesa_lookup_enum_by_nr(mode), start, end, count,
_mesa_lookup_enum_by_nr(type), indices, basevertex);
+ FLUSH_CURRENT(ctx, 0);
+
if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count,
type, indices, basevertex ))
return;
@@ -936,6 +926,8 @@ vbo_exec_DrawElements(GLenum mode, GLsizei count, GLenum type,
_mesa_lookup_enum_by_nr(mode), count,
_mesa_lookup_enum_by_nr(type), indices);
+ FLUSH_CURRENT(ctx, 0);
+
if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices, 0 ))
return;
@@ -958,6 +950,8 @@ vbo_exec_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
_mesa_lookup_enum_by_nr(mode), count,
_mesa_lookup_enum_by_nr(type), indices, basevertex);
+ FLUSH_CURRENT(ctx, 0);
+
if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices,
basevertex ))
return;
@@ -981,6 +975,8 @@ vbo_exec_DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type,
_mesa_lookup_enum_by_nr(mode), count,
_mesa_lookup_enum_by_nr(type), indices, numInstances);
+ FLUSH_CURRENT(ctx, 0);
+
if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices,
numInstances, 0))
return;
@@ -1005,6 +1001,8 @@ vbo_exec_DrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type
_mesa_lookup_enum_by_nr(type), indices,
numInstances, basevertex);
+ FLUSH_CURRENT(ctx, 0);
+
if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices,
numInstances, basevertex))
return;
@@ -1037,8 +1035,6 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
if (primcount == 0)
return;
- FLUSH_CURRENT( ctx, 0 );
-
prim = calloc(1, primcount * sizeof(*prim));
if (prim == NULL) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glMultiDrawElements");
@@ -1226,12 +1222,12 @@ vbo_exec_DrawTransformFeedback(GLenum mode, GLuint name)
_mesa_debug(ctx, "glDrawTransformFeedback(%s, %d)\n",
_mesa_lookup_enum_by_nr(mode), name);
+ FLUSH_CURRENT(ctx, 0);
+
if (!_mesa_validate_DrawTransformFeedback(ctx, mode, obj)) {
return;
}
- FLUSH_CURRENT(ctx, 0);
-
vbo_draw_transform_feedback(ctx, mode, obj, 1);
}
diff --git a/mesalib/src/mesa/vbo/vbo_exec_draw.c b/mesalib/src/mesa/vbo/vbo_exec_draw.c
index 5cc6586b3..da5ca695e 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_draw.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_draw.c
@@ -253,11 +253,11 @@ vbo_exec_bind_arrays( struct gl_context *ctx )
arrays[attr]._MaxElement = count; /* ??? */
varying_inputs |= VERT_BIT(attr);
- ctx->NewState |= _NEW_ARRAY;
}
}
_mesa_set_varying_vp_inputs( ctx, varying_inputs );
+ ctx->Driver.UpdateState(ctx, _NEW_ARRAY);
}
diff --git a/mesalib/src/mesa/vbo/vbo_save_draw.c b/mesalib/src/mesa/vbo/vbo_save_draw.c
index 57186de64..88a9a7e34 100644
--- a/mesalib/src/mesa/vbo/vbo_save_draw.c
+++ b/mesalib/src/mesa/vbo/vbo_save_draw.c
@@ -209,11 +209,11 @@ static void vbo_bind_vertex_list(struct gl_context *ctx,
buffer_offset += node_attrsz[src] * sizeof(GLfloat);
varying_inputs |= VERT_BIT(attr);
- ctx->NewState |= _NEW_ARRAY;
}
}
_mesa_set_varying_vp_inputs( ctx, varying_inputs );
+ ctx->Driver.UpdateState(ctx, _NEW_ARRAY);
}