add ARB_polygon_offset_clamp support

Calls the new API and exposes the cap

Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
macos/master
Dave Airlie 7 years ago
parent 7d4b9f972c
commit be265410c3
  1. 1
      src/virgl_hw.h
  2. 17
      src/vrend_renderer.c

@ -240,6 +240,7 @@ struct virgl_caps_bool_set1 {
unsigned has_cull:1;
unsigned conditional_render_inverted:1;
unsigned derivative_control:1;
unsigned polygon_offset_clamp:1;
};
/* endless expansion capabilites - current gallium has 252 formats */

@ -117,6 +117,7 @@ struct global_renderer_state {
bool have_stencil_texturing;
bool have_sample_shading;
bool have_texture_buffer_range;
bool have_polygon_offset_clamp;
/* these appeared broken on at least one driver */
bool use_explicit_locations;
@ -3698,7 +3699,11 @@ static void vrend_hw_emit_rs(struct vrend_context *ctx)
glProvokingVertexEXT(GL_LAST_VERTEX_CONVENTION_EXT);
}
}
glPolygonOffset(state->offset_scale, state->offset_units);
if (!vrend_state.use_gles && vrend_state.have_polygon_offset_clamp)
glPolygonOffsetClampEXT(state->offset_scale, state->offset_units, state->offset_clamp);
else
glPolygonOffset(state->offset_scale, state->offset_units);
if (vrend_state.use_core_profile == false) {
if (state->poly_stipple_enable)
@ -4253,6 +4258,9 @@ int vrend_renderer_init(struct vrend_if_cbs *cbs, uint32_t flags)
if (gl_ver >= 43 || epoxy_has_gl_extension("GL_ARB_texture_buffer_range"))
vrend_state.have_texture_buffer_range = true;
if (gl_ver >= 46 || epoxy_has_gl_extension("GL_ARB_polygon_offset_clamp"))
vrend_state.have_polygon_offset_clamp = true;
/* callbacks for when we are cleaning up the object table */
vrend_resource_set_destroy_callback(vrend_destroy_resource_object);
vrend_object_set_destroy_callback(VIRGL_OBJECT_QUERY, vrend_destroy_query_object);
@ -6965,6 +6973,13 @@ void vrend_renderer_fill_caps(uint32_t set, uint32_t version,
caps->v1.bset.derivative_control = 1;
}
if (gl_ver >= 46) {
caps->v1.bset.polygon_offset_clamp = 1;
} else {
if (epoxy_has_gl_extension("GL_ARB_polygon_offset_clamp"))
caps->v1.bset.polygon_offset_clamp = 1;
}
if (epoxy_has_gl_extension("GL_EXT_texture_mirror_clamp") ||
epoxy_has_gl_extension("GL_ARB_texture_mirror_clamp_to_edge")) {
caps->v1.bset.mirror_clamp = true;

Loading…
Cancel
Save