gl-renderer: define fragment shader compile_const

Compile time constants play an important role in keeping the shader
programs fast. Introduce an informal annotation to mark compile time
constants to make the shader code easier to reason with.

This will make much more sense once functions with compile time constant
parameters are added.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
dev
Pekka Paalanen 4 years ago
parent 734c2278f9
commit 37fe6fde49
  1. 7
      libweston/renderer-gl/fragment.glsl

@ -27,6 +27,9 @@
/* GLSL version 1.00 ES, defined in gl-shaders.c */ /* GLSL version 1.00 ES, defined in gl-shaders.c */
/* For annotating shader compile-time constant arguments */
#define compile_const const
/* /*
* Enumeration of shader variants, must match enum gl_shader_texture_variant. * Enumeration of shader variants, must match enum gl_shader_texture_variant.
*/ */
@ -49,8 +52,8 @@ precision mediump float;
* These undeclared identifiers will be #defined by a runtime generated code * These undeclared identifiers will be #defined by a runtime generated code
* snippet. * snippet.
*/ */
const int c_variant = DEF_VARIANT; compile_const int c_variant = DEF_VARIANT;
const bool c_green_tint = DEF_GREEN_TINT; compile_const bool c_green_tint = DEF_GREEN_TINT;
vec4 vec4
yuva2rgba(vec4 yuva) yuva2rgba(vec4 yuva)

Loading…
Cancel
Save