vrend: refactor vrender_get_glsl_version to return the value

There is no reason why this value should be obtained using a return
parameter. Also fix the version to return zero when the version string
doesn't follow the standard.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Rohan Garg <rohan.garg@collabora.com>
macos/master
Gert Wollny 4 years ago
parent 8f70103717
commit 4233c35791
  1. 13
      src/vrend_renderer.c

@ -757,7 +757,7 @@ static void vrend_destroy_query_object(void *obj_ptr);
static void vrend_finish_context_switch(struct vrend_context *ctx); static void vrend_finish_context_switch(struct vrend_context *ctx);
static void vrend_patch_blend_state(struct vrend_sub_context *sub_ctx); static void vrend_patch_blend_state(struct vrend_sub_context *sub_ctx);
static void vrend_update_frontface_state(struct vrend_sub_context *ctx); static void vrend_update_frontface_state(struct vrend_sub_context *ctx);
static void vrender_get_glsl_version(int *glsl_version); static int vrender_get_glsl_version(void);
static void vrend_destroy_program(struct vrend_linked_shader_program *ent); static void vrend_destroy_program(struct vrend_linked_shader_program *ent);
static void vrend_apply_sampler_state(struct vrend_sub_context *sub_ctx, static void vrend_apply_sampler_state(struct vrend_sub_context *sub_ctx,
struct vrend_resource *res, struct vrend_resource *res,
@ -6430,7 +6430,7 @@ struct vrend_context *vrend_create_context(int id, uint32_t nlen, const char *de
vrend_renderer_create_sub_ctx(grctx, 0); vrend_renderer_create_sub_ctx(grctx, 0);
vrend_renderer_set_sub_ctx(grctx, 0); vrend_renderer_set_sub_ctx(grctx, 0);
vrender_get_glsl_version(&grctx->shader_cfg.glsl_version); grctx->shader_cfg.glsl_version = vrender_get_glsl_version();
if (!grctx->ctx_id) if (!grctx->ctx_id)
grctx->fence_retire = vrend_clicbs->ctx0_fence_retire; grctx->fence_retire = vrend_clicbs->ctx0_fence_retire;
@ -9883,12 +9883,11 @@ int vrend_create_so_target(struct vrend_context *ctx,
return 0; return 0;
} }
static void vrender_get_glsl_version(int *glsl_version) static int vrender_get_glsl_version(void)
{ {
int major_local, minor_local; int major_local = 0, minor_local = 0;
const GLubyte *version_str; const GLubyte *version_str;
MAYBE_UNUSED int c; MAYBE_UNUSED int c;
int version;
version_str = glGetString(GL_SHADING_LANGUAGE_VERSION); version_str = glGetString(GL_SHADING_LANGUAGE_VERSION);
if (vrend_state.use_gles) { if (vrend_state.use_gles) {
@ -9902,9 +9901,7 @@ static void vrender_get_glsl_version(int *glsl_version)
assert(c == 2); assert(c == 2);
} }
version = (major_local * 100) + minor_local; return (major_local * 100) + minor_local;
if (glsl_version)
*glsl_version = version;
} }
static void vrend_fill_caps_glsl_version(int gl_ver, int gles_ver, static void vrend_fill_caps_glsl_version(int gl_ver, int gles_ver,

Loading…
Cancel
Save