gl-renderer: Use compile-time annotation in vertex shader
Reuse fragment shader's compile-time annotation logic in vertex shader for consistency. Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This commit is contained in:
parent
f7a14ba0e7
commit
22d9b9815f
|
@ -25,6 +25,9 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/* For annotating shader compile-time constant arguments */
|
||||
#define compile_const const
|
||||
|
||||
/* enum gl_shader_texcoord_input */
|
||||
#define SHADER_TEXCOORD_INPUT_ATTRIB 0
|
||||
#define SHADER_TEXCOORD_INPUT_SURFACE 1
|
||||
|
@ -47,13 +50,14 @@ attribute vec2 texcoord;
|
|||
/* Match the varying precision to the fragment shader */
|
||||
varying FRAG_PRECISION vec2 v_texcoord;
|
||||
|
||||
compile_const int c_texcoord_input = DEF_TEXCOORD_INPUT;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = proj * vec4(position, 0.0, 1.0);
|
||||
|
||||
#if DEF_TEXCOORD_INPUT == SHADER_TEXCOORD_INPUT_ATTRIB
|
||||
v_texcoord = texcoord;
|
||||
#elif DEF_TEXCOORD_INPUT == SHADER_TEXCOORD_INPUT_SURFACE
|
||||
v_texcoord = vec2(surface_to_buffer * vec4(position, 0.0, 1.0));
|
||||
#endif
|
||||
if (c_texcoord_input == SHADER_TEXCOORD_INPUT_ATTRIB)
|
||||
v_texcoord = texcoord;
|
||||
else if (c_texcoord_input == SHADER_TEXCOORD_INPUT_SURFACE)
|
||||
v_texcoord = vec2(surface_to_buffer * vec4(position, 0.0, 1.0));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue