From d4eb0650576be5b2d41ea0f09b09dd21528a0e08 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Tue, 6 Nov 2018 12:28:02 +0100 Subject: [PATCH] vrend: refactor feature list to easily add names to features This change makes it simpler to log features that are tested for and used. Reviewed-by: Gurchetan Singh Tested-by: Jakob Bornecrantz Signed-off-by: Gert Wollny Signed-off-by: Jakob Bornecrantz --- src/vrend_renderer.c | 116 ++++++++++++++++++++++--------------------- 1 file changed, 60 insertions(+), 56 deletions(-) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 7c206aa..79e190c 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -151,67 +151,71 @@ enum features_id #define FEAT_MAX_EXTS 4 #define UNAVAIL INT_MAX +#define FEAT(NAME, GLVER, GLESVER, ...) \ + [feat_ ## NAME ] = {GLVER, GLESVER, { __VA_ARGS__ }, #NAME} + static const struct { int gl_ver; int gles_ver; const char *gl_ext[FEAT_MAX_EXTS]; + const char *log_name; } feature_list[] = { - [feat_arb_or_gles_ext_texture_buffer] = { 31, UNAVAIL, { "GL_ARB_texture_buffer_object", "GL_EXT_texture_buffer", NULL } }, - [feat_arb_robustness] = { UNAVAIL, UNAVAIL, { "GL_ARB_robustness" } }, - [feat_atomic_counters] = { 42, 31, { "GL_ARB_shader_atomic_counters" } }, - [feat_base_instance] = { 42, UNAVAIL, { "GL_ARB_base_instance", "GL_EXT_base_instance" } }, - [feat_barrier] = { 42, 31, {} }, - [feat_bit_encoding] = { 33, UNAVAIL, { "GL_ARB_shader_bit_encoding" } }, - [feat_compute_shader] = { 43, 31, { "GL_ARB_compute_shader" } }, - [feat_copy_image] = { 43, 32, { "GL_ARB_copy_image", "GL_EXT_copy_image", "GL_OES_copy_image" } }, - [feat_conditional_render_inverted] = { 45, UNAVAIL, { "GL_ARB_conditional_render_inverted" } }, - [feat_cube_map_array] = { 40, 32, { "GL_ARB_texture_cube_map_array", "GL_EXT_texture_cube_map_array", "GL_OES_texture_cube_map_array" } }, - [feat_debug_cb] = { UNAVAIL, UNAVAIL, {} }, /* special case */ - [feat_draw_instance] = { 31, 30, { "GL_ARB_draw_instanced" } }, - [feat_dual_src_blend] = { 33, UNAVAIL, { "GL_ARB_blend_func_extended" } }, - [feat_fb_no_attach] = { 43, 31, { "GL_ARB_framebuffer_no_attachments" } }, - [feat_framebuffer_fetch] = { UNAVAIL, UNAVAIL, { "GL_EXT_shader_framebuffer_fetch" } }, - [feat_geometry_shader] = { 32, 32, {"GL_EXT_geometry_shader", "GL_OES_geometry_shader"} }, - [feat_gl_conditional_render] = { 30, UNAVAIL, {} }, - [feat_gl_prim_restart] = { 31, 30, {} }, - [feat_gles_khr_robustness] = { UNAVAIL, UNAVAIL, { "GL_KHR_robustness" } }, - [feat_gles31_vertex_attrib_binding] = { 43, 31, { "GL_ARB_vertex_attrib_binding" } }, - [feat_gpu_shader5] = { 40, 32, {"GL_ARB_gpu_shader5", "GL_EXT_gpu_shader5", "GL_OES_gpu_shader5" } }, - [feat_images] = { 42, 31, { "GL_ARB_shader_image_load_store" } }, - [feat_indep_blend] = { 30, 32, { "GL_EXT_draw_buffers2", "GL_OES_draw_buffers_indexed" } }, - [feat_indep_blend_func] = { 40, 32, { "GL_ARB_draw_buffers_blend", "GL_OES_draw_buffers_indexed"} }, - [feat_indirect_draw] = { 40, 31, { "GL_ARB_draw_indirect" } }, - [feat_mesa_invert] = { UNAVAIL, UNAVAIL, { "GL_MESA_pack_invert" } }, - [feat_ms_scaled_blit] = { UNAVAIL, UNAVAIL, { "GL_EXT_framebuffer_multisample_blit_scaled" } }, - [feat_multisample] = { 32, 30, { "GL_ARB_texture_multisample" } }, - [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_robust_buffer_access] = { 43, UNAVAIL, { "GL_ARB_robust_buffer_access_behavior", "GL_KHR_robust_buffer_access_behavior" } }, - [feat_sample_mask] = { 32, 31, { "GL_ARB_texture_multisample" } }, - [feat_sample_shading] = { 40, 32, { "GL_ARB_sample_shading", "GL_OES_sample_shading" } }, - [feat_samplers] = { 33, 30, { "GL_ARB_sampler_objects" } }, - [feat_shader_clock] = { UNAVAIL, UNAVAIL, { "GL_ARB_shader_clock" } }, - [feat_ssbo] = { 43, 31, { "GL_ARB_shader_storage_buffer_object" } }, - [feat_ssbo_barrier] = { 43, 31, {} }, - [feat_stencil_texturing] = { 43, 31, { "GL_ARB_stencil_texturing" } }, - [feat_storage_multisample] = { 43, 31, { "GL_ARB_texture_storage_multisample" } }, - [feat_tessellation] = { 40, 32, { "GL_ARB_tessellation_shader", "GL_OES_tessellation_shader", "GL_EXT_tessellation_shader" } }, - [feat_texture_array] = { 30, 30, { "GL_EXT_texture_array" } }, - [feat_texture_barrier] = { 45, UNAVAIL, { "GL_ARB_texture_barrier" } }, - [feat_texture_buffer_range] = { 43, 32, { "GL_ARB_texture_buffer_range" } }, - [feat_texture_gather] = { 40, 31, { "GL_ARB_texture_gather" } }, - [feat_texture_multisample] = { 32, 30, { "GL_ARB_texture_multisample" } }, - [feat_texture_srgb_decode] = { UNAVAIL, UNAVAIL, { "GL_EXT_texture_sRGB_decode" } }, - [feat_texture_storage] = { 42, 30, { "GL_ARB_texture_storage" } }, - [feat_texture_view] = { 43, UNAVAIL, { "GL_ARB_texture_view" } }, - [feat_transform_feedback] = { 30, 30, { "GL_EXT_transform_feedback" } }, - [feat_transform_feedback2] = { 40, 30, { "GL_ARB_transform_feedback2" } }, - [feat_transform_feedback3] = { 40, UNAVAIL, { "GL_ARB_transform_feedback3" } }, - [feat_transform_feedback_overflow_query] = { 46, UNAVAIL, { "GL_ARB_transform_feedback_overflow_query" } }, - [feat_txqs] = { 45, UNAVAIL, { "GL_ARB_shader_texture_image_samples" } }, - [feat_ubo] = { 31, 30, { "GL_ARB_uniform_buffer_object" } }, - [feat_viewport_array] = { 41, UNAVAIL, { "GL_ARB_viewport_array" } }, + FEAT(arb_or_gles_ext_texture_buffer, 31, UNAVAIL, "GL_ARB_texture_buffer_object", "GL_EXT_texture_buffer", NULL), + FEAT(arb_robustness, UNAVAIL, UNAVAIL, "GL_ARB_robustness" ), + FEAT(atomic_counters, 42, 31, "GL_ARB_shader_atomic_counters" ), + FEAT(base_instance, 42, UNAVAIL, "GL_ARB_base_instance", "GL_EXT_base_instance" ), + FEAT(barrier, 42, 31, NULL), + FEAT(bit_encoding, 33, UNAVAIL, "GL_ARB_shader_bit_encoding" ), + FEAT(compute_shader, 43, 31, "GL_ARB_compute_shader" ), + FEAT(copy_image, 43, 32, "GL_ARB_copy_image", "GL_EXT_copy_image", "GL_OES_copy_image" ), + FEAT(conditional_render_inverted, 45, UNAVAIL, "GL_ARB_conditional_render_inverted" ), + FEAT(cube_map_array, 40, 32, "GL_ARB_texture_cube_map_array", "GL_EXT_texture_cube_map_array", "GL_OES_texture_cube_map_array" ), + FEAT(debug_cb, UNAVAIL, UNAVAIL, NULL), /* special case */ + FEAT(draw_instance, 31, 30, "GL_ARB_draw_instanced" ), + FEAT(dual_src_blend, 33, UNAVAIL, "GL_ARB_blend_func_extended" ), + FEAT(fb_no_attach, 43, 31, "GL_ARB_framebuffer_no_attachments" ), + FEAT(framebuffer_fetch, UNAVAIL, UNAVAIL, "GL_EXT_shader_framebuffer_fetch" ), + FEAT(geometry_shader, 32, 32, "GL_EXT_geometry_shader", "GL_OES_geometry_shader"), + FEAT(gl_conditional_render, 30, UNAVAIL, NULL), + FEAT(gl_prim_restart, 31, 30, NULL), + FEAT(gles_khr_robustness, UNAVAIL, UNAVAIL, "GL_KHR_robustness" ), + FEAT(gles31_vertex_attrib_binding, 43, 31, "GL_ARB_vertex_attrib_binding" ), + FEAT(gpu_shader5, 40, 32, "GL_ARB_gpu_shader5", "GL_EXT_gpu_shader5", "GL_OES_gpu_shader5" ), + FEAT(images, 42, 31, "GL_ARB_shader_image_load_store" ), + FEAT(indep_blend, 30, 32, "GL_EXT_draw_buffers2", "GL_OES_draw_buffers_indexed" ), + FEAT(indep_blend_func, 40, 32, "GL_ARB_draw_buffers_blend", "GL_OES_draw_buffers_indexed"), + FEAT(indirect_draw, 40, 31, "GL_ARB_draw_indirect" ), + FEAT(mesa_invert, UNAVAIL, UNAVAIL, "GL_MESA_pack_invert" ), + FEAT(ms_scaled_blit, UNAVAIL, UNAVAIL, "GL_EXT_framebuffer_multisample_blit_scaled" ), + FEAT(multisample, 32, 30, "GL_ARB_texture_multisample" ), + 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(robust_buffer_access, 43, UNAVAIL, "GL_ARB_robust_buffer_access_behavior", "GL_KHR_robust_buffer_access_behavior" ), + FEAT(sample_mask, 32, 31, "GL_ARB_texture_multisample" ), + FEAT(sample_shading, 40, 32, "GL_ARB_sample_shading", "GL_OES_sample_shading" ), + FEAT(samplers, 33, 30, "GL_ARB_sampler_objects" ), + FEAT(shader_clock, UNAVAIL, UNAVAIL, "GL_ARB_shader_clock" ), + FEAT(ssbo, 43, 31, "GL_ARB_shader_storage_buffer_object" ), + FEAT(ssbo_barrier, 43, 31, NULL), + FEAT(stencil_texturing, 43, 31, "GL_ARB_stencil_texturing" ), + FEAT(storage_multisample, 43, 31, "GL_ARB_texture_storage_multisample" ), + FEAT(tessellation, 40, 32, "GL_ARB_tessellation_shader", "GL_OES_tessellation_shader", "GL_EXT_tessellation_shader" ), + FEAT(texture_array, 30, 30, "GL_EXT_texture_array" ), + FEAT(texture_barrier, 45, UNAVAIL, "GL_ARB_texture_barrier" ), + FEAT(texture_buffer_range, 43, 32, "GL_ARB_texture_buffer_range" ), + FEAT(texture_gather, 40, 31, "GL_ARB_texture_gather" ), + FEAT(texture_multisample, 32, 30, "GL_ARB_texture_multisample" ), + FEAT(texture_srgb_decode, UNAVAIL, UNAVAIL, "GL_EXT_texture_sRGB_decode" ), + FEAT(texture_storage, 42, 30, "GL_ARB_texture_storage" ), + FEAT(texture_view, 43, UNAVAIL, "GL_ARB_texture_view" ), + FEAT(transform_feedback, 30, 30, "GL_EXT_transform_feedback" ), + FEAT(transform_feedback2, 40, 30, "GL_ARB_transform_feedback2" ), + FEAT(transform_feedback3, 40, UNAVAIL, "GL_ARB_transform_feedback3" ), + FEAT(transform_feedback_overflow_query, 46, UNAVAIL, "GL_ARB_transform_feedback_overflow_query" ), + FEAT(txqs, 45, UNAVAIL, "GL_ARB_shader_texture_image_samples" ), + FEAT(ubo, 31, 30, "GL_ARB_uniform_buffer_object" ), + FEAT(viewport_array, 41, UNAVAIL, "GL_ARB_viewport_array" ), }; struct global_renderer_state {