glamor-gles2: Add explicit precision qualifiers for gles2.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
This commit is contained in:
parent
b4f265c7f9
commit
54c91079d2
|
@ -151,10 +151,11 @@ glamor_init_finish_access_shaders(ScreenPtr screen)
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
const char *fs_source =
|
const char *fs_source =
|
||||||
|
GLAMOR_DEFAULT_PRECISION
|
||||||
"varying vec2 source_texture;\n"
|
"varying vec2 source_texture;\n"
|
||||||
"uniform sampler2D sampler;\n"
|
"uniform sampler2D sampler;\n"
|
||||||
"uniform int no_revert;"
|
"uniform int no_revert;\n"
|
||||||
"uniform int swap_rb;"
|
"uniform int swap_rb;\n"
|
||||||
"void main()\n"
|
"void main()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" if (no_revert == 1) \n"
|
" if (no_revert == 1) \n"
|
||||||
|
@ -174,10 +175,11 @@ glamor_init_finish_access_shaders(ScreenPtr screen)
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
const char *set_alpha_source =
|
const char *set_alpha_source =
|
||||||
|
GLAMOR_DEFAULT_PRECISION
|
||||||
"varying vec2 source_texture;\n"
|
"varying vec2 source_texture;\n"
|
||||||
"uniform sampler2D sampler;\n"
|
"uniform sampler2D sampler;\n"
|
||||||
"uniform int no_revert;"
|
"uniform int no_revert;\n"
|
||||||
"uniform int swap_rb;"
|
"uniform int swap_rb;\n"
|
||||||
"void main()\n"
|
"void main()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" if (no_revert == 1) \n"
|
" if (no_revert == 1) \n"
|
||||||
|
|
|
@ -112,6 +112,7 @@ glamor_init_solid_shader(ScreenPtr screen)
|
||||||
" gl_Position = v_position;\n"
|
" gl_Position = v_position;\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
const char *solid_fs =
|
const char *solid_fs =
|
||||||
|
GLAMOR_DEFAULT_PRECISION
|
||||||
"uniform vec4 color;\n"
|
"uniform vec4 color;\n"
|
||||||
"void main()\n"
|
"void main()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
#include "glamor.h"
|
#include "glamor.h"
|
||||||
|
|
||||||
#ifdef GLAMOR_GLES2
|
#ifdef GLAMOR_GLES2
|
||||||
|
|
||||||
#define GL_BGRA GL_BGRA_EXT
|
#define GL_BGRA GL_BGRA_EXT
|
||||||
#define GL_COLOR_INDEX 0x1900
|
#define GL_COLOR_INDEX 0x1900
|
||||||
#define GL_BITMAP 0x1A00
|
#define GL_BITMAP 0x1A00
|
||||||
|
@ -77,9 +76,15 @@
|
||||||
#ifdef GLAMOR_GLES2
|
#ifdef GLAMOR_GLES2
|
||||||
#include <GLES2/gl2.h>
|
#include <GLES2/gl2.h>
|
||||||
#include <GLES2/gl2ext.h>
|
#include <GLES2/gl2ext.h>
|
||||||
|
|
||||||
|
#define GLAMOR_DEFAULT_PRECISION \
|
||||||
|
"precision mediump float;\n"
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
#include <GL/glext.h>
|
#include <GL/glext.h>
|
||||||
|
|
||||||
|
#define GLAMOR_DEFAULT_PRECISION
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -71,12 +71,14 @@ static GLuint
|
||||||
glamor_create_composite_fs(struct shader_key *key)
|
glamor_create_composite_fs(struct shader_key *key)
|
||||||
{
|
{
|
||||||
const char *source_solid_fetch =
|
const char *source_solid_fetch =
|
||||||
|
GLAMOR_DEFAULT_PRECISION
|
||||||
"uniform vec4 source;\n"
|
"uniform vec4 source;\n"
|
||||||
"vec4 get_source()\n"
|
"vec4 get_source()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" return source;\n"
|
" return source;\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
const char *source_alpha_pixmap_fetch =
|
const char *source_alpha_pixmap_fetch =
|
||||||
|
GLAMOR_DEFAULT_PRECISION
|
||||||
"varying vec2 source_texture;\n"
|
"varying vec2 source_texture;\n"
|
||||||
"uniform sampler2D source_sampler;\n"
|
"uniform sampler2D source_sampler;\n"
|
||||||
"vec4 get_source()\n"
|
"vec4 get_source()\n"
|
||||||
|
@ -84,6 +86,7 @@ glamor_create_composite_fs(struct shader_key *key)
|
||||||
" return texture2D(source_sampler, source_texture);\n"
|
" return texture2D(source_sampler, source_texture);\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
const char *source_pixmap_fetch =
|
const char *source_pixmap_fetch =
|
||||||
|
GLAMOR_DEFAULT_PRECISION
|
||||||
"varying vec2 source_texture;\n"
|
"varying vec2 source_texture;\n"
|
||||||
"uniform sampler2D source_sampler;\n"
|
"uniform sampler2D source_sampler;\n"
|
||||||
"vec4 get_source()\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"
|
" return vec4(texture2D(source_sampler, source_texture).rgb, 1);\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
const char *mask_solid_fetch =
|
const char *mask_solid_fetch =
|
||||||
|
GLAMOR_DEFAULT_PRECISION
|
||||||
"uniform vec4 mask;\n"
|
"uniform vec4 mask;\n"
|
||||||
"vec4 get_mask()\n"
|
"vec4 get_mask()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" return mask;\n"
|
" return mask;\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
const char *mask_alpha_pixmap_fetch =
|
const char *mask_alpha_pixmap_fetch =
|
||||||
|
GLAMOR_DEFAULT_PRECISION
|
||||||
"varying vec2 mask_texture;\n"
|
"varying vec2 mask_texture;\n"
|
||||||
"uniform sampler2D mask_sampler;\n"
|
"uniform sampler2D mask_sampler;\n"
|
||||||
"vec4 get_mask()\n"
|
"vec4 get_mask()\n"
|
||||||
|
@ -104,6 +109,7 @@ glamor_create_composite_fs(struct shader_key *key)
|
||||||
" return texture2D(mask_sampler, mask_texture);\n"
|
" return texture2D(mask_sampler, mask_texture);\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
const char *mask_pixmap_fetch =
|
const char *mask_pixmap_fetch =
|
||||||
|
GLAMOR_DEFAULT_PRECISION
|
||||||
"varying vec2 mask_texture;\n"
|
"varying vec2 mask_texture;\n"
|
||||||
"uniform sampler2D mask_sampler;\n"
|
"uniform sampler2D mask_sampler;\n"
|
||||||
"vec4 get_mask()\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"
|
" return vec4(texture2D(mask_sampler, mask_texture).rgb, 1);\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
const char *in_source_only =
|
const char *in_source_only =
|
||||||
|
GLAMOR_DEFAULT_PRECISION
|
||||||
"void main()\n"
|
"void main()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" gl_FragColor = get_source();\n"
|
" gl_FragColor = get_source();\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
const char *in_normal =
|
const char *in_normal =
|
||||||
|
GLAMOR_DEFAULT_PRECISION
|
||||||
"void main()\n"
|
"void main()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" gl_FragColor = get_source() * get_mask().a;\n"
|
" gl_FragColor = get_source() * get_mask().a;\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
const char *in_ca_source =
|
const char *in_ca_source =
|
||||||
|
GLAMOR_DEFAULT_PRECISION
|
||||||
"void main()\n"
|
"void main()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" gl_FragColor = get_source() * get_mask();\n"
|
" gl_FragColor = get_source() * get_mask();\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
const char *in_ca_alpha =
|
const char *in_ca_alpha =
|
||||||
|
GLAMOR_DEFAULT_PRECISION
|
||||||
"void main()\n"
|
"void main()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" gl_FragColor = get_source().a * get_mask();\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"
|
" tile_texture = v_texcoord0.xy;\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
const char *tile_fs =
|
const char *tile_fs =
|
||||||
|
GLAMOR_DEFAULT_PRECISION
|
||||||
"varying vec2 tile_texture;\n"
|
"varying vec2 tile_texture;\n"
|
||||||
"uniform sampler2D sampler;\n"
|
"uniform sampler2D sampler;\n"
|
||||||
"void main()\n"
|
"void main()\n"
|
||||||
|
|
Loading…
Reference in New Issue