From cd14ff177ce3597ec0ebac072f8f6c02f09b79ae Mon Sep 17 00:00:00 2001 From: David Riley Date: Wed, 25 Jul 2018 17:09:17 -0700 Subject: [PATCH] renderer: Protect glSampleMaski and GL_SAMPLE_MASK. Currently based on feat_multisample, but glSampleMaski isn't supported with the same versions. v2: Update to use new feature code. Signed-off-by: David Riley Signed-off-by: Dave Airlie --- src/vrend_renderer.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 2c02083..6536dd8 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -113,6 +113,7 @@ enum features_id feat_nv_conditional_render, feat_nv_prim_restart, feat_polygon_offset_clamp, + feat_sample_mask, feat_sample_shading, feat_samplers, feat_ssbo, @@ -164,6 +165,7 @@ static const struct { [feat_nv_conditional_render] = { UNAVAIL, UNAVAIL, { "GL_NV_conditional_render" } }, [feat_nv_prim_restart] = { UNAVAIL, UNAVAIL, { "GL_NV_primitive_restart" } }, [feat_polygon_offset_clamp] = { 46, UNAVAIL, { "GL_ARB_polygon_offset_clamp" } }, + [feat_sample_mask] = { 32, 31, { "GL_ARB_texture_multisample" } }, [feat_sample_shading] = { 40, UNAVAIL, { "GL_ARB_sample_shading" } }, [feat_samplers] = { 33, UNAVAIL, { "GL_ARB_sampler_objects" } }, [feat_ssbo] = { 43, 31, { "GL_ARB_shader_storage_buffer_object" } }, @@ -4304,10 +4306,12 @@ static void vrend_hw_emit_rs(struct vrend_context *ctx) } if (has_feature(feat_multisample)) { - if (state->multisample) - glEnable(GL_SAMPLE_MASK); - else - glDisable(GL_SAMPLE_MASK); + if (has_feature(feat_sample_mask)) { + if (state->multisample) + glEnable(GL_SAMPLE_MASK); + else + glDisable(GL_SAMPLE_MASK); + } /* GLES doesn't have GL_MULTISAMPLE */ if (!vrend_state.use_gles) { @@ -6299,7 +6303,8 @@ void vrend_set_clip_state(struct vrend_context *ctx, struct pipe_clip_state *ucp void vrend_set_sample_mask(UNUSED struct vrend_context *ctx, unsigned sample_mask) { - glSampleMaski(0, sample_mask); + if (has_feature(feat_sample_mask)) + glSampleMaski(0, sample_mask); } void vrend_set_min_samples(struct vrend_context *ctx, unsigned min_samples)