aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-11-07 08:23:50 +0100
committermarha <marha@users.sourceforge.net>2013-11-07 08:23:50 +0100
commit51c3a4e7b08aa904ff2af52a9f6f7adc748b361f (patch)
tree38fa447dc8970b83becb4d35487d2bb2e565301b /mesalib/src/mesa
parentd79b6645eb21ca82d506ef038b8ea71a1e431f3f (diff)
parent31fd4c5654595a4763e492e4ec26f66ca3a8a405 (diff)
downloadvcxsrv-51c3a4e7b08aa904ff2af52a9f6f7adc748b361f.tar.gz
vcxsrv-51c3a4e7b08aa904ff2af52a9f6f7adc748b361f.tar.bz2
vcxsrv-51c3a4e7b08aa904ff2af52a9f6f7adc748b361f.zip
Merge remote-tracking branch 'origin/released'
* origin/released: libxtrans fontconfig mesa xserver pixman xkbcomp git update 4 nov 2013 Conflicts: xorg-server/Xext/shm.c xorg-server/os/xstrans.c
Diffstat (limited to 'mesalib/src/mesa')
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c28
-rw-r--r--mesalib/src/mesa/main/dd.h8
-rw-r--r--mesalib/src/mesa/main/enable.c18
-rw-r--r--mesalib/src/mesa/main/extensions.c1
-rw-r--r--mesalib/src/mesa/main/get.c8
-rw-r--r--mesalib/src/mesa/main/get_hash_params.py3
-rw-r--r--mesalib/src/mesa/main/mtypes.h19
-rw-r--r--mesalib/src/mesa/main/multisample.c18
-rw-r--r--mesalib/src/mesa/main/multisample.h2
-rw-r--r--mesalib/src/mesa/main/performance_monitor.c6
-rw-r--r--mesalib/src/mesa/main/transformfeedback.c20
-rw-r--r--mesalib/src/mesa/main/transformfeedback.h3
-rw-r--r--mesalib/src/mesa/main/uniforms.c2
-rw-r--r--mesalib/src/mesa/main/vdpau.c6
-rw-r--r--mesalib/src/mesa/program/prog_print.c1
-rw-r--r--mesalib/src/mesa/program/prog_statevars.c11
-rw-r--r--mesalib/src/mesa/program/prog_statevars.h2
-rw-r--r--mesalib/src/mesa/program/program.c32
-rw-r--r--mesalib/src/mesa/program/program.h3
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_xformfb.c4
-rw-r--r--mesalib/src/mesa/state_tracker/st_draw.h2
-rw-r--r--mesalib/src/mesa/swrast/s_texfetch_tmp.h4
-rw-r--r--mesalib/src/mesa/vbo/vbo_attrib_tmp.h4
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_array.c10
24 files changed, 182 insertions, 33 deletions
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index 798efa680..aa50dde73 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -1729,10 +1729,10 @@ blitframebuffer_texture(struct gl_context *ctx,
}
else {
assert(target == GL_TEXTURE_RECTANGLE_ARB);
- s0 = srcX0;
- s1 = srcX1;
- t0 = srcY0;
- t1 = srcY1;
+ s0 = (float) srcX0;
+ s1 = (float) srcX1;
+ t0 = (float) srcY0;
+ t1 = (float) srcY1;
}
/* setup vertex positions */
@@ -2825,7 +2825,7 @@ _mesa_meta_DrawPixels(struct gl_context *ctx,
_mesa_StencilMask(mask);
_mesa_ProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 0,
- 255.0 / mask, 0.5, 0.0, 0.0);
+ 255.0f / mask, 0.5f, 0.0f, 0.0f);
_mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
@@ -3184,7 +3184,7 @@ setup_texture_coords(GLenum faceTarget,
r = (slice + 0.5f) / depth;
}
else if (faceTarget == GL_TEXTURE_2D_ARRAY)
- r = slice;
+ r = (float) slice;
else
r = 0.0F;
coords0[0] = 0.0F; /* s */
@@ -3204,28 +3204,28 @@ setup_texture_coords(GLenum faceTarget,
coords0[0] = 0.0F; /* s */
coords0[1] = 0.0F; /* t */
coords0[2] = 0.0F; /* r */
- coords1[0] = width;
+ coords1[0] = (float) width;
coords1[1] = 0.0F;
coords1[2] = 0.0F;
- coords2[0] = width;
- coords2[1] = height;
+ coords2[0] = (float) width;
+ coords2[1] = (float) height;
coords2[2] = 0.0F;
coords3[0] = 0.0F;
- coords3[1] = height;
+ coords3[1] = (float) height;
coords3[2] = 0.0F;
break;
case GL_TEXTURE_1D_ARRAY:
coords0[0] = 0.0F; /* s */
- coords0[1] = slice; /* t */
+ coords0[1] = (float) slice; /* t */
coords0[2] = 0.0F; /* r */
coords1[0] = 1.0f;
- coords1[1] = slice;
+ coords1[1] = (float) slice;
coords1[2] = 0.0F;
coords2[0] = 1.0F;
- coords2[1] = slice;
+ coords2[1] = (float) slice;
coords2[2] = 0.0F;
coords3[0] = 0.0F;
- coords3[1] = slice;
+ coords3[1] = (float) slice;
coords3[2] = 0.0F;
break;
diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h
index 501192199..d7c432713 100644
--- a/mesalib/src/mesa/main/dd.h
+++ b/mesalib/src/mesa/main/dd.h
@@ -843,6 +843,14 @@ struct dd_function_table {
struct gl_transform_feedback_object *obj);
/**
+ * Return the number of vertices written to a stream during the last
+ * Begin/EndTransformFeedback block.
+ */
+ GLsizei (*GetTransformFeedbackVertexCount)(struct gl_context *ctx,
+ struct gl_transform_feedback_object *obj,
+ GLuint stream);
+
+ /**
* \name GL_NV_texture_barrier interface
*/
void (*TextureBarrier)(struct gl_context *ctx);
diff --git a/mesalib/src/mesa/main/enable.c b/mesalib/src/mesa/main/enable.c
index 5e2fd80d2..dd6a772f9 100644
--- a/mesalib/src/mesa/main/enable.c
+++ b/mesalib/src/mesa/main/enable.c
@@ -802,6 +802,17 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Multisample.SampleCoverageInvert = state;
break;
+ /* GL_ARB_sample_shading */
+ case GL_SAMPLE_SHADING:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum_error;
+ CHECK_EXTENSION(ARB_sample_shading, cap);
+ if (ctx->Multisample.SampleShading == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
+ ctx->Multisample.SampleShading = state;
+ break;
+
/* GL_IBM_rasterpos_clip */
case GL_RASTER_POSITION_UNCLIPPED_IBM:
if (ctx->API != API_OPENGL_COMPAT)
@@ -1594,6 +1605,13 @@ _mesa_IsEnabled( GLenum cap )
CHECK_EXTENSION(ARB_texture_multisample);
return ctx->Multisample.SampleMask;
+ /* ARB_sample_shading */
+ case GL_SAMPLE_SHADING:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum_error;
+ CHECK_EXTENSION(ARB_sample_shading);
+ return ctx->Multisample.SampleShading;
+
default:
goto invalid_enum_error;
}
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index 285ec377c..48c4e9f1b 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -118,6 +118,7 @@ static const struct extension extension_table[] = {
{ "GL_ARB_point_sprite", o(ARB_point_sprite), GL, 2003 },
{ "GL_ARB_provoking_vertex", o(EXT_provoking_vertex), GL, 2009 },
{ "GL_ARB_robustness", o(dummy_true), GL, 2010 },
+ { "GL_ARB_sample_shading", o(ARB_sample_shading), GL, 2009 },
{ "GL_ARB_sampler_objects", o(dummy_true), GL, 2009 },
{ "GL_ARB_seamless_cube_map", o(ARB_seamless_cube_map), GL, 2009 },
{ "GL_ARB_shader_atomic_counters", o(ARB_shader_atomic_counters), GL, 2011 },
diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c
index 6e72ff5c2..6a0de0c16 100644
--- a/mesalib/src/mesa/main/get.c
+++ b/mesalib/src/mesa/main/get.c
@@ -131,6 +131,7 @@ enum value_extra {
EXTRA_VERSION_30,
EXTRA_VERSION_31,
EXTRA_VERSION_32,
+ EXTRA_VERSION_40,
EXTRA_API_GL,
EXTRA_API_GL_CORE,
EXTRA_API_ES2,
@@ -391,6 +392,7 @@ extra_NV_primitive_restart[] = {
static const int extra_version_30[] = { EXTRA_VERSION_30, EXTRA_END };
static const int extra_version_31[] = { EXTRA_VERSION_31, EXTRA_END };
static const int extra_version_32[] = { EXTRA_VERSION_32, EXTRA_END };
+static const int extra_version_40[] = { EXTRA_VERSION_40, EXTRA_END };
static const int extra_gl30_es3[] = {
EXTRA_VERSION_30,
@@ -410,6 +412,12 @@ static const int extra_gl32_ARB_geometry_shader4[] = {
EXTRA_END
};
+static const int extra_gl40_ARB_sample_shading[] = {
+ EXTRA_VERSION_40,
+ EXT(ARB_sample_shading),
+ EXTRA_END
+};
+
static const int
extra_ARB_vertex_program_api_es2[] = {
EXT(ARB_vertex_program),
diff --git a/mesalib/src/mesa/main/get_hash_params.py b/mesalib/src/mesa/main/get_hash_params.py
index 9f79f3406..0851b7b70 100644
--- a/mesalib/src/mesa/main/get_hash_params.py
+++ b/mesalib/src/mesa/main/get_hash_params.py
@@ -83,6 +83,9 @@ descriptor=[
[ "SAMPLE_BUFFERS_ARB", "BUFFER_INT(Visual.sampleBuffers), extra_new_buffers" ],
[ "SAMPLES_ARB", "BUFFER_INT(Visual.samples), extra_new_buffers" ],
+# GL_ARB_sample_shading
+ [ "MIN_SAMPLE_SHADING_VALUE_ARB", "CONTEXT_FLOAT(Multisample.MinSampleShadingValue), extra_gl40_ARB_sample_shading" ],
+
# GL_SGIS_generate_mipmap
[ "GENERATE_MIPMAP_HINT_SGIS", "CONTEXT_ENUM(Hint.GenerateMipmap), NO_EXTRA" ],
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index a1a5eb4bf..b5c5583d6 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -274,6 +274,11 @@ typedef enum
#define VARYING_BIT_VAR(V) BITFIELD64_BIT(VARYING_SLOT_VAR0 + (V))
/*@}*/
+/**
+ * Bitflags for system values.
+ */
+#define SYSTEM_BIT_SAMPLE_ID BITFIELD64_BIT(SYSTEM_VALUE_SAMPLE_ID)
+#define SYSTEM_BIT_SAMPLE_POS BITFIELD64_BIT(SYSTEM_VALUE_SAMPLE_POS)
/**
* Determine if the given gl_varying_slot appears in the fragment shader.
@@ -306,12 +311,13 @@ typedef enum
* register is written. No FRAG_RESULT_DATAn will be written.
*/
FRAG_RESULT_COLOR = 2,
+ FRAG_RESULT_SAMPLE_MASK = 3,
/* FRAG_RESULT_DATAn are the per-render-target (GLSL gl_FragData[n]
* or ARB_fragment_program fragment.color[n]) color results. If
* any are written, FRAG_RESULT_COLOR will not be written.
*/
- FRAG_RESULT_DATA0 = 3,
+ FRAG_RESULT_DATA0 = 4,
FRAG_RESULT_MAX = (FRAG_RESULT_DATA0 + MAX_DRAW_BUFFERS)
} gl_frag_result;
@@ -872,6 +878,8 @@ struct gl_multisample_attrib
GLboolean SampleCoverage;
GLfloat SampleCoverageValue;
GLboolean SampleCoverageInvert;
+ GLboolean SampleShading;
+ GLfloat MinSampleShadingValue;
/* ARB_texture_multisample / GL3.2 additions */
GLboolean SampleMask;
@@ -1902,6 +1910,8 @@ typedef enum
SYSTEM_VALUE_FRONT_FACE, /**< Fragment shader only (not done yet) */
SYSTEM_VALUE_VERTEX_ID, /**< Vertex shader only */
SYSTEM_VALUE_INSTANCE_ID, /**< Vertex shader only */
+ SYSTEM_VALUE_SAMPLE_ID, /**< Fragment shader only */
+ SYSTEM_VALUE_SAMPLE_POS, /**< Fragment shader only */
SYSTEM_VALUE_MAX /**< Number of values */
} gl_system_value;
@@ -3156,6 +3166,12 @@ struct gl_constants
*/
GLboolean PrimitiveRestartInSoftware;
+ /**
+ * Always use the GetTransformFeedbackVertexCount() driver hook, rather
+ * than passing the transform feedback object to the drawing function.
+ */
+ GLboolean AlwaysUseGetTransformFeedbackVertexCount;
+
/** GL_ARB_map_buffer_alignment */
GLuint MinMapBufferAlignment;
@@ -3239,6 +3255,7 @@ struct gl_extensions
GLboolean ARB_occlusion_query;
GLboolean ARB_occlusion_query2;
GLboolean ARB_point_sprite;
+ GLboolean ARB_sample_shading;
GLboolean ARB_seamless_cube_map;
GLboolean ARB_shader_atomic_counters;
GLboolean ARB_shader_bit_encoding;
diff --git a/mesalib/src/mesa/main/multisample.c b/mesalib/src/mesa/main/multisample.c
index bd97c5096..599cdee74 100644
--- a/mesalib/src/mesa/main/multisample.c
+++ b/mesalib/src/mesa/main/multisample.c
@@ -119,6 +119,24 @@ _mesa_SampleMaski(GLuint index, GLbitfield mask)
ctx->Multisample.SampleMaskValue = mask;
}
+/**
+ * Called via glMinSampleShadingARB
+ */
+void GLAPIENTRY
+_mesa_MinSampleShading(GLclampf value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (!ctx->Extensions.ARB_sample_shading || !_mesa_is_desktop_gl(ctx)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glMinSampleShading");
+ return;
+ }
+
+ FLUSH_VERTICES(ctx, 0);
+
+ ctx->Multisample.MinSampleShadingValue = CLAMP(value, 0.0, 1.0);
+ ctx->NewState |= _NEW_MULTISAMPLE;
+}
/**
* Helper for checking a requested sample count against the limit
diff --git a/mesalib/src/mesa/main/multisample.h b/mesalib/src/mesa/main/multisample.h
index 66848d269..7441d3ee9 100644
--- a/mesalib/src/mesa/main/multisample.h
+++ b/mesalib/src/mesa/main/multisample.h
@@ -44,6 +44,8 @@ _mesa_GetMultisamplefv(GLenum pname, GLuint index, GLfloat* val);
extern void GLAPIENTRY
_mesa_SampleMaski(GLuint index, GLbitfield mask);
+extern void GLAPIENTRY
+_mesa_MinSampleShading(GLclampf value);
extern GLenum
_mesa_check_sample_count(struct gl_context *ctx, GLenum target,
diff --git a/mesalib/src/mesa/main/performance_monitor.c b/mesalib/src/mesa/main/performance_monitor.c
index 8dfa8261e..17cae5183 100644
--- a/mesalib/src/mesa/main/performance_monitor.c
+++ b/mesalib/src/mesa/main/performance_monitor.c
@@ -127,7 +127,7 @@ _mesa_GetPerfMonitorGroupsAMD(GLint *numGroups, GLsizei groupsSize,
if (groupsSize > 0 && groups != NULL) {
unsigned i;
- unsigned n = MIN2(groupsSize, ctx->PerfMonitor.NumGroups);
+ unsigned n = MIN2((GLuint) groupsSize, ctx->PerfMonitor.NumGroups);
/* We just use the index in the Groups array as the ID. */
for (i = 0; i < n; i++)
@@ -156,7 +156,7 @@ _mesa_GetPerfMonitorCountersAMD(GLuint group, GLint *numCounters,
if (counters != NULL) {
unsigned i;
- unsigned n = MIN2(group_obj->NumCounters, countersSize);
+ unsigned n = MIN2(group_obj->NumCounters, (GLuint) countersSize);
for (i = 0; i < n; i++) {
/* We just use the index in the Counters array as the ID. */
counters[i] = i;
@@ -379,7 +379,7 @@ _mesa_SelectPerfMonitorCountersAMD(GLuint monitor, GLboolean enable,
GLuint *counterList)
{
GET_CURRENT_CONTEXT(ctx);
- unsigned i;
+ int i;
struct gl_perf_monitor_object *m;
const struct gl_perf_monitor_group *group_obj;
diff --git a/mesalib/src/mesa/main/transformfeedback.c b/mesalib/src/mesa/main/transformfeedback.c
index bc9b52ab9..76d213b16 100644
--- a/mesalib/src/mesa/main/transformfeedback.c
+++ b/mesalib/src/mesa/main/transformfeedback.c
@@ -205,17 +205,27 @@ _mesa_free_transform_feedback(struct gl_context *ctx)
}
+/** Initialize the fields of a gl_transform_feedback_object. */
+void
+_mesa_init_transform_feedback_object(struct gl_transform_feedback_object *obj,
+ GLuint name)
+{
+ if (!obj)
+ return;
+
+ obj->Name = name;
+ obj->RefCount = 1;
+ obj->EverBound = GL_FALSE;
+}
+
+
/** Default fallback for ctx->Driver.NewTransformFeedback() */
static struct gl_transform_feedback_object *
new_transform_feedback(struct gl_context *ctx, GLuint name)
{
struct gl_transform_feedback_object *obj;
obj = CALLOC_STRUCT(gl_transform_feedback_object);
- if (obj) {
- obj->Name = name;
- obj->RefCount = 1;
- obj->EverBound = GL_FALSE;
- }
+ _mesa_init_transform_feedback_object(obj, name);
return obj;
}
diff --git a/mesalib/src/mesa/main/transformfeedback.h b/mesalib/src/mesa/main/transformfeedback.h
index 0ffaab508..7aecd66a7 100644
--- a/mesalib/src/mesa/main/transformfeedback.h
+++ b/mesalib/src/mesa/main/transformfeedback.h
@@ -91,6 +91,9 @@ _mesa_GetTransformFeedbackVarying(GLuint program, GLuint index,
/*** GL_ARB_transform_feedback2 ***/
+extern void
+_mesa_init_transform_feedback_object(struct gl_transform_feedback_object *obj,
+ GLuint name);
struct gl_transform_feedback_object *
_mesa_lookup_transform_feedback_object(struct gl_context *ctx, GLuint name);
diff --git a/mesalib/src/mesa/main/uniforms.c b/mesalib/src/mesa/main/uniforms.c
index 2e847fe31..17e24f678 100644
--- a/mesalib/src/mesa/main/uniforms.c
+++ b/mesalib/src/mesa/main/uniforms.c
@@ -853,7 +853,7 @@ _mesa_GetActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex,
GET_CURRENT_CONTEXT(ctx);
struct gl_shader_program *shProg;
struct gl_active_atomic_buffer *ab;
- int i;
+ GLuint i;
if (!ctx->Extensions.ARB_shader_atomic_counters) {
_mesa_error(ctx, GL_INVALID_OPERATION,
diff --git a/mesalib/src/mesa/main/vdpau.c b/mesalib/src/mesa/main/vdpau.c
index e21a26b43..359757607 100644
--- a/mesalib/src/mesa/main/vdpau.c
+++ b/mesalib/src/mesa/main/vdpau.c
@@ -324,7 +324,7 @@ void GLAPIENTRY
_mesa_VDPAUMapSurfacesNV(GLsizei numSurfaces, const GLintptr *surfaces)
{
GET_CURRENT_CONTEXT(ctx);
- int i, j;
+ int i;
if (!ctx->vdpDevice || !ctx->vdpGetProcAddress || !ctx->vdpSurfaces) {
_mesa_error(ctx, GL_INVALID_OPERATION, "VDPAUUnmapSurfacesNV");
@@ -348,6 +348,7 @@ _mesa_VDPAUMapSurfacesNV(GLsizei numSurfaces, const GLintptr *surfaces)
for (i = 0; i < numSurfaces; ++i) {
struct vdp_surface *surf = (struct vdp_surface *)surfaces[i];
unsigned numTextureNames = surf->output ? 1 : 4;
+ unsigned j;
for (j = 0; j < numTextureNames; ++j) {
struct gl_texture_object *tex = surf->textures[j];
@@ -377,7 +378,7 @@ void GLAPIENTRY
_mesa_VDPAUUnmapSurfacesNV(GLsizei numSurfaces, const GLintptr *surfaces)
{
GET_CURRENT_CONTEXT(ctx);
- int i, j;
+ int i;
if (!ctx->vdpDevice || !ctx->vdpGetProcAddress || !ctx->vdpSurfaces) {
_mesa_error(ctx, GL_INVALID_OPERATION, "VDPAUUnmapSurfacesNV");
@@ -401,6 +402,7 @@ _mesa_VDPAUUnmapSurfacesNV(GLsizei numSurfaces, const GLintptr *surfaces)
for (i = 0; i < numSurfaces; ++i) {
struct vdp_surface *surf = (struct vdp_surface *)surfaces[i];
unsigned numTextureNames = surf->output ? 1 : 4;
+ unsigned j;
for (j = 0; j < numTextureNames; ++j) {
struct gl_texture_object *tex = surf->textures[j];
diff --git a/mesalib/src/mesa/program/prog_print.c b/mesalib/src/mesa/program/prog_print.c
index cf852132d..fa9063f5b 100644
--- a/mesalib/src/mesa/program/prog_print.c
+++ b/mesalib/src/mesa/program/prog_print.c
@@ -311,6 +311,7 @@ arb_output_attrib_string(GLint index, GLenum progType)
"result.depth", /* FRAG_RESULT_DEPTH */
"result.(one)", /* FRAG_RESULT_STENCIL */
"result.color", /* FRAG_RESULT_COLOR */
+ "result.samplemask", /* FRAG_RESULT_SAMPLE_MASK */
"result.color[0]", /* FRAG_RESULT_DATA0 (named for GLSL's gl_FragData) */
"result.color[1]",
"result.color[2]",
diff --git a/mesalib/src/mesa/program/prog_statevars.c b/mesalib/src/mesa/program/prog_statevars.c
index 145c07c67..f6fd53576 100644
--- a/mesalib/src/mesa/program/prog_statevars.c
+++ b/mesalib/src/mesa/program/prog_statevars.c
@@ -349,6 +349,9 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
}
}
return;
+ case STATE_NUM_SAMPLES:
+ ((int *)value)[0] = ctx->DrawBuffer->Visual.samples;
+ return;
case STATE_DEPTH_RANGE:
value[0] = ctx->Viewport.Near; /* near */
value[1] = ctx->Viewport.Far; /* far */
@@ -665,6 +668,9 @@ _mesa_program_state_flags(const gl_state_index state[STATE_LENGTH])
case STATE_PROGRAM_MATRIX:
return _NEW_TRACK_MATRIX;
+ case STATE_NUM_SAMPLES:
+ return _NEW_BUFFERS;
+
case STATE_DEPTH_RANGE:
return _NEW_VIEWPORT;
@@ -852,6 +858,9 @@ append_token(char *dst, gl_state_index k)
case STATE_TEXENV_COLOR:
append(dst, "texenv");
break;
+ case STATE_NUM_SAMPLES:
+ append(dst, "numsamples");
+ break;
case STATE_DEPTH_RANGE:
append(dst, "depth.range");
break;
@@ -1027,6 +1036,8 @@ _mesa_program_state_string(const gl_state_index state[STATE_LENGTH])
break;
case STATE_FOG_COLOR:
break;
+ case STATE_NUM_SAMPLES:
+ break;
case STATE_DEPTH_RANGE:
break;
case STATE_FRAGMENT_PROGRAM:
diff --git a/mesalib/src/mesa/program/prog_statevars.h b/mesalib/src/mesa/program/prog_statevars.h
index ec22b7376..23a9f48c3 100644
--- a/mesalib/src/mesa/program/prog_statevars.h
+++ b/mesalib/src/mesa/program/prog_statevars.h
@@ -103,6 +103,8 @@ typedef enum gl_state_index_ {
STATE_TEXENV_COLOR,
+ STATE_NUM_SAMPLES, /* An integer, not a float like the other state vars */
+
STATE_DEPTH_RANGE,
STATE_VERTEX_PROGRAM,
diff --git a/mesalib/src/mesa/program/program.c b/mesalib/src/mesa/program/program.c
index 093d37297..a102ec17a 100644
--- a/mesalib/src/mesa/program/program.c
+++ b/mesalib/src/mesa/program/program.c
@@ -32,6 +32,7 @@
#include "main/glheader.h"
#include "main/context.h"
#include "main/hash.h"
+#include "main/macros.h"
#include "program.h"
#include "prog_cache.h"
#include "prog_parameter.h"
@@ -1024,3 +1025,34 @@ _mesa_postprocess_program(struct gl_context *ctx, struct gl_program *prog)
}
}
+
+/* Gets the minimum number of shader invocations per fragment.
+ * This function is useful to determine if we need to do per
+ * sample shading or per fragment shading.
+ */
+GLint
+_mesa_get_min_invocations_per_fragment(struct gl_context *ctx,
+ const struct gl_fragment_program *prog)
+{
+ /* From ARB_sample_shading specification:
+ * "Using gl_SampleID in a fragment shader causes the entire shader
+ * to be evaluated per-sample."
+ *
+ * "Using gl_SamplePosition in a fragment shader causes the entire
+ * shader to be evaluated per-sample."
+ *
+ * "If MULTISAMPLE or SAMPLE_SHADING_ARB is disabled, sample shading
+ * has no effect."
+ */
+ if (ctx->Multisample.Enabled) {
+ if (prog->Base.SystemValuesRead & (SYSTEM_BIT_SAMPLE_ID |
+ SYSTEM_BIT_SAMPLE_POS))
+ return MAX2(ctx->DrawBuffer->Visual.samples, 1);
+ else if (ctx->Multisample.SampleShading)
+ return MAX2(ceil(ctx->Multisample.MinSampleShadingValue *
+ ctx->DrawBuffer->Visual.samples), 1);
+ else
+ return 1;
+ }
+ return 1;
+}
diff --git a/mesalib/src/mesa/program/program.h b/mesalib/src/mesa/program/program.h
index 34965ab99..353ccab47 100644
--- a/mesalib/src/mesa/program/program.h
+++ b/mesalib/src/mesa/program/program.h
@@ -187,6 +187,9 @@ _mesa_valid_register_index(const struct gl_context *ctx,
extern void
_mesa_postprocess_program(struct gl_context *ctx, struct gl_program *prog);
+extern GLint
+_mesa_get_min_invocations_per_fragment(struct gl_context *ctx,
+ const struct gl_fragment_program *prog);
static inline GLuint
_mesa_program_target_to_index(GLenum v)
diff --git a/mesalib/src/mesa/state_tracker/st_cb_xformfb.c b/mesalib/src/mesa/state_tracker/st_cb_xformfb.c
index e1a7a88a1..e824fe9b3 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_xformfb.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_xformfb.c
@@ -74,8 +74,8 @@ st_new_transform_feedback(struct gl_context *ctx, GLuint name)
if (!obj)
return NULL;
- obj->base.Name = name;
- obj->base.RefCount = 1;
+ _mesa_init_transform_feedback_object(&obj->base, name);
+
return &obj->base;
}
diff --git a/mesalib/src/mesa/state_tracker/st_draw.h b/mesalib/src/mesa/state_tracker/st_draw.h
index 3313fc8c7..394473b20 100644
--- a/mesalib/src/mesa/state_tracker/st_draw.h
+++ b/mesalib/src/mesa/state_tracker/st_draw.h
@@ -77,7 +77,7 @@ st_feedback_draw_vbo(struct gl_context *ctx,
static INLINE unsigned
pointer_to_offset(const void *ptr)
{
- return (unsigned) (((unsigned long) ptr) & 0xffffffffUL);
+ return (unsigned) (((GLsizeiptr) ptr) & 0xffffffffUL);
}
diff --git a/mesalib/src/mesa/swrast/s_texfetch_tmp.h b/mesalib/src/mesa/swrast/s_texfetch_tmp.h
index 7a687532d..e2521b50c 100644
--- a/mesalib/src/mesa/swrast/s_texfetch_tmp.h
+++ b/mesalib/src/mesa/swrast/s_texfetch_tmp.h
@@ -1537,7 +1537,7 @@ static void FETCH(f_z24_s8)( const struct swrast_texture_image *texImage,
/* only return Z, not stencil data */
const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
const GLdouble scale = 1.0 / (GLdouble) 0xffffff;
- texel[0] = ((*src) >> 8) * scale;
+ texel[0] = (GLfloat) (((*src) >> 8) * scale);
ASSERT(texImage->Base.TexFormat == MESA_FORMAT_Z24_S8 ||
texImage->Base.TexFormat == MESA_FORMAT_Z24_X8);
ASSERT(texel[0] >= 0.0F);
@@ -1555,7 +1555,7 @@ static void FETCH(f_s8_z24)( const struct swrast_texture_image *texImage,
/* only return Z, not stencil data */
const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
const GLdouble scale = 1.0 / (GLdouble) 0xffffff;
- texel[0] = ((*src) & 0x00ffffff) * scale;
+ texel[0] = (GLfloat) (((*src) & 0x00ffffff) * scale);
ASSERT(texImage->Base.TexFormat == MESA_FORMAT_S8_Z24 ||
texImage->Base.TexFormat == MESA_FORMAT_X8_Z24);
ASSERT(texel[0] >= 0.0F);
diff --git a/mesalib/src/mesa/vbo/vbo_attrib_tmp.h b/mesalib/src/mesa/vbo/vbo_attrib_tmp.h
index 02c283da4..bbc020539 100644
--- a/mesalib/src/mesa/vbo/vbo_attrib_tmp.h
+++ b/mesalib/src/mesa/vbo/vbo_attrib_tmp.h
@@ -140,7 +140,7 @@ static inline float conv_i10_to_norm_float(const struct gl_context *ctx, int i10
(ctx->API == API_OPENGL_CORE && ctx->Version >= 42)) {
/* Equation 2.3 above. */
float f = ((float) val.x) / 511.0F;
- return MAX2(f, -1.0);
+ return MAX2(f, -1.0f);
} else {
/* Equation 2.2 above. */
return (2.0F * (float)val.x + 1.0F) * (1.0F / 1023.0F);
@@ -156,7 +156,7 @@ static inline float conv_i2_to_norm_float(const struct gl_context *ctx, int i2)
(ctx->API == API_OPENGL_CORE && ctx->Version >= 42)) {
/* Equation 2.3 above. */
float f = (float) val.x;
- return MAX2(f, -1.0);
+ return MAX2(f, -1.0f);
} else {
/* Equation 2.2 above. */
return (2.0F * (float)val.x + 1.0F) * (1.0F / 3.0F);
diff --git a/mesalib/src/mesa/vbo/vbo_exec_array.c b/mesalib/src/mesa/vbo/vbo_exec_array.c
index 1670409d4..f25a9dec3 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_array.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_array.c
@@ -1464,6 +1464,16 @@ vbo_draw_transform_feedback(struct gl_context *ctx, GLenum mode,
return;
}
+ if (ctx->Driver.GetTransformFeedbackVertexCount &&
+ (ctx->Const.AlwaysUseGetTransformFeedbackVertexCount ||
+ (ctx->Const.PrimitiveRestartInSoftware &&
+ ctx->Array._PrimitiveRestart) ||
+ !vbo_all_varyings_in_vbos(exec->array.inputs))) {
+ GLsizei n = ctx->Driver.GetTransformFeedbackVertexCount(ctx, obj, stream);
+ vbo_draw_arrays(ctx, mode, 0, n, numInstances, 0);
+ return;
+ }
+
vbo_bind_arrays(ctx);
/* init most fields to zero */