This CL removes all dependencies on GL headers across all of Ganesh. New

GrGLint, etc. types are introduced, and new GR_GL_XXXX constants for use at all
GL call-sites.

Review:  http://codereview.appspot.com/4272061/



git-svn-id: http://skia.googlecode.com/svn/trunk@959 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
twiz@google.com 2011-03-18 17:38:11 +00:00
parent 098611bd74
commit 0f31ca79bd
22 changed files with 1247 additions and 882 deletions

View File

@ -20,6 +20,7 @@
#include "GrTypes.h"
#include "GrGLInterface.h"
#include "GrGLDefines.h"
/**
* The following are optional defines that can be enabled at the compiler
@ -66,19 +67,19 @@
#if GR_SCALAR_IS_FIXED
#define GrGLType GL_FIXED
#elif GR_SCALAR_IS_FLOAT
#define GrGLType GL_FLOAT
#define GrGLType GR_GL_FLOAT
#else
#error "unknown GR_SCALAR type"
#endif
#if GR_TEXT_SCALAR_IS_USHORT
#define GrGLTextType GL_UNSIGNED_SHORT
#define GrGLTextType GR_GL_UNSIGNED_SHORT
#define GR_GL_TEXT_TEXTURE_NORMALIZED 1
#elif GR_TEXT_SCALAR_IS_FLOAT
#define GrGLTextType GL_FLOAT
#define GrGLTextType GR_GL_FLOAT
#define GR_GL_TEXT_TEXTURE_NORMALIZED 0
#elif GR_TEXT_SCALAR_IS_FIXED
#define GrGLTextType GL_FIXED
#define GrGLTextType GR_GL_FIXED
#define GR_GL_TEXT_TEXTURE_NORMALIZED 0
#else
#error "unknown GR_TEXT_SCALAR type"
@ -90,7 +91,7 @@
#if GR_WIN32_BUILD
#define GR_GL_32BPP_COLOR_FORMAT GR_BGRA //use GR prefix because this
#else //may be an extension.
#define GR_GL_32BPP_COLOR_FORMAT GL_RGBA
#define GR_GL_32BPP_COLOR_FORMAT GR_GL_RGBA
#endif
#endif
@ -137,7 +138,7 @@
extern void GrGLCheckErr(const char* location, const char* call);
static inline void GrGLClearErr() {
while (GL_NO_ERROR != GrGLGetGLInterface()->fGetError()) {}
while (GR_GL_NO_ERROR != GrGLGetGLInterface()->fGetError()) {}
}
#if GR_GL_CHECK_ERROR
@ -165,7 +166,7 @@ static inline void GrGLClearErr() {
*/
#if GR_SUPPORT_GLDESKTOP
static inline void GrGL_RestoreResetRowLength() {
GR_GL(PixelStorei(GL_UNPACK_ROW_LENGTH, 0));
GR_GL(PixelStorei(GR_GL_UNPACK_ROW_LENGTH, 0));
}
#else
#define GrGL_RestoreResetRowLength()

View File

@ -8,10 +8,10 @@
#define GL_OES_mapbuffer 0
#define GL_IMG_multisampled_render_to_texture 0
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#define GR_GL_PLATFORM_HEADER <GLES2/gl2.h>
#define GR_GL_PLATFORM_HEADER_EXT <GLES2/gl2ext.h>
#define GR_GL_FUNC
#define GR_GL_FUNCTION_TYPE
#define GR_GL_PROC_ADDRESS(X) &X

628
gpu/include/GrGLDefines.h Normal file
View File

@ -0,0 +1,628 @@
/*
Copyright 2011 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef GrGLDefines_DEFINED
#define GrGLDefines_DEFINED
// The following constants consist of the intersection of GL constants
// exported by GLES 1.0, GLES 2.0, and desktop GL required by the system.
#define GR_GL_DEPTH_BUFFER_BIT 0x00000100
#define GR_GL_STENCIL_BUFFER_BIT 0x00000400
#define GR_GL_COLOR_BUFFER_BIT 0x00004000
/* Boolean */
#define GR_GL_FALSE 0
#define GR_GL_TRUE 1
/* BeginMode */
#define GR_GL_POINTS 0x0000
#define GR_GL_LINES 0x0001
#define GR_GL_LINE_LOOP 0x0002
#define GR_GL_LINE_STRIP 0x0003
#define GR_GL_TRIANGLES 0x0004
#define GR_GL_TRIANGLE_STRIP 0x0005
#define GR_GL_TRIANGLE_FAN 0x0006
/* AlphaFunction (not supported in ES20) */
/* GL_NEVER */
/* GL_LESS */
/* GL_EQUAL */
/* GL_LEQUAL */
/* GL_GREATER */
/* GL_NOTEQUAL */
/* GL_GEQUAL */
/* GL_ALWAYS */
/* BlendingFactorDest */
#define GR_GL_ZERO 0
#define GR_GL_ONE 1
#define GR_GL_SRC_COLOR 0x0300
#define GR_GL_ONE_MINUS_SRC_COLOR 0x0301
#define GR_GL_SRC_ALPHA 0x0302
#define GR_GL_ONE_MINUS_SRC_ALPHA 0x0303
#define GR_GL_DST_ALPHA 0x0304
#define GR_GL_ONE_MINUS_DST_ALPHA 0x0305
/* BlendingFactorSrc */
/* GL_ZERO */
/* GL_ONE */
#define GR_GL_DST_COLOR 0x0306
#define GR_GL_ONE_MINUS_DST_COLOR 0x0307
#define GR_GL_SRC_ALPHA_SATURATE 0x0308
/* GL_SRC_ALPHA */
/* GL_ONE_MINUS_SRC_ALPHA */
/* GL_DST_ALPHA */
/* GL_ONE_MINUS_DST_ALPHA */
/* BlendEquationSeparate */
#define GR_GL_FUNC_ADD 0x8006
#define GR_GL_BLEND_EQUATION 0x8009
#define GR_GL_BLEND_EQUATION_RGB 0x8009 /* same as BLEND_EQUATION */
#define GR_GL_BLEND_EQUATION_ALPHA 0x883D
/* BlendSubtract */
#define GR_GL_FUNC_SUBTRACT 0x800A
#define GR_GL_FUNC_REVERSE_SUBTRACT 0x800B
/* Separate Blend Functions */
#define GR_GL_BLEND_DST_RGB 0x80C8
#define GR_GL_BLEND_SRC_RGB 0x80C9
#define GR_GL_BLEND_DST_ALPHA 0x80CA
#define GR_GL_BLEND_SRC_ALPHA 0x80CB
#define GR_GL_CONSTANT_COLOR 0x8001
#define GR_GL_ONE_MINUS_CONSTANT_COLOR 0x8002
#define GR_GL_CONSTANT_ALPHA 0x8003
#define GR_GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
#define GR_GL_BLEND_COLOR 0x8005
/* Buffer Objects */
#define GR_GL_ARRAY_BUFFER 0x8892
#define GR_GL_ELEMENT_ARRAY_BUFFER 0x8893
#define GR_GL_ARRAY_BUFFER_BINDING 0x8894
#define GR_GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
#define GR_GL_STREAM_DRAW 0x88E0
#define GR_GL_STATIC_DRAW 0x88E4
#define GR_GL_DYNAMIC_DRAW 0x88E8
#define GR_GL_BUFFER_SIZE 0x8764
#define GR_GL_BUFFER_USAGE 0x8765
#define GR_GL_CURRENT_VERTEX_ATTRIB 0x8626
/* CullFaceMode */
#define GR_GL_FRONT 0x0404
#define GR_GL_BACK 0x0405
#define GR_GL_FRONT_AND_BACK 0x0408
/* DepthFunction */
/* GL_NEVER */
/* GL_LESS */
/* GL_EQUAL */
/* GL_LEQUAL */
/* GL_GREATER */
/* GL_NOTEQUAL */
/* GL_GEQUAL */
/* GL_ALWAYS */
/* EnableCap */
#define GR_GL_TEXTURE_2D 0x0DE1
#define GR_GL_CULL_FACE 0x0B44
#define GR_GL_BLEND 0x0BE2
#define GR_GL_DITHER 0x0BD0
#define GR_GL_STENCIL_TEST 0x0B90
#define GR_GL_DEPTH_TEST 0x0B71
#define GR_GL_SCISSOR_TEST 0x0C11
#define GR_GL_POLYGON_OFFSET_FILL 0x8037
#define GR_GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
#define GR_GL_SAMPLE_COVERAGE 0x80A0
/* ErrorCode */
#define GR_GL_NO_ERROR 0
#define GR_GL_INVALID_ENUM 0x0500
#define GR_GL_INVALID_VALUE 0x0501
#define GR_GL_INVALID_OPERATION 0x0502
#define GR_GL_OUT_OF_MEMORY 0x0505
#define GR_GL_CONTEXT_LOST 0x300E // TODO(gman): What value?
/* FrontFaceDirection */
#define GR_GL_CW 0x0900
#define GR_GL_CCW 0x0901
/* GetPName */
#define GR_GL_LINE_WIDTH 0x0B21
#define GR_GL_ALIASED_POINT_SIZE_RANGE 0x846D
#define GR_GL_ALIASED_LINE_WIDTH_RANGE 0x846E
#define GR_GL_CULL_FACE_MODE 0x0B45
#define GR_GL_FRONT_FACE 0x0B46
#define GR_GL_DEPTH_RANGE 0x0B70
#define GR_GL_DEPTH_WRITEMASK 0x0B72
#define GR_GL_DEPTH_CLEAR_VALUE 0x0B73
#define GR_GL_DEPTH_FUNC 0x0B74
#define GR_GL_STENCIL_CLEAR_VALUE 0x0B91
#define GR_GL_STENCIL_FUNC 0x0B92
#define GR_GL_STENCIL_FAIL 0x0B94
#define GR_GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
#define GR_GL_STENCIL_PASS_DEPTH_PASS 0x0B96
#define GR_GL_STENCIL_REF 0x0B97
#define GR_GL_STENCIL_VALUE_MASK 0x0B93
#define GR_GL_STENCIL_WRITEMASK 0x0B98
#define GR_GL_STENCIL_BACK_FUNC 0x8800
#define GR_GL_STENCIL_BACK_FAIL 0x8801
#define GR_GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
#define GR_GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
#define GR_GL_STENCIL_BACK_REF 0x8CA3
#define GR_GL_STENCIL_BACK_VALUE_MASK 0x8CA4
#define GR_GL_STENCIL_BACK_WRITEMASK 0x8CA5
#define GR_GL_VIEWPORT 0x0BA2
#define GR_GL_SCISSOR_BOX 0x0C10
/* GL_SCISSOR_TEST */
#define GR_GL_COLOR_CLEAR_VALUE 0x0C22
#define GR_GL_COLOR_WRITEMASK 0x0C23
#define GR_GL_UNPACK_ALIGNMENT 0x0CF5
#define GR_GL_PACK_ALIGNMENT 0x0D05
#define GR_GL_MAX_TEXTURE_SIZE 0x0D33
#define GR_GL_MAX_VIEWPORT_DIMS 0x0D3A
#define GR_GL_SUBPIXEL_BITS 0x0D50
#define GR_GL_RED_BITS 0x0D52
#define GR_GL_GREEN_BITS 0x0D53
#define GR_GL_BLUE_BITS 0x0D54
#define GR_GL_ALPHA_BITS 0x0D55
#define GR_GL_DEPTH_BITS 0x0D56
#define GR_GL_STENCIL_BITS 0x0D57
#define GR_GL_POLYGON_OFFSET_UNITS 0x2A00
/* GL_POLYGON_OFFSET_FILL */
#define GR_GL_POLYGON_OFFSET_FACTOR 0x8038
#define GR_GL_TEXTURE_BINDING_2D 0x8069
#define GR_GL_SAMPLE_BUFFERS 0x80A8
#define GR_GL_SAMPLES 0x80A9
#define GR_GL_SAMPLE_COVERAGE_VALUE 0x80AA
#define GR_GL_SAMPLE_COVERAGE_INVERT 0x80AB
/* GetTextureParameter */
/* GL_TEXTURE_MAG_FILTER */
/* GL_TEXTURE_MIN_FILTER */
/* GL_TEXTURE_WRAP_S */
/* GL_TEXTURE_WRAP_T */
#define GR_GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
#define GR_GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
/* HintMode */
#define GR_GL_DONT_CARE 0x1100
#define GR_GL_FASTEST 0x1101
#define GR_GL_NICEST 0x1102
/* HintTarget */
#define GR_GL_GENERATE_MIPMAP_HINT 0x8192
/* DataType */
#define GR_GL_BYTE 0x1400
#define GR_GL_UNSIGNED_BYTE 0x1401
#define GR_GL_SHORT 0x1402
#define GR_GL_UNSIGNED_SHORT 0x1403
#define GR_GL_INT 0x1404
#define GR_GL_UNSIGNED_INT 0x1405
#define GR_GL_FLOAT 0x1406
#define GR_GL_FIXED 0x140C
/* Lighting */
#define GR_GL_LIGHTING 0x0B50
#define GR_GL_LIGHT0 0x4000
#define GR_GL_LIGHT1 0x4001
#define GR_GL_LIGHT2 0x4002
#define GR_GL_LIGHT3 0x4003
#define GR_GL_LIGHT4 0x4004
#define GR_GL_LIGHT5 0x4005
#define GR_GL_LIGHT6 0x4006
#define GR_GL_LIGHT7 0x4007
#define GR_GL_SPOT_EXPONENT 0x1205
#define GR_GL_SPOT_CUTOFF 0x1206
#define GR_GL_CONSTANT_ATTENUATION 0x1207
#define GR_GL_LINEAR_ATTENUATION 0x1208
#define GR_GL_QUADRATIC_ATTENUATION 0x1209
#define GR_GL_AMBIENT 0x1200
#define GR_GL_DIFFUSE 0x1201
#define GR_GL_SPECULAR 0x1202
#define GR_GL_SHININESS 0x1601
#define GR_GL_EMISSION 0x1600
#define GR_GL_POSITION 0x1203
#define GR_GL_SPOT_DIRECTION 0x1204
#define GR_GL_AMBIENT_AND_DIFFUSE 0x1602
#define GR_GL_COLOR_INDEXES 0x1603
#define GR_GL_LIGHT_MODEL_TWO_SIDE 0x0B52
#define GR_GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51
#define GR_GL_LIGHT_MODEL_AMBIENT 0x0B53
#define GR_GL_FRONT_AND_BACK 0x0408
#define GR_GL_SHADE_MODEL 0x0B54
#define GR_GL_FLAT 0x1D00
#define GR_GL_SMOOTH 0x1D01
#define GR_GL_COLOR_MATERIAL 0x0B57
#define GR_GL_COLOR_MATERIAL_FACE 0x0B55
#define GR_GL_COLOR_MATERIAL_PARAMETER 0x0B56
#define GR_GL_NORMALIZE 0x0BA1
/* Matrix Mode */
#define GR_GL_MATRIX_MODE 0x0BA0
#define GR_GL_MODELVIEW 0x1700
#define GR_GL_PROJECTION 0x1701
#define GR_GL_TEXTURE 0x1702
/* multisample */
#define GR_GL_MULTISAMPLE 0x809D
/* Points */
#define GR_GL_POINT_SMOOTH 0x0B10
#define GR_GL_POINT_SIZE 0x0B11
#define GR_GL_POINT_SIZE_GRANULARITY 0x0B13
#define GR_GL_POINT_SIZE_RANGE 0x0B12
/* Lines */
#define GR_GL_LINE_SMOOTH 0x0B20
#define GR_GL_LINE_STIPPLE 0x0B24
#define GR_GL_LINE_STIPPLE_PATTERN 0x0B25
#define GR_GL_LINE_STIPPLE_REPEAT 0x0B26
#define GR_GL_LINE_WIDTH 0x0B21
#define GR_GL_LINE_WIDTH_GRANULARITY 0x0B23
#define GR_GL_LINE_WIDTH_RANGE 0x0B22
/* PixelFormat */
#define GR_GL_DEPTH_COMPONENT 0x1902
#define GR_GL_ALPHA 0x1906
#define GR_GL_RGB 0x1907
#define GR_GL_RGBA 0x1908
#define GR_GL_LUMINANCE 0x1909
#define GR_GL_LUMINANCE_ALPHA 0x190A
/* PixelType */
/* GL_UNSIGNED_BYTE */
#define GR_GL_UNSIGNED_SHORT_4_4_4_4 0x8033
#define GR_GL_UNSIGNED_SHORT_5_5_5_1 0x8034
#define GR_GL_UNSIGNED_SHORT_5_6_5 0x8363
/* Shaders */
#define GR_GL_FRAGMENT_SHADER 0x8B30
#define GR_GL_VERTEX_SHADER 0x8B31
#define GR_GL_MAX_VERTEX_ATTRIBS 0x8869
#define GR_GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
#define GR_GL_MAX_VARYING_VECTORS 0x8DFC
#define GR_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
#define GR_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
#define GR_GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
#define GR_GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
#define GR_GL_SHADER_TYPE 0x8B4F
#define GR_GL_DELETE_STATUS 0x8B80
#define GR_GL_LINK_STATUS 0x8B82
#define GR_GL_VALIDATE_STATUS 0x8B83
#define GR_GL_ATTACHED_SHADERS 0x8B85
#define GR_GL_ACTIVE_UNIFORMS 0x8B86
#define GR_GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
#define GR_GL_ACTIVE_ATTRIBUTES 0x8B89
#define GR_GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
#define GR_GL_SHADING_LANGUAGE_VERSION 0x8B8C
#define GR_GL_CURRENT_PROGRAM 0x8B8D
/* StencilFunction */
#define GR_GL_NEVER 0x0200
#define GR_GL_LESS 0x0201
#define GR_GL_EQUAL 0x0202
#define GR_GL_LEQUAL 0x0203
#define GR_GL_GREATER 0x0204
#define GR_GL_NOTEQUAL 0x0205
#define GR_GL_GEQUAL 0x0206
#define GR_GL_ALWAYS 0x0207
/* StencilOp */
/* GL_ZERO */
#define GR_GL_KEEP 0x1E00
#define GR_GL_REPLACE 0x1E01
#define GR_GL_INCR 0x1E02
#define GR_GL_DECR 0x1E03
#define GR_GL_INVERT 0x150A
#define GR_GL_INCR_WRAP 0x8507
#define GR_GL_DECR_WRAP 0x8508
/* StringName */
#define GR_GL_VENDOR 0x1F00
#define GR_GL_RENDERER 0x1F01
#define GR_GL_VERSION 0x1F02
#define GR_GL_EXTENSIONS 0x1F03
/* Pixel Mode / Transfer */
#define GR_GL_UNPACK_ROW_LENGTH 0x0CF2
/* TextureMagFilter */
#define GR_GL_NEAREST 0x2600
#define GR_GL_LINEAR 0x2601
/* TextureMinFilter */
/* GL_NEAREST */
/* GL_LINEAR */
#define GR_GL_NEAREST_MIPMAP_NEAREST 0x2700
#define GR_GL_LINEAR_MIPMAP_NEAREST 0x2701
#define GR_GL_NEAREST_MIPMAP_LINEAR 0x2702
#define GR_GL_LINEAR_MIPMAP_LINEAR 0x2703
/* TextureParameterName */
#define GR_GL_TEXTURE_MAG_FILTER 0x2800
#define GR_GL_TEXTURE_MIN_FILTER 0x2801
#define GR_GL_TEXTURE_WRAP_S 0x2802
#define GR_GL_TEXTURE_WRAP_T 0x2803
/* TextureTarget */
/* GL_TEXTURE_2D */
#define GR_GL_TEXTURE 0x1702
#define GR_GL_TEXTURE_CUBE_MAP 0x8513
#define GR_GL_TEXTURE_BINDING_CUBE_MAP 0x8514
#define GR_GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
#define GR_GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
#define GR_GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
#define GR_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
#define GR_GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
#define GR_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
#define GR_GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
/* TextureUnit */
#define GR_GL_TEXTURE0 0x84C0
#define GR_GL_TEXTURE1 0x84C1
#define GR_GL_TEXTURE2 0x84C2
#define GR_GL_TEXTURE3 0x84C3
#define GR_GL_TEXTURE4 0x84C4
#define GR_GL_TEXTURE5 0x84C5
#define GR_GL_TEXTURE6 0x84C6
#define GR_GL_TEXTURE7 0x84C7
#define GR_GL_TEXTURE8 0x84C8
#define GR_GL_TEXTURE9 0x84C9
#define GR_GL_TEXTURE10 0x84CA
#define GR_GL_TEXTURE11 0x84CB
#define GR_GL_TEXTURE12 0x84CC
#define GR_GL_TEXTURE13 0x84CD
#define GR_GL_TEXTURE14 0x84CE
#define GR_GL_TEXTURE15 0x84CF
#define GR_GL_TEXTURE16 0x84D0
#define GR_GL_TEXTURE17 0x84D1
#define GR_GL_TEXTURE18 0x84D2
#define GR_GL_TEXTURE19 0x84D3
#define GR_GL_TEXTURE20 0x84D4
#define GR_GL_TEXTURE21 0x84D5
#define GR_GL_TEXTURE22 0x84D6
#define GR_GL_TEXTURE23 0x84D7
#define GR_GL_TEXTURE24 0x84D8
#define GR_GL_TEXTURE25 0x84D9
#define GR_GL_TEXTURE26 0x84DA
#define GR_GL_TEXTURE27 0x84DB
#define GR_GL_TEXTURE28 0x84DC
#define GR_GL_TEXTURE29 0x84DD
#define GR_GL_TEXTURE30 0x84DE
#define GR_GL_TEXTURE31 0x84DF
#define GR_GL_ACTIVE_TEXTURE 0x84E0
#define GR_GL_MAX_TEXTURE_UNITS 0x84E2
/* TextureWrapMode */
#define GR_GL_REPEAT 0x2901
#define GR_GL_CLAMP_TO_EDGE 0x812F
#define GR_GL_MIRRORED_REPEAT 0x8370
/* Texture mapping */
#define GR_GL_TEXTURE_ENV 0x2300
#define GR_GL_TEXTURE_ENV_MODE 0x2200
#define GR_GL_TEXTURE_1D 0x0DE0
#define GR_GL_TEXTURE_2D 0x0DE1
#define GR_GL_TEXTURE_WRAP_S 0x2802
#define GR_GL_TEXTURE_WRAP_T 0x2803
#define GR_GL_TEXTURE_MAG_FILTER 0x2800
#define GR_GL_TEXTURE_MIN_FILTER 0x2801
#define GR_GL_TEXTURE_ENV_COLOR 0x2201
#define GR_GL_TEXTURE_GEN_S 0x0C60
#define GR_GL_TEXTURE_GEN_T 0x0C61
#define GR_GL_TEXTURE_GEN_MODE 0x2500
#define GR_GL_TEXTURE_BORDER_COLOR 0x1004
#define GR_GL_TEXTURE_WIDTH 0x1000
#define GR_GL_TEXTURE_HEIGHT 0x1001
#define GR_GL_TEXTURE_BORDER 0x1005
#define GR_GL_TEXTURE_COMPONENTS 0x1003
#define GR_GL_TEXTURE_RED_SIZE 0x805C
#define GR_GL_TEXTURE_GREEN_SIZE 0x805D
#define GR_GL_TEXTURE_BLUE_SIZE 0x805E
#define GR_GL_TEXTURE_ALPHA_SIZE 0x805F
#define GR_GL_TEXTURE_LUMINANCE_SIZE 0x8060
#define GR_GL_TEXTURE_INTENSITY_SIZE 0x8061
#define GR_GL_NEAREST_MIPMAP_NEAREST 0x2700
#define GR_GL_NEAREST_MIPMAP_LINEAR 0x2702
#define GR_GL_LINEAR_MIPMAP_NEAREST 0x2701
#define GR_GL_LINEAR_MIPMAP_LINEAR 0x2703
#define GR_GL_OBJECT_LINEAR 0x2401
#define GR_GL_OBJECT_PLANE 0x2501
#define GR_GL_EYE_LINEAR 0x2400
#define GR_GL_EYE_PLANE 0x2502
#define GR_GL_SPHERE_MAP 0x2402
#define GR_GL_DECAL 0x2101
#define GR_GL_MODULATE 0x2100
#define GR_GL_NEAREST 0x2600
#define GR_GL_REPEAT 0x2901
#define GR_GL_CLAMP 0x2900
#define GR_GL_S 0x2000
#define GR_GL_T 0x2001
#define GR_GL_R 0x2002
#define GR_GL_Q 0x2003
#define GR_GL_TEXTURE_GEN_R 0x0C62
#define GR_GL_TEXTURE_GEN_Q 0x0C63
/* texture_env_combine */
#define GR_GL_COMBINE 0x8570
#define GR_GL_COMBINE_RGB 0x8571
#define GR_GL_COMBINE_ALPHA 0x8572
#define GR_GL_SOURCE0_RGB 0x8580
#define GR_GL_SOURCE1_RGB 0x8581
#define GR_GL_SOURCE2_RGB 0x8582
#define GR_GL_SOURCE0_ALPHA 0x8588
#define GR_GL_SOURCE1_ALPHA 0x8589
#define GR_GL_SOURCE2_ALPHA 0x858A
#define GR_GL_OPERAND0_RGB 0x8590
#define GR_GL_OPERAND1_RGB 0x8591
#define GR_GL_OPERAND2_RGB 0x8592
#define GR_GL_OPERAND0_ALPHA 0x8598
#define GR_GL_OPERAND1_ALPHA 0x8599
#define GR_GL_OPERAND2_ALPHA 0x859A
#define GR_GL_RGB_SCALE 0x8573
#define GR_GL_ADD_SIGNED 0x8574
#define GR_GL_INTERPOLATE 0x8575
#define GR_GL_SUBTRACT 0x84E7
#define GR_GL_CONSTANT 0x8576
#define GR_GL_PRIMARY_COLOR 0x8577
#define GR_GL_PREVIOUS 0x8578
#define GR_GL_SRC0_RGB 0x8580
#define GR_GL_SRC1_RGB 0x8581
#define GR_GL_SRC2_RGB 0x8582
#define GR_GL_SRC0_ALPHA 0x8588
#define GR_GL_SRC1_ALPHA 0x8589
#define GR_GL_SRC2_ALPHA 0x858A
/* Uniform Types */
#define GR_GL_FLOAT_VEC2 0x8B50
#define GR_GL_FLOAT_VEC3 0x8B51
#define GR_GL_FLOAT_VEC4 0x8B52
#define GR_GL_INT_VEC2 0x8B53
#define GR_GL_INT_VEC3 0x8B54
#define GR_GL_INT_VEC4 0x8B55
#define GR_GL_BOOL 0x8B56
#define GR_GL_BOOL_VEC2 0x8B57
#define GR_GL_BOOL_VEC3 0x8B58
#define GR_GL_BOOL_VEC4 0x8B59
#define GR_GL_FLOAT_MAT2 0x8B5A
#define GR_GL_FLOAT_MAT3 0x8B5B
#define GR_GL_FLOAT_MAT4 0x8B5C
#define GR_GL_SAMPLER_2D 0x8B5E
#define GR_GL_SAMPLER_CUBE 0x8B60
/* Vertex Arrays */
#define GR_GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
#define GR_GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
#define GR_GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
#define GR_GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
#define GR_GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
#define GR_GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
#define GR_GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
#define GR_GL_VERTEX_ARRAY 0x8074
#define GR_GL_NORMAL_ARRAY 0x8075
#define GR_GL_COLOR_ARRAY 0x8076
#define GR_GL_INDEX_ARRAY 0x8077
#define GR_GL_TEXTURE_COORD_ARRAY 0x8078
#define GR_GL_EDGE_FLAG_ARRAY 0x8079
#define GR_GL_VERTEX_ARRAY_SIZE 0x807A
#define GR_GL_VERTEX_ARRAY_TYPE 0x807B
#define GR_GL_VERTEX_ARRAY_STRIDE 0x807C
#define GR_GL_NORMAL_ARRAY_TYPE 0x807E
#define GR_GL_NORMAL_ARRAY_STRIDE 0x807F
#define GR_GL_COLOR_ARRAY_SIZE 0x8081
#define GR_GL_COLOR_ARRAY_TYPE 0x8082
#define GR_GL_COLOR_ARRAY_STRIDE 0x8083
#define GR_GL_INDEX_ARRAY_TYPE 0x8085
#define GR_GL_INDEX_ARRAY_STRIDE 0x8086
#define GR_GL_TEXTURE_COORD_ARRAY_SIZE 0x8088
#define GR_GL_TEXTURE_COORD_ARRAY_TYPE 0x8089
#define GR_GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A
#define GR_GL_EDGE_FLAG_ARRAY_STRIDE 0x808C
#define GR_GL_VERTEX_ARRAY_POINTER 0x808E
#define GR_GL_NORMAL_ARRAY_POINTER 0x808F
#define GR_GL_COLOR_ARRAY_POINTER 0x8090
#define GR_GL_INDEX_ARRAY_POINTER 0x8091
#define GR_GL_TEXTURE_COORD_ARRAY_POINTER 0x8092
#define GR_GL_EDGE_FLAG_ARRAY_POINTER 0x8093
#define GR_GL_V2F 0x2A20
#define GR_GL_V3F 0x2A21
#define GR_GL_C4UB_V2F 0x2A22
#define GR_GL_C4UB_V3F 0x2A23
#define GR_GL_C3F_V3F 0x2A24
#define GR_GL_N3F_V3F 0x2A25
#define GR_GL_C4F_N3F_V3F 0x2A26
#define GR_GL_T2F_V3F 0x2A27
#define GR_GL_T4F_V4F 0x2A28
#define GR_GL_T2F_C4UB_V3F 0x2A29
#define GR_GL_T2F_C3F_V3F 0x2A2A
#define GR_GL_T2F_N3F_V3F 0x2A2B
#define GR_GL_T2F_C4F_N3F_V3F 0x2A2C
#define GR_GL_T4F_C4F_N3F_V4F 0x2A2D
/* Read Format */
#define GR_GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
#define GR_GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
/* Shader Source */
#define GR_GL_COMPILE_STATUS 0x8B81
#define GR_GL_INFO_LOG_LENGTH 0x8B84
#define GR_GL_SHADER_SOURCE_LENGTH 0x8B88
#define GR_GL_SHADER_COMPILER 0x8DFA
/* Shader Binary */
#define GR_GL_SHADER_BINARY_FORMATS 0x8DF8
#define GR_GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
/* Shader Precision-Specified Types */
#define GR_GL_LOW_FLOAT 0x8DF0
#define GR_GL_MEDIUM_FLOAT 0x8DF1
#define GR_GL_HIGH_FLOAT 0x8DF2
#define GR_GL_LOW_INT 0x8DF3
#define GR_GL_MEDIUM_INT 0x8DF4
#define GR_GL_HIGH_INT 0x8DF5
/* Framebuffer Object. */
#define GR_GL_FRAMEBUFFER 0x8D40
#define GR_GL_RENDERBUFFER 0x8D41
#define GR_GL_RGBA4 0x8056
#define GR_GL_RGB5_A1 0x8057
#define GR_GL_RGB565 0x8D62
#define GR_GL_DEPTH_COMPONENT16 0x81A5
#define GR_GL_STENCIL_INDEX 0x1901
#define GR_GL_STENCIL_INDEX8 0x8D48
#define GR_GL_RENDERBUFFER_WIDTH 0x8D42
#define GR_GL_RENDERBUFFER_HEIGHT 0x8D43
#define GR_GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
#define GR_GL_RENDERBUFFER_RED_SIZE 0x8D50
#define GR_GL_RENDERBUFFER_GREEN_SIZE 0x8D51
#define GR_GL_RENDERBUFFER_BLUE_SIZE 0x8D52
#define GR_GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
#define GR_GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
#define GR_GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
#define GR_GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
#define GR_GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
#define GR_GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
#define GR_GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
#define GR_GL_COLOR_ATTACHMENT0 0x8CE0
#define GR_GL_DEPTH_ATTACHMENT 0x8D00
#define GR_GL_STENCIL_ATTACHMENT 0x8D20
#define GR_GL_NONE 0
#define GR_GL_FRAMEBUFFER_COMPLETE 0x8CD5
#define GR_GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
#define GR_GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
#define GR_GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
#define GR_GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
#define GR_GL_FRAMEBUFFER_BINDING 0x8CA6
#define GR_GL_RENDERBUFFER_BINDING 0x8CA7
#define GR_GL_MAX_RENDERBUFFER_SIZE 0x84E8
#define GR_GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
#endif

View File

@ -1,17 +1,34 @@
#include "GrGLConfig.h"
/*
Copyright 2011 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef GrGLIRect_DEFINED
#define GrGLIRect_DEFINED
#include "GrGLConfig.h"
/**
* Helper struct for dealing with the fact that Ganesh and GL use different
* window coordinate systems (top-down vs bottom-up)
*/
struct GrGLIRect {
GLint fLeft;
GLint fBottom;
GLsizei fWidth;
GLsizei fHeight;
GrGLint fLeft;
GrGLint fBottom;
GrGLsizei fWidth;
GrGLsizei fHeight;
void pushToGLViewport() const {
GR_GL(Viewport(fLeft, fBottom, fWidth, fHeight));
@ -22,8 +39,8 @@ struct GrGLIRect {
}
void setFromGLViewport() {
GR_STATIC_ASSERT(sizeof(GrGLIRect) == 4*sizeof(GLint));
GR_GL_GetIntegerv(GL_VIEWPORT, (GLint*) this);
GR_STATIC_ASSERT(sizeof(GrGLIRect) == 4*sizeof(GrGLint));
GR_GL_GetIntegerv(GR_GL_VIEWPORT, (GrGLint*) this);
}
// sometimes we have a GrIRect from the client that we

View File

@ -1,5 +1,5 @@
/*
Copyright 2010 Google Inc.
Copyright 2011 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -25,14 +25,14 @@ class GrGpuGL;
class GrGLIndexBuffer : public GrIndexBuffer {
protected:
GrGLIndexBuffer(GLuint id,
GrGLIndexBuffer(GrGLuint id,
GrGpuGL* gl,
size_t sizeInBytes,
bool dynamic);
public:
virtual ~GrGLIndexBuffer();
GLuint bufferID() const;
GrGLuint bufferID() const;
// overrides of GrIndexBuffer
virtual void abandon();
@ -48,7 +48,7 @@ private:
void bind() const;
GrGpuGL* fGL;
GLuint fBufferID;
GrGLuint fBufferID;
void* fLockPtr;
friend class GrGpuGL;

View File

@ -47,6 +47,22 @@ extern void GrGLSetGLInterface(GrGLInterface* gl_interface);
*/
extern void GrGLSetDefaultGLInterface();
typedef unsigned int GrGLenum;
typedef unsigned char GrGLboolean;
typedef unsigned int GrGLbitfield;
typedef signed char GrGLbyte;
typedef short GrGLshort;
typedef int GrGLint;
typedef int GrGLsizei;
typedef unsigned char GrGLubyte;
typedef unsigned short GrGLushort;
typedef unsigned int GrGLuint;
typedef float GrGLfloat;
typedef float GrGLclampf;
typedef double GrGLdouble;
typedef double GrGLclampd;
typedef void GrGLvoid;
extern "C" {
/*
* The following interface exports the OpenGL entry points used by the system.
@ -58,109 +74,109 @@ extern "C" {
* extension pointer will be valid across contexts.
*/
struct GrGLInterface {
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLActiveTextureProc)(GLenum texture);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLAttachShaderProc)(GLuint program, GLuint shader);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLBindAttribLocationProc)(GLuint program, GLuint index, const char* name);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLBindBufferProc)(GLenum target, GLuint buffer);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLBindTextureProc)(GLenum target, GLuint texture);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLBlendColorProc)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLBlendFuncProc)(GLenum sfactor, GLenum dfactor);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLBufferDataProc)(GLenum target, GLsizei size, const void* data, GLenum usage);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLBufferSubDataProc)(GLenum target, GLint offset, GLsizei size, const void* data);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLClearProc)(GLbitfield mask);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLClearColorProc)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLClearStencilProc)(GLint s);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLClientActiveTextureProc)(GLenum texture);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLColor4ubProc)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLColorMaskProc)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLColorPointerProc)(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLCompileShaderProc)(GLuint shader);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLCompressedTexImage2DProc)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data);
typedef GLuint (GR_GL_FUNCTION_TYPE *GrGLCreateProgramProc)(void);
typedef GLuint (GR_GL_FUNCTION_TYPE *GrGLCreateShaderProc)(GLenum type);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLCullFaceProc)(GLenum mode);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLDeleteBuffersProc)(GLsizei n, const GLuint* buffers);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLDeleteProgramProc)(GLuint program);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLDeleteShaderProc)(GLuint shader);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLDeleteTexturesProc)(GLsizei n, const GLuint* textures);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLDepthMaskProc)(GLboolean flag);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLDisableProc)(GLenum cap);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLDisableClientStateProc)(GLenum array);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLDisableVertexAttribArrayProc)(GLuint index);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLDrawArraysProc)(GLenum mode, GLint first, GLsizei count);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLDrawElementsProc)(GLenum mode, GLsizei count, GLenum type, const void* indices);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLEnableProc)(GLenum cap);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLEnableClientStateProc)(GLenum cap);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLEnableVertexAttribArrayProc)(GLuint index);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLFrontFaceProc)(GLenum mode);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLGenBuffersProc)(GLsizei n, GLuint* buffers);
typedef GLenum (GR_GL_FUNCTION_TYPE *GrGLGetErrorProc)(void);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLGenTexturesProc)(GLsizei n, GLuint* textures);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLGetBufferParameterivProc)(GLenum target, GLenum pname, GLint* params);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLGetIntegervProc)(GLenum pname, GLint* params);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLGetProgramInfoLogProc)(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLGetProgramivProc)(GLuint program, GLenum pname, GLint* params);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLGetShaderInfoLogProc)(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLGetShaderivProc)(GLuint shader, GLenum pname, GLint* params);
typedef const GLubyte* (GR_GL_FUNCTION_TYPE *GrGLGetStringProc)(GLenum name);
typedef GLint (GR_GL_FUNCTION_TYPE *GrGLGetUniformLocationProc)(GLuint program, const char* name);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLLineWidthProc)(GLfloat width);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLLinkProgramProc)(GLuint program);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLLoadMatrixfProc)(const GLfloat* m);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLMatrixModeProc)(GLenum mode);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLPixelStoreiProc)(GLenum pname, GLint param);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLPointSizeProc)(GLfloat size);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLReadPixelsProc)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLScissorProc)(GLint x, GLint y, GLsizei width, GLsizei height);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLShadeModelProc)(GLenum mode);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLShaderSourceProc)(GLuint shader, GLsizei count, const char** str, const GLint* length);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLStencilFuncProc)(GLenum func, GLint ref, GLuint mask);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLStencilFuncSeparateProc)(GLenum face, GLenum func, GLint ref, GLuint mask);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLStencilMaskProc)(GLuint mask);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLStencilMaskSeparateProc)(GLenum face, GLuint mask);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLStencilOpProc)(GLenum fail, GLenum zfail, GLenum zpass);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLStencilOpSeparateProc)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLTexCoordPointerProc)(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLTexEnviProc)(GLenum target, GLenum pname, GLint param);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLTexImage2DProc)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLTexParameteriProc)(GLenum target, GLenum pname, GLint param);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLTexSubImage2DProc)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform1fvProc)(GLint location, GLsizei count, const GLfloat* v);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform1iProc)(GLint location, GLint x);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform4fvProc)(GLint location, GLsizei count, const GLfloat* v);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLUniformMatrix3fvProc)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLUseProgramProc)(GLuint program);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLVertexAttrib4fvProc)(GLuint indx, const GLfloat* values);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLVertexAttribPointerProc)(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLVertexPointerProc)(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLViewportProc)(GLint x, GLint y, GLsizei width, GLsizei height);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLActiveTextureProc)(GrGLenum texture);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLAttachShaderProc)(GrGLuint program, GrGLuint shader);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBindAttribLocationProc)(GrGLuint program, GrGLuint index, const char* name);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBindBufferProc)(GrGLenum target, GrGLuint buffer);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBindTextureProc)(GrGLenum target, GrGLuint texture);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBlendColorProc)(GrGLclampf red, GrGLclampf green, GrGLclampf blue, GrGLclampf alpha);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBlendFuncProc)(GrGLenum sfactor, GrGLenum dfactor);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBufferDataProc)(GrGLenum target, GrGLsizei size, const GrGLvoid* data, GrGLenum usage);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBufferSubDataProc)(GrGLenum target, GrGLint offset, GrGLsizei size, const GrGLvoid* data);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLClearProc)(GrGLbitfield mask);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLClearColorProc)(GrGLclampf red, GrGLclampf green, GrGLclampf blue, GrGLclampf alpha);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLClearStencilProc)(GrGLint s);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLClientActiveTextureProc)(GrGLenum texture);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLColor4ubProc)(GrGLubyte red, GrGLubyte green, GrGLubyte blue, GrGLubyte alpha);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLColorMaskProc)(GrGLboolean red, GrGLboolean green, GrGLboolean blue, GrGLboolean alpha);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLColorPointerProc)(GrGLint size, GrGLenum type, GrGLsizei stride, const GrGLvoid* pointer);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLCompileShaderProc)(GrGLuint shader);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLCompressedTexImage2DProc)(GrGLenum target, GrGLint level, GrGLenum internalformat, GrGLsizei width, GrGLsizei height, GrGLint border, GrGLsizei imageSize, const GrGLvoid* data);
typedef GrGLuint (GR_GL_FUNCTION_TYPE *GrGLCreateProgramProc)(void);
typedef GrGLuint (GR_GL_FUNCTION_TYPE *GrGLCreateShaderProc)(GrGLenum type);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLCullFaceProc)(GrGLenum mode);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDeleteBuffersProc)(GrGLsizei n, const GrGLuint* buffers);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDeleteProgramProc)(GrGLuint program);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDeleteShaderProc)(GrGLuint shader);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDeleteTexturesProc)(GrGLsizei n, const GrGLuint* textures);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDepthMaskProc)(GrGLboolean flag);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDisableProc)(GrGLenum cap);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDisableClientStateProc)(GrGLenum array);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDisableVertexAttribArrayProc)(GrGLuint index);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDrawArraysProc)(GrGLenum mode, GrGLint first, GrGLsizei count);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDrawElementsProc)(GrGLenum mode, GrGLsizei count, GrGLenum type, const GrGLvoid* indices);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLEnableProc)(GrGLenum cap);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLEnableClientStateProc)(GrGLenum cap);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLEnableVertexAttribArrayProc)(GrGLuint index);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLFrontFaceProc)(GrGLenum mode);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGenBuffersProc)(GrGLsizei n, GrGLuint* buffers);
typedef GrGLenum (GR_GL_FUNCTION_TYPE *GrGLGetErrorProc)(void);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGenTexturesProc)(GrGLsizei n, GrGLuint* textures);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetBufferParameterivProc)(GrGLenum target, GrGLenum pname, GrGLint* params);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetIntegervProc)(GrGLenum pname, GrGLint* params);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetProgramInfoLogProc)(GrGLuint program, GrGLsizei bufsize, GrGLsizei* length, char* infolog);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetProgramivProc)(GrGLuint program, GrGLenum pname, GrGLint* params);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetShaderInfoLogProc)(GrGLuint shader, GrGLsizei bufsize, GrGLsizei* length, char* infolog);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetShaderivProc)(GrGLuint shader, GrGLenum pname, GrGLint* params);
typedef const GrGLubyte* (GR_GL_FUNCTION_TYPE *GrGLGetStringProc)(GrGLenum name);
typedef GrGLint (GR_GL_FUNCTION_TYPE *GrGLGetUniformLocationProc)(GrGLuint program, const char* name);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLLineWidthProc)(GrGLfloat width);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLLinkProgramProc)(GrGLuint program);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLLoadMatrixfProc)(const GrGLfloat* m);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLMatrixModeProc)(GrGLenum mode);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLPixelStoreiProc)(GrGLenum pname, GrGLint param);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLPointSizeProc)(GrGLfloat size);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLReadPixelsProc)(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLenum type, GrGLvoid* pixels);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLScissorProc)(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLShadeModelProc)(GrGLenum mode);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLShaderSourceProc)(GrGLuint shader, GrGLsizei count, const char** str, const GrGLint* length);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLStencilFuncProc)(GrGLenum func, GrGLint ref, GrGLuint mask);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLStencilFuncSeparateProc)(GrGLenum face, GrGLenum func, GrGLint ref, GrGLuint mask);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLStencilMaskProc)(GrGLuint mask);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLStencilMaskSeparateProc)(GrGLenum face, GrGLuint mask);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLStencilOpProc)(GrGLenum fail, GrGLenum zfail, GrGLenum zpass);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLStencilOpSeparateProc)(GrGLenum face, GrGLenum fail, GrGLenum zfail, GrGLenum zpass);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLTexCoordPointerProc)(GrGLint size, GrGLenum type, GrGLsizei stride, const GrGLvoid* pointer);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLTexEnviProc)(GrGLenum target, GrGLenum pname, GrGLint param);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLTexImage2DProc)(GrGLenum target, GrGLint level, GrGLint internalformat, GrGLsizei width, GrGLsizei height, GrGLint border, GrGLenum format, GrGLenum type, const GrGLvoid* pixels);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLTexParameteriProc)(GrGLenum target, GrGLenum pname, GrGLint param);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLTexSubImage2DProc)(GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLenum type, const GrGLvoid* pixels);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform1fvProc)(GrGLint location, GrGLsizei count, const GrGLfloat* v);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform1iProc)(GrGLint location, GrGLint x);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform4fvProc)(GrGLint location, GrGLsizei count, const GrGLfloat* v);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniformMatrix3fvProc)(GrGLint location, GrGLsizei count, GrGLboolean transpose, const GrGLfloat* value);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUseProgramProc)(GrGLuint program);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLVertexAttrib4fvProc)(GrGLuint indx, const GrGLfloat* values);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLVertexAttribPointerProc)(GrGLuint indx, GrGLint size, GrGLenum type, GrGLboolean normalized, GrGLsizei stride, const GrGLvoid* ptr);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLVertexPointerProc)(GrGLint size, GrGLenum type, GrGLsizei stride, const GrGLvoid* pointer);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLViewportProc)(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height);
// FBO Extension Functions
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLBindFramebufferProc)(GLenum target, GLuint framebuffer);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLBindRenderbufferProc)(GLenum target, GLuint renderbuffer);
typedef GLenum (GR_GL_FUNCTION_TYPE *GrGLCheckFramebufferStatusProc)(GLenum target);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLDeleteFramebuffersProc)(GLsizei n, const GLuint *framebuffers);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLDeleteRenderbuffersProc)(GLsizei n, const GLuint *renderbuffers);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLFramebufferRenderbufferProc)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLFramebufferTexture2DProc)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLGenFramebuffersProc)(GLsizei n, GLuint *framebuffers);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLGenRenderbuffersProc)(GLsizei n, GLuint *renderbuffers);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLRenderbufferStorageProc)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBindFramebufferProc)(GrGLenum target, GrGLuint framebuffer);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBindRenderbufferProc)(GrGLenum target, GrGLuint renderbuffer);
typedef GrGLenum (GR_GL_FUNCTION_TYPE *GrGLCheckFramebufferStatusProc)(GrGLenum target);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDeleteFramebuffersProc)(GrGLsizei n, const GrGLuint *framebuffers);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDeleteRenderbuffersProc)(GrGLsizei n, const GrGLuint *renderbuffers);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLFramebufferRenderbufferProc)(GrGLenum target, GrGLenum attachment, GrGLenum renderbuffertarget, GrGLuint renderbuffer);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLFramebufferTexture2DProc)(GrGLenum target, GrGLenum attachment, GrGLenum textarget, GrGLuint texture, GrGLint level);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGenFramebuffersProc)(GrGLsizei n, GrGLuint *framebuffers);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGenRenderbuffersProc)(GrGLsizei n, GrGLuint *renderbuffers);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLRenderbufferStorageProc)(GrGLenum target, GrGLenum internalformat, GrGLsizei width, GrGLsizei height);
// Multisampling Extension Functions
// same prototype for ARB_FBO, EXT_FBO, GL 3.0, & Apple ES extension
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLRenderbufferStorageMultisampleProc)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLRenderbufferStorageMultisampleProc)(GrGLenum target, GrGLsizei samples, GrGLenum internalformat, GrGLsizei width, GrGLsizei height);
// desktop: ext_fbo_blit, arb_fbo, gl 3.0
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLBlitFramebufferProc)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBlitFramebufferProc)(GrGLint srcX0, GrGLint srcY0, GrGLint srcX1, GrGLint srcY1, GrGLint dstX0, GrGLint dstY0, GrGLint dstX1, GrGLint dstY1, GrGLbitfield mask, GrGLenum filter);
// apple's es extension
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLResolveMultisampleFramebufferProc)();
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLResolveMultisampleFramebufferProc)();
// IMG'e es extension
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLFramebufferTexture2DMultisampleProc)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLFramebufferTexture2DMultisampleProc)(GrGLenum target, GrGLenum attachment, GrGLenum textarget, GrGLuint texture, GrGLint level, GrGLsizei samples);
// Buffer mapping (extension in ES).
typedef GLvoid* (GR_GL_FUNCTION_TYPE *GrGLMapBufferProc)(GLenum target, GLenum access);
typedef GLboolean (GR_GL_FUNCTION_TYPE *GrGLUnmapBufferProc)(GLenum target);
typedef GrGLvoid* (GR_GL_FUNCTION_TYPE *GrGLMapBufferProc)(GrGLenum target, GrGLenum access);
typedef GrGLboolean (GR_GL_FUNCTION_TYPE *GrGLUnmapBufferProc)(GrGLenum target);
GrGLActiveTextureProc fActiveTexture;
GrGLAttachShaderProc fAttachShader;

View File

@ -18,8 +18,6 @@
#ifndef GrGLPlatformIncludes_DEFINED
#define GrGLPlatformIncludes_DEFINED
#include "GrConfig.h"
#if !defined(GR_GL_CUSTOM_SETUP)
#define GR_GL_CUSTOM_SETUP 0
#endif
@ -48,8 +46,8 @@
* 2. If necessary, the name of a file that includes extension
* definitions in GR_INCLUDE_GLES2ext.
*
* Optionally, define GR_GL_FUNC to any qualifier needed on GL function
* pointer declarations (e.g. __stdcall).
* Optionally, define GR_GL_FUNCTION_TYPE to any qualifier needed on GL
* function pointer declarations (e.g. __stdcall).
*
* Define GR_GL_PROC_ADDRESS to take a gl function and produce a
* function pointer. Two examples:
@ -66,7 +64,7 @@
* to a header that can be included. This file should:
* 1. Define the approprate GR_SUPPORT_GL* macro(s) to 1
* 2. Includes all necessary GL headers.
* 3. Optionally define GR_GL_FUNC.
* 3. Optionally define GR_GL_FUNCTION_TYPE.
* 4. Define GR_GL_PROC_ADDRESS.
* 5. Optionally define GR_GL_PROC_ADDRESS_HEADER
*/
@ -99,19 +97,19 @@
#include GR_GL_CUSTOM_SETUP_HEADER
#else
#include "GrConfig.h"
#undef GR_GL_FUNCTION_TYPE
#undef GR_GL_PROC_ADDRESS
#undef GR_GL_PROC_ADDRESS_HEADER
#if GR_WIN32_BUILD
#define GR_SUPPORT_GLDESKTOP 1
#include <Windows.h>
#include <GL/gl.h>
// remove stupid windows defines
#undef near
#undef far
#define GR_GL_EMIT_GL_CONSTANTS 1
#define GR_GL_FUNCTION_TYPE __stdcall
#define GR_GL_PLATFORM_HEADER_SUPPORT <Windows.h>
#define GR_GL_PLATFORM_HEADER <GL/gl.h>
#define GR_GL_FUNCTION_TYPE __stdcall
#define GR_GL_PROC_ADDRESS(X) wglGetProcAddress(#X)
#define GR_GL_PROC_ADDRESS_HEADER <windows.h>
@ -124,24 +122,30 @@
#define GL_OES_mapbuffer 1
#elif GR_MAC_BUILD
#define GR_SUPPORT_GLDESKTOP 1
#include <OpenGL/gl.h>
#include <OpenGL/glext.h>
#define GR_GL_PLATFORM_HEADER <OpenGL/gl.h>
#define GR_GL_PLATFORM_HEADER_EXT <OpenGL/glext.h>
#define GR_GL_PROC_ADDRESS(X) &X
#elif GR_IOS_BUILD
#define GR_SUPPORT_GLES1 1
#include <OpenGLES/ES1/gl.h>
#include <OpenGLES/ES1/glext.h>
#define GR_SUPPORT_GLES2 1
#include <OpenGLES/ES2/gl.h>
#include <OpenGLES/ES2/glext.h>
#define GR_GL_PLATFORM_HEADER <OpenGLES/ES1/gl.h>
#define GR_GL_PLATFORM_HEADER_EXT <OpenGLES/ES1/glext.h>
#define GR_GL_PLATFORM_HEADER2 <OpenGLES/ES2/gl.h>
#define GR_GL_PLATFORM_HEADER_EXT2 <OpenGLES/ES2/glext.h>
#define GR_GL_PROC_ADDRESS(X) &X
#elif GR_ANDROID_BUILD
#ifndef GL_GLEXT_PROTOTYPES
#define GL_GLEXT_PROTOTYPES
#endif
#define GR_SUPPORT_GLES2 1
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#define GR_GL_PLATFORM_HEADER <GLES2/gl2.h>
#define GR_GL_PLATFORM_HEADER_EXT <GLES2/gl2ext.h>
#define GR_GL_PROC_ADDRESS(X) eglGetProcAddress(#X)
#define GR_GL_PROC_ADDRESS_HEADER <EGL/egl.h>
#elif GR_QNX_BUILD
@ -151,16 +155,20 @@
#define GR_SUPPORT_GLES2 1
// This is needed by the QNX GLES2 headers
#define GL_API_EXT
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#define GR_GL_PLATFORM_HEADER <GLES2/gl2.h>
#define GR_GL_PLATFORM_HEADER_EXT <GLES2/gl2ext.h>
#define GR_GL_PROC_ADDRESS(X) eglGetProcAddress(#X)
#define GR_GL_PROC_ADDRESS_HEADER <EGL/egl.h>
#elif GR_LINUX_BUILD
#ifndef GL_GLEXT_PROTOTYPES
#define GL_GLEXT_PROTOTYPES
#endif
#include <GL/gl.h>
#include <GL/glext.h>
#define GR_GL_PLATFORM_HEADER <GL/gl.h>
#define GR_GL_PLATFORM_HEADER_EXT <GL/glext.h>
#define GR_GL_PROC_ADDRESS(X) glXGetProcAddress(reinterpret_cast<const GLubyte*>(#X))
#define GR_SUPPORT_GLDESKTOP 1
#define GR_GL_PROC_ADDRESS_HEADER <GL/glx.h>
@ -188,335 +196,4 @@
#error "Cannot support both desktop and ES GL"
#endif
#if GR_WIN32_BUILD && GR_GL_EMIT_GL_CONSTANTS
// The windows GL headers do not provide the constants used for extensions and
// some versions of GL. Define them here.
// OpenGL 1.2 Defines
#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12
#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13
#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22
#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23
#define GL_UNSIGNED_BYTE_3_3_2 0x8032
#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
#define GL_UNSIGNED_INT_8_8_8_8 0x8035
#define GL_UNSIGNED_INT_10_10_10_2 0x8036
#define GL_RESCALE_NORMAL 0x803A
#define GL_TEXTURE_BINDING_3D 0x806A
#define GL_PACK_SKIP_IMAGES 0x806B
#define GL_PACK_IMAGE_HEIGHT 0x806C
#define GL_UNPACK_SKIP_IMAGES 0x806D
#define GL_UNPACK_IMAGE_HEIGHT 0x806E
#define GL_TEXTURE_3D 0x806F
#define GL_PROXY_TEXTURE_3D 0x8070
#define GL_TEXTURE_DEPTH 0x8071
#define GL_TEXTURE_WRAP_R 0x8072
#define GL_MAX_3D_TEXTURE_SIZE 0x8073
#define GL_BGR 0x80E0
#define GL_BGRA 0x80E1
#define GL_MAX_ELEMENTS_VERTICES 0x80E8
#define GL_MAX_ELEMENTS_INDICES 0x80E9
#define GL_CLAMP_TO_EDGE 0x812F
#define GL_TEXTURE_MIN_LOD 0x813A
#define GL_TEXTURE_MAX_LOD 0x813B
#define GL_TEXTURE_BASE_LEVEL 0x813C
#define GL_TEXTURE_MAX_LEVEL 0x813D
#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8
#define GL_SINGLE_COLOR 0x81F9
#define GL_SEPARATE_SPECULAR_COLOR 0x81FA
#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362
#define GL_UNSIGNED_SHORT_5_6_5 0x8363
#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364
#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365
#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366
#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367
#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
// OpenGL 1.3 Multi-Sample Constant Values
#define GL_MULTISAMPLE 0x809D
#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
#define GL_SAMPLE_ALPHA_TO_ONE 0x809F
#define GL_SAMPLE_COVERAGE 0x80A0
#define GL_SAMPLE_BUFFERS 0x80A8
#define GL_SAMPLES 0x80A9
#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
#define GL_CLAMP_TO_BORDER 0x812D
#define GL_TEXTURE0 0x84C0
#define GL_TEXTURE1 0x84C1
#define GL_TEXTURE2 0x84C2
#define GL_TEXTURE3 0x84C3
#define GL_TEXTURE4 0x84C4
#define GL_TEXTURE5 0x84C5
#define GL_TEXTURE6 0x84C6
#define GL_TEXTURE7 0x84C7
#define GL_TEXTURE8 0x84C8
#define GL_TEXTURE9 0x84C9
#define GL_TEXTURE10 0x84CA
#define GL_TEXTURE11 0x84CB
#define GL_TEXTURE12 0x84CC
#define GL_TEXTURE13 0x84CD
#define GL_TEXTURE14 0x84CE
#define GL_TEXTURE15 0x84CF
#define GL_TEXTURE16 0x84D0
#define GL_TEXTURE17 0x84D1
#define GL_TEXTURE18 0x84D2
#define GL_TEXTURE19 0x84D3
#define GL_TEXTURE20 0x84D4
#define GL_TEXTURE21 0x84D5
#define GL_TEXTURE22 0x84D6
#define GL_TEXTURE23 0x84D7
#define GL_TEXTURE24 0x84D8
#define GL_TEXTURE25 0x84D9
#define GL_TEXTURE26 0x84DA
#define GL_TEXTURE27 0x84DB
#define GL_TEXTURE28 0x84DC
#define GL_TEXTURE29 0x84DD
#define GL_TEXTURE30 0x84DE
#define GL_TEXTURE31 0x84DF
#define GL_ACTIVE_TEXTURE 0x84E0
#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1
#define GL_MAX_TEXTURE_UNITS 0x84E2
#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3
#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4
#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5
#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6
#define GL_SUBTRACT 0x84E7
#define GL_COMPRESSED_ALPHA 0x84E9
#define GL_COMPRESSED_LUMINANCE 0x84EA
#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB
#define GL_COMPRESSED_INTENSITY 0x84EC
#define GL_COMPRESSED_RGB 0x84ED
#define GL_COMPRESSED_RGBA 0x84EE
#define GL_TEXTURE_COMPRESSION_HINT 0x84EF
#define GL_NORMAL_MAP 0x8511
#define GL_REFLECTION_MAP 0x8512
#define GL_TEXTURE_CUBE_MAP 0x8513
#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B
#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
#define GL_COMBINE 0x8570
#define GL_COMBINE_RGB 0x8571
#define GL_COMBINE_ALPHA 0x8572
#define GL_RGB_SCALE 0x8573
#define GL_ADD_SIGNED 0x8574
#define GL_INTERPOLATE 0x8575
#define GL_CONSTANT 0x8576
#define GL_PRIMARY_COLOR 0x8577
#define GL_PREVIOUS 0x8578
#define GL_SOURCE0_RGB 0x8580
#define GL_SOURCE1_RGB 0x8581
#define GL_SOURCE2_RGB 0x8582
#define GL_SOURCE0_ALPHA 0x8588
#define GL_SOURCE1_ALPHA 0x8589
#define GL_SOURCE2_ALPHA 0x858A
#define GL_OPERAND0_RGB 0x8590
#define GL_OPERAND1_RGB 0x8591
#define GL_OPERAND2_RGB 0x8592
#define GL_OPERAND0_ALPHA 0x8598
#define GL_OPERAND1_ALPHA 0x8599
#define GL_OPERAND2_ALPHA 0x859A
#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0
#define GL_TEXTURE_COMPRESSED 0x86A1
#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
#define GL_DOT3_RGB 0x86AE
#define GL_DOT3_RGBA 0x86AF
#define GL_MULTISAMPLE_BIT 0x20000000
// OpenGL 1.4 Defines
#define GL_CONSTANT_COLOR 0x8001
#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
#define GL_CONSTANT_ALPHA 0x8003
#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
#define GL_BLEND_DST_RGB 0x80C8
#define GL_BLEND_SRC_RGB 0x80C9
#define GL_BLEND_DST_ALPHA 0x80CA
#define GL_BLEND_SRC_ALPHA 0x80CB
#define GL_POINT_SIZE_MIN 0x8126
#define GL_POINT_SIZE_MAX 0x8127
#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128
#define GL_POINT_DISTANCE_ATTENUATION 0x8129
#define GL_GENERATE_MIPMAP 0x8191
#define GL_GENERATE_MIPMAP_HINT 0x8192
#define GL_DEPTH_COMPONENT16 0x81A5
#define GL_DEPTH_COMPONENT24 0x81A6
#define GL_DEPTH_COMPONENT32 0x81A7
#define GL_MIRRORED_REPEAT 0x8370
#define GL_FOG_COORDINATE_SOURCE 0x8450
#define GL_FOG_COORDINATE 0x8451
#define GL_FRAGMENT_DEPTH 0x8452
#define GL_CURRENT_FOG_COORDINATE 0x8453
#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454
#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455
#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456
#define GL_FOG_COORDINATE_ARRAY 0x8457
#define GL_COLOR_SUM 0x8458
#define GL_CURRENT_SECONDARY_COLOR 0x8459
#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A
#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B
#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C
#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D
#define GL_SECONDARY_COLOR_ARRAY 0x845E
#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD
#define GL_TEXTURE_FILTER_CONTROL 0x8500
#define GL_TEXTURE_LOD_BIAS 0x8501
#define GL_INCR_WRAP 0x8507
#define GL_DECR_WRAP 0x8508
#define GL_TEXTURE_DEPTH_SIZE 0x884A
#define GL_DEPTH_TEXTURE_MODE 0x884B
#define GL_TEXTURE_COMPARE_MODE 0x884C
#define GL_TEXTURE_COMPARE_FUNC 0x884D
#define GL_COMPARE_R_TO_TEXTURE 0x884E
// OpenGL 1.5 Defines
#define GL_FOG_COORD_SRC GL_FOG_COORDINATE_SOURCE
#define GL_FOG_COORD GL_FOG_COORDINATE
#define GL_FOG_COORD_ARRAY GL_FOG_COORDINATE_ARRAY
#define GL_SRC0_RGB GL_SOURCE0_RGB
#define GL_FOG_COORD_ARRAY_POINTER GL_FOG_COORDINATE_ARRAY_POINTER
#define GL_FOG_COORD_ARRAY_TYPE GL_FOG_COORDINATE_ARRAY_TYPE
#define GL_SRC1_ALPHA GL_SOURCE1_ALPHA
#define GL_CURRENT_FOG_COORD GL_CURRENT_FOG_COORDINATE
#define GL_FOG_COORD_ARRAY_STRIDE GL_FOG_COORDINATE_ARRAY_STRIDE
#define GL_SRC0_ALPHA GL_SOURCE0_ALPHA
#define GL_SRC1_RGB GL_SOURCE1_RGB
#define GL_FOG_COORD_ARRAY_BUFFER_BINDING GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING
#define GL_SRC2_ALPHA GL_SOURCE2_ALPHA
#define GL_SRC2_RGB GL_SOURCE2_RGB
#define GL_BUFFER_SIZE 0x8764
#define GL_BUFFER_USAGE 0x8765
#define GL_QUERY_COUNTER_BITS 0x8864
#define GL_CURRENT_QUERY 0x8865
#define GL_QUERY_RESULT 0x8866
#define GL_QUERY_RESULT_AVAILABLE 0x8867
#define GL_ARRAY_BUFFER 0x8892
#define GL_ELEMENT_ARRAY_BUFFER 0x8893
#define GL_ARRAY_BUFFER_BINDING 0x8894
#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896
#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897
#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898
#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899
#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A
#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B
#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C
#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D
#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E
#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
#define GL_READ_ONLY 0x88B8
#define GL_WRITE_ONLY 0x88B9
#define GL_READ_WRITE 0x88BA
#define GL_BUFFER_ACCESS 0x88BB
#define GL_BUFFER_MAPPED 0x88BC
#define GL_BUFFER_MAP_POINTER 0x88BD
#define GL_STREAM_DRAW 0x88E0
#define GL_STREAM_READ 0x88E1
#define GL_STREAM_COPY 0x88E2
#define GL_STATIC_DRAW 0x88E4
#define GL_STATIC_READ 0x88E5
#define GL_STATIC_COPY 0x88E6
#define GL_DYNAMIC_DRAW 0x88E8
#define GL_DYNAMIC_READ 0x88E9
#define GL_DYNAMIC_COPY 0x88EA
#define GL_SAMPLES_PASSED 0x8914
// OpenGL 2.0 Defines
#define GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION
#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
#define GL_CURRENT_VERTEX_ATTRIB 0x8626
#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642
#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643
#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
#define GL_STENCIL_BACK_FUNC 0x8800
#define GL_STENCIL_BACK_FAIL 0x8801
#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
#define GL_MAX_DRAW_BUFFERS 0x8824
#define GL_DRAW_BUFFER0 0x8825
#define GL_DRAW_BUFFER1 0x8826
#define GL_DRAW_BUFFER2 0x8827
#define GL_DRAW_BUFFER3 0x8828
#define GL_DRAW_BUFFER4 0x8829
#define GL_DRAW_BUFFER5 0x882A
#define GL_DRAW_BUFFER6 0x882B
#define GL_DRAW_BUFFER7 0x882C
#define GL_DRAW_BUFFER8 0x882D
#define GL_DRAW_BUFFER9 0x882E
#define GL_DRAW_BUFFER10 0x882F
#define GL_DRAW_BUFFER11 0x8830
#define GL_DRAW_BUFFER12 0x8831
#define GL_DRAW_BUFFER13 0x8832
#define GL_DRAW_BUFFER14 0x8833
#define GL_DRAW_BUFFER15 0x8834
#define GL_BLEND_EQUATION_ALPHA 0x883D
#define GL_POINT_SPRITE 0x8861
#define GL_COORD_REPLACE 0x8862
#define GL_MAX_VERTEX_ATTRIBS 0x8869
#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
#define GL_MAX_TEXTURE_COORDS 0x8871
#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
#define GL_FRAGMENT_SHADER 0x8B30
#define GL_VERTEX_SHADER 0x8B31
#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49
#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A
#define GL_MAX_VARYING_FLOATS 0x8B4B
#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
#define GL_SHADER_TYPE 0x8B4F
#define GL_FLOAT_VEC2 0x8B50
#define GL_FLOAT_VEC3 0x8B51
#define GL_FLOAT_VEC4 0x8B52
#define GL_INT_VEC2 0x8B53
#define GL_INT_VEC3 0x8B54
#define GL_INT_VEC4 0x8B55
#define GL_BOOL 0x8B56
#define GL_BOOL_VEC2 0x8B57
#define GL_BOOL_VEC3 0x8B58
#define GL_BOOL_VEC4 0x8B59
#define GL_FLOAT_MAT2 0x8B5A
#define GL_FLOAT_MAT3 0x8B5B
#define GL_FLOAT_MAT4 0x8B5C
#define GL_SAMPLER_1D 0x8B5D
#define GL_SAMPLER_2D 0x8B5E
#define GL_SAMPLER_3D 0x8B5F
#define GL_SAMPLER_CUBE 0x8B60
#define GL_SAMPLER_1D_SHADOW 0x8B61
#define GL_SAMPLER_2D_SHADOW 0x8B62
#define GL_DELETE_STATUS 0x8B80
#define GL_COMPILE_STATUS 0x8B81
#define GL_LINK_STATUS 0x8B82
#define GL_VALIDATE_STATUS 0x8B83
#define GL_INFO_LOG_LENGTH 0x8B84
#define GL_ATTACHED_SHADERS 0x8B85
#define GL_ACTIVE_UNIFORMS 0x8B86
#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
#define GL_SHADER_SOURCE_LENGTH 0x8B88
#define GL_ACTIVE_ATTRIBUTES 0x8B89
#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B
#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
#define GL_CURRENT_PROGRAM 0x8B8D
#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0
#define GL_LOWER_LEFT 0x8CA1
#define GL_UPPER_LEFT 0x8CA2
#define GL_STENCIL_BACK_REF 0x8CA3
#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
#endif // GR_WIN32_BUILD
#endif

View File

@ -30,7 +30,7 @@ class GrGLTexture;
*/
class GrGLTexID : public GrRefCnt {
public:
GrGLTexID(GLuint texID) : fTexID(texID) {}
GrGLTexID(GrGLuint texID) : fTexID(texID) {}
virtual ~GrGLTexID() {
if (0 != fTexID) {
@ -39,10 +39,10 @@ public:
}
void abandon() { fTexID = 0; }
GLuint id() const { return fTexID; }
GrGLuint id() const { return fTexID; }
private:
GLuint fTexID;
GrGLuint fTexID;
};
class GrGLRenderTarget : public GrRenderTarget {
@ -53,24 +53,24 @@ public:
bool needsResolve() const { return fNeedsResolve; }
void setDirty(bool dirty) { fNeedsResolve = resolveable() && dirty; }
GLuint renderFBOID() const { return fRTFBOID; }
GLuint textureFBOID() const { return fTexFBOID; }
GrGLuint renderFBOID() const { return fRTFBOID; }
GrGLuint textureFBOID() const { return fTexFBOID; }
void abandon();
protected:
struct GLRenderTargetIDs {
GLuint fRTFBOID;
GLuint fTexFBOID;
GLuint fStencilRenderbufferID;
GLuint fMSColorRenderbufferID;
GrGLuint fRTFBOID;
GrGLuint fTexFBOID;
GrGLuint fStencilRenderbufferID;
GrGLuint fMSColorRenderbufferID;
bool fOwnIDs;
};
GrGLRenderTarget(const GLRenderTargetIDs& ids,
GrGLTexID* texID,
GLuint stencilBits,
GrGLuint stencilBits,
const GrGLIRect& fViewport,
GrGLTexture* texture,
GrGpuGL* gl);
@ -79,10 +79,10 @@ protected:
const GrGLIRect& getViewport() const { return fViewport; }
private:
GrGpuGL* fGL;
GLuint fRTFBOID;
GLuint fTexFBOID;
GLuint fStencilRenderbufferID;
GLuint fMSColorRenderbufferID;
GrGLuint fRTFBOID;
GrGLuint fTexFBOID;
GrGLuint fStencilRenderbufferID;
GrGLuint fMSColorRenderbufferID;
// Should this object delete IDs when it is destroyed or does someone
// else own them.
@ -114,9 +114,9 @@ public:
};
struct TexParams {
GLenum fFilter;
GLenum fWrapS;
GLenum fWrapT;
GrGLenum fFilter;
GrGLenum fWrapS;
GrGLenum fWrapT;
};
protected:
@ -126,11 +126,11 @@ protected:
uint32_t fAllocWidth;
uint32_t fAllocHeight;
PixelConfig fFormat;
GLuint fTextureID;
GLenum fUploadFormat;
GLenum fUploadByteCount;
GLenum fUploadType;
GLuint fStencilBits;
GrGLuint fTextureID;
GrGLenum fUploadFormat;
GrGLenum fUploadByteCount;
GrGLenum fUploadType;
GrGLuint fStencilBits;
Orientation fOrientation;
};
typedef GrGLRenderTarget::GLRenderTargetIDs GLRenderTargetIDs;
@ -155,11 +155,11 @@ public:
const TexParams& getTexParams() const { return fTexParams; }
void setTexParams(const TexParams& texParams) { fTexParams = texParams; }
GLuint textureID() const { return fTexIDObj->id(); }
GrGLuint textureID() const { return fTexIDObj->id(); }
GLenum uploadFormat() const { return fUploadFormat; }
GLenum uploadByteCount() const { return fUploadByteCount; }
GLenum uploadType() const { return fUploadType; }
GrGLenum uploadFormat() const { return fUploadFormat; }
GrGLenum uploadByteCount() const { return fUploadByteCount; }
GrGLenum uploadType() const { return fUploadType; }
/**
* Retrieves the texture width actually allocated in texels.
@ -198,9 +198,9 @@ public:
private:
TexParams fTexParams;
GrGLTexID* fTexIDObj;
GLenum fUploadFormat;
GLenum fUploadByteCount;
GLenum fUploadType;
GrGLenum fUploadFormat;
GrGLenum fUploadByteCount;
GrGLenum fUploadType;
int fAllocWidth;
int fAllocHeight;
// precomputed content / alloc ratios
@ -210,7 +210,7 @@ private:
GrGLRenderTarget* fRenderTarget;
GrGpuGL* fGpuGL;
static const GLenum gWrapMode2GLWrap[];
static const GrGLenum gWrapMode2GLWrap[];
friend class GrGpuGL;

View File

@ -1,5 +1,5 @@
/*
Copyright 2010 Google Inc.
Copyright 2011 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -25,7 +25,7 @@ class GrGpuGL;
class GrGLVertexBuffer : public GrVertexBuffer {
protected:
GrGLVertexBuffer(GLuint id,
GrGLVertexBuffer(GrGLuint id,
GrGpuGL* gl,
size_t sizeInBytes,
bool dynamic);
@ -43,13 +43,13 @@ public:
virtual bool updateSubData(const void* src,
size_t srcSizeInBytes,
size_t offset);
GLuint bufferID() const;
GrGLuint bufferID() const;
private:
void bind() const;
GrGpuGL* fGL;
GLuint fBufferID;
GrGLuint fBufferID;
void* fLockPtr;
friend class GrGpuGL;

View File

@ -18,7 +18,7 @@
#include "GrGLIndexBuffer.h"
#include "GrGpuGL.h"
GrGLIndexBuffer::GrGLIndexBuffer(GLuint id, GrGpuGL* gl, size_t sizeInBytes,
GrGLIndexBuffer::GrGLIndexBuffer(GrGLuint id, GrGpuGL* gl, size_t sizeInBytes,
bool dynamic) :
INHERITED(sizeInBytes, dynamic),
fGL(gl),
@ -35,11 +35,11 @@ GrGLIndexBuffer::~GrGLIndexBuffer() {
}
void GrGLIndexBuffer::bind() const {
GR_GL(BindBuffer(GL_ELEMENT_ARRAY_BUFFER, fBufferID));
GR_GL(BindBuffer(GR_GL_ELEMENT_ARRAY_BUFFER, fBufferID));
fGL->notifyIndexBufferBind(this);
}
GLuint GrGLIndexBuffer::bufferID() const {
GrGLuint GrGLIndexBuffer::bufferID() const {
return fBufferID;
}
@ -55,9 +55,9 @@ void* GrGLIndexBuffer::lock() {
if (fGL->supportsBufferLocking()) {
bind();
// Let driver know it can discard the old data
GR_GL(BufferData(GL_ELEMENT_ARRAY_BUFFER, size(), NULL,
dynamic() ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW));
fLockPtr = GR_GL(MapBuffer(GL_ELEMENT_ARRAY_BUFFER, GR_WRITE_ONLY));
GR_GL(BufferData(GR_GL_ELEMENT_ARRAY_BUFFER, size(), NULL,
dynamic() ? GR_GL_DYNAMIC_DRAW : GR_GL_STATIC_DRAW));
fLockPtr = GR_GL(MapBuffer(GR_GL_ELEMENT_ARRAY_BUFFER, GR_WRITE_ONLY));
return fLockPtr;
}
@ -74,7 +74,7 @@ void GrGLIndexBuffer::unlock() {
GrAssert(fGL->supportsBufferLocking());
bind();
GR_GL(UnmapBuffer(GL_ELEMENT_ARRAY_BUFFER));
GR_GL(UnmapBuffer(GR_GL_ELEMENT_ARRAY_BUFFER));
fLockPtr = NULL;
}
@ -83,8 +83,8 @@ bool GrGLIndexBuffer::isLocked() const {
#if GR_DEBUG
if (fGL->supportsBufferLocking()) {
bind();
GLint mapped;
GR_GL(GetBufferParameteriv(GL_ELEMENT_ARRAY_BUFFER,
GrGLint mapped;
GR_GL(GetBufferParameteriv(GR_GL_ELEMENT_ARRAY_BUFFER,
GR_BUFFER_MAPPED, &mapped));
GrAssert(!!mapped == !!fLockPtr);
}
@ -99,12 +99,12 @@ bool GrGLIndexBuffer::updateData(const void* src, size_t srcSizeInBytes) {
return false;
}
bind();
GLenum usage = dynamic() ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW;
GrGLenum usage = dynamic() ? GR_GL_DYNAMIC_DRAW : GR_GL_STATIC_DRAW;
if (size() == srcSizeInBytes) {
GR_GL(BufferData(GL_ELEMENT_ARRAY_BUFFER, srcSizeInBytes, src, usage));
GR_GL(BufferData(GR_GL_ELEMENT_ARRAY_BUFFER, srcSizeInBytes, src, usage));
} else {
GR_GL(BufferData(GL_ELEMENT_ARRAY_BUFFER, size(), NULL, usage));
GR_GL(BufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, srcSizeInBytes, src));
GR_GL(BufferData(GR_GL_ELEMENT_ARRAY_BUFFER, size(), NULL, usage));
GR_GL(BufferSubData(GR_GL_ELEMENT_ARRAY_BUFFER, 0, srcSizeInBytes, src));
}
return true;
}
@ -118,7 +118,7 @@ bool GrGLIndexBuffer::updateSubData(const void* src,
return false;
}
bind();
GR_GL(BufferSubData(GL_ELEMENT_ARRAY_BUFFER, offset, srcSizeInBytes, src));
GR_GL(BufferSubData(GR_GL_ELEMENT_ARRAY_BUFFER, offset, srcSizeInBytes, src));
return true;
}

View File

@ -18,8 +18,29 @@
#include "GrGLInterface.h"
#include "GrTypes.h"
#include "GrGLPlatformIncludes.h"
#include <stdio.h>
#if defined(GR_GL_PLATFORM_HEADER_SUPPORT)
#include GR_GL_PLATFORM_HEADER_SUPPORT
#endif
#if defined(GR_GL_PLATFORM_HEADER)
#include GR_GL_PLATFORM_HEADER
#endif
#if defined(GR_GL_PLATFORM_HEADER_EXT)
#include GR_GL_PLATFORM_HEADER_EXT
#endif
#if defined(GR_GL_PLATFORM_HEADER2)
#include GR_GL_PLATFORM_HEADER2
#endif
#if defined(GR_GL_PLATFORM_HEADER_EXT2)
#include GR_GL_PLATFORM_HEADER_EXT2
#endif
#if defined(GR_GL_PROC_ADDRESS_HEADER)
#include GR_GL_PROC_ADDRESS_HEADER
#endif
@ -55,30 +76,27 @@ void gl_version_from_string(int* major, int* minor,
*minor = 0;
return;
}
#if GR_SUPPORT_GLDESKTOP
int n = sscanf(versionString, "%d.%d", major, minor);
if (n != 2) {
GrAssert(0);
*major = 0;
*minor = 0;
return;
if (2 == n) {
return;
}
#else
char profile[2];
int n = sscanf(versionString, "OpenGL ES-%c%c %d.%d", profile, profile+1,
major, minor);
n = sscanf(versionString, "OpenGL ES-%c%c %d.%d", profile, profile+1,
major, minor);
bool ok = 4 == n;
if (!ok) {
int n = sscanf(versionString, "OpenGL ES %d.%d", major, minor);
n = sscanf(versionString, "OpenGL ES %d.%d", major, minor);
ok = 2 == n;
}
if (!ok) {
GrAssert(0);
*major = 0;
*minor = 0;
return;
}
#endif
}
bool has_gl_extension_from_string(const char* ext,
@ -177,7 +195,7 @@ void InitializeGLInterfaceExtensions(GrGLInterface* glBindings) {
}
#endif
#if GL_OES_mapbuffer
#if GL_OES_framebuffer_object
if (!fboFound &&
has_gl_extension_from_string("GL_OES_framebuffer_object",
extensionString)) {

View File

@ -20,7 +20,7 @@
GrGLRenderTarget::GrGLRenderTarget(const GLRenderTargetIDs& ids,
GrGLTexID* texID,
GLuint stencilBits,
GrGLuint stencilBits,
const GrGLIRect& viewport,
GrGLTexture* texture,
GrGpuGL* gl) : INHERITED(texture,
@ -71,13 +71,13 @@ void GrGLRenderTarget::abandon() {
////////////////////////////////////////////////////////////////////////////////
const GLenum GrGLTexture::gWrapMode2GLWrap[] = {
GL_CLAMP_TO_EDGE,
GL_REPEAT,
#ifdef GL_MIRRORED_REPEAT
GL_MIRRORED_REPEAT
#else
GL_REPEAT // GL_MIRRORED_REPEAT not supported :(
const GrGLenum GrGLTexture::gWrapMode2GLWrap[] = {
GR_GL_CLAMP_TO_EDGE,
GR_GL_REPEAT,
#if GR_SUPPORT_GLES1 && !GR_SUPPORT_GLES2
GR_GL_REPEAT // GL_MIRRORED_REPEAT not supported :(
#else
GR_GL_MIRRORED_REPEAT
#endif
};
@ -158,9 +158,9 @@ void GrGLTexture::uploadTextureData(uint32_t x,
// If we need to update textures that are created upside down
// then we have to modify this code to flip the srcData
GrAssert(kTopDown_Orientation == fOrientation);
GR_GL(BindTexture(GL_TEXTURE_2D, fTexIDObj->id()));
GR_GL(PixelStorei(GL_UNPACK_ALIGNMENT, fUploadByteCount));
GR_GL(TexSubImage2D(GL_TEXTURE_2D, 0, x, y, width, height,
GR_GL(BindTexture(GR_GL_TEXTURE_2D, fTexIDObj->id()));
GR_GL(PixelStorei(GR_GL_UNPACK_ALIGNMENT, fUploadByteCount));
GR_GL(TexSubImage2D(GR_GL_TEXTURE_2D, 0, x, y, width, height,
fUploadFormat, fUploadType, srcData));
}

View File

@ -18,7 +18,7 @@
void GrGLCheckErr(const char* location, const char* call) {
uint32_t err = GrGLGetGLInterface()->fGetError();
if (GL_NO_ERROR != err) {
if (GR_GL_NO_ERROR != err) {
GrPrintf("---- glGetError %x", err);
if (NULL != location) {
GrPrintf(" at\n\t%s", location);

View File

@ -18,7 +18,7 @@
#include "GrGLVertexBuffer.h"
#include "GrGpuGL.h"
GrGLVertexBuffer::GrGLVertexBuffer(GLuint id, GrGpuGL* gl, size_t sizeInBytes,
GrGLVertexBuffer::GrGLVertexBuffer(GrGLuint id, GrGpuGL* gl, size_t sizeInBytes,
bool dynamic) :
INHERITED(sizeInBytes, dynamic),
fGL(gl),
@ -35,11 +35,11 @@ GrGLVertexBuffer::~GrGLVertexBuffer() {
}
void GrGLVertexBuffer::bind() const {
GR_GL(BindBuffer(GL_ARRAY_BUFFER, fBufferID));
GR_GL(BindBuffer(GR_GL_ARRAY_BUFFER, fBufferID));
fGL->notifyVertexBufferBind(this);
}
GLuint GrGLVertexBuffer::bufferID() const {
GrGLuint GrGLVertexBuffer::bufferID() const {
return fBufferID;
}
@ -55,9 +55,9 @@ void* GrGLVertexBuffer::lock() {
if (fGL->supportsBufferLocking()) {
bind();
// Let driver know it can discard the old data
GR_GL(BufferData(GL_ARRAY_BUFFER, size(), NULL,
dynamic() ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW));
fLockPtr = GR_GL(MapBuffer(GL_ARRAY_BUFFER, GR_WRITE_ONLY));
GR_GL(BufferData(GR_GL_ARRAY_BUFFER, size(), NULL,
dynamic() ? GR_GL_DYNAMIC_DRAW : GR_GL_STATIC_DRAW));
fLockPtr = GR_GL(MapBuffer(GR_GL_ARRAY_BUFFER, GR_WRITE_ONLY));
return fLockPtr;
}
return NULL;
@ -73,7 +73,7 @@ void GrGLVertexBuffer::unlock() {
GrAssert(fGL->supportsBufferLocking());
bind();
GR_GL(UnmapBuffer(GL_ARRAY_BUFFER));
GR_GL(UnmapBuffer(GR_GL_ARRAY_BUFFER));
fLockPtr = NULL;
}
@ -81,9 +81,9 @@ bool GrGLVertexBuffer::isLocked() const {
GrAssert(fBufferID);
#if GR_DEBUG
if (fGL->supportsBufferLocking()) {
GLint mapped;
GrGLint mapped;
bind();
GR_GL(GetBufferParameteriv(GL_ARRAY_BUFFER, GR_BUFFER_MAPPED, &mapped));
GR_GL(GetBufferParameteriv(GR_GL_ARRAY_BUFFER, GR_BUFFER_MAPPED, &mapped));
GrAssert(!!mapped == !!fLockPtr);
}
#endif
@ -97,12 +97,12 @@ bool GrGLVertexBuffer::updateData(const void* src, size_t srcSizeInBytes) {
return false;
}
bind();
GLenum usage = dynamic() ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW;
GrGLenum usage = dynamic() ? GR_GL_DYNAMIC_DRAW : GR_GL_STATIC_DRAW;
if (size() == srcSizeInBytes) {
GR_GL(BufferData(GL_ARRAY_BUFFER, srcSizeInBytes, src, usage));
GR_GL(BufferData(GR_GL_ARRAY_BUFFER, srcSizeInBytes, src, usage));
} else {
GR_GL(BufferData(GL_ARRAY_BUFFER, size(), NULL, usage));
GR_GL(BufferSubData(GL_ARRAY_BUFFER, 0, srcSizeInBytes, src));
GR_GL(BufferData(GR_GL_ARRAY_BUFFER, size(), NULL, usage));
GR_GL(BufferSubData(GR_GL_ARRAY_BUFFER, 0, srcSizeInBytes, src));
}
return true;
}
@ -116,7 +116,7 @@ bool GrGLVertexBuffer::updateSubData(const void* src,
return false;
}
bind();
GR_GL(BufferSubData(GL_ARRAY_BUFFER, offset, srcSizeInBytes, src));
GR_GL(BufferSubData(GR_GL_ARRAY_BUFFER, offset, srcSizeInBytes, src));
return true;
}

File diff suppressed because it is too large Load Diff

View File

@ -151,10 +151,10 @@ private:
void resolveTextureRenderTarget(GrGLTexture* texture);
bool canBeTexture(GrTexture::PixelConfig config,
GLenum* internalFormat,
GLenum* format,
GLenum* type);
bool fboInternalFormat(GrTexture::PixelConfig config, GLenum* format);
GrGLenum* internalFormat,
GrGLenum* format,
GrGLenum* type);
bool fboInternalFormat(GrTexture::PixelConfig config, GrGLenum* format);
friend class GrGLVertexBuffer;
friend class GrGLIndexBuffer;
@ -163,7 +163,7 @@ private:
bool fHWBlendDisabled;
GLuint fAASamples[4];
GrGLuint fAASamples[4];
enum {
kNone_MSFBO = 0,
kDesktop_MSFBO,

View File

@ -25,7 +25,7 @@
#define SKIP_CACHE_CHECK true
struct GrGpuMatrix {
GLfloat fMat[16];
GrGLfloat fMat[16];
void reset() {
Gr_bzero(fMat, sizeof(fMat));
@ -51,8 +51,8 @@ struct GrGpuMatrix {
};
// these must match the order in the corresponding enum in GrGpu.h
static const GLenum gMatrixMode2Enum[] = {
GL_MODELVIEW, GL_TEXTURE
static const GrGLenum gMatrixMode2Enum[] = {
GR_GL_MODELVIEW, GR_GL_TEXTURE
};
///////////////////////////////////////////////////////////////////////////////
@ -66,22 +66,22 @@ GrGpuGLFixed::~GrGpuGLFixed() {
void GrGpuGLFixed::resetContext() {
INHERITED::resetContext();
GR_GL(Disable(GL_TEXTURE_2D));
GR_GL(Disable(GR_GL_TEXTURE_2D));
for (int s = 0; s < kNumStages; ++s) {
setTextureUnit(s);
GR_GL(EnableClientState(GL_VERTEX_ARRAY));
GR_GL(TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE));
GR_GL(TexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE));
GR_GL(TexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE0+s));
GR_GL(TexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PREVIOUS));
GR_GL(TexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR));
GR_GL(EnableClientState(GR_GL_VERTEX_ARRAY));
GR_GL(TexEnvi(GR_GL_TEXTURE_ENV, GR_GL_TEXTURE_ENV_MODE, GR_GL_COMBINE));
GR_GL(TexEnvi(GR_GL_TEXTURE_ENV, GR_GL_COMBINE_RGB, GR_GL_MODULATE));
GR_GL(TexEnvi(GR_GL_TEXTURE_ENV, GR_GL_SRC0_RGB, GR_GL_TEXTURE0+s));
GR_GL(TexEnvi(GR_GL_TEXTURE_ENV, GR_GL_SRC1_RGB, GR_GL_PREVIOUS));
GR_GL(TexEnvi(GR_GL_TEXTURE_ENV, GR_GL_OPERAND1_RGB, GR_GL_SRC_COLOR));
GR_GL(TexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE));
GR_GL(TexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_TEXTURE0+s));
GR_GL(TexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA));
GR_GL(TexEnvi(GL_TEXTURE_ENV, GL_SRC1_ALPHA, GL_PREVIOUS));
GR_GL(TexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA));
GR_GL(TexEnvi(GR_GL_TEXTURE_ENV, GR_GL_COMBINE_ALPHA, GR_GL_MODULATE));
GR_GL(TexEnvi(GR_GL_TEXTURE_ENV, GR_GL_SRC0_ALPHA, GR_GL_TEXTURE0+s));
GR_GL(TexEnvi(GR_GL_TEXTURE_ENV, GR_GL_OPERAND0_ALPHA, GR_GL_SRC_ALPHA));
GR_GL(TexEnvi(GR_GL_TEXTURE_ENV, GR_GL_SRC1_ALPHA, GR_GL_PREVIOUS));
GR_GL(TexEnvi(GR_GL_TEXTURE_ENV, GR_GL_OPERAND1_ALPHA, GR_GL_SRC_ALPHA));
// color oprand0 changes between GL_SRC_COLR and GL_SRC_ALPHA depending
// upon whether we have a (premultiplied) RGBA texture or just an ALPHA
@ -92,10 +92,10 @@ void GrGpuGLFixed::resetContext() {
fHWGeometryState.fVertexLayout = 0;
fHWGeometryState.fVertexOffset = ~0;
GR_GL(EnableClientState(GL_VERTEX_ARRAY));
GR_GL(DisableClientState(GL_TEXTURE_COORD_ARRAY));
GR_GL(ShadeModel(GL_FLAT));
GR_GL(DisableClientState(GL_COLOR_ARRAY));
GR_GL(EnableClientState(GR_GL_VERTEX_ARRAY));
GR_GL(DisableClientState(GR_GL_TEXTURE_COORD_ARRAY));
GR_GL(ShadeModel(GR_GL_FLAT));
GR_GL(DisableClientState(GR_GL_COLOR_ARRAY));
GR_GL(PointSize(1.f));
@ -120,7 +120,7 @@ void GrGpuGLFixed::flushProjectionMatrix() {
mat[12] = -1.f;
mat[13] = 1.f;
GR_GL(MatrixMode(GL_PROJECTION));
GR_GL(MatrixMode(GR_GL_PROJECTION));
GR_GL(LoadMatrixf(mat));
}
@ -158,9 +158,9 @@ bool GrGpuGLFixed::flushGraphicsState(GrPrimitiveType type) {
if (usingTextures[s] != wasUsingTexture) {
setTextureUnit(s);
if (usingTextures[s]) {
GR_GL(Enable(GL_TEXTURE_2D));
GR_GL(Enable(GR_GL_TEXTURE_2D));
} else {
GR_GL(Disable(GL_TEXTURE_2D));
GR_GL(Disable(GR_GL_TEXTURE_2D));
}
}
}
@ -171,11 +171,11 @@ bool GrGpuGLFixed::flushGraphicsState(GrPrimitiveType type) {
if (vertColor != prevVertColor) {
if (vertColor) {
GR_GL(ShadeModel(GL_SMOOTH));
GR_GL(ShadeModel(GR_GL_SMOOTH));
// invalidate the immediate mode color
fHWDrawState.fColor = GrColor_ILLEGAL;
} else {
GR_GL(ShadeModel(GL_FLAT));
GR_GL(ShadeModel(GR_GL_FLAT));
}
}
@ -199,11 +199,11 @@ bool GrGpuGLFixed::flushGraphicsState(GrPrimitiveType type) {
kColor_TextureEnvRGBOperand;
if (fHWRGBOperand0[s] != nextRGBOperand0) {
setTextureUnit(s);
GR_GL(TexEnvi(GL_TEXTURE_ENV,
GL_OPERAND0_RGB,
GR_GL(TexEnvi(GR_GL_TEXTURE_ENV,
GR_GL_OPERAND0_RGB,
(nextRGBOperand0==kAlpha_TextureEnvRGBOperand) ?
GL_SRC_ALPHA :
GL_SRC_COLOR));
GR_GL_SRC_ALPHA :
GR_GL_SRC_COLOR));
fHWRGBOperand0[s] = nextRGBOperand0;
}
@ -218,7 +218,7 @@ bool GrGpuGLFixed::flushGraphicsState(GrPrimitiveType type) {
GrGpuMatrix glm;
glm.set(texMat);
setTextureUnit(s);
GR_GL(MatrixMode(GL_TEXTURE));
GR_GL(MatrixMode(GR_GL_TEXTURE));
GR_GL(LoadMatrixf(glm.fMat));
recordHWSamplerMatrix(s, getSamplerMatrix(s));
}
@ -232,7 +232,7 @@ bool GrGpuGLFixed::flushGraphicsState(GrPrimitiveType type) {
if (fHWDrawState.fViewMatrix != fCurrDrawState.fViewMatrix) {
GrGpuMatrix glm;
glm.set(fCurrDrawState.fViewMatrix);
GR_GL(MatrixMode(GL_MODELVIEW));
GR_GL(MatrixMode(GR_GL_MODELVIEW));
GR_GL(LoadMatrixf(glm.fMat));
fHWDrawState.fViewMatrix =
fCurrDrawState.fViewMatrix;
@ -249,14 +249,14 @@ void GrGpuGLFixed::setupGeometry(int* startVertex,
int newColorOffset;
int newTexCoordOffsets[kNumStages];
GLsizei newStride = VertexSizeAndOffsetsByStage(fGeometrySrc.fVertexLayout,
newTexCoordOffsets,
&newColorOffset);
GrGLsizei newStride = VertexSizeAndOffsetsByStage(fGeometrySrc.fVertexLayout,
newTexCoordOffsets,
&newColorOffset);
int oldColorOffset;
int oldTexCoordOffsets[kNumStages];
GLsizei oldStride = VertexSizeAndOffsetsByStage(fHWGeometryState.fVertexLayout,
oldTexCoordOffsets,
&oldColorOffset);
GrGLsizei oldStride = VertexSizeAndOffsetsByStage(fHWGeometryState.fVertexLayout,
oldTexCoordOffsets,
&oldColorOffset);
bool indexed = NULL != startIndex;
@ -264,7 +264,7 @@ void GrGpuGLFixed::setupGeometry(int* startVertex,
int extraIndexOffset;
setBuffers(indexed, &extraVertexOffset, &extraIndexOffset);
GLenum scalarType;
GrGLenum scalarType;
if (fGeometrySrc.fVertexLayout & kTextFormat_VertexLayoutBit) {
scalarType = GrGLTextType;
} else {
@ -291,7 +291,7 @@ void GrGpuGLFixed::setupGeometry(int* startVertex,
fGeometrySrc.fVertexLayout)));
if (posAndTexChange) {
GR_GL(VertexPointer(2, scalarType, newStride, (GLvoid*)vertexOffset));
GR_GL(VertexPointer(2, scalarType, newStride, (GrGLvoid*)vertexOffset));
fHWGeometryState.fVertexOffset = vertexOffset;
}
@ -299,32 +299,32 @@ void GrGpuGLFixed::setupGeometry(int* startVertex,
// need to enable array if tex coord offset is 0
// (using positions as coords)
if (newTexCoordOffsets[s] >= 0) {
GLvoid* texCoordOffset = (GLvoid*)(vertexOffset + newTexCoordOffsets[s]);
GrGLvoid* texCoordOffset = (GrGLvoid*)(vertexOffset + newTexCoordOffsets[s]);
if (oldTexCoordOffsets[s] < 0) {
GR_GL(ClientActiveTexture(GL_TEXTURE0+s));
GR_GL(EnableClientState(GL_TEXTURE_COORD_ARRAY));
GR_GL(ClientActiveTexture(GR_GL_TEXTURE0+s));
GR_GL(EnableClientState(GR_GL_TEXTURE_COORD_ARRAY));
GR_GL(TexCoordPointer(2, scalarType, newStride, texCoordOffset));
} else if (posAndTexChange ||
newTexCoordOffsets[s] != oldTexCoordOffsets[s]) {
GR_GL(ClientActiveTexture(GL_TEXTURE0+s));
GR_GL(ClientActiveTexture(GR_GL_TEXTURE0+s));
GR_GL(TexCoordPointer(2, scalarType, newStride, texCoordOffset));
}
} else if (oldTexCoordOffsets[s] >= 0) {
GR_GL(ClientActiveTexture(GL_TEXTURE0+s));
GR_GL(DisableClientState(GL_TEXTURE_COORD_ARRAY));
GR_GL(ClientActiveTexture(GR_GL_TEXTURE0+s));
GR_GL(DisableClientState(GR_GL_TEXTURE_COORD_ARRAY));
}
}
if (newColorOffset > 0) {
GLvoid* colorOffset = (GLvoid*)(vertexOffset + newColorOffset);
GrGLvoid* colorOffset = (GrGLvoid*)(vertexOffset + newColorOffset);
if (oldColorOffset <= 0) {
GR_GL(EnableClientState(GL_COLOR_ARRAY));
GR_GL(ColorPointer(4, GL_UNSIGNED_BYTE, newStride, colorOffset));
GR_GL(EnableClientState(GR_GL_COLOR_ARRAY));
GR_GL(ColorPointer(4, GR_GL_UNSIGNED_BYTE, newStride, colorOffset));
} else if (allOffsetsChange || newColorOffset != oldColorOffset) {
GR_GL(ColorPointer(4, GL_UNSIGNED_BYTE, newStride, colorOffset));
GR_GL(ColorPointer(4, GR_GL_UNSIGNED_BYTE, newStride, colorOffset));
}
} else if (oldColorOffset > 0) {
GR_GL(DisableClientState(GL_COLOR_ARRAY));
GR_GL(DisableClientState(GR_GL_COLOR_ARRAY));
}
fHWGeometryState.fVertexLayout = fGeometrySrc.fVertexLayout;

View File

@ -1,5 +1,5 @@
/*
Copyright 2010 Google Inc.
Copyright 2011 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -52,13 +52,13 @@
#define GR_UINT32_MAX static_cast<uint32_t>(-1)
struct GrGpuGLShaders2::StageUniLocations {
GLint fTextureMatrixUni;
GLint fSamplerUni;
GLint fRadial2Uni;
GrGLint fTextureMatrixUni;
GrGLint fSamplerUni;
GrGLint fRadial2Uni;
};
struct GrGpuGLShaders2::UniLocations {
GLint fViewMatrixUni;
GrGLint fViewMatrixUni;
StageUniLocations fStages[kNumStages];
};
@ -71,9 +71,9 @@ struct GrGpuGLShaders2::UniLocations {
// previous uniform state after a program change.
struct GrGpuGLShaders2::Program {
// IDs
GLuint fVShaderID;
GLuint fFShaderID;
GLuint fProgramID;
GrGLuint fVShaderID;
GrGLuint fFShaderID;
GrGLuint fProgramID;
// shader uniform locations (-1 if shader doesn't use them)
UniLocations fUniLocations;
@ -814,7 +814,7 @@ void GrGpuGLShaders2::GenProgram(const ProgramDesc& desc,
segments.fVaryings.cstr(),
segments.fVSCode.cstr());
#endif
program->fVShaderID = CompileShader(GL_VERTEX_SHADER,
program->fVShaderID = CompileShader(GR_GL_VERTEX_SHADER,
stringCnt,
strings,
lengths);
@ -849,13 +849,13 @@ void GrGpuGLShaders2::GenProgram(const ProgramDesc& desc,
segments.fVaryings.cstr(),
segments.fFSCode.cstr());
#endif
program->fFShaderID = CompileShader(GL_FRAGMENT_SHADER,
program->fFShaderID = CompileShader(GR_GL_FRAGMENT_SHADER,
stringCnt,
strings,
lengths);
program->fProgramID = GR_GL(CreateProgram());
const GLint& progID = program->fProgramID;
const GrGLint& progID = program->fProgramID;
GR_GL(AttachShader(progID, program->fVShaderID));
GR_GL(AttachShader(progID, program->fFShaderID));
@ -896,11 +896,11 @@ void GrGpuGLShaders2::GenProgram(const ProgramDesc& desc,
GR_GL(LinkProgram(progID));
GLint linked = GR_GL_INIT_ZERO;
GR_GL(GetProgramiv(progID, GL_LINK_STATUS, &linked));
GrGLint linked = GR_GL_INIT_ZERO;
GR_GL(GetProgramiv(progID, GR_GL_LINK_STATUS, &linked));
if (!linked) {
GLint infoLen = GR_GL_INIT_ZERO;
GR_GL(GetProgramiv(progID, GL_INFO_LOG_LENGTH, &infoLen));
GrGLint infoLen = GR_GL_INIT_ZERO;
GR_GL(GetProgramiv(progID, GR_GL_INFO_LOG_LENGTH, &infoLen));
GrAutoMalloc log(sizeof(char)*(infoLen+1)); // outside if for debugger
if (infoLen > 0) {
GR_GL(GetProgramInfoLog(progID,
@ -1042,23 +1042,23 @@ void GrGpuGLShaders2::getProgramDesc(GrPrimitiveType primType, ProgramDesc* desc
}
}
GLuint GrGpuGLShaders2::CompileShader(GLenum type,
int stringCnt,
const char** strings,
int* stringLengths) {
GLuint shader = GR_GL(CreateShader(type));
GrGLuint GrGpuGLShaders2::CompileShader(GrGLenum type,
int stringCnt,
const char** strings,
int* stringLengths) {
GrGLuint shader = GR_GL(CreateShader(type));
if (0 == shader) {
return 0;
}
GLint compiled = GR_GL_INIT_ZERO;
GrGLint compiled = GR_GL_INIT_ZERO;
GR_GL(ShaderSource(shader, stringCnt, strings, stringLengths));
GR_GL(CompileShader(shader));
GR_GL(GetShaderiv(shader, GL_COMPILE_STATUS, &compiled));
GR_GL(GetShaderiv(shader, GR_GL_COMPILE_STATUS, &compiled));
if (!compiled) {
GLint infoLen = GR_GL_INIT_ZERO;
GR_GL(GetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen));
GrGLint infoLen = GR_GL_INIT_ZERO;
GR_GL(GetShaderiv(shader, GR_GL_INFO_LOG_LENGTH, &infoLen));
GrAutoMalloc log(sizeof(char)*(infoLen+1)); // outside if for debugger
if (infoLen > 0) {
GR_GL(GetShaderInfoLog(shader, infoLen+1, NULL, (char*)log.get()));
@ -1316,21 +1316,21 @@ void GrGpuGLShaders2::setupGeometry(int* startVertex,
int newColorOffset;
int newTexCoordOffsets[kMaxTexCoords];
GLsizei newStride = VertexSizeAndOffsetsByIdx(fGeometrySrc.fVertexLayout,
newTexCoordOffsets,
&newColorOffset);
GrGLsizei newStride = VertexSizeAndOffsetsByIdx(fGeometrySrc.fVertexLayout,
newTexCoordOffsets,
&newColorOffset);
int oldColorOffset;
int oldTexCoordOffsets[kMaxTexCoords];
GLsizei oldStride = VertexSizeAndOffsetsByIdx(fHWGeometryState.fVertexLayout,
oldTexCoordOffsets,
&oldColorOffset);
GrGLsizei oldStride = VertexSizeAndOffsetsByIdx(fHWGeometryState.fVertexLayout,
oldTexCoordOffsets,
&oldColorOffset);
bool indexed = NULL != startIndex;
int extraVertexOffset;
int extraIndexOffset;
setBuffers(indexed, &extraVertexOffset, &extraIndexOffset);
GLenum scalarType;
GrGLenum scalarType;
bool texCoordNorm;
if (fGeometrySrc.fVertexLayout & kTextFormat_VertexLayoutBit) {
scalarType = GrGLTextType;
@ -1361,13 +1361,13 @@ void GrGpuGLShaders2::setupGeometry(int* startVertex,
if (posAndTexChange) {
GR_GL(VertexAttribPointer(POS_ATTR_LOCATION, 2, scalarType,
false, newStride, (GLvoid*)vertexOffset));
false, newStride, (GrGLvoid*)vertexOffset));
fHWGeometryState.fVertexOffset = vertexOffset;
}
for (int t = 0; t < kMaxTexCoords; ++t) {
if (newTexCoordOffsets[t] > 0) {
GLvoid* texCoordOffset = (GLvoid*)(vertexOffset + newTexCoordOffsets[t]);
GrGLvoid* texCoordOffset = (GrGLvoid*)(vertexOffset + newTexCoordOffsets[t]);
if (oldTexCoordOffsets[t] <= 0) {
GR_GL(EnableVertexAttribArray(TEX_ATTR_LOCATION(t)));
GR_GL(VertexAttribPointer(TEX_ATTR_LOCATION(t), 2, scalarType,
@ -1383,15 +1383,15 @@ void GrGpuGLShaders2::setupGeometry(int* startVertex,
}
if (newColorOffset > 0) {
GLvoid* colorOffset = (int8_t*)(vertexOffset + newColorOffset);
GrGLvoid* colorOffset = (int8_t*)(vertexOffset + newColorOffset);
if (oldColorOffset <= 0) {
GR_GL(EnableVertexAttribArray(COL_ATTR_LOCATION));
GR_GL(VertexAttribPointer(COL_ATTR_LOCATION, 4,
GL_UNSIGNED_BYTE,
GR_GL_UNSIGNED_BYTE,
true, newStride, colorOffset));
} else if (allOffsetsChange || newColorOffset != oldColorOffset) {
GR_GL(VertexAttribPointer(COL_ATTR_LOCATION, 4,
GL_UNSIGNED_BYTE,
GR_GL_UNSIGNED_BYTE,
true, newStride, colorOffset));
}
} else if (oldColorOffset > 0) {

View File

@ -1,5 +1,5 @@
/*
Copyright 2010 Google Inc.
Copyright 2011 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -84,16 +84,16 @@ private:
// Compiles a GL shader, returns shader ID or 0 if failed
// params have same meaning as glShaderSource
static GLuint CompileShader(GLenum type, int stringCnt,
const char** strings,
int* stringLengths);
static GrGLuint CompileShader(GrGLenum type, int stringCnt,
const char** strings,
int* stringLengths);
static void DeleteProgram(Program* program);
void ProgramUnitTest();
ProgramCache* fProgramCache;
Program* fProgram;
GLuint fHWProgramID;
GrGLuint fHWProgramID;
typedef GrGpuGL INHERITED;
};

View File

@ -207,6 +207,7 @@
<ClInclude Include="..\..\src\effects\SkRadialGradient_Table.h" />
<ClInclude Include="..\..\src\views\SkTagList.h" />
<ClInclude Include="..\..\src\views\SkViewPriv.h" />
<ClInclude Include="GrGLDefines.h" />
<ClInclude Include="Resource.h" />
<ClInclude Include="SampleApp.h" />
<ClInclude Include="stdafx.h" />

View File

@ -725,6 +725,9 @@
<ClInclude Include="..\..\gpu\include\GrGLPlatformIncludes.h">
<Filter>Gr\include</Filter>
</ClInclude>
<ClInclude Include="GrGLDefines.h">
<Filter>Gr\include</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="ReadMe.txt" />

View File

@ -90,6 +90,7 @@
7D669346132ABD5D003AC2F5 /* GrGLInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7D669345132ABD5D003AC2F5 /* GrGLInterface.cpp */; };
7D66934C132ABD8F003AC2F5 /* GrGLInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 7D66934B132ABD8F003AC2F5 /* GrGLInterface.h */; };
7D66934E132ABDA7003AC2F5 /* GrGLPlatformIncludes.h in Headers */ = {isa = PBXBuildFile; fileRef = 7D66934D132ABDA7003AC2F5 /* GrGLPlatformIncludes.h */; };
7D6EBF5A13330E8400AEAADD /* GrGLDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = 7D6EBF5913330E8400AEAADD /* GrGLDefines.h */; };
D539049B12EA01E30025F3D6 /* GrContext_impl.h in Headers */ = {isa = PBXBuildFile; fileRef = D539049A12EA01E30025F3D6 /* GrContext_impl.h */; };
D53904A112EA026E0025F3D6 /* GrPaint.h in Headers */ = {isa = PBXBuildFile; fileRef = D53904A012EA026E0025F3D6 /* GrPaint.h */; };
D542EAAD131C87E90065FC9D /* GrStencil.h in Headers */ = {isa = PBXBuildFile; fileRef = D542EAAC131C87E90065FC9D /* GrStencil.h */; };
@ -187,6 +188,7 @@
7D669345132ABD5D003AC2F5 /* GrGLInterface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GrGLInterface.cpp; path = ../../gpu/src/GrGLInterface.cpp; sourceTree = SOURCE_ROOT; };
7D66934B132ABD8F003AC2F5 /* GrGLInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GrGLInterface.h; path = ../../gpu/include/GrGLInterface.h; sourceTree = SOURCE_ROOT; };
7D66934D132ABDA7003AC2F5 /* GrGLPlatformIncludes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GrGLPlatformIncludes.h; path = ../../gpu/include/GrGLPlatformIncludes.h; sourceTree = SOURCE_ROOT; };
7D6EBF5913330E8400AEAADD /* GrGLDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GrGLDefines.h; path = ../../gpu/include/GrGLDefines.h; sourceTree = SOURCE_ROOT; };
D2AAC046055464E500DB518D /* libgpu.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libgpu.a; sourceTree = BUILT_PRODUCTS_DIR; };
D539049A12EA01E30025F3D6 /* GrContext_impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GrContext_impl.h; path = ../../gpu/include/GrContext_impl.h; sourceTree = SOURCE_ROOT; };
D53904A012EA026E0025F3D6 /* GrPaint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GrPaint.h; path = ../../gpu/include/GrPaint.h; sourceTree = SOURCE_ROOT; };
@ -215,6 +217,7 @@
00115E3712C116B7008296FE /* include */ = {
isa = PBXGroup;
children = (
7D6EBF5913330E8400AEAADD /* GrGLDefines.h */,
7D66934D132ABDA7003AC2F5 /* GrGLPlatformIncludes.h */,
7D66934B132ABD8F003AC2F5 /* GrGLInterface.h */,
00216E5D130F0B03009A2160 /* GrGLIRect.h */,
@ -419,6 +422,7 @@
D542EAAD131C87E90065FC9D /* GrStencil.h in Headers */,
7D66934C132ABD8F003AC2F5 /* GrGLInterface.h in Headers */,
7D66934E132ABDA7003AC2F5 /* GrGLPlatformIncludes.h in Headers */,
7D6EBF5A13330E8400AEAADD /* GrGLDefines.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};