vrend: Support caps struct v2

This new struct allows us to report:
- accurate max point size and line width
- accurate texel and texture gather offsets
- vertex and geometry shader limits
- one future tessellation limit

Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
macos/master
Stéphane Marchesin 7 years ago committed by Dave Airlie
parent 252b00d77c
commit 4977d1fa02
  1. 26
      src/virgl_hw.h
  2. 39
      src/vrend_renderer.c

@ -230,6 +230,9 @@ struct virgl_caps_bool_set1 {
unsigned texture_query_lod:1;
unsigned has_fp64:1;
unsigned has_tessellation_shaders:1;
unsigned has_indirect_draw:1;
unsigned has_sample_shading:1;
unsigned has_cull:1;
};
/* endless expansion capabilites - current gallium has 252 formats */
@ -257,9 +260,32 @@ struct virgl_caps_v1 {
uint32_t max_texture_gather_components;
};
struct virgl_caps_v2 {
struct virgl_caps_v1 v1;
float min_aliased_point_size;
float max_aliased_point_size;
float min_smooth_point_size;
float max_smooth_point_size;
float min_aliased_line_width;
float max_aliased_line_width;
float min_smooth_line_width;
float max_smooth_line_width;
float max_texture_lod_bias;
uint32_t max_geom_output_vertices;
uint32_t max_geom_total_output_components;
uint32_t max_vertex_outputs;
uint32_t max_vertex_attribs;
uint32_t max_shader_patch_varyings;
int32_t min_texel_offset;
int32_t max_texel_offset;
int32_t min_texture_gather_offset;
int32_t max_texture_gather_offset;
};
union virgl_caps {
uint32_t max_version;
struct virgl_caps_v1 v1;
struct virgl_caps_v2 v2;
};
enum virgl_errors {

@ -6239,6 +6239,7 @@ void vrend_renderer_fill_caps(uint32_t set, uint32_t version,
{
int i;
GLint max;
GLfloat range[2];
int gl_ver = epoxy_gl_version();
if (!caps)
@ -6251,7 +6252,7 @@ void vrend_renderer_fill_caps(uint32_t set, uint32_t version,
return;
}
caps->max_version = 1;
caps->max_version = 2;
caps->v1.bset.occlusion_query = 1;
if (gl_ver >= 30) {
@ -6412,6 +6413,40 @@ void vrend_renderer_fill_caps(uint32_t set, uint32_t version,
}
}
}
glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, range);
caps->v2.min_aliased_point_size = range[0];
caps->v2.max_aliased_point_size = range[1];
glGetFloatv(GL_SMOOTH_POINT_SIZE_RANGE, range);
caps->v2.min_smooth_point_size = range[0];
caps->v2.max_smooth_point_size = range[1];
glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, range);
caps->v2.min_aliased_line_width = range[0];
caps->v2.max_aliased_line_width = range[1];
glGetFloatv(GL_SMOOTH_LINE_WIDTH_RANGE, range);
caps->v2.min_smooth_line_width = range[0];
caps->v2.max_smooth_line_width = range[1];
glGetFloatv(GL_MAX_TEXTURE_LOD_BIAS, &caps->v2.max_texture_lod_bias);
glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &caps->v2.max_vertex_attribs);
glGetIntegerv(GL_MAX_VERTEX_OUTPUT_COMPONENTS, &max);
caps->v2.max_vertex_outputs = max / 4;
if (gl_ver >= 32) {
glGetIntegerv(GL_MAX_GEOMETRY_OUTPUT_VERTICES, &caps->v2.max_geom_output_vertices);
glGetIntegerv(GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS, &caps->v2.max_geom_total_output_components);
}
caps->v2.max_shader_patch_varyings = 0; // until we do tess.
if (epoxy_has_gl_extension("GL_ARB_texture_gather")) {
glGetIntegerv(GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET, &caps->v2.min_texture_gather_offset);
glGetIntegerv(GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET, &caps->v2.max_texture_gather_offset);
}
glGetIntegerv(GL_MIN_PROGRAM_TEXEL_OFFSET, &caps->v2.min_texel_offset);
glGetIntegerv(GL_MAX_PROGRAM_TEXEL_OFFSET, &caps->v2.max_texel_offset);
}
GLint64 vrend_renderer_get_timestamp(void)
@ -6583,7 +6618,7 @@ void vrend_renderer_get_cap_set(uint32_t cap_set, uint32_t *max_ver,
return;
}
*max_ver = 1;
*max_ver = 2;
*max_size = sizeof(union virgl_caps);
}

Loading…
Cancel
Save