{
GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
+ value = CLAMP(value, 0.0f, 1.0f);
- ctx->Multisample.SampleCoverageValue = CLAMP(value, 0.0f, 1.0f);
+ if (ctx->Multisample.SampleCoverageInvert == invert &&
+ ctx->Multisample.SampleCoverageValue == value)
+ return;
+
+ FLUSH_VERTICES(ctx, ctx->DriverFlags.NewSampleMask ? 0 : _NEW_MULTISAMPLE);
+ ctx->NewDriverState |= ctx->DriverFlags.NewSampleMask;
+ ctx->Multisample.SampleCoverageValue = value;
ctx->Multisample.SampleCoverageInvert = invert;
- ctx->NewState |= _NEW_MULTISAMPLE;
}
ctx->Multisample.SampleCoverage = GL_FALSE;
ctx->Multisample.SampleCoverageValue = 1.0;
ctx->Multisample.SampleCoverageInvert = GL_FALSE;
+ ctx->Multisample.SampleShading = GL_FALSE;
+ ctx->Multisample.MinSampleShadingValue = 0.0f;
/* ARB_texture_multisample / GL3.2 additions */
ctx->Multisample.SampleMask = GL_FALSE;
switch (pname) {
case GL_SAMPLE_POSITION: {
- if ((int) index >= ctx->DrawBuffer->Visual.samples) {
+ if (index >= ctx->DrawBuffer->Visual.samples) {
_mesa_error( ctx, GL_INVALID_VALUE, "glGetMultisamplefv(index)" );
return;
}
return;
}
+ case GL_PROGRAMMABLE_SAMPLE_LOCATION_ARB:
+ if (!ctx->Extensions.ARB_sample_locations) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetMultisamplefv(pname)" );
+ return;
+ }
+
+ if (index >= MAX_SAMPLE_LOCATION_TABLE_SIZE * 2) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glGetMultisamplefv(index)" );
+ return;
+ }
+
+ if (ctx->DrawBuffer->SampleLocationTable)
+ *val = ctx->DrawBuffer->SampleLocationTable[index];
+ else
+ *val = 0.5f;
+
+ return;
+
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glGetMultisamplefv(pname)" );
return;
}
}
+static void
+sample_maski(struct gl_context *ctx, GLuint index, GLbitfield mask)
+{
+ if (ctx->Multisample.SampleMaskValue == mask)
+ return;
+
+ FLUSH_VERTICES(ctx, ctx->DriverFlags.NewSampleMask ? 0 : _NEW_MULTISAMPLE);
+ ctx->NewDriverState |= ctx->DriverFlags.NewSampleMask;
+ ctx->Multisample.SampleMaskValue = mask;
+}
+
+void GLAPIENTRY
+_mesa_SampleMaski_no_error(GLuint index, GLbitfield mask)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ sample_maski(ctx, index, mask);
+}
+
void GLAPIENTRY
_mesa_SampleMaski(GLuint index, GLbitfield mask)
{
return;
}
- FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
- ctx->Multisample.SampleMaskValue = mask;
+ sample_maski(ctx, index, mask);
+}
+
+static void
+min_sample_shading(struct gl_context *ctx, GLclampf value)
+{
+ value = CLAMP(value, 0.0f, 1.0f);
+
+ if (ctx->Multisample.MinSampleShadingValue == value)
+ return;
+
+ FLUSH_VERTICES(ctx,
+ ctx->DriverFlags.NewSampleShading ? 0 : _NEW_MULTISAMPLE);
+ ctx->NewDriverState |= ctx->DriverFlags.NewSampleShading;
+ ctx->Multisample.MinSampleShadingValue = value;
}
/**
* Called via glMinSampleShadingARB
*/
+void GLAPIENTRY
+_mesa_MinSampleShading_no_error(GLclampf value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ min_sample_shading(ctx, value);
+}
+
void GLAPIENTRY
_mesa_MinSampleShading(GLclampf value)
{
GET_CURRENT_CONTEXT(ctx);
- if (!ctx->Extensions.ARB_sample_shading || !_mesa_is_desktop_gl(ctx)) {
+ if (!_mesa_has_ARB_sample_shading(ctx) &&
+ !_mesa_has_OES_sample_shading(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glMinSampleShading");
return;
}
- FLUSH_VERTICES(ctx, 0);
-
- ctx->Multisample.MinSampleShadingValue = CLAMP(value, 0.0f, 1.0f);
- ctx->NewState |= _NEW_MULTISAMPLE;
+ min_sample_shading(ctx, value);
}
/**
* for <internalformat> then the error INVALID_OPERATION is generated."
*/
if (ctx->Extensions.ARB_internalformat_query) {
- GLint buffer[16];
- int count = ctx->Driver.QuerySamplesForFormat(ctx, target,
- internalFormat, buffer);
- int limit = count ? buffer[0] : -1;
+ GLint buffer[16] = {-1};
+ GLint limit;
+
+ ctx->Driver.QueryInternalFormat(ctx, target, internalFormat,
+ GL_SAMPLES, buffer);
+ /* since the query returns samples sorted in descending order,
+ * the first element is the greatest supported sample value.
+ */
+ limit = buffer[0];
return samples > limit ? GL_INVALID_OPERATION : GL_NO_ERROR;
}