mirror of
https://gitlab.freedesktop.org/wayland/weston
synced 2024-10-03 14:11:23 +00:00
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.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* For annotating shader compile-time constant arguments */
|
||||||
|
#define compile_const const
|
||||||
|
|
||||||
/* enum gl_shader_texcoord_input */
|
/* enum gl_shader_texcoord_input */
|
||||||
#define SHADER_TEXCOORD_INPUT_ATTRIB 0
|
#define SHADER_TEXCOORD_INPUT_ATTRIB 0
|
||||||
#define SHADER_TEXCOORD_INPUT_SURFACE 1
|
#define SHADER_TEXCOORD_INPUT_SURFACE 1
|
||||||
|
@ -47,13 +50,14 @@ attribute vec2 texcoord;
|
||||||
/* Match the varying precision to the fragment shader */
|
/* Match the varying precision to the fragment shader */
|
||||||
varying FRAG_PRECISION vec2 v_texcoord;
|
varying FRAG_PRECISION vec2 v_texcoord;
|
||||||
|
|
||||||
|
compile_const int c_texcoord_input = DEF_TEXCOORD_INPUT;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
gl_Position = proj * vec4(position, 0.0, 1.0);
|
gl_Position = proj * vec4(position, 0.0, 1.0);
|
||||||
|
|
||||||
#if DEF_TEXCOORD_INPUT == SHADER_TEXCOORD_INPUT_ATTRIB
|
if (c_texcoord_input == SHADER_TEXCOORD_INPUT_ATTRIB)
|
||||||
v_texcoord = texcoord;
|
v_texcoord = texcoord;
|
||||||
#elif DEF_TEXCOORD_INPUT == SHADER_TEXCOORD_INPUT_SURFACE
|
else if (c_texcoord_input == SHADER_TEXCOORD_INPUT_SURFACE)
|
||||||
v_texcoord = vec2(surface_to_buffer * vec4(position, 0.0, 1.0));
|
v_texcoord = vec2(surface_to_buffer * vec4(position, 0.0, 1.0));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue