[virglrenderer-devel] [PATCH 4/6] add ARB_polygon_offset_clamp support
Dave Airlie
airlied at gmail.com
Mon May 21 06:09:35 UTC 2018
From: Dave Airlie <airlied at redhat.com>
Calls the new API and exposes the cap
---
src/virgl_hw.h | 1 +
src/vrend_renderer.c | 17 ++++++++++++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/virgl_hw.h b/src/virgl_hw.h
index a0c4874..102a43a 100644
--- a/src/virgl_hw.h
+++ b/src/virgl_hw.h
@@ -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 */
diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 10a1c0a..07a20af 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -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;
@@ -3701,7 +3702,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)
@@ -4256,6 +4261,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);
@@ -6968,6 +6976,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;
--
2.14.3
More information about the virglrenderer-devel
mailing list