Commit 54c91079 authored by Zhigang Gong's avatar Zhigang Gong

glamor-gles2: Add explicit precision qualifiers for gles2.

Signed-off-by: default avatarZhigang Gong <zhigang.gong@linux.intel.com>
parent b4f265c7
......@@ -151,10 +151,11 @@ glamor_init_finish_access_shaders(ScreenPtr screen)
"}\n";
const char *fs_source =
GLAMOR_DEFAULT_PRECISION
"varying vec2 source_texture;\n"
"uniform sampler2D sampler;\n"
"uniform int no_revert;"
"uniform int swap_rb;"
"uniform int no_revert;\n"
"uniform int swap_rb;\n"
"void main()\n"
"{\n"
" if (no_revert == 1) \n"
......@@ -174,10 +175,11 @@ glamor_init_finish_access_shaders(ScreenPtr screen)
"}\n";
const char *set_alpha_source =
GLAMOR_DEFAULT_PRECISION
"varying vec2 source_texture;\n"
"uniform sampler2D sampler;\n"
"uniform int no_revert;"
"uniform int swap_rb;"
"uniform int no_revert;\n"
"uniform int swap_rb;\n"
"void main()\n"
"{\n"
" if (no_revert == 1) \n"
......
......@@ -112,6 +112,7 @@ glamor_init_solid_shader(ScreenPtr screen)
" gl_Position = v_position;\n"
"}\n";
const char *solid_fs =
GLAMOR_DEFAULT_PRECISION
"uniform vec4 color;\n"
"void main()\n"
"{\n"
......
......@@ -36,7 +36,6 @@
#include "glamor.h"
#ifdef GLAMOR_GLES2
#define GL_BGRA GL_BGRA_EXT
#define GL_COLOR_INDEX 0x1900
#define GL_BITMAP 0x1A00
......@@ -77,9 +76,15 @@
#ifdef GLAMOR_GLES2
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#define GLAMOR_DEFAULT_PRECISION \
"precision mediump float;\n"
#else
#include <GL/gl.h>
#include <GL/glext.h>
#define GLAMOR_DEFAULT_PRECISION
#endif
......
......@@ -71,12 +71,14 @@ static GLuint
glamor_create_composite_fs(struct shader_key *key)
{
const char *source_solid_fetch =
GLAMOR_DEFAULT_PRECISION
"uniform vec4 source;\n"
"vec4 get_source()\n"
"{\n"
" return source;\n"
"}\n";
const char *source_alpha_pixmap_fetch =
GLAMOR_DEFAULT_PRECISION
"varying vec2 source_texture;\n"
"uniform sampler2D source_sampler;\n"
"vec4 get_source()\n"
......@@ -84,6 +86,7 @@ glamor_create_composite_fs(struct shader_key *key)
" return texture2D(source_sampler, source_texture);\n"
"}\n";
const char *source_pixmap_fetch =
GLAMOR_DEFAULT_PRECISION
"varying vec2 source_texture;\n"
"uniform sampler2D source_sampler;\n"
"vec4 get_source()\n"
......@@ -91,12 +94,14 @@ glamor_create_composite_fs(struct shader_key *key)
" return vec4(texture2D(source_sampler, source_texture).rgb, 1);\n"
"}\n";
const char *mask_solid_fetch =
GLAMOR_DEFAULT_PRECISION
"uniform vec4 mask;\n"
"vec4 get_mask()\n"
"{\n"
" return mask;\n"
"}\n";
const char *mask_alpha_pixmap_fetch =
GLAMOR_DEFAULT_PRECISION
"varying vec2 mask_texture;\n"
"uniform sampler2D mask_sampler;\n"
"vec4 get_mask()\n"
......@@ -104,6 +109,7 @@ glamor_create_composite_fs(struct shader_key *key)
" return texture2D(mask_sampler, mask_texture);\n"
"}\n";
const char *mask_pixmap_fetch =
GLAMOR_DEFAULT_PRECISION
"varying vec2 mask_texture;\n"
"uniform sampler2D mask_sampler;\n"
"vec4 get_mask()\n"
......@@ -111,21 +117,25 @@ glamor_create_composite_fs(struct shader_key *key)
" return vec4(texture2D(mask_sampler, mask_texture).rgb, 1);\n"
"}\n";
const char *in_source_only =
GLAMOR_DEFAULT_PRECISION
"void main()\n"
"{\n"
" gl_FragColor = get_source();\n"
"}\n";
const char *in_normal =
GLAMOR_DEFAULT_PRECISION
"void main()\n"
"{\n"
" gl_FragColor = get_source() * get_mask().a;\n"
"}\n";
const char *in_ca_source =
GLAMOR_DEFAULT_PRECISION
"void main()\n"
"{\n"
" gl_FragColor = get_source() * get_mask();\n"
"}\n";
const char *in_ca_alpha =
GLAMOR_DEFAULT_PRECISION
"void main()\n"
"{\n"
" gl_FragColor = get_source().a * get_mask();\n"
......
......@@ -50,6 +50,7 @@ glamor_init_tile_shader(ScreenPtr screen)
" tile_texture = v_texcoord0.xy;\n"
"}\n";
const char *tile_fs =
GLAMOR_DEFAULT_PRECISION
"varying vec2 tile_texture;\n"
"uniform sampler2D sampler;\n"
"void main()\n"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment