src/render/opengles2/SDL_shaders_gles2.h
author Sam Lantinga <slouken@libsdl.org>
Wed, 16 Feb 2011 17:17:21 -0800
changeset 5328 f34a5f9ce9f6
parent 5262 b530ef003506
child 5535 96594ac5fd1a
permissions -rw-r--r--
Fixed bug 1122 (spinlock fails to compile with -march=armv4t)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5201
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     1
/*
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     2
    SDL - Simple DirectMedia Layer
5262
b530ef003506 Happy 2011! :)
Sam Lantinga <slouken@libsdl.org>
parents: 5260
diff changeset
     3
    Copyright (C) 1997-2011 Sam Lantinga
5201
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     4
    Copyright (C) 2010 itsnotabigtruck.
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     5
5260
62d2bc792002 itsnotabigtruck has given me permission to replace the license for his contribution.
Sam Lantinga <slouken@libsdl.org>
parents: 5204
diff changeset
     6
    This library is free software; you can redistribute it and/or
62d2bc792002 itsnotabigtruck has given me permission to replace the license for his contribution.
Sam Lantinga <slouken@libsdl.org>
parents: 5204
diff changeset
     7
    modify it under the terms of the GNU Lesser General Public
62d2bc792002 itsnotabigtruck has given me permission to replace the license for his contribution.
Sam Lantinga <slouken@libsdl.org>
parents: 5204
diff changeset
     8
    License as published by the Free Software Foundation; either
62d2bc792002 itsnotabigtruck has given me permission to replace the license for his contribution.
Sam Lantinga <slouken@libsdl.org>
parents: 5204
diff changeset
     9
    version 2.1 of the License, or (at your option) any later version.
5201
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    10
5260
62d2bc792002 itsnotabigtruck has given me permission to replace the license for his contribution.
Sam Lantinga <slouken@libsdl.org>
parents: 5204
diff changeset
    11
    This library is distributed in the hope that it will be useful,
62d2bc792002 itsnotabigtruck has given me permission to replace the license for his contribution.
Sam Lantinga <slouken@libsdl.org>
parents: 5204
diff changeset
    12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
62d2bc792002 itsnotabigtruck has given me permission to replace the license for his contribution.
Sam Lantinga <slouken@libsdl.org>
parents: 5204
diff changeset
    13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
62d2bc792002 itsnotabigtruck has given me permission to replace the license for his contribution.
Sam Lantinga <slouken@libsdl.org>
parents: 5204
diff changeset
    14
    Lesser General Public License for more details.
62d2bc792002 itsnotabigtruck has given me permission to replace the license for his contribution.
Sam Lantinga <slouken@libsdl.org>
parents: 5204
diff changeset
    15
62d2bc792002 itsnotabigtruck has given me permission to replace the license for his contribution.
Sam Lantinga <slouken@libsdl.org>
parents: 5204
diff changeset
    16
    You should have received a copy of the GNU Lesser General Public
62d2bc792002 itsnotabigtruck has given me permission to replace the license for his contribution.
Sam Lantinga <slouken@libsdl.org>
parents: 5204
diff changeset
    17
    License along with this library; if not, write to the Free Software
62d2bc792002 itsnotabigtruck has given me permission to replace the license for his contribution.
Sam Lantinga <slouken@libsdl.org>
parents: 5204
diff changeset
    18
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
62d2bc792002 itsnotabigtruck has given me permission to replace the license for his contribution.
Sam Lantinga <slouken@libsdl.org>
parents: 5204
diff changeset
    19
62d2bc792002 itsnotabigtruck has given me permission to replace the license for his contribution.
Sam Lantinga <slouken@libsdl.org>
parents: 5204
diff changeset
    20
    Sam Lantinga
62d2bc792002 itsnotabigtruck has given me permission to replace the license for his contribution.
Sam Lantinga <slouken@libsdl.org>
parents: 5204
diff changeset
    21
    slouken@libsdl.org
5201
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    22
*/
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    23
#include "SDL_config.h"
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    24
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    25
#if SDL_VIDEO_RENDER_OGL_ES2
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    26
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    27
#ifndef SDL_shaderdata_h_
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    28
#define SDL_shaderdata_h_
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    29
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    30
typedef struct GLES2_ShaderInstance
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    31
{
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    32
    GLenum type;
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    33
    GLenum format;
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    34
    int length;
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    35
    const void *data;
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    36
} GLES2_ShaderInstance;
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    37
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    38
typedef struct GLES2_Shader
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    39
{
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    40
    int instance_count;
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    41
    const GLES2_ShaderInstance *instances[4];
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    42
} GLES2_Shader;
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    43
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    44
typedef enum
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    45
{
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    46
    GLES2_SHADER_VERTEX_DEFAULT,
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    47
    GLES2_SHADER_FRAGMENT_SOLID_SRC,
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    48
    GLES2_SHADER_FRAGMENT_TEXTURE_SRC
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    49
} GLES2_ShaderType;
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    50
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    51
#define GLES2_SOURCE_SHADER (GLenum)-1
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    52
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    53
const GLES2_Shader *GLES2_GetShader(GLES2_ShaderType type, SDL_BlendMode blendMode);
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    54
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    55
#endif /* SDL_shaderdata_h_ */
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    56
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    57
#endif /* SDL_VIDEO_RENDER_OGL_ES2 */
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    58
523409574510 Added an OpenGL ES 2.0 renderer, contributed by itsnotabigtruck
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    59
/* vi: set ts=4 sw=4 expandtab: */