summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/angle
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-08-08 14:30:41 +0200
committerJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-08-12 13:49:54 +0200
commitab0a50979b9eb4dfa3320eff7e187e41efedf7a9 (patch)
tree498dfb8a97ff3361a9f7486863a52bb4e26bb898 /chromium/third_party/angle
parent4ce69f7403811819800e7c5ae1318b2647e778d1 (diff)
Update Chromium to beta version 37.0.2062.68
Change-Id: I188e3b5aff1bec75566014291b654eb19f5bc8ca Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Diffstat (limited to 'chromium/third_party/angle')
-rw-r--r--chromium/third_party/angle/.gclient2
-rw-r--r--chromium/third_party/angle/.gitattributes1
-rw-r--r--chromium/third_party/angle/AUTHORS1
-rw-r--r--chromium/third_party/angle/DEPS6
-rw-r--r--chromium/third_party/angle/build/all.gyp40
-rw-r--r--chromium/third_party/angle/build/common.gypi464
-rw-r--r--chromium/third_party/angle/build/common_defines.gypi114
-rw-r--r--chromium/third_party/angle/build/gyp_angle29
-rw-r--r--chromium/third_party/angle/codereview.settings6
-rw-r--r--chromium/third_party/angle/enumerate_files.py62
-rw-r--r--chromium/third_party/angle/extensions/ANGLE_platform_angle_d3d.txt112
-rw-r--r--chromium/third_party/angle/extensions/EGL_ANGLE_window_fixed_size.txt136
-rw-r--r--chromium/third_party/angle/extensions/EXT_blend_minmax.txt164
-rw-r--r--chromium/third_party/angle/extensions/EXT_color_buffer_float.txt230
-rw-r--r--chromium/third_party/angle/extensions/EXT_texture_rg.txt195
-rw-r--r--chromium/third_party/angle/generate_projects49
-rw-r--r--chromium/third_party/angle/include/EGL/egl.h2
-rw-r--r--chromium/third_party/angle/include/EGL/eglext.h255
-rw-r--r--chromium/third_party/angle/include/EGL/eglplatform.h18
-rw-r--r--chromium/third_party/angle/include/GLES2/gl2.h9
-rw-r--r--chromium/third_party/angle/include/GLES2/gl2ext.h593
-rw-r--r--chromium/third_party/angle/include/GLES3/gl3.h1061
-rw-r--r--chromium/third_party/angle/include/GLES3/gl3ext.h24
-rw-r--r--chromium/third_party/angle/include/GLES3/gl3platform.h30
-rw-r--r--chromium/third_party/angle/include/GLSLANG/ShaderLang.h104
-rw-r--r--chromium/third_party/angle/projects/build/All.vcxproj215
-rw-r--r--chromium/third_party/angle/projects/build/all.sln285
-rw-r--r--chromium/third_party/angle/projects/samples/dds_to_header.vcxproj119
-rw-r--r--chromium/third_party/angle/projects/samples/dds_to_header.vcxproj.filters14
-rw-r--r--chromium/third_party/angle/projects/samples/essl_to_glsl.vcxproj133
-rw-r--r--chromium/third_party/angle/projects/samples/essl_to_glsl.vcxproj.filters14
-rw-r--r--chromium/third_party/angle/projects/samples/essl_to_hlsl.vcxproj133
-rw-r--r--chromium/third_party/angle/projects/samples/essl_to_hlsl.vcxproj.filters14
-rw-r--r--chromium/third_party/angle/projects/samples/hello_triangle.vcxproj133
-rw-r--r--chromium/third_party/angle/projects/samples/hello_triangle.vcxproj.filters17
-rw-r--r--chromium/third_party/angle/projects/samples/mip_map_2d.vcxproj133
-rw-r--r--chromium/third_party/angle/projects/samples/mip_map_2d.vcxproj.filters17
-rw-r--r--chromium/third_party/angle/projects/samples/multi_texture.vcxproj147
-rw-r--r--chromium/third_party/angle/projects/samples/multi_texture.vcxproj.filters23
-rw-r--r--chromium/third_party/angle/projects/samples/multiple_draw_buffers.vcxproj153
-rw-r--r--chromium/third_party/angle/projects/samples/multiple_draw_buffers.vcxproj.filters26
-rw-r--r--chromium/third_party/angle/projects/samples/particle_system.vcxproj141
-rw-r--r--chromium/third_party/angle/projects/samples/particle_system.vcxproj.filters20
-rw-r--r--chromium/third_party/angle/projects/samples/post_sub_buffer.vcxproj133
-rw-r--r--chromium/third_party/angle/projects/samples/post_sub_buffer.vcxproj.filters17
-rw-r--r--chromium/third_party/angle/projects/samples/sample_util.vcxproj158
-rw-r--r--chromium/third_party/angle/projects/samples/sample_util.vcxproj.filters101
-rw-r--r--chromium/third_party/angle/projects/samples/samples.sln252
-rw-r--r--chromium/third_party/angle/projects/samples/simple_instancing.vcxproj133
-rw-r--r--chromium/third_party/angle/projects/samples/simple_instancing.vcxproj.filters17
-rw-r--r--chromium/third_party/angle/projects/samples/simple_texture_2d.vcxproj133
-rw-r--r--chromium/third_party/angle/projects/samples/simple_texture_2d.vcxproj.filters17
-rw-r--r--chromium/third_party/angle/projects/samples/simple_texture_cubemap.vcxproj133
-rw-r--r--chromium/third_party/angle/projects/samples/simple_texture_cubemap.vcxproj.filters17
-rw-r--r--chromium/third_party/angle/projects/samples/simple_vertex_shader.vcxproj133
-rw-r--r--chromium/third_party/angle/projects/samples/simple_vertex_shader.vcxproj.filters17
-rw-r--r--chromium/third_party/angle/projects/samples/stencil_operations.vcxproj133
-rw-r--r--chromium/third_party/angle/projects/samples/stencil_operations.vcxproj.filters17
-rw-r--r--chromium/third_party/angle/projects/samples/texture_wrap.vcxproj133
-rw-r--r--chromium/third_party/angle/projects/samples/texture_wrap.vcxproj.filters17
-rw-r--r--chromium/third_party/angle/projects/src/angle.sln82
-rw-r--r--chromium/third_party/angle/projects/src/commit_id.vcxproj115
-rw-r--r--chromium/third_party/angle/projects/src/copy_compiler_dll.vcxproj127
-rw-r--r--chromium/third_party/angle/projects/src/copy_compiler_dll.vcxproj.filters14
-rw-r--r--chromium/third_party/angle/projects/src/copy_scripts.vcxproj121
-rw-r--r--chromium/third_party/angle/projects/src/libEGL.vcxproj172
-rw-r--r--chromium/third_party/angle/projects/src/libEGL.vcxproj.filters151
-rw-r--r--chromium/third_party/angle/projects/src/libGLESv2.vcxproj409
-rw-r--r--chromium/third_party/angle/projects/src/libGLESv2.vcxproj.filters847
-rw-r--r--chromium/third_party/angle/projects/src/preprocessor.vcxproj147
-rw-r--r--chromium/third_party/angle/projects/src/preprocessor.vcxproj.filters95
-rw-r--r--chromium/third_party/angle/projects/src/translator.vcxproj119
-rw-r--r--chromium/third_party/angle/projects/src/translator.vcxproj.filters17
-rw-r--r--chromium/third_party/angle/projects/src/translator_lib.vcxproj266
-rw-r--r--chromium/third_party/angle/projects/src/translator_lib.vcxproj.filters481
-rw-r--r--chromium/third_party/angle/projects/src/translator_static.vcxproj119
-rw-r--r--chromium/third_party/angle/projects/src/translator_static.vcxproj.filters17
-rw-r--r--chromium/third_party/angle/samples/angle/Simple_Instancing/Simple_Instancing.c230
-rw-r--r--chromium/third_party/angle/samples/angle/Simple_Instancing/Simple_Instancing.vcxproj105
-rw-r--r--chromium/third_party/angle/samples/angle/hello_triangle/HelloTriangle.cpp96
-rw-r--r--chromium/third_party/angle/samples/angle/mip_map_2d/MipMap2D.cpp169
-rw-r--r--chromium/third_party/angle/samples/angle/multi_texture/MultiTexture.cpp173
-rw-r--r--chromium/third_party/angle/samples/angle/multi_texture/basemap.tga (renamed from chromium/third_party/angle/samples/gles2_book/MultiTexture/basemap.tga)bin786476 -> 786476 bytes
-rw-r--r--chromium/third_party/angle/samples/angle/multi_texture/lightmap.tga (renamed from chromium/third_party/angle/samples/gles2_book/MultiTexture/lightmap.tga)bin196626 -> 196626 bytes
-rw-r--r--chromium/third_party/angle/samples/angle/multiple_draw_buffers/MultipleDrawBuffers.cpp215
-rw-r--r--chromium/third_party/angle/samples/angle/multiple_draw_buffers/multiple_draw_buffers_copy_fs.glsl8
-rw-r--r--chromium/third_party/angle/samples/angle/multiple_draw_buffers/multiple_draw_buffers_fs.glsl12
-rw-r--r--chromium/third_party/angle/samples/angle/multiple_draw_buffers/multiple_draw_buffers_vs.glsl8
-rw-r--r--chromium/third_party/angle/samples/angle/particle_system/ParticleSystem.cpp231
-rw-r--r--chromium/third_party/angle/samples/angle/particle_system/smoke.tga (renamed from chromium/third_party/angle/samples/gles2_book/ParticleSystem/smoke.tga)bin49170 -> 49170 bytes
-rw-r--r--chromium/third_party/angle/samples/angle/post_sub_buffer/PostSubBuffer.cpp176
-rw-r--r--chromium/third_party/angle/samples/angle/sample_util/Event.h86
-rw-r--r--chromium/third_party/angle/samples/angle/sample_util/Matrix.cpp219
-rw-r--r--chromium/third_party/angle/samples/angle/sample_util/Matrix.h46
-rw-r--r--chromium/third_party/angle/samples/angle/sample_util/SampleApplication.cpp223
-rw-r--r--chromium/third_party/angle/samples/angle/sample_util/SampleApplication.h72
-rw-r--r--chromium/third_party/angle/samples/angle/sample_util/Timer.h18
-rw-r--r--chromium/third_party/angle/samples/angle/sample_util/Vector.cpp194
-rw-r--r--chromium/third_party/angle/samples/angle/sample_util/Vector.h82
-rw-r--r--chromium/third_party/angle/samples/angle/sample_util/Window.cpp50
-rw-r--r--chromium/third_party/angle/samples/angle/sample_util/Window.h50
-rw-r--r--chromium/third_party/angle/samples/angle/sample_util/geometry_utils.cpp145
-rw-r--r--chromium/third_party/angle/samples/angle/sample_util/geometry_utils.h34
-rw-r--r--chromium/third_party/angle/samples/angle/sample_util/keyboard.h117
-rw-r--r--chromium/third_party/angle/samples/angle/sample_util/mouse.h21
-rw-r--r--chromium/third_party/angle/samples/angle/sample_util/path_utils.h15
-rw-r--r--chromium/third_party/angle/samples/angle/sample_util/random_utils.cpp22
-rw-r--r--chromium/third_party/angle/samples/angle/sample_util/random_utils.h12
-rw-r--r--chromium/third_party/angle/samples/angle/sample_util/shader_utils.cpp125
-rw-r--r--chromium/third_party/angle/samples/angle/sample_util/shader_utils.h29
-rw-r--r--chromium/third_party/angle/samples/angle/sample_util/texture_utils.cpp129
-rw-r--r--chromium/third_party/angle/samples/angle/sample_util/texture_utils.h17
-rw-r--r--chromium/third_party/angle/samples/angle/sample_util/tga_utils.cpp122
-rw-r--r--chromium/third_party/angle/samples/angle/sample_util/tga_utils.h29
-rw-r--r--chromium/third_party/angle/samples/angle/sample_util/win32/Win32Timer.cpp53
-rw-r--r--chromium/third_party/angle/samples/angle/sample_util/win32/Win32Timer.h30
-rw-r--r--chromium/third_party/angle/samples/angle/sample_util/win32/Win32Window.cpp510
-rw-r--r--chromium/third_party/angle/samples/angle/sample_util/win32/Win32Window.h42
-rw-r--r--chromium/third_party/angle/samples/angle/sample_util/win32/Win32_path_utils.cpp23
-rw-r--r--chromium/third_party/angle/samples/angle/simple_instancing/SimpleInstancing.cpp200
-rw-r--r--chromium/third_party/angle/samples/angle/simple_texture_2d/SimpleTexture2D.cpp141
-rw-r--r--chromium/third_party/angle/samples/angle/simple_texture_cubemap/SimpleTextureCubemap.cpp138
-rw-r--r--chromium/third_party/angle/samples/angle/simple_vertex_shader/SimpleVertexShader.cpp150
-rw-r--r--chromium/third_party/angle/samples/angle/stencil_operations/StencilOperations.cpp242
-rw-r--r--chromium/third_party/angle/samples/angle/texture_wrap/TextureWrap.cpp160
-rw-r--r--chromium/third_party/angle/samples/build_samples.gyp178
-rw-r--r--chromium/third_party/angle/samples/dds_to_header/main.cpp238
-rw-r--r--chromium/third_party/angle/samples/gles2_book/Common/Win32/esUtil_TGA.c122
-rw-r--r--chromium/third_party/angle/samples/gles2_book/Common/Win32/esUtil_win32.c190
-rw-r--r--chromium/third_party/angle/samples/gles2_book/Common/esShader.c155
-rw-r--r--chromium/third_party/angle/samples/gles2_book/Common/esShapes.c279
-rw-r--r--chromium/third_party/angle/samples/gles2_book/Common/esTransform.c212
-rw-r--r--chromium/third_party/angle/samples/gles2_book/Common/esUtil.c290
-rw-r--r--chromium/third_party/angle/samples/gles2_book/Common/esUtil.h297
-rw-r--r--chromium/third_party/angle/samples/gles2_book/Common/esUtil.vcxproj103
-rw-r--r--chromium/third_party/angle/samples/gles2_book/Common/esUtil.vcxproj.filters39
-rw-r--r--chromium/third_party/angle/samples/gles2_book/Common/esUtil_win.h65
-rw-r--r--chromium/third_party/angle/samples/gles2_book/Hello_Triangle/Hello_Triangle.c194
-rw-r--r--chromium/third_party/angle/samples/gles2_book/Hello_Triangle/Hello_Triangle.vcxproj105
-rw-r--r--chromium/third_party/angle/samples/gles2_book/MipMap2D/MipMap2D.c346
-rw-r--r--chromium/third_party/angle/samples/gles2_book/MipMap2D/MipMap2D.vcxproj105
-rw-r--r--chromium/third_party/angle/samples/gles2_book/MultiTexture/MultiTexture.c213
-rw-r--r--chromium/third_party/angle/samples/gles2_book/MultiTexture/MultiTexture.vcxproj115
-rw-r--r--chromium/third_party/angle/samples/gles2_book/MultipleRenderTargets/MultipleRenderTargets.c295
-rw-r--r--chromium/third_party/angle/samples/gles2_book/MultipleRenderTargets/MultipleRenderTargets.vcxproj105
-rw-r--r--chromium/third_party/angle/samples/gles2_book/ParticleSystem/ParticleSystem.c294
-rw-r--r--chromium/third_party/angle/samples/gles2_book/ParticleSystem/ParticleSystem.vcxproj111
-rw-r--r--chromium/third_party/angle/samples/gles2_book/PostSubBuffer/PostSubBuffer.c204
-rw-r--r--chromium/third_party/angle/samples/gles2_book/PostSubBuffer/PostSubBuffer.vcxproj105
-rw-r--r--chromium/third_party/angle/samples/gles2_book/Simple_Texture2D/Simple_Texture2D.c198
-rw-r--r--chromium/third_party/angle/samples/gles2_book/Simple_Texture2D/Simple_Texture2D.vcxproj105
-rw-r--r--chromium/third_party/angle/samples/gles2_book/Simple_TextureCubemap/Simple_TextureCubemap.c229
-rw-r--r--chromium/third_party/angle/samples/gles2_book/Simple_TextureCubemap/Simple_TextureCubemap.vcxproj108
-rw-r--r--chromium/third_party/angle/samples/gles2_book/Simple_VertexShader/Simple_VertexShader.c194
-rw-r--r--chromium/third_party/angle/samples/gles2_book/Simple_VertexShader/Simple_VertexShader.vcxproj105
-rw-r--r--chromium/third_party/angle/samples/gles2_book/Stencil_Test/Stencil_Test.c273
-rw-r--r--chromium/third_party/angle/samples/gles2_book/Stencil_Test/Stencil_Test.vcxproj97
-rw-r--r--chromium/third_party/angle/samples/gles2_book/TextureWrap/TextureWrap.c254
-rw-r--r--chromium/third_party/angle/samples/gles2_book/TextureWrap/TextureWrap.vcxproj105
-rw-r--r--chromium/third_party/angle/samples/samples.gyp199
-rw-r--r--chromium/third_party/angle/samples/samples.sln167
-rw-r--r--chromium/third_party/angle/samples/translator/essl_to_glsl.vcproj193
-rw-r--r--chromium/third_party/angle/samples/translator/essl_to_hlsl.vcxproj104
-rw-r--r--chromium/third_party/angle/samples/translator/essl_to_hlsl.vcxproj.filters21
-rw-r--r--chromium/third_party/angle/samples/translator/translator.cpp46
-rw-r--r--chromium/third_party/angle/src/ANGLE.sln56
-rw-r--r--chromium/third_party/angle/src/angle.gyp10
-rw-r--r--chromium/third_party/angle/src/angle.gypi150
-rw-r--r--chromium/third_party/angle/src/build_angle.gyp13
-rw-r--r--chromium/third_party/angle/src/build_angle.gypi431
-rw-r--r--chromium/third_party/angle/src/commit.h14
-rw-r--r--chromium/third_party/angle/src/commit_id.py38
-rw-r--r--chromium/third_party/angle/src/common/RefCountObject.cpp1
-rw-r--r--chromium/third_party/angle/src/common/RefCountObject.h64
-rw-r--r--chromium/third_party/angle/src/common/angleutils.h24
-rw-r--r--chromium/third_party/angle/src/common/blocklayout.cpp339
-rw-r--r--chromium/third_party/angle/src/common/blocklayout.h111
-rw-r--r--chromium/third_party/angle/src/common/debug.cpp89
-rw-r--r--chromium/third_party/angle/src/common/debug.h50
-rw-r--r--chromium/third_party/angle/src/common/event_tracer.cpp4
-rw-r--r--chromium/third_party/angle/src/common/event_tracer.h12
-rw-r--r--chromium/third_party/angle/src/common/mathutil.cpp66
-rw-r--r--chromium/third_party/angle/src/common/mathutil.h546
-rw-r--r--chromium/third_party/angle/src/common/shadervars.h162
-rw-r--r--chromium/third_party/angle/src/common/system.h26
-rw-r--r--chromium/third_party/angle/src/common/utilities.cpp473
-rw-r--r--chromium/third_party/angle/src/common/utilities.h56
-rw-r--r--chromium/third_party/angle/src/common/version.h18
-rw-r--r--chromium/third_party/angle/src/compiler.gypi99
-rw-r--r--chromium/third_party/angle/src/compiler/BaseTypes.h148
-rw-r--r--chromium/third_party/angle/src/compiler/ForLoopUnroll.cpp215
-rw-r--r--chromium/third_party/angle/src/compiler/ForLoopUnroll.h52
-rw-r--r--chromium/third_party/angle/src/compiler/Initialize.cpp564
-rw-r--r--chromium/third_party/angle/src/compiler/InitializeGLPosition.cpp61
-rw-r--r--chromium/third_party/angle/src/compiler/InitializeGLPosition.h33
-rw-r--r--chromium/third_party/angle/src/compiler/MapLongVariableNames.cpp115
-rw-r--r--chromium/third_party/angle/src/compiler/MapLongVariableNames.h58
-rw-r--r--chromium/third_party/angle/src/compiler/OutputGLSL.cpp35
-rw-r--r--chromium/third_party/angle/src/compiler/OutputGLSLBase.cpp817
-rw-r--r--chromium/third_party/angle/src/compiler/OutputGLSLBase.h79
-rw-r--r--chromium/third_party/angle/src/compiler/OutputHLSL.cpp3133
-rw-r--r--chromium/third_party/angle/src/compiler/RemoveTree.cpp77
-rw-r--r--chromium/third_party/angle/src/compiler/SymbolTable.cpp216
-rw-r--r--chromium/third_party/angle/src/compiler/SymbolTable.h382
-rw-r--r--chromium/third_party/angle/src/compiler/TranslatorHLSL.cpp24
-rw-r--r--chromium/third_party/angle/src/compiler/TranslatorHLSL.h27
-rw-r--r--chromium/third_party/angle/src/compiler/Types.h307
-rw-r--r--chromium/third_party/angle/src/compiler/Uniform.cpp21
-rw-r--r--chromium/third_party/angle/src/compiler/Uniform.h35
-rw-r--r--chromium/third_party/angle/src/compiler/ValidateLimitations.h59
-rw-r--r--chromium/third_party/angle/src/compiler/glslang.l355
-rw-r--r--chromium/third_party/angle/src/compiler/preprocessor/DiagnosticsBase.cpp80
-rw-r--r--chromium/third_party/angle/src/compiler/preprocessor/DiagnosticsBase.h6
-rw-r--r--chromium/third_party/angle/src/compiler/preprocessor/DirectiveHandlerBase.h18
-rw-r--r--chromium/third_party/angle/src/compiler/preprocessor/DirectiveParser.cpp171
-rw-r--r--chromium/third_party/angle/src/compiler/preprocessor/DirectiveParser.h62
-rw-r--r--chromium/third_party/angle/src/compiler/preprocessor/ExpressionParser.cpp119
-rw-r--r--chromium/third_party/angle/src/compiler/preprocessor/ExpressionParser.h8
-rw-r--r--chromium/third_party/angle/src/compiler/preprocessor/ExpressionParser.y97
-rw-r--r--chromium/third_party/angle/src/compiler/preprocessor/Input.cpp4
-rw-r--r--chromium/third_party/angle/src/compiler/preprocessor/Input.h29
-rw-r--r--chromium/third_party/angle/src/compiler/preprocessor/Lexer.h2
-rw-r--r--chromium/third_party/angle/src/compiler/preprocessor/Macro.cpp2
-rw-r--r--chromium/third_party/angle/src/compiler/preprocessor/Macro.h9
-rw-r--r--chromium/third_party/angle/src/compiler/preprocessor/MacroExpander.cpp64
-rw-r--r--chromium/third_party/angle/src/compiler/preprocessor/MacroExpander.h60
-rw-r--r--chromium/third_party/angle/src/compiler/preprocessor/Preprocessor.cpp35
-rw-r--r--chromium/third_party/angle/src/compiler/preprocessor/Preprocessor.h19
-rw-r--r--chromium/third_party/angle/src/compiler/preprocessor/SourceLocation.h18
-rw-r--r--chromium/third_party/angle/src/compiler/preprocessor/Token.cpp10
-rw-r--r--chromium/third_party/angle/src/compiler/preprocessor/Token.h35
-rw-r--r--chromium/third_party/angle/src/compiler/preprocessor/Tokenizer.cpp236
-rw-r--r--chromium/third_party/angle/src/compiler/preprocessor/Tokenizer.h16
-rw-r--r--chromium/third_party/angle/src/compiler/preprocessor/Tokenizer.l38
-rw-r--r--chromium/third_party/angle/src/compiler/preprocessor/numeric_lex.h8
-rw-r--r--chromium/third_party/angle/src/compiler/preprocessor/pp_utils.h4
-rw-r--r--chromium/third_party/angle/src/compiler/preprocessor/preprocessor.vcxproj172
-rw-r--r--chromium/third_party/angle/src/compiler/preprocessor/preprocessor.vcxproj.filters100
-rw-r--r--chromium/third_party/angle/src/compiler/translator.vcxproj304
-rw-r--r--chromium/third_party/angle/src/compiler/translator.vcxproj.filters361
-rw-r--r--chromium/third_party/angle/src/compiler/translator/64bit-lexer-safety.patch (renamed from chromium/third_party/angle/src/compiler/64bit-lexer-safety.patch)0
-rw-r--r--chromium/third_party/angle/src/compiler/translator/BaseTypes.h471
-rw-r--r--chromium/third_party/angle/src/compiler/translator/BuiltInFunctionEmulator.cpp (renamed from chromium/third_party/angle/src/compiler/BuiltInFunctionEmulator.cpp)12
-rw-r--r--chromium/third_party/angle/src/compiler/translator/BuiltInFunctionEmulator.h (renamed from chromium/third_party/angle/src/compiler/BuiltInFunctionEmulator.h)6
-rw-r--r--chromium/third_party/angle/src/compiler/translator/CodeGen.cpp (renamed from chromium/third_party/angle/src/compiler/CodeGen.cpp)18
-rw-r--r--chromium/third_party/angle/src/compiler/translator/Common.h (renamed from chromium/third_party/angle/src/compiler/Common.h)17
-rw-r--r--chromium/third_party/angle/src/compiler/translator/Compiler.cpp (renamed from chromium/third_party/angle/src/compiler/Compiler.cpp)347
-rw-r--r--chromium/third_party/angle/src/compiler/translator/ConstantUnion.h (renamed from chromium/third_party/angle/src/compiler/ConstantUnion.h)31
-rw-r--r--chromium/third_party/angle/src/compiler/translator/DetectCallDepth.cpp (renamed from chromium/third_party/angle/src/compiler/DetectCallDepth.cpp)4
-rw-r--r--chromium/third_party/angle/src/compiler/translator/DetectCallDepth.h (renamed from chromium/third_party/angle/src/compiler/DetectCallDepth.h)6
-rw-r--r--chromium/third_party/angle/src/compiler/translator/DetectDiscontinuity.cpp (renamed from chromium/third_party/angle/src/compiler/DetectDiscontinuity.cpp)4
-rw-r--r--chromium/third_party/angle/src/compiler/translator/DetectDiscontinuity.h (renamed from chromium/third_party/angle/src/compiler/DetectDiscontinuity.h)2
-rw-r--r--chromium/third_party/angle/src/compiler/translator/Diagnostics.cpp (renamed from chromium/third_party/angle/src/compiler/Diagnostics.cpp)8
-rw-r--r--chromium/third_party/angle/src/compiler/translator/Diagnostics.h (renamed from chromium/third_party/angle/src/compiler/Diagnostics.h)2
-rw-r--r--chromium/third_party/angle/src/compiler/translator/DirectiveHandler.cpp (renamed from chromium/third_party/angle/src/compiler/DirectiveHandler.cpp)23
-rw-r--r--chromium/third_party/angle/src/compiler/translator/DirectiveHandler.h (renamed from chromium/third_party/angle/src/compiler/DirectiveHandler.h)8
-rw-r--r--chromium/third_party/angle/src/compiler/translator/ExtensionBehavior.h (renamed from chromium/third_party/angle/src/compiler/ExtensionBehavior.h)0
-rw-r--r--chromium/third_party/angle/src/compiler/translator/FlagStd140Structs.cpp77
-rw-r--r--chromium/third_party/angle/src/compiler/translator/FlagStd140Structs.h37
-rw-r--r--chromium/third_party/angle/src/compiler/translator/ForLoopUnroll.cpp82
-rw-r--r--chromium/third_party/angle/src/compiler/translator/ForLoopUnroll.h50
-rw-r--r--chromium/third_party/angle/src/compiler/translator/HashNames.h (renamed from chromium/third_party/angle/src/compiler/HashNames.h)3
-rw-r--r--chromium/third_party/angle/src/compiler/translator/InfoSink.cpp (renamed from chromium/third_party/angle/src/compiler/InfoSink.cpp)2
-rw-r--r--chromium/third_party/angle/src/compiler/translator/InfoSink.h (renamed from chromium/third_party/angle/src/compiler/InfoSink.h)2
-rw-r--r--chromium/third_party/angle/src/compiler/translator/Initialize.cpp760
-rw-r--r--chromium/third_party/angle/src/compiler/translator/Initialize.h (renamed from chromium/third_party/angle/src/compiler/Initialize.h)6
-rw-r--r--chromium/third_party/angle/src/compiler/translator/InitializeDll.cpp (renamed from chromium/third_party/angle/src/compiler/InitializeDll.cpp)8
-rw-r--r--chromium/third_party/angle/src/compiler/translator/InitializeDll.h (renamed from chromium/third_party/angle/src/compiler/InitializeDll.h)0
-rw-r--r--chromium/third_party/angle/src/compiler/translator/InitializeGlobals.h (renamed from chromium/third_party/angle/src/compiler/InitializeGlobals.h)0
-rw-r--r--chromium/third_party/angle/src/compiler/translator/InitializeParseContext.cpp (renamed from chromium/third_party/angle/src/compiler/InitializeParseContext.cpp)4
-rw-r--r--chromium/third_party/angle/src/compiler/translator/InitializeParseContext.h (renamed from chromium/third_party/angle/src/compiler/InitializeParseContext.h)0
-rw-r--r--chromium/third_party/angle/src/compiler/translator/InitializeVariables.cpp116
-rw-r--r--chromium/third_party/angle/src/compiler/translator/InitializeVariables.h50
-rw-r--r--chromium/third_party/angle/src/compiler/translator/IntermTraverse.cpp (renamed from chromium/third_party/angle/src/compiler/IntermTraverse.cpp)28
-rw-r--r--chromium/third_party/angle/src/compiler/translator/Intermediate.cpp (renamed from chromium/third_party/angle/src/compiler/Intermediate.cpp)849
-rw-r--r--chromium/third_party/angle/src/compiler/translator/LoopInfo.cpp211
-rw-r--r--chromium/third_party/angle/src/compiler/translator/LoopInfo.h80
-rw-r--r--chromium/third_party/angle/src/compiler/translator/MMap.h (renamed from chromium/third_party/angle/src/compiler/MMap.h)0
-rw-r--r--chromium/third_party/angle/src/compiler/translator/NodeSearch.h (renamed from chromium/third_party/angle/src/compiler/NodeSearch.h)2
-rw-r--r--chromium/third_party/angle/src/compiler/translator/OutputESSL.cpp (renamed from chromium/third_party/angle/src/compiler/OutputESSL.cpp)9
-rw-r--r--chromium/third_party/angle/src/compiler/translator/OutputESSL.h (renamed from chromium/third_party/angle/src/compiler/OutputESSL.h)7
-rw-r--r--chromium/third_party/angle/src/compiler/translator/OutputGLSL.cpp57
-rw-r--r--chromium/third_party/angle/src/compiler/translator/OutputGLSL.h (renamed from chromium/third_party/angle/src/compiler/OutputGLSL.h)8
-rw-r--r--chromium/third_party/angle/src/compiler/translator/OutputGLSLBase.cpp1080
-rw-r--r--chromium/third_party/angle/src/compiler/translator/OutputGLSLBase.h91
-rw-r--r--chromium/third_party/angle/src/compiler/translator/OutputHLSL.cpp4184
-rw-r--r--chromium/third_party/angle/src/compiler/translator/OutputHLSL.h (renamed from chromium/third_party/angle/src/compiler/OutputHLSL.h)115
-rw-r--r--chromium/third_party/angle/src/compiler/translator/ParseContext.cpp (renamed from chromium/third_party/angle/src/compiler/ParseContext.cpp)1165
-rw-r--r--chromium/third_party/angle/src/compiler/translator/ParseContext.h (renamed from chromium/third_party/angle/src/compiler/ParseContext.h)61
-rw-r--r--chromium/third_party/angle/src/compiler/translator/PoolAlloc.cpp (renamed from chromium/third_party/angle/src/compiler/PoolAlloc.cpp)6
-rw-r--r--chromium/third_party/angle/src/compiler/translator/PoolAlloc.h (renamed from chromium/third_party/angle/src/compiler/PoolAlloc.h)0
-rw-r--r--chromium/third_party/angle/src/compiler/translator/Pragma.h (renamed from chromium/third_party/angle/src/compiler/Pragma.h)0
-rw-r--r--chromium/third_party/angle/src/compiler/translator/QualifierAlive.cpp (renamed from chromium/third_party/angle/src/compiler/QualifierAlive.cpp)2
-rw-r--r--chromium/third_party/angle/src/compiler/translator/QualifierAlive.h (renamed from chromium/third_party/angle/src/compiler/QualifierAlive.h)0
-rw-r--r--chromium/third_party/angle/src/compiler/translator/RemoveTree.cpp29
-rw-r--r--chromium/third_party/angle/src/compiler/translator/RemoveTree.h (renamed from chromium/third_party/angle/src/compiler/RemoveTree.h)0
-rw-r--r--chromium/third_party/angle/src/compiler/translator/RenameFunction.h (renamed from chromium/third_party/angle/src/compiler/RenameFunction.h)2
-rw-r--r--chromium/third_party/angle/src/compiler/translator/RewriteElseBlocks.cpp132
-rw-r--r--chromium/third_party/angle/src/compiler/translator/RewriteElseBlocks.h37
-rw-r--r--chromium/third_party/angle/src/compiler/translator/SearchSymbol.cpp (renamed from chromium/third_party/angle/src/compiler/SearchSymbol.cpp)6
-rw-r--r--chromium/third_party/angle/src/compiler/translator/SearchSymbol.h (renamed from chromium/third_party/angle/src/compiler/SearchSymbol.h)4
-rw-r--r--chromium/third_party/angle/src/compiler/translator/ShHandle.h (renamed from chromium/third_party/angle/src/compiler/ShHandle.h)51
-rw-r--r--chromium/third_party/angle/src/compiler/translator/ShaderLang.cpp (renamed from chromium/third_party/angle/src/compiler/ShaderLang.cpp)92
-rw-r--r--chromium/third_party/angle/src/compiler/translator/SymbolTable.cpp241
-rw-r--r--chromium/third_party/angle/src/compiler/translator/SymbolTable.h431
-rw-r--r--chromium/third_party/angle/src/compiler/translator/TranslatorESSL.cpp (renamed from chromium/third_party/angle/src/compiler/TranslatorESSL.cpp)10
-rw-r--r--chromium/third_party/angle/src/compiler/translator/TranslatorESSL.h (renamed from chromium/third_party/angle/src/compiler/TranslatorESSL.h)2
-rw-r--r--chromium/third_party/angle/src/compiler/translator/TranslatorGLSL.cpp (renamed from chromium/third_party/angle/src/compiler/TranslatorGLSL.cpp)32
-rw-r--r--chromium/third_party/angle/src/compiler/translator/TranslatorGLSL.h (renamed from chromium/third_party/angle/src/compiler/TranslatorGLSL.h)5
-rw-r--r--chromium/third_party/angle/src/compiler/translator/TranslatorHLSL.cpp29
-rw-r--r--chromium/third_party/angle/src/compiler/translator/TranslatorHLSL.h34
-rw-r--r--chromium/third_party/angle/src/compiler/translator/Types.cpp250
-rw-r--r--chromium/third_party/angle/src/compiler/translator/Types.h586
-rw-r--r--chromium/third_party/angle/src/compiler/translator/UnfoldShortCircuit.cpp (renamed from chromium/third_party/angle/src/compiler/UnfoldShortCircuit.cpp)6
-rw-r--r--chromium/third_party/angle/src/compiler/translator/UnfoldShortCircuit.h (renamed from chromium/third_party/angle/src/compiler/UnfoldShortCircuit.h)4
-rw-r--r--chromium/third_party/angle/src/compiler/translator/UnfoldShortCircuitAST.cpp (renamed from chromium/third_party/angle/src/compiler/UnfoldShortCircuitAST.cpp)2
-rw-r--r--chromium/third_party/angle/src/compiler/translator/UnfoldShortCircuitAST.h (renamed from chromium/third_party/angle/src/compiler/UnfoldShortCircuitAST.h)2
-rw-r--r--chromium/third_party/angle/src/compiler/translator/ValidateLimitations.cpp (renamed from chromium/third_party/angle/src/compiler/ValidateLimitations.cpp)341
-rw-r--r--chromium/third_party/angle/src/compiler/translator/ValidateLimitations.h55
-rw-r--r--chromium/third_party/angle/src/compiler/translator/ValidateOutputs.cpp78
-rw-r--r--chromium/third_party/angle/src/compiler/translator/ValidateOutputs.h33
-rw-r--r--chromium/third_party/angle/src/compiler/translator/VariableInfo.cpp (renamed from chromium/third_party/angle/src/compiler/VariableInfo.cpp)100
-rw-r--r--chromium/third_party/angle/src/compiler/translator/VariableInfo.h (renamed from chromium/third_party/angle/src/compiler/VariableInfo.h)4
-rw-r--r--chromium/third_party/angle/src/compiler/translator/VariablePacker.cpp (renamed from chromium/third_party/angle/src/compiler/VariablePacker.cpp)30
-rw-r--r--chromium/third_party/angle/src/compiler/translator/VariablePacker.h (renamed from chromium/third_party/angle/src/compiler/VariablePacker.h)2
-rw-r--r--chromium/third_party/angle/src/compiler/translator/VersionGLSL.cpp (renamed from chromium/third_party/angle/src/compiler/VersionGLSL.cpp)2
-rw-r--r--chromium/third_party/angle/src/compiler/translator/VersionGLSL.h (renamed from chromium/third_party/angle/src/compiler/VersionGLSL.h)6
-rw-r--r--chromium/third_party/angle/src/compiler/translator/compilerdebug.cpp (renamed from chromium/third_party/angle/src/compiler/debug.cpp)8
-rw-r--r--chromium/third_party/angle/src/compiler/translator/compilerdebug.h (renamed from chromium/third_party/angle/src/compiler/debug.h)0
-rw-r--r--chromium/third_party/angle/src/compiler/translator/depgraph/DependencyGraph.cpp (renamed from chromium/third_party/angle/src/compiler/depgraph/DependencyGraph.cpp)4
-rw-r--r--chromium/third_party/angle/src/compiler/translator/depgraph/DependencyGraph.h (renamed from chromium/third_party/angle/src/compiler/depgraph/DependencyGraph.h)2
-rw-r--r--chromium/third_party/angle/src/compiler/translator/depgraph/DependencyGraphBuilder.cpp (renamed from chromium/third_party/angle/src/compiler/depgraph/DependencyGraphBuilder.cpp)2
-rw-r--r--chromium/third_party/angle/src/compiler/translator/depgraph/DependencyGraphBuilder.h (renamed from chromium/third_party/angle/src/compiler/depgraph/DependencyGraphBuilder.h)2
-rw-r--r--chromium/third_party/angle/src/compiler/translator/depgraph/DependencyGraphOutput.cpp (renamed from chromium/third_party/angle/src/compiler/depgraph/DependencyGraphOutput.cpp)2
-rw-r--r--chromium/third_party/angle/src/compiler/translator/depgraph/DependencyGraphOutput.h (renamed from chromium/third_party/angle/src/compiler/depgraph/DependencyGraphOutput.h)4
-rw-r--r--chromium/third_party/angle/src/compiler/translator/depgraph/DependencyGraphTraverse.cpp (renamed from chromium/third_party/angle/src/compiler/depgraph/DependencyGraphTraverse.cpp)2
-rw-r--r--[-rwxr-xr-x]chromium/third_party/angle/src/compiler/translator/generate_parser.sh (renamed from chromium/third_party/angle/src/compiler/generate_parser.sh)0
-rw-r--r--chromium/third_party/angle/src/compiler/translator/glslang.h (renamed from chromium/third_party/angle/src/compiler/glslang.h)0
-rw-r--r--chromium/third_party/angle/src/compiler/translator/glslang.l558
-rw-r--r--chromium/third_party/angle/src/compiler/translator/glslang.y (renamed from chromium/third_party/angle/src/compiler/glslang.y)791
-rw-r--r--chromium/third_party/angle/src/compiler/translator/glslang_lex.cpp (renamed from chromium/third_party/angle/src/compiler/glslang_lex.cpp)1368
-rw-r--r--chromium/third_party/angle/src/compiler/translator/glslang_tab.cpp (renamed from chromium/third_party/angle/src/compiler/glslang_tab.cpp)2895
-rw-r--r--chromium/third_party/angle/src/compiler/translator/glslang_tab.h (renamed from chromium/third_party/angle/src/compiler/glslang_tab.h)204
-rw-r--r--chromium/third_party/angle/src/compiler/translator/intermOut.cpp (renamed from chromium/third_party/angle/src/compiler/intermOut.cpp)27
-rw-r--r--chromium/third_party/angle/src/compiler/translator/intermediate.h (renamed from chromium/third_party/angle/src/compiler/intermediate.h)108
-rw-r--r--chromium/third_party/angle/src/compiler/translator/length_limits.h (renamed from chromium/third_party/angle/src/compiler/preprocessor/length_limits.h)8
-rw-r--r--chromium/third_party/angle/src/compiler/translator/localintermediate.h (renamed from chromium/third_party/angle/src/compiler/localintermediate.h)14
-rw-r--r--chromium/third_party/angle/src/compiler/translator/osinclude.h (renamed from chromium/third_party/angle/src/compiler/osinclude.h)3
-rw-r--r--chromium/third_party/angle/src/compiler/translator/ossource_posix.cpp (renamed from chromium/third_party/angle/src/compiler/ossource_posix.cpp)2
-rw-r--r--chromium/third_party/angle/src/compiler/translator/ossource_win.cpp (renamed from chromium/third_party/angle/src/compiler/ossource_win.cpp)2
-rw-r--r--chromium/third_party/angle/src/compiler/translator/parseConst.cpp (renamed from chromium/third_party/angle/src/compiler/parseConst.cpp)74
-rw-r--r--chromium/third_party/angle/src/compiler/translator/timing/RestrictFragmentShaderTiming.cpp (renamed from chromium/third_party/angle/src/compiler/timing/RestrictFragmentShaderTiming.cpp)17
-rw-r--r--chromium/third_party/angle/src/compiler/translator/timing/RestrictFragmentShaderTiming.h (renamed from chromium/third_party/angle/src/compiler/timing/RestrictFragmentShaderTiming.h)6
-rw-r--r--chromium/third_party/angle/src/compiler/translator/timing/RestrictVertexShaderTiming.cpp (renamed from chromium/third_party/angle/src/compiler/timing/RestrictVertexShaderTiming.cpp)4
-rw-r--r--chromium/third_party/angle/src/compiler/translator/timing/RestrictVertexShaderTiming.h (renamed from chromium/third_party/angle/src/compiler/timing/RestrictVertexShaderTiming.h)6
-rw-r--r--chromium/third_party/angle/src/compiler/translator/util.cpp (renamed from chromium/third_party/angle/src/compiler/util.cpp)2
-rw-r--r--chromium/third_party/angle/src/compiler/translator/util.h (renamed from chromium/third_party/angle/src/compiler/util.h)0
-rw-r--r--chromium/third_party/angle/src/copy_compiler_dll.bat4
-rw-r--r--chromium/third_party/angle/src/libEGL.gypi60
-rw-r--r--chromium/third_party/angle/src/libEGL/Config.cpp16
-rw-r--r--chromium/third_party/angle/src/libEGL/Display.cpp56
-rw-r--r--chromium/third_party/angle/src/libEGL/Display.h4
-rw-r--r--chromium/third_party/angle/src/libEGL/Surface.cpp98
-rw-r--r--chromium/third_party/angle/src/libEGL/Surface.h18
-rw-r--r--chromium/third_party/angle/src/libEGL/libEGL.cpp126
-rw-r--r--chromium/third_party/angle/src/libEGL/libEGL.rc11
-rw-r--r--chromium/third_party/angle/src/libEGL/libEGL.vcxproj258
-rw-r--r--chromium/third_party/angle/src/libEGL/libEGL.vcxproj.filters68
-rw-r--r--chromium/third_party/angle/src/libEGL/main.cpp97
-rw-r--r--chromium/third_party/angle/src/libGLESv2.gypi124
-rw-r--r--chromium/third_party/angle/src/libGLESv2/BinaryStream.h118
-rw-r--r--chromium/third_party/angle/src/libGLESv2/Buffer.cpp106
-rw-r--r--chromium/third_party/angle/src/libGLESv2/Buffer.h19
-rw-r--r--chromium/third_party/angle/src/libGLESv2/Context.cpp2649
-rw-r--r--chromium/third_party/angle/src/libGLESv2/Context.h338
-rw-r--r--chromium/third_party/angle/src/libGLESv2/DynamicHLSL.cpp1057
-rw-r--r--chromium/third_party/angle/src/libGLESv2/DynamicHLSL.h78
-rw-r--r--chromium/third_party/angle/src/libGLESv2/Fence.cpp165
-rw-r--r--chromium/third_party/angle/src/libGLESv2/Fence.h41
-rw-r--r--chromium/third_party/angle/src/libGLESv2/Framebuffer.cpp375
-rw-r--r--chromium/third_party/angle/src/libGLESv2/Framebuffer.h48
-rw-r--r--chromium/third_party/angle/src/libGLESv2/FramebufferAttachment.cpp491
-rw-r--r--chromium/third_party/angle/src/libGLESv2/FramebufferAttachment.h247
-rw-r--r--chromium/third_party/angle/src/libGLESv2/HandleAllocator.h2
-rw-r--r--chromium/third_party/angle/src/libGLESv2/Program.cpp162
-rw-r--r--chromium/third_party/angle/src/libGLESv2/Program.h22
-rw-r--r--chromium/third_party/angle/src/libGLESv2/ProgramBinary.cpp2887
-rw-r--r--chromium/third_party/angle/src/libGLESv2/ProgramBinary.h190
-rw-r--r--chromium/third_party/angle/src/libGLESv2/Query.cpp5
-rw-r--r--chromium/third_party/angle/src/libGLESv2/Query.h3
-rw-r--r--chromium/third_party/angle/src/libGLESv2/Renderbuffer.cpp341
-rw-r--r--chromium/third_party/angle/src/libGLESv2/Renderbuffer.h153
-rw-r--r--chromium/third_party/angle/src/libGLESv2/RenderbufferProxySet.cpp87
-rw-r--r--chromium/third_party/angle/src/libGLESv2/RenderbufferProxySet.h46
-rw-r--r--chromium/third_party/angle/src/libGLESv2/ResourceManager.cpp115
-rw-r--r--chromium/third_party/angle/src/libGLESv2/ResourceManager.h51
-rw-r--r--chromium/third_party/angle/src/libGLESv2/Sampler.cpp44
-rw-r--r--chromium/third_party/angle/src/libGLESv2/Sampler.h60
-rw-r--r--chromium/third_party/angle/src/libGLESv2/Shader.cpp521
-rw-r--r--chromium/third_party/angle/src/libGLESv2/Shader.h103
-rw-r--r--chromium/third_party/angle/src/libGLESv2/Texture.cpp2460
-rw-r--r--chromium/third_party/angle/src/libGLESv2/Texture.h348
-rw-r--r--chromium/third_party/angle/src/libGLESv2/TransformFeedback.cpp63
-rw-r--r--chromium/third_party/angle/src/libGLESv2/TransformFeedback.h45
-rw-r--r--chromium/third_party/angle/src/libGLESv2/Uniform.cpp91
-rw-r--r--chromium/third_party/angle/src/libGLESv2/Uniform.h45
-rw-r--r--chromium/third_party/angle/src/libGLESv2/VertexArray.cpp71
-rw-r--r--chromium/third_party/angle/src/libGLESv2/VertexArray.h54
-rw-r--r--chromium/third_party/angle/src/libGLESv2/VertexAttribute.h156
-rw-r--r--chromium/third_party/angle/src/libGLESv2/angletypes.cpp177
-rw-r--r--chromium/third_party/angle/src/libGLESv2/angletypes.h158
-rw-r--r--chromium/third_party/angle/src/libGLESv2/constants.h (renamed from chromium/third_party/angle/src/libGLESv2/Constants.h)10
-rw-r--r--chromium/third_party/angle/src/libGLESv2/formatutils.cpp1812
-rw-r--r--chromium/third_party/angle/src/libGLESv2/formatutils.h98
-rw-r--r--chromium/third_party/angle/src/libGLESv2/libGLESv2.cpp7518
-rw-r--r--chromium/third_party/angle/src/libGLESv2/libGLESv2.def113
-rw-r--r--chromium/third_party/angle/src/libGLESv2/libGLESv2.rc11
-rw-r--r--chromium/third_party/angle/src/libGLESv2/libGLESv2.vcxproj425
-rw-r--r--chromium/third_party/angle/src/libGLESv2/libGLESv2.vcxproj.filters527
-rw-r--r--chromium/third_party/angle/src/libGLESv2/main.cpp75
-rw-r--r--chromium/third_party/angle/src/libGLESv2/main.h3
-rw-r--r--chromium/third_party/angle/src/libGLESv2/mathutil.h161
-rw-r--r--chromium/third_party/angle/src/libGLESv2/precompiled.h18
-rw-r--r--chromium/third_party/angle/src/libGLESv2/queryconversions.cpp148
-rw-r--r--chromium/third_party/angle/src/libGLESv2/queryconversions.h17
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/BufferStorage.cpp4
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/BufferStorage.h13
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/BufferStorage11.cpp358
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/BufferStorage11.h56
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/BufferStorage9.cpp78
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/Fence11.cpp134
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/Fence9.cpp135
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/FenceImpl.h21
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/Image.cpp527
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/Image.h93
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/Image11.cpp457
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/ImageSSE2.cpp100
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/IndexBuffer.cpp1
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/IndexDataManager.cpp18
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/IndexRangeCache.cpp4
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/IndexRangeCache.h1
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/Query11.cpp122
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/QueryImpl.h1
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/RenderTarget.h20
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/RenderTarget9.cpp113
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/Renderer.cpp203
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/Renderer.h138
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/ShaderExecutable.h17
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/TextureStorage.cpp110
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/TextureStorage.h73
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/TextureStorage11.cpp667
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/TextureStorage11.h120
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/VertexBuffer.cpp95
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/VertexBuffer.h25
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/VertexBuffer11.cpp440
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/VertexBuffer9.cpp530
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/VertexBuffer9.h91
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/VertexDataManager.cpp65
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/VertexDataManager.h9
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/copyimage.cpp23
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/copyimage.h42
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/copyvertex.h309
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d/HLSLCompiler.cpp123
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d/HLSLCompiler.h40
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Blit11.cpp1040
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Blit11.h126
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/BufferStorage11.cpp869
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/BufferStorage11.h100
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Clear11.cpp557
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Clear11.h77
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Fence11.cpp71
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Fence11.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/Fence11.h)9
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Image11.cpp461
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Image11.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/Image11.h)23
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/IndexBuffer11.cpp (renamed from chromium/third_party/angle/src/libGLESv2/renderer/IndexBuffer11.cpp)16
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/IndexBuffer11.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/IndexBuffer11.h)0
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/InputLayoutCache.cpp (renamed from chromium/third_party/angle/src/libGLESv2/renderer/InputLayoutCache.cpp)103
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/InputLayoutCache.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/InputLayoutCache.h)2
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/PixelTransfer11.cpp252
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/PixelTransfer11.h80
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Query11.cpp155
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Query11.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/Query11.h)9
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/RenderStateCache.cpp (renamed from chromium/third_party/angle/src/libGLESv2/renderer/RenderStateCache.cpp)160
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/RenderStateCache.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/RenderStateCache.h)29
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/RenderTarget11.cpp (renamed from chromium/third_party/angle/src/libGLESv2/renderer/RenderTarget11.cpp)270
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/RenderTarget11.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/RenderTarget11.h)15
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Renderer11.cpp (renamed from chromium/third_party/angle/src/libGLESv2/renderer/Renderer11.cpp)2433
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Renderer11.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/Renderer11.h)185
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/ShaderExecutable11.cpp (renamed from chromium/third_party/angle/src/libGLESv2/renderer/ShaderExecutable11.cpp)69
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/ShaderExecutable11.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/ShaderExecutable11.h)22
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/SwapChain11.cpp (renamed from chromium/third_party/angle/src/libGLESv2/renderer/SwapChain11.cpp)342
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/SwapChain11.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/SwapChain11.h)2
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp1567
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.h278
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/VertexBuffer11.cpp223
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/VertexBuffer11.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/VertexBuffer11.h)26
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/formatutils11.cpp1665
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/formatutils11.h79
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/renderer11_utils.cpp280
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/renderer11_utils.h165
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/BufferToTexture11.hlsl76
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/Clear11.hlsl102
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/Passthrough2D11.hlsl111
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/Passthrough3D11.hlsl146
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/Swizzle11.hlsl99
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/buffertotexture11_gs.h166
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/buffertotexture11_ps_4f.h223
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/buffertotexture11_ps_4i.h129
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/buffertotexture11_ps_4ui.h130
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/buffertotexture11_vs.h303
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/clearfloat11ps.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/clearmultiple11ps.h)2
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/clearfloat11vs.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/clear11vs.h)2
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/clearsint11ps.h196
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/clearsint11vs.h131
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/clearuint11ps.h196
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/clearuint11vs.h131
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthrough2d11vs.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/passthrough11vs.h)2
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthrough3d11gs.h192
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthrough3d11vs.h156
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughdepth2d11ps.h146
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughlum2d11ps.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/passthroughlum11ps.h)34
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughlum3d11ps.h161
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughlumalpha2d11ps.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/passthroughlumalpha11ps.h)34
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughlumalpha3d11ps.h157
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughr2d11ps.h154
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughr2di11ps.h168
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughr2dui11ps.h169
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughr3d11ps.h163
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughr3di11ps.h175
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughr3dui11ps.h176
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg2d11ps.h154
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg2di11ps.h168
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg2dui11ps.h169
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg3d11ps.h163
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg3di11ps.h175
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg3dui11ps.h176
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb2d11ps.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/passthroughrgb11ps.h)34
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb2di11ps.h166
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb2dui11ps.h167
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb3d11ps.h161
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb3di11ps.h173
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb3dui11ps.h174
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba2d11ps.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/passthroughrgba11ps.h)34
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba2di11ps.h158
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba2dui11ps.h158
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba3d11ps.h150
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba3di11ps.h165
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba3dui11ps.h165
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzlef2darrayps.h279
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzlef2dps.h257
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzlef3dps.h266
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzlei2darrayps.h287
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzlei2dps.h271
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzlei3dps.h278
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzleui2darrayps.h287
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzleui2dps.h271
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzleui3dps.h278
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/generate_shaders.bat119
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/Blit9.cpp (renamed from chromium/third_party/angle/src/libGLESv2/renderer/Blit.cpp)192
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/Blit9.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/Blit.h)16
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/BufferStorage9.cpp98
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/BufferStorage9.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/BufferStorage9.h)18
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/Fence9.cpp73
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/Fence9.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/Fence9.h)9
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/Image9.cpp (renamed from chromium/third_party/angle/src/libGLESv2/renderer/Image9.cpp)298
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/Image9.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/Image9.h)23
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/IndexBuffer9.cpp (renamed from chromium/third_party/angle/src/libGLESv2/renderer/IndexBuffer9.cpp)16
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/IndexBuffer9.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/IndexBuffer9.h)0
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/Query9.cpp (renamed from chromium/third_party/angle/src/libGLESv2/renderer/Query9.cpp)24
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/Query9.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/Query9.h)9
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/RenderTarget9.cpp141
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/RenderTarget9.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/RenderTarget9.h)5
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/Renderer9.cpp (renamed from chromium/third_party/angle/src/libGLESv2/renderer/Renderer9.cpp)1158
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/Renderer9.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/Renderer9.h)163
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/ShaderCache.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/ShaderCache.h)14
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/ShaderExecutable9.cpp (renamed from chromium/third_party/angle/src/libGLESv2/renderer/ShaderExecutable9.cpp)12
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/ShaderExecutable9.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/ShaderExecutable9.h)0
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/SwapChain9.cpp (renamed from chromium/third_party/angle/src/libGLESv2/renderer/SwapChain9.cpp)109
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/SwapChain9.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/SwapChain9.h)0
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/TextureStorage9.cpp (renamed from chromium/third_party/angle/src/libGLESv2/renderer/TextureStorage9.cpp)128
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/TextureStorage9.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/TextureStorage9.h)30
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/VertexBuffer9.cpp252
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/VertexBuffer9.h54
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/VertexDeclarationCache.cpp (renamed from chromium/third_party/angle/src/libGLESv2/renderer/VertexDeclarationCache.cpp)19
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/VertexDeclarationCache.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/VertexDeclarationCache.h)0
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/formatutils9.cpp864
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/formatutils9.h77
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/renderer9_utils.cpp (renamed from chromium/third_party/angle/src/libGLESv2/renderer/renderer9_utils.cpp)269
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/renderer9_utils.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/renderer9_utils.h)30
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/shaders/Blit.ps33
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/shaders/Blit.vs (renamed from chromium/third_party/angle/src/libGLESv2/renderer/shaders/Blit.vs)0
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/shaders/compiled/componentmaskps.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/luminanceps.h)56
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/shaders/compiled/flipyvs.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/flipyvs.h)0
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/shaders/compiled/luminanceps.h95
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/shaders/compiled/passthroughps.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/passthroughps.h)0
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/shaders/compiled/standardvs.h (renamed from chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/standardvs.h)0
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/d3d9/shaders/generate_shaders.bat63
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/generatemip.h330
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/imageformats.h2029
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/loadimage.cpp951
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/loadimage.h343
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/loadimageSSE2.cpp107
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/renderer11_utils.cpp688
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/renderer11_utils.h95
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/shaders/Blit.ps39
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/shaders/Clear11.hlsl38
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/shaders/Passthrough11.hlsl29
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/clearsingle11ps.h110
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/componentmaskps.h79
-rw-r--r--chromium/third_party/angle/src/libGLESv2/renderer/shaders/generate_shaders.bat24
-rw-r--r--chromium/third_party/angle/src/libGLESv2/utilities.cpp769
-rw-r--r--chromium/third_party/angle/src/libGLESv2/utilities.h67
-rw-r--r--chromium/third_party/angle/src/libGLESv2/validationES.cpp1293
-rw-r--r--chromium/third_party/angle/src/libGLESv2/validationES.h63
-rw-r--r--chromium/third_party/angle/src/libGLESv2/validationES2.cpp992
-rw-r--r--chromium/third_party/angle/src/libGLESv2/validationES2.h35
-rw-r--r--chromium/third_party/angle/src/libGLESv2/validationES3.cpp760
-rw-r--r--chromium/third_party/angle/src/libGLESv2/validationES3.h39
-rw-r--r--chromium/third_party/angle/src/third_party/compiler/ArrayBoundsClamper.h6
-rw-r--r--chromium/third_party/angle/src/third_party/murmurhash/MurmurHash3.h14
-rw-r--r--chromium/third_party/angle/src/third_party/systeminfo/SystemInfo.cpp60
-rw-r--r--chromium/third_party/angle/src/third_party/systeminfo/SystemInfo.h35
-rw-r--r--chromium/third_party/angle/tests/build_tests.gyp100
-rw-r--r--chromium/third_party/angle/tests/compiler_tests/compiler_tests.gypi21
-rw-r--r--chromium/third_party/angle/tests/preprocessor_tests/preprocessor_tests.gypi38
-rw-r--r--chromium/third_party/angle/tests/tests.gyp364
626 files changed, 82501 insertions, 36549 deletions
diff --git a/chromium/third_party/angle/.gclient b/chromium/third_party/angle/.gclient
index 77bf7d28b12..4f13bceffac 100644
--- a/chromium/third_party/angle/.gclient
+++ b/chromium/third_party/angle/.gclient
@@ -4,4 +4,4 @@ solutions = [ {
u'url': u'https://chromium.googlesource.com/angle/angle',
u'custom_deps': { },
u'deps_file': u'DEPS'
-} ] \ No newline at end of file
+} ]
diff --git a/chromium/third_party/angle/.gitattributes b/chromium/third_party/angle/.gitattributes
index 82531ad847b..196f35370d1 100644
--- a/chromium/third_party/angle/.gitattributes
+++ b/chromium/third_party/angle/.gitattributes
@@ -5,3 +5,4 @@
*.bat eol=crlf
*.rc eol=crlf
**/compiled/*.h eol=crlf
+*.sh eol=lf
diff --git a/chromium/third_party/angle/AUTHORS b/chromium/third_party/angle/AUTHORS
index 0f4d65c24d3..0bdb65ee9aa 100644
--- a/chromium/third_party/angle/AUTHORS
+++ b/chromium/third_party/angle/AUTHORS
@@ -14,6 +14,7 @@ TransGaming Inc.
Adobe Systems Inc.
Autodesk, Inc.
BlackBerry Limited
+Cable Television Laboratories, Inc.
Cloud Party, Inc.
Intel Corporation
Mozilla Corporation
diff --git a/chromium/third_party/angle/DEPS b/chromium/third_party/angle/DEPS
index 73679f52d82..0cec0b0256c 100644
--- a/chromium/third_party/angle/DEPS
+++ b/chromium/third_party/angle/DEPS
@@ -1,11 +1,11 @@
deps = {
"third_party/gyp":
- "http://gyp.googlecode.com/svn/trunk@1767",
+ "http://gyp.googlecode.com/svn/trunk@1806",
- "third_party/googletest":
+ "tests/third_party/googletest":
"http://googletest.googlecode.com/svn/trunk@629",
- "third_party/googlemock":
+ "tests/third_party/googlemock":
"http://googlemock.googlecode.com/svn/trunk@410",
}
diff --git a/chromium/third_party/angle/build/all.gyp b/chromium/third_party/angle/build/all.gyp
index fff9998741a..735fbeacc0e 100644
--- a/chromium/third_party/angle/build/all.gyp
+++ b/chromium/third_party/angle/build/all.gyp
@@ -3,25 +3,23 @@
# found in the LICENSE file.
{
- 'targets': [
- {
- 'target_name': 'all',
- 'type': 'none',
- 'dependencies': [
- # TODO(alokp): build_ prefix should be removed from the gyp files
- # as soon as we can get rid of manually-maintained sln files.
- # Otherwise auto-generated sln files will overwrite/conflict the
- # manually maintained ones.
- '../samples/build_samples.gyp:*',
- '../src/build_angle.gyp:*',
- '../tests/build_tests.gyp:*',
- ],
- },
- ],
+ 'targets':
+ [
+ {
+ 'target_name': 'All',
+ 'type': 'none',
+ 'dependencies': [ '../src/angle.gyp:*', ],
+ 'conditions':
+ [
+ ['angle_build_samples==1',
+ {
+ 'dependencies': [ '../samples/samples.gyp:*', ],
+ }],
+ ['angle_build_tests==1',
+ {
+ 'dependencies': [ '../tests/tests.gyp:*', ],
+ }],
+ ],
+ },
+ ],
}
-
-# Local Variables:
-# tab-width:2
-# indent-tabs-mode:nil
-# End:
-# vim: set expandtab tabstop=2 shiftwidth=2:
diff --git a/chromium/third_party/angle/build/common.gypi b/chromium/third_party/angle/build/common.gypi
index 1c48170e3ba..8a87e160889 100644
--- a/chromium/third_party/angle/build/common.gypi
+++ b/chromium/third_party/angle/build/common.gypi
@@ -3,206 +3,280 @@
# found in the LICENSE file.
{
- 'variables': {
- 'component%': 'static_library',
- # angle_code is set to 1 for the core ANGLE targets defined in src/build_angle.gyp.
- # angle_code is set to 0 for test code, sample code, and third party code.
- # When angle_code is 1, we build with additional warning flags on Mac and Linux.
- 'angle_code%': 0,
- 'windows_sdk_path%': 'C:/Program Files (x86)/Windows Kits/8.0',
- 'winsdk_arch%': 'x86',
- 'gcc_or_clang_warnings': [
- '-Wall',
- '-Wchar-subscripts',
- '-Werror',
- '-Wextra',
- '-Wformat=2',
- '-Winit-self',
- '-Wno-sign-compare',
- '-Wno-unused-function',
- '-Wno-unused-parameter',
- '-Wno-unknown-pragmas',
- '-Wpacked',
- '-Wpointer-arith',
- '-Wundef',
- '-Wwrite-strings',
- ],
- },
- 'target_defaults': {
- 'default_configuration': 'Debug',
- 'variables': {
- 'warn_as_error%': 1,
- },
- 'target_conditions': [
- ['warn_as_error == 1', {
- 'msvs_settings': {
- 'VCCLCompilerTool': {
- 'WarnAsError': 'true',
- },
- },
- }],
- ],
- 'configurations': {
- 'Common': {
- 'abstract': 1,
- 'msvs_configuration_attributes': {
- 'OutputDirectory': '$(SolutionDir)$(ConfigurationName)',
- 'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
- 'CharacterSet': '1', # UNICODE
- },
- 'msvs_configuration_platform': 'Win32',
- 'msvs_settings': {
- 'VCCLCompilerTool': {
- 'BufferSecurityCheck': 'true',
- 'DebugInformationFormat': '3',
- # TODO(alokp): Disable exceptions before integrating with chromium.
- #'ExceptionHandling': '0',
- 'EnableFunctionLevelLinking': 'true',
- 'MinimalRebuild': 'false',
- 'PreprocessorDefinitions': [
- '_CRT_SECURE_NO_DEPRECATE',
- '_SCL_SECURE_NO_DEPRECATE',
- '_HAS_EXCEPTIONS=0',
- '_WIN32_WINNT=0x0600',
- '_WINDOWS',
- 'NOMINMAX',
- 'WIN32',
- 'WIN32_LEAN_AND_MEAN',
- 'WINVER=0x0600',
- ],
- 'RuntimeTypeInfo': 'false',
- 'WarningLevel': '4',
- 'DisableSpecificWarnings': [4100, 4127, 4189, 4239, 4244, 4245, 4512, 4702],
- },
- 'VCLinkerTool': {
- 'FixedBaseAddress': '1',
- 'GenerateDebugInformation': 'true',
- 'ImportLibrary': '$(OutDir)\\lib\\$(TargetName).lib',
- 'MapFileName': '$(OutDir)\\$(TargetName).map',
- # Most of the executables we'll ever create are tests
- # and utilities with console output.
- 'SubSystem': '1', # /SUBSYSTEM:CONSOLE
- 'AdditionalLibraryDirectories': [
- '<(windows_sdk_path)/Lib/win8/um/<(winsdk_arch)',
- ],
- 'AdditionalDependencies': [
- 'kernel32.lib',
- 'gdi32.lib',
- 'winspool.lib',
- 'comdlg32.lib',
- 'advapi32.lib',
- 'shell32.lib',
- 'ole32.lib',
- 'oleaut32.lib',
- 'user32.lib',
- 'uuid.lib',
- 'odbc32.lib',
- 'odbccp32.lib',
- 'delayimp.lib',
- ],
- },
- 'VCLibrarianTool': {
- 'AdditionalLibraryDirectories': [
- '<(windows_sdk_path)/Lib/win8/um/<(winsdk_arch)',
- ],
- },
- 'VCResourceCompilerTool': {
- 'Culture': '1033',
- },
- },
- 'msvs_system_include_dirs': [
- '<(windows_sdk_path)/Include/shared',
- '<(windows_sdk_path)/Include/um',
+ 'includes': [ 'common_defines.gypi', ],
+ 'variables':
+ {
+ 'angle_build_tests%': '1',
+ 'angle_build_samples%': '1',
+ # angle_code is set to 1 for the core ANGLE targets defined in src/build_angle.gyp.
+ # angle_code is set to 0 for test code, sample code, and third party code.
+ # When angle_code is 1, we build with additional warning flags on Mac and Linux.
+ 'angle_code%': 0,
+ 'release_symbols%': 'true',
+ 'gcc_or_clang_warnings':
+ [
+ '-Wall',
+ '-Wchar-subscripts',
+ '-Werror',
+ '-Wextra',
+ '-Wformat=2',
+ '-Winit-self',
+ '-Wno-sign-compare',
+ '-Wno-unused-function',
+ '-Wno-unused-parameter',
+ '-Wno-unknown-pragmas',
+ '-Wpacked',
+ '-Wpointer-arith',
+ '-Wundef',
+ '-Wwrite-strings',
+ '-Wno-reorder',
+ '-Wno-format-nonliteral',
],
- }, # Common
- 'Debug': {
- 'inherit_from': ['Common'],
- 'msvs_settings': {
- 'VCCLCompilerTool': {
- 'Optimization': '0', # /Od
- 'PreprocessorDefinitions': ['_DEBUG'],
- 'BasicRuntimeChecks': '3',
- 'RuntimeLibrary': '1', # /MTd (debug static)
- },
- 'VCLinkerTool': {
- 'LinkIncremental': '2',
- },
- },
- 'xcode_settings': {
- 'COPY_PHASE_STRIP': 'NO',
- 'GCC_OPTIMIZATION_LEVEL': '0',
- },
- }, # Debug
- 'Release': {
- 'inherit_from': ['Common'],
- 'msvs_settings': {
- 'VCCLCompilerTool': {
- 'Optimization': '2', # /Os
- 'PreprocessorDefinitions': ['NDEBUG'],
- 'RuntimeLibrary': '0', # /MT (static)
- },
- 'VCLinkerTool': {
- 'LinkIncremental': '1',
- },
+ },
+ 'target_defaults':
+ {
+ 'default_configuration': 'Debug',
+ 'variables':
+ {
+ 'warn_as_error%': 1,
},
- }, # Release
- }, # configurations
- 'conditions': [
- ['component=="shared_library"', {
- 'defines': ['COMPONENT_BUILD'],
- }],
- ],
- }, # target_defaults
- 'conditions': [
- ['OS=="win"', {
- 'target_defaults': {
- 'msvs_cygwin_dirs': ['../third_party/cygwin'],
- },
- }],
- ['OS!="win" and OS!="mac"', {
- 'target_defaults': {
- 'cflags': [
- '-pthread',
- '-fno-exceptions',
- ],
- 'ldflags': [
- '-pthread',
+ 'target_conditions':
+ [
+ ['warn_as_error == 1',
+ {
+ 'msvs_settings':
+ {
+ 'VCCLCompilerTool':
+ {
+ 'WarnAsError': 'true',
+ },
+ },
+ }],
],
- 'configurations': {
- 'Debug': {
- 'variables': {
- 'debug_optimize%': '0',
+ 'configurations':
+ {
+ 'Common_Base':
+ {
+ 'abstract': 1,
+ 'msvs_configuration_attributes':
+ {
+ 'OutputDirectory': '$(SolutionDir)$(ConfigurationName)_$(Platform)',
+ 'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
+ 'CharacterSet': '0', # ASCII
+ },
+ 'msvs_settings':
+ {
+ 'VCCLCompilerTool':
+ {
+ 'AdditionalOptions': ['/MP'],
+ 'BufferSecurityCheck': 'true',
+ 'DebugInformationFormat': '3',
+ # TODO(alokp): Disable exceptions before integrating with chromium.
+ #'ExceptionHandling': '0',
+ 'EnableFunctionLevelLinking': 'true',
+ 'MinimalRebuild': 'false',
+ 'RuntimeTypeInfo': 'true',
+ 'WarningLevel': '4',
+ },
+ 'VCLinkerTool':
+ {
+ 'FixedBaseAddress': '1',
+ 'ImportLibrary': '$(OutDir)\\lib\\$(TargetName).lib',
+ 'MapFileName': '$(OutDir)\\$(TargetName).map',
+ # Most of the executables we'll ever create are tests
+ # and utilities with console output.
+ 'SubSystem': '1', # /SUBSYSTEM:CONSOLE
+ },
+ 'VCResourceCompilerTool':
+ {
+ 'Culture': '1033',
+ },
+ },
+ }, # Common_Base
+
+ 'Debug_Base':
+ {
+ 'abstract': 1,
+ 'msvs_settings':
+ {
+ 'VCCLCompilerTool':
+ {
+ 'Optimization': '0', # /Od
+ 'BasicRuntimeChecks': '3',
+ 'RuntimeLibrary': '1', # /MTd (debug static)
+ },
+ 'VCLinkerTool':
+ {
+ 'GenerateDebugInformation': 'true',
+ 'LinkIncremental': '2',
+ },
+ },
+ 'xcode_settings':
+ {
+ 'COPY_PHASE_STRIP': 'NO',
+ 'GCC_OPTIMIZATION_LEVEL': '0',
+ },
+ }, # Debug_Base
+
+ 'Release_Base':
+ {
+ 'abstract': 1,
+ 'msvs_settings':
+ {
+ 'VCCLCompilerTool':
+ {
+ 'Optimization': '2', # /Os
+ 'RuntimeLibrary': '0', # /MT (static)
+ },
+ 'VCLinkerTool':
+ {
+ 'GenerateDebugInformation': '<(release_symbols)',
+ 'LinkIncremental': '1',
+ },
+ },
+ }, # Release_Base
+
+ 'x86_Base':
+ {
+ 'abstract': 1,
+ 'msvs_configuration_platform': 'Win32',
+ 'msvs_settings':
+ {
+ 'VCLinkerTool':
+ {
+ 'TargetMachine': '1',
+ 'AdditionalLibraryDirectories':
+ [
+ '<(windows_sdk_path)/Lib/win8/um/x86',
+ ],
+ },
+ 'VCLibrarianTool':
+ {
+ 'AdditionalLibraryDirectories':
+ [
+ '<(windows_sdk_path)/Lib/win8/um/x86',
+ ],
+ },
+ },
+ }, # x86_Base
+
+ 'x64_Base':
+ {
+ 'abstract': 1,
+ 'msvs_configuration_platform': 'x64',
+ 'msvs_settings':
+ {
+ 'VCLinkerTool':
+ {
+ 'TargetMachine': '17', # x86 - 64
+ 'AdditionalLibraryDirectories':
+ [
+ '<(windows_sdk_path)/Lib/win8/um/x64',
+ ],
+ },
+ 'VCLibrarianTool':
+ {
+ 'AdditionalLibraryDirectories':
+ [
+ '<(windows_sdk_path)/Lib/win8/um/x64',
+ ],
+ },
+ },
+ }, # x64_Base
+
+ # Concrete configurations
+ 'Debug':
+ {
+ 'inherit_from': ['Common_Base', 'x86_Base', 'Debug_Base'],
},
- 'defines': [
- '_DEBUG',
- ],
- 'cflags': [
- '-O>(debug_optimize)',
- '-g',
+ 'Release':
+ {
+ 'inherit_from': ['Common_Base', 'x86_Base', 'Release_Base'],
+ },
+ 'conditions':
+ [
+ [ 'OS == "win" and MSVS_VERSION != "2010e" and MSVS_VERSION != "2012e"',
+ {
+ 'Debug_x64':
+ {
+ 'inherit_from': ['Common_Base', 'x64_Base', 'Debug_Base'],
+ },
+ 'Release_x64':
+ {
+ 'inherit_from': ['Common_Base', 'x64_Base', 'Release_Base'],
+ },
+ }],
],
- }
+ }, # configurations
+ }, # target_defaults
+ 'conditions':
+ [
+ ['OS == "win"',
+ {
+ 'target_defaults':
+ {
+ 'msvs_cygwin_dirs': ['../third_party/cygwin'],
+ },
},
- },
- }],
- ['angle_code==1', {
- 'target_defaults': {
- 'conditions': [
- ['OS=="mac"', {
- 'xcode_settings': {
- 'WARNING_CFLAGS': ['<@(gcc_or_clang_warnings)']
+ { # OS != win
+ 'target_defaults':
+ {
+ 'cflags': [ '-fPIC' ],
},
- }],
- ['OS!="win" and OS!="mac"', {
- 'cflags': ['<@(gcc_or_clang_warnings)']
- }],
- ]
- }
- }],
- ],
+ }],
+ ['OS != "win" and OS != "mac"',
+ {
+ 'target_defaults':
+ {
+ 'cflags':
+ [
+ '-pthread',
+ '-fno-exceptions',
+ ],
+ 'ldflags':
+ [
+ '-pthread',
+ ],
+ 'configurations':
+ {
+ 'Debug':
+ {
+ 'variables':
+ {
+ 'debug_optimize%': '0',
+ },
+ 'defines':
+ [
+ '_DEBUG',
+ ],
+ 'cflags':
+ [
+ '-O>(debug_optimize)',
+ '-g',
+ ],
+ }
+ },
+ },
+ }],
+ ['angle_code==1',
+ {
+ 'target_defaults':
+ {
+ 'conditions':
+ [
+ ['OS == "mac"',
+ {
+ 'xcode_settings':
+ {
+ 'WARNING_CFLAGS': ['<@(gcc_or_clang_warnings)']
+ },
+ }],
+ ['OS != "win" and OS != "mac"',
+ {
+ 'cflags': ['<@(gcc_or_clang_warnings)']
+ }],
+ ]
+ }
+ }],
+ ],
}
-
-# Local Variables:
-# tab-width:2
-# indent-tabs-mode:nil
-# End:
-# vim: set expandtab tabstop=2 shiftwidth=2:
diff --git a/chromium/third_party/angle/build/common_defines.gypi b/chromium/third_party/angle/build/common_defines.gypi
new file mode 100644
index 00000000000..4b6f347879b
--- /dev/null
+++ b/chromium/third_party/angle/build/common_defines.gypi
@@ -0,0 +1,114 @@
+# Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'variables':
+ {
+ 'component%': 'static_library',
+ 'angle_path%': '..',
+ 'windows_sdk_path%': 'C:/Program Files (x86)/Windows Kits/8.0',
+ },
+ 'defines':
+ [
+ 'NOMINMAX',
+ ],
+ 'msvs_disabled_warnings': [ 4100, 4127, 4239, 4244, 4245, 4512, 4702, 4530, 4718, 4267 ],
+ 'msvs_system_include_dirs':
+ [
+ '<(windows_sdk_path)/Include/shared',
+ '<(windows_sdk_path)/Include/um',
+ ],
+ 'msvs_settings':
+ {
+ 'VCCLCompilerTool':
+ {
+ 'PreprocessorDefinitions':
+ [
+ '_CRT_SECURE_NO_DEPRECATE',
+ '_SCL_SECURE_NO_WARNINGS',
+ '_HAS_EXCEPTIONS=0',
+ '_WINDOWS',
+ 'WIN32',
+ 'WIN32_LEAN_AND_MEAN',
+ ],
+ },
+ 'VCLinkerTool':
+ {
+ 'AdditionalDependencies':
+ [
+ 'kernel32.lib',
+ 'gdi32.lib',
+ 'winspool.lib',
+ 'comdlg32.lib',
+ 'advapi32.lib',
+ 'shell32.lib',
+ 'ole32.lib',
+ 'oleaut32.lib',
+ 'user32.lib',
+ 'uuid.lib',
+ 'odbc32.lib',
+ 'odbccp32.lib',
+ 'delayimp.lib',
+ ],
+ },
+ },
+ 'configurations':
+ {
+ 'Debug':
+ {
+ 'msvs_settings':
+ {
+ 'VCLinkerTool':
+ {
+ 'AdditionalLibraryDirectories':
+ [
+ '<(windows_sdk_path)/Lib/win8/um/x86',
+ ],
+ },
+ 'VCLibrarianTool':
+ {
+ 'AdditionalLibraryDirectories':
+ [
+ '<(windows_sdk_path)/Lib/win8/um/x86',
+ ],
+ },
+ },
+ 'defines':
+ [
+ '_DEBUG'
+ ],
+ },
+ 'Release':
+ {
+ 'msvs_settings':
+ {
+ 'VCLinkerTool':
+ {
+ 'AdditionalLibraryDirectories':
+ [
+ '<(windows_sdk_path)/Lib/win8/um/x86',
+ ],
+ },
+ 'VCLibrarianTool':
+ {
+ 'AdditionalLibraryDirectories':
+ [
+ '<(windows_sdk_path)/Lib/win8/um/x86',
+ ],
+ },
+ },
+ 'defines':
+ [
+ 'NDEBUG'
+ ],
+ },
+ },
+ 'conditions':
+ [
+ ['component=="shared_library"',
+ {
+ 'defines': [ 'COMPONENT_BUILD' ],
+ }],
+ ],
+}
diff --git a/chromium/third_party/angle/build/gyp_angle b/chromium/third_party/angle/build/gyp_angle
index 6533d367cd4..262b6162290 100644
--- a/chromium/third_party/angle/build/gyp_angle
+++ b/chromium/third_party/angle/build/gyp_angle
@@ -17,17 +17,18 @@ sys.path.append(os.path.join(angle_dir, 'third_party', 'gyp', 'pylib'))
import gyp
if __name__ == '__main__':
- args = sys.argv[1:]
-
- print 'Updating projects from gyp files...'
- sys.stdout.flush()
-
- # Set the depth to get the top-level Makefile generated into the
- # correct directory. This only has an effect on Linux.
- args.append('--depth');
- args.append('.');
- # Add common.gypi to the include path.
- args.append('-I' + os.path.join(script_dir, 'common.gypi'))
- # Add all.gyp as the main gyp file to be generated.
- args.append(os.path.join(script_dir, 'all.gyp'))
- sys.exit(gyp.main(args))
+ args = sys.argv[1:]
+
+ print 'Updating projects from gyp files...'
+ sys.stdout.flush()
+
+ # Set the depth to get the top-level Makefile generated into the
+ # correct directory. This only has an effect on Linux.
+ args.append('--depth');
+ args.append('.');
+ # Add common.gypi to the include path.
+ args.append('-I' + os.path.join(script_dir, 'common.gypi'))
+ args.append('--no-parallel')
+ # Add all.gyp as the main gyp file to be generated.
+ args.append(os.path.join(script_dir, 'all.gyp'))
+ sys.exit(gyp.main(args))
diff --git a/chromium/third_party/angle/codereview.settings b/chromium/third_party/angle/codereview.settings
index 6b8615de1f3..d7c8d395cbe 100644
--- a/chromium/third_party/angle/codereview.settings
+++ b/chromium/third_party/angle/codereview.settings
@@ -1,4 +1,4 @@
# This file is used by gcl to get repository specific information.
-CODE_REVIEW_SERVER: codereview.appspot.com
-CC_LIST: angleproject-review@googlegroups.com
-VIEW_VC: http://code.google.com/p/angleproject/source/detail?r=
+GERRIT_HOST: chromium-review.googlesource.com
+GERRIT_PORT: 29418
+CODE_REVIEW_SERVER: chromium-review.googlesource.com
diff --git a/chromium/third_party/angle/enumerate_files.py b/chromium/third_party/angle/enumerate_files.py
new file mode 100644
index 00000000000..06ebf9d4440
--- /dev/null
+++ b/chromium/third_party/angle/enumerate_files.py
@@ -0,0 +1,62 @@
+import fnmatch
+import os
+import sys
+
+dirs = [ ]
+types = [ ]
+excludes = [ ]
+files = [ ]
+
+# Default to accepting a list of directories first
+curArray = dirs
+
+# Iterate over the arguments and add them to the arrays
+for i in range(1, len(sys.argv)):
+ arg = sys.argv[i]
+
+ if arg == "-dirs":
+ curArray = dirs
+ continue
+
+ if arg == "-types":
+ curArray = types
+ continue
+
+ if arg == "-excludes":
+ curArray = excludes
+ continue
+
+ curArray.append(arg)
+
+# If no directories were specified, use the current directory
+if len(dirs) == 0:
+ dirs.append(".")
+
+# If no types were specified, accept all types
+if len(types) == 0:
+ types.append("*")
+
+# Walk the directories listed and compare with type and exclude lists
+for rootdir in dirs:
+ for root, dirnames, filenames in os.walk(rootdir):
+ for file in filenames:
+ # Skip files that are "hidden"
+ if file.startswith("."):
+ continue;
+
+ fullPath = os.path.join(root, file).replace("\\", "/")
+ for type in types:
+ if fnmatch.fnmatchcase(fullPath, type):
+ excluded = False
+ for exclude in excludes:
+ if fnmatch.fnmatchcase(fullPath, exclude):
+ excluded = True
+ break
+
+ if not excluded:
+ files.append(fullPath)
+ break
+
+files.sort()
+for file in files:
+ print file
diff --git a/chromium/third_party/angle/extensions/ANGLE_platform_angle_d3d.txt b/chromium/third_party/angle/extensions/ANGLE_platform_angle_d3d.txt
new file mode 100644
index 00000000000..019150fe228
--- /dev/null
+++ b/chromium/third_party/angle/extensions/ANGLE_platform_angle_d3d.txt
@@ -0,0 +1,112 @@
+
+Name
+
+ ANGLE_platform_angle_d3d
+
+Name Strings
+
+ EGL_ANGLE_platform_angle_d3d
+
+Contributors
+
+ Scott Graham, Google
+ Shannon Woods, Google
+
+Contacts
+
+ Scott Graham, Google (scottmg 'at' google 'dot' com)
+
+Status
+
+ Draft
+
+Version
+
+ Version 1, 2014-02-04
+
+Number
+
+ EGL Extension XXX
+
+Extension Type
+
+ EGL client extension
+
+Dependencies
+
+ Requires EGL_EXT_client_extensions to query its existence without
+ a display.
+
+ Requires EGL_EXT_platform_base.
+
+ This extension is written against the wording of version 9 of the
+ EGL_EXT_platform_base specification.
+
+Overview
+
+ This extension defines how to create EGL resources from resources using
+ the functions defined by EGL_EXT_platform_base.
+
+New Types
+
+ None
+
+New Procedures and Functions
+
+ None
+
+New Tokens
+
+ Accepted as the <platform> argument of eglGetPlatformDisplayEXT:
+
+ EGL_PLATFORM_ANGLE_D3D_ANGLE 0x3201
+
+ Accepted as an attribute name in the <attrib_list> argument of
+ eglGetPlatformDisplayEXT:
+
+ EGL_PLATFORM_ANGLE_D3D_TYPE_ANGLE 0x3202
+
+ Accepted as values for the EGL_PLATFORM_ANGLE_D3D_TYPE_ANGLE attribute:
+
+ EGL_PLATFORM_ANGLE_D3D_TYPE_D3D9_ANGLE 0x3203
+ EGL_PLATFORM_ANGLE_D3D_TYPE_D3D11_ANGLE 0x3204
+ EGL_PLATFORM_ANGLE_D3D_TYPE_D3D11_WARP_ANGLE 0x3205
+
+Additions to the EGL Specification
+
+ None.
+
+New Behavior
+
+ To determine if the EGL implementation supports this extension, clients
+ should query the EGL_EXTENSIONS string of EGL_NO_DISPLAY.
+
+ To obtain an EGLDisplay backed by a ANGLE D3D display, call
+ eglGetPlatformDisplayEXT with <platform> set to
+ EGL_PLATFORM_ANGLE_D3D_ANGLE.
+
+ The <native_display> parameter is of type EGLNativeDisplayType. If
+ <native_display> is EGL_DEFAULT_DISPLAY a default display is returned.
+ Multiple calls with the same <native_display> will return the same
+ EGLDisplay handle. The value of EGL_PLATFORM_ANGLE_D3D_TYPE_ANGLE, if any,
+ is ignored if there was previously a EGLDisplay successfully created for a
+ given value of EGLNativeDisplayType.
+
+ If no <attrib_list> is specified, a D3D9 device is created. Otherwise, the
+ value of EGL_PLATFORM_ANGLE_D3D_TYPE_ANGLE should be:
+ - EGL_PLATFORM_ANGLE_D3D_TYPE_D3D9_ANGLE for D3D9 hardware,
+ - EGL_PLATFORM_ANGLE_D3D_TYPE_D3D11_ANGLE for D3D11 hardware,
+ - EGL_PLATFORM_ANGLE_D3D_TYPE_D3D11_WARP_ANGLE for D3D11 WARP.
+
+ If no display matching the requested <native_display> or of the type
+ requested by the value of EGL_PLATFORM_ANGLE_D3D_TYPE_ANGLE is available,
+ EGL_NO_DISPLAY is returned. No error condition is raised in this case.
+
+Issues
+
+ None
+
+Revision History
+
+ Version 1, 2014-02-04 (Scott Graham)
+ - Initial draft
diff --git a/chromium/third_party/angle/extensions/EGL_ANGLE_window_fixed_size.txt b/chromium/third_party/angle/extensions/EGL_ANGLE_window_fixed_size.txt
new file mode 100644
index 00000000000..e4c1ac32c0d
--- /dev/null
+++ b/chromium/third_party/angle/extensions/EGL_ANGLE_window_fixed_size.txt
@@ -0,0 +1,136 @@
+Name
+
+ ANGLE_window_fixed_size
+
+Name Strings
+
+ EGL_ANGLE_window_fixed_size
+
+Contributors
+
+ John Bauman
+ Shannon Woods
+
+Contacts
+
+ John Bauman, Google Inc. (jbauman 'at' google.com)
+
+Status
+
+ Complete
+
+Version
+
+ Version 4, February 24, 2014
+
+Number
+
+ EGL Extension #??
+
+Dependencies
+
+ This extension is written against the wording of the EGL 1.4
+ Specification.
+
+Overview
+
+ This extension allows creating a window surface with a fixed size that is
+ specified when it is created.
+
+New Types
+
+ None
+
+New Procedures and Functions
+
+ None
+
+New Tokens
+
+ Accepted by the <attribute> parameter of eglQuerySurface and by the
+ <attrib_list> parameter of eglCreateWindowSurface:
+
+ EGL_FIXED_SIZE_ANGLE 0x3201
+
+Additions to Chapter 3 of the EGL 1.4 Specification:
+
+ Modify the third paragraph of Section 3.5.1 (Creating On-Screen Rendering Surfaces)
+
+ "<attrib_list> specifies a list of attributes for the window. The list has
+ the same structure as described for eglChooseConfig. Attributes that can
+ be specified in <attrib_list> include EGL_RENDER_BUFFER,
+ EGL_VG_COLORSPACE, EGL_VG_ALPHA_FORMAT, EGL_FIXED_SIZE_ANGLE, EGL_WIDTH,
+ and EGL_HEIGHT."
+
+ Add before the last paragraph of Section 3.5.1
+
+ "EGL_FIXED_SIZE_ANGLE specifies whether the surface must be resized by the
+ implementation when the native window is resized. The default value is
+ EGL_FALSE. Its value can be EGL_TRUE, in which case the size must be
+ specified when the window is created, or EGL_FALSE, in which case the size
+ is taken from the native window. Its default value is EGL_FALSE.
+
+ If the value of EGL_FIXED_SIZE_ANGLE is EGL_TRUE, the window surface's
+ size in pixels is specified by the EGL_WIDTH and EGL_HEIGHT attributes,
+ and will not change throughout the lifetime of the surface. If its value
+ is EGL_FALSE, then the values of EGL_WIDTH and EGL_HEIGHT are ignored and
+ the window surface must be resized by the implementation subsequent to the
+ native window being resized, and prior to copying its contents to the
+ native window (e.g. in eglSwapBuffers, as described in section 3.9.1.1).
+ The default values for EGL_WIDTH and EGL_HEIGHT are zero. If the value
+ specified for either of EGL_WIDTH or EGL_HEIGHT is less than zero then an
+ EGL_BAD_PARAMETER error is generated."
+
+ Add the following entry to Table 3.5
+ (Queryable surface attributes and types)
+
+ Attribute Type Description
+ -------------------- ------- ---------------------------------------------
+ EGL_FIXED_SIZE_ANGLE boolean Surface will not be resized with a native
+ window
+
+ Replace the last paragraph on page 37 in Section 3.5.6 (Surface Attributes)
+
+ "Querying EGL_WIDTH and EGL_HEIGHT returns respectively the width and
+ height, in pixels, of the surface. For a pixmap surface or window surface
+ with EGL_FIXED_SIZE_ANGLE set to EGL_FALSE, these values are initially
+ equal to the width and height of the native window or pixmap with respect
+ to which the surface was created. If the native window is resized and the
+ corresponding window surface is not fixed size, the corresponding window
+ surface will eventually be resized by the implementation to match (as
+ discussed in section 3.9.1). If there is a discrepancy because EGL has not
+ yet resized the window surface, the size returned by eglQuerySurface will
+ always be that of the EGL surface, not the corresponding native window."
+
+ Add the following paragraph to Section 3.5.6 (Surface Attributes)
+
+ "Querying EGL_FIXED_SIZE_ANGLE returns EGL_FALSE if the surface will be
+ resized to match a native window, and EGL_TRUE if the surface cannot be
+ resized."
+
+ Alter the beginning of the first paragraph of Section 3.9.1.1 (Native
+ Window Resizing)
+
+ "If <surface> does not have EGL_FIXED_SIZE_ANGLE set and the native window
+ corresponding to <surface> has been resized prior to the swap, <surface>
+ must be resized to match."
+
+Issues
+
+ 1. Should there be a way to resize a window surface that had its size
+ specified initially.
+
+ RESOLVED: No. Surfaces that have their sizes specified initially must have
+ EGL_FIXED_SIZE_ANGLE set and can never be resized.
+
+Revision History
+
+ Version 4, 2014/02/24 - formatting changes.
+
+ Version 3, 2014/02/12 - ignore EGL_WIDTH and EGL_HEIGHT if
+ EGL_FIXED_SIZE_ANGLE is EGL_FALSE
+
+ Version 2, 2014/02/07 - rename to EGL_ANGLE_window_fixed_size, and add an
+ EGL_FIXED_SIZE_ANGLE token.
+
+ Version 1, 2014/02/05 - first draft.
diff --git a/chromium/third_party/angle/extensions/EXT_blend_minmax.txt b/chromium/third_party/angle/extensions/EXT_blend_minmax.txt
new file mode 100644
index 00000000000..522ac202233
--- /dev/null
+++ b/chromium/third_party/angle/extensions/EXT_blend_minmax.txt
@@ -0,0 +1,164 @@
+Name
+
+ EXT_blend_minmax
+
+Name Strings
+
+ GL_EXT_blend_minmax
+
+Version
+
+ Last Modified Date: September 17, 2009
+ Version: 1.5
+
+Number
+
+ OpenGL Extension #37
+ OpenGL ES Extension #65
+
+Dependencies
+
+ There is an interaction with OpenGL ES.
+
+Overview
+
+ Blending capability is extended by respecifying the entire blend
+ equation. While this document defines only two new equations, the
+ BlendEquationEXT procedure that it defines will be used by subsequent
+ extensions to define additional blending equations.
+
+ The two new equations defined by this extension produce the minimum
+ (or maximum) color components of the source and destination colors.
+ Taking the maximum is useful for applications such as maximum projection
+ in medical imaging.
+
+Issues
+
+ * I've prefixed the ADD token with FUNC, to indicate that the blend
+ equation includes the parameters specified by BlendFunc. (The min
+ and max equations don't.) Is this necessary? Is it too ugly?
+ Is there a better way to accomplish the same thing?
+
+New Procedures and Functions
+
+ void BlendEquationEXT(enum mode);
+
+New Tokens
+
+ Accepted by the <mode> parameter of BlendEquationEXT:
+
+ FUNC_ADD_EXT 0x8006
+ MIN_EXT 0x8007
+ MAX_EXT 0x8008
+
+ Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
+ GetFloatv, and GetDoublev:
+
+ BLEND_EQUATION_EXT 0x8009
+
+Additions to Chapter 2 of the GL Specification (OpenGL Operation)
+
+ None
+
+Additions to Chapter 3 of the GL Specification (Rasterization)
+
+ None
+
+Additions to Chapter 4 of the GL Specification (Per-Fragment Operations
+and the Framebuffer)
+
+ The GL Specification defines a single blending equation. This
+ extension introduces a blend equation mode that is specified by calling
+ BlendEquationEXT with one of three enumerated values. The default
+ value FUNC_ADD_EXT specifies that the blending equation defined in
+ the GL Specification be used. This equation is
+
+ C' = (Cs * S) + (Cd * D)
+
+ / 1.0 C' > 1.0
+ C = (
+ \ C' C' <= 1.0
+
+ where Cs and Cd are the source and destination colors, and S and D are
+ as specified by BlendFunc.
+
+ If BlendEquationEXT is called with <mode> set to MIN_EXT, the
+ blending equation becomes
+
+ C = min (Cs, Cd)
+
+ Finally, if BlendEquationEXT is called with <mode> set to MAX_EXT, the
+ blending equation becomes
+
+ C = max (Cs, Cd)
+
+ In all cases the blending equation is evaluated separately for each
+ color component.
+
+Additions to Chapter 5 of the GL Specification (Special Functions)
+
+ None
+
+Additions to Chapter 6 of the GL Specification (State and State Requests)
+
+ None
+
+Additions to the GLX Specification
+
+ None
+
+GLX Protocol
+
+ A new GL rendering command is added. The following command is sent to the
+ server as part of a glXRender request:
+
+ BlendEquationEXT
+ 2 8 rendering command length
+ 2 4097 rendering command opcode
+ 4 ENUM mode
+
+Dependencies on OpenGL ES
+
+ If the GL is OpenGL ES, only the new MIN_EXT and MAX_EXT blend equations
+ are introduced by this extension. BlendEquationOES, FUNC_ADD_OES, and
+ BLEND_EQUATION_OES are introduced by the OES_blend_subtract extension,
+ which is required for this extension to operate. Alternatively,
+ OpenGL ES 2.0 is required, which introduces BlendEquation, FUNC_ADD, and
+ BLEND_EQUATION without the suffixes.
+
+ MIN_EXT and MAX_EXT should be added to Table 4.blendeq described in the
+ OES_blend_subtract extension specification, and Table 4.1 of the OpenGL
+ ES 2.0 specification.
+
+ Mentions of GetDoublev, Begin/End, and GLX in this extension specification
+ can be ignored for OpenGL ES. Also, BlendEquationEXT and FUNC_ADD_EXT
+ instead have the OES suffix courtesy of OES_blend_subtract, or no suffix
+ courtesy of core OpenGL ES 2.0.
+
+Errors
+
+ INVALID_ENUM is generated by BlendEquationEXT if its single parameter
+ is not FUNC_ADD_EXT, MIN_EXT, or MAX_EXT.
+
+ INVALID_OPERATION is generated if BlendEquationEXT is executed between
+ the execution of Begin and the corresponding execution to End.
+
+New State
+
+ Get Value Get Command Type Initial Value Attribute
+ --------- ----------- ---- ------------- ---------
+ BLEND_EQUATION_EXT GetIntegerv Z3 FUNC_ADD_EXT color-buffer
+
+New Implementation Dependent State
+
+ None
+
+Revision History
+
+ Version 1.5, September 17, 2009 (Jon Leech) -
+ Merge into OpenGL Registry version of the extension and assign
+ OpenGL ES extension number.
+ Version 1.4, May 19, 2009 (Benj Lipchak) -
+ Adapted for OpenGL ES.
+ Version 1.3, May 31, 1995 -
+ Last SGI revision.
diff --git a/chromium/third_party/angle/extensions/EXT_color_buffer_float.txt b/chromium/third_party/angle/extensions/EXT_color_buffer_float.txt
new file mode 100644
index 00000000000..2eb163dba15
--- /dev/null
+++ b/chromium/third_party/angle/extensions/EXT_color_buffer_float.txt
@@ -0,0 +1,230 @@
+Name
+
+ EXT_color_buffer_float
+
+Name Strings
+
+ GL_EXT_color_buffer_float
+
+Contributors
+
+ OpenGL ES Working Group members
+
+Contact
+
+ Mark Callow, HI Corp. (callow.mark 'at' artspark.co.jp)
+
+Notice
+
+ ©2012 The Khronos Group Inc.
+
+Status
+
+ Complete
+
+IP Status
+
+ Graphics Properties Holdings (GPH, formerly SGI) owns US Patent
+ #6,650,327, issued November 18, 2003. GPH believes this patent
+ contains necessary IP for graphics systems implementing floating
+ point (FP) rasterization and FP framebuffer capabilities.
+
+ GPH will not grant Khronos royalty-free use of this IP for use
+ in OpenGL ES, but will discuss licensing on RAND terms, on an
+ individual basis with companies wishing to use this IP in the
+ context of conformant OpenGL ES implementations. GPH does not
+ plan to make any special exemption for open source
+ implementations.
+
+ See
+ https://www.khronos.org/files/ip-disclosures/opengl/SGI%20IP%20Disclosure%20Mar05_clean.pdf
+ for the full disclosure.
+
+Version
+
+ Date: January 11th, 2013
+ Revision: 5
+
+Number
+
+ OpenGL ES Extension #137
+
+Dependencies
+
+ Requires OpenGL ES 3.0.
+
+ Written based on the wording of the OpenGL ES 3.0.1 Specification
+ (January 10th, 2013).
+
+Overview
+
+ This extension allows a variety of floating point formats to be
+ rendered to via framebuffer objects.
+
+New Procedures and Functions
+
+ None
+
+New Tokens
+
+ None
+
+Additions to Chapter 3 of the OpenGL ES 3.0 Specification
+(Rasterization)
+
+ 3.8.3 Texture Image Specification, unnumbered subsection "Required
+ Texture Formats", p. 126
+
+ Change the first two bullet items to the following:
+
+ - Texture and renderbuffer color formats (see section 4.4.2).
+ - RGBA32F, RGBA32I, RGBA32UI, RGBA16F, RGBA16I, RGBA16UI,
+ RGBA8, RGBA8I, RGBA8UI, SRGB8_ALPHA8, RGB10_A2, RGB10_-
+ A2UI, RGBA4, and RGB5_A1.
+ - RGB8 and RGB565.
+ - R11F G11F B10F.
+ - RG32F, RG32I, RG32UI, RG16F, RG16I, RG16UI, RG8, RG8I, and
+ RG8UI.
+ - R32F, R32I, R32UI, R16F, R16I, R16UI, R8, R8I, and R8UI.
+
+ - Texture-only color formats:
+ - RGBA8_SNORM.
+ - RGB32F, RGB32I, and RGB32UI.
+ - RGB16F, RGB16I, and RGB16UI.
+ - RGB8_SNORM, RGB8I, RGB8UI, and SRGB8.
+ - RGB9_E5.
+ - RG8_SNORM.
+ - R8_SNORM.
+
+ Table 3.12, p. 128 & 129
+
+ Convert the dash under 'Color-renderable' to a 'check' for the
+ following internal formats: R16F, RG16F, RGBA16F, R32F, RG32F,
+ RGBA32F and R11F_G11F_B10F.
+
+Additions to Chapter 4 of the OpenGL ES 3.0 Specification (Per-Fragment
+Operations and the Framebuffer)
+
+ (changed lines marked with *; added lines marked with +)
+
+ Chapter 4 Introduction, p. 167
+
+ Paragraph 5, sentence 3, p 168, insert "floating point" as shown:
+ "R, G, B, and A components may be represented as unsigned
+ * normalized fixed-point, floating point or signed or unsigned
+ integer values; ..." ^^^^^^^^^^^^^^
+
+ 4.1.7 Blending, p. 174
+
+ Modify paragraphs 3 & 4:
+
+ * "If the color buffer is fixed-point, the components of the
+ source and destination values and blend factors are clamped
+ * to [0; 1] prior to evaluating the blend equation. If the color
+ + buffer is floating-point, no clamping occurs. The resulting four
+ + values are sent to the next operation.
+
+ Blending applies only if the color buffer has a fixed-point or
+ * or floating-point format. If the color buffer has an integer
+ * format, proceed to the next operation. Furthermore, an
+ + INVALID_OPERATION error is generated by DrawArrays and the other
+ + drawing commands defined in section 2.8.3 if blending is enabled
+ + (see below) and any draw buffer has a 32-bit floating-point
+ + format."
+
+ 4.2.3 Clearing the Buffers, p. 183
+
+ Modify second paragraph, inserting "floating point":
+
+ " void ClearColor(float r, float g, float b, float a);
+
+ * sets the clear value for fixed- and floating-point color buffers.
+ ..." ^^^^^^^^^^^^^^^^^^
+
+ 4.3.1 Reading Pixels, p. 186
+
+ In paragraph 4, beginning "Only two combinations of format
+ and type are accepted ...", after the sentence ending "... type
+ UNSIGNED_BYTE is accepted." insert the following sentence:
+ "For floating-point rendering surfaces, the combination
+ format RGBA and type FLOAT is accepted."
+
+ 4.3.1 unnumbered subsection "Obtaining Pixels from the Framebuffer",
+ p. 188
+
+ Modify penultimate paragraph, p189, "If format is an integer ..."
+
+ "If format is an integer format and the color buffer is not an
+ integer format; if the color buffer is an integer format and
+ * format is not an integer format; if format is an integer format
+ * and type is FLOAT, HALF_FLOAT, or UNSIGNED_INT_10F_11F_11F_REV;
+ + or if the color buffer is a floating-point format and type is
+ + not FLOAT, HALF FLOAT, or UNSIGNED_INT_10F_11F_11F_REV, the error
+ INVALID_OPERATION occurs."
+
+ 4.3.1 unnumbered subsection "Conversion of RGBA values", p.190
+
+ Sole paragraph, sentence 3, insert "or floating point" as shown:
+ * "For an integer or floating point color buffer, the elements
+ are unmodified."^^^^^^^^^^^^^^^^^
+
+ 4.3.2 Copying Pixels, p192
+
+ Modify first error condition, at bottom of p193, "The read buffer
+ contains ..." to encompass floating-point buffers.
+
+ * "- The read buffer contains fixed-point or floating-point values
+ * and any draw buffer contains neither fixed-point nor
+ * floating-point values."
+
+ 4.4.2 Attaching Images to Framebuffer Objects, p. 197, unnumbered
+ subsection "Required Renderbuffer Formats", p. 200
+
+ In the last paragraph beginning "Implementations must support
+ creation ...", modify the final phrase to
+
+ * "with the exception of signed and unsigned integer, RGBA16F,
+ + R32F, RG32F and RGBA32F formats.
+
+Additions to Chapter 5 of the OpenGL ES 2.0 Specification (Special Functions)
+
+ None
+
+Additions to Chapter 6 of the OpenGL ES 2.0 Specification (State and State
+Requests)
+
+ 6.1.15 Internal Format Queries, p. 237
+
+ P. 238, paragraph 8 after "Since multisampling is not supported
+ for signed and unsigned integer internal formats, the value of
+ NUM_SAMPLE_COUNTS will be zero for such formats.", insert new
+ one-sentence paragraph:
+
+ "If <internalformat> is RGBA16F, R32F, RG32F, or RGBA32F, the
+ value of NUM_SAMPLE_COUNTS may be zero, or else the maximum
+ value in SAMPLES may be less than the value of MAX_SAMPLES."
+
+New Implementation Dependent State
+
+ None
+
+Issues
+
+Revision History
+
+ Rev. Date Author Changes
+ ---- -------- --------- -----------------------------------------
+ 1 10/16/12 markc Initial version
+ 2 10/18/12 markc Referenced preliminary version of OpenGL
+ ES 3.0.1 specification and updated page
+ numbers.
+ 3 11/21/12 markc Corrected IP status.
+ 4 01/09/13 markc Changed date of referenced OpenGL ES
+ 3.0.1 specification. Made minor language
+ simplification.
+ 5 01/11/13 markc Changed date to release version of
+ OpenGL ES 3.0.1 specification.
+ Clarified change to "Required
+ renderbuffer formats" section.
+
+# vim:ai:ts=4:sts=4:sw=4:expandtab:textwidth=70
diff --git a/chromium/third_party/angle/extensions/EXT_texture_rg.txt b/chromium/third_party/angle/extensions/EXT_texture_rg.txt
new file mode 100644
index 00000000000..968b28d1003
--- /dev/null
+++ b/chromium/third_party/angle/extensions/EXT_texture_rg.txt
@@ -0,0 +1,195 @@
+Name
+
+ EXT_texture_rg
+
+Name Strings
+
+ GL_EXT_texture_rg
+
+Contributors
+
+ Contributors to ARB_texture_rg, on which this extension is based
+ Kyle Haughey
+ Richard Schreyer
+
+Contact
+
+ Benj Lipchak, Apple (lipchak 'at' apple.com)
+
+Status
+
+ Complete
+
+Version
+
+ Date: July 22, 2011
+ Revision: 3
+
+Number
+
+ OpenGL ES Extension #103
+
+Dependencies
+
+ Requires OpenGL ES 2.0.
+
+ Written based on the wording of the OpenGL ES 2.0.25 Full Specification
+ (November 2, 2010).
+
+ OES_texture_float affects the definition of this extension.
+
+ OES_texture_half_float affects the definition of this extension.
+
+ APPLE_framebuffer_multisample affects the definition of this extension.
+
+Overview
+
+ Historically one- and two-component textures have been specified in OpenGL
+ ES using the luminance or luminance-alpha (L/LA) formats. With the advent
+ of programmable shaders and render-to-texture capabilities these legacy
+ formats carry some historical artifacts which are no longer useful.
+
+ For example, when sampling from such textures, the luminance values are
+ replicated across the color components. This is no longer necessary with
+ programmable shaders.
+
+ It is also desirable to be able to render to one- and two-component format
+ textures using capabilities such as framebuffer objects (FBO), but
+ rendering to L/LA formats is under-specified (specifically how to map
+ R/G/B/A values to L/A texture channels).
+
+ This extension adds new base internal formats for one-component RED and
+ two-component RG (red green) textures as well as sized RED and RG internal
+ formats for renderbuffers. The RED and RG texture formats can be used for
+ both texturing and rendering into with framebuffer objects.
+
+New Procedures and Functions
+
+ None
+
+New Tokens
+
+ Accepted by the <internalformat> parameter of TexImage2D and CopyTexImage2D,
+ and the <format> parameter of TexImage2D, TexSubImage2D, and ReadPixels:
+
+ RED_EXT 0x1903
+ RG_EXT 0x8227
+
+ Accepted by the <internalformat> parameter of RenderbufferStorage and
+ RenderbufferStorageMultisampleAPPLE:
+
+ R8_EXT 0x8229
+ RG8_EXT 0x822B
+
+Additions to Chapter 2 of the OpenGL ES 2.0 Specification (OpenGL ES Operation)
+
+ None
+
+Additions to Chapter 3 of the OpenGL ES 2.0 Specification (Rasterization)
+
+ (Add the following to Table 3.3: "TexImage2D and ReadPixels formats")
+
+ Format Name Element Meaning and Order Target Buffer
+ ----------- ------------------------- -------------
+ RED_EXT R Color
+ RG_EXT R, G Color
+
+ (Add the following to Table 3.4: "Valid pixel format and type combinations")
+ (as modified by OES_texture_float and OES_texture_half_float)
+
+ Format Type Bytes per Pixel
+ ----------- ------------------------- ---------------
+ RED_EXT FLOAT 4
+ RED_EXT HALF_FLOAT_OES 2
+ RED_EXT UNSIGNED_BYTE 1
+ RG_EXT FLOAT 8
+ RG_EXT HALF_FLOAT_OES 4
+ RG_EXT UNSIGNED_BYTE 2
+
+ (Add the following to Table 3.8: "Conversion from RGBA and depth pixel
+ components to internal texture")
+
+ Base Internal Format RGBA Internal Components
+ -------------------- ------ -------------------
+ RED_EXT R R
+ RG_EXT R,G R,G
+
+ (Modify Table 3.9: "CopyTexImage internal format/color buffer combinations")
+
+ Texture Format
+ Color Buffer A L LA R RG RGB RGBA
+ ------------ - - -- - -- --- ----
+ A X
+ R X X
+ RG X X X
+ RGB X X X X
+ RGBA X X X X X X X
+
+ (Add the following to Table 3.12: "Correspondence of filtered texture
+ components to texture source color components")
+
+ Texture Base Texture source color
+ Internal Format C_s A_s
+ --------------- ------------- ------
+ RED_EXT (R_t, 0, 0) 1
+ RG_EXT (R_t, G_t, 0) 1
+
+Additions to Chapter 4 of the OpenGL ES 2.0 Specification (Per-Fragment
+Operations and the Framebuffer)
+
+ In section 4.3.1 "Reading Pixels", subsection "Obtaining Pixels from the
+ Framebuffer", modify the last sentence to read:
+
+ "If the framebuffer does not support G, B, or A values then the G, B, and A
+ values that are obtained are 0.0, 0.0, and 1.0 respectively."
+
+ In section 4.4.5 "Framebuffer Completeness", modify the last sentence of
+ the second paragraph to read:
+
+ "Color-renderable formats contain red, and possibly green, blue, and alpha
+ components; depth-renderable formats contain depth components; and
+ stencil-renderable formats contain stencil components."
+
+ (Add the following to Table 4.5: "Renderbuffer image formats, showing their
+ renderable type (color-, depth-, or stencil-renderable) and the number of
+ bits each format contains for color (R, G, B, A), depth (D), and stencil
+ (S) components")
+
+ Sized Internal Renderable Type R bits G bits B bits A bits D bits S bits
+ Format
+ -------------- ---------------- ------ ------ ------ ------ ------ ------
+ R8_EXT color-renderable 8
+ RG8_EXT color-renderable 8 8
+
+Additions to Chapter 5 of the OpenGL ES 2.0 Specification (Special Functions)
+
+ None
+
+Additions to Chapter 6 of the OpenGL ES 2.0 Specification (State and State
+Requests)
+
+ None
+
+Dependencies on OES_texture_float
+
+ If OES_texture_float is not supported, then omit the rows of
+ Table 3.4 that have Type FLOAT.
+
+Dependencies on OES_texture_half_float
+
+ If OES_texture_half_float is not supported, then omit the rows of
+ Table 3.4 that have Type HALF_FLOAT_OES.
+
+Dependencies on APPLE_framebuffer_multisample
+
+ If APPLE_framebuffer_multisample is not supported, then all references to
+ RenderbufferStorageMultisampleAPPLE should be ignored.
+
+Revision History
+
+ #1 February 22, 2011, khaughey
+ - initial version adapted from ARB_texture_rg.
+ #2 June 16, 2011, benj
+ - add interaction with APPLE_framebuffer_multisample
+ #3 July 22, 2011, benj
+ - rename from APPLE to EXT
diff --git a/chromium/third_party/angle/generate_projects b/chromium/third_party/angle/generate_projects
new file mode 100644
index 00000000000..817527799e8
--- /dev/null
+++ b/chromium/third_party/angle/generate_projects
@@ -0,0 +1,49 @@
+#!/usr/bin/python
+
+# Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# This script regenerates the canonical visual studio project files that
+# are distributed with the ANGLE repository. It requires that depot_tools
+# is installed and gclient sync has been run to download gyp. The project
+# files are generated and then git added so they can be committed.
+
+import os
+import sys
+
+script_dir = os.path.join(os.path.dirname(__file__), 'build')
+angle_dir = os.path.normpath(os.path.join(script_dir, os.pardir))
+gyp_dir = os.path.join(angle_dir, 'third_party', 'gyp')
+
+generation_dir = "projects"
+gyp_generators = "msvs"
+msvs_version = "2010e"
+build_samples = True
+build_tests = False
+release_symbols = False
+
+if __name__ == '__main__':
+ gyp_cmd = os.path.join(gyp_dir, 'gyp')
+ gyp_cmd += ' --ignore-environment'
+ gyp_cmd += ' --depth=.'
+ gyp_cmd += ' --include=' + os.path.join(script_dir, 'common.gypi')
+ gyp_cmd += ' --generator-output=' + generation_dir
+ gyp_cmd += ' --format=' + gyp_generators
+ gyp_cmd += ' -G msvs_version=' + msvs_version
+ gyp_cmd += ' -D angle_build_tests=' + ('1' if build_tests else '0')
+ gyp_cmd += ' -D angle_build_samples=' + ('1' if build_samples else '0')
+ gyp_cmd += ' -D release_symbols=' + ('true' if release_symbols else 'false')
+ gyp_cmd += ' -D angle_use_commit_id=0'
+ gyp_cmd += ' ' + os.path.join(script_dir, 'all.gyp')
+
+ print 'Generating projects to ' + generation_dir + ' from gyp files...'
+ print gyp_cmd
+ sys.stdout.flush()
+ os.system(gyp_cmd)
+
+ git_add_cmd = 'git add ' + generation_dir + ' -u'
+ print '\nRunning git add on updated Visual Studio projects...'
+ print git_add_cmd
+ sys.stdout.flush()
+ os.system(git_add_cmd)
diff --git a/chromium/third_party/angle/include/EGL/egl.h b/chromium/third_party/angle/include/EGL/egl.h
index 99ea342a477..b55e6c640d8 100644
--- a/chromium/third_party/angle/include/EGL/egl.h
+++ b/chromium/third_party/angle/include/EGL/egl.h
@@ -1,7 +1,7 @@
/* -*- mode: c; tab-width: 8; -*- */
/* vi: set sw=4 ts=8: */
/* Reference version of egl.h for EGL 1.4.
- * $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $
+ * $Revision: 9356 $ on $Date: 2009-10-21 05:52:25 -0400 (Wed, 21 Oct 2009) $
*/
/*
diff --git a/chromium/third_party/angle/include/EGL/eglext.h b/chromium/third_party/angle/include/EGL/eglext.h
index c06d4c08505..937af4193b5 100644
--- a/chromium/third_party/angle/include/EGL/eglext.h
+++ b/chromium/third_party/angle/include/EGL/eglext.h
@@ -6,7 +6,7 @@ extern "C" {
#endif
/*
-** Copyright (c) 2007-2012 The Khronos Group Inc.
+** Copyright (c) 2007-2013 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
@@ -34,8 +34,8 @@ extern "C" {
/* Header file version number */
/* Current version at http://www.khronos.org/registry/egl/ */
-/* $Revision: 16473 $ on $Date: 2012-01-04 02:20:48 -0800 (Wed, 04 Jan 2012) $ */
-#define EGL_EGLEXT_VERSION 11
+/* $Revision: 20690 $ on $Date: 2013-02-22 20:15:05 -0500 (Fri, 22 Feb 2013) $ */
+#define EGL_EGLEXT_VERSION 15
#ifndef EGL_KHR_config_attribs
#define EGL_KHR_config_attribs 1
@@ -208,12 +208,12 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EG
typedef void* EGLSyncNV;
typedef khronos_utime_nanoseconds_t EGLTimeNV;
#ifdef EGL_EGLEXT_PROTOTYPES
-EGLSyncNV eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
-EGLBoolean eglDestroySyncNV (EGLSyncNV sync);
-EGLBoolean eglFenceNV (EGLSyncNV sync);
-EGLint eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
-EGLBoolean eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
-EGLBoolean eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
+EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync);
+EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync);
+EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
+EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
@@ -250,7 +250,6 @@ struct EGLClientPixmapHI
EGLint iHeight;
EGLint iStride;
};
-
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI(EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap);
#endif /* EGL_EGLEXT_PROTOTYPES */
@@ -324,12 +323,10 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay
#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133
#endif
-#if KHRONOS_SUPPORT_INT64 /* EGLTimeKHR requires 64-bit uint support */
+#if KHRONOS_SUPPORT_INT64 /* EGLuint64NV requires 64-bit uint support */
#ifndef EGL_NV_system_time
#define EGL_NV_system_time 1
-
typedef khronos_utime_nanoseconds_t EGLuint64NV;
-
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV(void);
EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV(void);
@@ -339,6 +336,86 @@ typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void);
#endif
#endif
+#if KHRONOS_SUPPORT_INT64 /* EGLuint64KHR requires 64-bit uint support */
+#ifndef EGL_KHR_stream
+#define EGL_KHR_stream 1
+typedef void* EGLStreamKHR;
+typedef khronos_uint64_t EGLuint64KHR;
+#define EGL_NO_STREAM_KHR ((EGLStreamKHR)0)
+#define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210
+#define EGL_PRODUCER_FRAME_KHR 0x3212
+#define EGL_CONSUMER_FRAME_KHR 0x3213
+#define EGL_STREAM_STATE_KHR 0x3214
+#define EGL_STREAM_STATE_CREATED_KHR 0x3215
+#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216
+#define EGL_STREAM_STATE_EMPTY_KHR 0x3217
+#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218
+#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219
+#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A
+#define EGL_BAD_STREAM_KHR 0x321B
+#define EGL_BAD_STATE_KHR 0x321C
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR(EGLDisplay dpy, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC)(EGLDisplay dpy, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
+#endif
+#endif
+
+#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
+#ifndef EGL_KHR_stream_consumer_gltexture
+#define EGL_KHR_stream_consumer_gltexture 1
+#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR(EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR(EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR(EGLDisplay dpy, EGLStreamKHR stream);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
+#endif
+#endif
+
+#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
+#ifndef EGL_KHR_stream_producer_eglsurface
+#define EGL_KHR_stream_producer_eglsurface 1
+#define EGL_STREAM_BIT_KHR 0x0800
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR(EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC)(EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
+#endif
+#endif
+
+#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
+#ifndef EGL_KHR_stream_producer_aldatalocator
+#define EGL_KHR_stream_producer_aldatalocator 1
+#endif
+#endif
+
+#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
+#ifndef EGL_KHR_stream_fifo
+#define EGL_KHR_stream_fifo 1
+/* reuse EGLTimeKHR */
+#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC
+#define EGL_STREAM_TIME_NOW_KHR 0x31FD
+#define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE
+#define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
+#endif
+#endif
+
#ifndef EGL_EXT_create_context_robustness
#define EGL_EXT_create_context_robustness 1
#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF
@@ -347,8 +424,158 @@ typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void);
#define EGL_LOSE_CONTEXT_ON_RESET_EXT 0x31BF
#endif
+#ifndef EGL_ANGLE_d3d_share_handle_client_buffer
+#define EGL_ANGLE_d3d_share_handle_client_buffer 1
+/* reuse EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE */
+#endif
+
+#ifndef EGL_ANGLE_window_fixed_size
+#define EGL_ANGLE_window_fixed_size 1
+#define EGL_FIXED_SIZE_ANGLE 0x3201
+#endif
+
+#ifndef EGL_KHR_create_context
+#define EGL_KHR_create_context 1
+#define EGL_CONTEXT_MAJOR_VERSION_KHR EGL_CONTEXT_CLIENT_VERSION
+#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB
+#define EGL_CONTEXT_FLAGS_KHR 0x30FC
+#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD
+#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD
+#define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE
+#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF
+#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001
+#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002
+#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004
+#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001
+#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002
+#define EGL_OPENGL_ES3_BIT_KHR 0x00000040
+#endif
+
+#ifndef EGL_KHR_surfaceless_context
+#define EGL_KHR_surfaceless_context 1
+/* No tokens/entry points, just relaxes an error condition */
+#endif
+
+#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
+#ifndef EGL_KHR_stream_cross_process_fd
+#define EGL_KHR_stream_cross_process_fd 1
+typedef int EGLNativeFileDescriptorKHR;
+#define EGL_NO_FILE_DESCRIPTOR_KHR ((EGLNativeFileDescriptorKHR)(-1))
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR(EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR(EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC)(EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
+#endif
+#endif
+
+#ifndef EGL_EXT_multiview_window
+#define EGL_EXT_multiview_window 1
+#define EGL_MULTIVIEW_VIEW_COUNT_EXT 0x3134
+#endif
+
+#ifndef EGL_KHR_wait_sync
+#define EGL_KHR_wait_sync 1
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC)(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
+#endif
+
+#ifndef EGL_NV_post_convert_rounding
+#define EGL_NV_post_convert_rounding 1
+/* No tokens or entry points, just relaxes behavior of SwapBuffers */
+#endif
+
+#ifndef EGL_NV_native_query
+#define EGL_NV_native_query 1
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeDisplayNV( EGLDisplay dpy, EGLNativeDisplayType* display_id);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeWindowNV( EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType* window);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativePixmapNV( EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType* pixmap);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEDISPLAYNVPROC)(EGLDisplay dpy, EGLNativeDisplayType *display_id);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEWINDOWNVPROC)(EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEPIXMAPNVPROC)(EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
+#endif
+
+#ifndef EGL_NV_3dvision_surface
+#define EGL_NV_3dvision_surface 1
+#define EGL_AUTO_STEREO_NV 0x3136
+#endif
+
+#ifndef EGL_ANDROID_framebuffer_target
+#define EGL_ANDROID_framebuffer_target 1
+#define EGL_FRAMEBUFFER_TARGET_ANDROID 0x3147
+#endif
+
+#ifndef EGL_ANDROID_blob_cache
+#define EGL_ANDROID_blob_cache 1
+typedef khronos_ssize_t EGLsizeiANDROID;
+typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize);
+typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID(EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC)(EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
+#endif
+
+#ifndef EGL_ANDROID_image_native_buffer
+#define EGL_ANDROID_image_native_buffer 1
+#define EGL_NATIVE_BUFFER_ANDROID 0x3140
+#endif
+
+#ifndef EGL_ANDROID_native_fence_sync
+#define EGL_ANDROID_native_fence_sync 1
+#define EGL_SYNC_NATIVE_FENCE_ANDROID 0x3144
+#define EGL_SYNC_NATIVE_FENCE_FD_ANDROID 0x3145
+#define EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID 0x3146
+#define EGL_NO_NATIVE_FENCE_FD_ANDROID -1
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID( EGLDisplay dpy, EGLSyncKHR);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC)(EGLDisplay dpy, EGLSyncKHR);
+#endif
+
+#ifndef EGL_ANDROID_recordable
+#define EGL_ANDROID_recordable 1
+#define EGL_RECORDABLE_ANDROID 0x3142
+#endif
+
+#ifndef EGL_EXT_buffer_age
+#define EGL_EXT_buffer_age 1
+#define EGL_BUFFER_AGE_EXT 0x313D
+#endif
+
+#ifndef EGL_EXT_image_dma_buf_import
+#define EGL_EXT_image_dma_buf_import 1
+#define EGL_LINUX_DMA_BUF_EXT 0x3270
+#define EGL_LINUX_DRM_FOURCC_EXT 0x3271
+#define EGL_DMA_BUF_PLANE0_FD_EXT 0x3272
+#define EGL_DMA_BUF_PLANE0_OFFSET_EXT 0x3273
+#define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274
+#define EGL_DMA_BUF_PLANE1_FD_EXT 0x3275
+#define EGL_DMA_BUF_PLANE1_OFFSET_EXT 0x3276
+#define EGL_DMA_BUF_PLANE1_PITCH_EXT 0x3277
+#define EGL_DMA_BUF_PLANE2_FD_EXT 0x3278
+#define EGL_DMA_BUF_PLANE2_OFFSET_EXT 0x3279
+#define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A
+#define EGL_YUV_COLOR_SPACE_HINT_EXT 0x327B
+#define EGL_SAMPLE_RANGE_HINT_EXT 0x327C
+#define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D
+#define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E
+#define EGL_ITU_REC601_EXT 0x327F
+#define EGL_ITU_REC709_EXT 0x3280
+#define EGL_ITU_REC2020_EXT 0x3281
+#define EGL_YUV_FULL_RANGE_EXT 0x3282
+#define EGL_YUV_NARROW_RANGE_EXT 0x3283
+#define EGL_YUV_CHROMA_SITING_0_EXT 0x3284
+#define EGL_YUV_CHROMA_SITING_0_5_EXT 0x3285
+#endif
+
#ifdef __cplusplus
}
#endif
-#endif
+#endif /* __eglext_h_ */
diff --git a/chromium/third_party/angle/include/EGL/eglplatform.h b/chromium/third_party/angle/include/EGL/eglplatform.h
index 34283f2e907..9a89420ebf9 100644
--- a/chromium/third_party/angle/include/EGL/eglplatform.h
+++ b/chromium/third_party/angle/include/EGL/eglplatform.h
@@ -25,7 +25,7 @@
*/
/* Platform-specific types and definitions for egl.h
- * $Revision: 12306 $ on $Date: 2010-08-25 09:51:28 -0700 (Wed, 25 Aug 2010) $
+ * $Revision: 12306 $ on $Date: 2010-08-25 12:51:28 -0400 (Wed, 25 Aug 2010) $
*
* Adopters may modify khrplatform.h and this file to suit their platform.
* You are encouraged to submit all modifications to the Khronos group so that
@@ -83,13 +83,7 @@ typedef int EGLNativeDisplayType;
typedef void *EGLNativeWindowType;
typedef void *EGLNativePixmapType;
-#elif defined(WL_EGL_PLATFORM)
-
-typedef struct wl_display *EGLNativeDisplayType;
-typedef struct wl_egl_pixmap *EGLNativePixmapType;
-typedef struct wl_egl_window *EGLNativeWindowType;
-
-#elif defined(__unix__) && !defined(ANDROID)
+#elif defined(__unix__)
/* X11 (tentative) */
#include <X11/Xlib.h>
@@ -99,14 +93,6 @@ typedef Display *EGLNativeDisplayType;
typedef Pixmap EGLNativePixmapType;
typedef Window EGLNativeWindowType;
-#elif defined(ANDROID)
-
-struct egl_native_pixmap_t;
-
-typedef struct ANativeWindow* EGLNativeWindowType;
-typedef struct egl_native_pixmap_t* EGLNativePixmapType;
-typedef void* EGLNativeDisplayType;
-
#else
#error "Platform not recognized"
#endif
diff --git a/chromium/third_party/angle/include/GLES2/gl2.h b/chromium/third_party/angle/include/GLES2/gl2.h
index e1d3b87cc59..c2d8357268f 100644
--- a/chromium/third_party/angle/include/GLES2/gl2.h
+++ b/chromium/third_party/angle/include/GLES2/gl2.h
@@ -1,7 +1,7 @@
#ifndef __gl2_h_
#define __gl2_h_
-/* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */
+/* $Revision: 20555 $ on $Date:: 2013-02-12 14:32:47 -0800 #$ */
#include <GLES2/gl2platform.h>
@@ -431,7 +431,6 @@ typedef khronos_ssize_t GLsizeiptr;
#define GL_RGB5_A1 0x8057
#define GL_RGB565 0x8D62
#define GL_DEPTH_COMPONENT16 0x81A5
-#define GL_STENCIL_INDEX 0x1901
#define GL_STENCIL_INDEX8 0x8D48
#define GL_RENDERBUFFER_WIDTH 0x8D42
@@ -528,7 +527,7 @@ GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures);
GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
-GL_APICALL int GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name);
+GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name);
GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params);
GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params);
GL_APICALL GLenum GL_APIENTRY glGetError (void);
@@ -547,7 +546,7 @@ GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum p
GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params);
GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params);
GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params);
-GL_APICALL int GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name);
+GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name);
GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params);
GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params);
GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer);
@@ -569,7 +568,7 @@ GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum
GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert);
GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length);
-GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar** string, const GLint* length);
+GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length);
GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
diff --git a/chromium/third_party/angle/include/GLES2/gl2ext.h b/chromium/third_party/angle/include/GLES2/gl2ext.h
index bad50f9ccbb..d77fdbaebc3 100644
--- a/chromium/third_party/angle/include/GLES2/gl2ext.h
+++ b/chromium/third_party/angle/include/GLES2/gl2ext.h
@@ -1,7 +1,7 @@
#ifndef __gl2ext_h_
#define __gl2ext_h_
-/* $Revision: 16482 $ on $Date:: 2012-01-04 13:44:55 -0500 #$ */
+/* $Revision: 20795 $ on $Date:: 2013-03-07 01:01:58 -0800 #$ */
#ifdef __cplusplus
extern "C" {
@@ -93,6 +93,25 @@ typedef void* GLeglImageOES;
#define GL_DEPTH24_STENCIL8_OES 0x88F0
#endif
+/* GL_OES_required_internalformat */
+#ifndef GL_OES_required_internalformat
+#define GL_ALPHA8_OES 0x803C
+#define GL_DEPTH_COMPONENT16_OES 0x81A5
+/* reuse GL_DEPTH_COMPONENT24_OES */
+/* reuse GL_DEPTH24_STENCIL8_OES */
+/* reuse GL_DEPTH_COMPONENT32_OES */
+#define GL_LUMINANCE4_ALPHA4_OES 0x8043
+#define GL_LUMINANCE8_ALPHA8_OES 0x8045
+#define GL_LUMINANCE8_OES 0x8040
+#define GL_RGBA4_OES 0x8056
+#define GL_RGB5_A1_OES 0x8057
+#define GL_RGB565_OES 0x8D62
+/* reuse GL_RGB8_OES */
+/* reuse GL_RGBA8_OES */
+/* reuse GL_RGB10_EXT */
+/* reuse GL_RGB10_A2_EXT */
+#endif
+
/* GL_OES_rgb8_rgba8 */
#ifndef GL_OES_rgb8_rgba8
#define GL_RGB8_OES 0x8051
@@ -114,6 +133,10 @@ typedef void* GLeglImageOES;
#define GL_STENCIL_INDEX4_OES 0x8D47
#endif
+#ifndef GL_OES_surfaceless_context
+#define GL_FRAMEBUFFER_UNDEFINED_OES 0x8219
+#endif
+
/* GL_OES_texture_3D */
#ifndef GL_OES_texture_3D
#define GL_TEXTURE_WRAP_R_OES 0x8072
@@ -156,6 +179,85 @@ typedef void* GLeglImageOES;
#endif
/*------------------------------------------------------------------------*
+ * KHR extension tokens
+ *------------------------------------------------------------------------*/
+
+#ifndef GL_KHR_debug
+typedef void (GL_APIENTRYP GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);
+#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242
+#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243
+#define GL_DEBUG_CALLBACK_FUNCTION 0x8244
+#define GL_DEBUG_CALLBACK_USER_PARAM 0x8245
+#define GL_DEBUG_SOURCE_API 0x8246
+#define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247
+#define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248
+#define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249
+#define GL_DEBUG_SOURCE_APPLICATION 0x824A
+#define GL_DEBUG_SOURCE_OTHER 0x824B
+#define GL_DEBUG_TYPE_ERROR 0x824C
+#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D
+#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E
+#define GL_DEBUG_TYPE_PORTABILITY 0x824F
+#define GL_DEBUG_TYPE_PERFORMANCE 0x8250
+#define GL_DEBUG_TYPE_OTHER 0x8251
+#define GL_DEBUG_TYPE_MARKER 0x8268
+#define GL_DEBUG_TYPE_PUSH_GROUP 0x8269
+#define GL_DEBUG_TYPE_POP_GROUP 0x826A
+#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B
+#define GL_MAX_DEBUG_GROUP_STACK_DEPTH 0x826C
+#define GL_DEBUG_GROUP_STACK_DEPTH 0x826D
+#define GL_BUFFER 0x82E0
+#define GL_SHADER 0x82E1
+#define GL_PROGRAM 0x82E2
+#define GL_QUERY 0x82E3
+/* PROGRAM_PIPELINE only in GL */
+#define GL_SAMPLER 0x82E6
+/* DISPLAY_LIST only in GL */
+#define GL_MAX_LABEL_LENGTH 0x82E8
+#define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143
+#define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144
+#define GL_DEBUG_LOGGED_MESSAGES 0x9145
+#define GL_DEBUG_SEVERITY_HIGH 0x9146
+#define GL_DEBUG_SEVERITY_MEDIUM 0x9147
+#define GL_DEBUG_SEVERITY_LOW 0x9148
+#define GL_DEBUG_OUTPUT 0x92E0
+#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002
+#define GL_STACK_OVERFLOW 0x0503
+#define GL_STACK_UNDERFLOW 0x0504
+#endif
+
+#ifndef GL_KHR_texture_compression_astc_ldr
+#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0
+#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1
+#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2
+#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3
+#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4
+#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5
+#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6
+#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7
+#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8
+#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9
+#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA
+#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB
+#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC
+#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD
+#endif
+
+/*------------------------------------------------------------------------*
* AMD extension tokens
*------------------------------------------------------------------------*/
@@ -192,6 +294,18 @@ typedef void* GLeglImageOES;
* ANGLE extension tokens
*------------------------------------------------------------------------*/
+/* GL_ANGLE_depth_texture */
+#ifndef GL_ANGLE_depth_texture
+#define GL_DEPTH_COMPONENT 0x1902
+#define GL_DEPTH_STENCIL_OES 0x84F9
+#define GL_UNSIGNED_SHORT 0x1403
+#define GL_UNSIGNED_INT 0x1405
+#define GL_UNSIGNED_INT_24_8_OES 0x84FA
+#define GL_DEPTH_COMPONENT16 0x81A5
+#define GL_DEPTH_COMPONENT32_OES 0x81A7
+#define GL_DEPTH24_STENCIL8_OES 0x88F0
+#endif
+
/* GL_ANGLE_framebuffer_blit */
#ifndef GL_ANGLE_framebuffer_blit
#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8
@@ -207,53 +321,49 @@ typedef void* GLeglImageOES;
#define GL_MAX_SAMPLES_ANGLE 0x8D57
#endif
+/* GL_ANGLE_instanced_arrays */
+#ifndef GL_ANGLE_instanced_arrays
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE
+#endif
+
/* GL_ANGLE_pack_reverse_row_order */
-#ifndef GL_ANGLE_pack_reverse_row_order
+#ifndef GL_ANGLE_pack_reverse_row_order
#define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4
#endif
+/* GL_ANGLE_program_binary */
+#ifndef GL_ANGLE_program_binary
+#define GL_PROGRAM_BINARY_ANGLE 0x93A6
+#endif
+
/* GL_ANGLE_texture_compression_dxt3 */
-#ifndef GL_ANGLE_texture_compression_dxt3
+#ifndef GL_ANGLE_texture_compression_dxt3
#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2
#endif
/* GL_ANGLE_texture_compression_dxt5 */
-#ifndef GL_ANGLE_texture_compression_dxt5
+#ifndef GL_ANGLE_texture_compression_dxt5
#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3
#endif
-/* GL_ANGLE_translated_shader_source */
-#ifndef GL_ANGLE_translated_shader_source
-#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0
-#endif
-
/* GL_ANGLE_texture_usage */
-#ifndef GL_ANGLE_texture_usage
+#ifndef GL_ANGLE_texture_usage
#define GL_TEXTURE_USAGE_ANGLE 0x93A2
#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3
#endif
-/* GL_ANGLE_instanced_arrays */
-#ifndef GL_ANGLE_instanced_arrays
-#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE
-#endif
-
-/* GL_ANGLE_program_binary */
-#ifndef GL_ANGLE_program_binary
-#define GL_PROGRAM_BINARY_ANGLE 0x93A6
+/* GL_ANGLE_translated_shader_source */
+#ifndef GL_ANGLE_translated_shader_source
+#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0
#endif
/*------------------------------------------------------------------------*
* APPLE extension tokens
*------------------------------------------------------------------------*/
-/* GL_APPLE_rgb_422 */
-#ifndef GL_APPLE_rgb_422
-#define GL_RGB_422_APPLE 0x8A1F
-#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA
-#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB
-#endif
-
+/* GL_APPLE_copy_texture_levels */
+/* No new tokens introduced by this extension. */
+
/* GL_APPLE_framebuffer_multisample */
#ifndef GL_APPLE_framebuffer_multisample
#define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB
@@ -265,6 +375,47 @@ typedef void* GLeglImageOES;
#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA
#endif
+/* GL_APPLE_rgb_422 */
+#ifndef GL_APPLE_rgb_422
+#define GL_RGB_422_APPLE 0x8A1F
+#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA
+#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB
+#endif
+
+/* GL_APPLE_sync */
+#ifndef GL_APPLE_sync
+
+#ifndef __gl3_h_
+/* These types are defined with reference to <inttypes.h>
+ * in the Apple extension spec, but here we use the Khronos
+ * portable types in khrplatform.h, and assume those types
+ * are always defined.
+ * If any other extensions using these types are defined,
+ * the typedefs must move out of this block and be shared.
+ */
+typedef khronos_int64_t GLint64;
+typedef khronos_uint64_t GLuint64;
+typedef struct __GLsync *GLsync;
+#endif
+
+#define GL_SYNC_OBJECT_APPLE 0x8A53
+#define GL_MAX_SERVER_WAIT_TIMEOUT_APPLE 0x9111
+#define GL_OBJECT_TYPE_APPLE 0x9112
+#define GL_SYNC_CONDITION_APPLE 0x9113
+#define GL_SYNC_STATUS_APPLE 0x9114
+#define GL_SYNC_FLAGS_APPLE 0x9115
+#define GL_SYNC_FENCE_APPLE 0x9116
+#define GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE 0x9117
+#define GL_UNSIGNALED_APPLE 0x9118
+#define GL_SIGNALED_APPLE 0x9119
+#define GL_ALREADY_SIGNALED_APPLE 0x911A
+#define GL_TIMEOUT_EXPIRED_APPLE 0x911B
+#define GL_CONDITION_SATISFIED_APPLE 0x911C
+#define GL_WAIT_FAILED_APPLE 0x911D
+#define GL_SYNC_FLUSH_COMMANDS_BIT_APPLE 0x00000001
+#define GL_TIMEOUT_IGNORED_APPLE 0xFFFFFFFFFFFFFFFFull
+#endif
+
/* GL_APPLE_texture_format_BGRA8888 */
#ifndef GL_APPLE_texture_format_BGRA8888
#define GL_BGRA_EXT 0x80E1
@@ -279,6 +430,11 @@ typedef void* GLeglImageOES;
* ARM extension tokens
*------------------------------------------------------------------------*/
+/* GL_ARM_mali_program_binary */
+#ifndef GL_ARM_mali_program_binary
+#define GL_MALI_PROGRAM_BINARY_ARM 0x8F61
+#endif
+
/* GL_ARM_mali_shader_binary */
#ifndef GL_ARM_mali_shader_binary
#define GL_MALI_SHADER_BINARY_ARM 0x8F60
@@ -327,12 +483,32 @@ typedef void* GLeglImageOES;
#define GL_STENCIL_EXT 0x1802
#endif
+/* GL_EXT_map_buffer_range */
+#ifndef GL_EXT_map_buffer_range
+#define GL_MAP_READ_BIT_EXT 0x0001
+#define GL_MAP_WRITE_BIT_EXT 0x0002
+#define GL_MAP_INVALIDATE_RANGE_BIT_EXT 0x0004
+#define GL_MAP_INVALIDATE_BUFFER_BIT_EXT 0x0008
+#define GL_MAP_FLUSH_EXPLICIT_BIT_EXT 0x0010
+#define GL_MAP_UNSYNCHRONIZED_BIT_EXT 0x0020
+#endif
+
/* GL_EXT_multisampled_render_to_texture */
#ifndef GL_EXT_multisampled_render_to_texture
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C
-#define GL_RENDERBUFFER_SAMPLES_EXT 0x9133
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x9134
-#define GL_MAX_SAMPLES_EXT 0x9135
+/* reuse values from GL_EXT_framebuffer_multisample (desktop extension) */
+#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
+#define GL_MAX_SAMPLES_EXT 0x8D57
+#endif
+
+/* GL_EXT_multiview_draw_buffers */
+#ifndef GL_EXT_multiview_draw_buffers
+#define GL_COLOR_ATTACHMENT_EXT 0x90F0
+#define GL_MULTIVIEW_EXT 0x90F1
+#define GL_DRAW_BUFFER_EXT 0x0C01
+#define GL_READ_BUFFER_EXT 0x0C02
+#define GL_MAX_MULTIVIEW_BUFFERS_EXT 0x90F2
#endif
/* GL_EXT_multi_draw_arrays */
@@ -376,6 +552,11 @@ typedef void* GLeglImageOES;
#define GL_PROGRAM_PIPELINE_BINDING_EXT 0x825A
#endif
+/* GL_EXT_shader_framebuffer_fetch */
+#ifndef GL_EXT_shader_framebuffer_fetch
+#define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT 0x8A52
+#endif
+
/* GL_EXT_shader_texture_lod */
/* No new tokens introduced by this extension. */
@@ -384,6 +565,7 @@ typedef void* GLeglImageOES;
#define GL_TEXTURE_COMPARE_MODE_EXT 0x884C
#define GL_TEXTURE_COMPARE_FUNC_EXT 0x884D
#define GL_COMPARE_REF_TO_TEXTURE_EXT 0x884E
+#define GL_SAMPLER_2D_SHADOW_EXT 0x8B62
#endif
/* GL_EXT_sRGB */
@@ -431,13 +613,19 @@ typedef void* GLeglImageOES;
#define GL_LUMINANCE32F_EXT 0x8818
#define GL_LUMINANCE_ALPHA32F_EXT 0x8819
/* reuse GL_RGBA16F_EXT */
-#define GL_RGB16F_EXT 0x881B
+/* reuse GL_RGB16F_EXT */
#define GL_ALPHA16F_EXT 0x881C
#define GL_LUMINANCE16F_EXT 0x881E
#define GL_LUMINANCE_ALPHA16F_EXT 0x881F
#define GL_RGB10_A2_EXT 0x8059
#define GL_RGB10_EXT 0x8052
#define GL_BGRA8_EXT 0x93A1
+#define GL_R8_EXT 0x8229
+#define GL_RG8_EXT 0x822B
+#define GL_R32F_EXT 0x822E
+#define GL_RG32F_EXT 0x8230
+#define GL_R16F_EXT 0x822D
+#define GL_RG16F_EXT 0x822F
#endif
/* GL_EXT_texture_type_2_10_10_10_REV */
@@ -447,9 +635,9 @@ typedef void* GLeglImageOES;
/* GL_EXT_unpack_subimage */
#ifndef GL_EXT_unpack_subimage
-#define GL_UNPACK_ROW_LENGTH 0x0CF2
-#define GL_UNPACK_SKIP_ROWS 0x0CF3
-#define GL_UNPACK_SKIP_PIXELS 0x0CF4
+#define GL_UNPACK_ROW_LENGTH_EXT 0x0CF2
+#define GL_UNPACK_SKIP_ROWS_EXT 0x0CF3
+#define GL_UNPACK_SKIP_PIXELS_EXT 0x0CF4
#endif
/*------------------------------------------------------------------------*
@@ -462,6 +650,15 @@ typedef void* GLeglImageOES;
#endif
/*------------------------------------------------------------------------*
+ * FJ extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_FJ_shader_binary_GCCSO */
+#ifndef GL_FJ_shader_binary_GCCSO
+#define GL_GCCSO_SHADER_BINARY_F 0x9260
+#endif
+
+/*------------------------------------------------------------------------*
* IMG extension tokens
*------------------------------------------------------------------------*/
@@ -489,6 +686,12 @@ typedef void* GLeglImageOES;
#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
#endif
+/* GL_IMG_texture_compression_pvrtc2 */
+#ifndef GL_IMG_texture_compression_pvrtc2
+#define GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG 0x9137
+#define GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG 0x9138
+#endif
+
/* GL_IMG_multisampled_render_to_texture */
#ifndef GL_IMG_multisampled_render_to_texture
#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133
@@ -594,6 +797,9 @@ typedef void* GLeglImageOES;
#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF
#endif
+/* GL_NV_draw_instanced */
+/* No new tokens introduced by this extension. */
+
/* GL_NV_fbo_color_attachments */
#ifndef GL_NV_fbo_color_attachments
#define GL_MAX_COLOR_ATTACHMENTS_NV 0x8CDF
@@ -607,6 +813,29 @@ typedef void* GLeglImageOES;
#define GL_FENCE_CONDITION_NV 0x84F4
#endif
+/* GL_NV_framebuffer_blit */
+#ifndef GL_NV_framebuffer_blit
+#define GL_READ_FRAMEBUFFER_NV 0x8CA8
+#define GL_DRAW_FRAMEBUFFER_NV 0x8CA9
+#define GL_DRAW_FRAMEBUFFER_BINDING_NV 0x8CA6
+#define GL_READ_FRAMEBUFFER_BINDING_NV 0x8CAA
+#endif
+
+/* GL_NV_framebuffer_multisample */
+#ifndef GL_NV_framebuffer_multisample
+#define GL_RENDERBUFFER_SAMPLES_NV 0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_NV 0x8D56
+#define GL_MAX_SAMPLES_NV 0x8D57
+#endif
+
+/* GL_NV_generate_mipmap_sRGB */
+/* No new tokens introduced by this extension. */
+
+/* GL_NV_instanced_arrays */
+#ifndef GL_NV_instanced_arrays
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_NV 0x88FE
+#endif
+
/* GL_NV_read_buffer */
#ifndef GL_NV_read_buffer
#define GL_READ_BUFFER_NV 0x0C02
@@ -624,6 +853,36 @@ typedef void* GLeglImageOES;
/* GL_NV_read_stencil */
/* No new tokens introduced by this extension. */
+/* GL_NV_shadow_samplers_array */
+#ifndef GL_NV_shadow_samplers_array
+#define GL_SAMPLER_2D_ARRAY_SHADOW_NV 0x8DC4
+#endif
+
+/* GL_NV_shadow_samplers_cube */
+#ifndef GL_NV_shadow_samplers_cube
+#define GL_SAMPLER_CUBE_SHADOW_NV 0x8DC5
+#endif
+
+/* GL_NV_sRGB_formats */
+#ifndef GL_NV_sRGB_formats
+#define GL_SLUMINANCE_NV 0x8C46
+#define GL_SLUMINANCE_ALPHA_NV 0x8C44
+#define GL_SRGB8_NV 0x8C41
+#define GL_SLUMINANCE8_NV 0x8C47
+#define GL_SLUMINANCE8_ALPHA8_NV 0x8C45
+#define GL_COMPRESSED_SRGB_S3TC_DXT1_NV 0x8C4C
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV 0x8C4D
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV 0x8C4E
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV 0x8C4F
+#define GL_ETC1_SRGB8_NV 0x88EE
+#endif
+
+/* GL_NV_texture_border_clamp */
+#ifndef GL_NV_texture_border_clamp
+#define GL_TEXTURE_BORDER_COLOR_NV 0x1004
+#define GL_CLAMP_TO_BORDER_NV 0x812D
+#endif
+
/* GL_NV_texture_compression_s3tc_update */
/* No new tokens introduced by this extension. */
@@ -641,6 +900,14 @@ typedef void* GLeglImageOES;
#define GL_ALPHA_TEST_REF_QCOM 0x0BC2
#endif
+/* GL_QCOM_binning_control */
+#ifndef GL_QCOM_binning_control
+#define GL_BINNING_CONTROL_HINT_QCOM 0x8FB0
+#define GL_CPU_OPTIMIZED_QCOM 0x8FB1
+#define GL_GPU_OPTIMIZED_QCOM 0x8FB2
+#define GL_RENDER_DIRECT_TO_FRAMEBUFFER_QCOM 0x8FB3
+#endif
+
/* GL_QCOM_driver_control */
/* No new tokens introduced by this extension. */
@@ -811,6 +1078,11 @@ typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum
#define GL_OES_packed_depth_stencil 1
#endif
+/* GL_OES_required_internalformat */
+#ifndef GL_OES_required_internalformat
+#define GL_OES_required_internalformat 1
+#endif
+
/* GL_OES_rgb8_rgba8 */
#ifndef GL_OES_rgb8_rgba8
#define GL_OES_rgb8_rgba8 1
@@ -831,6 +1103,10 @@ typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum
#define GL_OES_stencil4 1
#endif
+#ifndef GL_OES_surfaceless_context
+#define GL_OES_surfaceless_context 1
+#endif
+
/* GL_OES_texture_3D */
#ifndef GL_OES_texture_3D
#define GL_OES_texture_3D 1
@@ -901,6 +1177,43 @@ typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array);
#endif
/*------------------------------------------------------------------------*
+ * KHR extension functions
+ *------------------------------------------------------------------------*/
+
+#ifndef GL_KHR_debug
+#define GL_KHR_debug 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDebugMessageControl (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
+GL_APICALL void GL_APIENTRY glDebugMessageInsert (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
+GL_APICALL void GL_APIENTRY glDebugMessageCallback (GLDEBUGPROC callback, const void *userParam);
+GL_APICALL GLuint GL_APIENTRY glGetDebugMessageLog (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
+GL_APICALL void GL_APIENTRY glPushDebugGroup (GLenum source, GLuint id, GLsizei length, const GLchar *message);
+GL_APICALL void GL_APIENTRY glPopDebugGroup (void);
+GL_APICALL void GL_APIENTRY glObjectLabel (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
+GL_APICALL void GL_APIENTRY glGetObjectLabel (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
+GL_APICALL void GL_APIENTRY glObjectPtrLabel (const void *ptr, GLsizei length, const GLchar *label);
+GL_APICALL void GL_APIENTRY glGetObjectPtrLabel (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
+GL_APICALL void GL_APIENTRY glGetPointerv (GLenum pname, void **params);
+#endif
+typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECONTROLPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
+typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGEINSERTPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
+typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, const void *userParam);
+typedef GLuint (GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGPROC) (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
+typedef void (GL_APIENTRYP PFNGLPUSHDEBUGGROUPPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message);
+typedef void (GL_APIENTRYP PFNGLPOPDEBUGGROUPPROC) (void);
+typedef void (GL_APIENTRYP PFNGLOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
+typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
+typedef void (GL_APIENTRYP PFNGLOBJECTPTRLABELPROC) (const void *ptr, GLsizei length, const GLchar *label);
+typedef void (GL_APIENTRYP PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
+typedef void (GL_APIENTRYP PFNGLGETPOINTERVPROC) (GLenum pname, void **params);
+#endif
+
+#ifndef GL_KHR_texture_compression_astc_ldr
+#define GL_KHR_texture_compression_astc_ldr 1
+#endif
+
+
+/*------------------------------------------------------------------------*
* AMD extension functions
*------------------------------------------------------------------------*/
@@ -952,6 +1265,11 @@ typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monito
* ANGLE extension functions
*------------------------------------------------------------------------*/
+/* GL_ANGLE_depth_texture */
+#ifndef GL_ANGLE_depth_texture
+#define GL_ANGLE_depth_texture 1
+#endif
+
/* GL_ANGLE_framebuffer_blit */
#ifndef GL_ANGLE_framebuffer_blit
#define GL_ANGLE_framebuffer_blit 1
@@ -970,55 +1288,62 @@ GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLE (GLenum target
typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
#endif
+#ifndef GL_ANGLE_instanced_arrays
+#define GL_ANGLE_instanced_arrays 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLE (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE (GLuint index, GLuint divisor);
+#endif
+typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLuint divisor);
+#endif
+
/* GL_ANGLE_pack_reverse_row_order */
-#ifndef GL_ANGLE_pack_reverse_row_order
+#ifndef GL_ANGLE_pack_reverse_row_order
#define GL_ANGLE_pack_reverse_row_order 1
#endif
+/* GL_ANGLE_program_binary */
+#ifndef GL_ANGLE_program_binary
+#define GL_ANGLE_program_binary 1
+#endif
+
/* GL_ANGLE_texture_compression_dxt3 */
-#ifndef GL_ANGLE_texture_compression_dxt3
+#ifndef GL_ANGLE_texture_compression_dxt3
#define GL_ANGLE_texture_compression_dxt3 1
#endif
/* GL_ANGLE_texture_compression_dxt5 */
-#ifndef GL_ANGLE_texture_compression_dxt5
+#ifndef GL_ANGLE_texture_compression_dxt5
#define GL_ANGLE_texture_compression_dxt5 1
#endif
-/* GL_ANGLE_translated_shader_source */
-#ifndef GL_ANGLE_translated_shader_source
-#define GL_ANGLE_translated_shader_source 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
-#endif
-typedef void (GL_APIENTRYP PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
-#endif
-
/* GL_ANGLE_texture_usage */
-#ifndef GL_ANGLE_texture_usage
+#ifndef GL_ANGLE_texture_usage
#define GL_ANGLE_texture_usage 1
#endif
-/* GL_ANGLE_instanced_arrays */
-#ifndef GL_ANGLE_instanced_arrays
-#define GL_ANGLE_instanced_arrays 1
+#ifndef GL_ANGLE_translated_shader_source
+#define GL_ANGLE_translated_shader_source 1
#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE(GLuint index, GLuint divisor);
-GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount);
-GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
+GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
#endif
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLuint divisor);
-typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
-typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
#endif
/*------------------------------------------------------------------------*
* APPLE extension functions
*------------------------------------------------------------------------*/
-/* GL_APPLE_rgb_422 */
-#ifndef GL_APPLE_rgb_422
-#define GL_APPLE_rgb_422 1
+/* GL_APPLE_copy_texture_levels */
+#ifndef GL_APPLE_copy_texture_levels
+#define GL_APPLE_copy_texture_levels 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glCopyTextureLevelsAPPLE (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount);
+#endif
+typedef void (GL_APIENTRYP PFNGLCOPYTEXTURELEVELSAPPLEPROC) (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount);
#endif
/* GL_APPLE_framebuffer_multisample */
@@ -1032,6 +1357,32 @@ typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum
typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void);
#endif
+/* GL_APPLE_rgb_422 */
+#ifndef GL_APPLE_rgb_422
+#define GL_APPLE_rgb_422 1
+#endif
+
+/* GL_APPLE_sync */
+#ifndef GL_APPLE_sync
+#define GL_APPLE_sync 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL GLsync GL_APIENTRY glFenceSyncAPPLE (GLenum condition, GLbitfield flags);
+GL_APICALL GLboolean GL_APIENTRY glIsSyncAPPLE (GLsync sync);
+GL_APICALL void GL_APIENTRY glDeleteSyncAPPLE (GLsync sync);
+GL_APICALL GLenum GL_APIENTRY glClientWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GL_APICALL void GL_APIENTRY glWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GL_APICALL void GL_APIENTRY glGetInteger64vAPPLE (GLenum pname, GLint64 *params);
+GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+#endif
+typedef GLsync (GL_APIENTRYP PFNGLFENCESYNCAPPLEPROC) (GLenum condition, GLbitfield flags);
+typedef GLboolean (GL_APIENTRYP PFNGLISSYNCAPPLEPROC) (GLsync sync);
+typedef void (GL_APIENTRYP PFNGLDELETESYNCAPPLEPROC) (GLsync sync);
+typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+typedef void (GL_APIENTRYP PFNGLWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+typedef void (GL_APIENTRYP PFNGLGETINTEGER64VAPPLEPROC) (GLenum pname, GLint64 *params);
+typedef void (GL_APIENTRYP PFNGLGETSYNCIVAPPLEPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+#endif
+
/* GL_APPLE_texture_format_BGRA8888 */
#ifndef GL_APPLE_texture_format_BGRA8888
#define GL_APPLE_texture_format_BGRA8888 1
@@ -1046,6 +1397,11 @@ typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void);
* ARM extension functions
*------------------------------------------------------------------------*/
+/* GL_ARM_mali_program_binary */
+#ifndef GL_ARM_mali_program_binary
+#define GL_ARM_mali_program_binary 1
+#endif
+
/* GL_ARM_mali_shader_binary */
#ifndef GL_ARM_mali_shader_binary
#define GL_ARM_mali_shader_binary 1
@@ -1103,6 +1459,17 @@ GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numA
typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
#endif
+/* GL_EXT_map_buffer_range */
+#ifndef GL_EXT_map_buffer_range
+#define GL_EXT_map_buffer_range 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void* GL_APIENTRY glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+GL_APICALL void GL_APIENTRY glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length);
+#endif
+typedef void* (GL_APIENTRYP PFNGLMAPBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length);
+#endif
+
/* GL_EXT_multisampled_render_to_texture */
#ifndef GL_EXT_multisampled_render_to_texture
#define GL_EXT_multisampled_render_to_texture 1
@@ -1114,10 +1481,23 @@ typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum t
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
#endif
+/* GL_EXT_multiview_draw_buffers */
+#ifndef GL_EXT_multiview_draw_buffers
+#define GL_EXT_multiview_draw_buffers 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glReadBufferIndexedEXT (GLenum src, GLint index);
+GL_APICALL void GL_APIENTRY glDrawBuffersIndexedEXT (GLint n, const GLenum *location, const GLint *indices);
+GL_APICALL void GL_APIENTRY glGetIntegeri_vEXT (GLenum target, GLuint index, GLint *data);
+#endif
+typedef void (GL_APIENTRYP PFNGLREADBUFFERINDEXEDEXTPROC) (GLenum src, GLint index);
+typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSINDEXEDEXTPROC) (GLint n, const GLenum *location, const GLint *indices);
+typedef void (GL_APIENTRYP PFNGLGETINTEGERI_VEXTPROC) (GLenum target, GLuint index, GLint *data);
+#endif
+
#ifndef GL_EXT_multi_draw_arrays
#define GL_EXT_multi_draw_arrays 1
#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei);
+GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum, const GLint *, const GLsizei *, GLsizei);
GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount);
@@ -1232,6 +1612,11 @@ typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) (GLuint pipeline
typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
#endif
+/* GL_EXT_shader_framebuffer_fetch */
+#ifndef GL_EXT_shader_framebuffer_fetch
+#define GL_EXT_shader_framebuffer_fetch 1
+#endif
+
/* GL_EXT_shader_texture_lod */
#ifndef GL_EXT_shader_texture_lod
#define GL_EXT_shader_texture_lod 1
@@ -1306,6 +1691,15 @@ typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum
#endif
/*------------------------------------------------------------------------*
+ * FJ extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_FJ_shader_binary_GCCSO */
+#ifndef GL_FJ_shader_binary_GCCSO
+#define GL_FJ_shader_binary_GCCSO 1
+#endif
+
+/*------------------------------------------------------------------------*
* IMG extension functions
*------------------------------------------------------------------------*/
@@ -1329,6 +1723,11 @@ typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum
#define GL_IMG_texture_compression_pvrtc 1
#endif
+/* GL_IMG_texture_compression_pvrtc2 */
+#ifndef GL_IMG_texture_compression_pvrtc2
+#define GL_IMG_texture_compression_pvrtc2 1
+#endif
+
/* GL_IMG_multisampled_render_to_texture */
#ifndef GL_IMG_multisampled_render_to_texture
#define GL_IMG_multisampled_render_to_texture 1
@@ -1336,8 +1735,8 @@ typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum
GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei);
#endif
-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMG) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMG) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
#endif
/*------------------------------------------------------------------------*
@@ -1369,6 +1768,7 @@ GL_APICALL void GL_APIENTRY glDrawBuffersNV (GLsizei n, const GLenum *bufs);
typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSNVPROC) (GLsizei n, const GLenum *bufs);
#endif
+/* GL_EXT_draw_buffers */
#ifndef GL_EXT_draw_buffers
#define GL_EXT_draw_buffers 1
#ifdef GL_GLEXT_PROTOTYPES
@@ -1377,6 +1777,17 @@ GL_APICALL void GL_APIENTRY glDrawBuffersEXT (GLsizei n, const GLenum *bufs);
typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSEXTPROC) (GLsizei n, const GLenum *bufs);
#endif
+/* GL_NV_draw_instanced */
+#ifndef GL_NV_draw_instanced
+#define GL_NV_draw_instanced 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawArraysInstancedNV (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+GL_APICALL void GL_APIENTRY glDrawElementsInstancedNV (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
+#endif
+typedef void (GL_APIENTRYP PFNDRAWARRAYSINSTANCEDNVPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNDRAWELEMENTSINSTANCEDNVPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
+#endif
+
/* GL_NV_fbo_color_attachments */
#ifndef GL_NV_fbo_color_attachments
#define GL_NV_fbo_color_attachments 1
@@ -1403,6 +1814,38 @@ typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence);
typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);
#endif
+/* GL_NV_framebuffer_blit */
+#ifndef GL_NV_framebuffer_blit
+#define GL_NV_framebuffer_blit 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBlitFramebufferNV (int srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#endif
+typedef void (GL_APIENTRYP PFNBLITFRAMEBUFFERNVPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#endif
+
+/* GL_NV_framebuffer_multisample */
+#ifndef GL_NV_framebuffer_multisample
+#define GL_NV_framebuffer_multisample 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleNV ( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+#endif
+typedef void (GL_APIENTRYP PFNRENDERBUFFERSTORAGEMULTISAMPLENVPROC) ( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+#endif
+
+/* GL_NV_generate_mipmap_sRGB */
+#ifndef GL_NV_generate_mipmap_sRGB
+#define GL_NV_generate_mipmap_sRGB 1
+#endif
+
+/* GL_NV_instanced_arrays */
+#ifndef GL_NV_instanced_arrays
+#define GL_NV_instanced_arrays 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glVertexAttribDivisorNV (GLuint index, GLuint divisor);
+#endif
+typedef void (GL_APIENTRYP PFNVERTEXATTRIBDIVISORNVPROC) (GLuint index, GLuint divisor);
+#endif
+
/* GL_NV_read_buffer */
#ifndef GL_NV_read_buffer
#define GL_NV_read_buffer 1
@@ -1432,6 +1875,26 @@ typedef void (GL_APIENTRYP PFNGLREADBUFFERNVPROC) (GLenum mode);
#define GL_NV_read_stencil 1
#endif
+/* GL_NV_shadow_samplers_array */
+#ifndef GL_NV_shadow_samplers_array
+#define GL_NV_shadow_samplers_array 1
+#endif
+
+/* GL_NV_shadow_samplers_cube */
+#ifndef GL_NV_shadow_samplers_cube
+#define GL_NV_shadow_samplers_cube 1
+#endif
+
+/* GL_NV_sRGB_formats */
+#ifndef GL_NV_sRGB_formats
+#define GL_NV_sRGB_formats 1
+#endif
+
+/* GL_NV_texture_border_clamp */
+#ifndef GL_NV_texture_border_clamp
+#define GL_NV_texture_border_clamp 1
+#endif
+
/* GL_NV_texture_compression_s3tc_update */
#ifndef GL_NV_texture_compression_s3tc_update
#define GL_NV_texture_compression_s3tc_update 1
@@ -1455,6 +1918,11 @@ GL_APICALL void GL_APIENTRY glAlphaFuncQCOM (GLenum func, GLclampf ref);
typedef void (GL_APIENTRYP PFNGLALPHAFUNCQCOMPROC) (GLenum func, GLclampf ref);
#endif
+/* GL_QCOM_binning_control */
+#ifndef GL_QCOM_binning_control
+#define GL_QCOM_binning_control 1
+#endif
+
/* GL_QCOM_driver_control */
#ifndef GL_QCOM_driver_control
#define GL_QCOM_driver_control 1
@@ -1538,11 +2006,6 @@ typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask);
#define GL_VIV_shader_binary 1
#endif
-/* GL_ANGLE_program_binary */
-#ifndef GL_ANGLE_program_binary
-#define GL_ANGLE_program_binary 1
-#endif
-
#ifdef __cplusplus
}
#endif
diff --git a/chromium/third_party/angle/include/GLES3/gl3.h b/chromium/third_party/angle/include/GLES3/gl3.h
new file mode 100644
index 00000000000..9c79862c0d0
--- /dev/null
+++ b/chromium/third_party/angle/include/GLES3/gl3.h
@@ -0,0 +1,1061 @@
+#ifndef __gl3_h_
+#define __gl3_h_
+
+/*
+ * gl3.h last updated on $Date: 2013-02-12 14:37:24 -0800 (Tue, 12 Feb 2013) $
+ */
+
+#include <GLES3/gl3platform.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2007-2013 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+/*-------------------------------------------------------------------------
+ * Data type definitions
+ *-----------------------------------------------------------------------*/
+
+/* OpenGL ES 2.0 */
+
+typedef void GLvoid;
+typedef char GLchar;
+typedef unsigned int GLenum;
+typedef unsigned char GLboolean;
+typedef unsigned int GLbitfield;
+typedef khronos_int8_t GLbyte;
+typedef short GLshort;
+typedef int GLint;
+typedef int GLsizei;
+typedef khronos_uint8_t GLubyte;
+typedef unsigned short GLushort;
+typedef unsigned int GLuint;
+typedef khronos_float_t GLfloat;
+typedef khronos_float_t GLclampf;
+typedef khronos_int32_t GLfixed;
+typedef khronos_intptr_t GLintptr;
+typedef khronos_ssize_t GLsizeiptr;
+
+/* OpenGL ES 3.0 */
+
+typedef unsigned short GLhalf;
+typedef khronos_int64_t GLint64;
+typedef khronos_uint64_t GLuint64;
+typedef struct __GLsync *GLsync;
+
+/*-------------------------------------------------------------------------
+ * Token definitions
+ *-----------------------------------------------------------------------*/
+
+/* OpenGL ES core versions */
+#define GL_ES_VERSION_3_0 1
+#define GL_ES_VERSION_2_0 1
+
+/* OpenGL ES 2.0 */
+
+/* ClearBufferMask */
+#define GL_DEPTH_BUFFER_BIT 0x00000100
+#define GL_STENCIL_BUFFER_BIT 0x00000400
+#define GL_COLOR_BUFFER_BIT 0x00004000
+
+/* Boolean */
+#define GL_FALSE 0
+#define GL_TRUE 1
+
+/* BeginMode */
+#define GL_POINTS 0x0000
+#define GL_LINES 0x0001
+#define GL_LINE_LOOP 0x0002
+#define GL_LINE_STRIP 0x0003
+#define GL_TRIANGLES 0x0004
+#define GL_TRIANGLE_STRIP 0x0005
+#define GL_TRIANGLE_FAN 0x0006
+
+/* BlendingFactorDest */
+#define GL_ZERO 0
+#define GL_ONE 1
+#define GL_SRC_COLOR 0x0300
+#define GL_ONE_MINUS_SRC_COLOR 0x0301
+#define GL_SRC_ALPHA 0x0302
+#define GL_ONE_MINUS_SRC_ALPHA 0x0303
+#define GL_DST_ALPHA 0x0304
+#define GL_ONE_MINUS_DST_ALPHA 0x0305
+
+/* BlendingFactorSrc */
+/* GL_ZERO */
+/* GL_ONE */
+#define GL_DST_COLOR 0x0306
+#define GL_ONE_MINUS_DST_COLOR 0x0307
+#define GL_SRC_ALPHA_SATURATE 0x0308
+/* GL_SRC_ALPHA */
+/* GL_ONE_MINUS_SRC_ALPHA */
+/* GL_DST_ALPHA */
+/* GL_ONE_MINUS_DST_ALPHA */
+
+/* BlendEquationSeparate */
+#define GL_FUNC_ADD 0x8006
+#define GL_BLEND_EQUATION 0x8009
+#define GL_BLEND_EQUATION_RGB 0x8009 /* same as BLEND_EQUATION */
+#define GL_BLEND_EQUATION_ALPHA 0x883D
+
+/* BlendSubtract */
+#define GL_FUNC_SUBTRACT 0x800A
+#define GL_FUNC_REVERSE_SUBTRACT 0x800B
+
+/* Separate Blend Functions */
+#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_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_COLOR 0x8005
+
+/* Buffer Objects */
+#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_STREAM_DRAW 0x88E0
+#define GL_STATIC_DRAW 0x88E4
+#define GL_DYNAMIC_DRAW 0x88E8
+
+#define GL_BUFFER_SIZE 0x8764
+#define GL_BUFFER_USAGE 0x8765
+
+#define GL_CURRENT_VERTEX_ATTRIB 0x8626
+
+/* CullFaceMode */
+#define GL_FRONT 0x0404
+#define GL_BACK 0x0405
+#define GL_FRONT_AND_BACK 0x0408
+
+/* DepthFunction */
+/* GL_NEVER */
+/* GL_LESS */
+/* GL_EQUAL */
+/* GL_LEQUAL */
+/* GL_GREATER */
+/* GL_NOTEQUAL */
+/* GL_GEQUAL */
+/* GL_ALWAYS */
+
+/* EnableCap */
+#define GL_TEXTURE_2D 0x0DE1
+#define GL_CULL_FACE 0x0B44
+#define GL_BLEND 0x0BE2
+#define GL_DITHER 0x0BD0
+#define GL_STENCIL_TEST 0x0B90
+#define GL_DEPTH_TEST 0x0B71
+#define GL_SCISSOR_TEST 0x0C11
+#define GL_POLYGON_OFFSET_FILL 0x8037
+#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
+#define GL_SAMPLE_COVERAGE 0x80A0
+
+/* ErrorCode */
+#define GL_NO_ERROR 0
+#define GL_INVALID_ENUM 0x0500
+#define GL_INVALID_VALUE 0x0501
+#define GL_INVALID_OPERATION 0x0502
+#define GL_OUT_OF_MEMORY 0x0505
+
+/* FrontFaceDirection */
+#define GL_CW 0x0900
+#define GL_CCW 0x0901
+
+/* GetPName */
+#define GL_LINE_WIDTH 0x0B21
+#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
+#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
+#define GL_CULL_FACE_MODE 0x0B45
+#define GL_FRONT_FACE 0x0B46
+#define GL_DEPTH_RANGE 0x0B70
+#define GL_DEPTH_WRITEMASK 0x0B72
+#define GL_DEPTH_CLEAR_VALUE 0x0B73
+#define GL_DEPTH_FUNC 0x0B74
+#define GL_STENCIL_CLEAR_VALUE 0x0B91
+#define GL_STENCIL_FUNC 0x0B92
+#define GL_STENCIL_FAIL 0x0B94
+#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
+#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
+#define GL_STENCIL_REF 0x0B97
+#define GL_STENCIL_VALUE_MASK 0x0B93
+#define GL_STENCIL_WRITEMASK 0x0B98
+#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_STENCIL_BACK_REF 0x8CA3
+#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
+#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
+#define GL_VIEWPORT 0x0BA2
+#define GL_SCISSOR_BOX 0x0C10
+/* GL_SCISSOR_TEST */
+#define GL_COLOR_CLEAR_VALUE 0x0C22
+#define GL_COLOR_WRITEMASK 0x0C23
+#define GL_UNPACK_ALIGNMENT 0x0CF5
+#define GL_PACK_ALIGNMENT 0x0D05
+#define GL_MAX_TEXTURE_SIZE 0x0D33
+#define GL_MAX_VIEWPORT_DIMS 0x0D3A
+#define GL_SUBPIXEL_BITS 0x0D50
+#define GL_RED_BITS 0x0D52
+#define GL_GREEN_BITS 0x0D53
+#define GL_BLUE_BITS 0x0D54
+#define GL_ALPHA_BITS 0x0D55
+#define GL_DEPTH_BITS 0x0D56
+#define GL_STENCIL_BITS 0x0D57
+#define GL_POLYGON_OFFSET_UNITS 0x2A00
+/* GL_POLYGON_OFFSET_FILL */
+#define GL_POLYGON_OFFSET_FACTOR 0x8038
+#define GL_TEXTURE_BINDING_2D 0x8069
+#define GL_SAMPLE_BUFFERS 0x80A8
+#define GL_SAMPLES 0x80A9
+#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
+#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
+
+/* GetTextureParameter */
+/* GL_TEXTURE_MAG_FILTER */
+/* GL_TEXTURE_MIN_FILTER */
+/* GL_TEXTURE_WRAP_S */
+/* GL_TEXTURE_WRAP_T */
+
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
+#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
+
+/* HintMode */
+#define GL_DONT_CARE 0x1100
+#define GL_FASTEST 0x1101
+#define GL_NICEST 0x1102
+
+/* HintTarget */
+#define GL_GENERATE_MIPMAP_HINT 0x8192
+
+/* DataType */
+#define GL_BYTE 0x1400
+#define GL_UNSIGNED_BYTE 0x1401
+#define GL_SHORT 0x1402
+#define GL_UNSIGNED_SHORT 0x1403
+#define GL_INT 0x1404
+#define GL_UNSIGNED_INT 0x1405
+#define GL_FLOAT 0x1406
+#define GL_FIXED 0x140C
+
+/* PixelFormat */
+#define GL_DEPTH_COMPONENT 0x1902
+#define GL_ALPHA 0x1906
+#define GL_RGB 0x1907
+#define GL_RGBA 0x1908
+#define GL_LUMINANCE 0x1909
+#define GL_LUMINANCE_ALPHA 0x190A
+
+/* PixelType */
+/* GL_UNSIGNED_BYTE */
+#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
+#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
+#define GL_UNSIGNED_SHORT_5_6_5 0x8363
+
+/* Shaders */
+#define GL_FRAGMENT_SHADER 0x8B30
+#define GL_VERTEX_SHADER 0x8B31
+#define GL_MAX_VERTEX_ATTRIBS 0x8869
+#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
+#define GL_MAX_VARYING_VECTORS 0x8DFC
+#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
+#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
+#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
+#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
+#define GL_SHADER_TYPE 0x8B4F
+#define GL_DELETE_STATUS 0x8B80
+#define GL_LINK_STATUS 0x8B82
+#define GL_VALIDATE_STATUS 0x8B83
+#define GL_ATTACHED_SHADERS 0x8B85
+#define GL_ACTIVE_UNIFORMS 0x8B86
+#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
+#define GL_ACTIVE_ATTRIBUTES 0x8B89
+#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
+#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
+#define GL_CURRENT_PROGRAM 0x8B8D
+
+/* StencilFunction */
+#define GL_NEVER 0x0200
+#define GL_LESS 0x0201
+#define GL_EQUAL 0x0202
+#define GL_LEQUAL 0x0203
+#define GL_GREATER 0x0204
+#define GL_NOTEQUAL 0x0205
+#define GL_GEQUAL 0x0206
+#define GL_ALWAYS 0x0207
+
+/* StencilOp */
+/* GL_ZERO */
+#define GL_KEEP 0x1E00
+#define GL_REPLACE 0x1E01
+#define GL_INCR 0x1E02
+#define GL_DECR 0x1E03
+#define GL_INVERT 0x150A
+#define GL_INCR_WRAP 0x8507
+#define GL_DECR_WRAP 0x8508
+
+/* StringName */
+#define GL_VENDOR 0x1F00
+#define GL_RENDERER 0x1F01
+#define GL_VERSION 0x1F02
+#define GL_EXTENSIONS 0x1F03
+
+/* TextureMagFilter */
+#define GL_NEAREST 0x2600
+#define GL_LINEAR 0x2601
+
+/* TextureMinFilter */
+/* GL_NEAREST */
+/* GL_LINEAR */
+#define GL_NEAREST_MIPMAP_NEAREST 0x2700
+#define GL_LINEAR_MIPMAP_NEAREST 0x2701
+#define GL_NEAREST_MIPMAP_LINEAR 0x2702
+#define GL_LINEAR_MIPMAP_LINEAR 0x2703
+
+/* TextureParameterName */
+#define GL_TEXTURE_MAG_FILTER 0x2800
+#define GL_TEXTURE_MIN_FILTER 0x2801
+#define GL_TEXTURE_WRAP_S 0x2802
+#define GL_TEXTURE_WRAP_T 0x2803
+
+/* TextureTarget */
+/* GL_TEXTURE_2D */
+#define GL_TEXTURE 0x1702
+
+#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_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
+
+/* TextureUnit */
+#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
+
+/* TextureWrapMode */
+#define GL_REPEAT 0x2901
+#define GL_CLAMP_TO_EDGE 0x812F
+#define GL_MIRRORED_REPEAT 0x8370
+
+/* Uniform Types */
+#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_2D 0x8B5E
+#define GL_SAMPLER_CUBE 0x8B60
+
+/* Vertex Arrays */
+#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_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
+#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
+#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
+
+/* Read Format */
+#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
+#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
+
+/* Shader Source */
+#define GL_COMPILE_STATUS 0x8B81
+#define GL_INFO_LOG_LENGTH 0x8B84
+#define GL_SHADER_SOURCE_LENGTH 0x8B88
+#define GL_SHADER_COMPILER 0x8DFA
+
+/* Shader Binary */
+#define GL_SHADER_BINARY_FORMATS 0x8DF8
+#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
+
+/* Shader Precision-Specified Types */
+#define GL_LOW_FLOAT 0x8DF0
+#define GL_MEDIUM_FLOAT 0x8DF1
+#define GL_HIGH_FLOAT 0x8DF2
+#define GL_LOW_INT 0x8DF3
+#define GL_MEDIUM_INT 0x8DF4
+#define GL_HIGH_INT 0x8DF5
+
+/* Framebuffer Object. */
+#define GL_FRAMEBUFFER 0x8D40
+#define GL_RENDERBUFFER 0x8D41
+
+#define GL_RGBA4 0x8056
+#define GL_RGB5_A1 0x8057
+#define GL_RGB565 0x8D62
+#define GL_DEPTH_COMPONENT16 0x81A5
+#define GL_STENCIL_INDEX8 0x8D48
+
+#define GL_RENDERBUFFER_WIDTH 0x8D42
+#define GL_RENDERBUFFER_HEIGHT 0x8D43
+#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
+#define GL_RENDERBUFFER_RED_SIZE 0x8D50
+#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
+#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
+#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
+#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
+#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
+
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
+
+#define GL_COLOR_ATTACHMENT0 0x8CE0
+#define GL_DEPTH_ATTACHMENT 0x8D00
+#define GL_STENCIL_ATTACHMENT 0x8D20
+
+#define GL_NONE 0
+
+#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
+#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
+#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
+#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
+#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
+
+#define GL_FRAMEBUFFER_BINDING 0x8CA6
+#define GL_RENDERBUFFER_BINDING 0x8CA7
+#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
+
+#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
+
+/* OpenGL ES 3.0 */
+
+#define GL_READ_BUFFER 0x0C02
+#define GL_UNPACK_ROW_LENGTH 0x0CF2
+#define GL_UNPACK_SKIP_ROWS 0x0CF3
+#define GL_UNPACK_SKIP_PIXELS 0x0CF4
+#define GL_PACK_ROW_LENGTH 0x0D02
+#define GL_PACK_SKIP_ROWS 0x0D03
+#define GL_PACK_SKIP_PIXELS 0x0D04
+#define GL_COLOR 0x1800
+#define GL_DEPTH 0x1801
+#define GL_STENCIL 0x1802
+#define GL_RED 0x1903
+#define GL_RGB8 0x8051
+#define GL_RGBA8 0x8058
+#define GL_RGB10_A2 0x8059
+#define GL_TEXTURE_BINDING_3D 0x806A
+#define GL_UNPACK_SKIP_IMAGES 0x806D
+#define GL_UNPACK_IMAGE_HEIGHT 0x806E
+#define GL_TEXTURE_3D 0x806F
+#define GL_TEXTURE_WRAP_R 0x8072
+#define GL_MAX_3D_TEXTURE_SIZE 0x8073
+#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
+#define GL_MAX_ELEMENTS_VERTICES 0x80E8
+#define GL_MAX_ELEMENTS_INDICES 0x80E9
+#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_MIN 0x8007
+#define GL_MAX 0x8008
+#define GL_DEPTH_COMPONENT24 0x81A6
+#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD
+#define GL_TEXTURE_COMPARE_MODE 0x884C
+#define GL_TEXTURE_COMPARE_FUNC 0x884D
+#define GL_CURRENT_QUERY 0x8865
+#define GL_QUERY_RESULT 0x8866
+#define GL_QUERY_RESULT_AVAILABLE 0x8867
+#define GL_BUFFER_MAPPED 0x88BC
+#define GL_BUFFER_MAP_POINTER 0x88BD
+#define GL_STREAM_READ 0x88E1
+#define GL_STREAM_COPY 0x88E2
+#define GL_STATIC_READ 0x88E5
+#define GL_STATIC_COPY 0x88E6
+#define GL_DYNAMIC_READ 0x88E9
+#define GL_DYNAMIC_COPY 0x88EA
+#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_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49
+#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A
+#define GL_SAMPLER_3D 0x8B5F
+#define GL_SAMPLER_2D_SHADOW 0x8B62
+#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B
+#define GL_PIXEL_PACK_BUFFER 0x88EB
+#define GL_PIXEL_UNPACK_BUFFER 0x88EC
+#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED
+#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF
+#define GL_FLOAT_MAT2x3 0x8B65
+#define GL_FLOAT_MAT2x4 0x8B66
+#define GL_FLOAT_MAT3x2 0x8B67
+#define GL_FLOAT_MAT3x4 0x8B68
+#define GL_FLOAT_MAT4x2 0x8B69
+#define GL_FLOAT_MAT4x3 0x8B6A
+#define GL_SRGB 0x8C40
+#define GL_SRGB8 0x8C41
+#define GL_SRGB8_ALPHA8 0x8C43
+#define GL_COMPARE_REF_TO_TEXTURE 0x884E
+#define GL_MAJOR_VERSION 0x821B
+#define GL_MINOR_VERSION 0x821C
+#define GL_NUM_EXTENSIONS 0x821D
+#define GL_RGBA32F 0x8814
+#define GL_RGB32F 0x8815
+#define GL_RGBA16F 0x881A
+#define GL_RGB16F 0x881B
+#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD
+#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF
+#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904
+#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905
+#define GL_MAX_VARYING_COMPONENTS 0x8B4B
+#define GL_TEXTURE_2D_ARRAY 0x8C1A
+#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D
+#define GL_R11F_G11F_B10F 0x8C3A
+#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B
+#define GL_RGB9_E5 0x8C3D
+#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E
+#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76
+#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80
+#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83
+#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84
+#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85
+#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88
+#define GL_RASTERIZER_DISCARD 0x8C89
+#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B
+#define GL_INTERLEAVED_ATTRIBS 0x8C8C
+#define GL_SEPARATE_ATTRIBS 0x8C8D
+#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E
+#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F
+#define GL_RGBA32UI 0x8D70
+#define GL_RGB32UI 0x8D71
+#define GL_RGBA16UI 0x8D76
+#define GL_RGB16UI 0x8D77
+#define GL_RGBA8UI 0x8D7C
+#define GL_RGB8UI 0x8D7D
+#define GL_RGBA32I 0x8D82
+#define GL_RGB32I 0x8D83
+#define GL_RGBA16I 0x8D88
+#define GL_RGB16I 0x8D89
+#define GL_RGBA8I 0x8D8E
+#define GL_RGB8I 0x8D8F
+#define GL_RED_INTEGER 0x8D94
+#define GL_RGB_INTEGER 0x8D98
+#define GL_RGBA_INTEGER 0x8D99
+#define GL_SAMPLER_2D_ARRAY 0x8DC1
+#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4
+#define GL_SAMPLER_CUBE_SHADOW 0x8DC5
+#define GL_UNSIGNED_INT_VEC2 0x8DC6
+#define GL_UNSIGNED_INT_VEC3 0x8DC7
+#define GL_UNSIGNED_INT_VEC4 0x8DC8
+#define GL_INT_SAMPLER_2D 0x8DCA
+#define GL_INT_SAMPLER_3D 0x8DCB
+#define GL_INT_SAMPLER_CUBE 0x8DCC
+#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF
+#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2
+#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3
+#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4
+#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7
+#define GL_BUFFER_ACCESS_FLAGS 0x911F
+#define GL_BUFFER_MAP_LENGTH 0x9120
+#define GL_BUFFER_MAP_OFFSET 0x9121
+#define GL_DEPTH_COMPONENT32F 0x8CAC
+#define GL_DEPTH32F_STENCIL8 0x8CAD
+#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD
+#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210
+#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211
+#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212
+#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213
+#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214
+#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215
+#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216
+#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217
+#define GL_FRAMEBUFFER_DEFAULT 0x8218
+#define GL_FRAMEBUFFER_UNDEFINED 0x8219
+#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A
+#define GL_DEPTH_STENCIL 0x84F9
+#define GL_UNSIGNED_INT_24_8 0x84FA
+#define GL_DEPTH24_STENCIL8 0x88F0
+#define GL_UNSIGNED_NORMALIZED 0x8C17
+#define GL_DRAW_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING
+#define GL_READ_FRAMEBUFFER 0x8CA8
+#define GL_DRAW_FRAMEBUFFER 0x8CA9
+#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA
+#define GL_RENDERBUFFER_SAMPLES 0x8CAB
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4
+#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF
+#define GL_COLOR_ATTACHMENT1 0x8CE1
+#define GL_COLOR_ATTACHMENT2 0x8CE2
+#define GL_COLOR_ATTACHMENT3 0x8CE3
+#define GL_COLOR_ATTACHMENT4 0x8CE4
+#define GL_COLOR_ATTACHMENT5 0x8CE5
+#define GL_COLOR_ATTACHMENT6 0x8CE6
+#define GL_COLOR_ATTACHMENT7 0x8CE7
+#define GL_COLOR_ATTACHMENT8 0x8CE8
+#define GL_COLOR_ATTACHMENT9 0x8CE9
+#define GL_COLOR_ATTACHMENT10 0x8CEA
+#define GL_COLOR_ATTACHMENT11 0x8CEB
+#define GL_COLOR_ATTACHMENT12 0x8CEC
+#define GL_COLOR_ATTACHMENT13 0x8CED
+#define GL_COLOR_ATTACHMENT14 0x8CEE
+#define GL_COLOR_ATTACHMENT15 0x8CEF
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56
+#define GL_MAX_SAMPLES 0x8D57
+#define GL_HALF_FLOAT 0x140B
+#define GL_MAP_READ_BIT 0x0001
+#define GL_MAP_WRITE_BIT 0x0002
+#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004
+#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008
+#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010
+#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020
+#define GL_RG 0x8227
+#define GL_RG_INTEGER 0x8228
+#define GL_R8 0x8229
+#define GL_RG8 0x822B
+#define GL_R16F 0x822D
+#define GL_R32F 0x822E
+#define GL_RG16F 0x822F
+#define GL_RG32F 0x8230
+#define GL_R8I 0x8231
+#define GL_R8UI 0x8232
+#define GL_R16I 0x8233
+#define GL_R16UI 0x8234
+#define GL_R32I 0x8235
+#define GL_R32UI 0x8236
+#define GL_RG8I 0x8237
+#define GL_RG8UI 0x8238
+#define GL_RG16I 0x8239
+#define GL_RG16UI 0x823A
+#define GL_RG32I 0x823B
+#define GL_RG32UI 0x823C
+#define GL_VERTEX_ARRAY_BINDING 0x85B5
+#define GL_R8_SNORM 0x8F94
+#define GL_RG8_SNORM 0x8F95
+#define GL_RGB8_SNORM 0x8F96
+#define GL_RGBA8_SNORM 0x8F97
+#define GL_SIGNED_NORMALIZED 0x8F9C
+#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69
+#define GL_COPY_READ_BUFFER 0x8F36
+#define GL_COPY_WRITE_BUFFER 0x8F37
+#define GL_COPY_READ_BUFFER_BINDING GL_COPY_READ_BUFFER
+#define GL_COPY_WRITE_BUFFER_BINDING GL_COPY_WRITE_BUFFER
+#define GL_UNIFORM_BUFFER 0x8A11
+#define GL_UNIFORM_BUFFER_BINDING 0x8A28
+#define GL_UNIFORM_BUFFER_START 0x8A29
+#define GL_UNIFORM_BUFFER_SIZE 0x8A2A
+#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B
+#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D
+#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E
+#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F
+#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30
+#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31
+#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33
+#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34
+#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35
+#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36
+#define GL_UNIFORM_TYPE 0x8A37
+#define GL_UNIFORM_SIZE 0x8A38
+#define GL_UNIFORM_NAME_LENGTH 0x8A39
+#define GL_UNIFORM_BLOCK_INDEX 0x8A3A
+#define GL_UNIFORM_OFFSET 0x8A3B
+#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C
+#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D
+#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E
+#define GL_UNIFORM_BLOCK_BINDING 0x8A3F
+#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40
+#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41
+#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42
+#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46
+#define GL_INVALID_INDEX 0xFFFFFFFFu
+#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122
+#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125
+#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111
+#define GL_OBJECT_TYPE 0x9112
+#define GL_SYNC_CONDITION 0x9113
+#define GL_SYNC_STATUS 0x9114
+#define GL_SYNC_FLAGS 0x9115
+#define GL_SYNC_FENCE 0x9116
+#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117
+#define GL_UNSIGNALED 0x9118
+#define GL_SIGNALED 0x9119
+#define GL_ALREADY_SIGNALED 0x911A
+#define GL_TIMEOUT_EXPIRED 0x911B
+#define GL_CONDITION_SATISFIED 0x911C
+#define GL_WAIT_FAILED 0x911D
+#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001
+#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE
+#define GL_ANY_SAMPLES_PASSED 0x8C2F
+#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A
+#define GL_SAMPLER_BINDING 0x8919
+#define GL_RGB10_A2UI 0x906F
+#define GL_TEXTURE_SWIZZLE_R 0x8E42
+#define GL_TEXTURE_SWIZZLE_G 0x8E43
+#define GL_TEXTURE_SWIZZLE_B 0x8E44
+#define GL_TEXTURE_SWIZZLE_A 0x8E45
+#define GL_GREEN 0x1904
+#define GL_BLUE 0x1905
+#define GL_INT_2_10_10_10_REV 0x8D9F
+#define GL_TRANSFORM_FEEDBACK 0x8E22
+#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23
+#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24
+#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25
+#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257
+#define GL_PROGRAM_BINARY_LENGTH 0x8741
+#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE
+#define GL_PROGRAM_BINARY_FORMATS 0x87FF
+#define GL_COMPRESSED_R11_EAC 0x9270
+#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271
+#define GL_COMPRESSED_RG11_EAC 0x9272
+#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273
+#define GL_COMPRESSED_RGB8_ETC2 0x9274
+#define GL_COMPRESSED_SRGB8_ETC2 0x9275
+#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276
+#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277
+#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278
+#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279
+#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F
+#define GL_MAX_ELEMENT_INDEX 0x8D6B
+#define GL_NUM_SAMPLE_COUNTS 0x9380
+#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF
+
+/*-------------------------------------------------------------------------
+ * Entrypoint definitions
+ *-----------------------------------------------------------------------*/
+
+/* OpenGL ES 2.0 */
+
+GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
+GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
+GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar* name);
+GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
+GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
+GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
+GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
+GL_APICALL void GL_APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+GL_APICALL void GL_APIENTRY glBlendEquation (GLenum mode);
+GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
+GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
+GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);
+GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);
+GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target);
+GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
+GL_APICALL void GL_APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+GL_APICALL void GL_APIENTRY glClearDepthf (GLfloat depth);
+GL_APICALL void GL_APIENTRY glClearStencil (GLint s);
+GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader);
+GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data);
+GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL GLuint GL_APIENTRY glCreateProgram (void);
+GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type);
+GL_APICALL void GL_APIENTRY glCullFace (GLenum mode);
+GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers);
+GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers);
+GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers);
+GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader);
+GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures);
+GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func);
+GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag);
+GL_APICALL void GL_APIENTRY glDepthRangef (GLfloat n, GLfloat f);
+GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader);
+GL_APICALL void GL_APIENTRY glDisable (GLenum cap);
+GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index);
+GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
+GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);
+GL_APICALL void GL_APIENTRY glEnable (GLenum cap);
+GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index);
+GL_APICALL void GL_APIENTRY glFinish (void);
+GL_APICALL void GL_APIENTRY glFlush (void);
+GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode);
+GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers);
+GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target);
+GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers);
+GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers);
+GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures);
+GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
+GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
+GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
+GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name);
+GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params);
+GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params);
+GL_APICALL GLenum GL_APIENTRY glGetError (void);
+GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params);
+GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog);
+GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog);
+GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
+GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
+GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name);
+GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params);
+GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params);
+GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params);
+GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name);
+GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer);
+GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode);
+GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
+GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
+GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer);
+GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program);
+GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer);
+GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader);
+GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture);
+GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width);
+GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
+GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
+GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void);
+GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glSampleCoverage (GLfloat value, GLboolean invert);
+GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length);
+GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length);
+GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
+GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
+GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
+GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
+GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params);
+GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params);
+GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels);
+GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x);
+GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x);
+GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y);
+GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y);
+GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z);
+GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w);
+GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUseProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x);
+GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloat* values);
+GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y);
+GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloat* values);
+GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values);
+GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values);
+GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr);
+GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
+
+/* OpenGL ES 3.0 */
+
+GL_APICALL void GL_APIENTRY glReadBuffer (GLenum mode);
+GL_APICALL void GL_APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices);
+GL_APICALL void GL_APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
+GL_APICALL void GL_APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels);
+GL_APICALL void GL_APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data);
+GL_APICALL void GL_APIENTRY glGenQueries (GLsizei n, GLuint* ids);
+GL_APICALL void GL_APIENTRY glDeleteQueries (GLsizei n, const GLuint* ids);
+GL_APICALL GLboolean GL_APIENTRY glIsQuery (GLuint id);
+GL_APICALL void GL_APIENTRY glBeginQuery (GLenum target, GLuint id);
+GL_APICALL void GL_APIENTRY glEndQuery (GLenum target);
+GL_APICALL void GL_APIENTRY glGetQueryiv (GLenum target, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint* params);
+GL_APICALL GLboolean GL_APIENTRY glUnmapBuffer (GLenum target);
+GL_APICALL void GL_APIENTRY glGetBufferPointerv (GLenum target, GLenum pname, GLvoid** params);
+GL_APICALL void GL_APIENTRY glDrawBuffers (GLsizei n, const GLenum* bufs);
+GL_APICALL void GL_APIENTRY glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+GL_APICALL GLvoid* GL_APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+GL_APICALL void GL_APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length);
+GL_APICALL void GL_APIENTRY glBindVertexArray (GLuint array);
+GL_APICALL void GL_APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint* arrays);
+GL_APICALL void GL_APIENTRY glGenVertexArrays (GLsizei n, GLuint* arrays);
+GL_APICALL GLboolean GL_APIENTRY glIsVertexArray (GLuint array);
+GL_APICALL void GL_APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint* data);
+GL_APICALL void GL_APIENTRY glBeginTransformFeedback (GLenum primitiveMode);
+GL_APICALL void GL_APIENTRY glEndTransformFeedback (void);
+GL_APICALL void GL_APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
+GL_APICALL void GL_APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer);
+GL_APICALL void GL_APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode);
+GL_APICALL void GL_APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name);
+GL_APICALL void GL_APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
+GL_APICALL void GL_APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint* params);
+GL_APICALL void GL_APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w);
+GL_APICALL void GL_APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+GL_APICALL void GL_APIENTRY glVertexAttribI4iv (GLuint index, const GLint* v);
+GL_APICALL void GL_APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint* v);
+GL_APICALL void GL_APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint* params);
+GL_APICALL GLint GL_APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name);
+GL_APICALL void GL_APIENTRY glUniform1ui (GLint location, GLuint v0);
+GL_APICALL void GL_APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1);
+GL_APICALL void GL_APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2);
+GL_APICALL void GL_APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+GL_APICALL void GL_APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint* value);
+GL_APICALL void GL_APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint* value);
+GL_APICALL void GL_APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint* value);
+GL_APICALL void GL_APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint* value);
+GL_APICALL void GL_APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint* value);
+GL_APICALL void GL_APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint* value);
+GL_APICALL void GL_APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
+GL_APICALL const GLubyte* GL_APIENTRY glGetStringi (GLenum name, GLuint index);
+GL_APICALL void GL_APIENTRY glCopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+GL_APICALL void GL_APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices);
+GL_APICALL void GL_APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params);
+GL_APICALL GLuint GL_APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar* uniformBlockName);
+GL_APICALL void GL_APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName);
+GL_APICALL void GL_APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
+GL_APICALL void GL_APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei instanceCount);
+GL_APICALL void GL_APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount);
+GL_APICALL GLsync GL_APIENTRY glFenceSync (GLenum condition, GLbitfield flags);
+GL_APICALL GLboolean GL_APIENTRY glIsSync (GLsync sync);
+GL_APICALL void GL_APIENTRY glDeleteSync (GLsync sync);
+GL_APICALL GLenum GL_APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GL_APICALL void GL_APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GL_APICALL void GL_APIENTRY glGetInteger64v (GLenum pname, GLint64* params);
+GL_APICALL void GL_APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values);
+GL_APICALL void GL_APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64* data);
+GL_APICALL void GL_APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64* params);
+GL_APICALL void GL_APIENTRY glGenSamplers (GLsizei count, GLuint* samplers);
+GL_APICALL void GL_APIENTRY glDeleteSamplers (GLsizei count, const GLuint* samplers);
+GL_APICALL GLboolean GL_APIENTRY glIsSampler (GLuint sampler);
+GL_APICALL void GL_APIENTRY glBindSampler (GLuint unit, GLuint sampler);
+GL_APICALL void GL_APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint* param);
+GL_APICALL void GL_APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param);
+GL_APICALL void GL_APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat* param);
+GL_APICALL void GL_APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat* params);
+GL_APICALL void GL_APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor);
+GL_APICALL void GL_APIENTRY glBindTransformFeedback (GLenum target, GLuint id);
+GL_APICALL void GL_APIENTRY glDeleteTransformFeedbacks (GLsizei n, const GLuint* ids);
+GL_APICALL void GL_APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint* ids);
+GL_APICALL GLboolean GL_APIENTRY glIsTransformFeedback (GLuint id);
+GL_APICALL void GL_APIENTRY glPauseTransformFeedback (void);
+GL_APICALL void GL_APIENTRY glResumeTransformFeedback (void);
+GL_APICALL void GL_APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary);
+GL_APICALL void GL_APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length);
+GL_APICALL void GL_APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value);
+GL_APICALL void GL_APIENTRY glInvalidateFramebuffer (GLenum target, GLsizei numAttachments, const GLenum* attachments);
+GL_APICALL void GL_APIENTRY glInvalidateSubFramebuffer (GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+GL_APICALL void GL_APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/chromium/third_party/angle/include/GLES3/gl3ext.h b/chromium/third_party/angle/include/GLES3/gl3ext.h
new file mode 100644
index 00000000000..4d4ea96c4d6
--- /dev/null
+++ b/chromium/third_party/angle/include/GLES3/gl3ext.h
@@ -0,0 +1,24 @@
+#ifndef __gl3ext_h_
+#define __gl3ext_h_
+
+/* $Revision: 17809 $ on $Date:: 2012-05-14 08:03:36 -0700 #$ */
+
+/*
+ * This document is licensed under the SGI Free Software B License Version
+ * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
+ */
+
+/* OpenGL ES 3 Extensions
+ *
+ * After an OES extension's interactions with OpenGl ES 3.0 have been documented,
+ * its tokens and function definitions should be added to this file in a manner
+ * that does not conflict with gl2ext.h or gl3.h.
+ *
+ * Tokens and function definitions for extensions that have become standard
+ * features in OpenGL ES 3.0 will not be added to this file.
+ *
+ * Applications using OpenGL-ES-2-only extensions should include gl2ext.h
+ */
+
+#endif /* __gl3ext_h_ */
+
diff --git a/chromium/third_party/angle/include/GLES3/gl3platform.h b/chromium/third_party/angle/include/GLES3/gl3platform.h
new file mode 100644
index 00000000000..1bd1a850fa6
--- /dev/null
+++ b/chromium/third_party/angle/include/GLES3/gl3platform.h
@@ -0,0 +1,30 @@
+#ifndef __gl3platform_h_
+#define __gl3platform_h_
+
+/* $Revision: 18437 $ on $Date:: 2012-07-08 23:31:39 -0700 #$ */
+
+/*
+ * This document is licensed under the SGI Free Software B License Version
+ * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
+ */
+
+/* Platform-specific types and definitions for OpenGL ES 3.X gl3.h
+ *
+ * Adopters may modify khrplatform.h and this file to suit their platform.
+ * You are encouraged to submit all modifications to the Khronos group so that
+ * they can be included in future versions of this file. Please submit changes
+ * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
+ * by filing a bug against product "OpenGL-ES" component "Registry".
+ */
+
+#include <KHR/khrplatform.h>
+
+#ifndef GL_APICALL
+#define GL_APICALL KHRONOS_APICALL
+#endif
+
+#ifndef GL_APIENTRY
+#define GL_APIENTRY KHRONOS_APIENTRY
+#endif
+
+#endif /* __gl3platform_h_ */
diff --git a/chromium/third_party/angle/include/GLSLANG/ShaderLang.h b/chromium/third_party/angle/include/GLSLANG/ShaderLang.h
index addc7479e8e..c38fdae96cd 100644
--- a/chromium/third_party/angle/include/GLSLANG/ShaderLang.h
+++ b/chromium/third_party/angle/include/GLSLANG/ShaderLang.h
@@ -36,8 +36,8 @@ extern "C" {
#endif
// Version number for shader translation API.
-// It is incremented everytime the API changes.
-#define ANGLE_SH_VERSION 112
+// It is incremented every time the API changes.
+#define ANGLE_SH_VERSION 125
//
// The names of the following enums have been derived by replacing GL prefix
@@ -88,6 +88,7 @@ typedef enum {
typedef enum {
SH_NONE = 0,
SH_INT = 0x1404,
+ SH_UNSIGNED_INT = 0x1405,
SH_FLOAT = 0x1406,
SH_FLOAT_VEC2 = 0x8B50,
SH_FLOAT_VEC3 = 0x8B51,
@@ -95,6 +96,9 @@ typedef enum {
SH_INT_VEC2 = 0x8B53,
SH_INT_VEC3 = 0x8B54,
SH_INT_VEC4 = 0x8B55,
+ SH_UNSIGNED_INT_VEC2 = 0x8DC6,
+ SH_UNSIGNED_INT_VEC3 = 0x8DC7,
+ SH_UNSIGNED_INT_VEC4 = 0x8DC8,
SH_BOOL = 0x8B56,
SH_BOOL_VEC2 = 0x8B57,
SH_BOOL_VEC3 = 0x8B58,
@@ -102,10 +106,29 @@ typedef enum {
SH_FLOAT_MAT2 = 0x8B5A,
SH_FLOAT_MAT3 = 0x8B5B,
SH_FLOAT_MAT4 = 0x8B5C,
+ SH_FLOAT_MAT2x3 = 0x8B65,
+ SH_FLOAT_MAT2x4 = 0x8B66,
+ SH_FLOAT_MAT3x2 = 0x8B67,
+ SH_FLOAT_MAT3x4 = 0x8B68,
+ SH_FLOAT_MAT4x2 = 0x8B69,
+ SH_FLOAT_MAT4x3 = 0x8B6A,
SH_SAMPLER_2D = 0x8B5E,
+ SH_SAMPLER_3D = 0x8B5F,
SH_SAMPLER_CUBE = 0x8B60,
SH_SAMPLER_2D_RECT_ARB = 0x8B63,
- SH_SAMPLER_EXTERNAL_OES = 0x8D66
+ SH_SAMPLER_EXTERNAL_OES = 0x8D66,
+ SH_SAMPLER_2D_ARRAY = 0x8DC1,
+ SH_INT_SAMPLER_2D = 0x8DCA,
+ SH_INT_SAMPLER_3D = 0x8DCB,
+ SH_INT_SAMPLER_CUBE = 0x8DCC,
+ SH_INT_SAMPLER_2D_ARRAY = 0x8DCF,
+ SH_UNSIGNED_INT_SAMPLER_2D = 0x8DD2,
+ SH_UNSIGNED_INT_SAMPLER_3D = 0x8DD3,
+ SH_UNSIGNED_INT_SAMPLER_CUBE = 0x8DD4,
+ SH_UNSIGNED_INT_SAMPLER_2D_ARRAY = 0x8DD7,
+ SH_SAMPLER_2D_SHADOW = 0x8B62,
+ SH_SAMPLER_CUBE_SHADOW = 0x8DC5,
+ SH_SAMPLER_2D_ARRAY_SHADOW = 0x8DC4
} ShDataType;
typedef enum {
@@ -116,19 +139,26 @@ typedef enum {
} ShPrecisionType;
typedef enum {
- SH_INFO_LOG_LENGTH = 0x8B84,
- SH_OBJECT_CODE_LENGTH = 0x8B88, // GL_SHADER_SOURCE_LENGTH
- SH_ACTIVE_UNIFORMS = 0x8B86,
- SH_ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87,
- SH_ACTIVE_ATTRIBUTES = 0x8B89,
- SH_ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A,
- SH_VARYINGS = 0x8BBB,
- SH_VARYING_MAX_LENGTH = 0x8BBC,
- SH_MAPPED_NAME_MAX_LENGTH = 0x6000,
- SH_NAME_MAX_LENGTH = 0x6001,
- SH_HASHED_NAME_MAX_LENGTH = 0x6002,
- SH_HASHED_NAMES_COUNT = 0x6003,
- SH_ACTIVE_UNIFORMS_ARRAY = 0x6004
+ SH_INFO_LOG_LENGTH = 0x8B84,
+ SH_OBJECT_CODE_LENGTH = 0x8B88, // GL_SHADER_SOURCE_LENGTH
+ SH_ACTIVE_UNIFORMS = 0x8B86,
+ SH_ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87,
+ SH_ACTIVE_ATTRIBUTES = 0x8B89,
+ SH_ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A,
+ SH_VARYINGS = 0x8BBB,
+ SH_VARYING_MAX_LENGTH = 0x8BBC,
+ SH_MAPPED_NAME_MAX_LENGTH = 0x6000,
+ SH_NAME_MAX_LENGTH = 0x6001,
+ SH_HASHED_NAME_MAX_LENGTH = 0x6002,
+ SH_HASHED_NAMES_COUNT = 0x6003,
+ SH_ACTIVE_UNIFORMS_ARRAY = 0x6004,
+ SH_SHADER_VERSION = 0x6005,
+ SH_ACTIVE_INTERFACE_BLOCKS_ARRAY = 0x6006,
+ SH_ACTIVE_OUTPUT_VARIABLES_ARRAY = 0x6007,
+ SH_ACTIVE_ATTRIBUTES_ARRAY = 0x6008,
+ SH_ACTIVE_VARYINGS_ARRAY = 0x6009,
+ SH_RESOURCES_STRING_LENGTH = 0x600A,
+ SH_OUTPUT_TYPE = 0x600B
} ShShaderInfo;
// Compile options.
@@ -140,13 +170,17 @@ typedef enum {
SH_VARIABLES = 0x0008,
SH_LINE_DIRECTIVES = 0x0010,
SH_SOURCE_PATH = 0x0020,
- SH_MAP_LONG_VARIABLE_NAMES = 0x0040,
- SH_UNROLL_FOR_LOOP_WITH_INTEGER_INDEX = 0x0080,
+ SH_UNROLL_FOR_LOOP_WITH_INTEGER_INDEX = 0x0040,
+ // If a sampler array index happens to be a loop index,
+ // 1) if its type is integer, unroll the loop.
+ // 2) if its type is float, fail the shader compile.
+ // This is to work around a mac driver bug.
+ SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX = 0x0080,
// This is needed only as a workaround for certain OpenGL driver bugs.
SH_EMULATE_BUILT_IN_FUNCTIONS = 0x0100,
- // This is an experimental flag to enforce restrictions that aim to prevent
+ // This is an experimental flag to enforce restrictions that aim to prevent
// timing attacks.
// It generates compilation errors for shaders that could expose sensitive
// texture information via the timing channel.
@@ -184,8 +218,8 @@ typedef enum {
// This flag limits the depth of the call stack.
SH_LIMIT_CALL_STACK_DEPTH = 0x4000,
- // This flag initializes gl_Position to vec4(0.0, 0.0, 0.0, 1.0) at
- // the beginning of the vertex shader, and has no effect in the
+ // This flag initializes gl_Position to vec4(0,0,0,0) at the
+ // beginning of the vertex shader's main(), and has no effect in the
// fragment shader. It is intended as a workaround for drivers which
// incorrectly fail to link programs if gl_Position is not written.
SH_INIT_GL_POSITION = 0x8000,
@@ -196,6 +230,12 @@ typedef enum {
// This is to work around a MacOSX driver bug that |b| is executed
// independent of |a|'s value.
SH_UNFOLD_SHORT_CIRCUIT = 0x10000,
+
+ // This flag initializes varyings without static use in vertex shader
+ // at the beginning of main(), and has no effects in the fragment shader.
+ // It is intended as a workaround for drivers which incorrectly optimize
+ // out such varyings and cause a link failure.
+ SH_INIT_VARYINGS_WITHOUT_STATIC_USE = 0x20000,
} ShCompileOptions;
// Defines alternate strategies for implementing array index clamping.
@@ -246,11 +286,18 @@ typedef struct
int ARB_texture_rectangle;
int EXT_draw_buffers;
int EXT_frag_depth;
+ int EXT_shader_texture_lod;
// Set to 1 if highp precision is supported in the fragment language.
// Default is 0.
int FragmentPrecisionHigh;
+ // GLSL ES 3.0 constants.
+ int MaxVertexOutputVectors;
+ int MaxFragmentInputVectors;
+ int MinProgramTexelOffset;
+ int MaxProgramTexelOffset;
+
// Name Hashing.
// Set a 64 bit hash function to enable user-defined name hashing.
// Default is NULL.
@@ -274,7 +321,7 @@ COMPILER_EXPORT void ShInitBuiltInResources(ShBuiltInResources* resources);
//
// ShHandle held by but opaque to the driver. It is allocated,
-// managed, and de-allocated by the compiler. It's contents
+// managed, and de-allocated by the compiler. Its contents
// are defined by and used by the compiler.
//
// If handle creation fails, 0 will be returned.
@@ -282,6 +329,17 @@ COMPILER_EXPORT void ShInitBuiltInResources(ShBuiltInResources* resources);
typedef void* ShHandle;
//
+// Returns the a concatenated list of the items in ShBuiltInResources as a string.
+// This function must be updated whenever ShBuiltInResources is changed.
+// Parameters:
+// handle: Specifies the handle of the compiler to be used.
+// outStringLen: Specifies the size of the buffer, in number of characters. The size
+// of the buffer required to store the resources string can be obtained
+// by calling ShGetInfo with SH_RESOURCES_STRING_LENGTH.
+// outStr: Returns a null-terminated string representing all the built-in resources.
+COMPILER_EXPORT void ShGetBuiltInResourcesString(const ShHandle handle, size_t outStringLen, char *outStr);
+
+//
// Driver calls these to create and destroy compiler objects.
//
// Returns the handle of constructed compiler, null if the requested compiler is
@@ -358,6 +416,8 @@ COMPILER_EXPORT int ShCompile(
// SH_HASHED_NAME_MAX_LENGTH: the max length of a hashed name including the
// null termination character.
// SH_HASHED_NAMES_COUNT: the number of hashed names from the latest compile.
+// SH_SHADER_VERSION: the version of the shader language
+// SH_OUTPUT_TYPE: the currently set language output type
//
// params: Requested parameter
COMPILER_EXPORT void ShGetInfo(const ShHandle handle,
diff --git a/chromium/third_party/angle/projects/build/All.vcxproj b/chromium/third_party/angle/projects/build/All.vcxproj
new file mode 100644
index 00000000000..e4d508a3226
--- /dev/null
+++ b/chromium/third_party/angle/projects/build/All.vcxproj
@@ -0,0 +1,215 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{D048EF6F-5312-AF41-8D8A-DB22CD8634E6}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>All</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
+ <PropertyGroup Label="Configuration">
+ <CharacterSet>MultiByte</CharacterSet>
+ <ConfigurationType>Utility</ConfigurationType>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
+ <ImportGroup Label="ExtensionSettings"/>
+ <ImportGroup Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros"/>
+ <PropertyGroup>
+ <ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\..\third_party\cygwin\bin\;$(MSBuildProjectDirectory)\..\..\third_party\python_26\</ExecutablePath>
+ <OutDir>$(SolutionDir)$(Configuration)_$(Platform)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <TargetName>$(ProjectName)</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>$(OutDir)obj\global_intermediate\angle;..\..\include;..\..\samples\angle\sample_util;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4201;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>ANGLE_TRANSLATOR_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies></AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>$(OutDir)obj\global_intermediate\angle;..\..\include;..\..\samples\angle\sample_util;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>ANGLE_TRANSLATOR_STATIC;%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>$(OutDir)obj\global_intermediate\angle;..\..\include;..\..\samples\angle\sample_util;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4201;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>ANGLE_TRANSLATOR_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies></AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>$(OutDir)obj\global_intermediate\angle;..\..\include;..\..\samples\angle\sample_util;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>ANGLE_TRANSLATOR_STATIC;%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <None Include="..\..\build\all.gyp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\src\copy_scripts.vcxproj">
+ <Project>{63FB0B97-D1D9-5158-8E85-7F5B1E403817}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\preprocessor.vcxproj">
+ <Project>{C7BAF548-697D-2DCB-9DF3-9D1506A7B444}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\translator_lib.vcxproj">
+ <Project>{276D20F5-2943-414C-0FF6-21F4723A5CF6}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\translator.vcxproj">
+ <Project>{C15697F6-5057-016E-BD29-422971875679}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\translator_static.vcxproj">
+ <Project>{19386E01-D811-FA3B-9F1E-122BB0C0E9F5}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\commit_id.vcxproj">
+ <Project>{3B7F5656-177F-52EE-26B3-D6A75368D0A9}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\copy_compiler_dll.vcxproj">
+ <Project>{22DC02D5-1598-943C-13E1-82185B469F81}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\libGLESv2.vcxproj">
+ <Project>{7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\libEGL.vcxproj">
+ <Project>{FBAEE4F6-562A-588F-01F9-72DCABB3B061}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\samples\essl_to_glsl.vcxproj">
+ <Project>{293E74D1-544C-D368-02A0-52F61A4D0679}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\samples\essl_to_hlsl.vcxproj">
+ <Project>{B4D06330-EED1-6F99-BCA4-2F913908C38A}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\samples\dds_to_header.vcxproj">
+ <Project>{6BC75FF2-C11A-C393-F9BB-BF29FF29D736}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\samples\sample_util.vcxproj">
+ <Project>{297C46B0-9263-A9EA-82B1-EA221E7D7C7F}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\samples\hello_triangle.vcxproj">
+ <Project>{3F4D97A9-0809-E0E4-5A3F-B6ACB6EABB46}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\samples\mip_map_2d.vcxproj">
+ <Project>{A6E86EB3-561F-9FAB-670F-EF23556344BE}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\samples\multi_texture.vcxproj">
+ <Project>{37E1BB43-65DC-A25A-042E-30B88E6C75A2}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\samples\particle_system.vcxproj">
+ <Project>{8C20B90A-FBCB-B63F-435A-3299A1C38B2C}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\samples\simple_instancing.vcxproj">
+ <Project>{130A534E-6BA3-DB9C-B0D2-5ACE5CCB2632}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\samples\multiple_draw_buffers.vcxproj">
+ <Project>{58BE89D7-25D5-CC84-EDBF-412C12C59709}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\samples\simple_texture_2d.vcxproj">
+ <Project>{0BD6333E-E82C-7665-C386-CDA40096413D}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\samples\simple_texture_cubemap.vcxproj">
+ <Project>{93B7F18A-947E-69A1-9CD8-D1E5144E792A}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\samples\simple_vertex_shader.vcxproj">
+ <Project>{459E5678-892C-4EF9-6ED8-0D9E5272B4FF}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\samples\stencil_operations.vcxproj">
+ <Project>{92582B26-5131-8C32-39D9-5768C7FA12B4}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\samples\texture_wrap.vcxproj">
+ <Project>{46160987-0221-9E14-3B88-80F9FCFCFFBF}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\samples\post_sub_buffer.vcxproj">
+ <Project>{CBE3D362-43EA-60FC-D5AC-490039CA449A}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
+ <ImportGroup Label="ExtensionTargets"/>
+</Project>
diff --git a/chromium/third_party/angle/projects/build/all.sln b/chromium/third_party/angle/projects/build/all.sln
new file mode 100644
index 00000000000..5862eddf818
--- /dev/null
+++ b/chromium/third_party/angle/projects/build/all.sln
@@ -0,0 +1,285 @@
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual C++ Express 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "All", "All.vcxproj", "{D048EF6F-5312-AF41-8D8A-DB22CD8634E6}"
+ ProjectSection(ProjectDependencies) = postProject
+ {63FB0B97-D1D9-5158-8E85-7F5B1E403817} = {63FB0B97-D1D9-5158-8E85-7F5B1E403817}
+ {C7BAF548-697D-2DCB-9DF3-9D1506A7B444} = {C7BAF548-697D-2DCB-9DF3-9D1506A7B444}
+ {276D20F5-2943-414C-0FF6-21F4723A5CF6} = {276D20F5-2943-414C-0FF6-21F4723A5CF6}
+ {C15697F6-5057-016E-BD29-422971875679} = {C15697F6-5057-016E-BD29-422971875679}
+ {19386E01-D811-FA3B-9F1E-122BB0C0E9F5} = {19386E01-D811-FA3B-9F1E-122BB0C0E9F5}
+ {3B7F5656-177F-52EE-26B3-D6A75368D0A9} = {3B7F5656-177F-52EE-26B3-D6A75368D0A9}
+ {22DC02D5-1598-943C-13E1-82185B469F81} = {22DC02D5-1598-943C-13E1-82185B469F81}
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061} = {FBAEE4F6-562A-588F-01F9-72DCABB3B061}
+ {293E74D1-544C-D368-02A0-52F61A4D0679} = {293E74D1-544C-D368-02A0-52F61A4D0679}
+ {B4D06330-EED1-6F99-BCA4-2F913908C38A} = {B4D06330-EED1-6F99-BCA4-2F913908C38A}
+ {6BC75FF2-C11A-C393-F9BB-BF29FF29D736} = {6BC75FF2-C11A-C393-F9BB-BF29FF29D736}
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F} = {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}
+ {3F4D97A9-0809-E0E4-5A3F-B6ACB6EABB46} = {3F4D97A9-0809-E0E4-5A3F-B6ACB6EABB46}
+ {A6E86EB3-561F-9FAB-670F-EF23556344BE} = {A6E86EB3-561F-9FAB-670F-EF23556344BE}
+ {37E1BB43-65DC-A25A-042E-30B88E6C75A2} = {37E1BB43-65DC-A25A-042E-30B88E6C75A2}
+ {8C20B90A-FBCB-B63F-435A-3299A1C38B2C} = {8C20B90A-FBCB-B63F-435A-3299A1C38B2C}
+ {130A534E-6BA3-DB9C-B0D2-5ACE5CCB2632} = {130A534E-6BA3-DB9C-B0D2-5ACE5CCB2632}
+ {58BE89D7-25D5-CC84-EDBF-412C12C59709} = {58BE89D7-25D5-CC84-EDBF-412C12C59709}
+ {0BD6333E-E82C-7665-C386-CDA40096413D} = {0BD6333E-E82C-7665-C386-CDA40096413D}
+ {93B7F18A-947E-69A1-9CD8-D1E5144E792A} = {93B7F18A-947E-69A1-9CD8-D1E5144E792A}
+ {459E5678-892C-4EF9-6ED8-0D9E5272B4FF} = {459E5678-892C-4EF9-6ED8-0D9E5272B4FF}
+ {92582B26-5131-8C32-39D9-5768C7FA12B4} = {92582B26-5131-8C32-39D9-5768C7FA12B4}
+ {46160987-0221-9E14-3B88-80F9FCFCFFBF} = {46160987-0221-9E14-3B88-80F9FCFCFFBF}
+ {CBE3D362-43EA-60FC-D5AC-490039CA449A} = {CBE3D362-43EA-60FC-D5AC-490039CA449A}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "commit_id", "..\src\commit_id.vcxproj", "{3B7F5656-177F-52EE-26B3-D6A75368D0A9}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "copy_compiler_dll", "..\src\copy_compiler_dll.vcxproj", "{22DC02D5-1598-943C-13E1-82185B469F81}"
+ ProjectSection(ProjectDependencies) = postProject
+ {63FB0B97-D1D9-5158-8E85-7F5B1E403817} = {63FB0B97-D1D9-5158-8E85-7F5B1E403817}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "copy_scripts", "..\src\copy_scripts.vcxproj", "{63FB0B97-D1D9-5158-8E85-7F5B1E403817}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dds_to_header", "..\samples\dds_to_header.vcxproj", "{6BC75FF2-C11A-C393-F9BB-BF29FF29D736}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "essl_to_glsl", "..\samples\essl_to_glsl.vcxproj", "{293E74D1-544C-D368-02A0-52F61A4D0679}"
+ ProjectSection(ProjectDependencies) = postProject
+ {19386E01-D811-FA3B-9F1E-122BB0C0E9F5} = {19386E01-D811-FA3B-9F1E-122BB0C0E9F5}
+ {276D20F5-2943-414C-0FF6-21F4723A5CF6} = {276D20F5-2943-414C-0FF6-21F4723A5CF6}
+ {C7BAF548-697D-2DCB-9DF3-9D1506A7B444} = {C7BAF548-697D-2DCB-9DF3-9D1506A7B444}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "essl_to_hlsl", "..\samples\essl_to_hlsl.vcxproj", "{B4D06330-EED1-6F99-BCA4-2F913908C38A}"
+ ProjectSection(ProjectDependencies) = postProject
+ {19386E01-D811-FA3B-9F1E-122BB0C0E9F5} = {19386E01-D811-FA3B-9F1E-122BB0C0E9F5}
+ {276D20F5-2943-414C-0FF6-21F4723A5CF6} = {276D20F5-2943-414C-0FF6-21F4723A5CF6}
+ {C7BAF548-697D-2DCB-9DF3-9D1506A7B444} = {C7BAF548-697D-2DCB-9DF3-9D1506A7B444}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hello_triangle", "..\samples\hello_triangle.vcxproj", "{3F4D97A9-0809-E0E4-5A3F-B6ACB6EABB46}"
+ ProjectSection(ProjectDependencies) = postProject
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F} = {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061} = {FBAEE4F6-562A-588F-01F9-72DCABB3B061}
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libEGL", "..\src\libEGL.vcxproj", "{FBAEE4F6-562A-588F-01F9-72DCABB3B061}"
+ ProjectSection(ProjectDependencies) = postProject
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
+ {3B7F5656-177F-52EE-26B3-D6A75368D0A9} = {3B7F5656-177F-52EE-26B3-D6A75368D0A9}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libGLESv2", "..\src\libGLESv2.vcxproj", "{7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}"
+ ProjectSection(ProjectDependencies) = postProject
+ {C15697F6-5057-016E-BD29-422971875679} = {C15697F6-5057-016E-BD29-422971875679}
+ {3B7F5656-177F-52EE-26B3-D6A75368D0A9} = {3B7F5656-177F-52EE-26B3-D6A75368D0A9}
+ {22DC02D5-1598-943C-13E1-82185B469F81} = {22DC02D5-1598-943C-13E1-82185B469F81}
+ {276D20F5-2943-414C-0FF6-21F4723A5CF6} = {276D20F5-2943-414C-0FF6-21F4723A5CF6}
+ {C7BAF548-697D-2DCB-9DF3-9D1506A7B444} = {C7BAF548-697D-2DCB-9DF3-9D1506A7B444}
+ {63FB0B97-D1D9-5158-8E85-7F5B1E403817} = {63FB0B97-D1D9-5158-8E85-7F5B1E403817}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mip_map_2d", "..\samples\mip_map_2d.vcxproj", "{A6E86EB3-561F-9FAB-670F-EF23556344BE}"
+ ProjectSection(ProjectDependencies) = postProject
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F} = {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061} = {FBAEE4F6-562A-588F-01F9-72DCABB3B061}
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_texture", "..\samples\multi_texture.vcxproj", "{37E1BB43-65DC-A25A-042E-30B88E6C75A2}"
+ ProjectSection(ProjectDependencies) = postProject
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F} = {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061} = {FBAEE4F6-562A-588F-01F9-72DCABB3B061}
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multiple_draw_buffers", "..\samples\multiple_draw_buffers.vcxproj", "{58BE89D7-25D5-CC84-EDBF-412C12C59709}"
+ ProjectSection(ProjectDependencies) = postProject
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F} = {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061} = {FBAEE4F6-562A-588F-01F9-72DCABB3B061}
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "particle_system", "..\samples\particle_system.vcxproj", "{8C20B90A-FBCB-B63F-435A-3299A1C38B2C}"
+ ProjectSection(ProjectDependencies) = postProject
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F} = {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061} = {FBAEE4F6-562A-588F-01F9-72DCABB3B061}
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "post_sub_buffer", "..\samples\post_sub_buffer.vcxproj", "{CBE3D362-43EA-60FC-D5AC-490039CA449A}"
+ ProjectSection(ProjectDependencies) = postProject
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F} = {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061} = {FBAEE4F6-562A-588F-01F9-72DCABB3B061}
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "preprocessor", "..\src\preprocessor.vcxproj", "{C7BAF548-697D-2DCB-9DF3-9D1506A7B444}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample_util", "..\samples\sample_util.vcxproj", "{297C46B0-9263-A9EA-82B1-EA221E7D7C7F}"
+ ProjectSection(ProjectDependencies) = postProject
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061} = {FBAEE4F6-562A-588F-01F9-72DCABB3B061}
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simple_instancing", "..\samples\simple_instancing.vcxproj", "{130A534E-6BA3-DB9C-B0D2-5ACE5CCB2632}"
+ ProjectSection(ProjectDependencies) = postProject
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F} = {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061} = {FBAEE4F6-562A-588F-01F9-72DCABB3B061}
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simple_texture_2d", "..\samples\simple_texture_2d.vcxproj", "{0BD6333E-E82C-7665-C386-CDA40096413D}"
+ ProjectSection(ProjectDependencies) = postProject
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F} = {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061} = {FBAEE4F6-562A-588F-01F9-72DCABB3B061}
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simple_texture_cubemap", "..\samples\simple_texture_cubemap.vcxproj", "{93B7F18A-947E-69A1-9CD8-D1E5144E792A}"
+ ProjectSection(ProjectDependencies) = postProject
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F} = {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061} = {FBAEE4F6-562A-588F-01F9-72DCABB3B061}
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simple_vertex_shader", "..\samples\simple_vertex_shader.vcxproj", "{459E5678-892C-4EF9-6ED8-0D9E5272B4FF}"
+ ProjectSection(ProjectDependencies) = postProject
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F} = {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061} = {FBAEE4F6-562A-588F-01F9-72DCABB3B061}
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stencil_operations", "..\samples\stencil_operations.vcxproj", "{92582B26-5131-8C32-39D9-5768C7FA12B4}"
+ ProjectSection(ProjectDependencies) = postProject
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F} = {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061} = {FBAEE4F6-562A-588F-01F9-72DCABB3B061}
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "texture_wrap", "..\samples\texture_wrap.vcxproj", "{46160987-0221-9E14-3B88-80F9FCFCFFBF}"
+ ProjectSection(ProjectDependencies) = postProject
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F} = {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061} = {FBAEE4F6-562A-588F-01F9-72DCABB3B061}
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "translator", "..\src\translator.vcxproj", "{C15697F6-5057-016E-BD29-422971875679}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "translator_lib", "..\src\translator_lib.vcxproj", "{276D20F5-2943-414C-0FF6-21F4723A5CF6}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "translator_static", "..\src\translator_static.vcxproj", "{19386E01-D811-FA3B-9F1E-122BB0C0E9F5}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {0BD6333E-E82C-7665-C386-CDA40096413D}.Debug|Win32.ActiveCfg = Debug|Win32
+ {0BD6333E-E82C-7665-C386-CDA40096413D}.Debug|Win32.Build.0 = Debug|Win32
+ {0BD6333E-E82C-7665-C386-CDA40096413D}.Release|Win32.ActiveCfg = Release|Win32
+ {0BD6333E-E82C-7665-C386-CDA40096413D}.Release|Win32.Build.0 = Release|Win32
+ {130A534E-6BA3-DB9C-B0D2-5ACE5CCB2632}.Debug|Win32.ActiveCfg = Debug|Win32
+ {130A534E-6BA3-DB9C-B0D2-5ACE5CCB2632}.Debug|Win32.Build.0 = Debug|Win32
+ {130A534E-6BA3-DB9C-B0D2-5ACE5CCB2632}.Release|Win32.ActiveCfg = Release|Win32
+ {130A534E-6BA3-DB9C-B0D2-5ACE5CCB2632}.Release|Win32.Build.0 = Release|Win32
+ {19386E01-D811-FA3B-9F1E-122BB0C0E9F5}.Debug|Win32.ActiveCfg = Debug|Win32
+ {19386E01-D811-FA3B-9F1E-122BB0C0E9F5}.Debug|Win32.Build.0 = Debug|Win32
+ {19386E01-D811-FA3B-9F1E-122BB0C0E9F5}.Release|Win32.ActiveCfg = Release|Win32
+ {19386E01-D811-FA3B-9F1E-122BB0C0E9F5}.Release|Win32.Build.0 = Release|Win32
+ {22DC02D5-1598-943C-13E1-82185B469F81}.Debug|Win32.ActiveCfg = Debug|Win32
+ {22DC02D5-1598-943C-13E1-82185B469F81}.Debug|Win32.Build.0 = Debug|Win32
+ {22DC02D5-1598-943C-13E1-82185B469F81}.Release|Win32.ActiveCfg = Release|Win32
+ {22DC02D5-1598-943C-13E1-82185B469F81}.Release|Win32.Build.0 = Release|Win32
+ {276D20F5-2943-414C-0FF6-21F4723A5CF6}.Debug|Win32.ActiveCfg = Debug|Win32
+ {276D20F5-2943-414C-0FF6-21F4723A5CF6}.Debug|Win32.Build.0 = Debug|Win32
+ {276D20F5-2943-414C-0FF6-21F4723A5CF6}.Release|Win32.ActiveCfg = Release|Win32
+ {276D20F5-2943-414C-0FF6-21F4723A5CF6}.Release|Win32.Build.0 = Release|Win32
+ {293E74D1-544C-D368-02A0-52F61A4D0679}.Debug|Win32.ActiveCfg = Debug|Win32
+ {293E74D1-544C-D368-02A0-52F61A4D0679}.Debug|Win32.Build.0 = Debug|Win32
+ {293E74D1-544C-D368-02A0-52F61A4D0679}.Release|Win32.ActiveCfg = Release|Win32
+ {293E74D1-544C-D368-02A0-52F61A4D0679}.Release|Win32.Build.0 = Release|Win32
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}.Debug|Win32.ActiveCfg = Debug|Win32
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}.Debug|Win32.Build.0 = Debug|Win32
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}.Release|Win32.ActiveCfg = Release|Win32
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}.Release|Win32.Build.0 = Release|Win32
+ {37E1BB43-65DC-A25A-042E-30B88E6C75A2}.Debug|Win32.ActiveCfg = Debug|Win32
+ {37E1BB43-65DC-A25A-042E-30B88E6C75A2}.Debug|Win32.Build.0 = Debug|Win32
+ {37E1BB43-65DC-A25A-042E-30B88E6C75A2}.Release|Win32.ActiveCfg = Release|Win32
+ {37E1BB43-65DC-A25A-042E-30B88E6C75A2}.Release|Win32.Build.0 = Release|Win32
+ {3B7F5656-177F-52EE-26B3-D6A75368D0A9}.Debug|Win32.ActiveCfg = Debug|Win32
+ {3B7F5656-177F-52EE-26B3-D6A75368D0A9}.Debug|Win32.Build.0 = Debug|Win32
+ {3B7F5656-177F-52EE-26B3-D6A75368D0A9}.Release|Win32.ActiveCfg = Release|Win32
+ {3B7F5656-177F-52EE-26B3-D6A75368D0A9}.Release|Win32.Build.0 = Release|Win32
+ {3F4D97A9-0809-E0E4-5A3F-B6ACB6EABB46}.Debug|Win32.ActiveCfg = Debug|Win32
+ {3F4D97A9-0809-E0E4-5A3F-B6ACB6EABB46}.Debug|Win32.Build.0 = Debug|Win32
+ {3F4D97A9-0809-E0E4-5A3F-B6ACB6EABB46}.Release|Win32.ActiveCfg = Release|Win32
+ {3F4D97A9-0809-E0E4-5A3F-B6ACB6EABB46}.Release|Win32.Build.0 = Release|Win32
+ {459E5678-892C-4EF9-6ED8-0D9E5272B4FF}.Debug|Win32.ActiveCfg = Debug|Win32
+ {459E5678-892C-4EF9-6ED8-0D9E5272B4FF}.Debug|Win32.Build.0 = Debug|Win32
+ {459E5678-892C-4EF9-6ED8-0D9E5272B4FF}.Release|Win32.ActiveCfg = Release|Win32
+ {459E5678-892C-4EF9-6ED8-0D9E5272B4FF}.Release|Win32.Build.0 = Release|Win32
+ {46160987-0221-9E14-3B88-80F9FCFCFFBF}.Debug|Win32.ActiveCfg = Debug|Win32
+ {46160987-0221-9E14-3B88-80F9FCFCFFBF}.Debug|Win32.Build.0 = Debug|Win32
+ {46160987-0221-9E14-3B88-80F9FCFCFFBF}.Release|Win32.ActiveCfg = Release|Win32
+ {46160987-0221-9E14-3B88-80F9FCFCFFBF}.Release|Win32.Build.0 = Release|Win32
+ {58BE89D7-25D5-CC84-EDBF-412C12C59709}.Debug|Win32.ActiveCfg = Debug|Win32
+ {58BE89D7-25D5-CC84-EDBF-412C12C59709}.Debug|Win32.Build.0 = Debug|Win32
+ {58BE89D7-25D5-CC84-EDBF-412C12C59709}.Release|Win32.ActiveCfg = Release|Win32
+ {58BE89D7-25D5-CC84-EDBF-412C12C59709}.Release|Win32.Build.0 = Release|Win32
+ {63FB0B97-D1D9-5158-8E85-7F5B1E403817}.Debug|Win32.ActiveCfg = Debug|Win32
+ {63FB0B97-D1D9-5158-8E85-7F5B1E403817}.Debug|Win32.Build.0 = Debug|Win32
+ {63FB0B97-D1D9-5158-8E85-7F5B1E403817}.Release|Win32.ActiveCfg = Release|Win32
+ {63FB0B97-D1D9-5158-8E85-7F5B1E403817}.Release|Win32.Build.0 = Release|Win32
+ {6BC75FF2-C11A-C393-F9BB-BF29FF29D736}.Debug|Win32.ActiveCfg = Debug|Win32
+ {6BC75FF2-C11A-C393-F9BB-BF29FF29D736}.Debug|Win32.Build.0 = Debug|Win32
+ {6BC75FF2-C11A-C393-F9BB-BF29FF29D736}.Release|Win32.ActiveCfg = Release|Win32
+ {6BC75FF2-C11A-C393-F9BB-BF29FF29D736}.Release|Win32.Build.0 = Release|Win32
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}.Debug|Win32.ActiveCfg = Debug|Win32
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}.Debug|Win32.Build.0 = Debug|Win32
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}.Release|Win32.ActiveCfg = Release|Win32
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}.Release|Win32.Build.0 = Release|Win32
+ {8C20B90A-FBCB-B63F-435A-3299A1C38B2C}.Debug|Win32.ActiveCfg = Debug|Win32
+ {8C20B90A-FBCB-B63F-435A-3299A1C38B2C}.Debug|Win32.Build.0 = Debug|Win32
+ {8C20B90A-FBCB-B63F-435A-3299A1C38B2C}.Release|Win32.ActiveCfg = Release|Win32
+ {8C20B90A-FBCB-B63F-435A-3299A1C38B2C}.Release|Win32.Build.0 = Release|Win32
+ {92582B26-5131-8C32-39D9-5768C7FA12B4}.Debug|Win32.ActiveCfg = Debug|Win32
+ {92582B26-5131-8C32-39D9-5768C7FA12B4}.Debug|Win32.Build.0 = Debug|Win32
+ {92582B26-5131-8C32-39D9-5768C7FA12B4}.Release|Win32.ActiveCfg = Release|Win32
+ {92582B26-5131-8C32-39D9-5768C7FA12B4}.Release|Win32.Build.0 = Release|Win32
+ {93B7F18A-947E-69A1-9CD8-D1E5144E792A}.Debug|Win32.ActiveCfg = Debug|Win32
+ {93B7F18A-947E-69A1-9CD8-D1E5144E792A}.Debug|Win32.Build.0 = Debug|Win32
+ {93B7F18A-947E-69A1-9CD8-D1E5144E792A}.Release|Win32.ActiveCfg = Release|Win32
+ {93B7F18A-947E-69A1-9CD8-D1E5144E792A}.Release|Win32.Build.0 = Release|Win32
+ {A6E86EB3-561F-9FAB-670F-EF23556344BE}.Debug|Win32.ActiveCfg = Debug|Win32
+ {A6E86EB3-561F-9FAB-670F-EF23556344BE}.Debug|Win32.Build.0 = Debug|Win32
+ {A6E86EB3-561F-9FAB-670F-EF23556344BE}.Release|Win32.ActiveCfg = Release|Win32
+ {A6E86EB3-561F-9FAB-670F-EF23556344BE}.Release|Win32.Build.0 = Release|Win32
+ {B4D06330-EED1-6F99-BCA4-2F913908C38A}.Debug|Win32.ActiveCfg = Debug|Win32
+ {B4D06330-EED1-6F99-BCA4-2F913908C38A}.Debug|Win32.Build.0 = Debug|Win32
+ {B4D06330-EED1-6F99-BCA4-2F913908C38A}.Release|Win32.ActiveCfg = Release|Win32
+ {B4D06330-EED1-6F99-BCA4-2F913908C38A}.Release|Win32.Build.0 = Release|Win32
+ {C15697F6-5057-016E-BD29-422971875679}.Debug|Win32.ActiveCfg = Debug|Win32
+ {C15697F6-5057-016E-BD29-422971875679}.Debug|Win32.Build.0 = Debug|Win32
+ {C15697F6-5057-016E-BD29-422971875679}.Release|Win32.ActiveCfg = Release|Win32
+ {C15697F6-5057-016E-BD29-422971875679}.Release|Win32.Build.0 = Release|Win32
+ {C7BAF548-697D-2DCB-9DF3-9D1506A7B444}.Debug|Win32.ActiveCfg = Debug|Win32
+ {C7BAF548-697D-2DCB-9DF3-9D1506A7B444}.Debug|Win32.Build.0 = Debug|Win32
+ {C7BAF548-697D-2DCB-9DF3-9D1506A7B444}.Release|Win32.ActiveCfg = Release|Win32
+ {C7BAF548-697D-2DCB-9DF3-9D1506A7B444}.Release|Win32.Build.0 = Release|Win32
+ {CBE3D362-43EA-60FC-D5AC-490039CA449A}.Debug|Win32.ActiveCfg = Debug|Win32
+ {CBE3D362-43EA-60FC-D5AC-490039CA449A}.Debug|Win32.Build.0 = Debug|Win32
+ {CBE3D362-43EA-60FC-D5AC-490039CA449A}.Release|Win32.ActiveCfg = Release|Win32
+ {CBE3D362-43EA-60FC-D5AC-490039CA449A}.Release|Win32.Build.0 = Release|Win32
+ {D048EF6F-5312-AF41-8D8A-DB22CD8634E6}.Debug|Win32.ActiveCfg = Debug|Win32
+ {D048EF6F-5312-AF41-8D8A-DB22CD8634E6}.Debug|Win32.Build.0 = Debug|Win32
+ {D048EF6F-5312-AF41-8D8A-DB22CD8634E6}.Release|Win32.ActiveCfg = Release|Win32
+ {D048EF6F-5312-AF41-8D8A-DB22CD8634E6}.Release|Win32.Build.0 = Release|Win32
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061}.Debug|Win32.ActiveCfg = Debug|Win32
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061}.Debug|Win32.Build.0 = Debug|Win32
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061}.Release|Win32.ActiveCfg = Release|Win32
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/chromium/third_party/angle/projects/samples/dds_to_header.vcxproj b/chromium/third_party/angle/projects/samples/dds_to_header.vcxproj
new file mode 100644
index 00000000000..fc3e2277ab5
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/dds_to_header.vcxproj
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{6BC75FF2-C11A-C393-F9BB-BF29FF29D736}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>dds_to_header</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
+ <PropertyGroup Label="Configuration">
+ <CharacterSet>MultiByte</CharacterSet>
+ <ConfigurationType>Application</ConfigurationType>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
+ <ImportGroup Label="ExtensionSettings"/>
+ <ImportGroup Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros"/>
+ <PropertyGroup>
+ <ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\..\third_party\cygwin\bin\;$(MSBuildProjectDirectory)\..\..\third_party\python_26\</ExecutablePath>
+ <OutDir>$(SolutionDir)$(Configuration)_$(Platform)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <TargetName>$(ProjectName)</TargetName>
+ <TargetPath>$(OutDir)\$(ProjectName)$(TargetExt)</TargetPath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\samples\dds_to_header\main.cpp"/>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
+ <ImportGroup Label="ExtensionTargets"/>
+</Project>
diff --git a/chromium/third_party/angle/projects/samples/dds_to_header.vcxproj.filters b/chromium/third_party/angle/projects/samples/dds_to_header.vcxproj.filters
new file mode 100644
index 00000000000..44302d5cff2
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/dds_to_header.vcxproj.filters
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="dds_to_header">
+ <UniqueIdentifier>{6F557D24-D36F-34F5-20A1-E400ED0EC3BE}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ <ClCompile Include="..\..\samples\dds_to_header\main.cpp">
+ <Filter>dds_to_header</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
diff --git a/chromium/third_party/angle/projects/samples/essl_to_glsl.vcxproj b/chromium/third_party/angle/projects/samples/essl_to_glsl.vcxproj
new file mode 100644
index 00000000000..8b7b3771a9e
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/essl_to_glsl.vcxproj
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{293E74D1-544C-D368-02A0-52F61A4D0679}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>essl_to_glsl</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
+ <PropertyGroup Label="Configuration">
+ <CharacterSet>MultiByte</CharacterSet>
+ <ConfigurationType>Application</ConfigurationType>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
+ <ImportGroup Label="ExtensionSettings"/>
+ <ImportGroup Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros"/>
+ <PropertyGroup>
+ <ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\..\third_party\cygwin\bin\;$(MSBuildProjectDirectory)\..\..\third_party\python_26\</ExecutablePath>
+ <OutDir>$(SolutionDir)$(Configuration)_$(Platform)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <TargetName>$(ProjectName)</TargetName>
+ <TargetPath>$(OutDir)\$(ProjectName)$(TargetExt)</TargetPath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;ANGLE_TRANSLATOR_STATIC;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;ANGLE_TRANSLATOR_STATIC;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;ANGLE_TRANSLATOR_STATIC;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;ANGLE_TRANSLATOR_STATIC;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\samples\translator\translator.cpp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\src\translator_static.vcxproj">
+ <Project>{19386E01-D811-FA3B-9F1E-122BB0C0E9F5}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\translator_lib.vcxproj">
+ <Project>{276D20F5-2943-414C-0FF6-21F4723A5CF6}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\preprocessor.vcxproj">
+ <Project>{C7BAF548-697D-2DCB-9DF3-9D1506A7B444}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
+ <ImportGroup Label="ExtensionTargets"/>
+</Project>
diff --git a/chromium/third_party/angle/projects/samples/essl_to_glsl.vcxproj.filters b/chromium/third_party/angle/projects/samples/essl_to_glsl.vcxproj.filters
new file mode 100644
index 00000000000..2d54f3c2a34
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/essl_to_glsl.vcxproj.filters
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="translator">
+ <UniqueIdentifier>{502101C2-1680-5126-1D2E-39419A1AE009}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ <ClCompile Include="..\..\samples\translator\translator.cpp">
+ <Filter>translator</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
diff --git a/chromium/third_party/angle/projects/samples/essl_to_hlsl.vcxproj b/chromium/third_party/angle/projects/samples/essl_to_hlsl.vcxproj
new file mode 100644
index 00000000000..827e6d056f8
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/essl_to_hlsl.vcxproj
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{B4D06330-EED1-6F99-BCA4-2F913908C38A}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>essl_to_hlsl</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
+ <PropertyGroup Label="Configuration">
+ <CharacterSet>MultiByte</CharacterSet>
+ <ConfigurationType>Application</ConfigurationType>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
+ <ImportGroup Label="ExtensionSettings"/>
+ <ImportGroup Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros"/>
+ <PropertyGroup>
+ <ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\..\third_party\cygwin\bin\;$(MSBuildProjectDirectory)\..\..\third_party\python_26\</ExecutablePath>
+ <OutDir>$(SolutionDir)$(Configuration)_$(Platform)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <TargetName>$(ProjectName)</TargetName>
+ <TargetPath>$(OutDir)\$(ProjectName)$(TargetExt)</TargetPath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\src;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;ANGLE_TRANSLATOR_STATIC;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\src;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;ANGLE_TRANSLATOR_STATIC;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\src;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;ANGLE_TRANSLATOR_STATIC;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\src;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;ANGLE_TRANSLATOR_STATIC;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\samples\translator\translator.cpp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\src\translator_static.vcxproj">
+ <Project>{19386E01-D811-FA3B-9F1E-122BB0C0E9F5}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\translator_lib.vcxproj">
+ <Project>{276D20F5-2943-414C-0FF6-21F4723A5CF6}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\preprocessor.vcxproj">
+ <Project>{C7BAF548-697D-2DCB-9DF3-9D1506A7B444}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
+ <ImportGroup Label="ExtensionTargets"/>
+</Project>
diff --git a/chromium/third_party/angle/projects/samples/essl_to_hlsl.vcxproj.filters b/chromium/third_party/angle/projects/samples/essl_to_hlsl.vcxproj.filters
new file mode 100644
index 00000000000..2d54f3c2a34
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/essl_to_hlsl.vcxproj.filters
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="translator">
+ <UniqueIdentifier>{502101C2-1680-5126-1D2E-39419A1AE009}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ <ClCompile Include="..\..\samples\translator\translator.cpp">
+ <Filter>translator</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
diff --git a/chromium/third_party/angle/projects/samples/hello_triangle.vcxproj b/chromium/third_party/angle/projects/samples/hello_triangle.vcxproj
new file mode 100644
index 00000000000..c45a35b61ea
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/hello_triangle.vcxproj
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{3F4D97A9-0809-E0E4-5A3F-B6ACB6EABB46}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>hello_triangle</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
+ <PropertyGroup Label="Configuration">
+ <CharacterSet>MultiByte</CharacterSet>
+ <ConfigurationType>Application</ConfigurationType>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
+ <ImportGroup Label="ExtensionSettings"/>
+ <ImportGroup Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros"/>
+ <PropertyGroup>
+ <ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\..\third_party\cygwin\bin\;$(MSBuildProjectDirectory)\..\..\third_party\python_26\</ExecutablePath>
+ <OutDir>$(SolutionDir)$(Configuration)_$(Platform)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <TargetName>$(ProjectName)</TargetName>
+ <TargetPath>$(OutDir)\$(ProjectName)$(TargetExt)</TargetPath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;4201;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;4201;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\samples\angle\hello_triangle\HelloTriangle.cpp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="sample_util.vcxproj">
+ <Project>{297C46B0-9263-A9EA-82B1-EA221E7D7C7F}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\libEGL.vcxproj">
+ <Project>{FBAEE4F6-562A-588F-01F9-72DCABB3B061}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\libGLESv2.vcxproj">
+ <Project>{7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
+ <ImportGroup Label="ExtensionTargets"/>
+</Project>
diff --git a/chromium/third_party/angle/projects/samples/hello_triangle.vcxproj.filters b/chromium/third_party/angle/projects/samples/hello_triangle.vcxproj.filters
new file mode 100644
index 00000000000..94b76890907
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/hello_triangle.vcxproj.filters
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="angle">
+ <UniqueIdentifier>{2039F76D-4C9A-B8A0-444A-4766C6F6104A}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="angle\hello_triangle">
+ <UniqueIdentifier>{52213713-898E-BFE8-332B-BEAA1ACC263E}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ <ClCompile Include="..\..\samples\angle\hello_triangle\HelloTriangle.cpp">
+ <Filter>angle\hello_triangle</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
diff --git a/chromium/third_party/angle/projects/samples/mip_map_2d.vcxproj b/chromium/third_party/angle/projects/samples/mip_map_2d.vcxproj
new file mode 100644
index 00000000000..f8c9543b062
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/mip_map_2d.vcxproj
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{A6E86EB3-561F-9FAB-670F-EF23556344BE}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>mip_map_2d</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
+ <PropertyGroup Label="Configuration">
+ <CharacterSet>MultiByte</CharacterSet>
+ <ConfigurationType>Application</ConfigurationType>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
+ <ImportGroup Label="ExtensionSettings"/>
+ <ImportGroup Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros"/>
+ <PropertyGroup>
+ <ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\..\third_party\cygwin\bin\;$(MSBuildProjectDirectory)\..\..\third_party\python_26\</ExecutablePath>
+ <OutDir>$(SolutionDir)$(Configuration)_$(Platform)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <TargetName>$(ProjectName)</TargetName>
+ <TargetPath>$(OutDir)\$(ProjectName)$(TargetExt)</TargetPath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;4201;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;4201;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\samples\angle\mip_map_2d\MipMap2D.cpp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="sample_util.vcxproj">
+ <Project>{297C46B0-9263-A9EA-82B1-EA221E7D7C7F}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\libEGL.vcxproj">
+ <Project>{FBAEE4F6-562A-588F-01F9-72DCABB3B061}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\libGLESv2.vcxproj">
+ <Project>{7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
+ <ImportGroup Label="ExtensionTargets"/>
+</Project>
diff --git a/chromium/third_party/angle/projects/samples/mip_map_2d.vcxproj.filters b/chromium/third_party/angle/projects/samples/mip_map_2d.vcxproj.filters
new file mode 100644
index 00000000000..d177a882754
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/mip_map_2d.vcxproj.filters
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="angle">
+ <UniqueIdentifier>{2039F76D-4C9A-B8A0-444A-4766C6F6104A}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="angle\mip_map_2d">
+ <UniqueIdentifier>{63DD2738-D3D7-E13E-A38C-0177BCB49114}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ <ClCompile Include="..\..\samples\angle\mip_map_2d\MipMap2D.cpp">
+ <Filter>angle\mip_map_2d</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
diff --git a/chromium/third_party/angle/projects/samples/multi_texture.vcxproj b/chromium/third_party/angle/projects/samples/multi_texture.vcxproj
new file mode 100644
index 00000000000..2c34b2f60ad
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/multi_texture.vcxproj
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{37E1BB43-65DC-A25A-042E-30B88E6C75A2}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>multi_texture</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
+ <PropertyGroup Label="Configuration">
+ <CharacterSet>MultiByte</CharacterSet>
+ <ConfigurationType>Application</ConfigurationType>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
+ <ImportGroup Label="ExtensionSettings"/>
+ <ImportGroup Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros"/>
+ <PropertyGroup>
+ <ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\..\third_party\cygwin\bin\;$(MSBuildProjectDirectory)\..\..\third_party\python_26\</ExecutablePath>
+ <OutDir>$(SolutionDir)$(Configuration)_$(Platform)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <TargetName>$(ProjectName)</TargetName>
+ <TargetPath>$(OutDir)\$(ProjectName)$(TargetExt)</TargetPath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;4201;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;4201;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\samples\angle\multi_texture\MultiTexture.cpp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <CustomBuild Include="..\..\samples\angle\multi_texture\lightmap.tga">
+ <FileType>Document</FileType>
+ <Command>call mkdir &quot;$(OutDir)&quot; 2&gt;nul &amp; set ERRORLEVEL=0 &amp; copy /Y &quot;..\..\samples\angle\multi_texture\lightmap.tga&quot; &quot;$(OutDir)lightmap.tga&quot;</Command>
+ <Message>Copying angle/multi_texture/lightmap.tga to $(OutDir)\lightmap.tga</Message>
+ <Outputs>$(OutDir)\lightmap.tga</Outputs>
+ </CustomBuild>
+ <CustomBuild Include="..\..\samples\angle\multi_texture\basemap.tga">
+ <FileType>Document</FileType>
+ <Command>call mkdir &quot;$(OutDir)&quot; 2&gt;nul &amp; set ERRORLEVEL=0 &amp; copy /Y &quot;..\..\samples\angle\multi_texture\basemap.tga&quot; &quot;$(OutDir)basemap.tga&quot;</Command>
+ <Message>Copying angle/multi_texture/basemap.tga to $(OutDir)\basemap.tga</Message>
+ <Outputs>$(OutDir)\basemap.tga</Outputs>
+ </CustomBuild>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="sample_util.vcxproj">
+ <Project>{297C46B0-9263-A9EA-82B1-EA221E7D7C7F}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\libEGL.vcxproj">
+ <Project>{FBAEE4F6-562A-588F-01F9-72DCABB3B061}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\libGLESv2.vcxproj">
+ <Project>{7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
+ <ImportGroup Label="ExtensionTargets"/>
+</Project>
diff --git a/chromium/third_party/angle/projects/samples/multi_texture.vcxproj.filters b/chromium/third_party/angle/projects/samples/multi_texture.vcxproj.filters
new file mode 100644
index 00000000000..58764c67707
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/multi_texture.vcxproj.filters
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="angle">
+ <UniqueIdentifier>{2039F76D-4C9A-B8A0-444A-4766C6F6104A}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="angle\multi_texture">
+ <UniqueIdentifier>{7EDA6A50-7444-2574-045E-767D27689CC9}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ <None Include="..\..\samples\angle\multi_texture\lightmap.tga">
+ <Filter>angle\multi_texture</Filter>
+ </None>
+ <None Include="..\..\samples\angle\multi_texture\basemap.tga">
+ <Filter>angle\multi_texture</Filter>
+ </None>
+ <ClCompile Include="..\..\samples\angle\multi_texture\MultiTexture.cpp">
+ <Filter>angle\multi_texture</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
diff --git a/chromium/third_party/angle/projects/samples/multiple_draw_buffers.vcxproj b/chromium/third_party/angle/projects/samples/multiple_draw_buffers.vcxproj
new file mode 100644
index 00000000000..ac8f4f0465a
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/multiple_draw_buffers.vcxproj
@@ -0,0 +1,153 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{58BE89D7-25D5-CC84-EDBF-412C12C59709}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>multiple_draw_buffers</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
+ <PropertyGroup Label="Configuration">
+ <CharacterSet>MultiByte</CharacterSet>
+ <ConfigurationType>Application</ConfigurationType>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
+ <ImportGroup Label="ExtensionSettings"/>
+ <ImportGroup Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros"/>
+ <PropertyGroup>
+ <ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\..\third_party\cygwin\bin\;$(MSBuildProjectDirectory)\..\..\third_party\python_26\</ExecutablePath>
+ <OutDir>$(SolutionDir)$(Configuration)_$(Platform)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <TargetName>$(ProjectName)</TargetName>
+ <TargetPath>$(OutDir)\$(ProjectName)$(TargetExt)</TargetPath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;4201;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;4201;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\samples\angle\multiple_draw_buffers\MultipleDrawBuffers.cpp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <CustomBuild Include="..\..\samples\angle\multiple_draw_buffers\multiple_draw_buffers_vs.glsl">
+ <FileType>Document</FileType>
+ <Command>call mkdir &quot;$(OutDir)&quot; 2&gt;nul &amp; set ERRORLEVEL=0 &amp; copy /Y &quot;..\..\samples\angle\multiple_draw_buffers\multiple_draw_buffers_vs.glsl&quot; &quot;$(OutDir)multiple_draw_buffers_vs.glsl&quot;</Command>
+ <Message>Copying angle/multiple_draw_buffers/multiple_draw_buffers_vs.glsl to $(OutDir)\multiple_draw_buffers_vs.glsl</Message>
+ <Outputs>$(OutDir)\multiple_draw_buffers_vs.glsl</Outputs>
+ </CustomBuild>
+ <CustomBuild Include="..\..\samples\angle\multiple_draw_buffers\multiple_draw_buffers_copy_fs.glsl">
+ <FileType>Document</FileType>
+ <Command>call mkdir &quot;$(OutDir)&quot; 2&gt;nul &amp; set ERRORLEVEL=0 &amp; copy /Y &quot;..\..\samples\angle\multiple_draw_buffers\multiple_draw_buffers_copy_fs.glsl&quot; &quot;$(OutDir)multiple_draw_buffers_copy_fs.glsl&quot;</Command>
+ <Message>Copying angle/multiple_draw_buffers/multiple_draw_buffers_copy_fs.glsl to $(OutDir)\multiple_draw_buffers_copy_fs.glsl</Message>
+ <Outputs>$(OutDir)\multiple_draw_buffers_copy_fs.glsl</Outputs>
+ </CustomBuild>
+ <CustomBuild Include="..\..\samples\angle\multiple_draw_buffers\multiple_draw_buffers_fs.glsl">
+ <FileType>Document</FileType>
+ <Command>call mkdir &quot;$(OutDir)&quot; 2&gt;nul &amp; set ERRORLEVEL=0 &amp; copy /Y &quot;..\..\samples\angle\multiple_draw_buffers\multiple_draw_buffers_fs.glsl&quot; &quot;$(OutDir)multiple_draw_buffers_fs.glsl&quot;</Command>
+ <Message>Copying angle/multiple_draw_buffers/multiple_draw_buffers_fs.glsl to $(OutDir)\multiple_draw_buffers_fs.glsl</Message>
+ <Outputs>$(OutDir)\multiple_draw_buffers_fs.glsl</Outputs>
+ </CustomBuild>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="sample_util.vcxproj">
+ <Project>{297C46B0-9263-A9EA-82B1-EA221E7D7C7F}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\libEGL.vcxproj">
+ <Project>{FBAEE4F6-562A-588F-01F9-72DCABB3B061}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\libGLESv2.vcxproj">
+ <Project>{7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
+ <ImportGroup Label="ExtensionTargets"/>
+</Project>
diff --git a/chromium/third_party/angle/projects/samples/multiple_draw_buffers.vcxproj.filters b/chromium/third_party/angle/projects/samples/multiple_draw_buffers.vcxproj.filters
new file mode 100644
index 00000000000..86050907579
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/multiple_draw_buffers.vcxproj.filters
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="angle">
+ <UniqueIdentifier>{2039F76D-4C9A-B8A0-444A-4766C6F6104A}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="angle\multiple_draw_buffers">
+ <UniqueIdentifier>{D0BAF5AC-C79C-4569-5154-A04FD87C707E}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ <None Include="..\..\samples\angle\multiple_draw_buffers\multiple_draw_buffers_copy_fs.glsl">
+ <Filter>angle\multiple_draw_buffers</Filter>
+ </None>
+ <None Include="..\..\samples\angle\multiple_draw_buffers\multiple_draw_buffers_vs.glsl">
+ <Filter>angle\multiple_draw_buffers</Filter>
+ </None>
+ <ClCompile Include="..\..\samples\angle\multiple_draw_buffers\MultipleDrawBuffers.cpp">
+ <Filter>angle\multiple_draw_buffers</Filter>
+ </ClCompile>
+ <None Include="..\..\samples\angle\multiple_draw_buffers\multiple_draw_buffers_fs.glsl">
+ <Filter>angle\multiple_draw_buffers</Filter>
+ </None>
+ </ItemGroup>
+</Project>
diff --git a/chromium/third_party/angle/projects/samples/particle_system.vcxproj b/chromium/third_party/angle/projects/samples/particle_system.vcxproj
new file mode 100644
index 00000000000..fb6a6c3c4bd
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/particle_system.vcxproj
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{8C20B90A-FBCB-B63F-435A-3299A1C38B2C}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>particle_system</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
+ <PropertyGroup Label="Configuration">
+ <CharacterSet>MultiByte</CharacterSet>
+ <ConfigurationType>Application</ConfigurationType>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
+ <ImportGroup Label="ExtensionSettings"/>
+ <ImportGroup Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros"/>
+ <PropertyGroup>
+ <ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\..\third_party\cygwin\bin\;$(MSBuildProjectDirectory)\..\..\third_party\python_26\</ExecutablePath>
+ <OutDir>$(SolutionDir)$(Configuration)_$(Platform)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <TargetName>$(ProjectName)</TargetName>
+ <TargetPath>$(OutDir)\$(ProjectName)$(TargetExt)</TargetPath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;4201;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;4201;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\samples\angle\particle_system\ParticleSystem.cpp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <CustomBuild Include="..\..\samples\angle\particle_system\smoke.tga">
+ <FileType>Document</FileType>
+ <Command>call mkdir &quot;$(OutDir)&quot; 2&gt;nul &amp; set ERRORLEVEL=0 &amp; copy /Y &quot;..\..\samples\angle\particle_system\smoke.tga&quot; &quot;$(OutDir)smoke.tga&quot;</Command>
+ <Message>Copying angle/particle_system/smoke.tga to $(OutDir)\smoke.tga</Message>
+ <Outputs>$(OutDir)\smoke.tga</Outputs>
+ </CustomBuild>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="sample_util.vcxproj">
+ <Project>{297C46B0-9263-A9EA-82B1-EA221E7D7C7F}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\libEGL.vcxproj">
+ <Project>{FBAEE4F6-562A-588F-01F9-72DCABB3B061}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\libGLESv2.vcxproj">
+ <Project>{7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
+ <ImportGroup Label="ExtensionTargets"/>
+</Project>
diff --git a/chromium/third_party/angle/projects/samples/particle_system.vcxproj.filters b/chromium/third_party/angle/projects/samples/particle_system.vcxproj.filters
new file mode 100644
index 00000000000..f88f2d000fc
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/particle_system.vcxproj.filters
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="angle">
+ <UniqueIdentifier>{2039F76D-4C9A-B8A0-444A-4766C6F6104A}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="angle\particle_system">
+ <UniqueIdentifier>{BF3D6113-EF81-F63D-D06D-FD080BFBE471}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ <ClCompile Include="..\..\samples\angle\particle_system\ParticleSystem.cpp">
+ <Filter>angle\particle_system</Filter>
+ </ClCompile>
+ <None Include="..\..\samples\angle\particle_system\smoke.tga">
+ <Filter>angle\particle_system</Filter>
+ </None>
+ </ItemGroup>
+</Project>
diff --git a/chromium/third_party/angle/projects/samples/post_sub_buffer.vcxproj b/chromium/third_party/angle/projects/samples/post_sub_buffer.vcxproj
new file mode 100644
index 00000000000..a6768875e82
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/post_sub_buffer.vcxproj
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{CBE3D362-43EA-60FC-D5AC-490039CA449A}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>post_sub_buffer</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
+ <PropertyGroup Label="Configuration">
+ <CharacterSet>MultiByte</CharacterSet>
+ <ConfigurationType>Application</ConfigurationType>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
+ <ImportGroup Label="ExtensionSettings"/>
+ <ImportGroup Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros"/>
+ <PropertyGroup>
+ <ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\..\third_party\cygwin\bin\;$(MSBuildProjectDirectory)\..\..\third_party\python_26\</ExecutablePath>
+ <OutDir>$(SolutionDir)$(Configuration)_$(Platform)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <TargetName>$(ProjectName)</TargetName>
+ <TargetPath>$(OutDir)\$(ProjectName)$(TargetExt)</TargetPath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;4201;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;4201;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\samples\angle\post_sub_buffer\PostSubBuffer.cpp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="sample_util.vcxproj">
+ <Project>{297C46B0-9263-A9EA-82B1-EA221E7D7C7F}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\libEGL.vcxproj">
+ <Project>{FBAEE4F6-562A-588F-01F9-72DCABB3B061}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\libGLESv2.vcxproj">
+ <Project>{7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
+ <ImportGroup Label="ExtensionTargets"/>
+</Project>
diff --git a/chromium/third_party/angle/projects/samples/post_sub_buffer.vcxproj.filters b/chromium/third_party/angle/projects/samples/post_sub_buffer.vcxproj.filters
new file mode 100644
index 00000000000..e4ee1a6aad4
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/post_sub_buffer.vcxproj.filters
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="angle">
+ <UniqueIdentifier>{2039F76D-4C9A-B8A0-444A-4766C6F6104A}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="angle\post_sub_buffer">
+ <UniqueIdentifier>{662934E1-22DD-9C2B-5005-9C74A1B6424E}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ <ClCompile Include="..\..\samples\angle\post_sub_buffer\PostSubBuffer.cpp">
+ <Filter>angle\post_sub_buffer</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
diff --git a/chromium/third_party/angle/projects/samples/sample_util.vcxproj b/chromium/third_party/angle/projects/samples/sample_util.vcxproj
new file mode 100644
index 00000000000..ebba90f5863
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/sample_util.vcxproj
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{297C46B0-9263-A9EA-82B1-EA221E7D7C7F}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>sample_util</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
+ <PropertyGroup Label="Configuration">
+ <CharacterSet>MultiByte</CharacterSet>
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
+ <ImportGroup Label="ExtensionSettings"/>
+ <ImportGroup Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros"/>
+ <PropertyGroup>
+ <ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\..\third_party\cygwin\bin\;$(MSBuildProjectDirectory)\..\..\third_party\python_26\</ExecutablePath>
+ <OutDir>$(SolutionDir)$(Configuration)_$(Platform)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <TargetName>$(ProjectName)</TargetName>
+ <TargetPath>$(OutDir)lib\$(ProjectName)$(TargetExt)</TargetPath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4201;4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <OutputFile>$(OutDir)lib\$(ProjectName)$(TargetExt)</OutputFile>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4201;4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <OutputFile>$(OutDir)lib\$(ProjectName)$(TargetExt)</OutputFile>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\samples\angle\sample_util\Window.h"/>
+ <ClInclude Include="..\..\samples\angle\sample_util\path_utils.h"/>
+ <ClInclude Include="..\..\samples\angle\sample_util\Vector.h"/>
+ <ClInclude Include="..\..\samples\angle\sample_util\keyboard.h"/>
+ <ClInclude Include="..\..\samples\angle\sample_util\shader_utils.h"/>
+ <ClInclude Include="..\..\samples\angle\sample_util\Matrix.h"/>
+ <ClInclude Include="..\..\samples\angle\sample_util\Timer.h"/>
+ <ClInclude Include="..\..\samples\angle\sample_util\mouse.h"/>
+ <ClInclude Include="..\..\samples\angle\sample_util\geometry_utils.h"/>
+ <ClInclude Include="..\..\samples\angle\sample_util\Event.h"/>
+ <ClInclude Include="..\..\samples\angle\sample_util\random_utils.h"/>
+ <ClInclude Include="..\..\samples\angle\sample_util\tga_utils.h"/>
+ <ClInclude Include="..\..\samples\angle\sample_util\SampleApplication.h"/>
+ <ClInclude Include="..\..\samples\angle\sample_util\texture_utils.h"/>
+ <ClInclude Include="..\..\samples\angle\sample_util\win32\Win32Timer.h"/>
+ <ClInclude Include="..\..\samples\angle\sample_util\win32\Win32Window.h"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\samples\angle\sample_util\Window.cpp"/>
+ <ClCompile Include="..\..\samples\angle\sample_util\texture_utils.cpp"/>
+ <ClCompile Include="..\..\samples\angle\sample_util\Vector.cpp"/>
+ <ClCompile Include="..\..\samples\angle\sample_util\shader_utils.cpp"/>
+ <ClCompile Include="..\..\samples\angle\sample_util\SampleApplication.cpp"/>
+ <ClCompile Include="..\..\samples\angle\sample_util\geometry_utils.cpp"/>
+ <ClCompile Include="..\..\samples\angle\sample_util\tga_utils.cpp"/>
+ <ClCompile Include="..\..\samples\angle\sample_util\random_utils.cpp"/>
+ <ClCompile Include="..\..\samples\angle\sample_util\Matrix.cpp"/>
+ <ClCompile Include="..\..\samples\angle\sample_util\win32\Win32Timer.cpp"/>
+ <ClCompile Include="..\..\samples\angle\sample_util\win32\Win32Window.cpp"/>
+ <ClCompile Include="..\..\samples\angle\sample_util\win32\Win32_path_utils.cpp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\src\libEGL.vcxproj">
+ <Project>{FBAEE4F6-562A-588F-01F9-72DCABB3B061}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\libGLESv2.vcxproj">
+ <Project>{7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
+ <ImportGroup Label="ExtensionTargets"/>
+</Project>
diff --git a/chromium/third_party/angle/projects/samples/sample_util.vcxproj.filters b/chromium/third_party/angle/projects/samples/sample_util.vcxproj.filters
new file mode 100644
index 00000000000..5cd3b69d189
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/sample_util.vcxproj.filters
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="angle">
+ <UniqueIdentifier>{2039F76D-4C9A-B8A0-444A-4766C6F6104A}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="angle\sample_util">
+ <UniqueIdentifier>{60D21765-6E5A-8668-B584-931D7874AF54}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="angle\sample_util\win32">
+ <UniqueIdentifier>{789FEF16-EFE7-512E-F91B-DF7E0D72FB79}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ <ClCompile Include="..\..\samples\angle\sample_util\Window.cpp">
+ <Filter>angle\sample_util</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\samples\angle\sample_util\Window.h">
+ <Filter>angle\sample_util</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\samples\angle\sample_util\texture_utils.cpp">
+ <Filter>angle\sample_util</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\samples\angle\sample_util\path_utils.h">
+ <Filter>angle\sample_util</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\samples\angle\sample_util\Vector.cpp">
+ <Filter>angle\sample_util</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\samples\angle\sample_util\Vector.h">
+ <Filter>angle\sample_util</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\samples\angle\sample_util\keyboard.h">
+ <Filter>angle\sample_util</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\samples\angle\sample_util\shader_utils.h">
+ <Filter>angle\sample_util</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\samples\angle\sample_util\shader_utils.cpp">
+ <Filter>angle\sample_util</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\samples\angle\sample_util\Matrix.h">
+ <Filter>angle\sample_util</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\samples\angle\sample_util\Timer.h">
+ <Filter>angle\sample_util</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\samples\angle\sample_util\mouse.h">
+ <Filter>angle\sample_util</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\samples\angle\sample_util\geometry_utils.h">
+ <Filter>angle\sample_util</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\samples\angle\sample_util\Event.h">
+ <Filter>angle\sample_util</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\samples\angle\sample_util\SampleApplication.cpp">
+ <Filter>angle\sample_util</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\samples\angle\sample_util\geometry_utils.cpp">
+ <Filter>angle\sample_util</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\samples\angle\sample_util\random_utils.h">
+ <Filter>angle\sample_util</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\samples\angle\sample_util\tga_utils.cpp">
+ <Filter>angle\sample_util</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\samples\angle\sample_util\tga_utils.h">
+ <Filter>angle\sample_util</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\samples\angle\sample_util\random_utils.cpp">
+ <Filter>angle\sample_util</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\samples\angle\sample_util\SampleApplication.h">
+ <Filter>angle\sample_util</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\samples\angle\sample_util\Matrix.cpp">
+ <Filter>angle\sample_util</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\samples\angle\sample_util\texture_utils.h">
+ <Filter>angle\sample_util</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\samples\angle\sample_util\win32\Win32Timer.h">
+ <Filter>angle\sample_util\win32</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\samples\angle\sample_util\win32\Win32Timer.cpp">
+ <Filter>angle\sample_util\win32</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\samples\angle\sample_util\win32\Win32Window.cpp">
+ <Filter>angle\sample_util\win32</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\samples\angle\sample_util\win32\Win32Window.h">
+ <Filter>angle\sample_util\win32</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\samples\angle\sample_util\win32\Win32_path_utils.cpp">
+ <Filter>angle\sample_util\win32</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
diff --git a/chromium/third_party/angle/projects/samples/samples.sln b/chromium/third_party/angle/projects/samples/samples.sln
new file mode 100644
index 00000000000..b92786041d9
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/samples.sln
@@ -0,0 +1,252 @@
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual C++ Express 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "commit_id", "..\src\commit_id.vcxproj", "{3B7F5656-177F-52EE-26B3-D6A75368D0A9}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "copy_compiler_dll", "..\src\copy_compiler_dll.vcxproj", "{22DC02D5-1598-943C-13E1-82185B469F81}"
+ ProjectSection(ProjectDependencies) = postProject
+ {63FB0B97-D1D9-5158-8E85-7F5B1E403817} = {63FB0B97-D1D9-5158-8E85-7F5B1E403817}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "copy_scripts", "..\src\copy_scripts.vcxproj", "{63FB0B97-D1D9-5158-8E85-7F5B1E403817}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dds_to_header", "dds_to_header.vcxproj", "{6BC75FF2-C11A-C393-F9BB-BF29FF29D736}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "essl_to_glsl", "essl_to_glsl.vcxproj", "{293E74D1-544C-D368-02A0-52F61A4D0679}"
+ ProjectSection(ProjectDependencies) = postProject
+ {19386E01-D811-FA3B-9F1E-122BB0C0E9F5} = {19386E01-D811-FA3B-9F1E-122BB0C0E9F5}
+ {276D20F5-2943-414C-0FF6-21F4723A5CF6} = {276D20F5-2943-414C-0FF6-21F4723A5CF6}
+ {C7BAF548-697D-2DCB-9DF3-9D1506A7B444} = {C7BAF548-697D-2DCB-9DF3-9D1506A7B444}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "essl_to_hlsl", "essl_to_hlsl.vcxproj", "{B4D06330-EED1-6F99-BCA4-2F913908C38A}"
+ ProjectSection(ProjectDependencies) = postProject
+ {19386E01-D811-FA3B-9F1E-122BB0C0E9F5} = {19386E01-D811-FA3B-9F1E-122BB0C0E9F5}
+ {276D20F5-2943-414C-0FF6-21F4723A5CF6} = {276D20F5-2943-414C-0FF6-21F4723A5CF6}
+ {C7BAF548-697D-2DCB-9DF3-9D1506A7B444} = {C7BAF548-697D-2DCB-9DF3-9D1506A7B444}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hello_triangle", "hello_triangle.vcxproj", "{3F4D97A9-0809-E0E4-5A3F-B6ACB6EABB46}"
+ ProjectSection(ProjectDependencies) = postProject
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F} = {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061} = {FBAEE4F6-562A-588F-01F9-72DCABB3B061}
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libEGL", "..\src\libEGL.vcxproj", "{FBAEE4F6-562A-588F-01F9-72DCABB3B061}"
+ ProjectSection(ProjectDependencies) = postProject
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
+ {3B7F5656-177F-52EE-26B3-D6A75368D0A9} = {3B7F5656-177F-52EE-26B3-D6A75368D0A9}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libGLESv2", "..\src\libGLESv2.vcxproj", "{7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}"
+ ProjectSection(ProjectDependencies) = postProject
+ {C15697F6-5057-016E-BD29-422971875679} = {C15697F6-5057-016E-BD29-422971875679}
+ {3B7F5656-177F-52EE-26B3-D6A75368D0A9} = {3B7F5656-177F-52EE-26B3-D6A75368D0A9}
+ {22DC02D5-1598-943C-13E1-82185B469F81} = {22DC02D5-1598-943C-13E1-82185B469F81}
+ {276D20F5-2943-414C-0FF6-21F4723A5CF6} = {276D20F5-2943-414C-0FF6-21F4723A5CF6}
+ {C7BAF548-697D-2DCB-9DF3-9D1506A7B444} = {C7BAF548-697D-2DCB-9DF3-9D1506A7B444}
+ {63FB0B97-D1D9-5158-8E85-7F5B1E403817} = {63FB0B97-D1D9-5158-8E85-7F5B1E403817}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mip_map_2d", "mip_map_2d.vcxproj", "{A6E86EB3-561F-9FAB-670F-EF23556344BE}"
+ ProjectSection(ProjectDependencies) = postProject
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F} = {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061} = {FBAEE4F6-562A-588F-01F9-72DCABB3B061}
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_texture", "multi_texture.vcxproj", "{37E1BB43-65DC-A25A-042E-30B88E6C75A2}"
+ ProjectSection(ProjectDependencies) = postProject
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F} = {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061} = {FBAEE4F6-562A-588F-01F9-72DCABB3B061}
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multiple_draw_buffers", "multiple_draw_buffers.vcxproj", "{58BE89D7-25D5-CC84-EDBF-412C12C59709}"
+ ProjectSection(ProjectDependencies) = postProject
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F} = {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061} = {FBAEE4F6-562A-588F-01F9-72DCABB3B061}
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "particle_system", "particle_system.vcxproj", "{8C20B90A-FBCB-B63F-435A-3299A1C38B2C}"
+ ProjectSection(ProjectDependencies) = postProject
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F} = {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061} = {FBAEE4F6-562A-588F-01F9-72DCABB3B061}
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "post_sub_buffer", "post_sub_buffer.vcxproj", "{CBE3D362-43EA-60FC-D5AC-490039CA449A}"
+ ProjectSection(ProjectDependencies) = postProject
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F} = {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061} = {FBAEE4F6-562A-588F-01F9-72DCABB3B061}
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "preprocessor", "..\src\preprocessor.vcxproj", "{C7BAF548-697D-2DCB-9DF3-9D1506A7B444}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample_util", "sample_util.vcxproj", "{297C46B0-9263-A9EA-82B1-EA221E7D7C7F}"
+ ProjectSection(ProjectDependencies) = postProject
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061} = {FBAEE4F6-562A-588F-01F9-72DCABB3B061}
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simple_instancing", "simple_instancing.vcxproj", "{130A534E-6BA3-DB9C-B0D2-5ACE5CCB2632}"
+ ProjectSection(ProjectDependencies) = postProject
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F} = {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061} = {FBAEE4F6-562A-588F-01F9-72DCABB3B061}
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simple_texture_2d", "simple_texture_2d.vcxproj", "{0BD6333E-E82C-7665-C386-CDA40096413D}"
+ ProjectSection(ProjectDependencies) = postProject
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F} = {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061} = {FBAEE4F6-562A-588F-01F9-72DCABB3B061}
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simple_texture_cubemap", "simple_texture_cubemap.vcxproj", "{93B7F18A-947E-69A1-9CD8-D1E5144E792A}"
+ ProjectSection(ProjectDependencies) = postProject
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F} = {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061} = {FBAEE4F6-562A-588F-01F9-72DCABB3B061}
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simple_vertex_shader", "simple_vertex_shader.vcxproj", "{459E5678-892C-4EF9-6ED8-0D9E5272B4FF}"
+ ProjectSection(ProjectDependencies) = postProject
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F} = {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061} = {FBAEE4F6-562A-588F-01F9-72DCABB3B061}
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stencil_operations", "stencil_operations.vcxproj", "{92582B26-5131-8C32-39D9-5768C7FA12B4}"
+ ProjectSection(ProjectDependencies) = postProject
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F} = {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061} = {FBAEE4F6-562A-588F-01F9-72DCABB3B061}
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "texture_wrap", "texture_wrap.vcxproj", "{46160987-0221-9E14-3B88-80F9FCFCFFBF}"
+ ProjectSection(ProjectDependencies) = postProject
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F} = {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061} = {FBAEE4F6-562A-588F-01F9-72DCABB3B061}
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "translator", "..\src\translator.vcxproj", "{C15697F6-5057-016E-BD29-422971875679}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "translator_lib", "..\src\translator_lib.vcxproj", "{276D20F5-2943-414C-0FF6-21F4723A5CF6}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "translator_static", "..\src\translator_static.vcxproj", "{19386E01-D811-FA3B-9F1E-122BB0C0E9F5}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {0BD6333E-E82C-7665-C386-CDA40096413D}.Debug|Win32.ActiveCfg = Debug|Win32
+ {0BD6333E-E82C-7665-C386-CDA40096413D}.Debug|Win32.Build.0 = Debug|Win32
+ {0BD6333E-E82C-7665-C386-CDA40096413D}.Release|Win32.ActiveCfg = Release|Win32
+ {0BD6333E-E82C-7665-C386-CDA40096413D}.Release|Win32.Build.0 = Release|Win32
+ {130A534E-6BA3-DB9C-B0D2-5ACE5CCB2632}.Debug|Win32.ActiveCfg = Debug|Win32
+ {130A534E-6BA3-DB9C-B0D2-5ACE5CCB2632}.Debug|Win32.Build.0 = Debug|Win32
+ {130A534E-6BA3-DB9C-B0D2-5ACE5CCB2632}.Release|Win32.ActiveCfg = Release|Win32
+ {130A534E-6BA3-DB9C-B0D2-5ACE5CCB2632}.Release|Win32.Build.0 = Release|Win32
+ {19386E01-D811-FA3B-9F1E-122BB0C0E9F5}.Debug|Win32.ActiveCfg = Debug|Win32
+ {19386E01-D811-FA3B-9F1E-122BB0C0E9F5}.Debug|Win32.Build.0 = Debug|Win32
+ {19386E01-D811-FA3B-9F1E-122BB0C0E9F5}.Release|Win32.ActiveCfg = Release|Win32
+ {19386E01-D811-FA3B-9F1E-122BB0C0E9F5}.Release|Win32.Build.0 = Release|Win32
+ {22DC02D5-1598-943C-13E1-82185B469F81}.Debug|Win32.ActiveCfg = Debug|Win32
+ {22DC02D5-1598-943C-13E1-82185B469F81}.Debug|Win32.Build.0 = Debug|Win32
+ {22DC02D5-1598-943C-13E1-82185B469F81}.Release|Win32.ActiveCfg = Release|Win32
+ {22DC02D5-1598-943C-13E1-82185B469F81}.Release|Win32.Build.0 = Release|Win32
+ {276D20F5-2943-414C-0FF6-21F4723A5CF6}.Debug|Win32.ActiveCfg = Debug|Win32
+ {276D20F5-2943-414C-0FF6-21F4723A5CF6}.Debug|Win32.Build.0 = Debug|Win32
+ {276D20F5-2943-414C-0FF6-21F4723A5CF6}.Release|Win32.ActiveCfg = Release|Win32
+ {276D20F5-2943-414C-0FF6-21F4723A5CF6}.Release|Win32.Build.0 = Release|Win32
+ {293E74D1-544C-D368-02A0-52F61A4D0679}.Debug|Win32.ActiveCfg = Debug|Win32
+ {293E74D1-544C-D368-02A0-52F61A4D0679}.Debug|Win32.Build.0 = Debug|Win32
+ {293E74D1-544C-D368-02A0-52F61A4D0679}.Release|Win32.ActiveCfg = Release|Win32
+ {293E74D1-544C-D368-02A0-52F61A4D0679}.Release|Win32.Build.0 = Release|Win32
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}.Debug|Win32.ActiveCfg = Debug|Win32
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}.Debug|Win32.Build.0 = Debug|Win32
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}.Release|Win32.ActiveCfg = Release|Win32
+ {297C46B0-9263-A9EA-82B1-EA221E7D7C7F}.Release|Win32.Build.0 = Release|Win32
+ {37E1BB43-65DC-A25A-042E-30B88E6C75A2}.Debug|Win32.ActiveCfg = Debug|Win32
+ {37E1BB43-65DC-A25A-042E-30B88E6C75A2}.Debug|Win32.Build.0 = Debug|Win32
+ {37E1BB43-65DC-A25A-042E-30B88E6C75A2}.Release|Win32.ActiveCfg = Release|Win32
+ {37E1BB43-65DC-A25A-042E-30B88E6C75A2}.Release|Win32.Build.0 = Release|Win32
+ {3B7F5656-177F-52EE-26B3-D6A75368D0A9}.Debug|Win32.ActiveCfg = Debug|Win32
+ {3B7F5656-177F-52EE-26B3-D6A75368D0A9}.Debug|Win32.Build.0 = Debug|Win32
+ {3B7F5656-177F-52EE-26B3-D6A75368D0A9}.Release|Win32.ActiveCfg = Release|Win32
+ {3B7F5656-177F-52EE-26B3-D6A75368D0A9}.Release|Win32.Build.0 = Release|Win32
+ {3F4D97A9-0809-E0E4-5A3F-B6ACB6EABB46}.Debug|Win32.ActiveCfg = Debug|Win32
+ {3F4D97A9-0809-E0E4-5A3F-B6ACB6EABB46}.Debug|Win32.Build.0 = Debug|Win32
+ {3F4D97A9-0809-E0E4-5A3F-B6ACB6EABB46}.Release|Win32.ActiveCfg = Release|Win32
+ {3F4D97A9-0809-E0E4-5A3F-B6ACB6EABB46}.Release|Win32.Build.0 = Release|Win32
+ {459E5678-892C-4EF9-6ED8-0D9E5272B4FF}.Debug|Win32.ActiveCfg = Debug|Win32
+ {459E5678-892C-4EF9-6ED8-0D9E5272B4FF}.Debug|Win32.Build.0 = Debug|Win32
+ {459E5678-892C-4EF9-6ED8-0D9E5272B4FF}.Release|Win32.ActiveCfg = Release|Win32
+ {459E5678-892C-4EF9-6ED8-0D9E5272B4FF}.Release|Win32.Build.0 = Release|Win32
+ {46160987-0221-9E14-3B88-80F9FCFCFFBF}.Debug|Win32.ActiveCfg = Debug|Win32
+ {46160987-0221-9E14-3B88-80F9FCFCFFBF}.Debug|Win32.Build.0 = Debug|Win32
+ {46160987-0221-9E14-3B88-80F9FCFCFFBF}.Release|Win32.ActiveCfg = Release|Win32
+ {46160987-0221-9E14-3B88-80F9FCFCFFBF}.Release|Win32.Build.0 = Release|Win32
+ {58BE89D7-25D5-CC84-EDBF-412C12C59709}.Debug|Win32.ActiveCfg = Debug|Win32
+ {58BE89D7-25D5-CC84-EDBF-412C12C59709}.Debug|Win32.Build.0 = Debug|Win32
+ {58BE89D7-25D5-CC84-EDBF-412C12C59709}.Release|Win32.ActiveCfg = Release|Win32
+ {58BE89D7-25D5-CC84-EDBF-412C12C59709}.Release|Win32.Build.0 = Release|Win32
+ {63FB0B97-D1D9-5158-8E85-7F5B1E403817}.Debug|Win32.ActiveCfg = Debug|Win32
+ {63FB0B97-D1D9-5158-8E85-7F5B1E403817}.Debug|Win32.Build.0 = Debug|Win32
+ {63FB0B97-D1D9-5158-8E85-7F5B1E403817}.Release|Win32.ActiveCfg = Release|Win32
+ {63FB0B97-D1D9-5158-8E85-7F5B1E403817}.Release|Win32.Build.0 = Release|Win32
+ {6BC75FF2-C11A-C393-F9BB-BF29FF29D736}.Debug|Win32.ActiveCfg = Debug|Win32
+ {6BC75FF2-C11A-C393-F9BB-BF29FF29D736}.Debug|Win32.Build.0 = Debug|Win32
+ {6BC75FF2-C11A-C393-F9BB-BF29FF29D736}.Release|Win32.ActiveCfg = Release|Win32
+ {6BC75FF2-C11A-C393-F9BB-BF29FF29D736}.Release|Win32.Build.0 = Release|Win32
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}.Debug|Win32.ActiveCfg = Debug|Win32
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}.Debug|Win32.Build.0 = Debug|Win32
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}.Release|Win32.ActiveCfg = Release|Win32
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}.Release|Win32.Build.0 = Release|Win32
+ {8C20B90A-FBCB-B63F-435A-3299A1C38B2C}.Debug|Win32.ActiveCfg = Debug|Win32
+ {8C20B90A-FBCB-B63F-435A-3299A1C38B2C}.Debug|Win32.Build.0 = Debug|Win32
+ {8C20B90A-FBCB-B63F-435A-3299A1C38B2C}.Release|Win32.ActiveCfg = Release|Win32
+ {8C20B90A-FBCB-B63F-435A-3299A1C38B2C}.Release|Win32.Build.0 = Release|Win32
+ {92582B26-5131-8C32-39D9-5768C7FA12B4}.Debug|Win32.ActiveCfg = Debug|Win32
+ {92582B26-5131-8C32-39D9-5768C7FA12B4}.Debug|Win32.Build.0 = Debug|Win32
+ {92582B26-5131-8C32-39D9-5768C7FA12B4}.Release|Win32.ActiveCfg = Release|Win32
+ {92582B26-5131-8C32-39D9-5768C7FA12B4}.Release|Win32.Build.0 = Release|Win32
+ {93B7F18A-947E-69A1-9CD8-D1E5144E792A}.Debug|Win32.ActiveCfg = Debug|Win32
+ {93B7F18A-947E-69A1-9CD8-D1E5144E792A}.Debug|Win32.Build.0 = Debug|Win32
+ {93B7F18A-947E-69A1-9CD8-D1E5144E792A}.Release|Win32.ActiveCfg = Release|Win32
+ {93B7F18A-947E-69A1-9CD8-D1E5144E792A}.Release|Win32.Build.0 = Release|Win32
+ {A6E86EB3-561F-9FAB-670F-EF23556344BE}.Debug|Win32.ActiveCfg = Debug|Win32
+ {A6E86EB3-561F-9FAB-670F-EF23556344BE}.Debug|Win32.Build.0 = Debug|Win32
+ {A6E86EB3-561F-9FAB-670F-EF23556344BE}.Release|Win32.ActiveCfg = Release|Win32
+ {A6E86EB3-561F-9FAB-670F-EF23556344BE}.Release|Win32.Build.0 = Release|Win32
+ {B4D06330-EED1-6F99-BCA4-2F913908C38A}.Debug|Win32.ActiveCfg = Debug|Win32
+ {B4D06330-EED1-6F99-BCA4-2F913908C38A}.Debug|Win32.Build.0 = Debug|Win32
+ {B4D06330-EED1-6F99-BCA4-2F913908C38A}.Release|Win32.ActiveCfg = Release|Win32
+ {B4D06330-EED1-6F99-BCA4-2F913908C38A}.Release|Win32.Build.0 = Release|Win32
+ {C15697F6-5057-016E-BD29-422971875679}.Debug|Win32.ActiveCfg = Debug|Win32
+ {C15697F6-5057-016E-BD29-422971875679}.Debug|Win32.Build.0 = Debug|Win32
+ {C15697F6-5057-016E-BD29-422971875679}.Release|Win32.ActiveCfg = Release|Win32
+ {C15697F6-5057-016E-BD29-422971875679}.Release|Win32.Build.0 = Release|Win32
+ {C7BAF548-697D-2DCB-9DF3-9D1506A7B444}.Debug|Win32.ActiveCfg = Debug|Win32
+ {C7BAF548-697D-2DCB-9DF3-9D1506A7B444}.Debug|Win32.Build.0 = Debug|Win32
+ {C7BAF548-697D-2DCB-9DF3-9D1506A7B444}.Release|Win32.ActiveCfg = Release|Win32
+ {C7BAF548-697D-2DCB-9DF3-9D1506A7B444}.Release|Win32.Build.0 = Release|Win32
+ {CBE3D362-43EA-60FC-D5AC-490039CA449A}.Debug|Win32.ActiveCfg = Debug|Win32
+ {CBE3D362-43EA-60FC-D5AC-490039CA449A}.Debug|Win32.Build.0 = Debug|Win32
+ {CBE3D362-43EA-60FC-D5AC-490039CA449A}.Release|Win32.ActiveCfg = Release|Win32
+ {CBE3D362-43EA-60FC-D5AC-490039CA449A}.Release|Win32.Build.0 = Release|Win32
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061}.Debug|Win32.ActiveCfg = Debug|Win32
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061}.Debug|Win32.Build.0 = Debug|Win32
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061}.Release|Win32.ActiveCfg = Release|Win32
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/chromium/third_party/angle/projects/samples/simple_instancing.vcxproj b/chromium/third_party/angle/projects/samples/simple_instancing.vcxproj
new file mode 100644
index 00000000000..d75c8741f33
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/simple_instancing.vcxproj
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{130A534E-6BA3-DB9C-B0D2-5ACE5CCB2632}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>simple_instancing</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
+ <PropertyGroup Label="Configuration">
+ <CharacterSet>MultiByte</CharacterSet>
+ <ConfigurationType>Application</ConfigurationType>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
+ <ImportGroup Label="ExtensionSettings"/>
+ <ImportGroup Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros"/>
+ <PropertyGroup>
+ <ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\..\third_party\cygwin\bin\;$(MSBuildProjectDirectory)\..\..\third_party\python_26\</ExecutablePath>
+ <OutDir>$(SolutionDir)$(Configuration)_$(Platform)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <TargetName>$(ProjectName)</TargetName>
+ <TargetPath>$(OutDir)\$(ProjectName)$(TargetExt)</TargetPath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;4201;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;4201;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\samples\angle\simple_instancing\SimpleInstancing.cpp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="sample_util.vcxproj">
+ <Project>{297C46B0-9263-A9EA-82B1-EA221E7D7C7F}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\libEGL.vcxproj">
+ <Project>{FBAEE4F6-562A-588F-01F9-72DCABB3B061}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\libGLESv2.vcxproj">
+ <Project>{7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
+ <ImportGroup Label="ExtensionTargets"/>
+</Project>
diff --git a/chromium/third_party/angle/projects/samples/simple_instancing.vcxproj.filters b/chromium/third_party/angle/projects/samples/simple_instancing.vcxproj.filters
new file mode 100644
index 00000000000..d865f72a429
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/simple_instancing.vcxproj.filters
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="angle">
+ <UniqueIdentifier>{2039F76D-4C9A-B8A0-444A-4766C6F6104A}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="angle\simple_instancing">
+ <UniqueIdentifier>{AEBC5A90-1DEF-098F-9A8A-219A1BA9B797}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ <ClCompile Include="..\..\samples\angle\simple_instancing\SimpleInstancing.cpp">
+ <Filter>angle\simple_instancing</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
diff --git a/chromium/third_party/angle/projects/samples/simple_texture_2d.vcxproj b/chromium/third_party/angle/projects/samples/simple_texture_2d.vcxproj
new file mode 100644
index 00000000000..1f883e3c67c
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/simple_texture_2d.vcxproj
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{0BD6333E-E82C-7665-C386-CDA40096413D}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>simple_texture_2d</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
+ <PropertyGroup Label="Configuration">
+ <CharacterSet>MultiByte</CharacterSet>
+ <ConfigurationType>Application</ConfigurationType>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
+ <ImportGroup Label="ExtensionSettings"/>
+ <ImportGroup Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros"/>
+ <PropertyGroup>
+ <ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\..\third_party\cygwin\bin\;$(MSBuildProjectDirectory)\..\..\third_party\python_26\</ExecutablePath>
+ <OutDir>$(SolutionDir)$(Configuration)_$(Platform)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <TargetName>$(ProjectName)</TargetName>
+ <TargetPath>$(OutDir)\$(ProjectName)$(TargetExt)</TargetPath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;4201;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;4201;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\samples\angle\simple_texture_2d\SimpleTexture2D.cpp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="sample_util.vcxproj">
+ <Project>{297C46B0-9263-A9EA-82B1-EA221E7D7C7F}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\libEGL.vcxproj">
+ <Project>{FBAEE4F6-562A-588F-01F9-72DCABB3B061}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\libGLESv2.vcxproj">
+ <Project>{7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
+ <ImportGroup Label="ExtensionTargets"/>
+</Project>
diff --git a/chromium/third_party/angle/projects/samples/simple_texture_2d.vcxproj.filters b/chromium/third_party/angle/projects/samples/simple_texture_2d.vcxproj.filters
new file mode 100644
index 00000000000..df9c43ab88c
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/simple_texture_2d.vcxproj.filters
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="angle">
+ <UniqueIdentifier>{2039F76D-4C9A-B8A0-444A-4766C6F6104A}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="angle\simple_texture_2d">
+ <UniqueIdentifier>{81ACC49D-70E1-3041-5EDD-DB5646897C0F}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ <ClCompile Include="..\..\samples\angle\simple_texture_2d\SimpleTexture2D.cpp">
+ <Filter>angle\simple_texture_2d</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
diff --git a/chromium/third_party/angle/projects/samples/simple_texture_cubemap.vcxproj b/chromium/third_party/angle/projects/samples/simple_texture_cubemap.vcxproj
new file mode 100644
index 00000000000..344a0c1aed6
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/simple_texture_cubemap.vcxproj
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{93B7F18A-947E-69A1-9CD8-D1E5144E792A}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>simple_texture_cubemap</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
+ <PropertyGroup Label="Configuration">
+ <CharacterSet>MultiByte</CharacterSet>
+ <ConfigurationType>Application</ConfigurationType>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
+ <ImportGroup Label="ExtensionSettings"/>
+ <ImportGroup Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros"/>
+ <PropertyGroup>
+ <ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\..\third_party\cygwin\bin\;$(MSBuildProjectDirectory)\..\..\third_party\python_26\</ExecutablePath>
+ <OutDir>$(SolutionDir)$(Configuration)_$(Platform)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <TargetName>$(ProjectName)</TargetName>
+ <TargetPath>$(OutDir)\$(ProjectName)$(TargetExt)</TargetPath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;4201;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;4201;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\samples\angle\simple_texture_cubemap\SimpleTextureCubemap.cpp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="sample_util.vcxproj">
+ <Project>{297C46B0-9263-A9EA-82B1-EA221E7D7C7F}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\libEGL.vcxproj">
+ <Project>{FBAEE4F6-562A-588F-01F9-72DCABB3B061}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\libGLESv2.vcxproj">
+ <Project>{7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
+ <ImportGroup Label="ExtensionTargets"/>
+</Project>
diff --git a/chromium/third_party/angle/projects/samples/simple_texture_cubemap.vcxproj.filters b/chromium/third_party/angle/projects/samples/simple_texture_cubemap.vcxproj.filters
new file mode 100644
index 00000000000..04e94bcbbdd
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/simple_texture_cubemap.vcxproj.filters
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="angle">
+ <UniqueIdentifier>{2039F76D-4C9A-B8A0-444A-4766C6F6104A}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="angle\simple_texture_cubemap">
+ <UniqueIdentifier>{257CB9CA-65CC-C83E-62E1-287C2F99BFD1}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ <ClCompile Include="..\..\samples\angle\simple_texture_cubemap\SimpleTextureCubemap.cpp">
+ <Filter>angle\simple_texture_cubemap</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
diff --git a/chromium/third_party/angle/projects/samples/simple_vertex_shader.vcxproj b/chromium/third_party/angle/projects/samples/simple_vertex_shader.vcxproj
new file mode 100644
index 00000000000..89fd70562ed
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/simple_vertex_shader.vcxproj
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{459E5678-892C-4EF9-6ED8-0D9E5272B4FF}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>simple_vertex_shader</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
+ <PropertyGroup Label="Configuration">
+ <CharacterSet>MultiByte</CharacterSet>
+ <ConfigurationType>Application</ConfigurationType>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
+ <ImportGroup Label="ExtensionSettings"/>
+ <ImportGroup Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros"/>
+ <PropertyGroup>
+ <ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\..\third_party\cygwin\bin\;$(MSBuildProjectDirectory)\..\..\third_party\python_26\</ExecutablePath>
+ <OutDir>$(SolutionDir)$(Configuration)_$(Platform)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <TargetName>$(ProjectName)</TargetName>
+ <TargetPath>$(OutDir)\$(ProjectName)$(TargetExt)</TargetPath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;4201;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;4201;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\samples\angle\simple_vertex_shader\SimpleVertexShader.cpp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="sample_util.vcxproj">
+ <Project>{297C46B0-9263-A9EA-82B1-EA221E7D7C7F}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\libEGL.vcxproj">
+ <Project>{FBAEE4F6-562A-588F-01F9-72DCABB3B061}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\libGLESv2.vcxproj">
+ <Project>{7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
+ <ImportGroup Label="ExtensionTargets"/>
+</Project>
diff --git a/chromium/third_party/angle/projects/samples/simple_vertex_shader.vcxproj.filters b/chromium/third_party/angle/projects/samples/simple_vertex_shader.vcxproj.filters
new file mode 100644
index 00000000000..8ad33d4db1c
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/simple_vertex_shader.vcxproj.filters
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="angle">
+ <UniqueIdentifier>{2039F76D-4C9A-B8A0-444A-4766C6F6104A}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="angle\simple_vertex_shader">
+ <UniqueIdentifier>{B50155D0-892A-4C65-4754-9C5D58289F2E}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ <ClCompile Include="..\..\samples\angle\simple_vertex_shader\SimpleVertexShader.cpp">
+ <Filter>angle\simple_vertex_shader</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
diff --git a/chromium/third_party/angle/projects/samples/stencil_operations.vcxproj b/chromium/third_party/angle/projects/samples/stencil_operations.vcxproj
new file mode 100644
index 00000000000..3797c24cdbb
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/stencil_operations.vcxproj
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{92582B26-5131-8C32-39D9-5768C7FA12B4}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>stencil_operations</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
+ <PropertyGroup Label="Configuration">
+ <CharacterSet>MultiByte</CharacterSet>
+ <ConfigurationType>Application</ConfigurationType>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
+ <ImportGroup Label="ExtensionSettings"/>
+ <ImportGroup Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros"/>
+ <PropertyGroup>
+ <ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\..\third_party\cygwin\bin\;$(MSBuildProjectDirectory)\..\..\third_party\python_26\</ExecutablePath>
+ <OutDir>$(SolutionDir)$(Configuration)_$(Platform)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <TargetName>$(ProjectName)</TargetName>
+ <TargetPath>$(OutDir)\$(ProjectName)$(TargetExt)</TargetPath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;4201;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;4201;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\samples\angle\stencil_operations\StencilOperations.cpp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="sample_util.vcxproj">
+ <Project>{297C46B0-9263-A9EA-82B1-EA221E7D7C7F}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\libEGL.vcxproj">
+ <Project>{FBAEE4F6-562A-588F-01F9-72DCABB3B061}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\libGLESv2.vcxproj">
+ <Project>{7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
+ <ImportGroup Label="ExtensionTargets"/>
+</Project>
diff --git a/chromium/third_party/angle/projects/samples/stencil_operations.vcxproj.filters b/chromium/third_party/angle/projects/samples/stencil_operations.vcxproj.filters
new file mode 100644
index 00000000000..f3c07ead57f
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/stencil_operations.vcxproj.filters
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="angle">
+ <UniqueIdentifier>{2039F76D-4C9A-B8A0-444A-4766C6F6104A}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="angle\stencil_operations">
+ <UniqueIdentifier>{36BD90E0-1AC2-C244-DD65-86C57C57EA93}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ <ClCompile Include="..\..\samples\angle\stencil_operations\StencilOperations.cpp">
+ <Filter>angle\stencil_operations</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
diff --git a/chromium/third_party/angle/projects/samples/texture_wrap.vcxproj b/chromium/third_party/angle/projects/samples/texture_wrap.vcxproj
new file mode 100644
index 00000000000..33d23b69837
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/texture_wrap.vcxproj
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{46160987-0221-9E14-3B88-80F9FCFCFFBF}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>texture_wrap</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
+ <PropertyGroup Label="Configuration">
+ <CharacterSet>MultiByte</CharacterSet>
+ <ConfigurationType>Application</ConfigurationType>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
+ <ImportGroup Label="ExtensionSettings"/>
+ <ImportGroup Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros"/>
+ <PropertyGroup>
+ <ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\..\third_party\cygwin\bin\;$(MSBuildProjectDirectory)\..\..\third_party\python_26\</ExecutablePath>
+ <OutDir>$(SolutionDir)$(Configuration)_$(Platform)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <TargetName>$(ProjectName)</TargetName>
+ <TargetPath>$(OutDir)\$(ProjectName)$(TargetExt)</TargetPath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;4201;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;4201;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..\samples\angle\sample_util;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\samples\angle\texture_wrap\TextureWrap.cpp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="sample_util.vcxproj">
+ <Project>{297C46B0-9263-A9EA-82B1-EA221E7D7C7F}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\libEGL.vcxproj">
+ <Project>{FBAEE4F6-562A-588F-01F9-72DCABB3B061}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\src\libGLESv2.vcxproj">
+ <Project>{7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
+ <ImportGroup Label="ExtensionTargets"/>
+</Project>
diff --git a/chromium/third_party/angle/projects/samples/texture_wrap.vcxproj.filters b/chromium/third_party/angle/projects/samples/texture_wrap.vcxproj.filters
new file mode 100644
index 00000000000..1e6f5c8c15b
--- /dev/null
+++ b/chromium/third_party/angle/projects/samples/texture_wrap.vcxproj.filters
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="angle">
+ <UniqueIdentifier>{2039F76D-4C9A-B8A0-444A-4766C6F6104A}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="angle\texture_wrap">
+ <UniqueIdentifier>{14D5AFA5-3272-1D58-63E6-F5DE89477808}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\samples\samples.gyp"/>
+ <ClCompile Include="..\..\samples\angle\texture_wrap\TextureWrap.cpp">
+ <Filter>angle\texture_wrap</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
diff --git a/chromium/third_party/angle/projects/src/angle.sln b/chromium/third_party/angle/projects/src/angle.sln
new file mode 100644
index 00000000000..cdf9f53cbb1
--- /dev/null
+++ b/chromium/third_party/angle/projects/src/angle.sln
@@ -0,0 +1,82 @@
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual C++ Express 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "commit_id", "commit_id.vcxproj", "{3B7F5656-177F-52EE-26B3-D6A75368D0A9}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "copy_compiler_dll", "copy_compiler_dll.vcxproj", "{22DC02D5-1598-943C-13E1-82185B469F81}"
+ ProjectSection(ProjectDependencies) = postProject
+ {63FB0B97-D1D9-5158-8E85-7F5B1E403817} = {63FB0B97-D1D9-5158-8E85-7F5B1E403817}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "copy_scripts", "copy_scripts.vcxproj", "{63FB0B97-D1D9-5158-8E85-7F5B1E403817}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libEGL", "libEGL.vcxproj", "{FBAEE4F6-562A-588F-01F9-72DCABB3B061}"
+ ProjectSection(ProjectDependencies) = postProject
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81} = {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}
+ {3B7F5656-177F-52EE-26B3-D6A75368D0A9} = {3B7F5656-177F-52EE-26B3-D6A75368D0A9}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libGLESv2", "libGLESv2.vcxproj", "{7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}"
+ ProjectSection(ProjectDependencies) = postProject
+ {C15697F6-5057-016E-BD29-422971875679} = {C15697F6-5057-016E-BD29-422971875679}
+ {3B7F5656-177F-52EE-26B3-D6A75368D0A9} = {3B7F5656-177F-52EE-26B3-D6A75368D0A9}
+ {22DC02D5-1598-943C-13E1-82185B469F81} = {22DC02D5-1598-943C-13E1-82185B469F81}
+ {276D20F5-2943-414C-0FF6-21F4723A5CF6} = {276D20F5-2943-414C-0FF6-21F4723A5CF6}
+ {C7BAF548-697D-2DCB-9DF3-9D1506A7B444} = {C7BAF548-697D-2DCB-9DF3-9D1506A7B444}
+ {63FB0B97-D1D9-5158-8E85-7F5B1E403817} = {63FB0B97-D1D9-5158-8E85-7F5B1E403817}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "preprocessor", "preprocessor.vcxproj", "{C7BAF548-697D-2DCB-9DF3-9D1506A7B444}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "translator", "translator.vcxproj", "{C15697F6-5057-016E-BD29-422971875679}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "translator_lib", "translator_lib.vcxproj", "{276D20F5-2943-414C-0FF6-21F4723A5CF6}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "translator_static", "translator_static.vcxproj", "{19386E01-D811-FA3B-9F1E-122BB0C0E9F5}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {19386E01-D811-FA3B-9F1E-122BB0C0E9F5}.Debug|Win32.ActiveCfg = Debug|Win32
+ {19386E01-D811-FA3B-9F1E-122BB0C0E9F5}.Debug|Win32.Build.0 = Debug|Win32
+ {19386E01-D811-FA3B-9F1E-122BB0C0E9F5}.Release|Win32.ActiveCfg = Release|Win32
+ {19386E01-D811-FA3B-9F1E-122BB0C0E9F5}.Release|Win32.Build.0 = Release|Win32
+ {22DC02D5-1598-943C-13E1-82185B469F81}.Debug|Win32.ActiveCfg = Debug|Win32
+ {22DC02D5-1598-943C-13E1-82185B469F81}.Debug|Win32.Build.0 = Debug|Win32
+ {22DC02D5-1598-943C-13E1-82185B469F81}.Release|Win32.ActiveCfg = Release|Win32
+ {22DC02D5-1598-943C-13E1-82185B469F81}.Release|Win32.Build.0 = Release|Win32
+ {276D20F5-2943-414C-0FF6-21F4723A5CF6}.Debug|Win32.ActiveCfg = Debug|Win32
+ {276D20F5-2943-414C-0FF6-21F4723A5CF6}.Debug|Win32.Build.0 = Debug|Win32
+ {276D20F5-2943-414C-0FF6-21F4723A5CF6}.Release|Win32.ActiveCfg = Release|Win32
+ {276D20F5-2943-414C-0FF6-21F4723A5CF6}.Release|Win32.Build.0 = Release|Win32
+ {3B7F5656-177F-52EE-26B3-D6A75368D0A9}.Debug|Win32.ActiveCfg = Debug|Win32
+ {3B7F5656-177F-52EE-26B3-D6A75368D0A9}.Debug|Win32.Build.0 = Debug|Win32
+ {3B7F5656-177F-52EE-26B3-D6A75368D0A9}.Release|Win32.ActiveCfg = Release|Win32
+ {3B7F5656-177F-52EE-26B3-D6A75368D0A9}.Release|Win32.Build.0 = Release|Win32
+ {63FB0B97-D1D9-5158-8E85-7F5B1E403817}.Debug|Win32.ActiveCfg = Debug|Win32
+ {63FB0B97-D1D9-5158-8E85-7F5B1E403817}.Debug|Win32.Build.0 = Debug|Win32
+ {63FB0B97-D1D9-5158-8E85-7F5B1E403817}.Release|Win32.ActiveCfg = Release|Win32
+ {63FB0B97-D1D9-5158-8E85-7F5B1E403817}.Release|Win32.Build.0 = Release|Win32
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}.Debug|Win32.ActiveCfg = Debug|Win32
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}.Debug|Win32.Build.0 = Debug|Win32
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}.Release|Win32.ActiveCfg = Release|Win32
+ {7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}.Release|Win32.Build.0 = Release|Win32
+ {C15697F6-5057-016E-BD29-422971875679}.Debug|Win32.ActiveCfg = Debug|Win32
+ {C15697F6-5057-016E-BD29-422971875679}.Debug|Win32.Build.0 = Debug|Win32
+ {C15697F6-5057-016E-BD29-422971875679}.Release|Win32.ActiveCfg = Release|Win32
+ {C15697F6-5057-016E-BD29-422971875679}.Release|Win32.Build.0 = Release|Win32
+ {C7BAF548-697D-2DCB-9DF3-9D1506A7B444}.Debug|Win32.ActiveCfg = Debug|Win32
+ {C7BAF548-697D-2DCB-9DF3-9D1506A7B444}.Debug|Win32.Build.0 = Debug|Win32
+ {C7BAF548-697D-2DCB-9DF3-9D1506A7B444}.Release|Win32.ActiveCfg = Release|Win32
+ {C7BAF548-697D-2DCB-9DF3-9D1506A7B444}.Release|Win32.Build.0 = Release|Win32
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061}.Debug|Win32.ActiveCfg = Debug|Win32
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061}.Debug|Win32.Build.0 = Debug|Win32
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061}.Release|Win32.ActiveCfg = Release|Win32
+ {FBAEE4F6-562A-588F-01F9-72DCABB3B061}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/chromium/third_party/angle/projects/src/commit_id.vcxproj b/chromium/third_party/angle/projects/src/commit_id.vcxproj
new file mode 100644
index 00000000000..6acbadc7726
--- /dev/null
+++ b/chromium/third_party/angle/projects/src/commit_id.vcxproj
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{3B7F5656-177F-52EE-26B3-D6A75368D0A9}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>commit_id</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
+ <PropertyGroup Label="Configuration">
+ <CharacterSet>MultiByte</CharacterSet>
+ <ConfigurationType>Utility</ConfigurationType>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
+ <ImportGroup Label="ExtensionSettings"/>
+ <ImportGroup Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros"/>
+ <PropertyGroup>
+ <ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\..\third_party\cygwin\bin\;$(MSBuildProjectDirectory)\..\..\third_party\python_26\</ExecutablePath>
+ <OutDir>$(SolutionDir)$(Configuration)_$(Platform)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <TargetName>$(ProjectName)</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies></AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies></AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <None Include="..\..\src\angle.gyp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <CustomBuild Include="..\..\src\commit.h">
+ <FileType>Document</FileType>
+ <Command>call mkdir &quot;$(OutDir)obj\global_intermediate\angle\id&quot; 2&gt;nul &amp; set ERRORLEVEL=0 &amp; copy /Y &quot;..\..\src\commit.h&quot; &quot;$(OutDir)obj\global_intermediate\angle\id\commit.h&quot;</Command>
+ <Message>Copying commit.h to $(OutDir)obj/global_intermediate/angle/id\commit.h</Message>
+ <Outputs>$(OutDir)obj\global_intermediate\angle\id\commit.h</Outputs>
+ </CustomBuild>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
+ <ImportGroup Label="ExtensionTargets"/>
+</Project>
diff --git a/chromium/third_party/angle/projects/src/copy_compiler_dll.vcxproj b/chromium/third_party/angle/projects/src/copy_compiler_dll.vcxproj
new file mode 100644
index 00000000000..6b8587cdf5a
--- /dev/null
+++ b/chromium/third_party/angle/projects/src/copy_compiler_dll.vcxproj
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{22DC02D5-1598-943C-13E1-82185B469F81}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>copy_compiler_dll</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
+ <PropertyGroup Label="Configuration">
+ <CharacterSet>MultiByte</CharacterSet>
+ <ConfigurationType>Utility</ConfigurationType>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
+ <ImportGroup Label="ExtensionSettings"/>
+ <ImportGroup Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros"/>
+ <PropertyGroup>
+ <ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\..\third_party\cygwin\bin\;$(MSBuildProjectDirectory)\..\..\third_party\python_26\</ExecutablePath>
+ <OutDir>$(SolutionDir)$(Configuration)_$(Platform)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <TargetName>$(ProjectName)</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <None Include="..\..\src\angle.gyp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <CustomBuild Include="..\..\src\copy_compiler_dll.bat">
+ <FileType>Document</FileType>
+ <Command>call call $(OutDir)obj\global_intermediate\angle\copy_compiler_dll.bat &quot;$(Platform)&quot; &quot;C:\Program Files (x86)\Windows Kits\8.0&quot; &quot;$(OutDir)&quot;</Command>
+ <Message>Copying D3D Compiler DLL...</Message>
+ <Outputs>$(OutDir)\D3DCompiler_46.dll</Outputs>
+ </CustomBuild>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="copy_scripts.vcxproj">
+ <Project>{63FB0B97-D1D9-5158-8E85-7F5B1E403817}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
+ <ImportGroup Label="ExtensionTargets"/>
+</Project>
diff --git a/chromium/third_party/angle/projects/src/copy_compiler_dll.vcxproj.filters b/chromium/third_party/angle/projects/src/copy_compiler_dll.vcxproj.filters
new file mode 100644
index 00000000000..66954a4dd25
--- /dev/null
+++ b/chromium/third_party/angle/projects/src/copy_compiler_dll.vcxproj.filters
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="_excluded_files">
+ <UniqueIdentifier>{158E591E-B6EA-0C85-8F5A-18EAFA09B4CE}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\src\angle.gyp"/>
+ <None Include="..\..\src\copy_compiler_dll.bat">
+ <Filter>_excluded_files</Filter>
+ </None>
+ </ItemGroup>
+</Project>
diff --git a/chromium/third_party/angle/projects/src/copy_scripts.vcxproj b/chromium/third_party/angle/projects/src/copy_scripts.vcxproj
new file mode 100644
index 00000000000..748d69afbd6
--- /dev/null
+++ b/chromium/third_party/angle/projects/src/copy_scripts.vcxproj
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{63FB0B97-D1D9-5158-8E85-7F5B1E403817}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>copy_scripts</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
+ <PropertyGroup Label="Configuration">
+ <CharacterSet>MultiByte</CharacterSet>
+ <ConfigurationType>Utility</ConfigurationType>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
+ <ImportGroup Label="ExtensionSettings"/>
+ <ImportGroup Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros"/>
+ <PropertyGroup>
+ <ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\..\third_party\cygwin\bin\;$(MSBuildProjectDirectory)\..\..\third_party\python_26\</ExecutablePath>
+ <OutDir>$(SolutionDir)$(Configuration)_$(Platform)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <TargetName>$(ProjectName)</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies></AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies></AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <None Include="..\..\src\angle.gyp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <CustomBuild Include="..\..\src\commit_id.py">
+ <FileType>Document</FileType>
+ <Command>call mkdir &quot;$(OutDir)obj\global_intermediate\angle&quot; 2&gt;nul &amp; set ERRORLEVEL=0 &amp; copy /Y &quot;..\..\src\commit_id.py&quot; &quot;$(OutDir)obj\global_intermediate\angle\commit_id.py&quot;</Command>
+ <Message>Copying commit_id.py to $(OutDir)obj/global_intermediate/angle\commit_id.py</Message>
+ <Outputs>$(OutDir)obj\global_intermediate\angle\commit_id.py</Outputs>
+ </CustomBuild>
+ <CustomBuild Include="..\..\src\copy_compiler_dll.bat">
+ <FileType>Document</FileType>
+ <Command>call mkdir &quot;$(OutDir)obj\global_intermediate\angle&quot; 2&gt;nul &amp; set ERRORLEVEL=0 &amp; copy /Y &quot;..\..\src\copy_compiler_dll.bat&quot; &quot;$(OutDir)obj\global_intermediate\angle\copy_compiler_dll.bat&quot;</Command>
+ <Message>Copying copy_compiler_dll.bat to $(OutDir)obj/global_intermediate/angle\copy_compiler_dll.bat</Message>
+ <Outputs>$(OutDir)obj\global_intermediate\angle\copy_compiler_dll.bat</Outputs>
+ </CustomBuild>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
+ <ImportGroup Label="ExtensionTargets"/>
+</Project>
diff --git a/chromium/third_party/angle/projects/src/libEGL.vcxproj b/chromium/third_party/angle/projects/src/libEGL.vcxproj
new file mode 100644
index 00000000000..4daf31da16b
--- /dev/null
+++ b/chromium/third_party/angle/projects/src/libEGL.vcxproj
@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{FBAEE4F6-562A-588F-01F9-72DCABB3B061}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>libEGL</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
+ <PropertyGroup Label="Configuration">
+ <CharacterSet>MultiByte</CharacterSet>
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
+ <ImportGroup Label="ExtensionSettings"/>
+ <ImportGroup Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros"/>
+ <PropertyGroup>
+ <ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\..\third_party\cygwin\bin\;$(MSBuildProjectDirectory)\..\..\third_party\python_26\</ExecutablePath>
+ <OutDir>$(SolutionDir)$(Configuration)_$(Platform)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <TargetName>$(ProjectName)</TargetName>
+ <TargetPath>$(OutDir)\$(ProjectName)$(TargetExt)</TargetPath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\src;..\..\include;..\..\src\libGLESv2;$(OutDir)obj\global_intermediate\angle;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };GL_APICALL=;GL_GLEXT_PROTOTYPES=;EGLAPI=;NOMINMAX;ANGLE_ENABLE_PERF;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>d3d9.lib;kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <ModuleDefinitionFile>..\..\src\libEGL\libEGL.def</ModuleDefinitionFile>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\src;..\..\include;..\..\src\libGLESv2;$(OutDir)obj\global_intermediate\angle;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };GL_APICALL=;GL_GLEXT_PROTOTYPES=;EGLAPI=;NOMINMAX;ANGLE_ENABLE_PERF;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\src;..\..\include;..\..\src\libGLESv2;$(OutDir)obj\global_intermediate\angle;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };GL_APICALL=;GL_GLEXT_PROTOTYPES=;EGLAPI=;NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>d3d9.lib;kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <ModuleDefinitionFile>..\..\src\libEGL\libEGL.def</ModuleDefinitionFile>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\src;..\..\include;..\..\src\libGLESv2;$(OutDir)obj\global_intermediate\angle;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };GL_APICALL=;GL_GLEXT_PROTOTYPES=;EGLAPI=;NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <None Include="..\..\src\angle.gyp"/>
+ <None Include="..\..\src\libEGL\libEGL.def"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\src\libEGL\Surface.h"/>
+ <ClInclude Include="..\..\src\libEGL\resource.h"/>
+ <ClInclude Include="..\..\src\libEGL\Config.h"/>
+ <ClInclude Include="..\..\src\libEGL\main.h"/>
+ <ClInclude Include="..\..\src\libEGL\Display.h"/>
+ <ClInclude Include="..\..\src\common\RefCountObject.h"/>
+ <ClInclude Include="..\..\src\common\debug.h"/>
+ <ClInclude Include="..\..\src\common\mathutil.h"/>
+ <ClInclude Include="..\..\src\common\event_tracer.h"/>
+ <ClInclude Include="..\..\src\common\version.h"/>
+ <ClInclude Include="..\..\src\common\utilities.h"/>
+ <ClInclude Include="..\..\src\common\angleutils.h"/>
+ <ClInclude Include="..\..\src\common\shadervars.h"/>
+ <ClInclude Include="..\..\src\common\blocklayout.h"/>
+ <ClInclude Include="..\..\include\KHR\khrplatform.h"/>
+ <ClInclude Include="..\..\include\GLSLANG\ShaderLang.h"/>
+ <ClInclude Include="..\..\include\GLES2\gl2.h"/>
+ <ClInclude Include="..\..\include\GLES2\gl2platform.h"/>
+ <ClInclude Include="..\..\include\GLES2\gl2ext.h"/>
+ <ClInclude Include="..\..\include\GLES3\gl3ext.h"/>
+ <ClInclude Include="..\..\include\GLES3\gl3.h"/>
+ <ClInclude Include="..\..\include\GLES3\gl3platform.h"/>
+ <ClInclude Include="..\..\include\EGL\eglext.h"/>
+ <ClInclude Include="..\..\include\EGL\eglplatform.h"/>
+ <ClInclude Include="..\..\include\EGL\egl.h"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\libEGL\Surface.cpp"/>
+ <ClCompile Include="..\..\src\libEGL\Config.cpp"/>
+ <ClCompile Include="..\..\src\libEGL\main.cpp"/>
+ <ClCompile Include="..\..\src\libEGL\Display.cpp"/>
+ <ClCompile Include="..\..\src\libEGL\libEGL.cpp"/>
+ <ClCompile Include="..\..\src\common\mathutil.cpp"/>
+ <ClCompile Include="..\..\src\common\RefCountObject.cpp"/>
+ <ClCompile Include="..\..\src\common\debug.cpp"/>
+ <ClCompile Include="..\..\src\common\event_tracer.cpp"/>
+ <ClCompile Include="..\..\src\common\utilities.cpp"/>
+ <ClCompile Include="..\..\src\common\blocklayout.cpp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="..\..\src\libEGL\libEGL.rc"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="libGLESv2.vcxproj">
+ <Project>{7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="commit_id.vcxproj">
+ <Project>{3B7F5656-177F-52EE-26B3-D6A75368D0A9}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
+ <ImportGroup Label="ExtensionTargets"/>
+</Project>
diff --git a/chromium/third_party/angle/projects/src/libEGL.vcxproj.filters b/chromium/third_party/angle/projects/src/libEGL.vcxproj.filters
new file mode 100644
index 00000000000..5994e46b945
--- /dev/null
+++ b/chromium/third_party/angle/projects/src/libEGL.vcxproj.filters
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="src">
+ <UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="src\libEGL">
+ <UniqueIdentifier>{D633941D-C923-DFCE-3A9B-DCF851CC7DBA}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="src\common">
+ <UniqueIdentifier>{2F5FD094-EF52-77F7-7AA8-4327A01BF747}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="include">
+ <UniqueIdentifier>{57CA55B8-BCC5-4000-CE3A-58972F82E9CB}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="include\KHR">
+ <UniqueIdentifier>{6D4588DE-6319-FB13-135F-FA88843373FC}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="include\GLSLANG">
+ <UniqueIdentifier>{AD7D3D9B-E716-B150-1F3A-64569B7F5415}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="include\GLES2">
+ <UniqueIdentifier>{3FFE2AF8-8DA3-57BA-8037-4BE936BC5045}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="include\GLES3">
+ <UniqueIdentifier>{E18FF71E-3DE4-F6D0-36B6-93BA54EEDEE1}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="include\EGL">
+ <UniqueIdentifier>{79AE79DD-7922-70CC-3439-C9B3586338EF}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\src\angle.gyp">
+ <Filter>src</Filter>
+ </None>
+ <ClInclude Include="..\..\src\libEGL\Surface.h">
+ <Filter>src\libEGL</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libEGL\Surface.cpp">
+ <Filter>src\libEGL</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libEGL\Config.cpp">
+ <Filter>src\libEGL</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libEGL\resource.h">
+ <Filter>src\libEGL</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libEGL\main.cpp">
+ <Filter>src\libEGL</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libEGL\Config.h">
+ <Filter>src\libEGL</Filter>
+ </ClInclude>
+ <ResourceCompile Include="..\..\src\libEGL\libEGL.rc">
+ <Filter>src\libEGL</Filter>
+ </ResourceCompile>
+ <ClInclude Include="..\..\src\libEGL\main.h">
+ <Filter>src\libEGL</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libEGL\Display.h">
+ <Filter>src\libEGL</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libEGL\Display.cpp">
+ <Filter>src\libEGL</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libEGL\libEGL.cpp">
+ <Filter>src\libEGL</Filter>
+ </ClCompile>
+ <None Include="..\..\src\libEGL\libEGL.def">
+ <Filter>src\libEGL</Filter>
+ </None>
+ <ClCompile Include="..\..\src\common\mathutil.cpp">
+ <Filter>src\common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\common\RefCountObject.cpp">
+ <Filter>src\common</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\common\RefCountObject.h">
+ <Filter>src\common</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\common\debug.h">
+ <Filter>src\common</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\common\debug.cpp">
+ <Filter>src\common</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\common\mathutil.h">
+ <Filter>src\common</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\common\event_tracer.h">
+ <Filter>src\common</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\common\version.h">
+ <Filter>src\common</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\common\utilities.h">
+ <Filter>src\common</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\common\event_tracer.cpp">
+ <Filter>src\common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\common\utilities.cpp">
+ <Filter>src\common</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\common\angleutils.h">
+ <Filter>src\common</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\common\shadervars.h">
+ <Filter>src\common</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\common\blocklayout.h">
+ <Filter>src\common</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\common\blocklayout.cpp">
+ <Filter>src\common</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\include\KHR\khrplatform.h">
+ <Filter>include\KHR</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\GLSLANG\ShaderLang.h">
+ <Filter>include\GLSLANG</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\GLES2\gl2.h">
+ <Filter>include\GLES2</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\GLES2\gl2platform.h">
+ <Filter>include\GLES2</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\GLES2\gl2ext.h">
+ <Filter>include\GLES2</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\GLES3\gl3ext.h">
+ <Filter>include\GLES3</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\GLES3\gl3.h">
+ <Filter>include\GLES3</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\GLES3\gl3platform.h">
+ <Filter>include\GLES3</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\EGL\eglext.h">
+ <Filter>include\EGL</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\EGL\eglplatform.h">
+ <Filter>include\EGL</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\EGL\egl.h">
+ <Filter>include\EGL</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project>
diff --git a/chromium/third_party/angle/projects/src/libGLESv2.vcxproj b/chromium/third_party/angle/projects/src/libGLESv2.vcxproj
new file mode 100644
index 00000000000..28a77936a30
--- /dev/null
+++ b/chromium/third_party/angle/projects/src/libGLESv2.vcxproj
@@ -0,0 +1,409 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{7FBD6F69-B9A4-69F1-A12B-8DACB3F8CD81}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>libGLESv2</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
+ <PropertyGroup Label="Configuration">
+ <CharacterSet>MultiByte</CharacterSet>
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
+ <ImportGroup Label="ExtensionSettings"/>
+ <ImportGroup Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros"/>
+ <PropertyGroup>
+ <ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\..\third_party\cygwin\bin\;$(MSBuildProjectDirectory)\..\..\third_party\python_26\</ExecutablePath>
+ <OutDir>$(SolutionDir)$(Configuration)_$(Platform)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <TargetName>$(ProjectName)</TargetName>
+ <TargetPath>$(OutDir)\$(ProjectName)$(TargetExt)</TargetPath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\src;..\..\include;..\..\src\libGLESv2;$(OutDir)obj\global_intermediate\angle;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };GL_APICALL=;GL_GLEXT_PROTOTYPES=;EGLAPI=;NOMINMAX;ANGLE_ENABLE_D3D9;ANGLE_ENABLE_D3D11;ANGLE_ENABLE_PERF;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib;d3d9.lib;dxguid.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <ModuleDefinitionFile>..\..\src\libGLESv2\libGLESv2.def</ModuleDefinitionFile>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\src;..\..\include;..\..\src\libGLESv2;$(OutDir)obj\global_intermediate\angle;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };GL_APICALL=;GL_GLEXT_PROTOTYPES=;EGLAPI=;NOMINMAX;ANGLE_ENABLE_D3D9;ANGLE_ENABLE_D3D11;ANGLE_ENABLE_PERF;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\src;..\..\include;..\..\src\libGLESv2;$(OutDir)obj\global_intermediate\angle;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };GL_APICALL=;GL_GLEXT_PROTOTYPES=;EGLAPI=;NOMINMAX;ANGLE_ENABLE_D3D9;ANGLE_ENABLE_D3D11;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib;d3d9.lib;dxguid.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <ModuleDefinitionFile>..\..\src\libGLESv2\libGLESv2.def</ModuleDefinitionFile>
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\src;..\..\include;..\..\src\libGLESv2;$(OutDir)obj\global_intermediate\angle;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };GL_APICALL=;GL_GLEXT_PROTOTYPES=;EGLAPI=;NOMINMAX;ANGLE_ENABLE_D3D9;ANGLE_ENABLE_D3D11;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <None Include="..\..\src\angle.gyp"/>
+ <None Include="..\..\src\libGLESv2\libGLESv2.def"/>
+ <None Include="..\..\src\libGLESv2\renderer\d3d11\shaders\Clear11.hlsl"/>
+ <None Include="..\..\src\libGLESv2\renderer\d3d11\shaders\generate_shaders.bat"/>
+ <None Include="..\..\src\libGLESv2\renderer\d3d11\shaders\Swizzle11.hlsl"/>
+ <None Include="..\..\src\libGLESv2\renderer\d3d11\shaders\Passthrough2D11.hlsl"/>
+ <None Include="..\..\src\libGLESv2\renderer\d3d11\shaders\Passthrough3D11.hlsl"/>
+ <None Include="..\..\src\libGLESv2\renderer\d3d11\shaders\BufferToTexture11.hlsl"/>
+ <None Include="..\..\src\libGLESv2\renderer\d3d9\shaders\Blit.ps"/>
+ <None Include="..\..\src\libGLESv2\renderer\d3d9\shaders\Blit.vs"/>
+ <None Include="..\..\src\libGLESv2\renderer\d3d9\shaders\generate_shaders.bat"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\src\libGLESv2\Shader.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\BinaryStream.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\resource.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\Renderbuffer.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\precompiled.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\TransformFeedback.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\Context.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\Query.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\Texture.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\VertexArray.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\Uniform.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\ProgramBinary.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\constants.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\Buffer.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\RenderbufferProxySet.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\validationES.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\queryconversions.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\validationES3.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\Program.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\Sampler.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\HandleAllocator.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\ResourceManager.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\DynamicHLSL.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\VertexAttribute.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\validationES2.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\Fence.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\angletypes.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\main.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\FramebufferAttachment.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\Framebuffer.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\formatutils.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\IndexDataManager.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\Renderer.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\TextureStorage.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\imageformats.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\ShaderExecutable.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\IndexBuffer.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\loadimage.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\copyimage.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\copyvertex.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\BufferStorage.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\SwapChain.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\QueryImpl.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\IndexRangeCache.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\FenceImpl.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\Image.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\generatemip.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\RenderTarget.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\vertexconversion.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\VertexDataManager.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\VertexBuffer.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\PixelTransfer11.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\SwapChain11.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\VertexBuffer11.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\RenderStateCache.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\IndexBuffer11.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\Clear11.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\BufferStorage11.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\RenderTarget11.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\Image11.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\Renderer11.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\InputLayoutCache.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\renderer11_utils.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\TextureStorage11.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\ShaderExecutable11.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\Fence11.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\Query11.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\formatutils11.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\Blit11.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughr2di11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\buffertotexture11_gs.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughr2dui11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthrough2d11vs.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrg2d11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughr3di11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrg2di11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\swizzlei3dps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\clearsint11vs.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\clearuint11vs.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrgba3dui11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\swizzleui2darrayps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrgb2dui11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughlumalpha3d11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrg3di11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrg2dui11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\swizzleui2dps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrg3d11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\buffertotexture11_vs.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\swizzlef2dps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\swizzlef3dps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\buffertotexture11_ps_4f.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrgba2d11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrgb2di11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrgba3di11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrgb2d11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\clearsint11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\swizzleui3dps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\clearfloat11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrgb3di11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\swizzlei2dps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrgba3d11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthrough3d11gs.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\swizzlei2darrayps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\clearfloat11vs.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughlum3d11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrgba2di11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughlum2d11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughr3dui11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughr3d11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughdepth2d11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\buffertotexture11_ps_4ui.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughr2d11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\swizzlef2darrayps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrgb3d11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrgba2dui11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\buffertotexture11_ps_4i.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughlumalpha2d11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\clearuint11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrg3dui11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthrough3d11vs.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrgb3dui11ps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d\HLSLCompiler.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\IndexBuffer9.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\VertexDeclarationCache.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\ShaderCache.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\ShaderExecutable9.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\VertexBuffer9.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\Image9.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\SwapChain9.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\formatutils9.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\Renderer9.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\renderer9_utils.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\Blit9.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\Query9.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\Fence9.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\TextureStorage9.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\RenderTarget9.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\BufferStorage9.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\shaders\compiled\luminanceps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\shaders\compiled\passthroughps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\shaders\compiled\flipyvs.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\shaders\compiled\componentmaskps.h"/>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\shaders\compiled\standardvs.h"/>
+ <ClInclude Include="..\..\src\common\mathutil.h"/>
+ <ClInclude Include="..\..\src\common\blocklayout.h"/>
+ <ClInclude Include="..\..\src\common\debug.h"/>
+ <ClInclude Include="..\..\src\common\shadervars.h"/>
+ <ClInclude Include="..\..\src\common\utilities.h"/>
+ <ClInclude Include="..\..\src\common\angleutils.h"/>
+ <ClInclude Include="..\..\src\common\RefCountObject.h"/>
+ <ClInclude Include="..\..\src\common\event_tracer.h"/>
+ <ClInclude Include="..\..\src\common\version.h"/>
+ <ClInclude Include="..\..\src\third_party\systeminfo\SystemInfo.h"/>
+ <ClInclude Include="..\..\src\third_party\murmurhash\MurmurHash3.h"/>
+ <ClInclude Include="..\..\include\KHR\khrplatform.h"/>
+ <ClInclude Include="..\..\include\GLSLANG\ShaderLang.h"/>
+ <ClInclude Include="..\..\include\GLES2\gl2ext.h"/>
+ <ClInclude Include="..\..\include\GLES2\gl2.h"/>
+ <ClInclude Include="..\..\include\GLES2\gl2platform.h"/>
+ <ClInclude Include="..\..\include\GLES3\gl3ext.h"/>
+ <ClInclude Include="..\..\include\GLES3\gl3.h"/>
+ <ClInclude Include="..\..\include\GLES3\gl3platform.h"/>
+ <ClInclude Include="..\..\include\EGL\eglext.h"/>
+ <ClInclude Include="..\..\include\EGL\egl.h"/>
+ <ClInclude Include="..\..\include\EGL\eglplatform.h"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\libGLESv2\validationES2.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\precompiled.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\DynamicHLSL.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\HandleAllocator.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\queryconversions.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\RenderbufferProxySet.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\Fence.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\validationES.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\Renderbuffer.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\Program.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\angletypes.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\Float16ToFloat32.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\ResourceManager.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\validationES3.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\FramebufferAttachment.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\Query.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\libGLESv2.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\formatutils.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\Context.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\TransformFeedback.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\Buffer.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\VertexArray.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\Shader.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\Uniform.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\main.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\ProgramBinary.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\Sampler.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\Framebuffer.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\Texture.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\copyimage.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\IndexDataManager.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\IndexBuffer.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\loadimage.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\VertexDataManager.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\loadimageSSE2.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\VertexBuffer.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\Image.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\BufferStorage.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\IndexRangeCache.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\Renderer.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\TextureStorage.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\Clear11.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\Query11.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\TextureStorage11.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\ShaderExecutable11.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\VertexBuffer11.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\Renderer11.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\Blit11.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\RenderStateCache.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\RenderTarget11.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\InputLayoutCache.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\renderer11_utils.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\SwapChain11.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\IndexBuffer11.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\formatutils11.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\PixelTransfer11.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\Image11.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\Fence11.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\BufferStorage11.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d\HLSLCompiler.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d9\renderer9_utils.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d9\Image9.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d9\ShaderExecutable9.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d9\RenderTarget9.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d9\Renderer9.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d9\Fence9.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d9\SwapChain9.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d9\VertexBuffer9.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d9\Query9.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d9\VertexDeclarationCache.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d9\Blit9.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d9\BufferStorage9.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d9\TextureStorage9.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d9\IndexBuffer9.cpp"/>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d9\formatutils9.cpp"/>
+ <ClCompile Include="..\..\src\common\event_tracer.cpp"/>
+ <ClCompile Include="..\..\src\common\blocklayout.cpp"/>
+ <ClCompile Include="..\..\src\common\RefCountObject.cpp"/>
+ <ClCompile Include="..\..\src\common\utilities.cpp"/>
+ <ClCompile Include="..\..\src\common\mathutil.cpp"/>
+ <ClCompile Include="..\..\src\common\debug.cpp"/>
+ <ClCompile Include="..\..\src\third_party\systeminfo\SystemInfo.cpp"/>
+ <ClCompile Include="..\..\src\third_party\murmurhash\MurmurHash3.cpp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="..\..\src\libGLESv2\libGLESv2.rc"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="translator.vcxproj">
+ <Project>{C15697F6-5057-016E-BD29-422971875679}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="commit_id.vcxproj">
+ <Project>{3B7F5656-177F-52EE-26B3-D6A75368D0A9}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="copy_compiler_dll.vcxproj">
+ <Project>{22DC02D5-1598-943C-13E1-82185B469F81}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="translator_lib.vcxproj">
+ <Project>{276D20F5-2943-414C-0FF6-21F4723A5CF6}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="preprocessor.vcxproj">
+ <Project>{C7BAF548-697D-2DCB-9DF3-9D1506A7B444}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="copy_scripts.vcxproj">
+ <Project>{63FB0B97-D1D9-5158-8E85-7F5B1E403817}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
+ <ImportGroup Label="ExtensionTargets"/>
+</Project>
diff --git a/chromium/third_party/angle/projects/src/libGLESv2.vcxproj.filters b/chromium/third_party/angle/projects/src/libGLESv2.vcxproj.filters
new file mode 100644
index 00000000000..bee949152f4
--- /dev/null
+++ b/chromium/third_party/angle/projects/src/libGLESv2.vcxproj.filters
@@ -0,0 +1,847 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="src">
+ <UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="src\libGLESv2">
+ <UniqueIdentifier>{A62A9415-2E9D-A6D2-631D-1F25A5CD626F}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="src\libGLESv2\renderer">
+ <UniqueIdentifier>{AC4EF684-2900-10EA-3D11-A6DF0901358C}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="src\libGLESv2\renderer\d3d11">
+ <UniqueIdentifier>{10FB1414-88D2-B512-6D76-522749905268}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="src\libGLESv2\renderer\d3d11\shaders">
+ <UniqueIdentifier>{467D5622-06CC-2CF1-19E5-3CDD46A4008C}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="src\libGLESv2\renderer\d3d11\shaders\compiled">
+ <UniqueIdentifier>{F444E9E6-7D51-0546-F1E4-B6C8FCDA5FC6}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="src\libGLESv2\renderer\d3d">
+ <UniqueIdentifier>{3AC19AE3-A12C-4021-D645-4CEA5BC956DB}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="src\libGLESv2\renderer\d3d9">
+ <UniqueIdentifier>{8BB193D2-4A8B-A094-A81E-D5E262AB1F92}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="src\libGLESv2\renderer\d3d9\shaders">
+ <UniqueIdentifier>{467D5622-06CC-2CF1-19E5-3CDD46A4008C}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="src\libGLESv2\renderer\d3d9\shaders\compiled">
+ <UniqueIdentifier>{F444E9E6-7D51-0546-F1E4-B6C8FCDA5FC6}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="src\common">
+ <UniqueIdentifier>{2F5FD094-EF52-77F7-7AA8-4327A01BF747}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="src\third_party">
+ <UniqueIdentifier>{D6C6CEA7-AAD0-03AD-2394-AC6FCBF8A498}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="src\third_party\systeminfo">
+ <UniqueIdentifier>{8E42519F-DD71-5875-38CA-0ED32E34DB55}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="src\third_party\murmurhash">
+ <UniqueIdentifier>{FBF5769C-D63C-9100-0719-0B97CE76B013}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="include">
+ <UniqueIdentifier>{57CA55B8-BCC5-4000-CE3A-58972F82E9CB}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="include\KHR">
+ <UniqueIdentifier>{6D4588DE-6319-FB13-135F-FA88843373FC}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="include\GLSLANG">
+ <UniqueIdentifier>{AD7D3D9B-E716-B150-1F3A-64569B7F5415}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="include\GLES2">
+ <UniqueIdentifier>{3FFE2AF8-8DA3-57BA-8037-4BE936BC5045}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="include\GLES3">
+ <UniqueIdentifier>{E18FF71E-3DE4-F6D0-36B6-93BA54EEDEE1}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="include\EGL">
+ <UniqueIdentifier>{79AE79DD-7922-70CC-3439-C9B3586338EF}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\src\angle.gyp">
+ <Filter>src</Filter>
+ </None>
+ <ClInclude Include="..\..\src\libGLESv2\Shader.h">
+ <Filter>src\libGLESv2</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\validationES2.cpp">
+ <Filter>src\libGLESv2</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\BinaryStream.h">
+ <Filter>src\libGLESv2</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\resource.h">
+ <Filter>src\libGLESv2</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\precompiled.cpp">
+ <Filter>src\libGLESv2</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libGLESv2\DynamicHLSL.cpp">
+ <Filter>src\libGLESv2</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\Renderbuffer.h">
+ <Filter>src\libGLESv2</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\HandleAllocator.cpp">
+ <Filter>src\libGLESv2</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libGLESv2\queryconversions.cpp">
+ <Filter>src\libGLESv2</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\precompiled.h">
+ <Filter>src\libGLESv2</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\TransformFeedback.h">
+ <Filter>src\libGLESv2</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\Context.h">
+ <Filter>src\libGLESv2</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\Query.h">
+ <Filter>src\libGLESv2</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\RenderbufferProxySet.cpp">
+ <Filter>src\libGLESv2</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libGLESv2\Fence.cpp">
+ <Filter>src\libGLESv2</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\Texture.h">
+ <Filter>src\libGLESv2</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\validationES.cpp">
+ <Filter>src\libGLESv2</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libGLESv2\Renderbuffer.cpp">
+ <Filter>src\libGLESv2</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\VertexArray.h">
+ <Filter>src\libGLESv2</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\Uniform.h">
+ <Filter>src\libGLESv2</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\Program.cpp">
+ <Filter>src\libGLESv2</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libGLESv2\angletypes.cpp">
+ <Filter>src\libGLESv2</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libGLESv2\Float16ToFloat32.cpp">
+ <Filter>src\libGLESv2</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\ProgramBinary.h">
+ <Filter>src\libGLESv2</Filter>
+ </ClInclude>
+ <None Include="..\..\src\libGLESv2\libGLESv2.def">
+ <Filter>src\libGLESv2</Filter>
+ </None>
+ <ClCompile Include="..\..\src\libGLESv2\ResourceManager.cpp">
+ <Filter>src\libGLESv2</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libGLESv2\validationES3.cpp">
+ <Filter>src\libGLESv2</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\constants.h">
+ <Filter>src\libGLESv2</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\Buffer.h">
+ <Filter>src\libGLESv2</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\FramebufferAttachment.cpp">
+ <Filter>src\libGLESv2</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\RenderbufferProxySet.h">
+ <Filter>src\libGLESv2</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\Query.cpp">
+ <Filter>src\libGLESv2</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\validationES.h">
+ <Filter>src\libGLESv2</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\libGLESv2.cpp">
+ <Filter>src\libGLESv2</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\queryconversions.h">
+ <Filter>src\libGLESv2</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\validationES3.h">
+ <Filter>src\libGLESv2</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\Program.h">
+ <Filter>src\libGLESv2</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\Sampler.h">
+ <Filter>src\libGLESv2</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\HandleAllocator.h">
+ <Filter>src\libGLESv2</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\formatutils.cpp">
+ <Filter>src\libGLESv2</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\ResourceManager.h">
+ <Filter>src\libGLESv2</Filter>
+ </ClInclude>
+ <ResourceCompile Include="..\..\src\libGLESv2\libGLESv2.rc">
+ <Filter>src\libGLESv2</Filter>
+ </ResourceCompile>
+ <ClCompile Include="..\..\src\libGLESv2\Context.cpp">
+ <Filter>src\libGLESv2</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\DynamicHLSL.h">
+ <Filter>src\libGLESv2</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\TransformFeedback.cpp">
+ <Filter>src\libGLESv2</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\VertexAttribute.h">
+ <Filter>src\libGLESv2</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\validationES2.h">
+ <Filter>src\libGLESv2</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\Fence.h">
+ <Filter>src\libGLESv2</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\Buffer.cpp">
+ <Filter>src\libGLESv2</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\angletypes.h">
+ <Filter>src\libGLESv2</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\VertexArray.cpp">
+ <Filter>src\libGLESv2</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libGLESv2\Shader.cpp">
+ <Filter>src\libGLESv2</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libGLESv2\Uniform.cpp">
+ <Filter>src\libGLESv2</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libGLESv2\main.cpp">
+ <Filter>src\libGLESv2</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\main.h">
+ <Filter>src\libGLESv2</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\ProgramBinary.cpp">
+ <Filter>src\libGLESv2</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\FramebufferAttachment.h">
+ <Filter>src\libGLESv2</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\Sampler.cpp">
+ <Filter>src\libGLESv2</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\Framebuffer.h">
+ <Filter>src\libGLESv2</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\formatutils.h">
+ <Filter>src\libGLESv2</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\Framebuffer.cpp">
+ <Filter>src\libGLESv2</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libGLESv2\Texture.cpp">
+ <Filter>src\libGLESv2</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\IndexDataManager.h">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\copyimage.cpp">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\Renderer.h">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\IndexDataManager.cpp">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\TextureStorage.h">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\imageformats.h">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\IndexBuffer.cpp">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\ShaderExecutable.h">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\IndexBuffer.h">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\loadimage.h">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\copyimage.h">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\loadimage.cpp">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\VertexDataManager.cpp">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\loadimageSSE2.cpp">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\copyvertex.h">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\BufferStorage.h">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\VertexBuffer.cpp">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\SwapChain.h">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\Image.cpp">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\BufferStorage.cpp">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\QueryImpl.h">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\IndexRangeCache.h">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\FenceImpl.h">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\Image.h">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\generatemip.h">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\RenderTarget.h">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\vertexconversion.h">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\VertexDataManager.h">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\IndexRangeCache.cpp">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\VertexBuffer.h">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\Renderer.cpp">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\TextureStorage.cpp">
+ <Filter>src\libGLESv2\renderer</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\Clear11.cpp">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\Query11.cpp">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\PixelTransfer11.h">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\TextureStorage11.cpp">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\ShaderExecutable11.cpp">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\SwapChain11.h">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\VertexBuffer11.h">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\RenderStateCache.h">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\VertexBuffer11.cpp">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\Renderer11.cpp">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\IndexBuffer11.h">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\Clear11.h">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\BufferStorage11.h">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\RenderTarget11.h">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\Blit11.cpp">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\Image11.h">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\Renderer11.h">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\RenderStateCache.cpp">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\InputLayoutCache.h">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\RenderTarget11.cpp">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\InputLayoutCache.cpp">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\renderer11_utils.h">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\renderer11_utils.cpp">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\SwapChain11.cpp">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\TextureStorage11.h">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\ShaderExecutable11.h">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\Fence11.h">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\IndexBuffer11.cpp">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\formatutils11.cpp">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\PixelTransfer11.cpp">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\Query11.h">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\formatutils11.h">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\Blit11.h">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\Image11.cpp">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\Fence11.cpp">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d11\BufferStorage11.cpp">
+ <Filter>src\libGLESv2\renderer\d3d11</Filter>
+ </ClCompile>
+ <None Include="..\..\src\libGLESv2\renderer\d3d11\shaders\Clear11.hlsl">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders</Filter>
+ </None>
+ <None Include="..\..\src\libGLESv2\renderer\d3d11\shaders\generate_shaders.bat">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders</Filter>
+ </None>
+ <None Include="..\..\src\libGLESv2\renderer\d3d11\shaders\Swizzle11.hlsl">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders</Filter>
+ </None>
+ <None Include="..\..\src\libGLESv2\renderer\d3d11\shaders\Passthrough2D11.hlsl">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders</Filter>
+ </None>
+ <None Include="..\..\src\libGLESv2\renderer\d3d11\shaders\Passthrough3D11.hlsl">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders</Filter>
+ </None>
+ <None Include="..\..\src\libGLESv2\renderer\d3d11\shaders\BufferToTexture11.hlsl">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders</Filter>
+ </None>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughr2di11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\buffertotexture11_gs.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughr2dui11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthrough2d11vs.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrg2d11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughr3di11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrg2di11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\swizzlei3dps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\clearsint11vs.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\clearuint11vs.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrgba3dui11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\swizzleui2darrayps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrgb2dui11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughlumalpha3d11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrg3di11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrg2dui11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\swizzleui2dps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrg3d11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\buffertotexture11_vs.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\swizzlef2dps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\swizzlef3dps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\buffertotexture11_ps_4f.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrgba2d11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrgb2di11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrgba3di11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrgb2d11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\clearsint11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\swizzleui3dps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\clearfloat11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrgb3di11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\swizzlei2dps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrgba3d11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthrough3d11gs.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\swizzlei2darrayps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\clearfloat11vs.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughlum3d11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrgba2di11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughlum2d11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughr3dui11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughr3d11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughdepth2d11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\buffertotexture11_ps_4ui.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughr2d11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\swizzlef2darrayps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrgb3d11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrgba2dui11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\buffertotexture11_ps_4i.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughlumalpha2d11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\clearuint11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrg3dui11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthrough3d11vs.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d11\shaders\compiled\passthroughrgb3dui11ps.h">
+ <Filter>src\libGLESv2\renderer\d3d11\shaders\compiled</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d\HLSLCompiler.cpp">
+ <Filter>src\libGLESv2\renderer\d3d</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d\HLSLCompiler.h">
+ <Filter>src\libGLESv2\renderer\d3d</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d9\renderer9_utils.cpp">
+ <Filter>src\libGLESv2\renderer\d3d9</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\IndexBuffer9.h">
+ <Filter>src\libGLESv2\renderer\d3d9</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d9\Image9.cpp">
+ <Filter>src\libGLESv2\renderer\d3d9</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d9\ShaderExecutable9.cpp">
+ <Filter>src\libGLESv2\renderer\d3d9</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\VertexDeclarationCache.h">
+ <Filter>src\libGLESv2\renderer\d3d9</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\ShaderCache.h">
+ <Filter>src\libGLESv2\renderer\d3d9</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d9\RenderTarget9.cpp">
+ <Filter>src\libGLESv2\renderer\d3d9</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\ShaderExecutable9.h">
+ <Filter>src\libGLESv2\renderer\d3d9</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\VertexBuffer9.h">
+ <Filter>src\libGLESv2\renderer\d3d9</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d9\Renderer9.cpp">
+ <Filter>src\libGLESv2\renderer\d3d9</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\Image9.h">
+ <Filter>src\libGLESv2\renderer\d3d9</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\SwapChain9.h">
+ <Filter>src\libGLESv2\renderer\d3d9</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\formatutils9.h">
+ <Filter>src\libGLESv2\renderer\d3d9</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d9\Fence9.cpp">
+ <Filter>src\libGLESv2\renderer\d3d9</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d9\SwapChain9.cpp">
+ <Filter>src\libGLESv2\renderer\d3d9</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d9\VertexBuffer9.cpp">
+ <Filter>src\libGLESv2\renderer\d3d9</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\Renderer9.h">
+ <Filter>src\libGLESv2\renderer\d3d9</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d9\Query9.cpp">
+ <Filter>src\libGLESv2\renderer\d3d9</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d9\VertexDeclarationCache.cpp">
+ <Filter>src\libGLESv2\renderer\d3d9</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\renderer9_utils.h">
+ <Filter>src\libGLESv2\renderer\d3d9</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\Blit9.h">
+ <Filter>src\libGLESv2\renderer\d3d9</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d9\Blit9.cpp">
+ <Filter>src\libGLESv2\renderer\d3d9</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d9\BufferStorage9.cpp">
+ <Filter>src\libGLESv2\renderer\d3d9</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d9\TextureStorage9.cpp">
+ <Filter>src\libGLESv2\renderer\d3d9</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\Query9.h">
+ <Filter>src\libGLESv2\renderer\d3d9</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\Fence9.h">
+ <Filter>src\libGLESv2\renderer\d3d9</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\TextureStorage9.h">
+ <Filter>src\libGLESv2\renderer\d3d9</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d9\IndexBuffer9.cpp">
+ <Filter>src\libGLESv2\renderer\d3d9</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\RenderTarget9.h">
+ <Filter>src\libGLESv2\renderer\d3d9</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\libGLESv2\renderer\d3d9\formatutils9.cpp">
+ <Filter>src\libGLESv2\renderer\d3d9</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\BufferStorage9.h">
+ <Filter>src\libGLESv2\renderer\d3d9</Filter>
+ </ClInclude>
+ <None Include="..\..\src\libGLESv2\renderer\d3d9\shaders\Blit.ps">
+ <Filter>src\libGLESv2\renderer\d3d9\shaders</Filter>
+ </None>
+ <None Include="..\..\src\libGLESv2\renderer\d3d9\shaders\Blit.vs">
+ <Filter>src\libGLESv2\renderer\d3d9\shaders</Filter>
+ </None>
+ <None Include="..\..\src\libGLESv2\renderer\d3d9\shaders\generate_shaders.bat">
+ <Filter>src\libGLESv2\renderer\d3d9\shaders</Filter>
+ </None>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\shaders\compiled\luminanceps.h">
+ <Filter>src\libGLESv2\renderer\d3d9\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\shaders\compiled\passthroughps.h">
+ <Filter>src\libGLESv2\renderer\d3d9\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\shaders\compiled\flipyvs.h">
+ <Filter>src\libGLESv2\renderer\d3d9\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\shaders\compiled\componentmaskps.h">
+ <Filter>src\libGLESv2\renderer\d3d9\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\libGLESv2\renderer\d3d9\shaders\compiled\standardvs.h">
+ <Filter>src\libGLESv2\renderer\d3d9\shaders\compiled</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\common\mathutil.h">
+ <Filter>src\common</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\common\event_tracer.cpp">
+ <Filter>src\common</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\common\blocklayout.h">
+ <Filter>src\common</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\common\debug.h">
+ <Filter>src\common</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\common\shadervars.h">
+ <Filter>src\common</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\common\utilities.h">
+ <Filter>src\common</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\common\blocklayout.cpp">
+ <Filter>src\common</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\common\angleutils.h">
+ <Filter>src\common</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\common\RefCountObject.h">
+ <Filter>src\common</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\common\event_tracer.h">
+ <Filter>src\common</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\common\RefCountObject.cpp">
+ <Filter>src\common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\common\utilities.cpp">
+ <Filter>src\common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\common\mathutil.cpp">
+ <Filter>src\common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\common\debug.cpp">
+ <Filter>src\common</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\common\version.h">
+ <Filter>src\common</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\third_party\systeminfo\SystemInfo.h">
+ <Filter>src\third_party\systeminfo</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\third_party\systeminfo\SystemInfo.cpp">
+ <Filter>src\third_party\systeminfo</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\third_party\murmurhash\MurmurHash3.h">
+ <Filter>src\third_party\murmurhash</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\third_party\murmurhash\MurmurHash3.cpp">
+ <Filter>src\third_party\murmurhash</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\include\KHR\khrplatform.h">
+ <Filter>include\KHR</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\GLSLANG\ShaderLang.h">
+ <Filter>include\GLSLANG</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\GLES2\gl2ext.h">
+ <Filter>include\GLES2</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\GLES2\gl2.h">
+ <Filter>include\GLES2</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\GLES2\gl2platform.h">
+ <Filter>include\GLES2</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\GLES3\gl3ext.h">
+ <Filter>include\GLES3</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\GLES3\gl3.h">
+ <Filter>include\GLES3</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\GLES3\gl3platform.h">
+ <Filter>include\GLES3</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\EGL\eglext.h">
+ <Filter>include\EGL</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\EGL\egl.h">
+ <Filter>include\EGL</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\EGL\eglplatform.h">
+ <Filter>include\EGL</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project>
diff --git a/chromium/third_party/angle/projects/src/preprocessor.vcxproj b/chromium/third_party/angle/projects/src/preprocessor.vcxproj
new file mode 100644
index 00000000000..0b702e23e14
--- /dev/null
+++ b/chromium/third_party/angle/projects/src/preprocessor.vcxproj
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{C7BAF548-697D-2DCB-9DF3-9D1506A7B444}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>preprocessor</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
+ <PropertyGroup Label="Configuration">
+ <CharacterSet>MultiByte</CharacterSet>
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
+ <ImportGroup Label="ExtensionSettings"/>
+ <ImportGroup Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros"/>
+ <PropertyGroup>
+ <ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\..\third_party\cygwin\bin\;$(MSBuildProjectDirectory)\..\..\third_party\python_26\</ExecutablePath>
+ <OutDir>$(SolutionDir)$(Configuration)_$(Platform)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <TargetName>$(ProjectName)</TargetName>
+ <TargetPath>$(OutDir)lib\$(ProjectName)$(TargetExt)</TargetPath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <OutputFile>$(OutDir)lib\$(ProjectName)$(TargetExt)</OutputFile>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <OutputFile>$(OutDir)lib\$(ProjectName)$(TargetExt)</OutputFile>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <None Include="..\..\src\angle.gyp"/>
+ <None Include="..\..\src\compiler\preprocessor\ExpressionParser.y"/>
+ <None Include="..\..\src\compiler\preprocessor\Tokenizer.l"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\src\compiler\preprocessor\Tokenizer.h"/>
+ <ClInclude Include="..\..\src\compiler\preprocessor\Lexer.h"/>
+ <ClInclude Include="..\..\src\compiler\preprocessor\Token.h"/>
+ <ClInclude Include="..\..\src\compiler\preprocessor\Preprocessor.h"/>
+ <ClInclude Include="..\..\src\compiler\preprocessor\ExpressionParser.h"/>
+ <ClInclude Include="..\..\src\compiler\preprocessor\MacroExpander.h"/>
+ <ClInclude Include="..\..\src\compiler\preprocessor\Macro.h"/>
+ <ClInclude Include="..\..\src\compiler\preprocessor\pp_utils.h"/>
+ <ClInclude Include="..\..\src\compiler\preprocessor\Input.h"/>
+ <ClInclude Include="..\..\src\compiler\preprocessor\SourceLocation.h"/>
+ <ClInclude Include="..\..\src\compiler\preprocessor\numeric_lex.h"/>
+ <ClInclude Include="..\..\src\compiler\preprocessor\DirectiveParser.h"/>
+ <ClInclude Include="..\..\src\compiler\preprocessor\DiagnosticsBase.h"/>
+ <ClInclude Include="..\..\src\compiler\preprocessor\DirectiveHandlerBase.h"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\compiler\preprocessor\ExpressionParser.cpp"/>
+ <ClCompile Include="..\..\src\compiler\preprocessor\Input.cpp"/>
+ <ClCompile Include="..\..\src\compiler\preprocessor\Tokenizer.cpp"/>
+ <ClCompile Include="..\..\src\compiler\preprocessor\DirectiveHandlerBase.cpp"/>
+ <ClCompile Include="..\..\src\compiler\preprocessor\Lexer.cpp"/>
+ <ClCompile Include="..\..\src\compiler\preprocessor\Token.cpp"/>
+ <ClCompile Include="..\..\src\compiler\preprocessor\Macro.cpp"/>
+ <ClCompile Include="..\..\src\compiler\preprocessor\DiagnosticsBase.cpp"/>
+ <ClCompile Include="..\..\src\compiler\preprocessor\Preprocessor.cpp"/>
+ <ClCompile Include="..\..\src\compiler\preprocessor\DirectiveParser.cpp"/>
+ <ClCompile Include="..\..\src\compiler\preprocessor\MacroExpander.cpp"/>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
+ <ImportGroup Label="ExtensionTargets"/>
+</Project>
diff --git a/chromium/third_party/angle/projects/src/preprocessor.vcxproj.filters b/chromium/third_party/angle/projects/src/preprocessor.vcxproj.filters
new file mode 100644
index 00000000000..f61325000d8
--- /dev/null
+++ b/chromium/third_party/angle/projects/src/preprocessor.vcxproj.filters
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="compiler">
+ <UniqueIdentifier>{041FFD28-E4BD-ABC0-5AF7-A6D1560FAC0E}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="compiler\preprocessor">
+ <UniqueIdentifier>{56A90BCD-B311-1BEE-A8AC-25D8344BCE41}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\src\angle.gyp"/>
+ <ClCompile Include="..\..\src\compiler\preprocessor\ExpressionParser.cpp">
+ <Filter>compiler\preprocessor</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\compiler\preprocessor\Input.cpp">
+ <Filter>compiler\preprocessor</Filter>
+ </ClCompile>
+ <None Include="..\..\src\compiler\preprocessor\ExpressionParser.y">
+ <Filter>compiler\preprocessor</Filter>
+ </None>
+ <ClCompile Include="..\..\src\compiler\preprocessor\Tokenizer.cpp">
+ <Filter>compiler\preprocessor</Filter>
+ </ClCompile>
+ <None Include="..\..\src\compiler\preprocessor\Tokenizer.l">
+ <Filter>compiler\preprocessor</Filter>
+ </None>
+ <ClInclude Include="..\..\src\compiler\preprocessor\Tokenizer.h">
+ <Filter>compiler\preprocessor</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\preprocessor\Lexer.h">
+ <Filter>compiler\preprocessor</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\compiler\preprocessor\DirectiveHandlerBase.cpp">
+ <Filter>compiler\preprocessor</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\compiler\preprocessor\Token.h">
+ <Filter>compiler\preprocessor</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\compiler\preprocessor\Lexer.cpp">
+ <Filter>compiler\preprocessor</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\compiler\preprocessor\Preprocessor.h">
+ <Filter>compiler\preprocessor</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\preprocessor\ExpressionParser.h">
+ <Filter>compiler\preprocessor</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\preprocessor\MacroExpander.h">
+ <Filter>compiler\preprocessor</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\preprocessor\Macro.h">
+ <Filter>compiler\preprocessor</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\compiler\preprocessor\Token.cpp">
+ <Filter>compiler\preprocessor</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\compiler\preprocessor\Macro.cpp">
+ <Filter>compiler\preprocessor</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\compiler\preprocessor\DiagnosticsBase.cpp">
+ <Filter>compiler\preprocessor</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\compiler\preprocessor\pp_utils.h">
+ <Filter>compiler\preprocessor</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\compiler\preprocessor\Preprocessor.cpp">
+ <Filter>compiler\preprocessor</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\compiler\preprocessor\Input.h">
+ <Filter>compiler\preprocessor</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\preprocessor\SourceLocation.h">
+ <Filter>compiler\preprocessor</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\preprocessor\numeric_lex.h">
+ <Filter>compiler\preprocessor</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\preprocessor\DirectiveParser.h">
+ <Filter>compiler\preprocessor</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\compiler\preprocessor\DirectiveParser.cpp">
+ <Filter>compiler\preprocessor</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\compiler\preprocessor\DiagnosticsBase.h">
+ <Filter>compiler\preprocessor</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\compiler\preprocessor\MacroExpander.cpp">
+ <Filter>compiler\preprocessor</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\compiler\preprocessor\DirectiveHandlerBase.h">
+ <Filter>compiler\preprocessor</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project>
diff --git a/chromium/third_party/angle/projects/src/translator.vcxproj b/chromium/third_party/angle/projects/src/translator.vcxproj
new file mode 100644
index 00000000000..a5e97fdedfe
--- /dev/null
+++ b/chromium/third_party/angle/projects/src/translator.vcxproj
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{C15697F6-5057-016E-BD29-422971875679}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>translator</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
+ <PropertyGroup Label="Configuration">
+ <CharacterSet>MultiByte</CharacterSet>
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
+ <ImportGroup Label="ExtensionSettings"/>
+ <ImportGroup Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros"/>
+ <PropertyGroup>
+ <ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\..\third_party\cygwin\bin\;$(MSBuildProjectDirectory)\..\..\third_party\python_26\</ExecutablePath>
+ <OutDir>$(SolutionDir)$(Configuration)_$(Platform)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <TargetName>$(ProjectName)</TargetName>
+ <TargetPath>$(OutDir)lib\$(ProjectName)$(TargetExt)</TargetPath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\src;..\..\include;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };ANGLE_TRANSLATOR_IMPLEMENTATION;NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <OutputFile>$(OutDir)lib\$(ProjectName)$(TargetExt)</OutputFile>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\src;..\..\include;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };ANGLE_TRANSLATOR_IMPLEMENTATION;NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\src;..\..\include;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };ANGLE_TRANSLATOR_IMPLEMENTATION;NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <OutputFile>$(OutDir)lib\$(ProjectName)$(TargetExt)</OutputFile>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\src;..\..\include;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };ANGLE_TRANSLATOR_IMPLEMENTATION;NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <None Include="..\..\src\angle.gyp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\compiler\translator\ShaderLang.cpp"/>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
+ <ImportGroup Label="ExtensionTargets"/>
+</Project>
diff --git a/chromium/third_party/angle/projects/src/translator.vcxproj.filters b/chromium/third_party/angle/projects/src/translator.vcxproj.filters
new file mode 100644
index 00000000000..8b76279d812
--- /dev/null
+++ b/chromium/third_party/angle/projects/src/translator.vcxproj.filters
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="compiler">
+ <UniqueIdentifier>{041FFD28-E4BD-ABC0-5AF7-A6D1560FAC0E}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="compiler\translator">
+ <UniqueIdentifier>{502101C2-1680-5126-1D2E-39419A1AE009}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\src\angle.gyp"/>
+ <ClCompile Include="..\..\src\compiler\translator\ShaderLang.cpp">
+ <Filter>compiler\translator</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
diff --git a/chromium/third_party/angle/projects/src/translator_lib.vcxproj b/chromium/third_party/angle/projects/src/translator_lib.vcxproj
new file mode 100644
index 00000000000..26886850c1b
--- /dev/null
+++ b/chromium/third_party/angle/projects/src/translator_lib.vcxproj
@@ -0,0 +1,266 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{276D20F5-2943-414C-0FF6-21F4723A5CF6}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>translator_lib</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
+ <PropertyGroup Label="Configuration">
+ <CharacterSet>MultiByte</CharacterSet>
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
+ <ImportGroup Label="ExtensionSettings"/>
+ <ImportGroup Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros"/>
+ <PropertyGroup>
+ <ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\..\third_party\cygwin\bin\;$(MSBuildProjectDirectory)\..\..\third_party\python_26\</ExecutablePath>
+ <OutDir>$(SolutionDir)$(Configuration)_$(Platform)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <TargetName>$(ProjectName)</TargetName>
+ <TargetPath>$(OutDir)lib\$(ProjectName)$(TargetExt)</TargetPath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\src;..\..\include;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <AdditionalOptions>/ignore:4221 %(AdditionalOptions)</AdditionalOptions>
+ <OutputFile>$(OutDir)lib\$(ProjectName)$(TargetExt)</OutputFile>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\src;..\..\include;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\src;..\..\include;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <AdditionalOptions>/ignore:4221 %(AdditionalOptions)</AdditionalOptions>
+ <OutputFile>$(OutDir)lib\$(ProjectName)$(TargetExt)</OutputFile>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\src;..\..\include;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <None Include="..\..\src\angle.gyp"/>
+ <None Include="..\..\src\compiler\translator\glslang.y"/>
+ <None Include="..\..\src\compiler\translator\glslang.l"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\src\third_party\compiler\ArrayBoundsClamper.h"/>
+ <ClInclude Include="..\..\src\common\shadervars.h"/>
+ <ClInclude Include="..\..\src\common\RefCountObject.h"/>
+ <ClInclude Include="..\..\src\common\mathutil.h"/>
+ <ClInclude Include="..\..\src\common\event_tracer.h"/>
+ <ClInclude Include="..\..\src\common\debug.h"/>
+ <ClInclude Include="..\..\src\common\version.h"/>
+ <ClInclude Include="..\..\src\common\blocklayout.h"/>
+ <ClInclude Include="..\..\src\common\utilities.h"/>
+ <ClInclude Include="..\..\src\common\angleutils.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\BaseTypes.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\compilerdebug.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\Common.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\UnfoldShortCircuitAST.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\util.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\OutputGLSL.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\FlagStd140Structs.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\length_limits.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\PoolAlloc.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\BuiltInFunctionEmulator.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\DetectDiscontinuity.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\UnfoldShortCircuit.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\TranslatorGLSL.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\SymbolTable.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\InitializeGlobals.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\osinclude.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\Initialize.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\QualifierAlive.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\ConstantUnion.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\ParseContext.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\Diagnostics.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\VersionGLSL.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\HashNames.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\DirectiveHandler.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\NodeSearch.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\TranslatorESSL.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\InitializeDll.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\ValidateOutputs.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\InitializeVariables.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\localintermediate.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\ShHandle.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\OutputGLSLBase.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\ForLoopUnroll.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\Pragma.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\intermediate.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\TranslatorHLSL.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\OutputESSL.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\RenameFunction.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\ValidateLimitations.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\Types.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\InfoSink.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\RemoveTree.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\DetectCallDepth.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\MMap.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\VariablePacker.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\glslang.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\SearchSymbol.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\OutputHLSL.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\InitializeParseContext.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\VariableInfo.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\LoopInfo.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\glslang_tab.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\RewriteElseBlocks.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\ExtensionBehavior.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\timing\RestrictVertexShaderTiming.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\timing\RestrictFragmentShaderTiming.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\depgraph\DependencyGraph.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\depgraph\DependencyGraphOutput.h"/>
+ <ClInclude Include="..\..\src\compiler\translator\depgraph\DependencyGraphBuilder.h"/>
+ <ClInclude Include="..\..\include\KHR\khrplatform.h"/>
+ <ClInclude Include="..\..\include\GLSLANG\ShaderLang.h"/>
+ <ClInclude Include="..\..\include\GLES2\gl2platform.h"/>
+ <ClInclude Include="..\..\include\GLES2\gl2ext.h"/>
+ <ClInclude Include="..\..\include\GLES2\gl2.h"/>
+ <ClInclude Include="..\..\include\GLES3\gl3ext.h"/>
+ <ClInclude Include="..\..\include\GLES3\gl3.h"/>
+ <ClInclude Include="..\..\include\GLES3\gl3platform.h"/>
+ <ClInclude Include="..\..\include\EGL\eglext.h"/>
+ <ClInclude Include="..\..\include\EGL\egl.h"/>
+ <ClInclude Include="..\..\include\EGL\eglplatform.h"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\third_party\compiler\ArrayBoundsClamper.cpp"/>
+ <ClCompile Include="..\..\src\common\event_tracer.cpp"/>
+ <ClCompile Include="..\..\src\common\utilities.cpp"/>
+ <ClCompile Include="..\..\src\common\RefCountObject.cpp"/>
+ <ClCompile Include="..\..\src\common\mathutil.cpp"/>
+ <ClCompile Include="..\..\src\common\debug.cpp"/>
+ <ClCompile Include="..\..\src\common\blocklayout.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\InfoSink.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\OutputESSL.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\ValidateLimitations.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\BuiltInFunctionEmulator.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\glslang_lex.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\OutputGLSL.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\TranslatorHLSL.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\OutputGLSLBase.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\ParseContext.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\Types.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\RemoveTree.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\InitializeVariables.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\InitializeDll.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\PoolAlloc.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\ossource_win.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\RewriteElseBlocks.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\Diagnostics.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\QualifierAlive.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\util.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\ValidateOutputs.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\TranslatorESSL.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\VariablePacker.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\DirectiveHandler.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\parseConst.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\VersionGLSL.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\DetectCallDepth.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\InitializeParseContext.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\CodeGen.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\Intermediate.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\IntermTraverse.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\intermOut.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\glslang_tab.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\ForLoopUnroll.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\SearchSymbol.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\UnfoldShortCircuitAST.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\TranslatorGLSL.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\SymbolTable.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\FlagStd140Structs.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\LoopInfo.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\OutputHLSL.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\DetectDiscontinuity.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\UnfoldShortCircuit.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\compilerdebug.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\VariableInfo.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\Compiler.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\Initialize.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\ossource_posix.cpp">
+ <ExcludedFromBuild>true</ExcludedFromBuild>
+ </ClCompile>
+ <ClCompile Include="..\..\src\compiler\translator\timing\RestrictVertexShaderTiming.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\timing\RestrictFragmentShaderTiming.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\depgraph\DependencyGraphTraverse.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\depgraph\DependencyGraphOutput.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\depgraph\DependencyGraph.cpp"/>
+ <ClCompile Include="..\..\src\compiler\translator\depgraph\DependencyGraphBuilder.cpp"/>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
+ <ImportGroup Label="ExtensionTargets"/>
+</Project>
diff --git a/chromium/third_party/angle/projects/src/translator_lib.vcxproj.filters b/chromium/third_party/angle/projects/src/translator_lib.vcxproj.filters
new file mode 100644
index 00000000000..cbaa024a3c2
--- /dev/null
+++ b/chromium/third_party/angle/projects/src/translator_lib.vcxproj.filters
@@ -0,0 +1,481 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="src">
+ <UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="src\third_party">
+ <UniqueIdentifier>{D6C6CEA7-AAD0-03AD-2394-AC6FCBF8A498}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="src\third_party\compiler">
+ <UniqueIdentifier>{041FFD28-E4BD-ABC0-5AF7-A6D1560FAC0E}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="src\common">
+ <UniqueIdentifier>{2F5FD094-EF52-77F7-7AA8-4327A01BF747}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="src\compiler">
+ <UniqueIdentifier>{041FFD28-E4BD-ABC0-5AF7-A6D1560FAC0E}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="src\compiler\translator">
+ <UniqueIdentifier>{502101C2-1680-5126-1D2E-39419A1AE009}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="src\compiler\translator\_excluded_files">
+ <UniqueIdentifier>{158E591E-B6EA-0C85-8F5A-18EAFA09B4CE}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="src\compiler\translator\timing">
+ <UniqueIdentifier>{E1BE6BE7-5019-57F8-5C7D-26FC8CE74904}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="src\compiler\translator\depgraph">
+ <UniqueIdentifier>{233BE2B2-4E73-B3F0-20B8-25A55D8E5238}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="include">
+ <UniqueIdentifier>{57CA55B8-BCC5-4000-CE3A-58972F82E9CB}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="include\KHR">
+ <UniqueIdentifier>{6D4588DE-6319-FB13-135F-FA88843373FC}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="include\GLSLANG">
+ <UniqueIdentifier>{AD7D3D9B-E716-B150-1F3A-64569B7F5415}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="include\GLES2">
+ <UniqueIdentifier>{3FFE2AF8-8DA3-57BA-8037-4BE936BC5045}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="include\GLES3">
+ <UniqueIdentifier>{E18FF71E-3DE4-F6D0-36B6-93BA54EEDEE1}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="include\EGL">
+ <UniqueIdentifier>{79AE79DD-7922-70CC-3439-C9B3586338EF}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\src\angle.gyp">
+ <Filter>src</Filter>
+ </None>
+ <ClCompile Include="..\..\src\third_party\compiler\ArrayBoundsClamper.cpp">
+ <Filter>src\third_party\compiler</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\third_party\compiler\ArrayBoundsClamper.h">
+ <Filter>src\third_party\compiler</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\common\shadervars.h">
+ <Filter>src\common</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\common\RefCountObject.h">
+ <Filter>src\common</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\common\mathutil.h">
+ <Filter>src\common</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\common\event_tracer.h">
+ <Filter>src\common</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\common\event_tracer.cpp">
+ <Filter>src\common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\common\utilities.cpp">
+ <Filter>src\common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\common\RefCountObject.cpp">
+ <Filter>src\common</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\common\mathutil.cpp">
+ <Filter>src\common</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\common\debug.h">
+ <Filter>src\common</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\common\debug.cpp">
+ <Filter>src\common</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\common\version.h">
+ <Filter>src\common</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\common\blocklayout.h">
+ <Filter>src\common</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\common\utilities.h">
+ <Filter>src\common</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\common\blocklayout.cpp">
+ <Filter>src\common</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\common\angleutils.h">
+ <Filter>src\common</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\BaseTypes.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\compiler\translator\InfoSink.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\compiler\translator\OutputESSL.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\compiler\translator\compilerdebug.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\Common.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\UnfoldShortCircuitAST.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\compiler\translator\ValidateLimitations.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\compiler\translator\util.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\OutputGLSL.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\compiler\translator\BuiltInFunctionEmulator.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\compiler\translator\glslang_lex.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\compiler\translator\OutputGLSL.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\compiler\translator\FlagStd140Structs.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\length_limits.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\compiler\translator\TranslatorHLSL.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\compiler\translator\OutputGLSLBase.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\compiler\translator\PoolAlloc.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\BuiltInFunctionEmulator.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\DetectDiscontinuity.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\compiler\translator\ParseContext.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\compiler\translator\Types.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\compiler\translator\RemoveTree.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\compiler\translator\InitializeVariables.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\compiler\translator\UnfoldShortCircuit.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\TranslatorGLSL.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\SymbolTable.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\compiler\translator\InitializeDll.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\compiler\translator\PoolAlloc.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\compiler\translator\InitializeGlobals.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\osinclude.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\Initialize.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\compiler\translator\ossource_win.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\compiler\translator\QualifierAlive.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\ConstantUnion.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\compiler\translator\RewriteElseBlocks.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\compiler\translator\Diagnostics.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\compiler\translator\ParseContext.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\compiler\translator\QualifierAlive.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\compiler\translator\Diagnostics.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\VersionGLSL.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\HashNames.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\compiler\translator\util.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\compiler\translator\DirectiveHandler.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\compiler\translator\ValidateOutputs.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\compiler\translator\NodeSearch.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\TranslatorESSL.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\compiler\translator\TranslatorESSL.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\compiler\translator\InitializeDll.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\ValidateOutputs.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\InitializeVariables.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\localintermediate.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\ShHandle.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\OutputGLSLBase.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\ForLoopUnroll.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\Pragma.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\intermediate.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\compiler\translator\VariablePacker.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\compiler\translator\TranslatorHLSL.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\compiler\translator\DirectiveHandler.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\compiler\translator\OutputESSL.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\compiler\translator\parseConst.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\compiler\translator\RenameFunction.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\ValidateLimitations.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\Types.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\InfoSink.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\RemoveTree.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <None Include="..\..\src\compiler\translator\glslang.y">
+ <Filter>src\compiler\translator</Filter>
+ </None>
+ <ClCompile Include="..\..\src\compiler\translator\VersionGLSL.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\compiler\translator\DetectCallDepth.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\MMap.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\VariablePacker.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\glslang.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\compiler\translator\DetectCallDepth.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\compiler\translator\InitializeParseContext.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\compiler\translator\SearchSymbol.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\compiler\translator\CodeGen.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\compiler\translator\Intermediate.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\compiler\translator\IntermTraverse.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <None Include="..\..\src\compiler\translator\glslang.l">
+ <Filter>src\compiler\translator</Filter>
+ </None>
+ <ClCompile Include="..\..\src\compiler\translator\intermOut.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\compiler\translator\glslang_tab.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\compiler\translator\ForLoopUnroll.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\compiler\translator\SearchSymbol.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\compiler\translator\UnfoldShortCircuitAST.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\compiler\translator\OutputHLSL.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\compiler\translator\TranslatorGLSL.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\compiler\translator\SymbolTable.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\compiler\translator\InitializeParseContext.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\VariableInfo.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\compiler\translator\FlagStd140Structs.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\compiler\translator\LoopInfo.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\compiler\translator\OutputHLSL.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\compiler\translator\LoopInfo.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\compiler\translator\DetectDiscontinuity.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\compiler\translator\glslang_tab.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\compiler\translator\UnfoldShortCircuit.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\compiler\translator\RewriteElseBlocks.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\compiler\translator\compilerdebug.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\compiler\translator\ExtensionBehavior.h">
+ <Filter>src\compiler\translator</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\compiler\translator\VariableInfo.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\compiler\translator\Compiler.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\compiler\translator\Initialize.cpp">
+ <Filter>src\compiler\translator</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\compiler\translator\ossource_posix.cpp">
+ <Filter>src\compiler\translator\_excluded_files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\compiler\translator\timing\RestrictVertexShaderTiming.cpp">
+ <Filter>src\compiler\translator\timing</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\compiler\translator\timing\RestrictFragmentShaderTiming.cpp">
+ <Filter>src\compiler\translator\timing</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\src\compiler\translator\timing\RestrictVertexShaderTiming.h">
+ <Filter>src\compiler\translator\timing</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\timing\RestrictFragmentShaderTiming.h">
+ <Filter>src\compiler\translator\timing</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\depgraph\DependencyGraph.h">
+ <Filter>src\compiler\translator\depgraph</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\depgraph\DependencyGraphOutput.h">
+ <Filter>src\compiler\translator\depgraph</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\src\compiler\translator\depgraph\DependencyGraphBuilder.h">
+ <Filter>src\compiler\translator\depgraph</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\src\compiler\translator\depgraph\DependencyGraphTraverse.cpp">
+ <Filter>src\compiler\translator\depgraph</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\compiler\translator\depgraph\DependencyGraphOutput.cpp">
+ <Filter>src\compiler\translator\depgraph</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\compiler\translator\depgraph\DependencyGraph.cpp">
+ <Filter>src\compiler\translator\depgraph</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\compiler\translator\depgraph\DependencyGraphBuilder.cpp">
+ <Filter>src\compiler\translator\depgraph</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\include\KHR\khrplatform.h">
+ <Filter>include\KHR</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\GLSLANG\ShaderLang.h">
+ <Filter>include\GLSLANG</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\GLES2\gl2platform.h">
+ <Filter>include\GLES2</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\GLES2\gl2ext.h">
+ <Filter>include\GLES2</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\GLES2\gl2.h">
+ <Filter>include\GLES2</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\GLES3\gl3ext.h">
+ <Filter>include\GLES3</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\GLES3\gl3.h">
+ <Filter>include\GLES3</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\GLES3\gl3platform.h">
+ <Filter>include\GLES3</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\EGL\eglext.h">
+ <Filter>include\EGL</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\EGL\egl.h">
+ <Filter>include\EGL</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\EGL\eglplatform.h">
+ <Filter>include\EGL</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project>
diff --git a/chromium/third_party/angle/projects/src/translator_static.vcxproj b/chromium/third_party/angle/projects/src/translator_static.vcxproj
new file mode 100644
index 00000000000..6c943aae91c
--- /dev/null
+++ b/chromium/third_party/angle/projects/src/translator_static.vcxproj
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{19386E01-D811-FA3B-9F1E-122BB0C0E9F5}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>translator_static</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
+ <PropertyGroup Label="Configuration">
+ <CharacterSet>MultiByte</CharacterSet>
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
+ <ImportGroup Label="ExtensionSettings"/>
+ <ImportGroup Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros"/>
+ <PropertyGroup>
+ <ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\..\third_party\cygwin\bin\;$(MSBuildProjectDirectory)\..\..\third_party\python_26\</ExecutablePath>
+ <OutDir>$(SolutionDir)$(Configuration)_$(Platform)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <TargetName>$(ProjectName)</TargetName>
+ <TargetPath>$(OutDir)lib\$(ProjectName)$(TargetExt)</TargetPath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\src;..\..\include;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };ANGLE_TRANSLATOR_STATIC;NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <OutputFile>$(OutDir)lib\$(ProjectName)$(TargetExt)</OutputFile>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\src;..\..\include;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };ANGLE_TRANSLATOR_STATIC;NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\src;..\..\include;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <BufferSecurityCheck>true</BufferSecurityCheck>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4100;4127;4239;4244;4245;4512;4702;4530;4718;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <MinimalRebuild>false</MinimalRebuild>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_HAS_EXCEPTIONS=0;_WINDOWS;WIN32;WIN32_LEAN_AND_MEAN;ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };ANGLE_TRANSLATOR_STATIC;NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ </ClCompile>
+ <Lib>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <OutputFile>$(OutDir)lib\$(ProjectName)$(TargetExt)</OutputFile>
+ </Lib>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories>C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <FixedBaseAddress>false</FixedBaseAddress>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <ImportLibrary>$(OutDir)lib\$(TargetName).lib</ImportLibrary>
+ <MapFileName>$(OutDir)$(TargetName).map</MapFileName>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\src;..\..\include;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\um;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Culture>0x0409</Culture>
+ <PreprocessorDefinitions>ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT(&quot;d3dcompiler_46.dll&quot;), TEXT(&quot;d3dcompiler_43.dll&quot;) };ANGLE_TRANSLATOR_STATIC;NOMINMAX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <None Include="..\..\src\angle.gyp"/>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\compiler\translator\ShaderLang.cpp"/>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
+ <ImportGroup Label="ExtensionTargets"/>
+</Project>
diff --git a/chromium/third_party/angle/projects/src/translator_static.vcxproj.filters b/chromium/third_party/angle/projects/src/translator_static.vcxproj.filters
new file mode 100644
index 00000000000..8b76279d812
--- /dev/null
+++ b/chromium/third_party/angle/projects/src/translator_static.vcxproj.filters
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="compiler">
+ <UniqueIdentifier>{041FFD28-E4BD-ABC0-5AF7-A6D1560FAC0E}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="compiler\translator">
+ <UniqueIdentifier>{502101C2-1680-5126-1D2E-39419A1AE009}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\src\angle.gyp"/>
+ <ClCompile Include="..\..\src\compiler\translator\ShaderLang.cpp">
+ <Filter>compiler\translator</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
diff --git a/chromium/third_party/angle/samples/angle/Simple_Instancing/Simple_Instancing.c b/chromium/third_party/angle/samples/angle/Simple_Instancing/Simple_Instancing.c
deleted file mode 100644
index c513c9b37fb..00000000000
--- a/chromium/third_party/angle/samples/angle/Simple_Instancing/Simple_Instancing.c
+++ /dev/null
@@ -1,230 +0,0 @@
-//
-// Modified from Simple_Texture2D found in:
-// Book: OpenGL(R) ES 2.0 Programming Guide
-// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
-// ISBN-10: 0321502795
-// ISBN-13: 9780321502797
-// Publisher: Addison-Wesley Professional
-// URLs: http://safari.informit.com/9780321563835
-// http://www.opengles-book.com
-//
-
-// Simple_Instancing.c
-//
-// This is a simple example that draws two quads with a 2D
-// texture image. The purpose of this example is to demonstrate
-// the basics of ANGLE instancing in GLESv2.
-//
-#include <stdlib.h>
-#include "esUtil.h"
-
-#include <GLES2/gl2ext.h>
-
-PFNGLVERTEXATTRIBDIVISORANGLEPROC glVertexAttribDivisorANGLE;
-PFNGLDRAWARRAYSINSTANCEDANGLEPROC glDrawArraysInstancedANGLE;
-PFNGLDRAWELEMENTSINSTANCEDANGLEPROC glDrawElementsInstancedANGLE;
-
-typedef struct
-{
- // Handle to a program object
- GLuint programObject;
-
- // Attribute locations
- GLint positionLoc;
- GLint texCoordLoc;
-
- // Sampler location
- GLint samplerLoc;
-
- // Texture handle
- GLuint textureId;
-
- // Instance VBO
- GLint instancePosLoc;
-
-} UserData;
-
-///
-// Create a simple 2x2 texture image with four different colors
-//
-GLuint CreateSimpleTexture2D( )
-{
- // Texture object handle
- GLuint textureId;
-
- // 2x2 Image, 3 bytes per pixel (R, G, B)
- GLubyte pixels[4 * 3] =
- {
- 255, 0, 0, // Red
- 0, 255, 0, // Green
- 0, 0, 255, // Blue
- 255, 255, 0 // Yellow
- };
-
- // Use tightly packed data
- glPixelStorei ( GL_UNPACK_ALIGNMENT, 1 );
-
- // Generate a texture object
- glGenTextures ( 1, &textureId );
-
- // Bind the texture object
- glBindTexture ( GL_TEXTURE_2D, textureId );
-
- // Load the texture
- glTexImage2D ( GL_TEXTURE_2D, 0, GL_RGB, 2, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels );
-
- // Set the filtering mode
- glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
- glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
-
- return textureId;
-
-}
-
-
-///
-// Initialize the shader and program object
-//
-int Init ( ESContext *esContext )
-{
- // init instancing functions
- char *extensionString = (char*) glGetString(GL_EXTENSIONS);
-
- UserData *userData = esContext->userData;
- GLbyte vShaderStr[] =
- "attribute vec3 a_position; \n"
- "attribute vec2 a_texCoord; \n"
- "attribute vec3 a_instancePos;\n"
- "varying vec2 v_texCoord; \n"
- "void main() \n"
- "{ \n"
- " gl_Position = vec4(a_position.xyz + a_instancePos.xyz, 1.0); \n"
- " v_texCoord = a_texCoord; \n"
- "} \n";
-
- GLbyte fShaderStr[] =
- "precision mediump float; \n"
- "varying vec2 v_texCoord; \n"
- "uniform sampler2D s_texture; \n"
- "void main() \n"
- "{ \n"
- " gl_FragColor = texture2D( s_texture, v_texCoord );\n"
- "} \n";
-
- if (strstr(extensionString, "GL_ANGLE_instanced_arrays"))
- {
- glVertexAttribDivisorANGLE = (PFNGLVERTEXATTRIBDIVISORANGLEPROC)eglGetProcAddress("glVertexAttribDivisorANGLE");
- glDrawArraysInstancedANGLE = (PFNGLDRAWARRAYSINSTANCEDANGLEPROC)eglGetProcAddress("glDrawArraysInstancedANGLE");
- glDrawElementsInstancedANGLE = (PFNGLDRAWELEMENTSINSTANCEDANGLEPROC)eglGetProcAddress("glDrawElementsInstancedANGLE");
- }
-
- // Load the shaders and get a linked program object
- userData->programObject = esLoadProgram ( vShaderStr, fShaderStr );
-
- // Get the attribute locations
- userData->positionLoc = glGetAttribLocation ( userData->programObject, "a_position" );
- userData->texCoordLoc = glGetAttribLocation ( userData->programObject, "a_texCoord" );
- userData->instancePosLoc = glGetAttribLocation ( userData->programObject, "a_instancePos" );
-
- // Get the sampler location
- userData->samplerLoc = glGetUniformLocation ( userData->programObject, "s_texture" );
-
- // Load the texture
- userData->textureId = CreateSimpleTexture2D ();
-
- glClearColor ( 0.0f, 0.0f, 0.0f, 0.0f );
- return TRUE;
-}
-
-///
-// Draw a triangle using the shader pair created in Init()
-//
-void Draw ( ESContext *esContext )
-{
- UserData *userData = (UserData*) esContext->userData;
- GLfloat vVertices[] = { -0.2f, 0.2f, 0.0f, // Position 0
- 0.0f, 0.0f, // TexCoord 0
- -0.2f, -0.2f, 0.0f, // Position 1
- 0.0f, 1.0f, // TexCoord 1
- 0.2f, -0.2f, 0.0f, // Position 2
- 1.0f, 1.0f, // TexCoord 2
- 0.2f, 0.2f, 0.0f, // Position 3
- 1.0f, 0.0f // TexCoord 3
- };
- GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
-
- GLfloat instanceVerts [] = { -0.3f, -0.3f, 0.0f, 0.3f, 0.3f, 0.0f };
-
- // Set the viewport
- glViewport ( 0, 0, esContext->width, esContext->height );
-
- // Clear the color buffer
- glClear ( GL_COLOR_BUFFER_BIT );
-
- // Use the program object
- glUseProgram ( userData->programObject );
-
- // Load the vertex position
- glVertexAttribPointer ( userData->positionLoc, 3, GL_FLOAT,
- GL_FALSE, 5 * sizeof(GLfloat), vVertices );
- // Load the texture coordinate
- glVertexAttribPointer ( userData->texCoordLoc, 2, GL_FLOAT,
- GL_FALSE, 5 * sizeof(GLfloat), &vVertices[3] );
-
- // Load the instance position
- glVertexAttribPointer ( userData->instancePosLoc, 3, GL_FLOAT,
- GL_FALSE, 3 * sizeof(GLfloat), instanceVerts );
-
- glEnableVertexAttribArray ( userData->positionLoc );
- glEnableVertexAttribArray ( userData->texCoordLoc );
- glEnableVertexAttribArray ( userData->instancePosLoc );
-
- // Enable instancing
- glVertexAttribDivisorANGLE( userData->instancePosLoc, 1 );
-
- // Bind the texture
- glActiveTexture ( GL_TEXTURE0 );
- glBindTexture ( GL_TEXTURE_2D, userData->textureId );
-
- // Set the sampler texture unit to 0
- glUniform1i ( userData->samplerLoc, 0 );
-
- glDrawElementsInstancedANGLE ( GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices, 2 );
-
- eglSwapBuffers ( esContext->eglDisplay, esContext->eglSurface );
-}
-
-///
-// Cleanup
-//
-void ShutDown ( ESContext *esContext )
-{
- UserData *userData = (UserData*) esContext->userData;
-
- // Delete texture object
- glDeleteTextures ( 1, &userData->textureId );
-
- // Delete program object
- glDeleteProgram ( userData->programObject );
-}
-
-
-int main ( int argc, char *argv[] )
-{
- ESContext esContext;
- UserData userData;
-
- esInitContext ( &esContext );
- esContext.userData = &userData;
-
- esCreateWindow ( &esContext, TEXT("Simple Instancing"), 320, 240, ES_WINDOW_RGB );
-
- if ( !Init ( &esContext ) )
- return 0;
-
- esRegisterDrawFunc ( &esContext, Draw );
-
- esMainLoop ( &esContext );
-
- ShutDown ( &esContext );
-}
diff --git a/chromium/third_party/angle/samples/angle/Simple_Instancing/Simple_Instancing.vcxproj b/chromium/third_party/angle/samples/angle/Simple_Instancing/Simple_Instancing.vcxproj
deleted file mode 100644
index 38786f75212..00000000000
--- a/chromium/third_party/angle/samples/angle/Simple_Instancing/Simple_Instancing.vcxproj
+++ /dev/null
@@ -1,105 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{EB6E138B-9DE5-41E8-A127-3675AA2BA607}</ProjectGuid>
- <RootNamespace>Simple_Texture2D</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- <ProjectName>Simple_Instancing</ProjectName>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>NotSet</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>NotSet</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
- <EmbedManifest Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</EmbedManifest>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>../../gles2_book/Common;../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>../../gles2_book/Common;../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="Simple_Instancing.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\gles2_book\Common\esUtil.vcxproj">
- <Project>{47c93f52-ab4e-4ff9-8d4f-b38cd60a183f}</Project>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/chromium/third_party/angle/samples/angle/hello_triangle/HelloTriangle.cpp b/chromium/third_party/angle/samples/angle/hello_triangle/HelloTriangle.cpp
new file mode 100644
index 00000000000..e991607d887
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/hello_triangle/HelloTriangle.cpp
@@ -0,0 +1,96 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Based on Hello_Triangle.c from
+// Book: OpenGL(R) ES 2.0 Programming Guide
+// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
+// ISBN-10: 0321502795
+// ISBN-13: 9780321502797
+// Publisher: Addison-Wesley Professional
+// URLs: http://safari.informit.com/9780321563835
+// http://www.opengles-book.com
+
+#include "SampleApplication.h"
+#include "shader_utils.h"
+
+class HelloTriangleSample : public SampleApplication
+{
+ public:
+ HelloTriangleSample::HelloTriangleSample()
+ : SampleApplication("HelloTriangle", 1280, 720)
+ {
+ }
+
+ virtual bool initialize()
+ {
+ const std::string vs = SHADER_SOURCE
+ (
+ attribute vec4 vPosition;
+ void main()
+ {
+ gl_Position = vPosition;
+ }
+ );
+
+ const std::string fs = SHADER_SOURCE
+ (
+ precision mediump float;
+ void main()
+ {
+ gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+ }
+ );
+
+ mProgram = CompileProgram(vs, fs);
+ if (!mProgram)
+ {
+ return false;
+ }
+
+ glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+
+ return true;
+ }
+
+ virtual void destroy()
+ {
+ glDeleteProgram(mProgram);
+ }
+
+ virtual void draw()
+ {
+ GLfloat vertices[] =
+ {
+ 0.0f, 0.5f, 0.0f,
+ -0.5f, -0.5f, 0.0f,
+ 0.5f, -0.5f, 0.0f,
+ };
+
+ // Set the viewport
+ glViewport(0, 0, getWindow()->getWidth(), getWindow()->getHeight());
+
+ // Clear the color buffer
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ // Use the program object
+ glUseProgram(mProgram);
+
+ // Load the vertex data
+ glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, vertices);
+ glEnableVertexAttribArray(0);
+
+ glDrawArrays(GL_TRIANGLES, 0, 3);
+ }
+
+ private:
+ GLuint mProgram;
+};
+
+int main(int argc, char **argv)
+{
+ HelloTriangleSample app;
+ return app.run();
+}
diff --git a/chromium/third_party/angle/samples/angle/mip_map_2d/MipMap2D.cpp b/chromium/third_party/angle/samples/angle/mip_map_2d/MipMap2D.cpp
new file mode 100644
index 00000000000..478d9da184a
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/mip_map_2d/MipMap2D.cpp
@@ -0,0 +1,169 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Based on MipMap2D.c from
+// Book: OpenGL(R) ES 2.0 Programming Guide
+// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
+// ISBN-10: 0321502795
+// ISBN-13: 9780321502797
+// Publisher: Addison-Wesley Professional
+// URLs: http://safari.informit.com/9780321563835
+// http://www.opengles-book.com
+
+#include "SampleApplication.h"
+#include "shader_utils.h"
+#include "texture_utils.h"
+
+class MipMap2DSample : public SampleApplication
+{
+ public:
+ MipMap2DSample::MipMap2DSample()
+ : SampleApplication("MipMap2D", 1280, 720)
+ {
+ }
+
+ virtual bool initialize()
+ {
+ const std::string vs = SHADER_SOURCE
+ (
+ uniform float u_offset;
+ attribute vec4 a_position;
+ attribute vec2 a_texCoord;
+ varying vec2 v_texCoord;
+ void main()
+ {
+ gl_Position = a_position;
+ gl_Position.x += u_offset;
+ v_texCoord = a_texCoord;
+ }
+ );
+
+ const std::string fs = SHADER_SOURCE
+ (
+ precision mediump float;
+ varying vec2 v_texCoord;
+ uniform sampler2D s_texture;
+ void main()
+ {
+ gl_FragColor = texture2D(s_texture, v_texCoord);
+ }
+ );
+
+ mProgram = CompileProgram(vs, fs);
+ if (!mProgram)
+ {
+ return false;
+ }
+
+ // Get the attribute locations
+ mPositionLoc = glGetAttribLocation(mProgram, "a_position");
+ mTexCoordLoc = glGetAttribLocation(mProgram, "a_texCoord");
+
+ // Get the sampler location
+ mSamplerLoc = glGetUniformLocation(mProgram, "s_texture");
+
+ // Get the offset location
+ mOffsetLoc = glGetUniformLocation(mProgram, "u_offset");
+
+ // Load the texture
+ mTextureID = CreateMipMappedTexture2D();
+
+ // Check Anisotropy limits
+ glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &mMaxAnisotropy);
+
+ glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+
+ return true;
+ }
+
+ virtual void destroy()
+ {
+ glDeleteProgram(mProgram);
+ glDeleteTextures(1, &mTextureID);
+ }
+
+ virtual void draw()
+ {
+ const GLfloat vertices[] =
+ {
+ -0.25f, 0.5f, 0.0f, 5.0f, // Position 0
+ 0.0f, 0.0f, // TexCoord 0
+ -0.25f, -0.5f, 0.0f, 1.0f, // Position 1
+ 0.0f, 1.0f, // TexCoord 1
+ 0.25f, -0.5f, 0.0f, 1.0f, // Position 2
+ 1.0f, 1.0f, // TexCoord 2
+ 0.25f, 0.5f, 0.0f, 5.0f, // Position 3
+ 1.0f, 0.0f // TexCoord 3
+ };
+ const GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
+
+ // Set the viewport
+ glViewport(0, 0, getWindow()->getWidth(), getWindow()->getHeight());
+
+ // Clear the color buffer
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ // Use the program object
+ glUseProgram(mProgram);
+
+ // Load the vertex position
+ glVertexAttribPointer(mPositionLoc, 4, GL_FLOAT, GL_FALSE, 6 * sizeof(GLfloat), vertices);
+ // Load the texture coordinate
+ glVertexAttribPointer(mTexCoordLoc, 2, GL_FLOAT, GL_FALSE, 6 * sizeof(GLfloat), vertices + 4);
+
+ glEnableVertexAttribArray(mPositionLoc);
+ glEnableVertexAttribArray(mTexCoordLoc);
+
+ // Bind the texture
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, mTextureID);
+
+ // Set the sampler texture unit to 0
+ glUniform1i(mSamplerLoc, 0);
+
+ // Draw quad with nearest sampling
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glUniform1f(mOffsetLoc, -0.6f);
+ glDrawElements ( GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
+
+ // Draw quad with trilinear filtering
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
+ glUniform1f(mOffsetLoc, 0.0f);
+ glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
+
+ // Draw quad with anisotropic filtering
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, mMaxAnisotropy);
+ glUniform1f(mOffsetLoc, 0.6f);
+ glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0f);
+ }
+
+ private:
+ // Handle to a program object
+ GLuint mProgram;
+
+ // Attribute locations
+ GLint mPositionLoc;
+ GLint mTexCoordLoc;
+
+ // Sampler location
+ GLint mSamplerLoc;
+
+ // Offset location
+ GLint mOffsetLoc;
+
+ // Texture handle
+ GLuint mTextureID;
+
+ float mMaxAnisotropy;
+};
+
+int main(int argc, char **argv)
+{
+ MipMap2DSample app;
+ return app.run();
+}
diff --git a/chromium/third_party/angle/samples/angle/multi_texture/MultiTexture.cpp b/chromium/third_party/angle/samples/angle/multi_texture/MultiTexture.cpp
new file mode 100644
index 00000000000..8052a859031
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/multi_texture/MultiTexture.cpp
@@ -0,0 +1,173 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Based on MultiTexture.c from
+// Book: OpenGL(R) ES 2.0 Programming Guide
+// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
+// ISBN-10: 0321502795
+// ISBN-13: 9780321502797
+// Publisher: Addison-Wesley Professional
+// URLs: http://safari.informit.com/9780321563835
+// http://www.opengles-book.com
+
+#include "SampleApplication.h"
+#include "shader_utils.h"
+#include "tga_utils.h"
+#include "path_utils.h"
+
+class MultiTextureSample : public SampleApplication
+{
+ public:
+ MultiTextureSample::MultiTextureSample()
+ : SampleApplication("MultiTexture", 1280, 720)
+ {
+ }
+
+ GLuint loadTexture(const std::string &path)
+ {
+ TGAImage img;
+ if (!LoadTGAImageFromFile(path, &img))
+ {
+ return 0;
+ }
+
+ return LoadTextureFromTGAImage(img);
+ }
+
+ virtual bool initialize()
+ {
+ const std::string vs = SHADER_SOURCE
+ (
+ attribute vec4 a_position;
+ attribute vec2 a_texCoord;
+ varying vec2 v_texCoord;
+ void main()
+ {
+ gl_Position = a_position;
+ v_texCoord = a_texCoord;
+ }
+ );
+
+ const std::string fs = SHADER_SOURCE
+ (
+ precision mediump float;
+ varying vec2 v_texCoord;
+ uniform sampler2D s_baseMap;
+ uniform sampler2D s_lightMap;
+ void main()
+ {
+ vec4 baseColor;
+ vec4 lightColor;
+
+ baseColor = texture2D(s_baseMap, v_texCoord);
+ lightColor = texture2D(s_lightMap, v_texCoord);
+ gl_FragColor = baseColor * (lightColor + 0.25);
+ }
+ );
+
+ mProgram = CompileProgram(vs, fs);
+ if (!mProgram)
+ {
+ return false;
+ }
+
+ // Get the attribute locations
+ mPositionLoc = glGetAttribLocation(mProgram, "a_position");
+ mTexCoordLoc = glGetAttribLocation(mProgram, "a_texCoord");
+
+ // Get the sampler location
+ mBaseMapLoc = glGetUniformLocation(mProgram, "s_baseMap");
+ mLightMapLoc = glGetUniformLocation(mProgram, "s_lightMap");
+
+ // Load the textures
+ mBaseMapTexID = loadTexture(GetExecutableDirectory() + "/basemap.tga");
+ mLightMapTexID = loadTexture(GetExecutableDirectory() + "/lightmap.tga");
+ if (mBaseMapTexID == 0 || mLightMapTexID == 0)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ virtual void destroy()
+ {
+ glDeleteProgram(mProgram);
+ glDeleteTextures(1, &mBaseMapTexID);
+ glDeleteTextures(1, &mLightMapTexID);
+ }
+
+ virtual void draw()
+ {
+ GLfloat vertices[] =
+ {
+ -0.5f, 0.5f, 0.0f, // Position 0
+ 0.0f, 0.0f, // TexCoord 0
+ -0.5f, -0.5f, 0.0f, // Position 1
+ 0.0f, 1.0f, // TexCoord 1
+ 0.5f, -0.5f, 0.0f, // Position 2
+ 1.0f, 1.0f, // TexCoord 2
+ 0.5f, 0.5f, 0.0f, // Position 3
+ 1.0f, 0.0f // TexCoord 3
+ };
+ GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
+
+ // Set the viewport
+ glViewport(0, 0, getWindow()->getWidth(), getWindow()->getHeight());
+
+ // Clear the color buffer
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ // Use the program object
+ glUseProgram(mProgram);
+
+ // Load the vertex position
+ glVertexAttribPointer(mPositionLoc, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), vertices);
+ // Load the texture coordinate
+ glVertexAttribPointer(mTexCoordLoc, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), vertices + 3);
+
+ glEnableVertexAttribArray(mPositionLoc);
+ glEnableVertexAttribArray(mTexCoordLoc);
+
+ // Bind the base map
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, mBaseMapTexID);
+
+ // Set the base map sampler to texture unit to 0
+ glUniform1i(mBaseMapLoc, 0);
+
+ // Bind the light map
+ glActiveTexture(GL_TEXTURE1);
+ glBindTexture(GL_TEXTURE_2D, mLightMapTexID);
+
+ // Set the light map sampler to texture unit 1
+ glUniform1i(mLightMapLoc, 1);
+
+ glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
+ }
+
+ private:
+ // Handle to a program object
+ GLuint mProgram;
+
+ // Attribute locations
+ GLint mPositionLoc;
+ GLint mTexCoordLoc;
+
+ // Sampler locations
+ GLint mBaseMapLoc;
+ GLint mLightMapLoc;
+
+ // Texture handle
+ GLuint mBaseMapTexID;
+ GLuint mLightMapTexID;
+};
+
+int main(int argc, char **argv)
+{
+ MultiTextureSample app;
+ return app.run();
+}
diff --git a/chromium/third_party/angle/samples/gles2_book/MultiTexture/basemap.tga b/chromium/third_party/angle/samples/angle/multi_texture/basemap.tga
index 8acafae236c..8acafae236c 100644
--- a/chromium/third_party/angle/samples/gles2_book/MultiTexture/basemap.tga
+++ b/chromium/third_party/angle/samples/angle/multi_texture/basemap.tga
Binary files differ
diff --git a/chromium/third_party/angle/samples/gles2_book/MultiTexture/lightmap.tga b/chromium/third_party/angle/samples/angle/multi_texture/lightmap.tga
index d95b262837d..d95b262837d 100644
--- a/chromium/third_party/angle/samples/gles2_book/MultiTexture/lightmap.tga
+++ b/chromium/third_party/angle/samples/angle/multi_texture/lightmap.tga
Binary files differ
diff --git a/chromium/third_party/angle/samples/angle/multiple_draw_buffers/MultipleDrawBuffers.cpp b/chromium/third_party/angle/samples/angle/multiple_draw_buffers/MultipleDrawBuffers.cpp
new file mode 100644
index 00000000000..3826eaa9b38
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/multiple_draw_buffers/MultipleDrawBuffers.cpp
@@ -0,0 +1,215 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Based on Simple_Texture2D.c from
+// Book: OpenGL(R) ES 2.0 Programming Guide
+// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
+// ISBN-10: 0321502795
+// ISBN-13: 9780321502797
+// Publisher: Addison-Wesley Professional
+// URLs: http://safari.informit.com/9780321563835
+// http://www.opengles-book.com
+
+#include "SampleApplication.h"
+#include "shader_utils.h"
+#include "path_utils.h"
+#include "texture_utils.h"
+
+#include <iostream>
+
+class MultipleDrawBuffersSample : public SampleApplication
+{
+ public:
+ MultipleDrawBuffersSample::MultipleDrawBuffersSample()
+ : SampleApplication("MultipleDrawBuffers", 1280, 720)
+ {
+ }
+
+ virtual bool initialize()
+ {
+ // Check EXT_draw_buffers is supported
+ char *extensionString = (char*)glGetString(GL_EXTENSIONS);
+ if (strstr(extensionString, "GL_EXT_draw_buffers") != NULL)
+ {
+ // Retrieve the address of glDrawBuffersEXT from EGL
+ mDrawBuffers = (PFNGLDRAWBUFFERSEXTPROC)eglGetProcAddress("glDrawBuffersEXT");
+ }
+ else
+ {
+ mDrawBuffers = glDrawBuffers;
+ }
+
+ if (!mDrawBuffers)
+ {
+ std::cerr << "Unable to load glDrawBuffers[EXT] entry point.";
+ return false;
+ }
+
+ mMRTProgram = CompileProgramFromFiles(GetExecutableDirectory() + "/multiple_draw_buffers_vs.glsl",
+ GetExecutableDirectory() + "/multiple_draw_buffers_fs.glsl");
+ if (!mMRTProgram)
+ {
+ return false;
+ }
+
+ mCopyProgram = CompileProgramFromFiles(GetExecutableDirectory() + "/multiple_draw_buffers_vs.glsl",
+ GetExecutableDirectory() + "/multiple_draw_buffers_copy_fs.glsl");
+ if (!mCopyProgram)
+ {
+ return false;
+ }
+
+ // Get the attribute locations
+ mPositionLoc = glGetAttribLocation(mCopyProgram, "a_position");
+ mTexCoordLoc = glGetAttribLocation(mCopyProgram, "a_texCoord");
+
+ // Get the sampler location
+ mSamplerLoc = glGetUniformLocation(mCopyProgram, "s_texture");
+
+ // Load the texture
+ mTexture = CreateSimpleTexture2D();
+
+ // Initialize the user framebuffer
+ glGenFramebuffers(1, &mFramebuffer);
+ glGenTextures(mFramebufferAttachmentCount, mFramebufferTextures);
+
+ glBindFramebuffer(GL_FRAMEBUFFER, mFramebuffer);
+ for (size_t i = 0; i < mFramebufferAttachmentCount; i++)
+ {
+ // Create textures for the four color attachments
+ glBindTexture(GL_TEXTURE_2D, mFramebufferTextures[i]);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, getWindow()->getWidth(), getWindow()->getHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0_EXT + i, GL_TEXTURE_2D, mFramebufferTextures[i], 0);
+ }
+
+ glBindTexture(GL_TEXTURE_2D, 0);
+
+ glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+
+ return true;
+ }
+
+ virtual void destroy()
+ {
+ glDeleteProgram(mCopyProgram);
+ glDeleteProgram(mMRTProgram);
+ glDeleteTextures(1, &mTexture);
+ glDeleteTextures(mFramebufferAttachmentCount, mFramebufferTextures);
+ glDeleteFramebuffers(1, &mFramebuffer);
+ }
+
+ virtual void draw()
+ {
+ GLfloat vertices[] =
+ {
+ -0.8f, 0.8f, 0.0f, // Position 0
+ 0.0f, 0.0f, // TexCoord 0
+ -0.8f, -0.8f, 0.0f, // Position 1
+ 0.0f, 1.0f, // TexCoord 1
+ 0.8f, -0.8f, 0.0f, // Position 2
+ 1.0f, 1.0f, // TexCoord 2
+ 0.8f, 0.8f, 0.0f, // Position 3
+ 1.0f, 0.0f // TexCoord 3
+ };
+ GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
+ GLenum drawBuffers[mFramebufferAttachmentCount] =
+ {
+ GL_COLOR_ATTACHMENT0_EXT,
+ GL_COLOR_ATTACHMENT1_EXT,
+ GL_COLOR_ATTACHMENT2_EXT,
+ GL_COLOR_ATTACHMENT3_EXT
+ };
+
+ // Enable drawing to the four color attachments of the user framebuffer
+ glBindFramebuffer(GL_FRAMEBUFFER, mFramebuffer);
+ mDrawBuffers(mFramebufferAttachmentCount, drawBuffers);
+
+ // Set the viewport
+ size_t width = getWindow()->getWidth();
+ size_t height = getWindow()->getHeight();
+ glViewport(0, 0, width, height);
+
+ // Clear the color buffer
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ // Use the program object
+ glUseProgram(mMRTProgram);
+
+ // Load the vertex position
+ glVertexAttribPointer(mPositionLoc, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), vertices);
+ glEnableVertexAttribArray(mPositionLoc);
+
+ // Load the texture coordinate
+ glVertexAttribPointer(mTexCoordLoc, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), vertices + 3);
+ glEnableVertexAttribArray(mTexCoordLoc);
+
+ // Bind the texture
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, mTexture);
+
+ // Set the sampler texture unit to 0
+ glUniform1i(mSamplerLoc, 0);
+
+ // Draw the textured quad to the four render targets
+ glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
+
+ // Enable the default framebuffer and single textured drawing
+ glBindFramebuffer(GL_FRAMEBUFFER, 0);
+ glUseProgram(mCopyProgram);
+
+ // Draw the four textured quads to a separate region in the viewport
+ glBindTexture(GL_TEXTURE_2D, mFramebufferTextures[0]);
+ glViewport(0, 0, width / 2, height / 2);
+ glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
+
+ glBindTexture(GL_TEXTURE_2D, mFramebufferTextures[1]);
+ glViewport(width / 2, 0, width / 2, height / 2);
+ glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
+
+ glBindTexture(GL_TEXTURE_2D, mFramebufferTextures[2]);
+ glViewport(0, height / 2, width / 2, height / 2);
+ glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
+
+ glBindTexture(GL_TEXTURE_2D, mFramebufferTextures[3]);
+ glViewport(width / 2, height / 2, width / 2, height / 2);
+ glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
+ }
+
+ private:
+ // Handle to a program object
+ GLuint mMRTProgram;
+ GLuint mCopyProgram;
+
+ // Attribute locations
+ GLint mPositionLoc;
+ GLint mTexCoordLoc;
+
+ // Sampler location
+ GLint mSamplerLoc;
+
+ // Texture handle
+ GLuint mTexture;
+
+ // Framebuffer object handle
+ GLuint mFramebuffer;
+
+ // Framebuffer color attachments
+ static const size_t mFramebufferAttachmentCount = 4;
+ GLuint mFramebufferTextures[mFramebufferAttachmentCount];
+
+ // Loaded draw buffer entry points
+ PFNGLDRAWBUFFERSEXTPROC mDrawBuffers;
+};
+
+int main(int argc, char **argv)
+{
+ MultipleDrawBuffersSample app;
+ return app.run();
+}
diff --git a/chromium/third_party/angle/samples/angle/multiple_draw_buffers/multiple_draw_buffers_copy_fs.glsl b/chromium/third_party/angle/samples/angle/multiple_draw_buffers/multiple_draw_buffers_copy_fs.glsl
new file mode 100644
index 00000000000..59deb61ce04
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/multiple_draw_buffers/multiple_draw_buffers_copy_fs.glsl
@@ -0,0 +1,8 @@
+precision mediump float;
+varying vec2 v_texCoord;
+uniform sampler2D s_texture;
+void main()
+{
+ vec4 color = texture2D(s_texture, v_texCoord);
+ gl_FragColor = color;
+}
diff --git a/chromium/third_party/angle/samples/angle/multiple_draw_buffers/multiple_draw_buffers_fs.glsl b/chromium/third_party/angle/samples/angle/multiple_draw_buffers/multiple_draw_buffers_fs.glsl
new file mode 100644
index 00000000000..d0143d5dc63
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/multiple_draw_buffers/multiple_draw_buffers_fs.glsl
@@ -0,0 +1,12 @@
+#extension GL_EXT_draw_buffers : enable
+precision mediump float;
+varying vec2 v_texCoord;
+uniform sampler2D s_texture;
+void main()
+{
+ vec4 color = texture2D(s_texture, v_texCoord);
+ gl_FragData[0] = color;
+ gl_FragData[1] = vec4(1.0, 1.0, 1.0, 1.0) - color.brga;
+ gl_FragData[2] = vec4(0.2, 1.0, 0.5, 1.0) * color.gbra;
+ gl_FragData[3] = color.rrra;
+}
diff --git a/chromium/third_party/angle/samples/angle/multiple_draw_buffers/multiple_draw_buffers_vs.glsl b/chromium/third_party/angle/samples/angle/multiple_draw_buffers/multiple_draw_buffers_vs.glsl
new file mode 100644
index 00000000000..0978752573f
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/multiple_draw_buffers/multiple_draw_buffers_vs.glsl
@@ -0,0 +1,8 @@
+attribute vec4 a_position;
+attribute vec2 a_texCoord;
+varying vec2 v_texCoord;
+void main()
+{
+ gl_Position = a_position;
+ v_texCoord = a_texCoord;
+}
diff --git a/chromium/third_party/angle/samples/angle/particle_system/ParticleSystem.cpp b/chromium/third_party/angle/samples/angle/particle_system/ParticleSystem.cpp
new file mode 100644
index 00000000000..5c0ae7c76aa
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/particle_system/ParticleSystem.cpp
@@ -0,0 +1,231 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Based on ParticleSystem.c from
+// Book: OpenGL(R) ES 2.0 Programming Guide
+// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
+// ISBN-10: 0321502795
+// ISBN-13: 9780321502797
+// Publisher: Addison-Wesley Professional
+// URLs: http://safari.informit.com/9780321563835
+// http://www.opengles-book.com
+
+#include "SampleApplication.h"
+#include "Vector.h"
+#include "shader_utils.h"
+#include "random_utils.h"
+#include "tga_utils.h"
+#include "path_utils.h"
+
+#define _USE_MATH_DEFINES
+#include <math.h>
+
+class ParticleSystemSample : public SampleApplication
+{
+ public:
+ ParticleSystemSample::ParticleSystemSample()
+ : SampleApplication("ParticleSystem", 1280, 720)
+ {
+ }
+
+ virtual bool initialize()
+ {
+ const std::string vs = SHADER_SOURCE
+ (
+ uniform float u_time;
+ uniform vec3 u_centerPosition;
+ attribute float a_lifetime;
+ attribute vec3 a_startPosition;
+ attribute vec3 a_endPosition;
+ varying float v_lifetime;
+ void main()
+ {
+ if (u_time <= a_lifetime)
+ {
+ gl_Position.xyz = a_startPosition + (u_time * a_endPosition);
+ gl_Position.xyz += u_centerPosition;
+ gl_Position.w = 1.0;
+ }
+ else
+ {
+ gl_Position = vec4(-1000, -1000, 0, 0);
+ }
+ v_lifetime = 1.0 - (u_time / a_lifetime);
+ v_lifetime = clamp(v_lifetime, 0.0, 1.0);
+ gl_PointSize = (v_lifetime * v_lifetime) * 40.0;
+ }
+ );
+
+ const std::string fs = SHADER_SOURCE
+ (
+ precision mediump float;
+ uniform vec4 u_color;
+ varying float v_lifetime;
+ uniform sampler2D s_texture;
+ void main()
+ {
+ vec4 texColor;
+ texColor = texture2D(s_texture, gl_PointCoord);
+ gl_FragColor = vec4(u_color) * texColor;
+ gl_FragColor.a *= v_lifetime;
+ }
+ );
+
+ mProgram = CompileProgram(vs, fs);
+ if (!mProgram)
+ {
+ return false;
+ }
+
+ // Get the attribute locations
+ mLifetimeLoc = glGetAttribLocation(mProgram, "a_lifetime");
+ mStartPositionLoc = glGetAttribLocation(mProgram, "a_startPosition");
+ mEndPositionLoc = glGetAttribLocation(mProgram, "a_endPosition");
+
+ // Get the uniform locations
+ mTimeLoc = glGetUniformLocation(mProgram, "u_time");
+ mCenterPositionLoc = glGetUniformLocation(mProgram, "u_centerPosition");
+ mColorLoc = glGetUniformLocation(mProgram, "u_color");
+ mSamplerLoc = glGetUniformLocation(mProgram, "s_texture");
+
+ glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+
+ // Fill in particle data array
+ for (size_t i = 0; i < mParticleCount; i++)
+ {
+ mParticles[i].lifetime = RandomBetween(0.0f, 1.0f);
+
+ float endAngle = RandomBetween(0, 2.0f * float(M_PI));
+ float endRadius = RandomBetween(0.0f, 2.0f);
+ mParticles[i].endPosition.x = sinf(endAngle) * endRadius;
+ mParticles[i].endPosition.y = cosf(endAngle) * endRadius;
+ mParticles[i].endPosition.z = 0.0f;
+
+ float startAngle = RandomBetween(0, 2.0f * float(M_PI));
+ float startRadius = RandomBetween(0.0f, 0.25f);
+ mParticles[i].startPosition.x = sinf(startAngle) * startRadius;
+ mParticles[i].startPosition.y = cosf(startAngle) * startRadius;
+ mParticles[i].startPosition.z = 0.0f;
+ }
+
+ mParticleTime = 1.0f;
+
+ TGAImage img;
+ if (!LoadTGAImageFromFile(GetExecutableDirectory() + "/smoke.tga", &img))
+ {
+ return false;
+ }
+ mTextureID = LoadTextureFromTGAImage(img);
+ if (!mTextureID)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ virtual void destroy()
+ {
+ glDeleteProgram(mProgram);
+ }
+
+ virtual void step(float dt, double totalTime)
+ {
+ // Use the program object
+ glUseProgram(mProgram);
+
+ mParticleTime += dt;
+ if (mParticleTime >= 1.0f)
+ {
+ mParticleTime = 0.0f;
+
+ // Pick a new start location and color
+ Vector3 centerPos(RandomBetween(-0.5f, 0.5f),
+ RandomBetween(-0.5f, 0.5f),
+ RandomBetween(-0.5f, 0.5f));
+ glUniform3fv(mCenterPositionLoc, 1, centerPos.data);
+
+ // Random color
+ Vector4 color(RandomBetween(0.0f, 1.0f),
+ RandomBetween(0.0f, 1.0f),
+ RandomBetween(0.0f, 1.0f),
+ 0.5f);
+ glUniform4fv(mColorLoc, 1, color.data);
+ }
+
+ // Load uniform time variable
+ glUniform1f(mTimeLoc, mParticleTime);
+ }
+
+ virtual void draw()
+ {
+ // Set the viewport
+ glViewport(0, 0, getWindow()->getWidth(), getWindow()->getHeight());
+
+ // Clear the color buffer
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ // Use the program object
+ glUseProgram(mProgram);
+
+ // Load the vertex attributes
+ glVertexAttribPointer(mLifetimeLoc, 1, GL_FLOAT, GL_FALSE, sizeof(Particle), &mParticles[0].lifetime);
+ glVertexAttribPointer(mEndPositionLoc, 3, GL_FLOAT, GL_FALSE, sizeof(Particle), &mParticles[0].endPosition);
+ glVertexAttribPointer(mStartPositionLoc, 3, GL_FLOAT, GL_FALSE, sizeof(Particle), &mParticles[0].startPosition);
+
+ glEnableVertexAttribArray(mLifetimeLoc);
+ glEnableVertexAttribArray(mEndPositionLoc);
+ glEnableVertexAttribArray(mStartPositionLoc);
+
+ // Blend particles
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+
+ // Bind the texture
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, mTextureID);
+
+ // Set the sampler texture unit to 0
+ glUniform1i(mSamplerLoc, 0);
+
+ glDrawArrays(GL_POINTS, 0, mParticleCount);
+ }
+
+ private:
+ // Handle to a program object
+ GLuint mProgram;
+
+ // Attribute locations
+ GLint mLifetimeLoc;
+ GLint mStartPositionLoc;
+ GLint mEndPositionLoc;
+
+ // Uniform location
+ GLint mTimeLoc;
+ GLint mColorLoc;
+ GLint mCenterPositionLoc;
+ GLint mSamplerLoc;
+
+ // Texture handle
+ GLuint mTextureID;
+
+ // Particle vertex data
+ struct Particle
+ {
+ float lifetime;
+ Vector3 startPosition;
+ Vector3 endPosition;
+ };
+ static const size_t mParticleCount = 1024;
+ std::array<Particle, mParticleCount> mParticles;
+ float mParticleTime;
+};
+
+int main(int argc, char **argv)
+{
+ ParticleSystemSample app;
+ return app.run();
+}
diff --git a/chromium/third_party/angle/samples/gles2_book/ParticleSystem/smoke.tga b/chromium/third_party/angle/samples/angle/particle_system/smoke.tga
index 06a0705c7e6..06a0705c7e6 100644
--- a/chromium/third_party/angle/samples/gles2_book/ParticleSystem/smoke.tga
+++ b/chromium/third_party/angle/samples/angle/particle_system/smoke.tga
Binary files differ
diff --git a/chromium/third_party/angle/samples/angle/post_sub_buffer/PostSubBuffer.cpp b/chromium/third_party/angle/samples/angle/post_sub_buffer/PostSubBuffer.cpp
new file mode 100644
index 00000000000..044437ad2cf
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/post_sub_buffer/PostSubBuffer.cpp
@@ -0,0 +1,176 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Based on Simple_VertexShader.c from
+// Book: OpenGL(R) ES 2.0 Programming Guide
+// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
+// ISBN-10: 0321502795
+// ISBN-13: 9780321502797
+// Publisher: Addison-Wesley Professional
+// URLs: http://safari.informit.com/9780321563835
+// http://www.opengles-book.com
+
+#include "SampleApplication.h"
+#include "shader_utils.h"
+#include "texture_utils.h"
+#include "geometry_utils.h"
+#include "Vector.h"
+#include "Matrix.h"
+#include <iostream>
+
+class PostSubBufferSample : public SampleApplication
+{
+ public:
+ PostSubBufferSample::PostSubBufferSample()
+ : SampleApplication("PostSubBuffer", 1280, 720)
+ {
+ }
+
+ virtual bool initialize()
+ {
+ mPostSubBufferNV = (PFNEGLPOSTSUBBUFFERNVPROC)eglGetProcAddress("eglPostSubBufferNV");
+ if (!mPostSubBufferNV)
+ {
+ std::cerr << "Could not load eglPostSubBufferNV.";
+ return false;
+ }
+
+ const std::string vs = SHADER_SOURCE
+ (
+ uniform mat4 u_mvpMatrix;
+ attribute vec4 a_position;
+ attribute vec2 a_texcoord;
+ varying vec2 v_texcoord;
+ void main()
+ {
+ gl_Position = u_mvpMatrix * a_position;
+ v_texcoord = a_texcoord;
+ }
+ );
+
+ const std::string fs = SHADER_SOURCE
+ (
+ precision mediump float;
+ varying vec2 v_texcoord;
+ void main()
+ {
+ gl_FragColor = vec4(v_texcoord.x, v_texcoord.y, 1.0, 1.0);
+ }
+ );
+
+ mProgram = CompileProgram(vs, fs);
+ if (!mProgram)
+ {
+ return false;
+ }
+
+ // Get the attribute locations
+ mPositionLoc = glGetAttribLocation(mProgram, "a_position");
+ mTexcoordLoc = glGetAttribLocation(mProgram, "a_texcoord");
+
+ // Get the uniform locations
+ mMVPMatrixLoc = glGetUniformLocation(mProgram, "u_mvpMatrix");
+
+ // Generate the geometry data
+ GenerateCubeGeometry(0.5f, &mCube);
+
+ // Set an initial rotation
+ mRotation = 45.0f;
+
+ // Clear the whole window surface to blue.
+ glClearColor(0.0f, 0.0f, 1.0f, 0.0f);
+ glClear(GL_COLOR_BUFFER_BIT);
+ SampleApplication::swap();
+
+ glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ glCullFace(GL_BACK);
+ glEnable(GL_CULL_FACE);
+
+ return true;
+ }
+
+ virtual void destroy()
+ {
+ glDeleteProgram(mProgram);
+ }
+
+ virtual void step(float dt, double totalTime)
+ {
+ mRotation = fmod(mRotation + (dt * 40.0f), 360.0f);
+
+ Matrix4 perspectiveMatrix = Matrix4::perspective(60.0f, float(getWindow()->getWidth()) / getWindow()->getHeight(),
+ 1.0f, 20.0f);
+
+ Matrix4 modelMatrix = Matrix4::translate(Vector3(0.0f, 0.0f, -2.0f)) *
+ Matrix4::rotate(mRotation, Vector3(1.0f, 0.0f, 1.0f));
+
+ Matrix4 viewMatrix = Matrix4::identity();
+
+ Matrix4 mvpMatrix = perspectiveMatrix * viewMatrix * modelMatrix;
+
+ // Load the matrices
+ glUniformMatrix4fv(mMVPMatrixLoc, 1, GL_FALSE, mvpMatrix.data);
+ }
+
+ virtual void draw()
+ {
+ // Set the viewport
+ glViewport(0, 0, getWindow()->getWidth(), getWindow()->getHeight());
+
+ // Clear the color buffer
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ // Use the program object
+ glUseProgram(mProgram);
+
+ // Load the vertex position
+ glVertexAttribPointer(mPositionLoc, 3, GL_FLOAT, GL_FALSE, 0, mCube.positions.data());
+ glEnableVertexAttribArray(mPositionLoc);
+
+ // Load the texcoord data
+ glVertexAttribPointer(mTexcoordLoc, 2, GL_FLOAT, GL_FALSE, 0, mCube.texcoords.data());
+ glEnableVertexAttribArray(mTexcoordLoc);
+
+ // Draw the cube
+ glDrawElements(GL_TRIANGLES, mCube.indices.size(), GL_UNSIGNED_SHORT, mCube.indices.data());
+ }
+
+ virtual void swap()
+ {
+ // Instead of letting the application call eglSwapBuffers, call eglPostSubBufferNV here instead
+ size_t windowWidth = getWindow()->getWidth();
+ size_t windowHeight = getWindow()->getHeight();
+ EGLDisplay display = getWindow()->getDisplay();
+ EGLSurface surface = getSurface();
+ mPostSubBufferNV(display, surface, 60, 60, windowWidth - 120, windowHeight - 120);
+ }
+
+ private:
+ // Handle to a program object
+ GLuint mProgram;
+
+ // Attribute locations
+ GLint mPositionLoc;
+ GLint mTexcoordLoc;
+
+ // Uniform locations
+ GLuint mMVPMatrixLoc;
+
+ // Current rotation
+ float mRotation;
+
+ // Geometry data
+ CubeGeometry mCube;
+
+ // eglPostSubBufferNV entry point
+ PFNEGLPOSTSUBBUFFERNVPROC mPostSubBufferNV;
+};
+
+int main(int argc, char **argv)
+{
+ PostSubBufferSample app;
+ return app.run();
+}
diff --git a/chromium/third_party/angle/samples/angle/sample_util/Event.h b/chromium/third_party/angle/samples/angle/sample_util/Event.h
new file mode 100644
index 00000000000..1414864149d
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/sample_util/Event.h
@@ -0,0 +1,86 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef SAMPLE_UTIL_EVENT_H
+#define SAMPLE_UTIL_EVENT_H
+
+#include "keyboard.h"
+#include "mouse.h"
+
+class Event
+{
+ public:
+ struct MoveEvent
+ {
+ int X;
+ int Y;
+ };
+
+ struct SizeEvent
+ {
+ int Width;
+ int Height;
+ };
+
+ struct KeyEvent
+ {
+ Key Code;
+ bool Alt;
+ bool Control;
+ bool Shift;
+ bool System;
+ };
+
+ struct MouseMoveEvent
+ {
+ int X;
+ int Y;
+ };
+
+ struct MouseButtonEvent
+ {
+ MouseButton Button;
+ int X;
+ int Y;
+ };
+
+ struct MouseWheelEvent
+ {
+ int Delta;
+ };
+
+ enum EventType
+ {
+ EVENT_CLOSED, // The window requested to be closed
+ EVENT_MOVED, // The window has moved
+ EVENT_RESIZED, // The window was resized
+ EVENT_LOST_FOCUS, // The window lost the focus
+ EVENT_GAINED_FOCUS, // The window gained the focus
+ EVENT_TEXT_ENTERED, // A character was entered
+ EVENT_KEY_PRESSED, // A key was pressed
+ EVENT_KEY_RELEASED, // A key was released
+ EVENT_MOUSE_WHEEL_MOVED, // The mouse wheel was scrolled
+ EVENT_MOUSE_BUTTON_PRESSED, // A mouse button was pressed
+ EVENT_MOUSE_BUTTON_RELEASED, // A mouse button was released
+ EVENT_MOUSE_MOVED, // The mouse cursor moved
+ EVENT_MOUSE_ENTERED, // The mouse cursor entered the area of the window
+ EVENT_MOUSE_LEFT, // The mouse cursor left the area of the window
+ };
+
+ EventType Type;
+
+ union
+ {
+ MoveEvent Move; // Move event parameters
+ SizeEvent Size; // Size event parameters
+ KeyEvent Key; // Key event parameters
+ MouseMoveEvent MouseMove; // Mouse move event parameters
+ MouseButtonEvent MouseButton; // Mouse button event parameters
+ MouseWheelEvent MouseWheel; // Mouse wheel event parameters
+ };
+};
+
+#endif SAMPLE_UTIL_EVENT_H
diff --git a/chromium/third_party/angle/samples/angle/sample_util/Matrix.cpp b/chromium/third_party/angle/samples/angle/sample_util/Matrix.cpp
new file mode 100644
index 00000000000..d82478a2086
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/sample_util/Matrix.cpp
@@ -0,0 +1,219 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "Matrix.h"
+
+#define _USE_MATH_DEFINES
+#include <math.h>
+
+Matrix4::Matrix4()
+{
+ data[ 0] = 1.0f; data[ 4] = 0.0f; data[ 8] = 0.0f; data[12] = 0.0f;
+ data[ 1] = 0.0f; data[ 5] = 1.0f; data[ 9] = 0.0f; data[13] = 0.0f;
+ data[ 2] = 0.0f; data[ 6] = 0.0f; data[10] = 1.0f; data[14] = 0.0f;
+ data[ 3] = 0.0f; data[ 7] = 0.0f; data[11] = 0.0f; data[15] = 1.0f;
+}
+
+Matrix4::Matrix4(float m00, float m01, float m02, float m03,
+ float m10, float m11, float m12, float m13,
+ float m20, float m21, float m22, float m23,
+ float m30, float m31, float m32, float m33)
+{
+ data[ 0] = m00; data[ 4] = m01; data[ 8] = m02; data[12] = m03;
+ data[ 1] = m10; data[ 5] = m11; data[ 9] = m12; data[13] = m13;
+ data[ 2] = m20; data[ 6] = m21; data[10] = m22; data[14] = m23;
+ data[ 3] = m30; data[ 7] = m31; data[11] = m32; data[15] = m33;
+}
+
+Matrix4 Matrix4::identity()
+{
+ return Matrix4(1.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 1.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 1.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 1.0f);
+}
+
+Matrix4 Matrix4::rotate(float angle, const Vector3 &p)
+{
+ Vector3 u = Vector3::normalize(p);
+ float theta = angle * (M_PI / 180.0f);
+ float cos_t = cosf(theta);
+ float sin_t = sinf(theta);
+
+ return Matrix4( cos_t + (u.x * u.x * (1.0f - cos_t)), (u.x * u.y * (1.0f - cos_t)) - (u.z * sin_t), (u.x * u.z * (1.0f - cos_t)) + (u.y * sin_t), 0.0f,
+ (u.y * u.x * (1.0f - cos_t)) + (u.z * sin_t), cos_t + (u.y * u.y * (1.0f - cos_t)), (u.y * u.z * (1.0f - cos_t)) - (u.x * sin_t), 0.0f,
+ (u.z * u.x * (1.0f - cos_t)) - (u.y * sin_t), (u.z * u.y * (1.0f - cos_t)) + (u.x * sin_t), cos_t + (u.z * u.z * (1.0f - cos_t)), 0.0f,
+ 0.0f, 0.0f, 0.0f, 1.0f);
+}
+
+Matrix4 Matrix4::translate(const Vector3 &t)
+{
+ return Matrix4(1.0f, 0.0f, 0.0f, t.x,
+ 0.0f, 1.0f, 0.0f, t.y,
+ 0.0f, 0.0f, 1.0f, t.z,
+ 0.0f, 0.0f, 0.0f, 1.0f);
+}
+
+Matrix4 Matrix4::scale(const Vector3 &s)
+{
+ return Matrix4( s.x, 0.0f, 0.0f, 0.0f,
+ 0.0f, s.y, 0.0f, 0.0f,
+ 0.0f, 0.0f, s.z, 0.0f,
+ 0.0f, 0.0f, 0.0f, 1.0f);
+}
+
+Matrix4 Matrix4::frustum(float l, float r, float b, float t, float n, float f)
+{
+ return Matrix4((2.0f * n) / (r - l), 0.0f, (r + l) / (r - l), 0.0f,
+ 0.0f, (2.0f * n) / (t - b), (t + b) / (t - b), 0.0f,
+ 0.0f, 0.0f, -(f + n) / (f - n), -(2.0f * f * n) / (f - n),
+ 0.0f, 0.0f, -1.0f, 0.0f);
+}
+
+Matrix4 Matrix4::perspective(float fovY, float aspectRatio, float nearZ, float farZ)
+{
+ const float frustumHeight = tanf(fovY / 360.0f * M_PI) * nearZ;
+ const float frustumWidth = frustumHeight * aspectRatio;
+ return frustum(-frustumWidth, frustumWidth, -frustumHeight, frustumHeight, nearZ, farZ);
+}
+
+Matrix4 Matrix4::ortho(float l, float r, float b, float t, float n, float f)
+{
+ return Matrix4(2.0f / (r - l), 0.0f, 0.0f, -(r + l) / (r - l),
+ 0.0f, 2.0f / (t - b), 0.0f, -(t + b) / (t - b),
+ 0.0f, 0.0f, -2.0f / (f - n), -(f + n) / (f - n),
+ 0.0f, 0.0f, 0.0f, 1.0f);
+}
+
+Matrix4 Matrix4::rollPitchYaw(float roll, float pitch, float yaw)
+{
+ return rotate(yaw, Vector3(0, 0, 1)) *
+ rotate(pitch, Vector3(0, 1, 0)) *
+ rotate(roll, Vector3(1, 0, 0));
+}
+
+Matrix4 Matrix4::invert(const Matrix4 &mat)
+{
+ Matrix4 inverted( mat.data[ 5] * mat.data[10] * mat.data[15] - mat.data[5] * mat.data[11] * mat.data[14] - mat.data[ 9] * mat.data[ 6] * mat.data[15] + mat.data[ 9] * mat.data[ 7] * mat.data[14] + mat.data[13] * mat.data[ 6] * mat.data[11] - mat.data[13] * mat.data[ 7] * mat.data[10],
+ -mat.data[ 4] * mat.data[10] * mat.data[15] + mat.data[4] * mat.data[11] * mat.data[14] + mat.data[ 8] * mat.data[ 6] * mat.data[15] - mat.data[ 8] * mat.data[ 7] * mat.data[14] - mat.data[12] * mat.data[ 6] * mat.data[11] + mat.data[12] * mat.data[ 7] * mat.data[10],
+ mat.data[ 4] * mat.data[ 9] * mat.data[15] - mat.data[4] * mat.data[11] * mat.data[13] - mat.data[ 8] * mat.data[ 5] * mat.data[15] + mat.data[ 8] * mat.data[ 7] * mat.data[13] + mat.data[12] * mat.data[ 5] * mat.data[11] - mat.data[12] * mat.data[ 7] * mat.data[ 9],
+ -mat.data[ 4] * mat.data[ 9] * mat.data[14] + mat.data[4] * mat.data[10] * mat.data[13] + mat.data[ 8] * mat.data[ 5] * mat.data[14] - mat.data[ 8] * mat.data[ 6] * mat.data[13] - mat.data[12] * mat.data[ 5] * mat.data[10] + mat.data[12] * mat.data[ 6] * mat.data[ 9],
+ -mat.data[ 1] * mat.data[10] * mat.data[15] + mat.data[1] * mat.data[11] * mat.data[14] + mat.data[ 9] * mat.data[ 2] * mat.data[15] - mat.data[ 9] * mat.data[ 3] * mat.data[14] - mat.data[13] * mat.data[ 2] * mat.data[11] + mat.data[13] * mat.data[ 3] * mat.data[10],
+ mat.data[ 0] * mat.data[10] * mat.data[15] - mat.data[0] * mat.data[11] * mat.data[14] - mat.data[ 8] * mat.data[ 2] * mat.data[15] + mat.data[ 8] * mat.data[ 3] * mat.data[14] + mat.data[12] * mat.data[ 2] * mat.data[11] - mat.data[12] * mat.data[ 3] * mat.data[10],
+ -mat.data[ 0] * mat.data[ 9] * mat.data[15] + mat.data[0] * mat.data[11] * mat.data[13] + mat.data[ 8] * mat.data[ 1] * mat.data[15] - mat.data[ 8] * mat.data[ 3] * mat.data[13] - mat.data[12] * mat.data[ 1] * mat.data[11] + mat.data[12] * mat.data[ 3] * mat.data[ 9],
+ mat.data[ 0] * mat.data[ 9] * mat.data[14] - mat.data[0] * mat.data[10] * mat.data[13] - mat.data[ 8] * mat.data[ 1] * mat.data[14] + mat.data[ 8] * mat.data[ 2] * mat.data[13] + mat.data[12] * mat.data[ 1] * mat.data[10] - mat.data[12] * mat.data[ 2] * mat.data[ 9],
+ mat.data[ 1] * mat.data[ 6] * mat.data[15] - mat.data[1] * mat.data[ 7] * mat.data[14] - mat.data[ 5] * mat.data[ 2] * mat.data[15] + mat.data[ 5] * mat.data[ 3] * mat.data[14] + mat.data[13] * mat.data[ 2] * mat.data[ 7] - mat.data[13] * mat.data[ 3] * mat.data[ 6],
+ -mat.data[ 0] * mat.data[ 6] * mat.data[15] + mat.data[0] * mat.data[ 7] * mat.data[14] + mat.data[ 4] * mat.data[ 2] * mat.data[15] - mat.data[ 4] * mat.data[ 3] * mat.data[14] - mat.data[12] * mat.data[ 2] * mat.data[ 7] + mat.data[12] * mat.data[ 3] * mat.data[ 6],
+ mat.data[ 0] * mat.data[ 5] * mat.data[15] - mat.data[0] * mat.data[ 7] * mat.data[13] - mat.data[ 4] * mat.data[ 1] * mat.data[15] + mat.data[ 4] * mat.data[ 3] * mat.data[13] + mat.data[12] * mat.data[ 1] * mat.data[ 7] - mat.data[12] * mat.data[ 3] * mat.data[ 5],
+ -mat.data[ 0] * mat.data[ 5] * mat.data[14] + mat.data[0] * mat.data[ 6] * mat.data[13] + mat.data[ 4] * mat.data[ 1] * mat.data[14] - mat.data[ 4] * mat.data[ 2] * mat.data[13] - mat.data[12] * mat.data[ 1] * mat.data[ 6] + mat.data[12] * mat.data[ 2] * mat.data[ 5],
+ -mat.data[ 1] * mat.data[ 6] * mat.data[11] + mat.data[1] * mat.data[ 7] * mat.data[10] + mat.data[ 5] * mat.data[ 2] * mat.data[11] - mat.data[ 5] * mat.data[ 3] * mat.data[10] - mat.data[ 9] * mat.data[ 2] * mat.data[ 7] + mat.data[ 9] * mat.data[ 3] * mat.data[ 6],
+ mat.data[ 0] * mat.data[ 6] * mat.data[11] - mat.data[0] * mat.data[ 7] * mat.data[10] - mat.data[ 4] * mat.data[ 2] * mat.data[11] + mat.data[ 4] * mat.data[ 3] * mat.data[10] + mat.data[ 8] * mat.data[ 2] * mat.data[ 7] - mat.data[ 8] * mat.data[ 3] * mat.data[ 6],
+ -mat.data[ 0] * mat.data[ 5] * mat.data[11] + mat.data[0] * mat.data[ 7] * mat.data[ 9] + mat.data[ 4] * mat.data[ 1] * mat.data[11] - mat.data[ 4] * mat.data[ 3] * mat.data[ 9] - mat.data[ 8] * mat.data[ 1] * mat.data[ 7] + mat.data[ 8] * mat.data[ 3] * mat.data[ 5],
+ mat.data[ 0] * mat.data[ 5] * mat.data[10] - mat.data[0] * mat.data[ 6] * mat.data[ 9] - mat.data[ 4] * mat.data[ 1] * mat.data[10] + mat.data[ 4] * mat.data[ 2] * mat.data[ 9] + mat.data[ 8] * mat.data[ 1] * mat.data[ 6] - mat.data[ 8] * mat.data[ 2] * mat.data[ 5]);
+
+ float determinant = mat.data[0] * inverted.data[0] + mat.data[1] * inverted.data[4] + mat.data[2] * inverted.data[8] + mat.data[3] * inverted.data[12];
+
+ if (determinant != 0.0f)
+ {
+ inverted *= 1.0f / determinant;
+ }
+ else
+ {
+ inverted = identity();
+ }
+
+ return inverted;
+}
+
+Matrix4 Matrix4::transpose(const Matrix4 &mat)
+{
+ return Matrix4(mat.data[ 0], mat.data[ 1], mat.data[ 2], mat.data[ 3],
+ mat.data[ 4], mat.data[ 5], mat.data[ 6], mat.data[ 7],
+ mat.data[ 8], mat.data[ 9], mat.data[10], mat.data[11],
+ mat.data[12], mat.data[13], mat.data[14], mat.data[15]);
+}
+
+Vector3 Matrix4::transform(const Matrix4 &mat, const Vector3 &pt)
+{
+ Vector4 transformed = Vector4::normalize(mat * Vector4(pt.x, pt.y, pt.z, 1.0f));
+ return Vector3(transformed.x, transformed.y, transformed.z);
+}
+
+Vector3 Matrix4::transform(const Matrix4 &mat, const Vector4 &pt)
+{
+ Vector4 transformed = Vector4::normalize(mat * pt);
+ return Vector3(transformed.x, transformed.y, transformed.z);
+}
+
+Matrix4 operator*(const Matrix4 &a, const Matrix4 &b)
+{
+ return Matrix4(a.data[ 0] * b.data[ 0] + a.data[ 4] * b.data[ 1] + a.data[ 8] * b.data[ 2] + a.data[12] * b.data[ 3],
+ a.data[ 0] * b.data[ 4] + a.data[ 4] * b.data[ 5] + a.data[ 8] * b.data[ 6] + a.data[12] * b.data[ 7],
+ a.data[ 0] * b.data[ 8] + a.data[ 4] * b.data[ 9] + a.data[ 8] * b.data[10] + a.data[12] * b.data[11],
+ a.data[ 0] * b.data[12] + a.data[ 4] * b.data[13] + a.data[ 8] * b.data[14] + a.data[12] * b.data[15],
+ a.data[ 1] * b.data[ 0] + a.data[ 5] * b.data[ 1] + a.data[ 9] * b.data[ 2] + a.data[13] * b.data[ 3],
+ a.data[ 1] * b.data[ 4] + a.data[ 5] * b.data[ 5] + a.data[ 9] * b.data[ 6] + a.data[13] * b.data[ 7],
+ a.data[ 1] * b.data[ 8] + a.data[ 5] * b.data[ 9] + a.data[ 9] * b.data[10] + a.data[13] * b.data[11],
+ a.data[ 1] * b.data[12] + a.data[ 5] * b.data[13] + a.data[ 9] * b.data[14] + a.data[13] * b.data[15],
+ a.data[ 2] * b.data[ 0] + a.data[ 6] * b.data[ 1] + a.data[10] * b.data[ 2] + a.data[14] * b.data[ 3],
+ a.data[ 2] * b.data[ 4] + a.data[ 6] * b.data[ 5] + a.data[10] * b.data[ 6] + a.data[14] * b.data[ 7],
+ a.data[ 2] * b.data[ 8] + a.data[ 6] * b.data[ 9] + a.data[10] * b.data[10] + a.data[14] * b.data[11],
+ a.data[ 2] * b.data[12] + a.data[ 6] * b.data[13] + a.data[10] * b.data[14] + a.data[14] * b.data[15],
+ a.data[ 3] * b.data[ 0] + a.data[ 7] * b.data[ 1] + a.data[11] * b.data[ 2] + a.data[15] * b.data[ 3],
+ a.data[ 3] * b.data[ 4] + a.data[ 7] * b.data[ 5] + a.data[11] * b.data[ 6] + a.data[15] * b.data[ 7],
+ a.data[ 3] * b.data[ 8] + a.data[ 7] * b.data[ 9] + a.data[11] * b.data[10] + a.data[15] * b.data[11],
+ a.data[ 3] * b.data[12] + a.data[ 7] * b.data[13] + a.data[11] * b.data[14] + a.data[15] * b.data[15]);
+}
+
+Matrix4 &operator*=(Matrix4 &a, const Matrix4 &b)
+{
+ a = a * b;
+ return a;
+}
+
+Matrix4 operator*(const Matrix4 &a, float b)
+{
+ Matrix4 ret(a);
+ for (size_t i = 0; i < 16; i++)
+ {
+ ret.data[i] *= b;
+ }
+ return ret;
+}
+
+Matrix4 &operator*=(Matrix4 &a, float b)
+{
+ for (size_t i = 0; i < 16; i++)
+ {
+ a.data[i] *= b;
+ }
+ return a;
+}
+
+Vector4 operator*(const Matrix4 &a, const Vector4 &b)
+{
+ return Vector4(a.data[ 0] * b.x + a.data[ 4] * b.y + a.data[ 8] * b.z + a.data[12] * b.w,
+ a.data[ 1] * b.x + a.data[ 5] * b.y + a.data[ 9] * b.z + a.data[13] * b.w,
+ a.data[ 2] * b.x + a.data[ 6] * b.y + a.data[10] * b.z + a.data[14] * b.w,
+ a.data[ 3] * b.x + a.data[ 7] * b.y + a.data[11] * b.z + a.data[15] * b.w);
+}
+
+bool operator==(const Matrix4 &a, const Matrix4 &b)
+{
+ for (size_t i = 0; i < 16; i++)
+ {
+ if (a.data[i] != b.data[i])
+ {
+ return false;
+ }
+ }
+ return true;
+}
+
+bool operator!=(const Matrix4 &a, const Matrix4 &b)
+{
+ return !(a == b);
+}
diff --git a/chromium/third_party/angle/samples/angle/sample_util/Matrix.h b/chromium/third_party/angle/samples/angle/sample_util/Matrix.h
new file mode 100644
index 00000000000..c482c52a106
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/sample_util/Matrix.h
@@ -0,0 +1,46 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef SAMPLE_UTIL_MATRIX_H
+#define SAMPLE_UTIL_MATRIX_H
+
+#include "Vector.h"
+
+struct Matrix4
+{
+ float data[16];
+
+ Matrix4();
+ Matrix4(float m00, float m01, float m02, float m03,
+ float m10, float m11, float m12, float m13,
+ float m20, float m21, float m22, float m23,
+ float m30, float m31, float m32, float m33);
+
+ static Matrix4 identity();
+ static Matrix4 rotate(float angle, const Vector3 &p);
+ static Matrix4 translate(const Vector3 &t);
+ static Matrix4 scale(const Vector3 &s);
+ static Matrix4 frustum(float l, float r, float b, float t, float n, float f);
+ static Matrix4 perspective(float fov, float aspectRatio, float n, float f);
+ static Matrix4 ortho(float l, float r, float b, float t, float n, float f);
+ static Matrix4 rollPitchYaw(float roll, float pitch, float yaw);
+
+ static Matrix4 invert(const Matrix4 &mat);
+ static Matrix4 transpose(const Matrix4 &mat);
+ static Vector3 transform(const Matrix4 &mat, const Vector3 &pt);
+ static Vector3 transform(const Matrix4 &mat, const Vector4 &pt);
+};
+
+Matrix4 operator*(const Matrix4 &a, const Matrix4 &b);
+Matrix4 &operator*=(Matrix4 &a, const Matrix4 &b);
+Matrix4 operator*(const Matrix4 &a, float b);
+Matrix4 &operator*=(Matrix4 &a, float b);
+Vector4 operator*(const Matrix4 &a, const Vector4 &b);
+
+bool operator==(const Matrix4 &a, const Matrix4 &b);
+bool operator!=(const Matrix4 &a, const Matrix4 &b);
+
+#endif // SAMPLE_UTIL_MATRIX_H
diff --git a/chromium/third_party/angle/samples/angle/sample_util/SampleApplication.cpp b/chromium/third_party/angle/samples/angle/sample_util/SampleApplication.cpp
new file mode 100644
index 00000000000..518ffdb6c82
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/sample_util/SampleApplication.cpp
@@ -0,0 +1,223 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "SampleApplication.h"
+
+#ifdef _WIN32
+#include "win32/Win32Timer.h"
+#include "win32/Win32Window.h"
+#else
+#error unsupported OS.
+#endif
+
+SampleApplication::SampleApplication(const std::string& name, size_t width, size_t height,
+ EGLint glesMajorVersion, RendererType requestedRenderer)
+ : mSurface(EGL_NO_SURFACE),
+ mContext(EGL_NO_CONTEXT),
+ mClientVersion(glesMajorVersion),
+ mRequestedRenderer(requestedRenderer),
+ mWidth(width),
+ mHeight(height),
+ mName(name),
+ mRunning(false),
+#ifdef _WIN32
+ mTimer(new Win32Timer()),
+ mWindow(new Win32Window())
+#endif
+{
+}
+
+SampleApplication::~SampleApplication()
+{
+}
+
+bool SampleApplication::initialize()
+{
+ return true;
+}
+
+void SampleApplication::destroy()
+{
+}
+
+void SampleApplication::step(float dt, double totalTime)
+{
+}
+
+void SampleApplication::draw()
+{
+}
+
+void SampleApplication::swap()
+{
+ eglSwapBuffers(mWindow->getDisplay(), mSurface);
+}
+
+Window *SampleApplication::getWindow() const
+{
+ return mWindow.get();
+}
+
+EGLConfig SampleApplication::getConfig() const
+{
+ return mConfig;
+}
+
+EGLSurface SampleApplication::getSurface() const
+{
+ return mSurface;
+}
+
+EGLContext SampleApplication::getContext() const
+{
+ return mContext;
+}
+
+int SampleApplication::run()
+{
+ if (!mWindow->initialize(mName, mWidth, mHeight, mRequestedRenderer))
+ {
+ return -1;
+ }
+
+ if (!initializeGL())
+ {
+ return -1;
+ }
+
+ mRunning = true;
+ int result = 0;
+
+ if (!initialize())
+ {
+ mRunning = false;
+ result = -1;
+ }
+
+ mTimer->start();
+ double prevTime = 0.0;
+
+ while (mRunning)
+ {
+ double elapsedTime = mTimer->getElapsedTime();
+ double deltaTime = elapsedTime - prevTime;
+
+ step(static_cast<float>(deltaTime), elapsedTime);
+
+ // Clear events that the application did not process from this frame
+ Event event;
+ while (popEvent(&event))
+ {
+ // If the application did not catch a close event, close now
+ if (event.Type == Event::EVENT_CLOSED)
+ {
+ exit();
+ }
+ }
+
+ if (!mRunning)
+ {
+ break;
+ }
+
+ draw();
+ swap();
+
+ mWindow->messageLoop();
+
+ prevTime = elapsedTime;
+ }
+
+ destroy();
+ destroyGL();
+ mWindow->destroy();
+
+ return result;
+}
+
+void SampleApplication::exit()
+{
+ mRunning = false;
+}
+
+bool SampleApplication::popEvent(Event *event)
+{
+ return mWindow->popEvent(event);
+}
+
+bool SampleApplication::initializeGL()
+{
+ const EGLint configAttributes[] =
+ {
+ EGL_RED_SIZE, 8,
+ EGL_GREEN_SIZE, 8,
+ EGL_BLUE_SIZE, 8,
+ EGL_ALPHA_SIZE, 8,
+ EGL_DEPTH_SIZE, 24,
+ EGL_STENCIL_SIZE, 8,
+ EGL_SAMPLE_BUFFERS, EGL_DONT_CARE,
+ EGL_NONE
+ };
+
+ EGLint configCount;
+ if (!eglChooseConfig(mWindow->getDisplay(), configAttributes, &mConfig, 1, &configCount) || (configCount != 1))
+ {
+ destroyGL();
+ return false;
+ }
+
+ const EGLint surfaceAttributes[] =
+ {
+ EGL_POST_SUB_BUFFER_SUPPORTED_NV, EGL_TRUE,
+ EGL_NONE, EGL_NONE,
+ };
+
+ mSurface = eglCreateWindowSurface(mWindow->getDisplay(), mConfig, mWindow->getNativeWindow(), surfaceAttributes);
+ if (mSurface == EGL_NO_SURFACE)
+ {
+ eglGetError(); // Clear error and try again
+ mSurface = eglCreateWindowSurface(mWindow->getDisplay(), mConfig, NULL, NULL);
+ }
+
+ if (eglGetError() != EGL_SUCCESS)
+ {
+ destroyGL();
+ return false;
+ }
+
+ EGLint contextAttibutes[] =
+ {
+ EGL_CONTEXT_CLIENT_VERSION, mClientVersion,
+ EGL_NONE
+ };
+ mContext = eglCreateContext(mWindow->getDisplay(), mConfig, NULL, contextAttibutes);
+ if (eglGetError() != EGL_SUCCESS)
+ {
+ destroyGL();
+ return false;
+ }
+
+ eglMakeCurrent(mWindow->getDisplay(), mSurface, mSurface, mContext);
+ if (eglGetError() != EGL_SUCCESS)
+ {
+ destroyGL();
+ return false;
+ }
+
+ // Turn off vsync
+ eglSwapInterval(mWindow->getDisplay(), 0);
+
+ return true;
+}
+
+void SampleApplication::destroyGL()
+{
+ eglDestroySurface(mWindow->getDisplay(), mSurface);
+ mSurface = 0;
+
+ eglDestroyContext(mWindow->getDisplay(), mContext);
+ mContext = 0;
+}
diff --git a/chromium/third_party/angle/samples/angle/sample_util/SampleApplication.h b/chromium/third_party/angle/samples/angle/sample_util/SampleApplication.h
new file mode 100644
index 00000000000..b34454006b1
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/sample_util/SampleApplication.h
@@ -0,0 +1,72 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef SAMPLE_UTIL_SAMPLE_APPLICATION_H
+#define SAMPLE_UTIL_SAMPLE_APPLICATION_H
+
+#define GL_GLEXT_PROTOTYPES
+
+#include <GLES3/gl3.h>
+#include <GLES3/gl3ext.h>
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+
+#include "Window.h"
+#include "Timer.h"
+
+#include <string>
+#include <list>
+#include <cstdint>
+#include <memory>
+
+class SampleApplication
+{
+ public:
+ SampleApplication(const std::string& name, size_t width, size_t height,
+ EGLint glesMajorVersion = 2, RendererType requestedRenderer = RENDERER_D3D11);
+ virtual ~SampleApplication();
+
+ virtual bool initialize();
+ virtual void destroy();
+
+ virtual void step(float dt, double totalTime);
+ virtual void draw();
+
+ virtual void swap();
+
+ Window *getWindow() const;
+ EGLConfig getConfig() const;
+ EGLSurface getSurface() const;
+ EGLContext getContext() const;
+
+ bool popEvent(Event *event);
+
+ int run();
+ void exit();
+
+ private:
+ bool initializeGL();
+ void destroyGL();
+
+ EGLConfig mConfig;
+ EGLSurface mSurface;
+ EGLContext mContext;
+
+ GLuint mClientVersion;
+ RendererType mRequestedRenderer;
+ size_t mWidth;
+ size_t mHeight;
+ std::string mName;
+
+ bool mRunning;
+
+ std::unique_ptr<Timer> mTimer;
+ std::unique_ptr<Window> mWindow;
+};
+
+#endif // SAMPLE_UTIL_SAMPLE_APPLICATION_H
diff --git a/chromium/third_party/angle/samples/angle/sample_util/Timer.h b/chromium/third_party/angle/samples/angle/sample_util/Timer.h
new file mode 100644
index 00000000000..b86cf85b4c9
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/sample_util/Timer.h
@@ -0,0 +1,18 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef SAMPLE_UTIL_TIMER_H
+#define SAMPLE_UTIL_TIMER_H
+
+class Timer
+{
+ public:
+ virtual void start() = 0;
+ virtual void stop() = 0;
+ virtual double getElapsedTime() const = 0;
+};
+
+#endif // SAMPLE_UTIL_TIMER_H
diff --git a/chromium/third_party/angle/samples/angle/sample_util/Vector.cpp b/chromium/third_party/angle/samples/angle/sample_util/Vector.cpp
new file mode 100644
index 00000000000..5ea2dfa14a5
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/sample_util/Vector.cpp
@@ -0,0 +1,194 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "Vector.h"
+
+#include <math.h>
+
+Vector2::Vector2()
+ : x(0.0),
+ y(0.0)
+{
+}
+
+Vector2::Vector2(float x, float y)
+ : x(x),
+ y(y)
+{
+}
+
+float Vector2::length(const Vector2 &vec)
+{
+ float lenSquared = lengthSquared(vec);
+ return (lenSquared != 0.0f) ? sqrt(lenSquared) : 0.0f;
+}
+
+float Vector2::lengthSquared(const Vector2 &vec)
+{
+ return vec.x * vec.x +
+ vec.y * vec.y;
+}
+
+Vector2 Vector2::normalize(const Vector2 &vec)
+{
+ Vector2 ret(0.0f, 0.0f);
+ float len = length(vec);
+ if (len != 0.0f)
+ {
+ float invLen = 1.0f / len;
+ ret.x = vec.x * invLen;
+ ret.y = vec.y * invLen;
+ }
+ return ret;
+}
+
+Vector3::Vector3()
+ : x(0.0),
+ y(0.0),
+ z(0.0)
+{
+}
+
+Vector3::Vector3(float x, float y, float z)
+ : x(x),
+ y(y),
+ z(z)
+{
+}
+
+float Vector3::length(const Vector3 &vec)
+{
+ float lenSquared = lengthSquared(vec);
+ return (lenSquared != 0.0f) ? sqrt(lenSquared) : 0.0f;
+}
+
+float Vector3::lengthSquared(const Vector3 &vec)
+{
+ return vec.x * vec.x +
+ vec.y * vec.y +
+ vec.z * vec.z;
+}
+
+Vector3 Vector3::normalize(const Vector3 &vec)
+{
+ Vector3 ret(0.0f, 0.0f, 0.0f);
+ float len = length(vec);
+ if (len != 0.0f)
+ {
+ float invLen = 1.0f / len;
+ ret.x = vec.x * invLen;
+ ret.y = vec.y * invLen;
+ ret.z = vec.z * invLen;
+ }
+ return ret;
+}
+
+float Vector3::dot(const Vector3 &a, const Vector3 &b)
+{
+ return a.x * b.x +
+ a.y * b.y +
+ a.z * b.z;
+}
+
+Vector3 Vector3::cross(const Vector3 &a, const Vector3 &b)
+{
+ return Vector3(a.y * b.z - a.z * b.y,
+ a.z * b.x - a.x * b.z,
+ a.x * b.y - a.y * b.x);
+}
+
+Vector3 operator*(const Vector3 &a, const Vector3 &b)
+{
+ return Vector3(a.x * b.x,
+ a.y * b.y,
+ a.z * b.z);
+}
+
+Vector3 operator*(const Vector3 &a, const float& b)
+{
+ return Vector3(a.x * b,
+ a.y * b,
+ a.z * b);
+}
+
+Vector3 operator/(const Vector3 &a, const Vector3 &b)
+{
+ return Vector3(a.x / b.x,
+ a.y / b.y,
+ a.z / b.z);
+}
+
+Vector3 operator/(const Vector3 &a, const float& b)
+{
+ return Vector3(a.x / b,
+ a.y / b,
+ a.z / b);
+}
+
+Vector3 operator+(const Vector3 &a, const Vector3 &b)
+{
+ return Vector3(a.x + b.x,
+ a.y + b.y,
+ a.z + b.z);
+}
+
+Vector3 operator-(const Vector3 &a, const Vector3 &b)
+{
+ return Vector3(a.x - b.x,
+ a.y - b.y,
+ a.z - b.z);
+}
+
+Vector4::Vector4()
+ : x(0.0f),
+ y(0.0f),
+ z(0.0f),
+ w(0.0f)
+{
+}
+
+Vector4::Vector4(float x, float y, float z, float w)
+ : x(x),
+ y(y),
+ z(z),
+ w(w)
+{
+}
+
+float Vector4::length(const Vector4 &vec)
+{
+ float lenSquared = lengthSquared(vec);
+ return (lenSquared != 0.0f) ? sqrt(lenSquared) : 0.0f;
+}
+
+float Vector4::lengthSquared(const Vector4 &vec)
+{
+ return vec.x * vec.x +
+ vec.y * vec.y +
+ vec.z * vec.z +
+ vec.w * vec.w;
+}
+
+Vector4 Vector4::normalize(const Vector4 &vec)
+{
+ Vector4 ret(0.0f, 0.0f, 0.0f, 1.0f);
+ if (vec.w != 0.0f)
+ {
+ float invLen = 1.0f / vec.w;
+ ret.x = vec.x * invLen;
+ ret.y = vec.y * invLen;
+ ret.z = vec.z * invLen;
+ }
+ return ret;
+}
+
+float Vector4::dot(const Vector4 &a, const Vector4 &b)
+{
+ return a.x * b.x +
+ a.y * b.y +
+ a.z * b.z +
+ a.w * b.w;
+}
diff --git a/chromium/third_party/angle/samples/angle/sample_util/Vector.h b/chromium/third_party/angle/samples/angle/sample_util/Vector.h
new file mode 100644
index 00000000000..ab1c63f82a8
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/sample_util/Vector.h
@@ -0,0 +1,82 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef SAMPLE_UTIL_VECTOR_H
+#define SAMPLE_UTIL_VECTOR_H
+
+struct Vector2
+{
+ union
+ {
+ struct
+ {
+ float x, y;
+ };
+ float data[2];
+ };
+
+ Vector2();
+ Vector2(float x, float y);
+
+ static float length(const Vector2 &vec);
+ static float lengthSquared(const Vector2 &vec);
+
+ static Vector2 normalize(const Vector2 &vec);
+};
+
+struct Vector3
+{
+ union
+ {
+ struct
+ {
+ float x, y, z;
+ };
+ float data[3];
+ };
+
+ Vector3();
+ Vector3(float x, float y, float z);
+
+ static float length(const Vector3 &vec);
+ static float lengthSquared(const Vector3 &vec);
+
+ static Vector3 normalize(const Vector3 &vec);
+
+ static float dot(const Vector3 &a, const Vector3 &b);
+ static Vector3 cross(const Vector3 &a, const Vector3 &b);
+};
+
+Vector3 operator*(const Vector3 &a, const Vector3 &b);
+Vector3 operator*(const Vector3 &a, const float& b);
+Vector3 operator/(const Vector3 &a, const Vector3 &b);
+Vector3 operator/(const Vector3 &a, const float& b);
+Vector3 operator+(const Vector3 &a, const Vector3 &b);
+Vector3 operator-(const Vector3 &a, const Vector3 &b);
+
+struct Vector4
+{
+ union
+ {
+ struct
+ {
+ float x, y, z, w;
+ };
+ float data[4];
+ };
+
+ Vector4();
+ Vector4(float x, float y, float z, float w);
+
+ static float length(const Vector4 &vec);
+ static float lengthSquared(const Vector4 &vec);
+
+ static Vector4 normalize(const Vector4 &vec);
+
+ static float dot(const Vector4 &a, const Vector4 &b);
+};
+
+#endif // SAMPLE_UTIL_VECTOR_H
diff --git a/chromium/third_party/angle/samples/angle/sample_util/Window.cpp b/chromium/third_party/angle/samples/angle/sample_util/Window.cpp
new file mode 100644
index 00000000000..2a23176f638
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/sample_util/Window.cpp
@@ -0,0 +1,50 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "Window.h"
+
+Window::Window()
+ : mWidth(0),
+ mHeight(0)
+{
+}
+
+int Window::getWidth() const
+{
+ return mWidth;
+}
+
+int Window::getHeight() const
+{
+ return mHeight;
+}
+
+bool Window::popEvent(Event *event)
+{
+ if (mEvents.size() > 0 && event)
+ {
+ *event = mEvents.front();
+ mEvents.pop_front();
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+void Window::pushEvent(Event event)
+{
+ switch (event.Type)
+ {
+ case Event::EVENT_RESIZED:
+ mWidth = event.Size.Width;
+ mHeight = event.Size.Height;
+ break;
+ }
+
+ mEvents.push_back(event);
+}
diff --git a/chromium/third_party/angle/samples/angle/sample_util/Window.h b/chromium/third_party/angle/samples/angle/sample_util/Window.h
new file mode 100644
index 00000000000..adf95e800cc
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/sample_util/Window.h
@@ -0,0 +1,50 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef SAMPLE_UTIL_WINDOW_H
+#define SAMPLE_UTIL_WINDOW_H
+
+#include "Event.h"
+
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+#include <list>
+
+enum RendererType
+{
+ RENDERER_D3D9,
+ RENDERER_D3D11
+};
+
+class Window
+{
+ public:
+ Window();
+
+ virtual bool initialize(const std::string &name, size_t width, size_t height, RendererType requestedRenderer) = 0;
+ virtual void destroy() = 0;
+
+ int getWidth() const;
+ int getHeight() const;
+ virtual void setMousePosition(int x, int y) = 0;
+
+ virtual EGLDisplay getDisplay() const = 0;
+ virtual EGLNativeWindowType getNativeWindow() const = 0;
+ virtual EGLNativeDisplayType getNativeDisplay() const = 0;
+
+ virtual void messageLoop() = 0;
+
+ bool popEvent(Event *event);
+ void pushEvent(Event event);
+
+ private:
+ int mWidth;
+ int mHeight;
+
+ std::list<Event> mEvents;
+};
+
+#endif // SAMPLE_UTIL_WINDOW_H
diff --git a/chromium/third_party/angle/samples/angle/sample_util/geometry_utils.cpp b/chromium/third_party/angle/samples/angle/sample_util/geometry_utils.cpp
new file mode 100644
index 00000000000..a4bc2f7eba4
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/sample_util/geometry_utils.cpp
@@ -0,0 +1,145 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "geometry_utils.h"
+
+#define _USE_MATH_DEFINES
+#include <math.h>
+
+void CreateSphereGeometry(size_t sliceCount, float radius, SphereGeometry *result)
+{
+ size_t parellelCount = sliceCount / 2;
+ size_t vertexCount = (parellelCount + 1) * (sliceCount + 1);
+ size_t indexCount = parellelCount * sliceCount * 6;
+ float angleStep = (2.0f * M_PI) / sliceCount;
+
+ result->positions.resize(vertexCount);
+ result->normals.resize(vertexCount);
+ for (size_t i = 0; i < parellelCount + 1; i++)
+ {
+ for (size_t j = 0; j < sliceCount + 1; j++)
+ {
+ Vector3 direction(sinf(angleStep * i) * sinf(angleStep * j),
+ cosf(angleStep * i),
+ sinf(angleStep * i) * cosf(angleStep * j));
+
+ size_t vertexIdx = i * (sliceCount + 1) + j;
+ result->positions[vertexIdx] = direction * radius;
+ result->normals[vertexIdx] = direction;
+ }
+ }
+
+ result->indices.clear();
+ result->indices.reserve(indexCount);
+ for (size_t i = 0; i < parellelCount; i++)
+ {
+ for (size_t j = 0; j < sliceCount; j++)
+ {
+ result->indices.push_back( i * (sliceCount + 1) + j );
+ result->indices.push_back((i + 1) * (sliceCount + 1) + j );
+ result->indices.push_back((i + 1) * (sliceCount + 1) + (j + 1));
+
+ result->indices.push_back( i * (sliceCount + 1) + j );
+ result->indices.push_back((i + 1) * (sliceCount + 1) + (j + 1));
+ result->indices.push_back( i * (sliceCount + 1) + (j + 1));
+ }
+ }
+}
+
+void GenerateCubeGeometry(float radius, CubeGeometry *result)
+{
+ result->positions.resize(24);
+ result->positions[ 0] = Vector3(-radius, -radius, -radius);
+ result->positions[ 1] = Vector3(-radius, -radius, radius);
+ result->positions[ 2] = Vector3( radius, -radius, radius);
+ result->positions[ 3] = Vector3( radius, -radius, -radius);
+ result->positions[ 4] = Vector3(-radius, radius, -radius);
+ result->positions[ 5] = Vector3(-radius, radius, radius);
+ result->positions[ 6] = Vector3( radius, radius, radius);
+ result->positions[ 7] = Vector3( radius, radius, -radius);
+ result->positions[ 8] = Vector3(-radius, -radius, -radius);
+ result->positions[ 9] = Vector3(-radius, radius, -radius);
+ result->positions[10] = Vector3( radius, radius, -radius);
+ result->positions[11] = Vector3( radius, -radius, -radius);
+ result->positions[12] = Vector3(-radius, -radius, radius);
+ result->positions[13] = Vector3(-radius, radius, radius);
+ result->positions[14] = Vector3( radius, radius, radius);
+ result->positions[15] = Vector3( radius, -radius, radius);
+ result->positions[16] = Vector3(-radius, -radius, -radius);
+ result->positions[17] = Vector3(-radius, -radius, radius);
+ result->positions[18] = Vector3(-radius, radius, radius);
+ result->positions[19] = Vector3(-radius, radius, -radius);
+ result->positions[20] = Vector3( radius, -radius, -radius);
+ result->positions[21] = Vector3( radius, -radius, radius);
+ result->positions[22] = Vector3( radius, radius, radius);
+ result->positions[23] = Vector3( radius, radius, -radius);
+
+ result->normals.resize(24);
+ result->normals[ 0] = Vector3( 0.0f, -1.0f, 0.0f);
+ result->normals[ 1] = Vector3( 0.0f, -1.0f, 0.0f);
+ result->normals[ 2] = Vector3( 0.0f, -1.0f, 0.0f);
+ result->normals[ 3] = Vector3( 0.0f, -1.0f, 0.0f);
+ result->normals[ 4] = Vector3( 0.0f, 1.0f, 0.0f);
+ result->normals[ 5] = Vector3( 0.0f, 1.0f, 0.0f);
+ result->normals[ 6] = Vector3( 0.0f, 1.0f, 0.0f);
+ result->normals[ 7] = Vector3( 0.0f, 1.0f, 0.0f);
+ result->normals[ 8] = Vector3( 0.0f, 0.0f, -1.0f);
+ result->normals[ 9] = Vector3( 0.0f, 0.0f, -1.0f);
+ result->normals[10] = Vector3( 0.0f, 0.0f, -1.0f);
+ result->normals[11] = Vector3( 0.0f, 0.0f, -1.0f);
+ result->normals[12] = Vector3( 0.0f, 0.0f, 1.0f);
+ result->normals[13] = Vector3( 0.0f, 0.0f, 1.0f);
+ result->normals[14] = Vector3( 0.0f, 0.0f, 1.0f);
+ result->normals[15] = Vector3( 0.0f, 0.0f, 1.0f);
+ result->normals[16] = Vector3(-1.0f, 0.0f, 0.0f);
+ result->normals[17] = Vector3(-1.0f, 0.0f, 0.0f);
+ result->normals[18] = Vector3(-1.0f, 0.0f, 0.0f);
+ result->normals[19] = Vector3(-1.0f, 0.0f, 0.0f);
+ result->normals[20] = Vector3( 1.0f, 0.0f, 0.0f);
+ result->normals[21] = Vector3( 1.0f, 0.0f, 0.0f);
+ result->normals[22] = Vector3( 1.0f, 0.0f, 0.0f);
+ result->normals[23] = Vector3( 1.0f, 0.0f, 0.0f);
+
+ result->texcoords.resize(24);
+ result->texcoords[ 0] = Vector2(0.0f, 0.0f);
+ result->texcoords[ 1] = Vector2(0.0f, 1.0f);
+ result->texcoords[ 2] = Vector2(1.0f, 1.0f);
+ result->texcoords[ 3] = Vector2(1.0f, 0.0f);
+ result->texcoords[ 4] = Vector2(1.0f, 0.0f);
+ result->texcoords[ 5] = Vector2(1.0f, 1.0f);
+ result->texcoords[ 6] = Vector2(0.0f, 1.0f);
+ result->texcoords[ 7] = Vector2(0.0f, 0.0f);
+ result->texcoords[ 8] = Vector2(0.0f, 0.0f);
+ result->texcoords[ 9] = Vector2(0.0f, 1.0f);
+ result->texcoords[10] = Vector2(1.0f, 1.0f);
+ result->texcoords[11] = Vector2(1.0f, 0.0f);
+ result->texcoords[12] = Vector2(0.0f, 0.0f);
+ result->texcoords[13] = Vector2(0.0f, 1.0f);
+ result->texcoords[14] = Vector2(1.0f, 1.0f);
+ result->texcoords[15] = Vector2(1.0f, 0.0f);
+ result->texcoords[16] = Vector2(0.0f, 0.0f);
+ result->texcoords[17] = Vector2(0.0f, 1.0f);
+ result->texcoords[18] = Vector2(1.0f, 1.0f);
+ result->texcoords[19] = Vector2(1.0f, 0.0f);
+ result->texcoords[20] = Vector2(0.0f, 0.0f);
+ result->texcoords[21] = Vector2(0.0f, 1.0f);
+ result->texcoords[22] = Vector2(1.0f, 1.0f);
+ result->texcoords[23] = Vector2(1.0f, 0.0f);
+
+ result->indices.resize(36);
+ result->indices[ 0] = 0; result->indices[ 1] = 2; result->indices[ 2] = 1;
+ result->indices[ 3] = 0; result->indices[ 4] = 3; result->indices[ 5] = 2;
+ result->indices[ 6] = 4; result->indices[ 7] = 5; result->indices[ 8] = 6;
+ result->indices[ 9] = 4; result->indices[10] = 6; result->indices[11] = 7;
+ result->indices[12] = 8; result->indices[13] = 9; result->indices[14] = 10;
+ result->indices[15] = 8; result->indices[16] = 10; result->indices[17] = 11;
+ result->indices[18] = 12; result->indices[19] = 15; result->indices[20] = 14;
+ result->indices[21] = 12; result->indices[22] = 14; result->indices[23] = 13;
+ result->indices[24] = 16; result->indices[25] = 17; result->indices[26] = 18;
+ result->indices[27] = 16; result->indices[28] = 18; result->indices[29] = 19;
+ result->indices[30] = 20; result->indices[31] = 23; result->indices[32] = 22;
+ result->indices[33] = 20; result->indices[34] = 22; result->indices[35] = 21;
+}
diff --git a/chromium/third_party/angle/samples/angle/sample_util/geometry_utils.h b/chromium/third_party/angle/samples/angle/sample_util/geometry_utils.h
new file mode 100644
index 00000000000..84221a12f45
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/sample_util/geometry_utils.h
@@ -0,0 +1,34 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef SAMPLE_UTIL_GEOMETRY_UTILS_H
+#define SAMPLE_UTIL_GEOMETRY_UTILS_H
+
+#include <GLES2/gl2.h>
+
+#include "Vector.h"
+#include <vector>
+
+struct SphereGeometry
+{
+ std::vector<Vector3> positions;
+ std::vector<Vector3> normals;
+ std::vector<GLushort> indices;
+};
+
+void CreateSphereGeometry(size_t sliceCount, float radius, SphereGeometry *result);
+
+struct CubeGeometry
+{
+ std::vector<Vector3> positions;
+ std::vector<Vector3> normals;
+ std::vector<Vector2> texcoords;
+ std::vector<GLushort> indices;
+};
+
+void GenerateCubeGeometry(float radius, CubeGeometry *result);
+
+#endif // SAMPLE_UTIL_GEOMETRY_UTILS_H
diff --git a/chromium/third_party/angle/samples/angle/sample_util/keyboard.h b/chromium/third_party/angle/samples/angle/sample_util/keyboard.h
new file mode 100644
index 00000000000..2718dd5ab9b
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/sample_util/keyboard.h
@@ -0,0 +1,117 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef SAMPLE_UTIL_KEYBOARD_H
+#define SAMPLE_UTIL_KEYBOARD_H
+
+enum Key
+{
+ KEY_UNKNOWN,
+ KEY_A, // The A key
+ KEY_B, // The B key
+ KEY_C, // The C key
+ KEY_D, // The D key
+ KEY_E, // The E key
+ KEY_F, // The F key
+ KEY_G, // The G key
+ KEY_H, // The H key
+ KEY_I, // The I key
+ KEY_J, // The J key
+ KEY_K, // The K key
+ KEY_L, // The L key
+ KEY_M, // The M key
+ KEY_N, // The N key
+ KEY_O, // The O key
+ KEY_P, // The P key
+ KEY_Q, // The Q key
+ KEY_R, // The R key
+ KEY_S, // The S key
+ KEY_T, // The T key
+ KEY_U, // The U key
+ KEY_V, // The V key
+ KEY_W, // The W key
+ KEY_X, // The X key
+ KEY_Y, // The Y key
+ KEY_Z, // The Z key
+ KEY_NUM0, // The 0 key
+ KEY_NUM1, // The 1 key
+ KEY_NUM2, // The 2 key
+ KEY_NUM3, // The 3 key
+ KEY_NUM4, // The 4 key
+ KEY_NUM5, // The 5 key
+ KEY_NUM6, // The 6 key
+ KEY_NUM7, // The 7 key
+ KEY_NUM8, // The 8 key
+ KEY_NUM9, // The 9 key
+ KEY_ESCAPE, // The escape key
+ KEY_LCONTROL, // The left control key
+ KEY_LSHIFT, // The left shift key
+ KEY_LALT, // The left alt key
+ KEY_LSYSTEM, // The left OS specific key: Window (Windows and Linux), Apple (MacOS X), ...
+ KEY_RCONTROL, // The right control key
+ KEY_RSHIFT, // The right shift key
+ KEY_RALT, // The right alt key
+ KEY_RSYSTEM, // The right OS specific key: Window (Windows and Linux), Apple (MacOS X), ...
+ KEY_MENU, // The menu key
+ KEY_LBRACKET, // The [ key
+ KEY_RBRACKET, // The ] key
+ KEY_SEMICOLON, // The ; key
+ KEY_COMMA, // The , key
+ KEY_PERIOD, // The . key
+ KEY_QUOTE, // The ' key
+ KEY_SLASH, // The / key
+ KEY_BACKSLASH, // The \ key
+ KEY_TILDE, // The ~ key
+ KEY_EQUAL, // The = key
+ KEY_DASH, // The - key
+ KEY_SPACE, // The space key
+ KEY_RETURN, // The return key
+ KEY_BACK, // The backspace key
+ KEY_TAB, // The tabulation key
+ KEY_PAGEUP, // The page up key
+ KEY_PAGEDOWN, // The page down key
+ KEY_END, // The end key
+ KEY_HOME, // The home key
+ KEY_INSERT, // The insert key
+ KEY_DELETE, // The delete key
+ KEY_ADD, // +
+ KEY_SUBTRACT, // -
+ KEY_MULTIPLY, // *
+ KEY_DIVIDE, // /
+ KEY_LEFT, // Left arrow
+ KEY_RIGHT, // Right arrow
+ KEY_UP, // Up arrow
+ KEY_DOWN, // Down arrow
+ KEY_NUMPAD0, // The numpad 0 key
+ KEY_NUMPAD1, // The numpad 1 key
+ KEY_NUMPAD2, // The numpad 2 key
+ KEY_NUMPAD3, // The numpad 3 key
+ KEY_NUMPAD4, // The numpad 4 key
+ KEY_NUMPAD5, // The numpad 5 key
+ KEY_NUMPAD6, // The numpad 6 key
+ KEY_NUMPAD7, // The numpad 7 key
+ KEY_NUMPAD8, // The numpad 8 key
+ KEY_NUMPAD9, // The numpad 9 key
+ KEY_F1, // The F1 key
+ KEY_F2, // The F2 key
+ KEY_F3, // The F3 key
+ KEY_F4, // The F4 key
+ KEY_F5, // The F5 key
+ KEY_F6, // The F6 key
+ KEY_F7, // The F7 key
+ KEY_F8, // The F8 key
+ KEY_F9, // The F8 key
+ KEY_F10, // The F10 key
+ KEY_F11, // The F11 key
+ KEY_F12, // The F12 key
+ KEY_F13, // The F13 key
+ KEY_F14, // The F14 key
+ KEY_F15, // The F15 key
+ KEY_PAUSE, // The pause key
+ KEY_COUNT,
+};
+
+#endif // SAMPLE_UTIL_KEYBOARD_H
diff --git a/chromium/third_party/angle/samples/angle/sample_util/mouse.h b/chromium/third_party/angle/samples/angle/sample_util/mouse.h
new file mode 100644
index 00000000000..d51b96d74e8
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/sample_util/mouse.h
@@ -0,0 +1,21 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef SAMPLE_UTIL_MOUSE_H
+#define SAMPLE_UTIL_MOUSE_H
+
+enum MouseButton
+{
+ MOUSEBUTTON_UNKNOWN,
+ MOUSEBUTTON_LEFT,
+ MOUSEBUTTON_RIGHT,
+ MOUSEBUTTON_MIDDLE,
+ MOUSEBUTTON_BUTTON4,
+ MOUSEBUTTON_BUTTON5,
+ MOUSEBUTTON_COUNT,
+};
+
+#endif // SAMPLE_UTIL_MOUSE_H
diff --git a/chromium/third_party/angle/samples/angle/sample_util/path_utils.h b/chromium/third_party/angle/samples/angle/sample_util/path_utils.h
new file mode 100644
index 00000000000..430abfadf93
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/sample_util/path_utils.h
@@ -0,0 +1,15 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef SAMPLE_UTIL_PATH_UTILS_H
+#define SAMPLE_UTIL_PATH_UTILS_H
+
+#include <string>
+
+std::string GetExecutablePath();
+std::string GetExecutableDirectory();
+
+#endif // SAMPLE_UTIL_PATH_UTILS_H
diff --git a/chromium/third_party/angle/samples/angle/sample_util/random_utils.cpp b/chromium/third_party/angle/samples/angle/sample_util/random_utils.cpp
new file mode 100644
index 00000000000..b7b7ae3f7aa
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/sample_util/random_utils.cpp
@@ -0,0 +1,22 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "random_utils.h"
+#include <time.h>
+#include <cstdlib>
+
+float RandomBetween(float min, float max)
+{
+ static bool randInitialized = false;
+ if (!randInitialized)
+ {
+ srand(time(NULL));
+ randInitialized = true;
+ }
+
+ const size_t divisor = 10000;
+ return min + ((rand() % divisor) / static_cast<float>(divisor)) * (max - min);
+}
diff --git a/chromium/third_party/angle/samples/angle/sample_util/random_utils.h b/chromium/third_party/angle/samples/angle/sample_util/random_utils.h
new file mode 100644
index 00000000000..42acc374a70
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/sample_util/random_utils.h
@@ -0,0 +1,12 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef SAMPLE_UTIL_RANDOM_UTILS_H
+#define SAMPLE_UTIL_RANDOM_UTILS_H
+
+float RandomBetween(float min, float max);
+
+#endif // SAMPLE_UTIL_RANDOM_UTILS_H
diff --git a/chromium/third_party/angle/samples/angle/sample_util/shader_utils.cpp b/chromium/third_party/angle/samples/angle/sample_util/shader_utils.cpp
new file mode 100644
index 00000000000..b83481f0a72
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/sample_util/shader_utils.cpp
@@ -0,0 +1,125 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "shader_utils.h"
+
+#include <vector>
+#include <iostream>
+#include <fstream>
+
+static std::string ReadFileToString(const std::string &source)
+{
+ std::ifstream stream(source);
+ if (!stream)
+ {
+ std::cerr << "Failed to load shader file: " << source;
+ return "";
+ }
+
+ std::string result;
+
+ stream.seekg(0, std::ios::end);
+ result.reserve(stream.tellg());
+ stream.seekg(0, std::ios::beg);
+
+ result.assign((std::istreambuf_iterator<char>(stream)), std::istreambuf_iterator<char>());
+
+ return result;
+}
+
+GLuint CompileShader(GLenum type, const std::string &source)
+{
+ GLuint shader = glCreateShader(type);
+
+ const char *sourceArray[1] = { source.c_str() };
+ glShaderSource(shader, 1, sourceArray, NULL);
+ glCompileShader(shader);
+
+ GLint compileResult;
+ glGetShaderiv(shader, GL_COMPILE_STATUS, &compileResult);
+
+ if (compileResult == 0)
+ {
+ GLint infoLogLength;
+ glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLogLength);
+
+ std::vector<GLchar> infoLog(infoLogLength);
+ glGetShaderInfoLog(shader, infoLog.size(), NULL, infoLog.data());
+
+ std::cerr << "shader compilation failed: " << infoLog.data();
+
+ glDeleteShader(shader);
+ shader = 0;
+ }
+
+ return shader;
+}
+
+GLuint CompileShaderFromFile(GLenum type, const std::string &sourcePath)
+{
+ std::string source = ReadFileToString(sourcePath);
+ if (source.empty())
+ {
+ return 0;
+ }
+
+ return CompileShader(type, source);
+}
+
+GLuint CompileProgram(const std::string &vsSource, const std::string &fsSource)
+{
+ GLuint program = glCreateProgram();
+
+ GLuint vs = CompileShader(GL_VERTEX_SHADER, vsSource);
+ GLuint fs = CompileShader(GL_FRAGMENT_SHADER, fsSource);
+
+ if (vs == 0 || fs == 0)
+ {
+ glDeleteShader(fs);
+ glDeleteShader(vs);
+ glDeleteProgram(program);
+ return 0;
+ }
+
+ glAttachShader(program, vs);
+ glDeleteShader(vs);
+
+ glAttachShader(program, fs);
+ glDeleteShader(fs);
+
+ glLinkProgram(program);
+
+ GLint linkStatus;
+ glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
+
+ if (linkStatus == 0)
+ {
+ GLint infoLogLength;
+ glGetProgramiv(program, GL_INFO_LOG_LENGTH, &infoLogLength);
+
+ std::vector<GLchar> infoLog(infoLogLength);
+ glGetProgramInfoLog(program, infoLog.size(), NULL, infoLog.data());
+
+ std::cerr << "program link failed: " << infoLog.data();
+
+ glDeleteProgram(program);
+ return 0;
+ }
+
+ return program;
+}
+
+GLuint CompileProgramFromFiles(const std::string &vsPath, const std::string &fsPath)
+{
+ std::string vsSource = ReadFileToString(vsPath);
+ std::string fsSource = ReadFileToString(fsPath);
+ if (vsSource.empty() || fsSource.empty())
+ {
+ return 0;
+ }
+
+ return CompileProgram(vsSource, fsSource);
+}
diff --git a/chromium/third_party/angle/samples/angle/sample_util/shader_utils.h b/chromium/third_party/angle/samples/angle/sample_util/shader_utils.h
new file mode 100644
index 00000000000..6ac7eb2876f
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/sample_util/shader_utils.h
@@ -0,0 +1,29 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef SAMPLE_UTIL_SHADER_UTILS_H
+#define SAMPLE_UTIL_SHADER_UTILS_H
+
+#define GL_GLEXT_PROTOTYPES
+
+#include <GLES3/gl3.h>
+#include <GLES3/gl3ext.h>
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+
+#include <string>
+
+#define SHADER_SOURCE(...) #__VA_ARGS__
+
+GLuint CompileShader(GLenum type, const std::string &source);
+GLuint CompileShaderFromFile(GLenum type, const std::string &sourcePath);
+
+GLuint CompileProgram(const std::string &vsSource, const std::string &fsSource);
+GLuint CompileProgramFromFiles(const std::string &vsPath, const std::string &fsPath);
+
+#endif // SAMPLE_UTIL_SHADER_UTILS_H
diff --git a/chromium/third_party/angle/samples/angle/sample_util/texture_utils.cpp b/chromium/third_party/angle/samples/angle/sample_util/texture_utils.cpp
new file mode 100644
index 00000000000..58fd8ca3173
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/sample_util/texture_utils.cpp
@@ -0,0 +1,129 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "texture_utils.h"
+#include <array>
+
+GLuint CreateSimpleTexture2D()
+{
+ // Use tightly packed data
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+
+ // Generate a texture object
+ GLuint texture;
+ glGenTextures(1, &texture);
+
+ // Bind the texture object
+ glBindTexture(GL_TEXTURE_2D, texture);
+
+ // Load the texture: 2x2 Image, 3 bytes per pixel (R, G, B)
+ const size_t width = 2;
+ const size_t height = 2;
+ GLubyte pixels[width * height * 3] =
+ {
+ 255, 0, 0, // Red
+ 0, 255, 0, // Green
+ 0, 0, 255, // Blue
+ 255, 255, 0, // Yellow
+ };
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels);
+
+ // Set the filtering mode
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+ return texture;
+}
+
+GLuint CreateSimpleTextureCubemap()
+{
+ // Generate a texture object
+ GLuint texture;
+ glGenTextures(1, &texture);
+
+ // Bind the texture object
+ glBindTexture(GL_TEXTURE_CUBE_MAP, texture);
+
+ // Load the texture faces
+ GLubyte pixels[6][3] =
+ {
+ // Face 0 - Red
+ 255, 0, 0,
+ // Face 1 - Green,
+ 0, 255, 0,
+ // Face 3 - Blue
+ 0, 0, 255,
+ // Face 4 - Yellow
+ 255, 255, 0,
+ // Face 5 - Purple
+ 255, 0, 255,
+ // Face 6 - White
+ 255, 255, 255
+ };
+
+ for (size_t i = 0; i < 6; i++)
+ {
+ glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, &pixels[i]);
+ }
+
+ // Set the filtering mode
+ glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+ return texture;
+}
+
+GLuint CreateMipMappedTexture2D()
+{
+ // Texture object handle
+ const size_t width = 256;
+ const size_t height = 256;
+ std::array<GLubyte, width * height * 3> pixels;
+
+ const size_t checkerSize = 8;
+ for (GLsizei y = 0; y < height; y++)
+ {
+ for (GLsizei x = 0; x < width; x++)
+ {
+ GLubyte rColor = 0;
+ GLubyte bColor = 0;
+
+ if ((x / checkerSize) % 2 == 0)
+ {
+ rColor = 255 * ((y / checkerSize) % 2);
+ bColor = 255 * (1 - ((y / checkerSize) % 2));
+ }
+ else
+ {
+ bColor = 255 * ((y / checkerSize) % 2);
+ rColor = 255 * (1 - ((y / checkerSize) % 2));
+ }
+
+ pixels[(y * height + x) * 3] = rColor;
+ pixels[(y * height + x) * 3 + 1] = 0;
+ pixels[(y * height + x) * 3 + 2] = bColor;
+ }
+ }
+
+ // Generate a texture object
+ GLuint texture;
+ glGenTextures(1, &texture);
+
+ // Bind the texture object
+ glBindTexture(GL_TEXTURE_2D, texture);
+
+ // Load mipmap level 0
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels.data());
+
+ // Generate mipmaps
+ glGenerateMipmap(GL_TEXTURE_2D);
+
+ // Set the filtering mode
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+
+ return texture;
+}
diff --git a/chromium/third_party/angle/samples/angle/sample_util/texture_utils.h b/chromium/third_party/angle/samples/angle/sample_util/texture_utils.h
new file mode 100644
index 00000000000..6ddeb5cf502
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/sample_util/texture_utils.h
@@ -0,0 +1,17 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef SAMPLE_UTIL_TEXTURE_UTILS_H
+#define SAMPLE_UTIL_TEXTURE_UTILS_H
+
+#include <GLES2/gl2.h>
+
+GLuint CreateSimpleTexture2D();
+GLuint CreateSimpleTextureCubemap();
+
+GLuint CreateMipMappedTexture2D();
+
+#endif // SAMPLE_UTIL_TEXTURE_UTILS_H
diff --git a/chromium/third_party/angle/samples/angle/sample_util/tga_utils.cpp b/chromium/third_party/angle/samples/angle/sample_util/tga_utils.cpp
new file mode 100644
index 00000000000..3e2d6e12c9f
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/sample_util/tga_utils.cpp
@@ -0,0 +1,122 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "tga_utils.h"
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <cstdint>
+
+TGAImage::TGAImage()
+ : data(0), width(0), height(0)
+{
+}
+
+struct TGAHeader
+{
+ uint8_t idSize;
+ uint8_t mapType;
+ uint8_t imageType;
+ uint16_t paletteStart;
+ uint16_t paletteSize;
+ uint8_t paletteEntryDepth;
+ uint16_t x;
+ uint16_t y;
+ uint16_t width;
+ uint16_t height;
+ uint8_t colorDepth;
+ uint8_t descriptor;
+};
+
+#define INVERTED_BIT (1 << 5)
+
+template <typename dataType>
+void readBinary(std::ifstream &stream, dataType &item)
+{
+ stream.read(reinterpret_cast<char *>(&item), sizeof(dataType));
+}
+
+template <typename dataType>
+void readBinary(std::ifstream &stream, std::vector<dataType> &items)
+{
+ stream.read(reinterpret_cast<char *>(items.data()), sizeof(dataType) * items.size());
+}
+
+bool LoadTGAImageFromFile(const std::string &path, TGAImage *image)
+{
+ std::ifstream stream(path, std::ios::binary);
+ if (!stream)
+ {
+ std::cerr << "error opening tga file " << path << " for reading.\n";
+ return false;
+ }
+
+ TGAHeader header;
+ readBinary(stream, header.idSize);
+ readBinary(stream, header.mapType);
+ readBinary(stream, header.imageType);
+ readBinary(stream, header.paletteStart);
+ readBinary(stream, header.paletteSize);
+ readBinary(stream, header.paletteEntryDepth);
+ readBinary(stream, header.x);
+ readBinary(stream, header.y);
+ readBinary(stream, header.width);
+ readBinary(stream, header.height);
+ readBinary(stream, header.colorDepth);
+ readBinary(stream, header.descriptor);
+
+ image->width = header.width;
+ image->height = header.height;
+
+ size_t pixelComponentCount = header.colorDepth / CHAR_BIT;
+ std::vector<unsigned char> buffer(header.width * header.height * pixelComponentCount);
+ readBinary(stream, buffer);
+
+ image->data.reserve(header.width * header.height);
+
+ for (size_t y = 0; y < header.height; y++)
+ {
+ size_t rowIdx = ((header.descriptor & INVERTED_BIT) ? (header.height - 1 - y) : y) * header.width * pixelComponentCount;
+ for (size_t x = 0; x < header.width; x++)
+ {
+ size_t pixelIdx = rowIdx + x * pixelComponentCount;
+
+ Byte4 pixel;
+ pixel[0] = (pixelComponentCount > 2) ? buffer[pixelIdx + 2] : 0;
+ pixel[2] = (pixelComponentCount > 0) ? buffer[pixelIdx + 0] : 0;
+ pixel[1] = (pixelComponentCount > 1) ? buffer[pixelIdx + 1] : 0;
+ pixel[3] = (pixelComponentCount > 3) ? buffer[pixelIdx + 3] : 255;
+
+ image->data.push_back(pixel);
+ }
+ }
+
+ std::cout << "loaded image " << path << ".\n";
+
+ return true;
+}
+
+GLuint LoadTextureFromTGAImage(const TGAImage &image)
+{
+ if (image.width > 0 && image.height > 0)
+ {
+ GLuint texture;
+ glGenTextures(1, &texture);
+ glBindTexture(GL_TEXTURE_2D, texture);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, static_cast<GLsizei>(image.width), static_cast<GLsizei>(image.height), 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, image.data.data());
+ glGenerateMipmap(GL_TEXTURE_2D);
+ return texture;
+ }
+ else
+ {
+ return 0;
+ }
+}
diff --git a/chromium/third_party/angle/samples/angle/sample_util/tga_utils.h b/chromium/third_party/angle/samples/angle/sample_util/tga_utils.h
new file mode 100644
index 00000000000..22fa5b1c8c2
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/sample_util/tga_utils.h
@@ -0,0 +1,29 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef SAMPLE_UTIL_TGA_UTILS_HPP
+#define SAMPLE_UTIL_TGA_UTILS_HPP
+
+#include <GLES2/gl2.h>
+
+#include <array>
+#include <vector>
+
+typedef std::array<unsigned char, 4> Byte4;
+
+struct TGAImage
+{
+ size_t width;
+ size_t height;
+ std::vector<Byte4> data;
+
+ TGAImage();
+};
+
+bool LoadTGAImageFromFile(const std::string &path, TGAImage *image);
+GLuint LoadTextureFromTGAImage(const TGAImage &image);
+
+#endif // SAMPLE_UTIL_TGA_UTILS_HPP
diff --git a/chromium/third_party/angle/samples/angle/sample_util/win32/Win32Timer.cpp b/chromium/third_party/angle/samples/angle/sample_util/win32/Win32Timer.cpp
new file mode 100644
index 00000000000..c4345bf0911
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/sample_util/win32/Win32Timer.cpp
@@ -0,0 +1,53 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "win32/Win32Timer.h"
+
+Win32Timer::Win32Timer()
+ : mRunning(0),
+ mStartTime(0),
+ mStopTime(0)
+{
+}
+
+void Win32Timer::start()
+{
+ LARGE_INTEGER frequency;
+ QueryPerformanceFrequency(&frequency);
+ mFrequency = frequency.QuadPart;
+
+ LARGE_INTEGER curTime;
+ QueryPerformanceCounter(&curTime);
+ mStartTime = curTime.QuadPart;
+
+ mRunning = true;
+}
+
+void Win32Timer::stop()
+{
+ LARGE_INTEGER curTime;
+ QueryPerformanceCounter(&curTime);
+ mStopTime = curTime.QuadPart;
+
+ mRunning = false;
+}
+
+double Win32Timer::getElapsedTime() const
+{
+ LONGLONG endTime;
+ if (mRunning)
+ {
+ LARGE_INTEGER curTime;
+ QueryPerformanceCounter(&curTime);
+ endTime = curTime.QuadPart;
+ }
+ else
+ {
+ endTime = mStopTime;
+ }
+
+ return static_cast<double>(endTime - mStartTime) / mFrequency;
+}
diff --git a/chromium/third_party/angle/samples/angle/sample_util/win32/Win32Timer.h b/chromium/third_party/angle/samples/angle/sample_util/win32/Win32Timer.h
new file mode 100644
index 00000000000..e559aa27716
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/sample_util/win32/Win32Timer.h
@@ -0,0 +1,30 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef SAMPLE_UTIL_WIN32_TIMER_H
+#define SAMPLE_UTIL_WIN32_TIMER_H
+
+#include "Timer.h"
+#include <windows.h>
+
+class Win32Timer : public Timer
+{
+ public:
+ Win32Timer();
+
+ void start();
+ void stop();
+ double getElapsedTime() const ;
+
+ private:
+ bool mRunning;
+ LONGLONG mStartTime;
+ LONGLONG mStopTime;
+
+ LONGLONG mFrequency;
+};
+
+#endif // SAMPLE_UTIL_WIN32_TIMER_H
diff --git a/chromium/third_party/angle/samples/angle/sample_util/win32/Win32Window.cpp b/chromium/third_party/angle/samples/angle/sample_util/win32/Win32Window.cpp
new file mode 100644
index 00000000000..49eaa378a42
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/sample_util/win32/Win32Window.cpp
@@ -0,0 +1,510 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "win32/Win32Window.h"
+
+Key VirtualKeyCodeToKey(WPARAM key, LPARAM flags)
+{
+ switch (key)
+ {
+ // Check the scancode to distinguish between left and right shift
+ case VK_SHIFT:
+ {
+ static unsigned int lShift = MapVirtualKey(VK_LSHIFT, MAPVK_VK_TO_VSC);
+ unsigned int scancode = static_cast<unsigned int>((flags & (0xFF << 16)) >> 16);
+ return scancode == lShift ? KEY_LSHIFT : KEY_RSHIFT;
+ }
+
+ // Check the "extended" flag to distinguish between left and right alt
+ case VK_MENU: return (HIWORD(flags) & KF_EXTENDED) ? KEY_RALT : KEY_LALT;
+
+ // Check the "extended" flag to distinguish between left and right control
+ case VK_CONTROL: return (HIWORD(flags) & KF_EXTENDED) ? KEY_RCONTROL : KEY_LCONTROL;
+
+ // Other keys are reported properly
+ case VK_LWIN: return KEY_LSYSTEM;
+ case VK_RWIN: return KEY_RSYSTEM;
+ case VK_APPS: return KEY_MENU;
+ case VK_OEM_1: return KEY_SEMICOLON;
+ case VK_OEM_2: return KEY_SLASH;
+ case VK_OEM_PLUS: return KEY_EQUAL;
+ case VK_OEM_MINUS: return KEY_DASH;
+ case VK_OEM_4: return KEY_LBRACKET;
+ case VK_OEM_6: return KEY_RBRACKET;
+ case VK_OEM_COMMA: return KEY_COMMA;
+ case VK_OEM_PERIOD: return KEY_PERIOD;
+ case VK_OEM_7: return KEY_QUOTE;
+ case VK_OEM_5: return KEY_BACKSLASH;
+ case VK_OEM_3: return KEY_TILDE;
+ case VK_ESCAPE: return KEY_ESCAPE;
+ case VK_SPACE: return KEY_SPACE;
+ case VK_RETURN: return KEY_RETURN;
+ case VK_BACK: return KEY_BACK;
+ case VK_TAB: return KEY_TAB;
+ case VK_PRIOR: return KEY_PAGEUP;
+ case VK_NEXT: return KEY_PAGEDOWN;
+ case VK_END: return KEY_END;
+ case VK_HOME: return KEY_HOME;
+ case VK_INSERT: return KEY_INSERT;
+ case VK_DELETE: return KEY_DELETE;
+ case VK_ADD: return KEY_ADD;
+ case VK_SUBTRACT: return KEY_SUBTRACT;
+ case VK_MULTIPLY: return KEY_MULTIPLY;
+ case VK_DIVIDE: return KEY_DIVIDE;
+ case VK_PAUSE: return KEY_PAUSE;
+ case VK_F1: return KEY_F1;
+ case VK_F2: return KEY_F2;
+ case VK_F3: return KEY_F3;
+ case VK_F4: return KEY_F4;
+ case VK_F5: return KEY_F5;
+ case VK_F6: return KEY_F6;
+ case VK_F7: return KEY_F7;
+ case VK_F8: return KEY_F8;
+ case VK_F9: return KEY_F9;
+ case VK_F10: return KEY_F10;
+ case VK_F11: return KEY_F11;
+ case VK_F12: return KEY_F12;
+ case VK_F13: return KEY_F13;
+ case VK_F14: return KEY_F14;
+ case VK_F15: return KEY_F15;
+ case VK_LEFT: return KEY_LEFT;
+ case VK_RIGHT: return KEY_RIGHT;
+ case VK_UP: return KEY_UP;
+ case VK_DOWN: return KEY_DOWN;
+ case VK_NUMPAD0: return KEY_NUMPAD0;
+ case VK_NUMPAD1: return KEY_NUMPAD1;
+ case VK_NUMPAD2: return KEY_NUMPAD2;
+ case VK_NUMPAD3: return KEY_NUMPAD3;
+ case VK_NUMPAD4: return KEY_NUMPAD4;
+ case VK_NUMPAD5: return KEY_NUMPAD5;
+ case VK_NUMPAD6: return KEY_NUMPAD6;
+ case VK_NUMPAD7: return KEY_NUMPAD7;
+ case VK_NUMPAD8: return KEY_NUMPAD8;
+ case VK_NUMPAD9: return KEY_NUMPAD9;
+ case 'A': return KEY_A;
+ case 'Z': return KEY_Z;
+ case 'E': return KEY_E;
+ case 'R': return KEY_R;
+ case 'T': return KEY_T;
+ case 'Y': return KEY_Y;
+ case 'U': return KEY_U;
+ case 'I': return KEY_I;
+ case 'O': return KEY_O;
+ case 'P': return KEY_P;
+ case 'Q': return KEY_Q;
+ case 'S': return KEY_S;
+ case 'D': return KEY_D;
+ case 'F': return KEY_F;
+ case 'G': return KEY_G;
+ case 'H': return KEY_H;
+ case 'J': return KEY_J;
+ case 'K': return KEY_K;
+ case 'L': return KEY_L;
+ case 'M': return KEY_M;
+ case 'W': return KEY_W;
+ case 'X': return KEY_X;
+ case 'C': return KEY_C;
+ case 'V': return KEY_V;
+ case 'B': return KEY_B;
+ case 'N': return KEY_N;
+ case '0': return KEY_NUM0;
+ case '1': return KEY_NUM1;
+ case '2': return KEY_NUM2;
+ case '3': return KEY_NUM3;
+ case '4': return KEY_NUM4;
+ case '5': return KEY_NUM5;
+ case '6': return KEY_NUM6;
+ case '7': return KEY_NUM7;
+ case '8': return KEY_NUM8;
+ case '9': return KEY_NUM9;
+ }
+
+ return Key(0);
+}
+
+LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ switch(message)
+ {
+ case WM_NCCREATE:
+ {
+ LPCREATESTRUCT pCreateStruct = (LPCREATESTRUCT)lParam;
+ SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)pCreateStruct->lpCreateParams);
+ return DefWindowProcA(hWnd, message, wParam, lParam);
+ }
+ }
+
+ Window *window = (Window*)(LONG_PTR)GetWindowLongPtr(hWnd, GWLP_USERDATA);
+ if (window)
+ {
+ switch (message)
+ {
+ case WM_DESTROY:
+ case WM_CLOSE:
+ {
+ Event event;
+ event.Type = Event::EVENT_CLOSED;
+ window->pushEvent(event);
+ break;
+ }
+
+ case WM_MOVE:
+ {
+ RECT winRect;
+ GetClientRect(hWnd, &winRect);
+
+ POINT topLeft;
+ topLeft.x = winRect.left;
+ topLeft.y = winRect.top;
+ ClientToScreen(hWnd, &topLeft);
+
+ Event event;
+ event.Type = Event::EVENT_MOVED;
+ event.Move.X = topLeft.x;
+ event.Move.Y = topLeft.y;
+ window->pushEvent(event);
+
+ break;
+ }
+
+ case WM_SIZE:
+ {
+ RECT winRect;
+ GetClientRect(hWnd, &winRect);
+
+ POINT topLeft;
+ topLeft.x = winRect.left;
+ topLeft.y = winRect.top;
+ ClientToScreen(hWnd, &topLeft);
+
+ POINT botRight;
+ botRight.x = winRect.right;
+ botRight.y = winRect.bottom;
+ ClientToScreen(hWnd, &botRight);
+
+ Event event;
+ event.Type = Event::EVENT_RESIZED;
+ event.Size.Width = botRight.x - topLeft.x;
+ event.Size.Height = botRight.y - topLeft.y;
+ window->pushEvent(event);
+
+ break;
+ }
+
+ case WM_SETFOCUS:
+ {
+ Event event;
+ event.Type = Event::EVENT_GAINED_FOCUS;
+ window->pushEvent(event);
+ break;
+ }
+
+ case WM_KILLFOCUS:
+ {
+ Event event;
+ event.Type = Event::EVENT_LOST_FOCUS;
+ window->pushEvent(event);
+ break;
+ }
+
+ case WM_KEYDOWN:
+ case WM_SYSKEYDOWN:
+ case WM_KEYUP:
+ case WM_SYSKEYUP:
+ {
+ bool down = (message == WM_KEYDOWN || message == WM_SYSKEYDOWN);
+
+ Event event;
+ event.Type = down ? Event::EVENT_KEY_PRESSED : Event::EVENT_KEY_RELEASED;
+ event.Key.Alt = HIWORD(GetAsyncKeyState(VK_MENU)) != 0;
+ event.Key.Control = HIWORD(GetAsyncKeyState(VK_CONTROL)) != 0;
+ event.Key.Shift = HIWORD(GetAsyncKeyState(VK_SHIFT)) != 0;
+ event.Key.System = HIWORD(GetAsyncKeyState(VK_LWIN)) || HIWORD(GetAsyncKeyState(VK_RWIN));
+ event.Key.Code = VirtualKeyCodeToKey(wParam, lParam);
+ window->pushEvent(event);
+
+ break;
+ }
+
+ case WM_MOUSEWHEEL:
+ {
+ Event event;
+ event.Type = Event::EVENT_MOUSE_WHEEL_MOVED;
+ event.MouseWheel.Delta = static_cast<short>(HIWORD(wParam)) / 120;
+ window->pushEvent(event);
+ break;
+ }
+
+ case WM_LBUTTONDOWN:
+ case WM_LBUTTONDBLCLK:
+ {
+ Event event;
+ event.Type = Event::EVENT_MOUSE_BUTTON_PRESSED;
+ event.MouseButton.Button = MOUSEBUTTON_LEFT;
+ event.MouseButton.X = static_cast<short>(LOWORD(lParam));
+ event.MouseButton.Y = static_cast<short>(HIWORD(lParam));
+ window->pushEvent(event);
+ break;
+ }
+
+ case WM_LBUTTONUP:
+ {
+ Event event;
+ event.Type = Event::EVENT_MOUSE_BUTTON_RELEASED;
+ event.MouseButton.Button = MOUSEBUTTON_LEFT;
+ event.MouseButton.X = static_cast<short>(LOWORD(lParam));
+ event.MouseButton.Y = static_cast<short>(HIWORD(lParam));
+ window->pushEvent(event);
+ break;
+ }
+
+ case WM_RBUTTONDOWN:
+ case WM_RBUTTONDBLCLK:
+ {
+ Event event;
+ event.Type = Event::EVENT_MOUSE_BUTTON_PRESSED;
+ event.MouseButton.Button = MOUSEBUTTON_RIGHT;
+ event.MouseButton.X = static_cast<short>(LOWORD(lParam));
+ event.MouseButton.Y = static_cast<short>(HIWORD(lParam));
+ window->pushEvent(event);
+ break;
+ }
+
+ // Mouse right button up event
+ case WM_RBUTTONUP:
+ {
+ Event event;
+ event.Type = Event::EVENT_MOUSE_BUTTON_RELEASED;
+ event.MouseButton.Button = MOUSEBUTTON_RIGHT;
+ event.MouseButton.X = static_cast<short>(LOWORD(lParam));
+ event.MouseButton.Y = static_cast<short>(HIWORD(lParam));
+ window->pushEvent(event);
+ break;
+ }
+
+ // Mouse wheel button down event
+ case WM_MBUTTONDOWN:
+ case WM_MBUTTONDBLCLK:
+ {
+ Event event;
+ event.Type = Event::EVENT_MOUSE_BUTTON_PRESSED;
+ event.MouseButton.Button = MOUSEBUTTON_MIDDLE;
+ event.MouseButton.X = static_cast<short>(LOWORD(lParam));
+ event.MouseButton.Y = static_cast<short>(HIWORD(lParam));
+ window->pushEvent(event);
+ break;
+ }
+
+ // Mouse wheel button up event
+ case WM_MBUTTONUP:
+ {
+ Event event;
+ event.Type = Event::EVENT_MOUSE_BUTTON_RELEASED;
+ event.MouseButton.Button = MOUSEBUTTON_MIDDLE;
+ event.MouseButton.X = static_cast<short>(LOWORD(lParam));
+ event.MouseButton.Y = static_cast<short>(HIWORD(lParam));
+ window->pushEvent(event);
+ break;
+ }
+
+ // Mouse X button down event
+ case WM_XBUTTONDOWN:
+ case WM_XBUTTONDBLCLK:
+ {
+ Event event;
+ event.Type = Event::EVENT_MOUSE_BUTTON_PRESSED;
+ event.MouseButton.Button = (HIWORD(wParam) == XBUTTON1) ? MOUSEBUTTON_BUTTON4 : MOUSEBUTTON_BUTTON5;
+ event.MouseButton.X = static_cast<short>(LOWORD(lParam));
+ event.MouseButton.Y = static_cast<short>(HIWORD(lParam));
+ window->pushEvent(event);
+ break;
+ }
+
+ // Mouse X button up event
+ case WM_XBUTTONUP:
+ {
+ Event event;
+ event.Type = Event::EVENT_MOUSE_BUTTON_RELEASED;
+ event.MouseButton.Button = (HIWORD(wParam) == XBUTTON1) ? MOUSEBUTTON_BUTTON4 : MOUSEBUTTON_BUTTON5;
+ event.MouseButton.X = static_cast<short>(LOWORD(lParam));
+ event.MouseButton.Y = static_cast<short>(HIWORD(lParam));
+ window->pushEvent(event);
+ break;
+ }
+
+ case WM_MOUSEMOVE:
+ {
+ int mouseX = static_cast<short>(LOWORD(lParam));
+ int mouseY = static_cast<short>(HIWORD(lParam));
+
+ Event event;
+ event.Type = Event::EVENT_MOUSE_MOVED;
+ event.MouseMove.X = mouseX;
+ event.MouseMove.Y = mouseY;
+ window->pushEvent(event);
+ break;
+ }
+
+ case WM_MOUSELEAVE:
+ {
+ Event event;
+ event.Type = Event::EVENT_MOUSE_LEFT;
+ window->pushEvent(event);
+ break;
+ }
+ }
+
+ }
+ return DefWindowProcA(hWnd, message, wParam, lParam);
+}
+
+Win32Window::Win32Window()
+ : mClassName(),
+ mDisplay(0),
+ mNativeWindow(0),
+ mNativeDisplay(0)
+{
+}
+
+Win32Window::~Win32Window()
+{
+ destroy();
+}
+
+bool Win32Window::initialize(const std::string &name, size_t width, size_t height, RendererType requestedRenderer)
+{
+ destroy();
+
+ mClassName = name;
+
+ WNDCLASSEXA windowClass = { 0 };
+ windowClass.cbSize = sizeof(WNDCLASSEXA);
+ windowClass.style = CS_OWNDC;
+ windowClass.lpfnWndProc = WndProc;
+ windowClass.cbClsExtra = 0;
+ windowClass.cbWndExtra = 0;
+ windowClass.hInstance = GetModuleHandle(NULL);
+ windowClass.hIcon = NULL;
+ windowClass.hCursor = LoadCursorA(NULL, IDC_ARROW);
+ windowClass.hbrBackground = 0;
+ windowClass.lpszMenuName = NULL;
+ windowClass.lpszClassName = mClassName.c_str();
+ if (!RegisterClassExA(&windowClass))
+ {
+ return false;
+ }
+
+ DWORD style = WS_VISIBLE | WS_CAPTION | WS_MINIMIZEBOX | WS_THICKFRAME | WS_MAXIMIZEBOX | WS_SYSMENU;
+ DWORD extendedStyle = WS_EX_APPWINDOW;
+
+ RECT sizeRect = { 0, 0, width, height };
+ AdjustWindowRectEx(&sizeRect, style, false, extendedStyle);
+
+ mNativeWindow = CreateWindowExA(extendedStyle, mClassName.c_str(), name.c_str(), style, CW_USEDEFAULT, CW_USEDEFAULT,
+ sizeRect.right - sizeRect.left, sizeRect.bottom - sizeRect.top, NULL, NULL,
+ GetModuleHandle(NULL), this);
+
+ SetWindowLongPtrA(mNativeWindow, GWLP_USERDATA, reinterpret_cast<LONG>(this));
+
+ ShowWindow(mNativeWindow, SW_SHOW);
+
+ mNativeDisplay = GetDC(mNativeWindow);
+ if (!mNativeDisplay)
+ {
+ destroy();
+ return false;
+ }
+
+ EGLNativeDisplayType requestedDisplay = mNativeDisplay;
+ if (requestedRenderer == RENDERER_D3D11)
+ {
+ requestedDisplay = EGL_D3D11_ONLY_DISPLAY_ANGLE;
+ }
+
+ mDisplay = eglGetDisplay(requestedDisplay);
+ if (mDisplay == EGL_NO_DISPLAY)
+ {
+ mDisplay = eglGetDisplay((EGLNativeDisplayType)EGL_DEFAULT_DISPLAY);
+ }
+
+ EGLint majorVersion, minorVersion;
+ if (!eglInitialize(mDisplay, &majorVersion, &minorVersion))
+ {
+ destroy();
+ return false;
+ }
+
+ eglBindAPI(EGL_OPENGL_ES_API);
+ if (eglGetError() != EGL_SUCCESS)
+ {
+ destroy();
+ return false;
+ }
+
+ return true;
+}
+
+void Win32Window::destroy()
+{
+ if (mDisplay != EGL_NO_DISPLAY)
+ {
+ eglMakeCurrent(mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+ eglTerminate(mDisplay);
+ mDisplay = EGL_NO_DISPLAY;
+ }
+
+ if (mNativeDisplay)
+ {
+ ReleaseDC(mNativeWindow, mNativeDisplay);
+ mNativeDisplay = 0;
+ }
+
+ if (mNativeWindow)
+ {
+ DestroyWindow(mNativeWindow);
+ mNativeWindow = 0;
+ }
+
+ UnregisterClassA(mClassName.c_str(), NULL);
+}
+
+EGLDisplay Win32Window::getDisplay() const
+{
+ return mDisplay;
+}
+
+EGLNativeWindowType Win32Window::getNativeWindow() const
+{
+ return mNativeWindow;
+}
+
+EGLNativeDisplayType Win32Window::getNativeDisplay() const
+{
+ return mNativeDisplay;
+}
+
+void Win32Window::messageLoop()
+{
+ MSG msg;
+ while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
+ {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+}
+
+void Win32Window::setMousePosition(int x, int y)
+{
+ RECT winRect;
+ GetClientRect(mNativeWindow, &winRect);
+
+ POINT topLeft;
+ topLeft.x = winRect.left;
+ topLeft.y = winRect.top;
+ ClientToScreen(mNativeWindow, &topLeft);
+
+ SetCursorPos(topLeft.x + x, topLeft.y + y);
+}
diff --git a/chromium/third_party/angle/samples/angle/sample_util/win32/Win32Window.h b/chromium/third_party/angle/samples/angle/sample_util/win32/Win32Window.h
new file mode 100644
index 00000000000..44839b9c8a8
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/sample_util/win32/Win32Window.h
@@ -0,0 +1,42 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef SAMPLE_UTIL_WIN32_WINDOW_H
+#define SAMPLE_UTIL_WIN32_WINDOW_H
+
+#include "Window.h"
+#include <string>
+#include <windows.h>
+
+class Win32Window : public Window
+{
+ public:
+ Win32Window();
+ ~Win32Window();
+
+ bool initialize(const std::string &name, size_t width, size_t height, RendererType requestedRenderer);
+ void destroy();
+
+ EGLDisplay getDisplay() const;
+ EGLNativeWindowType getNativeWindow() const;
+ EGLNativeDisplayType getNativeDisplay() const;
+
+ void messageLoop();
+
+ bool popEvent(Event *event);
+ void pushEvent(Event event);
+
+ void setMousePosition(int x, int y);
+
+ private:
+ std::string mClassName;
+
+ EGLDisplay mDisplay;
+ EGLNativeWindowType mNativeWindow;
+ EGLNativeDisplayType mNativeDisplay;
+};
+
+#endif // SAMPLE_UTIL_WINDOW_H
diff --git a/chromium/third_party/angle/samples/angle/sample_util/win32/Win32_path_utils.cpp b/chromium/third_party/angle/samples/angle/sample_util/win32/Win32_path_utils.cpp
new file mode 100644
index 00000000000..6096aa20f7b
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/sample_util/win32/Win32_path_utils.cpp
@@ -0,0 +1,23 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "path_utils.h"
+#include <array>
+#include <windows.h>
+
+std::string GetExecutablePath()
+{
+ std::array<char, MAX_PATH> executableFileBuf;
+ DWORD executablePathLen = GetModuleFileNameA(NULL, executableFileBuf.data(), executableFileBuf.size());
+ return (executablePathLen > 0 ? std::string(executableFileBuf.data()) : "");
+}
+
+std::string GetExecutableDirectory()
+{
+ std::string executablePath = GetExecutablePath();
+ size_t lastPathSepLoc = executablePath.find_last_of("\\/");
+ return (lastPathSepLoc != std::string::npos) ? executablePath.substr(0, lastPathSepLoc) : "";
+}
diff --git a/chromium/third_party/angle/samples/angle/simple_instancing/SimpleInstancing.cpp b/chromium/third_party/angle/samples/angle/simple_instancing/SimpleInstancing.cpp
new file mode 100644
index 00000000000..bdefef252d2
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/simple_instancing/SimpleInstancing.cpp
@@ -0,0 +1,200 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Based on Simple_Texture2D.c from
+// Book: OpenGL(R) ES 2.0 Programming Guide
+// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
+// ISBN-10: 0321502795
+// ISBN-13: 9780321502797
+// Publisher: Addison-Wesley Professional
+// URLs: http://safari.informit.com/9780321563835
+// http://www.opengles-book.com
+
+#include "SampleApplication.h"
+#include "Vector.h"
+#include "shader_utils.h"
+#include "texture_utils.h"
+
+#include <iostream>
+#include <vector>
+
+class SimpleInstancingSample : public SampleApplication
+{
+ public:
+ SimpleInstancingSample::SimpleInstancingSample()
+ : SampleApplication("SimpleInstancing", 1280, 720)
+ {
+ }
+
+ virtual bool initialize()
+ {
+ // init instancing functions
+ char *extensionString = (char*)glGetString(GL_EXTENSIONS);
+ if (strstr(extensionString, "GL_ANGLE_instanced_arrays"))
+ {
+ mVertexAttribDivisorANGLE = (PFNGLVERTEXATTRIBDIVISORANGLEPROC)eglGetProcAddress("glVertexAttribDivisorANGLE");
+ mDrawArraysInstancedANGLE = (PFNGLDRAWARRAYSINSTANCEDANGLEPROC)eglGetProcAddress("glDrawArraysInstancedANGLE");
+ mDrawElementsInstancedANGLE = (PFNGLDRAWELEMENTSINSTANCEDANGLEPROC)eglGetProcAddress("glDrawElementsInstancedANGLE");
+ }
+
+ if (!mVertexAttribDivisorANGLE || !mDrawArraysInstancedANGLE || !mDrawElementsInstancedANGLE)
+ {
+ std::cerr << "Unable to load GL_ANGLE_instanced_arrays entry points.";
+ return false;
+ }
+
+ const std::string vs = SHADER_SOURCE
+ (
+ attribute vec3 a_position;
+ attribute vec2 a_texCoord;
+ attribute vec3 a_instancePos;
+ varying vec2 v_texCoord;
+ void main()
+ {
+ gl_Position = vec4(a_position.xyz + a_instancePos.xyz, 1.0);
+ v_texCoord = a_texCoord;
+ }
+ );
+
+ const std::string fs = SHADER_SOURCE
+ (
+ precision mediump float;
+ varying vec2 v_texCoord;
+ uniform sampler2D s_texture;
+ void main()
+ {
+ gl_FragColor = texture2D(s_texture, v_texCoord);
+ }
+ );
+
+ mProgram = CompileProgram(vs, fs);
+ if (!mProgram)
+ {
+ return false;
+ }
+
+ // Get the attribute locations
+ mPositionLoc = glGetAttribLocation(mProgram, "a_position");
+ mTexCoordLoc = glGetAttribLocation(mProgram, "a_texCoord");
+ mInstancePosLoc = glGetAttribLocation(mProgram, "a_instancePos");
+
+ // Get the sampler location
+ mSamplerLoc = glGetUniformLocation(mProgram, "s_texture");
+
+ // Load the texture
+ mTextureID = CreateSimpleTexture2D();
+
+ // Initialize the vertex and index vectors
+ const GLfloat quadRadius = 0.01f;
+
+ mVertices.push_back(Vector3(-quadRadius, quadRadius, 0.0f));
+ mVertices.push_back(Vector3(-quadRadius, -quadRadius, 0.0f));
+ mVertices.push_back(Vector3( quadRadius, -quadRadius, 0.0f));
+ mVertices.push_back(Vector3( quadRadius, quadRadius, 0.0f));
+
+ mTexcoords.push_back(Vector2(0.0f, 0.0f));
+ mTexcoords.push_back(Vector2(0.0f, 1.0f));
+ mTexcoords.push_back(Vector2(1.0f, 1.0f));
+ mTexcoords.push_back(Vector2(1.0f, 0.0f));
+
+ mIndices.push_back(0);
+ mIndices.push_back(1);
+ mIndices.push_back(2);
+ mIndices.push_back(0);
+ mIndices.push_back(2);
+ mIndices.push_back(3);
+
+ // Tile thousands of quad instances
+ for (float y = -1.0f + quadRadius; y < 1.0f - quadRadius; y += quadRadius * 3)
+ {
+ for (float x = -1.0f + quadRadius; x < 1.0f - quadRadius; x += quadRadius * 3)
+ {
+ mInstances.push_back(Vector3(x, y, 0.0f));
+ }
+ }
+
+ glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+
+ return true;
+ }
+
+ virtual void destroy()
+ {
+ glDeleteProgram(mProgram);
+ glDeleteTextures(1, &mTextureID);
+ }
+
+ virtual void draw()
+ {
+ // Set the viewport
+ glViewport(0, 0, getWindow()->getWidth(), getWindow()->getHeight());
+
+ // Clear the color buffer
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ // Use the program object
+ glUseProgram(mProgram);
+
+ // Load the vertex position
+ glVertexAttribPointer(mPositionLoc, 3, GL_FLOAT, GL_FALSE, 0, mVertices.data());
+ glEnableVertexAttribArray(mPositionLoc);
+
+ // Load the texture coordinate
+ glVertexAttribPointer(mTexCoordLoc, 2, GL_FLOAT, GL_FALSE, 0, mTexcoords.data());
+ glEnableVertexAttribArray(mTexCoordLoc);
+
+ // Load the instance position
+ glVertexAttribPointer(mInstancePosLoc, 3, GL_FLOAT, GL_FALSE, 0, mInstances.data());
+ glEnableVertexAttribArray(mInstancePosLoc);
+
+ // Enable instancing
+ mVertexAttribDivisorANGLE(mInstancePosLoc, 1);
+
+ // Bind the texture
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, mTextureID);
+
+ // Set the sampler texture unit to 0
+ glUniform1i(mSamplerLoc, 0);
+
+ // Do the instanced draw
+ mDrawElementsInstancedANGLE(GL_TRIANGLES, mIndices.size(), GL_UNSIGNED_SHORT, mIndices.data(), mInstances.size());
+ }
+
+ private:
+ // Handle to a program object
+ GLuint mProgram;
+
+ // Attribute locations
+ GLint mPositionLoc;
+ GLint mTexCoordLoc;
+
+ // Sampler location
+ GLint mSamplerLoc;
+
+ // Texture handle
+ GLuint mTextureID;
+
+ // Instance VBO
+ GLint mInstancePosLoc;
+
+ // Loaded entry points
+ PFNGLVERTEXATTRIBDIVISORANGLEPROC mVertexAttribDivisorANGLE;
+ PFNGLDRAWARRAYSINSTANCEDANGLEPROC mDrawArraysInstancedANGLE;
+ PFNGLDRAWELEMENTSINSTANCEDANGLEPROC mDrawElementsInstancedANGLE;
+
+ // Vertex data
+ std::vector<Vector3> mVertices;
+ std::vector<Vector2> mTexcoords;
+ std::vector<Vector3> mInstances;
+ std::vector<GLushort> mIndices;
+};
+
+int main(int argc, char **argv)
+{
+ SimpleInstancingSample app;
+ return app.run();
+}
diff --git a/chromium/third_party/angle/samples/angle/simple_texture_2d/SimpleTexture2D.cpp b/chromium/third_party/angle/samples/angle/simple_texture_2d/SimpleTexture2D.cpp
new file mode 100644
index 00000000000..33b00062afc
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/simple_texture_2d/SimpleTexture2D.cpp
@@ -0,0 +1,141 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Based on Simple_Texture2D.c from
+// Book: OpenGL(R) ES 2.0 Programming Guide
+// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
+// ISBN-10: 0321502795
+// ISBN-13: 9780321502797
+// Publisher: Addison-Wesley Professional
+// URLs: http://safari.informit.com/9780321563835
+// http://www.opengles-book.com
+
+#include "SampleApplication.h"
+#include "shader_utils.h"
+#include "texture_utils.h"
+
+class SimpleTexture2DSample : public SampleApplication
+{
+ public:
+ SimpleTexture2DSample::SimpleTexture2DSample()
+ : SampleApplication("SimpleTexture2D", 1280, 720)
+ {
+ }
+
+ virtual bool initialize()
+ {
+ const std::string vs = SHADER_SOURCE
+ (
+ attribute vec4 a_position;
+ attribute vec2 a_texCoord;
+ varying vec2 v_texCoord;
+ void main()
+ {
+ gl_Position = a_position;
+ v_texCoord = a_texCoord;
+ }
+ );
+
+ const std::string fs = SHADER_SOURCE
+ (
+ precision mediump float;
+ varying vec2 v_texCoord;
+ uniform sampler2D s_texture;
+ void main()
+ {
+ gl_FragColor = texture2D(s_texture, v_texCoord);
+ }
+ );
+
+ mProgram = CompileProgram(vs, fs);
+ if (!mProgram)
+ {
+ return false;
+ }
+
+ // Get the attribute locations
+ mPositionLoc = glGetAttribLocation(mProgram, "a_position");
+ mTexCoordLoc = glGetAttribLocation(mProgram, "a_texCoord");
+
+ // Get the sampler location
+ mSamplerLoc = glGetUniformLocation(mProgram, "s_texture");
+
+ // Load the texture
+ mTexture = CreateSimpleTexture2D();
+
+ glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+
+ return true;
+ }
+
+ virtual void destroy()
+ {
+ glDeleteProgram(mProgram);
+ glDeleteTextures(1, &mTexture);
+ }
+
+ virtual void draw()
+ {
+ GLfloat vertices[] =
+ {
+ -0.5f, 0.5f, 0.0f, // Position 0
+ 0.0f, 0.0f, // TexCoord 0
+ -0.5f, -0.5f, 0.0f, // Position 1
+ 0.0f, 1.0f, // TexCoord 1
+ 0.5f, -0.5f, 0.0f, // Position 2
+ 1.0f, 1.0f, // TexCoord 2
+ 0.5f, 0.5f, 0.0f, // Position 3
+ 1.0f, 0.0f // TexCoord 3
+ };
+ GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
+
+ // Set the viewport
+ glViewport(0, 0, getWindow()->getWidth(), getWindow()->getHeight());
+
+ // Clear the color buffer
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ // Use the program object
+ glUseProgram(mProgram);
+
+ // Load the vertex position
+ glVertexAttribPointer(mPositionLoc, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), vertices);
+ // Load the texture coordinate
+ glVertexAttribPointer(mTexCoordLoc, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), vertices + 3);
+
+ glEnableVertexAttribArray(mPositionLoc);
+ glEnableVertexAttribArray(mTexCoordLoc);
+
+ // Bind the texture
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, mTexture);
+
+ // Set the texture sampler to texture unit to 0
+ glUniform1i(mSamplerLoc, 0);
+
+ glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
+ }
+
+ private:
+ // Handle to a program object
+ GLuint mProgram;
+
+ // Attribute locations
+ GLint mPositionLoc;
+ GLint mTexCoordLoc;
+
+ // Sampler location
+ GLint mSamplerLoc;
+
+ // Texture handle
+ GLuint mTexture;
+};
+
+int main(int argc, char **argv)
+{
+ SimpleTexture2DSample app;
+ return app.run();
+}
diff --git a/chromium/third_party/angle/samples/angle/simple_texture_cubemap/SimpleTextureCubemap.cpp b/chromium/third_party/angle/samples/angle/simple_texture_cubemap/SimpleTextureCubemap.cpp
new file mode 100644
index 00000000000..5094bbb80fd
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/simple_texture_cubemap/SimpleTextureCubemap.cpp
@@ -0,0 +1,138 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Based on Simple_TextureCubemap.c from
+// Book: OpenGL(R) ES 2.0 Programming Guide
+// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
+// ISBN-10: 0321502795
+// ISBN-13: 9780321502797
+// Publisher: Addison-Wesley Professional
+// URLs: http://safari.informit.com/9780321563835
+// http://www.opengles-book.com
+
+#include "SampleApplication.h"
+#include "shader_utils.h"
+#include "texture_utils.h"
+#include "geometry_utils.h"
+#include "Vector.h"
+
+class SimpleTextureCubemapSample : public SampleApplication
+{
+ public:
+ SimpleTextureCubemapSample::SimpleTextureCubemapSample()
+ : SampleApplication("SimpleTextureCubemap", 1280, 720)
+ {
+ }
+
+ virtual bool initialize()
+ {
+ const std::string vs = SHADER_SOURCE
+ (
+ attribute vec4 a_position;
+ attribute vec3 a_normal;
+ varying vec3 v_normal;
+ void main()
+ {
+ gl_Position = a_position;
+ v_normal = a_normal;
+ }
+ );
+
+ const std::string fs = SHADER_SOURCE
+ (
+ precision mediump float;
+ varying vec3 v_normal;
+ uniform samplerCube s_texture;
+ void main()
+ {
+ gl_FragColor = textureCube(s_texture, v_normal);
+ }
+ );
+
+ mProgram = CompileProgram(vs, fs);
+ if (!mProgram)
+ {
+ return false;
+ }
+
+ // Get the attribute locations
+ mPositionLoc = glGetAttribLocation(mProgram, "a_position");
+ mNormalLoc = glGetAttribLocation(mProgram, "a_normal");
+
+ // Get the sampler locations
+ mSamplerLoc = glGetUniformLocation(mProgram, "s_texture");
+
+ // Load the texture
+ mTexture = CreateSimpleTextureCubemap();
+
+ // Generate the geometry data
+ CreateSphereGeometry(128, 0.75f, &mSphere);
+
+ glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ glCullFace(GL_BACK);
+ glEnable(GL_CULL_FACE);
+
+ return true;
+ }
+
+ virtual void destroy()
+ {
+ glDeleteProgram(mProgram);
+ glDeleteTextures(1, &mTexture);
+ }
+
+ virtual void draw()
+ {
+ // Set the viewport
+ glViewport(0, 0, getWindow()->getWidth(), getWindow()->getHeight());
+
+ // Clear the color buffer
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ // Use the program object
+ glUseProgram(mProgram);
+
+ // Load the vertex position
+ glVertexAttribPointer(mPositionLoc, 3, GL_FLOAT, GL_FALSE, 0, mSphere.positions.data());
+ glEnableVertexAttribArray(mPositionLoc);
+
+ // Load the normal
+ glVertexAttribPointer(mNormalLoc, 3, GL_FLOAT, GL_FALSE, 0, mSphere.normals.data());
+ glEnableVertexAttribArray(mNormalLoc);
+
+ // Bind the texture
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_CUBE_MAP, mTexture);
+
+ // Set the texture sampler to texture unit to 0
+ glUniform1i(mSamplerLoc, 0);
+
+ glDrawElements(GL_TRIANGLES, mSphere.indices.size(), GL_UNSIGNED_SHORT, mSphere.indices.data());
+ }
+
+ private:
+ // Handle to a program object
+ GLuint mProgram;
+
+ // Attribute locations
+ GLint mPositionLoc;
+ GLint mNormalLoc;
+
+ // Sampler location
+ GLint mSamplerLoc;
+
+ // Texture handle
+ GLuint mTexture;
+
+ // Geometry data
+ SphereGeometry mSphere;
+};
+
+int main(int argc, char **argv)
+{
+ SimpleTextureCubemapSample app;
+ return app.run();
+}
diff --git a/chromium/third_party/angle/samples/angle/simple_vertex_shader/SimpleVertexShader.cpp b/chromium/third_party/angle/samples/angle/simple_vertex_shader/SimpleVertexShader.cpp
new file mode 100644
index 00000000000..3962a66ce07
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/simple_vertex_shader/SimpleVertexShader.cpp
@@ -0,0 +1,150 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Based on Simple_VertexShader.c from
+// Book: OpenGL(R) ES 2.0 Programming Guide
+// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
+// ISBN-10: 0321502795
+// ISBN-13: 9780321502797
+// Publisher: Addison-Wesley Professional
+// URLs: http://safari.informit.com/9780321563835
+// http://www.opengles-book.com
+
+#include "SampleApplication.h"
+#include "shader_utils.h"
+#include "texture_utils.h"
+#include "geometry_utils.h"
+#include "Vector.h"
+#include "Matrix.h"
+
+class SimpleVertexShaderSample : public SampleApplication
+{
+ public:
+ SimpleVertexShaderSample::SimpleVertexShaderSample()
+ : SampleApplication("SimpleVertexShader", 1280, 720)
+ {
+ }
+
+ virtual bool initialize()
+ {
+ const std::string vs = SHADER_SOURCE
+ (
+ uniform mat4 u_mvpMatrix;
+ attribute vec4 a_position;
+ attribute vec2 a_texcoord;
+ varying vec2 v_texcoord;
+ void main()
+ {
+ gl_Position = u_mvpMatrix * a_position;
+ v_texcoord = a_texcoord;
+ }
+ );
+
+ const std::string fs = SHADER_SOURCE
+ (
+ precision mediump float;
+ varying vec2 v_texcoord;
+ void main()
+ {
+ gl_FragColor = vec4(v_texcoord.x, v_texcoord.y, 1.0, 1.0);
+ }
+ );
+
+ mProgram = CompileProgram(vs, fs);
+ if (!mProgram)
+ {
+ return false;
+ }
+
+ // Get the attribute locations
+ mPositionLoc = glGetAttribLocation(mProgram, "a_position");
+ mTexcoordLoc = glGetAttribLocation(mProgram, "a_texcoord");
+
+ // Get the uniform locations
+ mMVPMatrixLoc = glGetUniformLocation(mProgram, "u_mvpMatrix");
+
+ // Generate the geometry data
+ GenerateCubeGeometry(0.5f, &mCube);
+
+ // Set an initial rotation
+ mRotation = 45.0f;
+
+ glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ glCullFace(GL_BACK);
+ glEnable(GL_CULL_FACE);
+
+ return true;
+ }
+
+ virtual void destroy()
+ {
+ glDeleteProgram(mProgram);
+ }
+
+ virtual void step(float dt, double totalTime)
+ {
+ mRotation = fmod(mRotation + (dt * 40.0f), 360.0f);
+
+ Matrix4 perspectiveMatrix = Matrix4::perspective(60.0f, float(getWindow()->getWidth()) / getWindow()->getHeight(),
+ 1.0f, 20.0f);
+
+ Matrix4 modelMatrix = Matrix4::translate(Vector3(0.0f, 0.0f, -2.0f)) *
+ Matrix4::rotate(mRotation, Vector3(1.0f, 0.0f, 1.0f));
+
+ Matrix4 viewMatrix = Matrix4::identity();
+
+ Matrix4 mvpMatrix = perspectiveMatrix * viewMatrix * modelMatrix;
+
+ // Load the matrices
+ glUniformMatrix4fv(mMVPMatrixLoc, 1, GL_FALSE, mvpMatrix.data);
+ }
+
+ virtual void draw()
+ {
+ // Set the viewport
+ glViewport(0, 0, getWindow()->getWidth(), getWindow()->getHeight());
+
+ // Clear the color buffer
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ // Use the program object
+ glUseProgram(mProgram);
+
+ // Load the vertex position
+ glVertexAttribPointer(mPositionLoc, 3, GL_FLOAT, GL_FALSE, 0, mCube.positions.data());
+ glEnableVertexAttribArray(mPositionLoc);
+
+ // Load the texcoord data
+ glVertexAttribPointer(mTexcoordLoc, 2, GL_FLOAT, GL_FALSE, 0, mCube.texcoords.data());
+ glEnableVertexAttribArray(mTexcoordLoc);
+
+ // Draw the cube
+ glDrawElements(GL_TRIANGLES, mCube.indices.size(), GL_UNSIGNED_SHORT, mCube.indices.data());
+ }
+
+ private:
+ // Handle to a program object
+ GLuint mProgram;
+
+ // Attribute locations
+ GLint mPositionLoc;
+ GLint mTexcoordLoc;
+
+ // Uniform locations
+ GLuint mMVPMatrixLoc;
+
+ // Current rotation
+ float mRotation;
+
+ // Geometry data
+ CubeGeometry mCube;
+};
+
+int main(int argc, char **argv)
+{
+ SimpleVertexShaderSample app;
+ return app.run();
+}
diff --git a/chromium/third_party/angle/samples/angle/stencil_operations/StencilOperations.cpp b/chromium/third_party/angle/samples/angle/stencil_operations/StencilOperations.cpp
new file mode 100644
index 00000000000..aa2f56fca42
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/stencil_operations/StencilOperations.cpp
@@ -0,0 +1,242 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Based on Stencil_Test.c from
+// Book: OpenGL(R) ES 2.0 Programming Guide
+// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
+// ISBN-10: 0321502795
+// ISBN-13: 9780321502797
+// Publisher: Addison-Wesley Professional
+// URLs: http://safari.informit.com/9780321563835
+// http://www.opengles-book.com
+
+#include "SampleApplication.h"
+#include "shader_utils.h"
+
+class StencilOperationsSample : public SampleApplication
+{
+ public:
+ StencilOperationsSample::StencilOperationsSample()
+ : SampleApplication("StencilOperations", 1280, 720)
+ {
+ }
+
+ virtual bool initialize()
+ {
+ const std::string vs = SHADER_SOURCE
+ (
+ attribute vec4 a_position;
+ void main()
+ {
+ gl_Position = a_position;
+ }
+ );
+
+ const std::string fs = SHADER_SOURCE
+ (
+ precision mediump float;
+ uniform vec4 u_color;
+ void main()
+ {
+ gl_FragColor = u_color;
+ }
+ );
+
+ mProgram = CompileProgram(vs, fs);
+ if (!mProgram)
+ {
+ return false;
+ }
+
+ // Get the attribute locations
+ mPositionLoc = glGetAttribLocation(mProgram, "a_position");
+
+ // Get the sampler location
+ mColorLoc = glGetUniformLocation(mProgram, "u_color");
+
+ // Set the clear color
+ glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+
+ // Set the stencil clear value
+ glClearStencil(0x01);
+
+ // Set the depth clear value
+ glClearDepthf(0.75f);
+
+ // Enable the depth and stencil tests
+ glEnable(GL_DEPTH_TEST);
+ glEnable(GL_STENCIL_TEST);
+
+ return true;
+ }
+
+ virtual void destroy()
+ {
+ glDeleteProgram(mProgram);
+ }
+
+ virtual void draw()
+ {
+ GLfloat vertices[] =
+ {
+ -0.75f, 0.25f, 0.50f, // Quad #0
+ -0.25f, 0.25f, 0.50f,
+ -0.25f, 0.75f, 0.50f,
+ -0.75f, 0.75f, 0.50f,
+ 0.25f, 0.25f, 0.90f, // Quad #1
+ 0.75f, 0.25f, 0.90f,
+ 0.75f, 0.75f, 0.90f,
+ 0.25f, 0.75f, 0.90f,
+ -0.75f, -0.75f, 0.50f, // Quad #2
+ -0.25f, -0.75f, 0.50f,
+ -0.25f, -0.25f, 0.50f,
+ -0.75f, -0.25f, 0.50f,
+ 0.25f, -0.75f, 0.50f, // Quad #3
+ 0.75f, -0.75f, 0.50f,
+ 0.75f, -0.25f, 0.50f,
+ 0.25f, -0.25f, 0.50f,
+ -1.00f, -1.00f, 0.00f, // Big Quad
+ 1.00f, -1.00f, 0.00f,
+ 1.00f, 1.00f, 0.00f,
+ -1.00f, 1.00f, 0.00f,
+ };
+
+ GLubyte indices[][6] =
+ {
+ { 0, 1, 2, 0, 2, 3 }, // Quad #0
+ { 4, 5, 6, 4, 6, 7 }, // Quad #1
+ { 8, 9, 10, 8, 10, 11 }, // Quad #2
+ { 12, 13, 14, 12, 14, 15 }, // Quad #3
+ { 16, 17, 18, 16, 18, 19 }, // Big Quad
+ };
+
+ static const size_t testCount = 4;
+ GLfloat colors[testCount][4] =
+ {
+ { 1.0f, 0.0f, 0.0f, 1.0f },
+ { 0.0f, 1.0f, 0.0f, 1.0f },
+ { 0.0f, 0.0f, 1.0f, 1.0f },
+ { 1.0f, 1.0f, 0.0f, 0.0f },
+ };
+
+ GLuint stencilValues[testCount] =
+ {
+ 0x7, // Result of test 0
+ 0x0, // Result of test 1
+ 0x2, // Result of test 2
+ 0xff // Result of test 3. We need to fill this value in at run-time
+ };
+
+ // Set the viewport
+ glViewport(0, 0, getWindow()->getWidth(), getWindow()->getHeight());
+
+ // Clear the color, depth, and stencil buffers. At this point, the stencil
+ // buffer will be 0x1 for all pixels
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
+
+ // Use the program object
+ glUseProgram(mProgram);
+
+ // Load the vertex data
+ glVertexAttribPointer(mPositionLoc, 3, GL_FLOAT, GL_FALSE, 0, vertices);
+ glEnableVertexAttribArray(mPositionLoc);
+
+ // Test 0:
+ //
+ // Initialize upper-left region. In this case, the stencil-buffer values will
+ // be replaced because the stencil test for the rendered pixels will fail the
+ // stencil test, which is
+ //
+ // ref mask stencil mask
+ // ( 0x7 & 0x3 ) < ( 0x1 & 0x7 )
+ //
+ // The value in the stencil buffer for these pixels will be 0x7.
+ glStencilFunc(GL_LESS, 0x7, 0x3);
+ glStencilOp(GL_REPLACE, GL_DECR, GL_DECR);
+ glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, indices[0]);
+
+ // Test 1:
+ //
+ // Initialize the upper-right region. Here, we'll decrement the stencil-buffer
+ // values where the stencil test passes but the depth test fails. The stencil test is
+ //
+ // ref mask stencil mask
+ // ( 0x3 & 0x3 ) > ( 0x1 & 0x3 )
+ //
+ // but where the geometry fails the depth test. The stencil values for these pixels
+ // will be 0x0.
+ glStencilFunc(GL_GREATER, 0x3, 0x3);
+ glStencilOp(GL_KEEP, GL_DECR, GL_KEEP);
+ glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, indices[1]);
+
+ // Test 2:
+ //
+ // Initialize the lower-left region. Here we'll increment (with saturation) the
+ // stencil value where both the stencil and depth tests pass. The stencil test for
+ // these pixels will be
+ //
+ // ref mask stencil mask
+ // ( 0x1 & 0x3 ) == ( 0x1 & 0x3 )
+ //
+ // The stencil values for these pixels will be 0x2.
+ glStencilFunc(GL_EQUAL, 0x1, 0x3);
+ glStencilOp(GL_KEEP, GL_INCR, GL_INCR);
+ glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, indices[2]);
+
+ // Test 3:
+ //
+ // Finally, initialize the lower-right region. We'll invert the stencil value
+ // where the stencil tests fails. The stencil test for these pixels will be
+ //
+ // ref mask stencil mask
+ // ( 0x2 & 0x1 ) == ( 0x1 & 0x1 )
+ //
+ // The stencil value here will be set to ~((2^s-1) & 0x1), (with the 0x1 being
+ // from the stencil clear value), where 's' is the number of bits in the stencil
+ // buffer
+ glStencilFunc(GL_EQUAL, 0x2, 0x1);
+ glStencilOp(GL_INVERT, GL_KEEP, GL_KEEP);
+ glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, indices[3]);
+
+ // Since we don't know at compile time how many stencil bits are present, we'll
+ // query, and update the value correct value in the stencilValues arrays for the
+ // fourth tests. We'll use this value later in rendering.
+ GLint stencilBitCount;
+ glGetIntegerv(GL_STENCIL_BITS, &stencilBitCount);
+ stencilValues[3] = ~(((1 << stencilBitCount) - 1) & 0x1) & 0xff;
+
+ // Use the stencil buffer for controlling where rendering will occur. We disable
+ // writing to the stencil buffer so we can test against them without modifying
+ // the values we generated.
+ glStencilMask(0x0);
+
+ for (size_t i = 0; i < testCount; ++i)
+ {
+ glStencilFunc(GL_EQUAL, stencilValues[i], 0xff);
+ glUniform4fv(mColorLoc, 1, colors[i]);
+ glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, indices[4]);
+ }
+
+ // Reset the stencil mask
+ glStencilMask(0xFF);
+ }
+
+ private:
+ // Handle to a program object
+ GLuint mProgram;
+
+ // Attribute locations
+ GLint mPositionLoc;
+
+ // Uniform locations
+ GLint mColorLoc;
+};
+
+int main(int argc, char **argv)
+{
+ StencilOperationsSample app;
+ return app.run();
+}
diff --git a/chromium/third_party/angle/samples/angle/texture_wrap/TextureWrap.cpp b/chromium/third_party/angle/samples/angle/texture_wrap/TextureWrap.cpp
new file mode 100644
index 00000000000..7d5605923a1
--- /dev/null
+++ b/chromium/third_party/angle/samples/angle/texture_wrap/TextureWrap.cpp
@@ -0,0 +1,160 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Based on TextureWrap.c from
+// Book: OpenGL(R) ES 2.0 Programming Guide
+// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
+// ISBN-10: 0321502795
+// ISBN-13: 9780321502797
+// Publisher: Addison-Wesley Professional
+// URLs: http://safari.informit.com/9780321563835
+// http://www.opengles-book.com
+
+#include "SampleApplication.h"
+#include "shader_utils.h"
+#include "texture_utils.h"
+
+class TextureWrapSample : public SampleApplication
+{
+ public:
+ TextureWrapSample::TextureWrapSample()
+ : SampleApplication("TextureWrap", 1280, 720)
+ {
+ }
+
+ virtual bool initialize()
+ {
+ const std::string vs = SHADER_SOURCE
+ (
+ uniform float u_offset;
+ attribute vec4 a_position;
+ attribute vec2 a_texCoord;
+ varying vec2 v_texCoord;
+ void main()
+ {
+ gl_Position = a_position;
+ gl_Position.x += u_offset;
+ v_texCoord = a_texCoord;
+ }
+ );
+
+ const std::string fs = SHADER_SOURCE
+ (
+ precision mediump float;
+ varying vec2 v_texCoord;
+ uniform sampler2D s_texture;
+ void main()
+ {
+ gl_FragColor = texture2D(s_texture, v_texCoord);
+ }
+ );
+
+ mProgram = CompileProgram(vs, fs);
+ if (!mProgram)
+ {
+ return false;
+ }
+
+ // Get the attribute locations
+ mPositionLoc = glGetAttribLocation(mProgram, "a_position");
+ mTexCoordLoc = glGetAttribLocation(mProgram, "a_texCoord");
+
+ // Get the sampler location
+ mSamplerLoc = glGetUniformLocation(mProgram, "s_texture");
+
+ // Get the offset location
+ mOffsetLoc = glGetUniformLocation(mProgram, "u_offset");
+
+ // Load the texture
+ mTexture = CreateMipMappedTexture2D();
+
+ glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+
+ return true;
+ }
+
+ virtual void destroy()
+ {
+ glDeleteProgram(mProgram);
+ }
+
+ virtual void draw()
+ {
+ GLfloat vertices[] =
+ {
+ -0.3f, 0.3f, 0.0f, 1.0f, // Position 0
+ -1.0f, -1.0f, // TexCoord 0
+ -0.3f, -0.3f, 0.0f, 1.0f, // Position 1
+ -1.0f, 2.0f, // TexCoord 1
+ 0.3f, -0.3f, 0.0f, 1.0f, // Position 2
+ 2.0f, 2.0f, // TexCoord 2
+ 0.3f, 0.3f, 0.0f, 1.0f, // Position 3
+ 2.0f, -1.0f // TexCoord 3
+ };
+ GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
+
+ // Set the viewport
+ glViewport(0, 0, getWindow()->getWidth(), getWindow()->getHeight());
+
+ // Clear the color buffer
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ // Use the program object
+ glUseProgram(mProgram);
+
+ // Load the vertex position
+ glVertexAttribPointer(mPositionLoc, 4, GL_FLOAT, GL_FALSE, 6 * sizeof(GLfloat), vertices);
+ glEnableVertexAttribArray(mPositionLoc);
+
+ // Load the texture coordinate
+ glVertexAttribPointer(mTexCoordLoc, 2, GL_FLOAT, GL_FALSE, 6 * sizeof(GLfloat), vertices + 4);
+ glEnableVertexAttribArray(mTexCoordLoc);
+
+ // Set the sampler texture unit to 0
+ glUniform1i(mSamplerLoc, 0);
+
+ // Draw quad with repeat wrap mode
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+ glUniform1f(mOffsetLoc, -0.7f);
+ glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
+
+ // Draw quad with clamp to edge wrap mode
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ glUniform1f(mOffsetLoc, 0.0f);
+ glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
+
+ // Draw quad with mirrored repeat
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT);
+ glUniform1f(mOffsetLoc, 0.7f);
+ glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
+ }
+
+private:
+ // Handle to a program object
+ GLuint mProgram;
+
+ // Attribute locations
+ GLint mPositionLoc;
+ GLint mTexCoordLoc;
+
+ // Sampler location
+ GLint mSamplerLoc;
+
+ // Offset location
+ GLint mOffsetLoc;
+
+ // Texture handle
+ GLuint mTexture;
+};
+
+int main(int argc, char **argv)
+{
+ TextureWrapSample app;
+ return app.run();
+}
diff --git a/chromium/third_party/angle/samples/build_samples.gyp b/chromium/third_party/angle/samples/build_samples.gyp
deleted file mode 100644
index d79de06e2ac..00000000000
--- a/chromium/third_party/angle/samples/build_samples.gyp
+++ /dev/null
@@ -1,178 +0,0 @@
-# Copyright (c) 2010 The ANGLE Project Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-{
- 'targets': [
- {
- 'target_name': 'essl_to_glsl',
- 'type': 'executable',
- 'dependencies': [
- '../src/build_angle.gyp:translator',
- ],
- 'include_dirs': [
- '../include',
- ],
- 'sources': [
- 'translator/translator.cpp',
- ],
- },
- ],
- 'conditions': [
- ['OS=="win"', {
- 'targets': [
- {
- 'target_name': 'essl_to_hlsl',
- 'type': 'executable',
- 'dependencies': [
- '../src/build_angle.gyp:translator',
- ],
- 'include_dirs': [
- '../include',
- '../src',
- ],
- 'sources': [
- 'translator/translator.cpp',
- '../src/common/debug.cpp',
- ],
- 'msvs_settings': {
- 'VCLinkerTool': {
- 'AdditionalDependencies': ['d3d9.lib'],
- }
- }
- },
- {
- 'target_name': 'es_util',
- 'type': 'static_library',
- 'dependencies': [
- '../src/build_angle.gyp:libEGL',
- '../src/build_angle.gyp:libGLESv2',
- ],
- 'include_dirs': [
- 'gles2_book/Common',
- '../include',
- ],
- 'sources': [
- 'gles2_book/Common/esShader.c',
- 'gles2_book/Common/esShapes.c',
- 'gles2_book/Common/esTransform.c',
- 'gles2_book/Common/esUtil.c',
- 'gles2_book/Common/esUtil.h',
- 'gles2_book/Common/esUtil_win.h',
- 'gles2_book/Common/Win32/esUtil_TGA.c',
- 'gles2_book/Common/Win32/esUtil_win32.c',
- ],
- 'direct_dependent_settings': {
- 'include_dirs': [
- 'gles2_book/Common',
- '../include',
- ],
- },
- },
- {
- 'target_name': 'hello_triangle',
- 'type': 'executable',
- 'dependencies': ['es_util'],
- 'sources': [
- 'gles2_book/Hello_Triangle/Hello_Triangle.c',
- ],
- },
- {
- 'target_name': 'mip_map_2d',
- 'type': 'executable',
- 'dependencies': ['es_util'],
- 'sources': [
- 'gles2_book/MipMap2D/MipMap2D.c',
- ],
- },
- {
- 'target_name': 'multi_texture',
- 'type': 'executable',
- 'dependencies': ['es_util'],
- 'sources': [
- 'gles2_book/MultiTexture/MultiTexture.c',
- ],
- 'copies': [
- {
- 'destination': '<(PRODUCT_DIR)',
- 'files': [
- 'gles2_book/MultiTexture/basemap.tga',
- 'gles2_book/MultiTexture/lightmap.tga',
- ],
- },
- ],
- },
- {
- 'target_name': 'particle_system',
- 'type': 'executable',
- 'dependencies': ['es_util'],
- 'sources': [
- 'gles2_book/ParticleSystem/ParticleSystem.c',
- ],
- 'copies': [
- {
- 'destination': '<(PRODUCT_DIR)',
- 'files': [
- 'gles2_book/ParticleSystem/smoke.tga',
- ],
- },
- ],
- },
- {
- 'target_name': 'simple_texture_2d',
- 'type': 'executable',
- 'dependencies': ['es_util'],
- 'sources': [
- 'gles2_book/Simple_Texture2D/Simple_Texture2D.c',
- ],
- },
- {
- 'target_name': 'simple_texture_cubemap',
- 'type': 'executable',
- 'dependencies': ['es_util'],
- 'sources': [
- 'gles2_book/Simple_TextureCubemap/Simple_TextureCubemap.c',
- ],
- },
- {
- 'target_name': 'simple_vertex_shader',
- 'type': 'executable',
- 'dependencies': ['es_util'],
- 'sources': [
- 'gles2_book/Simple_VertexShader/Simple_VertexShader.c',
- ],
- },
- {
- 'target_name': 'stencil_test',
- 'type': 'executable',
- 'dependencies': ['es_util'],
- 'sources': [
- 'gles2_book/Stencil_Test/Stencil_Test.c',
- ],
- },
- {
- 'target_name': 'texture_wrap',
- 'type': 'executable',
- 'dependencies': ['es_util'],
- 'sources': [
- 'gles2_book/TextureWrap/TextureWrap.c',
- ],
- },
- {
- 'target_name': 'post_sub_buffer',
- 'type': 'executable',
- 'dependencies': ['es_util'],
- 'sources': [
- 'gles2_book/PostSubBuffer/PostSubBuffer.c',
- ],
- },
- ],
- }],
- ],
-}
-
-# Local Variables:
-# tab-width:2
-# indent-tabs-mode:nil
-# End:
-# vim: set expandtab tabstop=2 shiftwidth=2:
diff --git a/chromium/third_party/angle/samples/dds_to_header/main.cpp b/chromium/third_party/angle/samples/dds_to_header/main.cpp
new file mode 100644
index 00000000000..3df80aa751b
--- /dev/null
+++ b/chromium/third_party/angle/samples/dds_to_header/main.cpp
@@ -0,0 +1,238 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include <ddraw.h>
+#include <d3d9types.h>
+#include <stdio.h>
+#include <fstream>
+#include <vector>
+#include <iostream>
+#include <string>
+#include <algorithm>
+#include <array>
+
+int main(int argc, char **argv)
+{
+ std::string programName(argv[0]);
+ if (argc < 4)
+ {
+ std::cout << "usage:\n";
+ std::cout << programName << "INPUT_FILE OUTPUT_C_ARRAY_NAME OUTPUT_FILE\n";
+ return -1;
+ }
+
+ std::string inputFile(argv[1]);
+ std::string outputName(argv[2]);
+ std::string outputFile(argv[3]);
+ std::ifstream readFile(inputFile, std::ios::binary | std::ios::in);
+
+ readFile.seekg(0, std::ios::end);
+ std::streamoff fileSize = readFile.tellg();
+ readFile.seekg(0, std::ios::beg);
+
+ const std::size_t minSize = sizeof(DDSURFACEDESC2) + sizeof(DWORD);
+ if (fileSize < minSize)
+ {
+ std::cout << inputFile << " is only " << fileSize << " bytes, must be at greater than " << minSize
+ << " bytes to be a correct DDS image file.\n";
+ return -2;
+ }
+
+ DWORD magicWord;
+ readFile.read(reinterpret_cast<char*>(&magicWord), sizeof(DWORD));
+ if (magicWord != MAKEFOURCC('D','D','S',' '))
+ {
+ std::cout << "Magic word must be " << MAKEFOURCC('D','D','S',' ') << ".\n";
+ return -3;
+ }
+
+ DDSURFACEDESC2 header;
+ readFile.read(reinterpret_cast<char*>(&header), sizeof(DDSURFACEDESC2));
+
+ std::string formatName;
+ std::size_t blockSize = 0;
+ std::size_t blockWidth = 0;
+ std::size_t blockHeight = 0;
+
+ if (header.ddpfPixelFormat.dwFlags & DDPF_RGB)
+ {
+ blockSize = header.ddpfPixelFormat.dwRGBBitCount / 8;
+ blockWidth = 1;
+ blockHeight = 1;
+
+ if (blockSize == 4)
+ {
+ if (header.ddpfPixelFormat.dwRBitMask == 0x000000FF &&
+ header.ddpfPixelFormat.dwGBitMask == 0x0000FF00 &&
+ header.ddpfPixelFormat.dwBBitMask == 0x00FF0000 &&
+ header.ddpfPixelFormat.dwRGBAlphaBitMask == 0xFF000000)
+ {
+ formatName = "RGBA8";
+ }
+ else if (header.ddpfPixelFormat.dwRBitMask == 0x000000FF &&
+ header.ddpfPixelFormat.dwGBitMask == 0x0000FF00 &&
+ header.ddpfPixelFormat.dwBBitMask == 0x00FF0000 &&
+ header.ddpfPixelFormat.dwRGBAlphaBitMask == 0x00000000)
+ {
+ formatName = "RGBX8";
+ }
+ else if (header.ddpfPixelFormat.dwRBitMask == 0x000003FF &&
+ header.ddpfPixelFormat.dwGBitMask == 0x000FFC00 &&
+ header.ddpfPixelFormat.dwBBitMask == 0x3FF00000 &&
+ header.ddpfPixelFormat.dwRGBAlphaBitMask == 0xC0000000)
+ {
+ formatName = "RGB10A2";
+ }
+ else if (header.ddpfPixelFormat.dwRBitMask == 0x0000FFFF &&
+ header.ddpfPixelFormat.dwGBitMask == 0xFFFF0000 &&
+ header.ddpfPixelFormat.dwBBitMask == 0x00000000 &&
+ header.ddpfPixelFormat.dwRGBAlphaBitMask == 0x00000000)
+ {
+ formatName = "RG16";
+ }
+ else if (header.ddpfPixelFormat.dwRBitMask == 0xFFFFFFFF &&
+ header.ddpfPixelFormat.dwGBitMask == 0x00000000 &&
+ header.ddpfPixelFormat.dwBBitMask == 0x00000000 &&
+ header.ddpfPixelFormat.dwRGBAlphaBitMask == 0x00000000)
+ {
+ formatName = "R32";
+ }
+ else
+ {
+ formatName = "UKNOWN";
+ }
+ }
+ }
+ else if (header.ddpfPixelFormat.dwFlags & DDPF_FOURCC)
+ {
+ switch (header.ddpfPixelFormat.dwFourCC)
+ {
+ case MAKEFOURCC('D','X','T','1'):
+ formatName = "DXT1";
+ blockSize = 8;
+ blockWidth = 4;
+ blockHeight = 4;
+ break;
+
+ case MAKEFOURCC('D','X','T','3'):
+ formatName = "DXT3";
+ blockSize = 16;
+ blockWidth = 4;
+ blockHeight = 4;
+ break;
+
+ case MAKEFOURCC('D','X','T','5'):
+ formatName = "DXT5";
+ blockSize = 16;
+ blockWidth = 4;
+ blockHeight = 4;
+ break;
+
+ case D3DFMT_R32F:
+ formatName = "R32F";
+ blockSize = 4;
+ blockWidth = 1;
+ blockHeight = 1;
+
+ case D3DFMT_G32R32F:
+ formatName = "RG32F";
+ blockSize = 8;
+ blockWidth = 1;
+ blockHeight = 1;
+
+ case D3DFMT_A32B32G32R32F:
+ formatName = "RGBA32F";
+ blockSize = 16;
+ blockWidth = 1;
+ blockHeight = 1;
+
+ case D3DFMT_R16F:
+ formatName = "R16F";
+ blockSize = 2;
+ blockWidth = 1;
+ blockHeight = 1;
+
+ case D3DFMT_G16R16F:
+ formatName = "RG16F";
+ blockSize = 4;
+ blockWidth = 1;
+ blockHeight = 1;
+
+ case D3DFMT_A16B16G16R16F:
+ formatName = "RGBA16F";
+ blockSize = 8;
+ blockWidth = 1;
+ blockHeight = 1;
+
+ default:
+ std::cout << "Unsupported FourCC format.\n";
+ return -5;
+ }
+ }
+ else
+ {
+ std::cout << "Unsupported DDS format.\n";
+ return -6;
+ }
+
+ std::size_t height = header.dwHeight;
+ std::size_t width = header.dwWidth;
+ std::size_t levels = std::max<size_t>(1, header.dwMipMapCount);
+
+ std::ofstream oss(outputFile);
+ oss << "// Automatically generated header from " << inputFile << ", a " << width << "x" << height;
+ if (levels > 1)
+ {
+ oss << " (" << levels << " mip levels)";
+ }
+ oss << "\n// " << formatName << " texture using " << programName << ".\n";
+
+ oss << "static const size_t " << outputName << "_width = " << width << ";\n";
+ oss << "static const size_t " << outputName << "_height = " << height << ";\n";
+ oss << "static const size_t " << outputName << "_levels = " << levels << ";\n";
+ oss << "\n";
+
+ for (std::size_t i = 0; i < levels; ++i)
+ {
+ std::size_t widthAtLevel = std::max<size_t>(width >> i, 1);
+ std::size_t heightAtLevel = std::max<size_t>(height >> i, 1);
+ std::size_t sizeAtLevel = static_cast<std::size_t>(std::ceil(widthAtLevel / static_cast<float>(blockWidth)) *
+ std::ceil(heightAtLevel / static_cast<float>(blockHeight))) *
+ blockSize;
+
+ std::vector<unsigned char> data(sizeAtLevel);
+ readFile.read(reinterpret_cast<char*>(data.data()), sizeAtLevel);
+
+ oss << "static const size_t " << outputName << "_" << i << "_width = " << widthAtLevel << ";\n";
+ oss << "static const size_t " << outputName << "_" << i << "_height = " << heightAtLevel << ";\n";
+ oss << "static const size_t " << outputName << "_" << i << "_size = " << sizeAtLevel << ";\n";
+ oss << "static const unsigned char " << outputName << "_" << i << "_data[" << sizeAtLevel << "] =\n";
+ oss << "{";
+ for (std::size_t j = 0; j < sizeAtLevel; j++)
+ {
+ if (j % 16 == 0)
+ {
+ oss << "\n ";
+ }
+
+ char buffer[32];
+ sprintf_s(buffer, "0x%02X,", data[j]);
+ oss << std::string(buffer);
+ }
+ oss << "\n";
+ oss << "};\n";
+
+ if (i + 1 < levels)
+ {
+ oss << "\n";
+ }
+ }
+
+ oss.close();
+ readFile.close();
+
+ return 0;
+}
diff --git a/chromium/third_party/angle/samples/gles2_book/Common/Win32/esUtil_TGA.c b/chromium/third_party/angle/samples/gles2_book/Common/Win32/esUtil_TGA.c
deleted file mode 100644
index 61d1cb149d8..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/Common/Win32/esUtil_TGA.c
+++ /dev/null
@@ -1,122 +0,0 @@
-//
-// Book: OpenGL(R) ES 2.0 Programming Guide
-// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
-// ISBN-10: 0321502795
-// ISBN-13: 9780321502797
-// Publisher: Addison-Wesley Professional
-// URLs: http://safari.informit.com/9780321563835
-// http://www.opengles-book.com
-//
-
-// esUtil_TGA.c
-//
-// This file contains the Win32 implementation of a TGA image loader
-
-#include <windows.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-///
-// Macros
-//
-#define INVERTED_BIT (1 << 5)
-
-///
-// Types
-//
-#pragma pack(push,x1) // Byte alignment (8-bit)
-#pragma pack(1)
-
-typedef struct
-{
- unsigned char IdSize,
- MapType,
- ImageType;
- unsigned short PaletteStart,
- PaletteSize;
- unsigned char PaletteEntryDepth;
- unsigned short X,
- Y,
- Width,
- Height;
- unsigned char ColorDepth,
- Descriptor;
-
-} TGA_HEADER;
-
-#pragma pack(pop,x1)
-
-////////////////////////////////////////////////////////////////////////////////////
-//
-// Private Functions
-//
-
-////////////////////////////////////////////////////////////////////////////////////
-//
-// Public Functions
-//
-//
-
-
-///
-// WinTGALoad()
-//
-int WinTGALoad( const char *fileName, char **buffer, int *width, int *height )
-{
- FILE *fp;
- TGA_HEADER Header;
-
- if ( fopen_s ( &fp, fileName, "rb" ) != 0 )
- {
- return FALSE;
- }
-
- if ( fp == NULL )
- {
- return FALSE;
- }
-
- fread ( &Header, sizeof(TGA_HEADER), 1, fp );
-
- *width = Header.Width;
- *height = Header.Height;
-
- if ( Header.ColorDepth == 24 )
- {
- RGBTRIPLE *Buffer24;
-
- Buffer24= (RGBTRIPLE*)malloc(sizeof(RGBTRIPLE) * (*width) * (*height));
-
- if(Buffer24)
- {
- int i=0;
- int x,
- y;
-
- fread(Buffer24, sizeof(RGBTRIPLE), (*width) * (*height), fp);
-
- *buffer= (LPSTR) malloc(3 * (*width) * (*height));
-
- for ( y = 0; y < *height; y++ )
- for( x = 0; x < *width; x++ )
- {
- int Index= y * (*width) + x;
-
- if(!(Header.Descriptor & INVERTED_BIT))
- Index= ((*height) - 1 - y) * (*width) + x;
-
- (*buffer)[(i * 3)]= Buffer24[Index].rgbtRed;
- (*buffer)[(i * 3) + 1]= Buffer24[Index].rgbtGreen;
- (*buffer)[(i * 3) + 2]= Buffer24[Index].rgbtBlue;
-
- i++;
- }
-
- fclose(fp);
- free(Buffer24);
- return(TRUE);
- }
- }
-
- return(FALSE);
-}
diff --git a/chromium/third_party/angle/samples/gles2_book/Common/Win32/esUtil_win32.c b/chromium/third_party/angle/samples/gles2_book/Common/Win32/esUtil_win32.c
deleted file mode 100644
index c27131ed476..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/Common/Win32/esUtil_win32.c
+++ /dev/null
@@ -1,190 +0,0 @@
-//
-// Book: OpenGL(R) ES 2.0 Programming Guide
-// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
-// ISBN-10: 0321502795
-// ISBN-13: 9780321502797
-// Publisher: Addison-Wesley Professional
-// URLs: http://safari.informit.com/9780321563835
-// http://www.opengles-book.com
-//
-
-// esUtil_win32.c
-//
-// This file contains the Win32 implementation of the windowing functions.
-
-
-///
-// Includes
-//
-
-#include <windows.h>
-#include "esUtil.h"
-
-//////////////////////////////////////////////////////////////////
-//
-// Private Functions
-//
-//
-
-///
-// ESWindowProc()
-//
-// Main window procedure
-//
-LRESULT WINAPI ESWindowProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
-{
- LRESULT lRet = 1;
-
- switch (uMsg)
- {
- case WM_CREATE:
- break;
-
- case WM_SIZE:
- {
- ESContext *esContext = (ESContext*)(LONG_PTR) GetWindowLongPtr ( hWnd, GWL_USERDATA );
- if ( esContext ) {
- esContext->width = LOWORD( lParam );
- esContext->height = HIWORD( lParam );
- InvalidateRect( esContext->hWnd, NULL, FALSE );
- }
- }
-
- case WM_PAINT:
- {
- ESContext *esContext = (ESContext*)(LONG_PTR) GetWindowLongPtr ( hWnd, GWL_USERDATA );
-
- if ( esContext && esContext->drawFunc )
- esContext->drawFunc ( esContext );
-
- if ( esContext )
- ValidateRect( esContext->hWnd, NULL );
- }
- break;
-
- case WM_DESTROY:
- PostQuitMessage(0);
- break;
-
- case WM_CHAR:
- {
- POINT point;
- ESContext *esContext = (ESContext*)(LONG_PTR) GetWindowLongPtr ( hWnd, GWL_USERDATA );
-
- GetCursorPos( &point );
-
- if ( esContext && esContext->keyFunc )
- esContext->keyFunc ( esContext, (unsigned char) wParam,
- (int) point.x, (int) point.y );
-}
- break;
-
- default:
- lRet = DefWindowProc (hWnd, uMsg, wParam, lParam);
- break;
- }
-
- return lRet;
-}
-
-//////////////////////////////////////////////////////////////////
-//
-// Public Functions
-//
-//
-
-///
-// WinCreate()
-//
-// Create Win32 instance and window
-//
-GLboolean WinCreate ( ESContext *esContext, LPCTSTR title )
-{
- WNDCLASS wndclass = {0};
- DWORD wStyle = 0;
- RECT windowRect;
- HINSTANCE hInstance = GetModuleHandle(NULL);
-
- wndclass.style = CS_OWNDC;
- wndclass.lpfnWndProc = (WNDPROC)ESWindowProc;
- wndclass.hInstance = hInstance;
- wndclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
- wndclass.lpszClassName = TEXT("opengles2.0");
-
- if (!RegisterClass (&wndclass) )
- return FALSE;
-
- wStyle = WS_VISIBLE | WS_POPUP | WS_BORDER | WS_SYSMENU | WS_CAPTION | WS_SIZEBOX;
-
- // Adjust the window rectangle so that the client area has
- // the correct number of pixels
- windowRect.left = 0;
- windowRect.top = 0;
- windowRect.right = esContext->width;
- windowRect.bottom = esContext->height;
-
- AdjustWindowRect ( &windowRect, wStyle, FALSE );
-
- esContext->hWnd = CreateWindow(
- TEXT("opengles2.0"),
- title,
- wStyle,
- 0,
- 0,
- windowRect.right - windowRect.left,
- windowRect.bottom - windowRect.top,
- NULL,
- NULL,
- hInstance,
- NULL);
-
- // Set the ESContext* to the GWL_USERDATA so that it is available to the
- // ESWindowProc
- SetWindowLongPtr ( esContext->hWnd, GWL_USERDATA, (LONG) (LONG_PTR) esContext );
-
- if ( esContext->hWnd == NULL )
- return GL_FALSE;
-
- ShowWindow ( esContext->hWnd, TRUE );
-
- return GL_TRUE;
-}
-
-///
-// winLoop()
-//
-// Start main windows loop
-//
-void WinLoop ( ESContext *esContext )
-{
- MSG msg = { 0 };
- int done = 0;
- DWORD lastTime = GetTickCount();
-
- while (!done)
- {
- int gotMsg = (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) != 0);
- DWORD curTime = GetTickCount();
- float deltaTime = (float)( curTime - lastTime ) / 1000.0f;
- lastTime = curTime;
-
- if ( gotMsg )
- {
- if (msg.message==WM_QUIT)
- {
- done=1;
- }
- else
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- }
- else
- SendMessage( esContext->hWnd, WM_PAINT, 0, 0 );
-
- // Call update function if registered
- if ( esContext->updateFunc != NULL )
- esContext->updateFunc ( esContext, deltaTime );
- }
-}
diff --git a/chromium/third_party/angle/samples/gles2_book/Common/esShader.c b/chromium/third_party/angle/samples/gles2_book/Common/esShader.c
deleted file mode 100644
index a2bb6e5206e..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/Common/esShader.c
+++ /dev/null
@@ -1,155 +0,0 @@
-//
-// Book: OpenGL(R) ES 2.0 Programming Guide
-// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
-// ISBN-10: 0321502795
-// ISBN-13: 9780321502797
-// Publisher: Addison-Wesley Professional
-// URLs: http://safari.informit.com/9780321563835
-// http://www.opengles-book.com
-//
-
-// ESShader.c
-//
-// Utility functions for loading shaders and creating program objects.
-//
-
-///
-// Includes
-//
-#include "esUtil.h"
-#include <stdlib.h>
-
-//////////////////////////////////////////////////////////////////
-//
-// Private Functions
-//
-//
-
-
-
-//////////////////////////////////////////////////////////////////
-//
-// Public Functions
-//
-//
-
-//
-///
-/// \brief Load a shader, check for compile errors, print error messages to output log
-/// \param type Type of shader (GL_VERTEX_SHADER or GL_FRAGMENT_SHADER)
-/// \param shaderSrc Shader source string
-/// \return A new shader object on success, 0 on failure
-//
-GLuint ESUTIL_API esLoadShader ( GLenum type, const char *shaderSrc )
-{
- GLuint shader;
- GLint compiled;
-
- // Create the shader object
- shader = glCreateShader ( type );
-
- if ( shader == 0 )
- return 0;
-
- // Load the shader source
- glShaderSource ( shader, 1, &shaderSrc, NULL );
-
- // Compile the shader
- glCompileShader ( shader );
-
- // Check the compile status
- glGetShaderiv ( shader, GL_COMPILE_STATUS, &compiled );
-
- if ( !compiled )
- {
- GLint infoLen = 0;
-
- glGetShaderiv ( shader, GL_INFO_LOG_LENGTH, &infoLen );
-
- if ( infoLen > 1 )
- {
- char* infoLog = malloc (sizeof(char) * infoLen );
-
- glGetShaderInfoLog ( shader, infoLen, NULL, infoLog );
- esLogMessage ( "Error compiling shader:\n%s\n", infoLog );
-
- free ( infoLog );
- }
-
- glDeleteShader ( shader );
- return 0;
- }
-
- return shader;
-
-}
-
-
-//
-///
-/// \brief Load a vertex and fragment shader, create a program object, link program.
-// Errors output to log.
-/// \param vertShaderSrc Vertex shader source code
-/// \param fragShaderSrc Fragment shader source code
-/// \return A new program object linked with the vertex/fragment shader pair, 0 on failure
-//
-GLuint ESUTIL_API esLoadProgram ( const char *vertShaderSrc, const char *fragShaderSrc )
-{
- GLuint vertexShader;
- GLuint fragmentShader;
- GLuint programObject;
- GLint linked;
-
- // Load the vertex/fragment shaders
- vertexShader = esLoadShader ( GL_VERTEX_SHADER, vertShaderSrc );
- if ( vertexShader == 0 )
- return 0;
-
- fragmentShader = esLoadShader ( GL_FRAGMENT_SHADER, fragShaderSrc );
- if ( fragmentShader == 0 )
- {
- glDeleteShader( vertexShader );
- return 0;
- }
-
- // Create the program object
- programObject = glCreateProgram ( );
-
- if ( programObject == 0 )
- return 0;
-
- glAttachShader ( programObject, vertexShader );
- glAttachShader ( programObject, fragmentShader );
-
- // Link the program
- glLinkProgram ( programObject );
-
- // Check the link status
- glGetProgramiv ( programObject, GL_LINK_STATUS, &linked );
-
- if ( !linked )
- {
- GLint infoLen = 0;
-
- glGetProgramiv ( programObject, GL_INFO_LOG_LENGTH, &infoLen );
-
- if ( infoLen > 1 )
- {
- char* infoLog = malloc (sizeof(char) * infoLen );
-
- glGetProgramInfoLog ( programObject, infoLen, NULL, infoLog );
- esLogMessage ( "Error linking program:\n%s\n", infoLog );
-
- free ( infoLog );
- }
-
- glDeleteProgram ( programObject );
- return 0;
- }
-
- // Free up no longer needed shader resources
- glDeleteShader ( vertexShader );
- glDeleteShader ( fragmentShader );
-
- return programObject;
-}
diff --git a/chromium/third_party/angle/samples/gles2_book/Common/esShapes.c b/chromium/third_party/angle/samples/gles2_book/Common/esShapes.c
deleted file mode 100644
index 6813534e882..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/Common/esShapes.c
+++ /dev/null
@@ -1,279 +0,0 @@
-//
-// Book: OpenGL(R) ES 2.0 Programming Guide
-// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
-// ISBN-10: 0321502795
-// ISBN-13: 9780321502797
-// Publisher: Addison-Wesley Professional
-// URLs: http://safari.informit.com/9780321563835
-// http://www.opengles-book.com
-//
-
-// ESShapes.c
-//
-// Utility functions for generating shapes
-//
-
-///
-// Includes
-//
-#include "esUtil.h"
-#include <stdlib.h>
-#include <math.h>
-
-///
-// Defines
-//
-#define ES_PI (3.14159265f)
-
-//////////////////////////////////////////////////////////////////
-//
-// Private Functions
-//
-//
-
-
-
-//////////////////////////////////////////////////////////////////
-//
-// Public Functions
-//
-//
-
-//
-/// \brief Generates geometry for a sphere. Allocates memory for the vertex data and stores
-/// the results in the arrays. Generate index list for a TRIANGLE_STRIP
-/// \param numSlices The number of slices in the sphere
-/// \param vertices If not NULL, will contain array of float3 positions
-/// \param normals If not NULL, will contain array of float3 normals
-/// \param texCoords If not NULL, will contain array of float2 texCoords
-/// \param indices If not NULL, will contain the array of indices for the triangle strip
-/// \return The number of indices required for rendering the buffers (the number of indices stored in the indices array
-/// if it is not NULL ) as a GL_TRIANGLE_STRIP
-//
-int ESUTIL_API esGenSphere ( int numSlices, float radius, GLfloat **vertices, GLfloat **normals,
- GLfloat **texCoords, GLushort **indices )
-{
- int i;
- int j;
- int numParallels = numSlices / 2;
- int numVertices = ( numParallels + 1 ) * ( numSlices + 1 );
- int numIndices = numParallels * numSlices * 6;
- float angleStep = (2.0f * ES_PI) / ((float) numSlices);
-
- // Allocate memory for buffers
- if ( vertices != NULL )
- *vertices = malloc ( sizeof(GLfloat) * 3 * numVertices );
-
- if ( normals != NULL )
- *normals = malloc ( sizeof(GLfloat) * 3 * numVertices );
-
- if ( texCoords != NULL )
- *texCoords = malloc ( sizeof(GLfloat) * 2 * numVertices );
-
- if ( indices != NULL )
- *indices = malloc ( sizeof(GLushort) * numIndices );
-
- for ( i = 0; i < numParallels + 1; i++ )
- {
- for ( j = 0; j < numSlices + 1; j++ )
- {
- int vertex = ( i * (numSlices + 1) + j ) * 3;
-
- if ( vertices )
- {
- (*vertices)[vertex + 0] = radius * sinf ( angleStep * (float)i ) *
- sinf ( angleStep * (float)j );
- (*vertices)[vertex + 1] = radius * cosf ( angleStep * (float)i );
- (*vertices)[vertex + 2] = radius * sinf ( angleStep * (float)i ) *
- cosf ( angleStep * (float)j );
- }
-
- if ( normals )
- {
- (*normals)[vertex + 0] = (*vertices)[vertex + 0] / radius;
- (*normals)[vertex + 1] = (*vertices)[vertex + 1] / radius;
- (*normals)[vertex + 2] = (*vertices)[vertex + 2] / radius;
- }
-
- if ( texCoords )
- {
- int texIndex = ( i * (numSlices + 1) + j ) * 2;
- (*texCoords)[texIndex + 0] = (float) j / (float) numSlices;
- (*texCoords)[texIndex + 1] = ( 1.0f - (float) i ) / (float) (numParallels - 1 );
- }
- }
- }
-
- // Generate the indices
- if ( indices != NULL )
- {
- GLushort *indexBuf = (*indices);
- for ( i = 0; i < numParallels ; i++ )
- {
- for ( j = 0; j < numSlices; j++ )
- {
- *indexBuf++ = i * ( numSlices + 1 ) + j;
- *indexBuf++ = ( i + 1 ) * ( numSlices + 1 ) + j;
- *indexBuf++ = ( i + 1 ) * ( numSlices + 1 ) + ( j + 1 );
-
- *indexBuf++ = i * ( numSlices + 1 ) + j;
- *indexBuf++ = ( i + 1 ) * ( numSlices + 1 ) + ( j + 1 );
- *indexBuf++ = i * ( numSlices + 1 ) + ( j + 1 );
- }
- }
- }
-
- return numIndices;
-}
-
-//
-/// \brief Generates geometry for a cube. Allocates memory for the vertex data and stores
-/// the results in the arrays. Generate index list for a TRIANGLES
-/// \param scale The size of the cube, use 1.0 for a unit cube.
-/// \param vertices If not NULL, will contain array of float3 positions
-/// \param normals If not NULL, will contain array of float3 normals
-/// \param texCoords If not NULL, will contain array of float2 texCoords
-/// \param indices If not NULL, will contain the array of indices for the triangle strip
-/// \return The number of indices required for rendering the buffers (the number of indices stored in the indices array
-/// if it is not NULL ) as a GL_TRIANGLE_STRIP
-//
-int ESUTIL_API esGenCube ( float scale, GLfloat **vertices, GLfloat **normals,
- GLfloat **texCoords, GLushort **indices )
-{
- int i;
- int numVertices = 24;
- int numIndices = 36;
-
- GLfloat cubeVerts[] =
- {
- -0.5f, -0.5f, -0.5f,
- -0.5f, -0.5f, 0.5f,
- 0.5f, -0.5f, 0.5f,
- 0.5f, -0.5f, -0.5f,
- -0.5f, 0.5f, -0.5f,
- -0.5f, 0.5f, 0.5f,
- 0.5f, 0.5f, 0.5f,
- 0.5f, 0.5f, -0.5f,
- -0.5f, -0.5f, -0.5f,
- -0.5f, 0.5f, -0.5f,
- 0.5f, 0.5f, -0.5f,
- 0.5f, -0.5f, -0.5f,
- -0.5f, -0.5f, 0.5f,
- -0.5f, 0.5f, 0.5f,
- 0.5f, 0.5f, 0.5f,
- 0.5f, -0.5f, 0.5f,
- -0.5f, -0.5f, -0.5f,
- -0.5f, -0.5f, 0.5f,
- -0.5f, 0.5f, 0.5f,
- -0.5f, 0.5f, -0.5f,
- 0.5f, -0.5f, -0.5f,
- 0.5f, -0.5f, 0.5f,
- 0.5f, 0.5f, 0.5f,
- 0.5f, 0.5f, -0.5f,
- };
-
- GLfloat cubeNormals[] =
- {
- 0.0f, -1.0f, 0.0f,
- 0.0f, -1.0f, 0.0f,
- 0.0f, -1.0f, 0.0f,
- 0.0f, -1.0f, 0.0f,
- 0.0f, 1.0f, 0.0f,
- 0.0f, 1.0f, 0.0f,
- 0.0f, 1.0f, 0.0f,
- 0.0f, 1.0f, 0.0f,
- 0.0f, 0.0f, -1.0f,
- 0.0f, 0.0f, -1.0f,
- 0.0f, 0.0f, -1.0f,
- 0.0f, 0.0f, -1.0f,
- 0.0f, 0.0f, 1.0f,
- 0.0f, 0.0f, 1.0f,
- 0.0f, 0.0f, 1.0f,
- 0.0f, 0.0f, 1.0f,
- -1.0f, 0.0f, 0.0f,
- -1.0f, 0.0f, 0.0f,
- -1.0f, 0.0f, 0.0f,
- -1.0f, 0.0f, 0.0f,
- 1.0f, 0.0f, 0.0f,
- 1.0f, 0.0f, 0.0f,
- 1.0f, 0.0f, 0.0f,
- 1.0f, 0.0f, 0.0f,
- };
-
- GLfloat cubeTex[] =
- {
- 0.0f, 0.0f,
- 0.0f, 1.0f,
- 1.0f, 1.0f,
- 1.0f, 0.0f,
- 1.0f, 0.0f,
- 1.0f, 1.0f,
- 0.0f, 1.0f,
- 0.0f, 0.0f,
- 0.0f, 0.0f,
- 0.0f, 1.0f,
- 1.0f, 1.0f,
- 1.0f, 0.0f,
- 0.0f, 0.0f,
- 0.0f, 1.0f,
- 1.0f, 1.0f,
- 1.0f, 0.0f,
- 0.0f, 0.0f,
- 0.0f, 1.0f,
- 1.0f, 1.0f,
- 1.0f, 0.0f,
- 0.0f, 0.0f,
- 0.0f, 1.0f,
- 1.0f, 1.0f,
- 1.0f, 0.0f,
- };
-
- // Allocate memory for buffers
- if ( vertices != NULL )
- {
- *vertices = malloc ( sizeof(GLfloat) * 3 * numVertices );
- memcpy( *vertices, cubeVerts, sizeof( cubeVerts ) );
- for ( i = 0; i < numVertices; i++ )
- {
- (*vertices)[i] *= scale;
- }
- }
-
- if ( normals != NULL )
- {
- *normals = malloc ( sizeof(GLfloat) * 3 * numVertices );
- memcpy( *normals, cubeNormals, sizeof( cubeNormals ) );
- }
-
- if ( texCoords != NULL )
- {
- *texCoords = malloc ( sizeof(GLfloat) * 2 * numVertices );
- memcpy( *texCoords, cubeTex, sizeof( cubeTex ) ) ;
- }
-
-
- // Generate the indices
- if ( indices != NULL )
- {
- GLushort cubeIndices[] =
- {
- 0, 2, 1,
- 0, 3, 2,
- 4, 5, 6,
- 4, 6, 7,
- 8, 9, 10,
- 8, 10, 11,
- 12, 15, 14,
- 12, 14, 13,
- 16, 17, 18,
- 16, 18, 19,
- 20, 23, 22,
- 20, 22, 21
- };
-
- *indices = malloc ( sizeof(GLushort) * numIndices );
- memcpy( *indices, cubeIndices, sizeof( cubeIndices ) );
- }
-
- return numIndices;
-}
diff --git a/chromium/third_party/angle/samples/gles2_book/Common/esTransform.c b/chromium/third_party/angle/samples/gles2_book/Common/esTransform.c
deleted file mode 100644
index 7da8f7652c0..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/Common/esTransform.c
+++ /dev/null
@@ -1,212 +0,0 @@
-//
-// Book: OpenGL(R) ES 2.0 Programming Guide
-// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
-// ISBN-10: 0321502795
-// ISBN-13: 9780321502797
-// Publisher: Addison-Wesley Professional
-// URLs: http://safari.informit.com/9780321563835
-// http://www.opengles-book.com
-//
-
-// ESUtil.c
-//
-// A utility library for OpenGL ES. This library provides a
-// basic common framework for the example applications in the
-// OpenGL ES 2.0 Programming Guide.
-//
-
-///
-// Includes
-//
-#include "esUtil.h"
-#include <math.h>
-
-#define PI 3.1415926535897932384626433832795f
-
-void ESUTIL_API
-esScale(ESMatrix *result, GLfloat sx, GLfloat sy, GLfloat sz)
-{
- result->m[0][0] *= sx;
- result->m[0][1] *= sx;
- result->m[0][2] *= sx;
- result->m[0][3] *= sx;
-
- result->m[1][0] *= sy;
- result->m[1][1] *= sy;
- result->m[1][2] *= sy;
- result->m[1][3] *= sy;
-
- result->m[2][0] *= sz;
- result->m[2][1] *= sz;
- result->m[2][2] *= sz;
- result->m[2][3] *= sz;
-}
-
-void ESUTIL_API
-esTranslate(ESMatrix *result, GLfloat tx, GLfloat ty, GLfloat tz)
-{
- result->m[3][0] += (result->m[0][0] * tx + result->m[1][0] * ty + result->m[2][0] * tz);
- result->m[3][1] += (result->m[0][1] * tx + result->m[1][1] * ty + result->m[2][1] * tz);
- result->m[3][2] += (result->m[0][2] * tx + result->m[1][2] * ty + result->m[2][2] * tz);
- result->m[3][3] += (result->m[0][3] * tx + result->m[1][3] * ty + result->m[2][3] * tz);
-}
-
-void ESUTIL_API
-esRotate(ESMatrix *result, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
-{
- GLfloat sinAngle, cosAngle;
- GLfloat mag = sqrtf(x * x + y * y + z * z);
-
- sinAngle = sinf ( angle * PI / 180.0f );
- cosAngle = cosf ( angle * PI / 180.0f );
- if ( mag > 0.0f )
- {
- GLfloat xx, yy, zz, xy, yz, zx, xs, ys, zs;
- GLfloat oneMinusCos;
- ESMatrix rotMat;
-
- x /= mag;
- y /= mag;
- z /= mag;
-
- xx = x * x;
- yy = y * y;
- zz = z * z;
- xy = x * y;
- yz = y * z;
- zx = z * x;
- xs = x * sinAngle;
- ys = y * sinAngle;
- zs = z * sinAngle;
- oneMinusCos = 1.0f - cosAngle;
-
- rotMat.m[0][0] = (oneMinusCos * xx) + cosAngle;
- rotMat.m[0][1] = (oneMinusCos * xy) - zs;
- rotMat.m[0][2] = (oneMinusCos * zx) + ys;
- rotMat.m[0][3] = 0.0F;
-
- rotMat.m[1][0] = (oneMinusCos * xy) + zs;
- rotMat.m[1][1] = (oneMinusCos * yy) + cosAngle;
- rotMat.m[1][2] = (oneMinusCos * yz) - xs;
- rotMat.m[1][3] = 0.0F;
-
- rotMat.m[2][0] = (oneMinusCos * zx) - ys;
- rotMat.m[2][1] = (oneMinusCos * yz) + xs;
- rotMat.m[2][2] = (oneMinusCos * zz) + cosAngle;
- rotMat.m[2][3] = 0.0F;
-
- rotMat.m[3][0] = 0.0F;
- rotMat.m[3][1] = 0.0F;
- rotMat.m[3][2] = 0.0F;
- rotMat.m[3][3] = 1.0F;
-
- esMatrixMultiply( result, &rotMat, result );
- }
-}
-
-void ESUTIL_API
-esFrustum(ESMatrix *result, float left, float right, float bottom, float top, float nearZ, float farZ)
-{
- float deltaX = right - left;
- float deltaY = top - bottom;
- float deltaZ = farZ - nearZ;
- ESMatrix frust;
-
- if ( (nearZ <= 0.0f) || (farZ <= 0.0f) ||
- (deltaX <= 0.0f) || (deltaY <= 0.0f) || (deltaZ <= 0.0f) )
- return;
-
- frust.m[0][0] = 2.0f * nearZ / deltaX;
- frust.m[0][1] = frust.m[0][2] = frust.m[0][3] = 0.0f;
-
- frust.m[1][1] = 2.0f * nearZ / deltaY;
- frust.m[1][0] = frust.m[1][2] = frust.m[1][3] = 0.0f;
-
- frust.m[2][0] = (right + left) / deltaX;
- frust.m[2][1] = (top + bottom) / deltaY;
- frust.m[2][2] = -(nearZ + farZ) / deltaZ;
- frust.m[2][3] = -1.0f;
-
- frust.m[3][2] = -2.0f * nearZ * farZ / deltaZ;
- frust.m[3][0] = frust.m[3][1] = frust.m[3][3] = 0.0f;
-
- esMatrixMultiply(result, &frust, result);
-}
-
-
-void ESUTIL_API
-esPerspective(ESMatrix *result, float fovy, float aspect, float nearZ, float farZ)
-{
- GLfloat frustumW, frustumH;
-
- frustumH = tanf( fovy / 360.0f * PI ) * nearZ;
- frustumW = frustumH * aspect;
-
- esFrustum( result, -frustumW, frustumW, -frustumH, frustumH, nearZ, farZ );
-}
-
-void ESUTIL_API
-esOrtho(ESMatrix *result, float left, float right, float bottom, float top, float nearZ, float farZ)
-{
- float deltaX = right - left;
- float deltaY = top - bottom;
- float deltaZ = farZ - nearZ;
- ESMatrix ortho;
-
- if ( (deltaX == 0.0f) || (deltaY == 0.0f) || (deltaZ == 0.0f) )
- return;
-
- esMatrixLoadIdentity(&ortho);
- ortho.m[0][0] = 2.0f / deltaX;
- ortho.m[3][0] = -(right + left) / deltaX;
- ortho.m[1][1] = 2.0f / deltaY;
- ortho.m[3][1] = -(top + bottom) / deltaY;
- ortho.m[2][2] = -2.0f / deltaZ;
- ortho.m[3][2] = -(nearZ + farZ) / deltaZ;
-
- esMatrixMultiply(result, &ortho, result);
-}
-
-
-void ESUTIL_API
-esMatrixMultiply(ESMatrix *result, ESMatrix *srcA, ESMatrix *srcB)
-{
- ESMatrix tmp = { 0.0f };
- int i;
-
- for (i=0; i<4; i++)
- {
- tmp.m[i][0] = (srcA->m[i][0] * srcB->m[0][0]) +
- (srcA->m[i][1] * srcB->m[1][0]) +
- (srcA->m[i][2] * srcB->m[2][0]) +
- (srcA->m[i][3] * srcB->m[3][0]) ;
-
- tmp.m[i][1] = (srcA->m[i][0] * srcB->m[0][1]) +
- (srcA->m[i][1] * srcB->m[1][1]) +
- (srcA->m[i][2] * srcB->m[2][1]) +
- (srcA->m[i][3] * srcB->m[3][1]) ;
-
- tmp.m[i][2] = (srcA->m[i][0] * srcB->m[0][2]) +
- (srcA->m[i][1] * srcB->m[1][2]) +
- (srcA->m[i][2] * srcB->m[2][2]) +
- (srcA->m[i][3] * srcB->m[3][2]) ;
-
- tmp.m[i][3] = (srcA->m[i][0] * srcB->m[0][3]) +
- (srcA->m[i][1] * srcB->m[1][3]) +
- (srcA->m[i][2] * srcB->m[2][3]) +
- (srcA->m[i][3] * srcB->m[3][3]) ;
- }
- memcpy(result, &tmp, sizeof(ESMatrix));
-}
-
-
-void ESUTIL_API
-esMatrixLoadIdentity(ESMatrix *result)
-{
- memset(result, 0x0, sizeof(ESMatrix));
- result->m[0][0] = 1.0f;
- result->m[1][1] = 1.0f;
- result->m[2][2] = 1.0f;
- result->m[3][3] = 1.0f;
-}
-
diff --git a/chromium/third_party/angle/samples/gles2_book/Common/esUtil.c b/chromium/third_party/angle/samples/gles2_book/Common/esUtil.c
deleted file mode 100644
index aeeee7ff8fa..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/Common/esUtil.c
+++ /dev/null
@@ -1,290 +0,0 @@
-//
-// Book: OpenGL(R) ES 2.0 Programming Guide
-// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
-// ISBN-10: 0321502795
-// ISBN-13: 9780321502797
-// Publisher: Addison-Wesley Professional
-// URLs: http://safari.informit.com/9780321563835
-// http://www.opengles-book.com
-//
-
-// ESUtil.c
-//
-// A utility library for OpenGL ES. This library provides a
-// basic common framework for the example applications in the
-// OpenGL ES 2.0 Programming Guide.
-//
-
-///
-// Includes
-//
-#include <stdio.h>
-#include <stdlib.h>
-#include <GLES2/gl2.h>
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include "esUtil.h"
-#include "esUtil_win.h"
-
-#if defined(_MSC_VER)
-#pragma warning(disable: 4204) // nonstandard extension used : non-constant aggregate initializer
-#endif
-
-///
-// Extensions
-//
-
-PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;
-PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR;
-
-PFNEGLPOSTSUBBUFFERNVPROC eglPostSubBufferNV;
-
-PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES;
-
-PFNGLDELETEFENCESNVPROC glDeleteFencesNV;
-PFNGLGENFENCESNVPROC glGenFencesNV;
-PFNGLGETFENCEIVNVPROC glGetFenceivNV;
-PFNGLISFENCENVPROC glIsFenceNV;
-PFNGLFINISHFENCENVPROC glFinishFenceNV;
-PFNGLSETFENCENVPROC glSetFenceNV;
-PFNGLTESTFENCENVPROC glTestFenceNV;
-
-///
-// CreateEGLContext()
-//
-// Creates an EGL rendering context and all associated elements
-//
-EGLBoolean CreateEGLContext ( EGLNativeWindowType hWnd, EGLDisplay* eglDisplay,
- EGLContext* eglContext, EGLSurface* eglSurface,
- EGLint* configAttribList, EGLint* surfaceAttribList)
-{
- EGLint numConfigs;
- EGLint majorVersion;
- EGLint minorVersion;
- EGLDisplay display;
- EGLContext context;
- EGLSurface surface;
- EGLConfig config;
- EGLint contextAttribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE, EGL_NONE };
-
- // Get Display
- display = eglGetDisplay(GetDC(hWnd));
- if ( display == EGL_NO_DISPLAY )
- {
- return EGL_FALSE;
- }
-
- // Initialize EGL
- if ( !eglInitialize(display, &majorVersion, &minorVersion) )
- {
- return EGL_FALSE;
- }
-
- // Bind to extensions
- eglCreateImageKHR = (PFNEGLCREATEIMAGEKHRPROC) eglGetProcAddress("eglCreateImageKHR");
- eglDestroyImageKHR = (PFNEGLDESTROYIMAGEKHRPROC) eglGetProcAddress("eglDestroyImageKHR");
-
- eglPostSubBufferNV = (PFNEGLPOSTSUBBUFFERNVPROC) eglGetProcAddress("eglPostSubBufferNV");
-
- glEGLImageTargetTexture2DOES = (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) eglGetProcAddress("glEGLImageTargetTexture2DOES");
-
- glDeleteFencesNV = (PFNGLDELETEFENCESNVPROC) eglGetProcAddress("glDeleteFencesNV");
- glGenFencesNV = (PFNGLGENFENCESNVPROC) eglGetProcAddress("glGenFencesNV");
- glGetFenceivNV = (PFNGLGETFENCEIVNVPROC) eglGetProcAddress("glGetFenceivNV");
- glIsFenceNV = (PFNGLISFENCENVPROC) eglGetProcAddress("glIsFenceNV");
- glFinishFenceNV = (PFNGLFINISHFENCENVPROC) eglGetProcAddress("glFinishFenceNV");
- glSetFenceNV = (PFNGLSETFENCENVPROC) eglGetProcAddress("glSetFenceNV");
- glTestFenceNV = (PFNGLTESTFENCENVPROC) eglGetProcAddress("glTestFenceNV");
-
- // Get configs
- if ( !eglGetConfigs(display, NULL, 0, &numConfigs) )
- {
- return EGL_FALSE;
- }
-
- // Choose config
- if ( !eglChooseConfig(display, configAttribList, &config, 1, &numConfigs) )
- {
- return EGL_FALSE;
- }
-
- // Create a surface
- surface = eglCreateWindowSurface(display, config, (EGLNativeWindowType)hWnd, surfaceAttribList);
- if ( surface == EGL_NO_SURFACE )
- {
- return EGL_FALSE;
- }
-
- // Create a GL context
- context = eglCreateContext(display, config, EGL_NO_CONTEXT, contextAttribs );
- if ( context == EGL_NO_CONTEXT )
- {
- return EGL_FALSE;
- }
-
- // Make the context current
- if ( !eglMakeCurrent(display, surface, surface, context) )
- {
- return EGL_FALSE;
- }
-
- *eglDisplay = display;
- *eglSurface = surface;
- *eglContext = context;
- return EGL_TRUE;
-}
-
-//////////////////////////////////////////////////////////////////
-//
-// Public Functions
-//
-//
-
-///
-// esInitContext()
-//
-// Initialize ES utility context. This must be called before calling any other
-// functions.
-//
-void ESUTIL_API esInitContext ( ESContext *esContext )
-{
- if ( esContext != NULL )
- {
- memset( esContext, 0, sizeof( ESContext) );
- }
-}
-
-///
-// esCreateWindow()
-//
-// title - name for title bar of window
-// width - width of window to create
-// height - height of window to create
-// flags - bitwise or of window creation flags
-// ES_WINDOW_ALPHA - specifies that the framebuffer should have alpha
-// ES_WINDOW_DEPTH - specifies that a depth buffer should be created
-// ES_WINDOW_STENCIL - specifies that a stencil buffer should be created
-// ES_WINDOW_MULTISAMPLE - specifies that a multi-sample buffer should be created
-// ES_WINDOW_POST_SUB_BUFFER_SUPPORTED - specifies that EGL_POST_SUB_BUFFER_NV is supported.
-//
-GLboolean ESUTIL_API esCreateWindow ( ESContext *esContext, LPCTSTR title, GLint width, GLint height, GLuint flags )
-{
- EGLint configAttribList[] =
- {
- EGL_RED_SIZE, 5,
- EGL_GREEN_SIZE, 6,
- EGL_BLUE_SIZE, 5,
- EGL_ALPHA_SIZE, (flags & ES_WINDOW_ALPHA) ? 8 : EGL_DONT_CARE,
- EGL_DEPTH_SIZE, (flags & ES_WINDOW_DEPTH) ? 8 : EGL_DONT_CARE,
- EGL_STENCIL_SIZE, (flags & ES_WINDOW_STENCIL) ? 8 : EGL_DONT_CARE,
- EGL_SAMPLE_BUFFERS, (flags & ES_WINDOW_MULTISAMPLE) ? 1 : 0,
- EGL_NONE
- };
- EGLint surfaceAttribList[] =
- {
- EGL_POST_SUB_BUFFER_SUPPORTED_NV, flags & (ES_WINDOW_POST_SUB_BUFFER_SUPPORTED) ? EGL_TRUE : EGL_FALSE,
- EGL_NONE, EGL_NONE
- };
-
- if ( esContext == NULL )
- {
- return GL_FALSE;
- }
-
- esContext->width = width;
- esContext->height = height;
-
- if ( !WinCreate ( esContext, title) )
- {
- return GL_FALSE;
- }
-
-
- if ( !CreateEGLContext ( esContext->hWnd,
- &esContext->eglDisplay,
- &esContext->eglContext,
- &esContext->eglSurface,
- configAttribList,
- surfaceAttribList ) )
- {
- return GL_FALSE;
- }
-
-
- return GL_TRUE;
-}
-
-///
-// esMainLoop()
-//
-// Start the main loop for the OpenGL ES application
-//
-void ESUTIL_API esMainLoop ( ESContext *esContext )
-{
- WinLoop ( esContext );
-}
-
-
-///
-// esRegisterDrawFunc()
-//
-void ESUTIL_API esRegisterDrawFunc ( ESContext *esContext, void (ESCALLBACK *drawFunc) (ESContext* ) )
-{
- esContext->drawFunc = drawFunc;
-}
-
-
-///
-// esRegisterUpdateFunc()
-//
-void ESUTIL_API esRegisterUpdateFunc ( ESContext *esContext, void (ESCALLBACK *updateFunc) ( ESContext*, float ) )
-{
- esContext->updateFunc = updateFunc;
-}
-
-
-///
-// esRegisterKeyFunc()
-//
-void ESUTIL_API esRegisterKeyFunc ( ESContext *esContext,
- void (ESCALLBACK *keyFunc) (ESContext*, unsigned char, int, int ) )
-{
- esContext->keyFunc = keyFunc;
-}
-
-
-///
-// esLogMessage()
-//
-// Log an error message to the debug output for the platform
-//
-void ESUTIL_API esLogMessage ( const char *formatStr, ... )
-{
- va_list params;
- char buf[BUFSIZ];
-
- va_start ( params, formatStr );
- vsprintf_s ( buf, sizeof(buf), formatStr, params );
-
- printf ( "%s", buf );
-
- va_end ( params );
-}
-
-
-///
-// esLoadTGA()
-//
-// Loads a 24-bit TGA image from a file
-//
-char* ESUTIL_API esLoadTGA ( char *fileName, int *width, int *height )
-{
- char *buffer;
-
- if ( WinTGALoad ( fileName, &buffer, width, height ) )
- {
- return buffer;
- }
-
- return NULL;
-}
diff --git a/chromium/third_party/angle/samples/gles2_book/Common/esUtil.h b/chromium/third_party/angle/samples/gles2_book/Common/esUtil.h
deleted file mode 100644
index 7b7595c0d5b..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/Common/esUtil.h
+++ /dev/null
@@ -1,297 +0,0 @@
-//
-// Book: OpenGL(R) ES 2.0 Programming Guide
-// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
-// ISBN-10: 0321502795
-// ISBN-13: 9780321502797
-// Publisher: Addison-Wesley Professional
-// URLs: http://safari.informit.com/9780321563835
-// http://www.opengles-book.com
-//
-
-//
-/// \file ESUtil.h
-/// \brief A utility library for OpenGL ES. This library provides a
-/// basic common framework for the example applications in the
-/// OpenGL ES 2.0 Programming Guide.
-//
-#ifndef ESUTIL_H
-#define ESUTIL_H
-
-///
-// Includes
-//
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-
-#ifdef __cplusplus
-
-extern "C" {
-#endif
-
-
-///
-// Macros
-//
-#define ESUTIL_API __cdecl
-#define ESCALLBACK __cdecl
-
-
-/// esCreateWindow flag - RGB color buffer
-#define ES_WINDOW_RGB 0
-/// esCreateWindow flag - ALPHA color buffer
-#define ES_WINDOW_ALPHA 1
-/// esCreateWindow flag - depth buffer
-#define ES_WINDOW_DEPTH 2
-/// esCreateWindow flag - stencil buffer
-#define ES_WINDOW_STENCIL 4
-/// esCreateWindow flag - multi-sample buffer
-#define ES_WINDOW_MULTISAMPLE 8
-/// esCreateWindow flag - EGL_POST_SUB_BUFFER_NV supported.
-#define ES_WINDOW_POST_SUB_BUFFER_SUPPORTED 16
-
-///
-// Types
-//
-
-typedef struct
-{
- GLfloat m[4][4];
-} ESMatrix;
-
-typedef struct
-{
- /// Put your user data here...
- void* userData;
-
- /// Window width
- GLint width;
-
- /// Window height
- GLint height;
-
- /// Window handle
- EGLNativeWindowType hWnd;
-
- /// EGL display
- EGLDisplay eglDisplay;
-
- /// EGL context
- EGLContext eglContext;
-
- /// EGL surface
- EGLSurface eglSurface;
-
- /// Callbacks
- void (ESCALLBACK *drawFunc) ( void* );
- void (ESCALLBACK *keyFunc) ( void*, unsigned char, int, int );
- void (ESCALLBACK *updateFunc) ( void*, float deltaTime );
-} ESContext;
-
-
-///
-// Extensions
-//
-
-extern PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;
-extern PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR;
-
-extern PFNEGLPOSTSUBBUFFERNVPROC eglPostSubBufferNV;
-
-extern PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES;
-
-extern PFNGLDELETEFENCESNVPROC glDeleteFencesNV;
-extern PFNGLGENFENCESNVPROC glGenFencesNV;
-extern PFNGLGETFENCEIVNVPROC glGetFenceivNV;
-extern PFNGLISFENCENVPROC glIsFenceNV;
-extern PFNGLFINISHFENCENVPROC glFinishFenceNV;
-extern PFNGLSETFENCENVPROC glSetFenceNV;
-extern PFNGLTESTFENCENVPROC glTestFenceNV;
-
-///
-// Public Functions
-//
-
-//
-///
-/// \brief Initialize ES framework context. This must be called before calling any other functions.
-/// \param esContext Application context
-//
-void ESUTIL_API esInitContext ( ESContext *esContext );
-
-//
-/// \brief Create a window with the specified parameters
-/// \param esContext Application context
-/// \param title Name for title bar of window
-/// \param width Width in pixels of window to create
-/// \param height Height in pixels of window to create
-/// \param flags Bitfield for the window creation flags
-/// ES_WINDOW_RGB - specifies that the color buffer should have R,G,B channels
-/// ES_WINDOW_ALPHA - specifies that the color buffer should have alpha
-/// ES_WINDOW_DEPTH - specifies that a depth buffer should be created
-/// ES_WINDOW_STENCIL - specifies that a stencil buffer should be created
-/// ES_WINDOW_MULTISAMPLE - specifies that a multi-sample buffer should be created
-/// ES_WINDOW_POST_SUB_BUFFER_SUPPORTED - specifies that EGL_POST_SUB_BUFFER_NV is supported.
-/// \return GL_TRUE if window creation is succesful, GL_FALSE otherwise
-GLboolean ESUTIL_API esCreateWindow ( ESContext *esContext, LPCTSTR title, GLint width, GLint height, GLuint flags );
-
-//
-/// \brief Start the main loop for the OpenGL ES application
-/// \param esContext Application context
-//
-void ESUTIL_API esMainLoop ( ESContext *esContext );
-
-//
-/// \brief Register a draw callback function to be used to render each frame
-/// \param esContext Application context
-/// \param drawFunc Draw callback function that will be used to render the scene
-//
-void ESUTIL_API esRegisterDrawFunc ( ESContext *esContext, void (ESCALLBACK *drawFunc) ( ESContext* ) );
-
-//
-/// \brief Register an update callback function to be used to update on each time step
-/// \param esContext Application context
-/// \param updateFunc Update callback function that will be used to render the scene
-//
-void ESUTIL_API esRegisterUpdateFunc ( ESContext *esContext, void (ESCALLBACK *updateFunc) ( ESContext*, float ) );
-
-//
-/// \brief Register an keyboard input processing callback function
-/// \param esContext Application context
-/// \param keyFunc Key callback function for application processing of keyboard input
-//
-void ESUTIL_API esRegisterKeyFunc ( ESContext *esContext,
- void (ESCALLBACK *drawFunc) ( ESContext*, unsigned char, int, int ) );
-//
-/// \brief Log a message to the debug output for the platform
-/// \param formatStr Format string for error log.
-//
-void ESUTIL_API esLogMessage ( const char *formatStr, ... );
-
-//
-///
-/// \brief Load a shader, check for compile errors, print error messages to output log
-/// \param type Type of shader (GL_VERTEX_SHADER or GL_FRAGMENT_SHADER)
-/// \param shaderSrc Shader source string
-/// \return A new shader object on success, 0 on failure
-//
-GLuint ESUTIL_API esLoadShader ( GLenum type, const char *shaderSrc );
-
-//
-///
-/// \brief Load a vertex and fragment shader, create a program object, link program.
-/// Errors output to log.
-/// \param vertShaderSrc Vertex shader source code
-/// \param fragShaderSrc Fragment shader source code
-/// \return A new program object linked with the vertex/fragment shader pair, 0 on failure
-//
-GLuint ESUTIL_API esLoadProgram ( const char *vertShaderSrc, const char *fragShaderSrc );
-
-
-//
-/// \brief Generates geometry for a sphere. Allocates memory for the vertex data and stores
-/// the results in the arrays. Generate index list for a TRIANGLE_STRIP
-/// \param numSlices The number of slices in the sphere
-/// \param vertices If not NULL, will contain array of float3 positions
-/// \param normals If not NULL, will contain array of float3 normals
-/// \param texCoords If not NULL, will contain array of float2 texCoords
-/// \param indices If not NULL, will contain the array of indices for the triangle strip
-/// \return The number of indices required for rendering the buffers (the number of indices stored in the indices array
-/// if it is not NULL ) as a GL_TRIANGLE_STRIP
-//
-int ESUTIL_API esGenSphere ( int numSlices, float radius, GLfloat **vertices, GLfloat **normals,
- GLfloat **texCoords, GLushort **indices );
-
-//
-/// \brief Generates geometry for a cube. Allocates memory for the vertex data and stores
-/// the results in the arrays. Generate index list for a TRIANGLES
-/// \param scale The size of the cube, use 1.0 for a unit cube.
-/// \param vertices If not NULL, will contain array of float3 positions
-/// \param normals If not NULL, will contain array of float3 normals
-/// \param texCoords If not NULL, will contain array of float2 texCoords
-/// \param indices If not NULL, will contain the array of indices for the triangle strip
-/// \return The number of indices required for rendering the buffers (the number of indices stored in the indices array
-/// if it is not NULL ) as a GL_TRIANGLES
-//
-int ESUTIL_API esGenCube ( float scale, GLfloat **vertices, GLfloat **normals,
- GLfloat **texCoords, GLushort **indices );
-
-//
-/// \brief Loads a 24-bit TGA image from a file
-/// \param fileName Name of the file on disk
-/// \param width Width of loaded image in pixels
-/// \param height Height of loaded image in pixels
-/// \return Pointer to loaded image. NULL on failure.
-//
-char* ESUTIL_API esLoadTGA ( char *fileName, int *width, int *height );
-
-
-//
-/// \brief multiply matrix specified by result with a scaling matrix and return new matrix in result
-/// \param result Specifies the input matrix. Scaled matrix is returned in result.
-/// \param sx, sy, sz Scale factors along the x, y and z axes respectively
-//
-void ESUTIL_API esScale(ESMatrix *result, GLfloat sx, GLfloat sy, GLfloat sz);
-
-//
-/// \brief multiply matrix specified by result with a translation matrix and return new matrix in result
-/// \param result Specifies the input matrix. Translated matrix is returned in result.
-/// \param tx, ty, tz Scale factors along the x, y and z axes respectively
-//
-void ESUTIL_API esTranslate(ESMatrix *result, GLfloat tx, GLfloat ty, GLfloat tz);
-
-//
-/// \brief multiply matrix specified by result with a rotation matrix and return new matrix in result
-/// \param result Specifies the input matrix. Rotated matrix is returned in result.
-/// \param angle Specifies the angle of rotation, in degrees.
-/// \param x, y, z Specify the x, y and z coordinates of a vector, respectively
-//
-void ESUTIL_API esRotate(ESMatrix *result, GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
-
-//
-// \brief multiply matrix specified by result with a perspective matrix and return new matrix in result
-/// \param result Specifies the input matrix. new matrix is returned in result.
-/// \param left, right Coordinates for the left and right vertical clipping planes
-/// \param bottom, top Coordinates for the bottom and top horizontal clipping planes
-/// \param nearZ, farZ Distances to the near and far depth clipping planes. Both distances must be positive.
-//
-void ESUTIL_API esFrustum(ESMatrix *result, float left, float right, float bottom, float top, float nearZ, float farZ);
-
-//
-/// \brief multiply matrix specified by result with a perspective matrix and return new matrix in result
-/// \param result Specifies the input matrix. new matrix is returned in result.
-/// \param fovy Field of view y angle in degrees
-/// \param aspect Aspect ratio of screen
-/// \param nearZ Near plane distance
-/// \param farZ Far plane distance
-//
-void ESUTIL_API esPerspective(ESMatrix *result, float fovy, float aspect, float nearZ, float farZ);
-
-//
-/// \brief multiply matrix specified by result with a perspective matrix and return new matrix in result
-/// \param result Specifies the input matrix. new matrix is returned in result.
-/// \param left, right Coordinates for the left and right vertical clipping planes
-/// \param bottom, top Coordinates for the bottom and top horizontal clipping planes
-/// \param nearZ, farZ Distances to the near and far depth clipping planes. These values are negative if plane is behind the viewer
-//
-void ESUTIL_API esOrtho(ESMatrix *result, float left, float right, float bottom, float top, float nearZ, float farZ);
-
-//
-/// \brief perform the following operation - result matrix = srcA matrix * srcB matrix
-/// \param result Returns multiplied matrix
-/// \param srcA, srcB Input matrices to be multiplied
-//
-void ESUTIL_API esMatrixMultiply(ESMatrix *result, ESMatrix *srcA, ESMatrix *srcB);
-
-//
-//// \brief return an indentity matrix
-//// \param result returns identity matrix
-//
-void ESUTIL_API esMatrixLoadIdentity(ESMatrix *result);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // ESUTIL_H
diff --git a/chromium/third_party/angle/samples/gles2_book/Common/esUtil.vcxproj b/chromium/third_party/angle/samples/gles2_book/Common/esUtil.vcxproj
deleted file mode 100644
index 9f058049f77..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/Common/esUtil.vcxproj
+++ /dev/null
@@ -1,103 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{47C93F52-AB4E-4FF9-8D4F-B38CD60A183F}</ProjectGuid>
- <RootNamespace>esUtil</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>NotSet</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>NotSet</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>./;../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>./;../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="Win32\esUtil_TGA.c" />
- <ClCompile Include="Win32\esUtil_win32.c" />
- <ClCompile Include="esShader.c" />
- <ClCompile Include="esShapes.c" />
- <ClCompile Include="esTransform.c" />
- <ClCompile Include="esUtil.c" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="esUtil_win.h" />
- <ClInclude Include="esUtil.h" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\src\libEGL\libEGL.vcxproj">
- <Project>{e746fca9-64c3-433e-85e8-9a5a67ab7ed6}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- <Private>true</Private>
- <CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
- <LinkLibraryDependencies>true</LinkLibraryDependencies>
- <UseLibraryDependencyInputs>true</UseLibraryDependencyInputs>
- </ProjectReference>
- <ProjectReference Include="..\..\..\src\libGLESv2\libGLESv2.vcxproj">
- <Project>{b5871a7a-968c-42e3-a33b-981e6f448e78}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- <Private>true</Private>
- <CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
- <LinkLibraryDependencies>true</LinkLibraryDependencies>
- <UseLibraryDependencyInputs>true</UseLibraryDependencyInputs>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/chromium/third_party/angle/samples/gles2_book/Common/esUtil.vcxproj.filters b/chromium/third_party/angle/samples/gles2_book/Common/esUtil.vcxproj.filters
deleted file mode 100644
index 0b81a0a6618..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/Common/esUtil.vcxproj.filters
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Win32">
- <UniqueIdentifier>{8b3de51d-fe0c-4a62-aa51-feb196406ff8}</UniqueIdentifier>
- </Filter>
- <Filter Include="Common">
- <UniqueIdentifier>{cdf112d8-e32a-47f8-8095-2b433bc4fc0f}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="Win32\esUtil_TGA.c">
- <Filter>Win32</Filter>
- </ClCompile>
- <ClCompile Include="Win32\esUtil_win32.c">
- <Filter>Win32</Filter>
- </ClCompile>
- <ClCompile Include="esShader.c">
- <Filter>Common</Filter>
- </ClCompile>
- <ClCompile Include="esShapes.c">
- <Filter>Common</Filter>
- </ClCompile>
- <ClCompile Include="esTransform.c">
- <Filter>Common</Filter>
- </ClCompile>
- <ClCompile Include="esUtil.c">
- <Filter>Common</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="esUtil_win.h">
- <Filter>Win32</Filter>
- </ClInclude>
- <ClInclude Include="esUtil.h">
- <Filter>Common</Filter>
- </ClInclude>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/chromium/third_party/angle/samples/gles2_book/Common/esUtil_win.h b/chromium/third_party/angle/samples/gles2_book/Common/esUtil_win.h
deleted file mode 100644
index 8ba340693fa..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/Common/esUtil_win.h
+++ /dev/null
@@ -1,65 +0,0 @@
-//
-// Book: OpenGL(R) ES 2.0 Programming Guide
-// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
-// ISBN-10: 0321502795
-// ISBN-13: 9780321502797
-// Publisher: Addison-Wesley Professional
-// URLs: http://safari.informit.com/9780321563835
-// http://www.opengles-book.com
-//
-
-// esUtil_win.h
-//
-// API-neutral interface for creating windows. Implementation needs to be provided per-platform.
-
-#ifndef ESUTIL_WIN_H
-#define ESUTIL_WIN_H
-
-///
-// Includes
-//
-
-#ifdef __cplusplus
-
-extern "C" {
-#endif
-
-
-///
-// Macros
-//
-
-///
-// Types
-//
-
-///
-// Public Functions
-//
-
-///
-// WinCreate()
-//
-// Create Win32 instance and window
-//
-GLboolean WinCreate ( ESContext *esContext, LPCTSTR title );
-
-///
-// WinLoop()
-//
-// Start main windows loop
-//
-void WinLoop ( ESContext *esContext );
-
-///
-// WinTGALoad()
-//
-// TGA loader win32 implementation
-//
-int WinTGALoad ( const char *fileName, char **buffer, int *width, int *height );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // ESUTIL_WIN_H
diff --git a/chromium/third_party/angle/samples/gles2_book/Hello_Triangle/Hello_Triangle.c b/chromium/third_party/angle/samples/gles2_book/Hello_Triangle/Hello_Triangle.c
deleted file mode 100644
index b0e3a4c81cf..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/Hello_Triangle/Hello_Triangle.c
+++ /dev/null
@@ -1,194 +0,0 @@
-//
-// Book: OpenGL(R) ES 2.0 Programming Guide
-// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
-// ISBN-10: 0321502795
-// ISBN-13: 9780321502797
-// Publisher: Addison-Wesley Professional
-// URLs: http://safari.informit.com/9780321563835
-// http://www.opengles-book.com
-//
-
-// Hello_Triangle.c
-//
-// This is a simple example that draws a single triangle with
-// a minimal vertex/fragment shader. The purpose of this
-// example is to demonstrate the basic concepts of
-// OpenGL ES 2.0 rendering.
-#include <stdlib.h>
-#include "esUtil.h"
-
-typedef struct
-{
- // Handle to a program object
- GLuint programObject;
-
-} UserData;
-
-///
-// Create a shader object, load the shader source, and
-// compile the shader.
-//
-GLuint LoadShader ( GLenum type, const char *shaderSrc )
-{
- GLuint shader;
- GLint compiled;
-
- // Create the shader object
- shader = glCreateShader ( type );
-
- if ( shader == 0 )
- return 0;
-
- // Load the shader source
- glShaderSource ( shader, 1, &shaderSrc, NULL );
-
- // Compile the shader
- glCompileShader ( shader );
-
- // Check the compile status
- glGetShaderiv ( shader, GL_COMPILE_STATUS, &compiled );
-
- if ( !compiled )
- {
- GLint infoLen = 0;
-
- glGetShaderiv ( shader, GL_INFO_LOG_LENGTH, &infoLen );
-
- if ( infoLen > 1 )
- {
- char* infoLog = malloc (sizeof(char) * infoLen );
-
- glGetShaderInfoLog ( shader, infoLen, NULL, infoLog );
- esLogMessage ( "Error compiling shader:\n%s\n", infoLog );
-
- free ( infoLog );
- }
-
- glDeleteShader ( shader );
- return 0;
- }
-
- return shader;
-
-}
-
-///
-// Initialize the shader and program object
-//
-int Init ( ESContext *esContext )
-{
- UserData *userData = esContext->userData;
- GLbyte vShaderStr[] =
- "attribute vec4 vPosition; \n"
- "void main() \n"
- "{ \n"
- " gl_Position = vPosition; \n"
- "} \n";
-
- GLbyte fShaderStr[] =
- "precision mediump float;\n"\
- "void main() \n"
- "{ \n"
- " gl_FragColor = vec4 ( 1.0, 0.0, 0.0, 1.0 );\n"
- "} \n";
-
- GLuint vertexShader;
- GLuint fragmentShader;
- GLuint programObject;
- GLint linked;
-
- // Load the vertex/fragment shaders
- vertexShader = LoadShader ( GL_VERTEX_SHADER, vShaderStr );
- fragmentShader = LoadShader ( GL_FRAGMENT_SHADER, fShaderStr );
-
- // Create the program object
- programObject = glCreateProgram ( );
-
- if ( programObject == 0 )
- return 0;
-
- glAttachShader ( programObject, vertexShader );
- glAttachShader ( programObject, fragmentShader );
-
- // Bind vPosition to attribute 0
- glBindAttribLocation ( programObject, 0, "vPosition" );
-
- // Link the program
- glLinkProgram ( programObject );
-
- // Check the link status
- glGetProgramiv ( programObject, GL_LINK_STATUS, &linked );
-
- if ( !linked )
- {
- GLint infoLen = 0;
-
- glGetProgramiv ( programObject, GL_INFO_LOG_LENGTH, &infoLen );
-
- if ( infoLen > 1 )
- {
- char* infoLog = malloc (sizeof(char) * infoLen );
-
- glGetProgramInfoLog ( programObject, infoLen, NULL, infoLog );
- esLogMessage ( "Error linking program:\n%s\n", infoLog );
-
- free ( infoLog );
- }
-
- glDeleteProgram ( programObject );
- return FALSE;
- }
-
- // Store the program object
- userData->programObject = programObject;
-
- glClearColor ( 0.0f, 0.0f, 0.0f, 0.0f );
- return TRUE;
-}
-
-///
-// Draw a triangle using the shader pair created in Init()
-//
-void Draw ( ESContext *esContext )
-{
- UserData *userData = esContext->userData;
- GLfloat vVertices[] = { 0.0f, 0.5f, 0.0f,
- -0.5f, -0.5f, 0.0f,
- 0.5f, -0.5f, 0.0f };
-
- // Set the viewport
- glViewport ( 0, 0, esContext->width, esContext->height );
-
- // Clear the color buffer
- glClear ( GL_COLOR_BUFFER_BIT );
-
- // Use the program object
- glUseProgram ( userData->programObject );
-
- // Load the vertex data
- glVertexAttribPointer ( 0, 3, GL_FLOAT, GL_FALSE, 0, vVertices );
- glEnableVertexAttribArray ( 0 );
-
- glDrawArrays ( GL_TRIANGLES, 0, 3 );
-
- eglSwapBuffers ( esContext->eglDisplay, esContext->eglSurface );
-}
-
-
-int main ( int argc, char *argv[] )
-{
- ESContext esContext;
- UserData userData;
-
- esInitContext ( &esContext );
- esContext.userData = &userData;
-
- esCreateWindow ( &esContext, TEXT("Hello Triangle"), 320, 240, ES_WINDOW_RGB );
-
- if ( !Init ( &esContext ) )
- return 0;
-
- esRegisterDrawFunc ( &esContext, Draw );
-
- esMainLoop ( &esContext );
-}
diff --git a/chromium/third_party/angle/samples/gles2_book/Hello_Triangle/Hello_Triangle.vcxproj b/chromium/third_party/angle/samples/gles2_book/Hello_Triangle/Hello_Triangle.vcxproj
deleted file mode 100644
index 9de57152c9a..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/Hello_Triangle/Hello_Triangle.vcxproj
+++ /dev/null
@@ -1,105 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{8278251F-6C1F-4D80-8499-FA7B590FAFE6}</ProjectGuid>
- <RootNamespace>Hello_Triangle</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>NotSet</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>NotSet</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
- <EmbedManifest Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</EmbedManifest>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>../Common;../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>../Common;../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="Hello_Triangle.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\Common\esUtil.vcxproj">
- <Project>{47c93f52-ab4e-4ff9-8d4f-b38cd60a183f}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/chromium/third_party/angle/samples/gles2_book/MipMap2D/MipMap2D.c b/chromium/third_party/angle/samples/gles2_book/MipMap2D/MipMap2D.c
deleted file mode 100644
index bc70cd4c08c..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/MipMap2D/MipMap2D.c
+++ /dev/null
@@ -1,346 +0,0 @@
-//
-// Book: OpenGL(R) ES 2.0 Programming Guide
-// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
-// ISBN-10: 0321502795
-// ISBN-13: 9780321502797
-// Publisher: Addison-Wesley Professional
-// URLs: http://safari.informit.com/9780321563835
-// http://www.opengles-book.com
-//
-
-// MipMap2D.c
-//
-// This is a simple example that demonstrates generating a mipmap chain
-// and rendering with it
-//
-#include <stdlib.h>
-#include "esUtil.h"
-
-typedef struct
-{
- // Handle to a program object
- GLuint programObject;
-
- // Attribute locations
- GLint positionLoc;
- GLint texCoordLoc;
-
- // Sampler location
- GLint samplerLoc;
-
- // Offset location
- GLint offsetLoc;
-
- // Texture handle
- GLuint textureId;
-
-} UserData;
-
-
-///
-// From an RGB8 source image, generate the next level mipmap
-//
-GLboolean GenMipMap2D( GLubyte *src, GLubyte **dst, int srcWidth, int srcHeight, int *dstWidth, int *dstHeight )
-{
- int x,
- y;
- int texelSize = 3;
-
- *dstWidth = srcWidth / 2;
- if ( *dstWidth <= 0 )
- *dstWidth = 1;
-
- *dstHeight = srcHeight / 2;
- if ( *dstHeight <= 0 )
- *dstHeight = 1;
-
- *dst = malloc ( sizeof(GLubyte) * texelSize * (*dstWidth) * (*dstHeight) );
- if ( *dst == NULL )
- return GL_FALSE;
-
- for ( y = 0; y < *dstHeight; y++ )
- {
- for( x = 0; x < *dstWidth; x++ )
- {
- int srcIndex[4];
- float r = 0.0f,
- g = 0.0f,
- b = 0.0f;
- int sample;
-
- // Compute the offsets for 2x2 grid of pixels in previous
- // image to perform box filter
- srcIndex[0] =
- (((y * 2) * srcWidth) + (x * 2)) * texelSize;
- srcIndex[1] =
- (((y * 2) * srcWidth) + (x * 2 + 1)) * texelSize;
- srcIndex[2] =
- ((((y * 2) + 1) * srcWidth) + (x * 2)) * texelSize;
- srcIndex[3] =
- ((((y * 2) + 1) * srcWidth) + (x * 2 + 1)) * texelSize;
-
- // Sum all pixels
- for ( sample = 0; sample < 4; sample++ )
- {
- r += src[srcIndex[sample]];
- g += src[srcIndex[sample] + 1];
- b += src[srcIndex[sample] + 2];
- }
-
- // Average results
- r /= 4.0;
- g /= 4.0;
- b /= 4.0;
-
- // Store resulting pixels
- (*dst)[ ( y * (*dstWidth) + x ) * texelSize ] = (GLubyte)( r );
- (*dst)[ ( y * (*dstWidth) + x ) * texelSize + 1] = (GLubyte)( g );
- (*dst)[ ( y * (*dstWidth) + x ) * texelSize + 2] = (GLubyte)( b );
- }
- }
-
- return GL_TRUE;
-}
-
-///
-// Generate an RGB8 checkerboard image
-//
-GLubyte* GenCheckImage( int width, int height, int checkSize )
-{
- int x,
- y;
- GLubyte *pixels = malloc( width * height * 3 );
-
- if ( pixels == NULL )
- return NULL;
-
- for ( y = 0; y < height; y++ )
- for ( x = 0; x < width; x++ )
- {
- GLubyte rColor = 0;
- GLubyte bColor = 0;
-
- if ( ( x / checkSize ) % 2 == 0 )
- {
- rColor = 255 * ( ( y / checkSize ) % 2 );
- bColor = 255 * ( 1 - ( ( y / checkSize ) % 2 ) );
- }
- else
- {
- bColor = 255 * ( ( y / checkSize ) % 2 );
- rColor = 255 * ( 1 - ( ( y / checkSize ) % 2 ) );
- }
-
- pixels[(y * height + x) * 3] = rColor;
- pixels[(y * height + x) * 3 + 1] = 0;
- pixels[(y * height + x) * 3 + 2] = bColor;
- }
-
- return pixels;
-}
-
-///
-// Create a mipmapped 2D texture image
-//
-GLuint CreateMipMappedTexture2D( )
-{
- // Texture object handle
- GLuint textureId;
- int width = 256,
- height = 256;
- int level;
- GLubyte *pixels;
- GLubyte *prevImage;
- GLubyte *newImage = NULL;
-
- pixels = GenCheckImage( width, height, 8 );
- if ( pixels == NULL )
- return 0;
-
- // Generate a texture object
- glGenTextures ( 1, &textureId );
-
- // Bind the texture object
- glBindTexture ( GL_TEXTURE_2D, textureId );
-
- // Load mipmap level 0
- glTexImage2D ( GL_TEXTURE_2D, 0, GL_RGB, width, height,
- 0, GL_RGB, GL_UNSIGNED_BYTE, pixels );
-
- level = 1;
- prevImage = &pixels[0];
-
- while ( width > 1 && height > 1 )
- {
- int newWidth,
- newHeight;
-
- // Generate the next mipmap level
- GenMipMap2D( prevImage, &newImage, width, height,
- &newWidth, &newHeight );
-
- // Load the mipmap level
- glTexImage2D( GL_TEXTURE_2D, level, GL_RGB,
- newWidth, newHeight, 0, GL_RGB,
- GL_UNSIGNED_BYTE, newImage );
-
- // Free the previous image
- free ( prevImage );
-
- // Set the previous image for the next iteration
- prevImage = newImage;
- level++;
-
- // Half the width and height
- width = newWidth;
- height = newHeight;
- }
-
- free ( newImage );
-
- // Set the filtering mode
- glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST );
- glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
-
- return textureId;
-
-}
-
-
-///
-// Initialize the shader and program object
-//
-int Init ( ESContext *esContext )
-{
- UserData *userData = esContext->userData;
- GLbyte vShaderStr[] =
- "uniform float u_offset; \n"
- "attribute vec4 a_position; \n"
- "attribute vec2 a_texCoord; \n"
- "varying vec2 v_texCoord; \n"
- "void main() \n"
- "{ \n"
- " gl_Position = a_position; \n"
- " gl_Position.x += u_offset;\n"
- " v_texCoord = a_texCoord; \n"
- "} \n";
-
- GLbyte fShaderStr[] =
- "precision mediump float; \n"
- "varying vec2 v_texCoord; \n"
- "uniform sampler2D s_texture; \n"
- "void main() \n"
- "{ \n"
- " gl_FragColor = texture2D( s_texture, v_texCoord );\n"
- "} \n";
-
- // Load the shaders and get a linked program object
- userData->programObject = esLoadProgram ( vShaderStr, fShaderStr );
-
- // Get the attribute locations
- userData->positionLoc = glGetAttribLocation ( userData->programObject, "a_position" );
- userData->texCoordLoc = glGetAttribLocation ( userData->programObject, "a_texCoord" );
-
- // Get the sampler location
- userData->samplerLoc = glGetUniformLocation ( userData->programObject, "s_texture" );
-
- // Get the offset location
- userData->offsetLoc = glGetUniformLocation( userData->programObject, "u_offset" );
-
- // Load the texture
- userData->textureId = CreateMipMappedTexture2D ();
-
- glClearColor ( 0.0f, 0.0f, 0.0f, 0.0f );
- return TRUE;
-}
-
-///
-// Draw a triangle using the shader pair created in Init()
-//
-void Draw ( ESContext *esContext )
-{
- UserData *userData = esContext->userData;
- GLfloat vVertices[] = { -0.5f, 0.5f, 0.0f, 1.5f, // Position 0
- 0.0f, 0.0f, // TexCoord 0
- -0.5f, -0.5f, 0.0f, 0.75f, // Position 1
- 0.0f, 1.0f, // TexCoord 1
- 0.5f, -0.5f, 0.0f, 0.75f, // Position 2
- 1.0f, 1.0f, // TexCoord 2
- 0.5f, 0.5f, 0.0f, 1.5f, // Position 3
- 1.0f, 0.0f // TexCoord 3
- };
- GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
-
- // Set the viewport
- glViewport ( 0, 0, esContext->width, esContext->height );
-
- // Clear the color buffer
- glClear ( GL_COLOR_BUFFER_BIT );
-
- // Use the program object
- glUseProgram ( userData->programObject );
-
- // Load the vertex position
- glVertexAttribPointer ( userData->positionLoc, 4, GL_FLOAT,
- GL_FALSE, 6 * sizeof(GLfloat), vVertices );
- // Load the texture coordinate
- glVertexAttribPointer ( userData->texCoordLoc, 2, GL_FLOAT,
- GL_FALSE, 6 * sizeof(GLfloat), &vVertices[4] );
-
- glEnableVertexAttribArray ( userData->positionLoc );
- glEnableVertexAttribArray ( userData->texCoordLoc );
-
- // Bind the texture
- glActiveTexture ( GL_TEXTURE0 );
- glBindTexture ( GL_TEXTURE_2D, userData->textureId );
-
- // Set the sampler texture unit to 0
- glUniform1i ( userData->samplerLoc, 0 );
-
- // Draw quad with nearest sampling
- glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
- glUniform1f ( userData->offsetLoc, -0.6f );
- glDrawElements ( GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices );
-
- // Draw quad with trilinear filtering
- glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
- glUniform1f ( userData->offsetLoc, 0.6f );
- glDrawElements ( GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices );
-
- eglSwapBuffers ( esContext->eglDisplay, esContext->eglSurface );
-}
-
-///
-// Cleanup
-//
-void ShutDown ( ESContext *esContext )
-{
- UserData *userData = esContext->userData;
-
- // Delete texture object
- glDeleteTextures ( 1, &userData->textureId );
-
- // Delete program object
- glDeleteProgram ( userData->programObject );
-}
-
-
-int main ( int argc, char *argv[] )
-{
- ESContext esContext;
- UserData userData;
-
- esInitContext ( &esContext );
- esContext.userData = &userData;
-
- esCreateWindow ( &esContext, TEXT("MipMap 2D"), 320, 240, ES_WINDOW_RGB );
-
- if ( !Init ( &esContext ) )
- return 0;
-
- esRegisterDrawFunc ( &esContext, Draw );
-
- esMainLoop ( &esContext );
-
- ShutDown ( &esContext );
-}
diff --git a/chromium/third_party/angle/samples/gles2_book/MipMap2D/MipMap2D.vcxproj b/chromium/third_party/angle/samples/gles2_book/MipMap2D/MipMap2D.vcxproj
deleted file mode 100644
index da116d40e17..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/MipMap2D/MipMap2D.vcxproj
+++ /dev/null
@@ -1,105 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{4E69AC1F-1C7A-4D58-917C-E764FBEB489A}</ProjectGuid>
- <RootNamespace>MipMap2D</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>NotSet</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>NotSet</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
- <EmbedManifest Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</EmbedManifest>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>../Common;../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>../Common;../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="MipMap2D.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\Common\esUtil.vcxproj">
- <Project>{47c93f52-ab4e-4ff9-8d4f-b38cd60a183f}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/chromium/third_party/angle/samples/gles2_book/MultiTexture/MultiTexture.c b/chromium/third_party/angle/samples/gles2_book/MultiTexture/MultiTexture.c
deleted file mode 100644
index bb2224a34cd..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/MultiTexture/MultiTexture.c
+++ /dev/null
@@ -1,213 +0,0 @@
-//
-// Book: OpenGL(R) ES 2.0 Programming Guide
-// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
-// ISBN-10: 0321502795
-// ISBN-13: 9780321502797
-// Publisher: Addison-Wesley Professional
-// URLs: http://safari.informit.com/9780321563835
-// http://www.opengles-book.com
-//
-
-// MultiTexture.c
-//
-// This is an example that draws a quad with a basemap and
-// lightmap to demonstrate multitexturing.
-//
-#include <stdlib.h>
-#include "esUtil.h"
-
-typedef struct
-{
- // Handle to a program object
- GLuint programObject;
-
- // Attribute locations
- GLint positionLoc;
- GLint texCoordLoc;
-
- // Sampler locations
- GLint baseMapLoc;
- GLint lightMapLoc;
-
- // Texture handle
- GLuint baseMapTexId;
- GLuint lightMapTexId;
-
-} UserData;
-
-
-///
-// Load texture from disk
-//
-GLuint LoadTexture ( char *fileName )
-{
- int width,
- height;
- char *buffer = esLoadTGA ( fileName, &width, &height );
- GLuint texId;
-
- if ( buffer == NULL )
- {
- esLogMessage ( "Error loading (%s) image.\n", fileName );
- return 0;
- }
-
- glGenTextures ( 1, &texId );
- glBindTexture ( GL_TEXTURE_2D, texId );
-
- glTexImage2D ( GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, buffer );
- glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
- glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
- glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
- glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
-
- free ( buffer );
-
- return texId;
-}
-
-
-
-///
-// Initialize the shader and program object
-//
-int Init ( ESContext *esContext )
-{
- UserData *userData = esContext->userData;
- GLbyte vShaderStr[] =
- "attribute vec4 a_position; \n"
- "attribute vec2 a_texCoord; \n"
- "varying vec2 v_texCoord; \n"
- "void main() \n"
- "{ \n"
- " gl_Position = a_position; \n"
- " v_texCoord = a_texCoord; \n"
- "} \n";
-
- GLbyte fShaderStr[] =
- "precision mediump float; \n"
- "varying vec2 v_texCoord; \n"
- "uniform sampler2D s_baseMap; \n"
- "uniform sampler2D s_lightMap; \n"
- "void main() \n"
- "{ \n"
- " vec4 baseColor; \n"
- " vec4 lightColor; \n"
- " \n"
- " baseColor = texture2D( s_baseMap, v_texCoord ); \n"
- " lightColor = texture2D( s_lightMap, v_texCoord ); \n"
- " gl_FragColor = baseColor * (lightColor + 0.25); \n"
- "} \n";
-
- // Load the shaders and get a linked program object
- userData->programObject = esLoadProgram ( vShaderStr, fShaderStr );
-
- // Get the attribute locations
- userData->positionLoc = glGetAttribLocation ( userData->programObject, "a_position" );
- userData->texCoordLoc = glGetAttribLocation ( userData->programObject, "a_texCoord" );
-
- // Get the sampler location
- userData->baseMapLoc = glGetUniformLocation ( userData->programObject, "s_baseMap" );
- userData->lightMapLoc = glGetUniformLocation ( userData->programObject, "s_lightMap" );
-
- // Load the textures
- userData->baseMapTexId = LoadTexture ( "basemap.tga" );
- userData->lightMapTexId = LoadTexture ( "lightmap.tga" );
-
- if ( userData->baseMapTexId == 0 || userData->lightMapTexId == 0 )
- return FALSE;
-
- glClearColor ( 0.0f, 0.0f, 0.0f, 0.0f );
- return TRUE;
-}
-
-///
-// Draw a triangle using the shader pair created in Init()
-//
-void Draw ( ESContext *esContext )
-{
- UserData *userData = esContext->userData;
- GLfloat vVertices[] = { -0.5f, 0.5f, 0.0f, // Position 0
- 0.0f, 0.0f, // TexCoord 0
- -0.5f, -0.5f, 0.0f, // Position 1
- 0.0f, 1.0f, // TexCoord 1
- 0.5f, -0.5f, 0.0f, // Position 2
- 1.0f, 1.0f, // TexCoord 2
- 0.5f, 0.5f, 0.0f, // Position 3
- 1.0f, 0.0f // TexCoord 3
- };
- GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
-
- // Set the viewport
- glViewport ( 0, 0, esContext->width, esContext->height );
-
- // Clear the color buffer
- glClear ( GL_COLOR_BUFFER_BIT );
-
- // Use the program object
- glUseProgram ( userData->programObject );
-
- // Load the vertex position
- glVertexAttribPointer ( userData->positionLoc, 3, GL_FLOAT,
- GL_FALSE, 5 * sizeof(GLfloat), vVertices );
- // Load the texture coordinate
- glVertexAttribPointer ( userData->texCoordLoc, 2, GL_FLOAT,
- GL_FALSE, 5 * sizeof(GLfloat), &vVertices[3] );
-
- glEnableVertexAttribArray ( userData->positionLoc );
- glEnableVertexAttribArray ( userData->texCoordLoc );
-
- // Bind the base map
- glActiveTexture ( GL_TEXTURE0 );
- glBindTexture ( GL_TEXTURE_2D, userData->baseMapTexId );
-
- // Set the base map sampler to texture unit to 0
- glUniform1i ( userData->baseMapLoc, 0 );
-
- // Bind the light map
- glActiveTexture ( GL_TEXTURE1 );
- glBindTexture ( GL_TEXTURE_2D, userData->lightMapTexId );
-
- // Set the light map sampler to texture unit 1
- glUniform1i ( userData->lightMapLoc, 1 );
-
- glDrawElements ( GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices );
-
- eglSwapBuffers ( esContext->eglDisplay, esContext->eglSurface );
-}
-
-///
-// Cleanup
-//
-void ShutDown ( ESContext *esContext )
-{
- UserData *userData = esContext->userData;
-
- // Delete texture object
- glDeleteTextures ( 1, &userData->baseMapTexId );
- glDeleteTextures ( 1, &userData->lightMapTexId );
-
- // Delete program object
- glDeleteProgram ( userData->programObject );
-}
-
-
-int main ( int argc, char *argv[] )
-{
- ESContext esContext;
- UserData userData;
-
- esInitContext ( &esContext );
- esContext.userData = &userData;
-
- esCreateWindow ( &esContext, TEXT("MultiTexture"), 320, 240, ES_WINDOW_RGB );
-
- if ( !Init ( &esContext ) )
- return 0;
-
- esRegisterDrawFunc ( &esContext, Draw );
-
- esMainLoop ( &esContext );
-
- ShutDown ( &esContext );
-}
diff --git a/chromium/third_party/angle/samples/gles2_book/MultiTexture/MultiTexture.vcxproj b/chromium/third_party/angle/samples/gles2_book/MultiTexture/MultiTexture.vcxproj
deleted file mode 100644
index 0edf52217c3..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/MultiTexture/MultiTexture.vcxproj
+++ /dev/null
@@ -1,115 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{120CFF94-ED4B-4C5B-9587-9E40889F15F7}</ProjectGuid>
- <RootNamespace>MultiTexture</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>NotSet</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>NotSet</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
- <EmbedManifest Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</EmbedManifest>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>../Common;../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- <PostBuildEvent>
- <Command>xcopy /D /Y basemap.tga "$(OutDir)"
-xcopy /D /Y lightmap.tga "$(OutDir)"
-</Command>
- </PostBuildEvent>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>../Common;../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- <PostBuildEvent>
- <Command>xcopy /D /Y basemap.tga "$(OutDir)"
-xcopy /D /Y lightmap.tga "$(OutDir)"
-</Command>
- </PostBuildEvent>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="MultiTexture.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\Common\esUtil.vcxproj">
- <Project>{47c93f52-ab4e-4ff9-8d4f-b38cd60a183f}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/chromium/third_party/angle/samples/gles2_book/MultipleRenderTargets/MultipleRenderTargets.c b/chromium/third_party/angle/samples/gles2_book/MultipleRenderTargets/MultipleRenderTargets.c
deleted file mode 100644
index 0e06c29fc72..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/MultipleRenderTargets/MultipleRenderTargets.c
+++ /dev/null
@@ -1,295 +0,0 @@
-//
-// Modified from Simple_Texture2D, found in:
-//
-// Book: OpenGL(R) ES 2.0 Programming Guide
-// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
-// ISBN-10: 0321502795
-// ISBN-13: 9780321502797
-// Publisher: Addison-Wesley Professional
-// URLs: http://safari.informit.com/9780321563835
-// http://www.opengles-book.com
-//
-
-// MultipleRenderTargets.c
-//
-// This is a simple example that shows how to use multiple render
-// targets in GLES 2.0 using EXT_draw_buffers. The example
-// draws to three render targets and displays
-// them together in a final pass.
-//
-#include <stdlib.h>
-#include "esUtil.h"
-
-PFNGLDRAWBUFFERSEXTPROC glDrawBuffersEXT;
-
-typedef struct
-{
- // Handle to a program object
- GLuint programObjectMRT;
- GLuint programObject;
-
- // Attribute locations
- GLint positionLoc;
- GLint texCoordLoc;
-
- // Sampler location
- GLint samplerLoc;
-
- // Texture handle
- GLuint textureId;
-
- // Framebuffer object handle
- GLuint framebuffer;
-
- // Framebuffer color attachments
- GLuint framebufferTextures[4];
-
-} UserData;
-
-///
-// Create a simple 2x2 texture image with four different colors
-//
-GLuint CreateSimpleTexture2D( )
-{
- // Texture object handle
- GLuint textureId;
-
- // 2x2 Image, 3 bytes per pixel (R, G, B)
- GLubyte pixels[4 * 3] =
- {
- 255, 0, 0, // Red
- 0, 255, 0, // Green
- 0, 0, 255, // Blue
- 255, 255, 0 // Yellow
- };
-
- // Use tightly packed data
- glPixelStorei ( GL_UNPACK_ALIGNMENT, 1 );
-
- // Generate a texture object
- glGenTextures ( 1, &textureId );
-
- // Bind the texture object
- glBindTexture ( GL_TEXTURE_2D, textureId );
-
- // Load the texture
- glTexImage2D ( GL_TEXTURE_2D, 0, GL_RGB, 2, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels );
-
- // Set the filtering mode
- glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
- glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
-
- return textureId;
-
-}
-
-
-///
-// Initialize the shader and program object
-//
-int Init ( ESContext *esContext )
-{
- UserData *userData = (UserData*)esContext->userData;
- GLbyte vShaderStr[] =
- "attribute vec4 a_position; \n"
- "attribute vec2 a_texCoord; \n"
- "varying vec2 v_texCoord; \n"
- "void main() \n"
- "{ \n"
- " gl_Position = a_position; \n"
- " v_texCoord = a_texCoord; \n"
- "} \n";
-
- GLbyte fMultiShaderStr[] =
- "#extension GL_EXT_draw_buffers : enable \n"
- "precision mediump float; \n"
- "varying vec2 v_texCoord; \n"
- "uniform sampler2D s_texture; \n"
- "void main() \n"
- "{ \n"
- " vec4 color = texture2D( s_texture, v_texCoord ); \n"
- " gl_FragData[0] = color; \n"
- " gl_FragData[1] = vec4(1.0, 1.0, 1.0, 1.0) - color.brga;\n"
- " gl_FragData[2] = vec4(0.2, 1.0, 0.5, 1.0) * color.gbra;\n"
- " gl_FragData[3] = color.rrra; \n"
- "} \n";
-
- GLbyte fShaderStr[] =
- "precision mediump float; \n"
- "varying vec2 v_texCoord; \n"
- "uniform sampler2D s_texture; \n"
- "void main() \n"
- "{ \n"
- " vec4 color = texture2D( s_texture, v_texCoord ); \n"
- " gl_FragColor = color; \n"
- "} \n";
-
- int i;
-
- // Check EXT_draw_buffers is supported
- if (strstr(glGetString(GL_EXTENSIONS), "GL_EXT_draw_buffers") == 0)
- {
- return FALSE;
- }
-
- // Retrieve the address of glDrawBuffersEXT from EGL
- glDrawBuffersEXT = (PFNGLDRAWBUFFERSEXTPROC)eglGetProcAddress("glDrawBuffersEXT");
-
- // Load the shaders and get a linked program object
- userData->programObject = esLoadProgram ( (const char*)vShaderStr, (const char*)fShaderStr );
-
- userData->programObjectMRT = esLoadProgram ( (const char*)vShaderStr, (const char*)fMultiShaderStr );
-
- // Get the attribute locations
- userData->positionLoc = glGetAttribLocation ( userData->programObject, "a_position" );
- userData->texCoordLoc = glGetAttribLocation ( userData->programObject, "a_texCoord" );
-
- // Get the sampler location
- userData->samplerLoc = glGetUniformLocation ( userData->programObject, "s_texture" );
-
- // Load the texture
- userData->textureId = CreateSimpleTexture2D ();
-
- glClearColor ( 0.0f, 0.0f, 0.0f, 0.0f );
-
- // Initialize the user framebuffer
- glGenFramebuffers(1, &userData->framebuffer);
- glGenTextures(4, userData->framebufferTextures);
-
- glBindFramebuffer(GL_FRAMEBUFFER, userData->framebuffer);
-
- for (i = 0; i < 4; i++)
- {
- // Create textures for the four color attachments
- glBindTexture(GL_TEXTURE_2D, userData->framebufferTextures[i]);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, esContext->width, esContext->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0_EXT + i, GL_TEXTURE_2D, userData->framebufferTextures[i], 0);
- }
-
- glBindTexture(GL_TEXTURE_2D, 0);
-
- return TRUE;
-}
-
-///
-// Draw a triangle using the shader pair created in Init()
-//
-void Draw ( ESContext *esContext )
-{
- UserData *userData = (UserData*)esContext->userData;
- GLfloat vVertices[] = { -0.8f, 0.8f, 0.0f, // Position 0
- 0.0f, 0.0f, // TexCoord 0
- -0.8f, -0.8f, 0.0f, // Position 1
- 0.0f, 1.0f, // TexCoord 1
- 0.8f, -0.8f, 0.0f, // Position 2
- 1.0f, 1.0f, // TexCoord 2
- 0.8f, 0.8f, 0.0f, // Position 3
- 1.0f, 0.0f // TexCoord 3
- };
- GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
-
- GLenum drawBuffers[] = { GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_COLOR_ATTACHMENT2_EXT, GL_COLOR_ATTACHMENT3_EXT };
-
- // Enable drawing to the four color attachments of the user framebuffer
- glBindFramebuffer(GL_FRAMEBUFFER, userData->framebuffer);
- glDrawBuffersEXT(4, drawBuffers);
-
- // Set the viewport
- glViewport ( 0, 0, esContext->width, esContext->height );
-
- // Clear the color buffer
- glClear ( GL_COLOR_BUFFER_BIT );
-
- // Use the program object
- glUseProgram ( userData->programObjectMRT );
-
- // Load the vertex position
- glVertexAttribPointer ( userData->positionLoc, 3, GL_FLOAT,
- GL_FALSE, 5 * sizeof(GLfloat), vVertices );
- // Load the texture coordinate
- glVertexAttribPointer ( userData->texCoordLoc, 2, GL_FLOAT,
- GL_FALSE, 5 * sizeof(GLfloat), &vVertices[3] );
-
- glEnableVertexAttribArray ( userData->positionLoc );
- glEnableVertexAttribArray ( userData->texCoordLoc );
-
- // Bind the texture
- glActiveTexture ( GL_TEXTURE0 );
- glBindTexture ( GL_TEXTURE_2D, userData->textureId );
-
- // Set the sampler texture unit to 0
- glUniform1i ( userData->samplerLoc, 0 );
-
- // Draw the textured quad to the four render targets
- glDrawElements ( GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices );
-
- // Enable the default framebuffer and single textured drawing
- glBindFramebuffer(GL_FRAMEBUFFER, 0);
- glUseProgram ( userData->programObject );
-
- // Draw the four textured quads to a separate region in the viewport
- glBindTexture( GL_TEXTURE_2D, userData->framebufferTextures[0]);
- glViewport ( 0, 0, esContext->width/2, esContext->height/2 );
- glDrawElements ( GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices );
-
- glBindTexture( GL_TEXTURE_2D, userData->framebufferTextures[1]);
- glViewport ( esContext->width/2, 0, esContext->width/2, esContext->height/2 );
- glDrawElements ( GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices );
-
- glBindTexture( GL_TEXTURE_2D, userData->framebufferTextures[2]);
- glViewport ( 0, esContext->height/2, esContext->width/2, esContext->height/2 );
- glDrawElements ( GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices );
-
- glBindTexture( GL_TEXTURE_2D, userData->framebufferTextures[3]);
- glViewport ( esContext->width/2, esContext->height/2, esContext->width/2, esContext->height/2 );
- glDrawElements ( GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices );
-
- eglSwapBuffers ( esContext->eglDisplay, esContext->eglSurface );
-}
-
-///
-// Cleanup
-//
-void ShutDown ( ESContext *esContext )
-{
- UserData *userData = (UserData*)esContext->userData;
-
- glDeleteTextures(4, userData->framebufferTextures);
-
- glDeleteFramebuffers(1, &userData->framebuffer);
-
- // Delete texture object
- glDeleteTextures ( 1, &userData->textureId );
-
- // Delete program object
- glDeleteProgram ( userData->programObject );
-
- eglDestroyContext(esContext->eglDisplay, esContext->eglContext);
- eglDestroySurface(esContext->eglDisplay, esContext->eglSurface);
- eglTerminate(esContext->eglDisplay);
-}
-
-
-int main ( int argc, char *argv[] )
-{
- ESContext esContext;
- UserData userData;
-
- esInitContext ( &esContext );
- esContext.userData = &userData;
-
- esCreateWindow ( &esContext, TEXT("Multiple Render Targets"), 320, 240, ES_WINDOW_RGB );
-
- if ( !Init ( &esContext ) )
- return 0;
-
- esRegisterDrawFunc ( &esContext, Draw );
-
- esMainLoop ( &esContext );
-
- ShutDown ( &esContext );
-}
diff --git a/chromium/third_party/angle/samples/gles2_book/MultipleRenderTargets/MultipleRenderTargets.vcxproj b/chromium/third_party/angle/samples/gles2_book/MultipleRenderTargets/MultipleRenderTargets.vcxproj
deleted file mode 100644
index 234512b1699..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/MultipleRenderTargets/MultipleRenderTargets.vcxproj
+++ /dev/null
@@ -1,105 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{DD670DCB-2554-4FAE-B7C9-D7F0C3087C10}</ProjectGuid>
- <RootNamespace>MultipleRenderTargets</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>NotSet</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>NotSet</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
- <EmbedManifest Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</EmbedManifest>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>../Common;../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>../Common;../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="MultipleRenderTargets.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\Common\esUtil.vcxproj">
- <Project>{47c93f52-ab4e-4ff9-8d4f-b38cd60a183f}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/chromium/third_party/angle/samples/gles2_book/ParticleSystem/ParticleSystem.c b/chromium/third_party/angle/samples/gles2_book/ParticleSystem/ParticleSystem.c
deleted file mode 100644
index 22141334c8f..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/ParticleSystem/ParticleSystem.c
+++ /dev/null
@@ -1,294 +0,0 @@
-//
-// Book: OpenGL(R) ES 2.0 Programming Guide
-// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
-// ISBN-10: 0321502795
-// ISBN-13: 9780321502797
-// Publisher: Addison-Wesley Professional
-// URLs: http://safari.informit.com/9780321563835
-// http://www.opengles-book.com
-//
-
-// ParticleSystem.c
-//
-// This is an example that demonstrates rendering a particle system
-// using a vertex shader and point sprites.
-//
-#include <stdlib.h>
-#include <math.h>
-#include "esUtil.h"
-
-#define NUM_PARTICLES 1000
-#define PARTICLE_SIZE 7
-
-typedef struct
-{
- // Handle to a program object
- GLuint programObject;
-
- // Attribute locations
- GLint lifetimeLoc;
- GLint startPositionLoc;
- GLint endPositionLoc;
-
- // Uniform location
- GLint timeLoc;
- GLint colorLoc;
- GLint centerPositionLoc;
- GLint samplerLoc;
-
- // Texture handle
- GLuint textureId;
-
- // Particle vertex data
- float particleData[ NUM_PARTICLES * PARTICLE_SIZE ];
-
- // Current time
- float time;
-
-} UserData;
-
-///
-// Load texture from disk
-//
-GLuint LoadTexture ( char *fileName )
-{
- int width,
- height;
- char *buffer = esLoadTGA ( fileName, &width, &height );
- GLuint texId;
-
- if ( buffer == NULL )
- {
- esLogMessage ( "Error loading (%s) image.\n", fileName );
- return 0;
- }
-
- glGenTextures ( 1, &texId );
- glBindTexture ( GL_TEXTURE_2D, texId );
-
- glTexImage2D ( GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, buffer );
- glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
- glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
- glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
- glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
-
- free ( buffer );
-
- return texId;
-}
-
-
-///
-// Initialize the shader and program object
-//
-int Init ( ESContext *esContext )
-{
- UserData *userData = esContext->userData;
- int i;
-
- GLbyte vShaderStr[] =
- "uniform float u_time; \n"
- "uniform vec3 u_centerPosition; \n"
- "attribute float a_lifetime; \n"
- "attribute vec3 a_startPosition; \n"
- "attribute vec3 a_endPosition; \n"
- "varying float v_lifetime; \n"
- "void main() \n"
- "{ \n"
- " if ( u_time <= a_lifetime ) \n"
- " { \n"
- " gl_Position.xyz = a_startPosition + \n"
- " (u_time * a_endPosition); \n"
- " gl_Position.xyz += u_centerPosition; \n"
- " gl_Position.w = 1.0; \n"
- " } \n"
- " else \n"
- " gl_Position = vec4( -1000, -1000, 0, 0 ); \n"
- " v_lifetime = 1.0 - ( u_time / a_lifetime ); \n"
- " v_lifetime = clamp ( v_lifetime, 0.0, 1.0 ); \n"
- " gl_PointSize = ( v_lifetime * v_lifetime ) * 40.0; \n"
- "}";
-
- GLbyte fShaderStr[] =
- "precision mediump float; \n"
- "uniform vec4 u_color; \n"
- "varying float v_lifetime; \n"
- "uniform sampler2D s_texture; \n"
- "void main() \n"
- "{ \n"
- " vec4 texColor; \n"
- " texColor = texture2D( s_texture, gl_PointCoord ); \n"
- " gl_FragColor = vec4( u_color ) * texColor; \n"
- " gl_FragColor.a *= v_lifetime; \n"
- "} \n";
-
- // Load the shaders and get a linked program object
- userData->programObject = esLoadProgram ( vShaderStr, fShaderStr );
-
- // Get the attribute locations
- userData->lifetimeLoc = glGetAttribLocation ( userData->programObject, "a_lifetime" );
- userData->startPositionLoc = glGetAttribLocation ( userData->programObject, "a_startPosition" );
- userData->endPositionLoc = glGetAttribLocation ( userData->programObject, "a_endPosition" );
-
- // Get the uniform locations
- userData->timeLoc = glGetUniformLocation ( userData->programObject, "u_time" );
- userData->centerPositionLoc = glGetUniformLocation ( userData->programObject, "u_centerPosition" );
- userData->colorLoc = glGetUniformLocation ( userData->programObject, "u_color" );
- userData->samplerLoc = glGetUniformLocation ( userData->programObject, "s_texture" );
-
- glClearColor ( 0.0f, 0.0f, 0.0f, 0.0f );
-
- // Fill in particle data array
- srand ( 0 );
- for ( i = 0; i < NUM_PARTICLES; i++ )
- {
- float *particleData = &userData->particleData[i * PARTICLE_SIZE];
-
- // Lifetime of particle
- (*particleData++) = ( (float)(rand() % 10000) / 10000.0f );
-
- // End position of particle
- (*particleData++) = ( (float)(rand() % 10000) / 5000.0f ) - 1.0f;
- (*particleData++) = ( (float)(rand() % 10000) / 5000.0f ) - 1.0f;
- (*particleData++) = ( (float)(rand() % 10000) / 5000.0f ) - 1.0f;
-
- // Start position of particle
- (*particleData++) = ( (float)(rand() % 10000) / 40000.0f ) - 0.125f;
- (*particleData++) = ( (float)(rand() % 10000) / 40000.0f ) - 0.125f;
- (*particleData++) = ( (float)(rand() % 10000) / 40000.0f ) - 0.125f;
-
- }
-
- // Initialize time to cause reset on first update
- userData->time = 1.0f;
-
- userData->textureId = LoadTexture ( "smoke.tga" );
- if ( userData->textureId <= 0 )
- {
- return FALSE;
- }
-
- return TRUE;
-}
-
-///
-// Update time-based variables
-//
-void Update ( ESContext *esContext, float deltaTime )
-{
- UserData *userData = esContext->userData;
-
- userData->time += deltaTime;
-
- if ( userData->time >= 1.0f )
- {
- float centerPos[3];
- float color[4];
-
- userData->time = 0.0f;
-
- // Pick a new start location and color
- centerPos[0] = ( (float)(rand() % 10000) / 10000.0f ) - 0.5f;
- centerPos[1] = ( (float)(rand() % 10000) / 10000.0f ) - 0.5f;
- centerPos[2] = ( (float)(rand() % 10000) / 10000.0f ) - 0.5f;
-
- glUniform3fv ( userData->centerPositionLoc, 1, &centerPos[0] );
-
- // Random color
- color[0] = ( (float)(rand() % 10000) / 20000.0f ) + 0.5f;
- color[1] = ( (float)(rand() % 10000) / 20000.0f ) + 0.5f;
- color[2] = ( (float)(rand() % 10000) / 20000.0f ) + 0.5f;
- color[3] = 0.5;
-
- glUniform4fv ( userData->colorLoc, 1, &color[0] );
- }
-
- // Load uniform time variable
- glUniform1f ( userData->timeLoc, userData->time );
-}
-
-///
-// Draw a triangle using the shader pair created in Init()
-//
-void Draw ( ESContext *esContext )
-{
- UserData *userData = esContext->userData;
-
- // Set the viewport
- glViewport ( 0, 0, esContext->width, esContext->height );
-
- // Clear the color buffer
- glClear ( GL_COLOR_BUFFER_BIT );
-
- // Use the program object
- glUseProgram ( userData->programObject );
-
- // Load the vertex attributes
- glVertexAttribPointer ( userData->lifetimeLoc, 1, GL_FLOAT,
- GL_FALSE, PARTICLE_SIZE * sizeof(GLfloat),
- userData->particleData );
-
- glVertexAttribPointer ( userData->endPositionLoc, 3, GL_FLOAT,
- GL_FALSE, PARTICLE_SIZE * sizeof(GLfloat),
- &userData->particleData[1] );
-
- glVertexAttribPointer ( userData->startPositionLoc, 3, GL_FLOAT,
- GL_FALSE, PARTICLE_SIZE * sizeof(GLfloat),
- &userData->particleData[4] );
-
-
- glEnableVertexAttribArray ( userData->lifetimeLoc );
- glEnableVertexAttribArray ( userData->endPositionLoc );
- glEnableVertexAttribArray ( userData->startPositionLoc );
- // Blend particles
- glEnable ( GL_BLEND );
- glBlendFunc ( GL_SRC_ALPHA, GL_ONE );
-
- // Bind the texture
- glActiveTexture ( GL_TEXTURE0 );
- glBindTexture ( GL_TEXTURE_2D, userData->textureId );
- glEnable ( GL_TEXTURE_2D );
-
- // Set the sampler texture unit to 0
- glUniform1i ( userData->samplerLoc, 0 );
-
- glDrawArrays( GL_POINTS, 0, NUM_PARTICLES );
-
- eglSwapBuffers ( esContext->eglDisplay, esContext->eglSurface );
-}
-
-///
-// Cleanup
-//
-void ShutDown ( ESContext *esContext )
-{
- UserData *userData = esContext->userData;
-
- // Delete texture object
- glDeleteTextures ( 1, &userData->textureId );
-
- // Delete program object
- glDeleteProgram ( userData->programObject );
-}
-
-
-int main ( int argc, char *argv[] )
-{
- ESContext esContext;
- UserData userData;
-
- esInitContext ( &esContext );
- esContext.userData = &userData;
-
- esCreateWindow ( &esContext, TEXT("ParticleSystem"), 640, 480, ES_WINDOW_RGB );
-
- if ( !Init ( &esContext ) )
- return 0;
-
- esRegisterDrawFunc ( &esContext, Draw );
- esRegisterUpdateFunc ( &esContext, Update );
-
- esMainLoop ( &esContext );
-
- ShutDown ( &esContext );
-}
diff --git a/chromium/third_party/angle/samples/gles2_book/ParticleSystem/ParticleSystem.vcxproj b/chromium/third_party/angle/samples/gles2_book/ParticleSystem/ParticleSystem.vcxproj
deleted file mode 100644
index 60a6d6aec56..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/ParticleSystem/ParticleSystem.vcxproj
+++ /dev/null
@@ -1,111 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{B9E5BFFC-D843-4E0E-9D3E-23913A613473}</ProjectGuid>
- <RootNamespace>ParticleSystem</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>NotSet</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>NotSet</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
- <EmbedManifest Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</EmbedManifest>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>../Common;../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- <PostBuildEvent>
- <Command>xcopy /D /Y smoke.tga "$(outDir)"</Command>
- </PostBuildEvent>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>../Common;../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- <PostBuildEvent>
- <Command>xcopy /D /Y smoke.tga "$(outDir)"</Command>
- </PostBuildEvent>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="ParticleSystem.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\Common\esUtil.vcxproj">
- <Project>{47c93f52-ab4e-4ff9-8d4f-b38cd60a183f}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/chromium/third_party/angle/samples/gles2_book/PostSubBuffer/PostSubBuffer.c b/chromium/third_party/angle/samples/gles2_book/PostSubBuffer/PostSubBuffer.c
deleted file mode 100644
index 0096ec31b03..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/PostSubBuffer/PostSubBuffer.c
+++ /dev/null
@@ -1,204 +0,0 @@
-// Based on a sample from:
-//
-// Book: OpenGL(R) ES 2.0 Programming Guide
-// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
-// ISBN-10: 0321502795
-// ISBN-13: 9780321502797
-// Publisher: Addison-Wesley Professional
-// URLs: http://safari.informit.com/9780321563835
-// http://www.opengles-book.com
-//
-
-// PostSubBuffer.c
-//
-// This is a simple example that draws a rotating cube in perspective
-// using a vertex shader to transform the object, posting only a subrectangle
-// to the window surface.
-//
-#include <stdlib.h>
-#include "esUtil.h"
-
-#define WINDOW_WIDTH 320
-#define WINDOW_HEIGHT 240
-
-typedef struct
-{
- // Handle to a program object
- GLuint programObject;
-
- // Attribute locations
- GLint positionLoc;
-
- // Uniform locations
- GLint mvpLoc;
-
- // Vertex daata
- GLfloat *vertices;
- GLushort *indices;
- int numIndices;
-
- // Rotation angle
- GLfloat angle;
-
- // MVP matrix
- ESMatrix mvpMatrix;
-} UserData;
-
-///
-// Initialize the shader and program object
-//
-int Init ( ESContext *esContext )
-{
- UserData *userData = esContext->userData;
- GLbyte vShaderStr[] =
- "uniform mat4 u_mvpMatrix; \n"
- "attribute vec4 a_position; \n"
- "void main() \n"
- "{ \n"
- " gl_Position = u_mvpMatrix * a_position; \n"
- "} \n";
-
- GLbyte fShaderStr[] =
- "precision mediump float; \n"
- "void main() \n"
- "{ \n"
- " gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); \n"
- "} \n";
-
- // Load the shaders and get a linked program object
- userData->programObject = esLoadProgram ( vShaderStr, fShaderStr );
-
- // Get the attribute locations
- userData->positionLoc = glGetAttribLocation ( userData->programObject, "a_position" );
-
- // Get the uniform locations
- userData->mvpLoc = glGetUniformLocation( userData->programObject, "u_mvpMatrix" );
-
- // Generate the vertex data
- userData->numIndices = esGenCube( 1.0, &userData->vertices,
- NULL, NULL, &userData->indices );
-
- // Starting rotation angle for the cube
- userData->angle = 45.0f;
-
- // Clear the whole window surface.
- glClearColor ( 0.0f, 0.0f, 1.0f, 0.0f );
- glClear ( GL_COLOR_BUFFER_BIT );
- eglSwapBuffers ( esContext->eglDisplay, esContext->eglSurface );
-
- glClearColor ( 0.0f, 0.0f, 0.0f, 0.0f );
- return TRUE;
-}
-
-
-///
-// Update MVP matrix based on time
-//
-void Update ( ESContext *esContext, float deltaTime )
-{
- UserData *userData = (UserData*) esContext->userData;
- ESMatrix perspective;
- ESMatrix modelview;
- float aspect;
-
- // Compute a rotation angle based on time to rotate the cube
- userData->angle += ( deltaTime * 40.0f );
- if( userData->angle >= 360.0f )
- userData->angle -= 360.0f;
-
- // Compute the window aspect ratio
- aspect = (GLfloat) esContext->width / (GLfloat) esContext->height;
-
- // Generate a perspective matrix with a 60 degree FOV
- esMatrixLoadIdentity( &perspective );
- esPerspective( &perspective, 60.0f, aspect, 1.0f, 20.0f );
-
- // Generate a model view matrix to rotate/translate the cube
- esMatrixLoadIdentity( &modelview );
-
- // Translate away from the viewer
- esTranslate( &modelview, 0.0, 0.0, -2.0 );
-
- // Rotate the cube
- esRotate( &modelview, userData->angle, 1.0, 0.0, 1.0 );
-
- // Compute the final MVP by multiplying the
- // modevleiw and perspective matrices together
- esMatrixMultiply( &userData->mvpMatrix, &modelview, &perspective );
-}
-
-///
-// Draw a triangle using the shader pair created in Init()
-//
-void Draw ( ESContext *esContext )
-{
- UserData *userData = esContext->userData;
-
- // Set the viewport
- glViewport ( 0, 0, esContext->width, esContext->height );
-
-
- // Clear the color buffer
- glClear ( GL_COLOR_BUFFER_BIT );
-
- // Use the program object
- glUseProgram ( userData->programObject );
-
- // Load the vertex position
- glVertexAttribPointer ( userData->positionLoc, 3, GL_FLOAT,
- GL_FALSE, 3 * sizeof(GLfloat), userData->vertices );
-
- glEnableVertexAttribArray ( userData->positionLoc );
-
-
- // Load the MVP matrix
- glUniformMatrix4fv( userData->mvpLoc, 1, GL_FALSE, (GLfloat*) &userData->mvpMatrix.m[0][0] );
-
- // Draw the cube
- glDrawElements ( GL_TRIANGLES, userData->numIndices, GL_UNSIGNED_SHORT, userData->indices );
-
- eglPostSubBufferNV ( esContext->eglDisplay, esContext->eglSurface, 60, 60, WINDOW_WIDTH - 120, WINDOW_HEIGHT - 120 );
-}
-
-///
-// Cleanup
-//
-void ShutDown ( ESContext *esContext )
-{
- UserData *userData = esContext->userData;
-
- if ( userData->vertices != NULL )
- {
- free ( userData->vertices );
- }
-
- if ( userData->indices != NULL )
- {
- free ( userData->indices );
- }
-
- // Delete program object
- glDeleteProgram ( userData->programObject );
-}
-
-
-int main ( int argc, char *argv[] )
-{
- ESContext esContext;
- UserData userData;
-
- esInitContext ( &esContext );
- esContext.userData = &userData;
-
- esCreateWindow ( &esContext, TEXT("Simple Vertex Shader"), WINDOW_WIDTH, WINDOW_HEIGHT, ES_WINDOW_RGB | ES_WINDOW_POST_SUB_BUFFER_SUPPORTED );
-
- if ( !Init ( &esContext ) )
- return 0;
-
- esRegisterDrawFunc ( &esContext, Draw );
- esRegisterUpdateFunc ( &esContext, Update );
-
- esMainLoop ( &esContext );
-
- ShutDown ( &esContext );
-}
diff --git a/chromium/third_party/angle/samples/gles2_book/PostSubBuffer/PostSubBuffer.vcxproj b/chromium/third_party/angle/samples/gles2_book/PostSubBuffer/PostSubBuffer.vcxproj
deleted file mode 100644
index 875d16322ef..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/PostSubBuffer/PostSubBuffer.vcxproj
+++ /dev/null
@@ -1,105 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{667CE95F-5DD8-4495-8C18-5CA8A175B12D}</ProjectGuid>
- <RootNamespace>Simple_VertexShader</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>NotSet</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>NotSet</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
- <EmbedManifest Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</EmbedManifest>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>../Common;../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>../Common;../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="PostSubBuffer.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\Common\esUtil.vcxproj">
- <Project>{47c93f52-ab4e-4ff9-8d4f-b38cd60a183f}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/chromium/third_party/angle/samples/gles2_book/Simple_Texture2D/Simple_Texture2D.c b/chromium/third_party/angle/samples/gles2_book/Simple_Texture2D/Simple_Texture2D.c
deleted file mode 100644
index b074608a757..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/Simple_Texture2D/Simple_Texture2D.c
+++ /dev/null
@@ -1,198 +0,0 @@
-//
-// Book: OpenGL(R) ES 2.0 Programming Guide
-// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
-// ISBN-10: 0321502795
-// ISBN-13: 9780321502797
-// Publisher: Addison-Wesley Professional
-// URLs: http://safari.informit.com/9780321563835
-// http://www.opengles-book.com
-//
-
-// Simple_Texture2D.c
-//
-// This is a simple example that draws a quad with a 2D
-// texture image. The purpose of this example is to demonstrate
-// the basics of 2D texturing
-//
-#include <stdlib.h>
-#include "esUtil.h"
-
-typedef struct
-{
- // Handle to a program object
- GLuint programObject;
-
- // Attribute locations
- GLint positionLoc;
- GLint texCoordLoc;
-
- // Sampler location
- GLint samplerLoc;
-
- // Texture handle
- GLuint textureId;
-
-} UserData;
-
-///
-// Create a simple 2x2 texture image with four different colors
-//
-GLuint CreateSimpleTexture2D( )
-{
- // Texture object handle
- GLuint textureId;
-
- // 2x2 Image, 3 bytes per pixel (R, G, B)
- GLubyte pixels[4 * 3] =
- {
- 255, 0, 0, // Red
- 0, 255, 0, // Green
- 0, 0, 255, // Blue
- 255, 255, 0 // Yellow
- };
-
- // Use tightly packed data
- glPixelStorei ( GL_UNPACK_ALIGNMENT, 1 );
-
- // Generate a texture object
- glGenTextures ( 1, &textureId );
-
- // Bind the texture object
- glBindTexture ( GL_TEXTURE_2D, textureId );
-
- // Load the texture
- glTexImage2D ( GL_TEXTURE_2D, 0, GL_RGB, 2, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels );
-
- // Set the filtering mode
- glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
- glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
-
- return textureId;
-
-}
-
-
-///
-// Initialize the shader and program object
-//
-int Init ( ESContext *esContext )
-{
- UserData *userData = esContext->userData;
- GLbyte vShaderStr[] =
- "attribute vec4 a_position; \n"
- "attribute vec2 a_texCoord; \n"
- "varying vec2 v_texCoord; \n"
- "void main() \n"
- "{ \n"
- " gl_Position = a_position; \n"
- " v_texCoord = a_texCoord; \n"
- "} \n";
-
- GLbyte fShaderStr[] =
- "precision mediump float; \n"
- "varying vec2 v_texCoord; \n"
- "uniform sampler2D s_texture; \n"
- "void main() \n"
- "{ \n"
- " gl_FragColor = texture2D( s_texture, v_texCoord );\n"
- "} \n";
-
- // Load the shaders and get a linked program object
- userData->programObject = esLoadProgram ( vShaderStr, fShaderStr );
-
- // Get the attribute locations
- userData->positionLoc = glGetAttribLocation ( userData->programObject, "a_position" );
- userData->texCoordLoc = glGetAttribLocation ( userData->programObject, "a_texCoord" );
-
- // Get the sampler location
- userData->samplerLoc = glGetUniformLocation ( userData->programObject, "s_texture" );
-
- // Load the texture
- userData->textureId = CreateSimpleTexture2D ();
-
- glClearColor ( 0.0f, 0.0f, 0.0f, 0.0f );
- return TRUE;
-}
-
-///
-// Draw a triangle using the shader pair created in Init()
-//
-void Draw ( ESContext *esContext )
-{
- UserData *userData = esContext->userData;
- GLfloat vVertices[] = { -0.5f, 0.5f, 0.0f, // Position 0
- 0.0f, 0.0f, // TexCoord 0
- -0.5f, -0.5f, 0.0f, // Position 1
- 0.0f, 1.0f, // TexCoord 1
- 0.5f, -0.5f, 0.0f, // Position 2
- 1.0f, 1.0f, // TexCoord 2
- 0.5f, 0.5f, 0.0f, // Position 3
- 1.0f, 0.0f // TexCoord 3
- };
- GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
-
- // Set the viewport
- glViewport ( 0, 0, esContext->width, esContext->height );
-
- // Clear the color buffer
- glClear ( GL_COLOR_BUFFER_BIT );
-
- // Use the program object
- glUseProgram ( userData->programObject );
-
- // Load the vertex position
- glVertexAttribPointer ( userData->positionLoc, 3, GL_FLOAT,
- GL_FALSE, 5 * sizeof(GLfloat), vVertices );
- // Load the texture coordinate
- glVertexAttribPointer ( userData->texCoordLoc, 2, GL_FLOAT,
- GL_FALSE, 5 * sizeof(GLfloat), &vVertices[3] );
-
- glEnableVertexAttribArray ( userData->positionLoc );
- glEnableVertexAttribArray ( userData->texCoordLoc );
-
- // Bind the texture
- glActiveTexture ( GL_TEXTURE0 );
- glBindTexture ( GL_TEXTURE_2D, userData->textureId );
-
- // Set the sampler texture unit to 0
- glUniform1i ( userData->samplerLoc, 0 );
-
- glDrawElements ( GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices );
-
- eglSwapBuffers ( esContext->eglDisplay, esContext->eglSurface );
-}
-
-///
-// Cleanup
-//
-void ShutDown ( ESContext *esContext )
-{
- UserData *userData = esContext->userData;
-
- // Delete texture object
- glDeleteTextures ( 1, &userData->textureId );
-
- // Delete program object
- glDeleteProgram ( userData->programObject );
-}
-
-
-int main ( int argc, char *argv[] )
-{
- ESContext esContext;
- UserData userData;
-
- esInitContext ( &esContext );
- esContext.userData = &userData;
-
- esCreateWindow ( &esContext, TEXT("Simple Texture 2D"), 320, 240, ES_WINDOW_RGB );
-
- if ( !Init ( &esContext ) )
- return 0;
-
- esRegisterDrawFunc ( &esContext, Draw );
-
- esMainLoop ( &esContext );
-
- ShutDown ( &esContext );
-}
diff --git a/chromium/third_party/angle/samples/gles2_book/Simple_Texture2D/Simple_Texture2D.vcxproj b/chromium/third_party/angle/samples/gles2_book/Simple_Texture2D/Simple_Texture2D.vcxproj
deleted file mode 100644
index d6210a36090..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/Simple_Texture2D/Simple_Texture2D.vcxproj
+++ /dev/null
@@ -1,105 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{2E54D748-781B-4DF2-A1DD-B9384A821810}</ProjectGuid>
- <RootNamespace>Simple_Texture2D</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>NotSet</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>NotSet</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
- <EmbedManifest Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</EmbedManifest>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>../Common;../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>../Common;../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="Simple_Texture2D.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\Common\esUtil.vcxproj">
- <Project>{47c93f52-ab4e-4ff9-8d4f-b38cd60a183f}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/chromium/third_party/angle/samples/gles2_book/Simple_TextureCubemap/Simple_TextureCubemap.c b/chromium/third_party/angle/samples/gles2_book/Simple_TextureCubemap/Simple_TextureCubemap.c
deleted file mode 100644
index 302d844f597..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/Simple_TextureCubemap/Simple_TextureCubemap.c
+++ /dev/null
@@ -1,229 +0,0 @@
-//
-// Book: OpenGL(R) ES 2.0 Programming Guide
-// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
-// ISBN-10: 0321502795
-// ISBN-13: 9780321502797
-// Publisher: Addison-Wesley Professional
-// URLs: http://safari.informit.com/9780321563835
-// http://www.opengles-book.com
-//
-
-// Simple_TextureCubemap.c
-//
-// This is a simple example that draws a sphere with a cubemap image applied.
-//
-#include <stdlib.h>
-#include "esUtil.h"
-
-typedef struct
-{
- // Handle to a program object
- GLuint programObject;
-
- // Attribute locations
- GLint positionLoc;
- GLint normalLoc;
-
- // Sampler location
- GLint samplerLoc;
-
- // Texture handle
- GLuint textureId;
-
- // Vertex data
- int numIndices;
- GLfloat *vertices;
- GLfloat *normals;
- GLushort *indices;
-
-} UserData;
-
-///
-// Create a simple cubemap with a 1x1 face with a different
-// color for each face
-GLuint CreateSimpleTextureCubemap( )
-{
- GLuint textureId;
- // Six 1x1 RGB faces
- GLubyte cubePixels[6][3] =
- {
- // Face 0 - Red
- 255, 0, 0,
- // Face 1 - Green,
- 0, 255, 0,
- // Face 3 - Blue
- 0, 0, 255,
- // Face 4 - Yellow
- 255, 255, 0,
- // Face 5 - Purple
- 255, 0, 255,
- // Face 6 - White
- 255, 255, 255
- };
-
- // Generate a texture object
- glGenTextures ( 1, &textureId );
-
- // Bind the texture object
- glBindTexture ( GL_TEXTURE_CUBE_MAP, textureId );
-
- // Load the cube face - Positive X
- glTexImage2D ( GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 1, 1, 0,
- GL_RGB, GL_UNSIGNED_BYTE, &cubePixels[0] );
-
- // Load the cube face - Negative X
- glTexImage2D ( GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 1, 1, 0,
- GL_RGB, GL_UNSIGNED_BYTE, &cubePixels[1] );
-
- // Load the cube face - Positive Y
- glTexImage2D ( GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 1, 1, 0,
- GL_RGB, GL_UNSIGNED_BYTE, &cubePixels[2] );
-
- // Load the cube face - Negative Y
- glTexImage2D ( GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 1, 1, 0,
- GL_RGB, GL_UNSIGNED_BYTE, &cubePixels[3] );
-
- // Load the cube face - Positive Z
- glTexImage2D ( GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 1, 1, 0,
- GL_RGB, GL_UNSIGNED_BYTE, &cubePixels[4] );
-
- // Load the cube face - Negative Z
- glTexImage2D ( GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 1, 1, 0,
- GL_RGB, GL_UNSIGNED_BYTE, &cubePixels[5] );
-
- // Set the filtering mode
- glTexParameteri ( GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
- glTexParameteri ( GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
-
- return textureId;
-
-}
-
-
-///
-// Initialize the shader and program object
-//
-int Init ( ESContext *esContext )
-{
- UserData *userData = esContext->userData;
- GLbyte vShaderStr[] =
- "attribute vec4 a_position; \n"
- "attribute vec3 a_normal; \n"
- "varying vec3 v_normal; \n"
- "void main() \n"
- "{ \n"
- " gl_Position = a_position; \n"
- " v_normal = a_normal; \n"
- "} \n";
-
- GLbyte fShaderStr[] =
- "precision mediump float; \n"
- "varying vec3 v_normal; \n"
- "uniform samplerCube s_texture; \n"
- "void main() \n"
- "{ \n"
- " gl_FragColor = textureCube( s_texture, v_normal );\n"
- "} \n";
-
- // Load the shaders and get a linked program object
- userData->programObject = esLoadProgram ( vShaderStr, fShaderStr );
-
- // Get the attribute locations
- userData->positionLoc = glGetAttribLocation ( userData->programObject, "a_position" );
- userData->normalLoc = glGetAttribLocation ( userData->programObject, "a_normal" );
-
- // Get the sampler locations
- userData->samplerLoc = glGetUniformLocation ( userData->programObject, "s_texture" );
-
- // Load the texture
- userData->textureId = CreateSimpleTextureCubemap ();
-
- // Generate the vertex data
- userData->numIndices = esGenSphere ( 20, 0.75f, &userData->vertices, &userData->normals,
- NULL, &userData->indices );
-
-
- glClearColor ( 0.0f, 0.0f, 0.0f, 0.0f );
- return TRUE;
-}
-
-///
-// Draw a triangle using the shader pair created in Init()
-//
-void Draw ( ESContext *esContext )
-{
- UserData *userData = esContext->userData;
-
- // Set the viewport
- glViewport ( 0, 0, esContext->width, esContext->height );
-
- // Clear the color buffer
- glClear ( GL_COLOR_BUFFER_BIT );
-
-
- glCullFace ( GL_BACK );
- glEnable ( GL_CULL_FACE );
-
- // Use the program object
- glUseProgram ( userData->programObject );
-
- // Load the vertex position
- glVertexAttribPointer ( userData->positionLoc, 3, GL_FLOAT,
- GL_FALSE, 0, userData->vertices );
- // Load the normal
- glVertexAttribPointer ( userData->normalLoc, 3, GL_FLOAT,
- GL_FALSE, 0, userData->normals );
-
- glEnableVertexAttribArray ( userData->positionLoc );
- glEnableVertexAttribArray ( userData->normalLoc );
-
- // Bind the texture
- glActiveTexture ( GL_TEXTURE0 );
- glBindTexture ( GL_TEXTURE_CUBE_MAP, userData->textureId );
-
- // Set the sampler texture unit to 0
- glUniform1i ( userData->samplerLoc, 0 );
-
- glDrawElements ( GL_TRIANGLES, userData->numIndices,
- GL_UNSIGNED_SHORT, userData->indices );
-
- eglSwapBuffers ( esContext->eglDisplay, esContext->eglSurface );
-}
-
-///
-// Cleanup
-//
-void ShutDown ( ESContext *esContext )
-{
- UserData *userData = esContext->userData;
-
- // Delete texture object
- glDeleteTextures ( 1, &userData->textureId );
-
- // Delete program object
- glDeleteProgram ( userData->programObject );
-
- free ( userData->vertices );
- free ( userData->normals );
-}
-
-
-int main ( int argc, char *argv[] )
-{
- ESContext esContext;
- UserData userData;
-
- esInitContext ( &esContext );
- esContext.userData = &userData;
-
- esCreateWindow ( &esContext, TEXT("Simple Texture Cubemap"), 320, 240, ES_WINDOW_RGB );
-
- if ( !Init ( &esContext ) )
- return 0;
-
- esRegisterDrawFunc ( &esContext, Draw );
-
- esMainLoop ( &esContext );
-
- ShutDown ( &esContext );
-}
diff --git a/chromium/third_party/angle/samples/gles2_book/Simple_TextureCubemap/Simple_TextureCubemap.vcxproj b/chromium/third_party/angle/samples/gles2_book/Simple_TextureCubemap/Simple_TextureCubemap.vcxproj
deleted file mode 100644
index 84e9be072f7..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/Simple_TextureCubemap/Simple_TextureCubemap.vcxproj
+++ /dev/null
@@ -1,108 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{5EE56061-643D-406E-B42D-4299D2411056}</ProjectGuid>
- <RootNamespace>Simple_TextureCubemap</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>NotSet</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>NotSet</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
- <EmbedManifest Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</EmbedManifest>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>../Common;../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- </ClCompile>
- <ProjectReference>
- <UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
- </ProjectReference>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>../Common;../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="Simple_TextureCubemap.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\Common\esUtil.vcxproj">
- <Project>{47c93f52-ab4e-4ff9-8d4f-b38cd60a183f}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/chromium/third_party/angle/samples/gles2_book/Simple_VertexShader/Simple_VertexShader.c b/chromium/third_party/angle/samples/gles2_book/Simple_VertexShader/Simple_VertexShader.c
deleted file mode 100644
index df5c98d612f..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/Simple_VertexShader/Simple_VertexShader.c
+++ /dev/null
@@ -1,194 +0,0 @@
-//
-// Book: OpenGL(R) ES 2.0 Programming Guide
-// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
-// ISBN-10: 0321502795
-// ISBN-13: 9780321502797
-// Publisher: Addison-Wesley Professional
-// URLs: http://safari.informit.com/9780321563835
-// http://www.opengles-book.com
-//
-
-// Simple_VertexShader.c
-//
-// This is a simple example that draws a rotating cube in perspective
-// using a vertex shader to transform the object
-//
-#include <stdlib.h>
-#include "esUtil.h"
-
-typedef struct
-{
- // Handle to a program object
- GLuint programObject;
-
- // Attribute locations
- GLint positionLoc;
-
- // Uniform locations
- GLint mvpLoc;
-
- // Vertex daata
- GLfloat *vertices;
- GLushort *indices;
- int numIndices;
-
- // Rotation angle
- GLfloat angle;
-
- // MVP matrix
- ESMatrix mvpMatrix;
-} UserData;
-
-///
-// Initialize the shader and program object
-//
-int Init ( ESContext *esContext )
-{
- UserData *userData = esContext->userData;
- GLbyte vShaderStr[] =
- "uniform mat4 u_mvpMatrix; \n"
- "attribute vec4 a_position; \n"
- "void main() \n"
- "{ \n"
- " gl_Position = u_mvpMatrix * a_position; \n"
- "} \n";
-
- GLbyte fShaderStr[] =
- "precision mediump float; \n"
- "void main() \n"
- "{ \n"
- " gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); \n"
- "} \n";
-
- // Load the shaders and get a linked program object
- userData->programObject = esLoadProgram ( vShaderStr, fShaderStr );
-
- // Get the attribute locations
- userData->positionLoc = glGetAttribLocation ( userData->programObject, "a_position" );
-
- // Get the uniform locations
- userData->mvpLoc = glGetUniformLocation( userData->programObject, "u_mvpMatrix" );
-
- // Generate the vertex data
- userData->numIndices = esGenCube( 1.0, &userData->vertices,
- NULL, NULL, &userData->indices );
-
- // Starting rotation angle for the cube
- userData->angle = 45.0f;
-
- glClearColor ( 0.0f, 0.0f, 0.0f, 0.0f );
- return TRUE;
-}
-
-
-///
-// Update MVP matrix based on time
-//
-void Update ( ESContext *esContext, float deltaTime )
-{
- UserData *userData = (UserData*) esContext->userData;
- ESMatrix perspective;
- ESMatrix modelview;
- float aspect;
-
- // Compute a rotation angle based on time to rotate the cube
- userData->angle += ( deltaTime * 40.0f );
- if( userData->angle >= 360.0f )
- userData->angle -= 360.0f;
-
- // Compute the window aspect ratio
- aspect = (GLfloat) esContext->width / (GLfloat) esContext->height;
-
- // Generate a perspective matrix with a 60 degree FOV
- esMatrixLoadIdentity( &perspective );
- esPerspective( &perspective, 60.0f, aspect, 1.0f, 20.0f );
-
- // Generate a model view matrix to rotate/translate the cube
- esMatrixLoadIdentity( &modelview );
-
- // Translate away from the viewer
- esTranslate( &modelview, 0.0, 0.0, -2.0 );
-
- // Rotate the cube
- esRotate( &modelview, userData->angle, 1.0, 0.0, 1.0 );
-
- // Compute the final MVP by multiplying the
- // modevleiw and perspective matrices together
- esMatrixMultiply( &userData->mvpMatrix, &modelview, &perspective );
-}
-
-///
-// Draw a triangle using the shader pair created in Init()
-//
-void Draw ( ESContext *esContext )
-{
- UserData *userData = esContext->userData;
-
- // Set the viewport
- glViewport ( 0, 0, esContext->width, esContext->height );
-
-
- // Clear the color buffer
- glClear ( GL_COLOR_BUFFER_BIT );
-
- // Use the program object
- glUseProgram ( userData->programObject );
-
- // Load the vertex position
- glVertexAttribPointer ( userData->positionLoc, 3, GL_FLOAT,
- GL_FALSE, 3 * sizeof(GLfloat), userData->vertices );
-
- glEnableVertexAttribArray ( userData->positionLoc );
-
-
- // Load the MVP matrix
- glUniformMatrix4fv( userData->mvpLoc, 1, GL_FALSE, (GLfloat*) &userData->mvpMatrix.m[0][0] );
-
- // Draw the cube
- glDrawElements ( GL_TRIANGLES, userData->numIndices, GL_UNSIGNED_SHORT, userData->indices );
-
- eglSwapBuffers ( esContext->eglDisplay, esContext->eglSurface );
-}
-
-///
-// Cleanup
-//
-void ShutDown ( ESContext *esContext )
-{
- UserData *userData = esContext->userData;
-
- if ( userData->vertices != NULL )
- {
- free ( userData->vertices );
- }
-
- if ( userData->indices != NULL )
- {
- free ( userData->indices );
- }
-
- // Delete program object
- glDeleteProgram ( userData->programObject );
-}
-
-
-int main ( int argc, char *argv[] )
-{
- ESContext esContext;
- UserData userData;
-
- esInitContext ( &esContext );
- esContext.userData = &userData;
-
- esCreateWindow ( &esContext, TEXT("Simple Vertex Shader"), 320, 240, ES_WINDOW_RGB );
-
- if ( !Init ( &esContext ) )
- return 0;
-
- esRegisterDrawFunc ( &esContext, Draw );
- esRegisterUpdateFunc ( &esContext, Update );
-
- esMainLoop ( &esContext );
-
- ShutDown ( &esContext );
-}
diff --git a/chromium/third_party/angle/samples/gles2_book/Simple_VertexShader/Simple_VertexShader.vcxproj b/chromium/third_party/angle/samples/gles2_book/Simple_VertexShader/Simple_VertexShader.vcxproj
deleted file mode 100644
index ed716768361..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/Simple_VertexShader/Simple_VertexShader.vcxproj
+++ /dev/null
@@ -1,105 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{667CE95F-5DD8-4395-8C18-5CA8A175B12D}</ProjectGuid>
- <RootNamespace>Simple_VertexShader</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>NotSet</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>NotSet</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
- <EmbedManifest Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</EmbedManifest>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>../Common;../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>../Common;../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="Simple_VertexShader.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\Common\esUtil.vcxproj">
- <Project>{47c93f52-ab4e-4ff9-8d4f-b38cd60a183f}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/chromium/third_party/angle/samples/gles2_book/Stencil_Test/Stencil_Test.c b/chromium/third_party/angle/samples/gles2_book/Stencil_Test/Stencil_Test.c
deleted file mode 100644
index 4996ccfcaac..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/Stencil_Test/Stencil_Test.c
+++ /dev/null
@@ -1,273 +0,0 @@
-//
-// Book: OpenGL(R) ES 2.0 Programming Guide
-// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
-// ISBN-10: 0321502795
-// ISBN-13: 9780321502797
-// Publisher: Addison-Wesley Professional
-// URLs: http://safari.informit.com/9780321563835
-// http://www.opengles-book.com
-//
-
-// Stencil_Test.c
-//
-// This example shows various stencil buffer
-// operations.
-//
-#include <stdlib.h>
-#include "esUtil.h"
-
-typedef struct
-{
- // Handle to a program object
- GLuint programObject;
-
- // Attribute locations
- GLint positionLoc;
-
- // Uniform locations
- GLint colorLoc;
-
-} UserData;
-
-///
-// Initialize the shader and program object
-//
-int Init ( ESContext *esContext )
-{
- UserData *userData = esContext->userData;
- GLbyte vShaderStr[] =
- "attribute vec4 a_position; \n"
- "void main() \n"
- "{ \n"
- " gl_Position = a_position; \n"
- "} \n";
-
- GLbyte fShaderStr[] =
- "precision mediump float; \n"
- "uniform vec4 u_color; \n"
- "void main() \n"
- "{ \n"
- " gl_FragColor = u_color; \n"
- "} \n";
-
- // Load the shaders and get a linked program object
- userData->programObject = esLoadProgram ( vShaderStr, fShaderStr );
-
- // Get the attribute locations
- userData->positionLoc = glGetAttribLocation ( userData->programObject, "a_position" );
-
- // Get the sampler location
- userData->colorLoc = glGetUniformLocation ( userData->programObject, "u_color" );
-
- // Set the clear color
- glClearColor ( 0.0f, 0.0f, 0.0f, 0.0f );
-
- // Set the stencil clear value
- glClearStencil ( 0x1 );
-
- // Set the depth clear value
- glClearDepthf( 0.75f );
-
- // Enable the depth and stencil tests
- glEnable( GL_DEPTH_TEST );
- glEnable( GL_STENCIL_TEST );
-
- return TRUE;
-}
-
-///
-// Initialize the stencil buffer values, and then use those
-// values to control rendering
-//
-void Draw ( ESContext *esContext )
-{
- int i;
-
- UserData *userData = esContext->userData;
-
- GLfloat vVertices[] = {
- -0.75f, 0.25f, 0.50f, // Quad #0
- -0.25f, 0.25f, 0.50f,
- -0.25f, 0.75f, 0.50f,
- -0.75f, 0.75f, 0.50f,
- 0.25f, 0.25f, 0.90f, // Quad #1
- 0.75f, 0.25f, 0.90f,
- 0.75f, 0.75f, 0.90f,
- 0.25f, 0.75f, 0.90f,
- -0.75f, -0.75f, 0.50f, // Quad #2
- -0.25f, -0.75f, 0.50f,
- -0.25f, -0.25f, 0.50f,
- -0.75f, -0.25f, 0.50f,
- 0.25f, -0.75f, 0.50f, // Quad #3
- 0.75f, -0.75f, 0.50f,
- 0.75f, -0.25f, 0.50f,
- 0.25f, -0.25f, 0.50f,
- -1.00f, -1.00f, 0.00f, // Big Quad
- 1.00f, -1.00f, 0.00f,
- 1.00f, 1.00f, 0.00f,
- -1.00f, 1.00f, 0.00f
- };
-
- GLubyte indices[][6] = {
- { 0, 1, 2, 0, 2, 3 }, // Quad #0
- { 4, 5, 6, 4, 6, 7 }, // Quad #1
- { 8, 9, 10, 8, 10, 11 }, // Quad #2
- { 12, 13, 14, 12, 14, 15 }, // Quad #3
- { 16, 17, 18, 16, 18, 19 } // Big Quad
- };
-
-#define NumTests 4
- GLfloat colors[NumTests][4] = {
- { 1.0f, 0.0f, 0.0f, 1.0f },
- { 0.0f, 1.0f, 0.0f, 1.0f },
- { 0.0f, 0.0f, 1.0f, 1.0f },
- { 1.0f, 1.0f, 0.0f, 0.0f }
- };
-
- GLint numStencilBits;
- GLuint stencilValues[NumTests] = {
- 0x7, // Result of test 0
- 0x0, // Result of test 1
- 0x2, // Result of test 2
- 0xff // Result of test 3. We need to fill this
- // value in a run-time
- };
-
- // Set the viewport
- glViewport ( 0, 0, esContext->width, esContext->height );
-
- // Clear the color, depth, and stencil buffers. At this
- // point, the stencil buffer will be 0x1 for all pixels
- glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
-
- // Use the program object
- glUseProgram ( userData->programObject );
-
- // Load the vertex position
- glVertexAttribPointer ( userData->positionLoc, 3, GL_FLOAT,
- GL_FALSE, 0, vVertices );
-
- glEnableVertexAttribArray ( userData->positionLoc );
-
- // Test 0:
- //
- // Initialize upper-left region. In this case, the
- // stencil-buffer values will be replaced because the
- // stencil test for the rendered pixels will fail the
- // stencil test, which is
- //
- // ref mask stencil mask
- // ( 0x7 & 0x3 ) < ( 0x1 & 0x7 )
- //
- // The value in the stencil buffer for these pixels will
- // be 0x7.
- //
- glStencilFunc( GL_LESS, 0x7, 0x3 );
- glStencilOp( GL_REPLACE, GL_DECR, GL_DECR );
- glDrawElements( GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, indices[0] );
-
- // Test 1:
- //
- // Initialize the upper-right region. Here, we'll decrement
- // the stencil-buffer values where the stencil test passes
- // but the depth test fails. The stencil test is
- //
- // ref mask stencil mask
- // ( 0x3 & 0x3 ) > ( 0x1 & 0x3 )
- //
- // but where the geometry fails the depth test. The
- // stencil values for these pixels will be 0x0.
- //
- glStencilFunc( GL_GREATER, 0x3, 0x3 );
- glStencilOp( GL_KEEP, GL_DECR, GL_KEEP );
- glDrawElements( GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, indices[1] );
-
- // Test 2:
- //
- // Initialize the lower-left region. Here we'll increment
- // (with saturation) the stencil value where both the
- // stencil and depth tests pass. The stencil test for
- // these pixels will be
- //
- // ref mask stencil mask
- // ( 0x1 & 0x3 ) == ( 0x1 & 0x3 )
- //
- // The stencil values for these pixels will be 0x2.
- //
- glStencilFunc( GL_EQUAL, 0x1, 0x3 );
- glStencilOp( GL_KEEP, GL_INCR, GL_INCR );
- glDrawElements( GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, indices[2] );
-
- // Test 3:
- //
- // Finally, initialize the lower-right region. We'll invert
- // the stencil value where the stencil tests fails. The
- // stencil test for these pixels will be
- //
- // ref mask stencil mask
- // ( 0x2 & 0x1 ) == ( 0x1 & 0x1 )
- //
- // The stencil value here will be set to ~((2^s-1) & 0x1),
- // (with the 0x1 being from the stencil clear value),
- // where 's' is the number of bits in the stencil buffer
- //
- glStencilFunc( GL_EQUAL, 0x2, 0x1 );
- glStencilOp( GL_INVERT, GL_KEEP, GL_KEEP );
- glDrawElements( GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, indices[3] );
-
- // Since we don't know at compile time how many stecil bits are present,
- // we'll query, and update the value correct value in the
- // stencilValues arrays for the fourth tests. We'll use this value
- // later in rendering.
- glGetIntegerv( GL_STENCIL_BITS, &numStencilBits );
-
- stencilValues[3] = ~(((1 << numStencilBits) - 1) & 0x1) & 0xff;
-
- // Use the stencil buffer for controlling where rendering will
- // occur. We diable writing to the stencil buffer so we
- // can test against them without modifying the values we
- // generated.
- glStencilMask( 0x0 );
-
- for ( i = 0; i < NumTests; ++i )
- {
- glStencilFunc( GL_EQUAL, stencilValues[i], 0xff );
- glUniform4fv( userData->colorLoc, 1, colors[i] );
- glDrawElements( GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, indices[4] );
- }
-
- eglSwapBuffers ( esContext->eglDisplay, esContext->eglSurface );
-}
-
-///
-// Cleanup
-//
-void ShutDown ( ESContext *esContext )
-{
- UserData *userData = esContext->userData;
-
- // Delete program object
- glDeleteProgram ( userData->programObject );
-}
-
-
-int main ( int argc, char *argv[] )
-{
- ESContext esContext;
- UserData userData;
-
- esInitContext ( &esContext );
- esContext.userData = &userData;
-
- esCreateWindow ( &esContext, TEXT("Stencil Test"), 320, 240,
- ES_WINDOW_RGB | ES_WINDOW_DEPTH | ES_WINDOW_STENCIL );
-
- if ( !Init ( &esContext ) )
- return 0;
-
- esRegisterDrawFunc ( &esContext, Draw );
-
- esMainLoop ( &esContext );
-
- ShutDown ( &esContext );
-}
diff --git a/chromium/third_party/angle/samples/gles2_book/Stencil_Test/Stencil_Test.vcxproj b/chromium/third_party/angle/samples/gles2_book/Stencil_Test/Stencil_Test.vcxproj
deleted file mode 100644
index 8891553f600..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/Stencil_Test/Stencil_Test.vcxproj
+++ /dev/null
@@ -1,97 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{EEACE995-26BC-4D56-A8B3-3E7A9AB3EB26}</ProjectGuid>
- <RootNamespace>Stencil_Test</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>MultiByte</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>../Common;../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>../Common;../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="Stencil_Test.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\Common\esUtil.vcxproj">
- <Project>{47c93f52-ab4e-4ff9-8d4f-b38cd60a183f}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/chromium/third_party/angle/samples/gles2_book/TextureWrap/TextureWrap.c b/chromium/third_party/angle/samples/gles2_book/TextureWrap/TextureWrap.c
deleted file mode 100644
index 3e958ddf41b..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/TextureWrap/TextureWrap.c
+++ /dev/null
@@ -1,254 +0,0 @@
-//
-// Book: OpenGL(R) ES 2.0 Programming Guide
-// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
-// ISBN-10: 0321502795
-// ISBN-13: 9780321502797
-// Publisher: Addison-Wesley Professional
-// URLs: http://safari.informit.com/9780321563835
-// http://www.opengles-book.com
-//
-
-// TextureWrap.c
-//
-// This is an example that demonstrates the three texture
-// wrap modes available on 2D textures
-//
-#include <stdlib.h>
-#include "esUtil.h"
-
-typedef struct
-{
- // Handle to a program object
- GLuint programObject;
-
- // Attribute locations
- GLint positionLoc;
- GLint texCoordLoc;
-
- // Sampler location
- GLint samplerLoc;
-
- // Offset location
- GLint offsetLoc;
-
- // Texture handle
- GLuint textureId;
-
-} UserData;
-
-///
-// Generate an RGB8 checkerboard image
-//
-GLubyte* GenCheckImage( int width, int height, int checkSize )
-{
- int x,
- y;
- GLubyte *pixels = malloc( width * height * 3 );
-
- if ( pixels == NULL )
- return NULL;
-
- for ( y = 0; y < height; y++ )
- for ( x = 0; x < width; x++ )
- {
- GLubyte rColor = 0;
- GLubyte bColor = 0;
-
- if ( ( x / checkSize ) % 2 == 0 )
- {
- rColor = 255 * ( ( y / checkSize ) % 2 );
- bColor = 255 * ( 1 - ( ( y / checkSize ) % 2 ) );
- }
- else
- {
- bColor = 255 * ( ( y / checkSize ) % 2 );
- rColor = 255 * ( 1 - ( ( y / checkSize ) % 2 ) );
- }
-
- pixels[(y * height + x) * 3] = rColor;
- pixels[(y * height + x) * 3 + 1] = 0;
- pixels[(y * height + x) * 3 + 2] = bColor;
- }
-
- return pixels;
-}
-
-///
-// Create a mipmapped 2D texture image
-//
-GLuint CreateTexture2D( )
-{
- // Texture object handle
- GLuint textureId;
- int width = 256,
- height = 256;
- GLubyte *pixels;
-
- pixels = GenCheckImage( width, height, 64 );
- if ( pixels == NULL )
- return 0;
-
- // Generate a texture object
- glGenTextures ( 1, &textureId );
-
- // Bind the texture object
- glBindTexture ( GL_TEXTURE_2D, textureId );
-
- // Load mipmap level 0
- glTexImage2D ( GL_TEXTURE_2D, 0, GL_RGB, width, height,
- 0, GL_RGB, GL_UNSIGNED_BYTE, pixels );
-
- // Set the filtering mode
- glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
- glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
-
- return textureId;
-
-}
-
-
-///
-// Initialize the shader and program object
-//
-int Init ( ESContext *esContext )
-{
- UserData *userData = esContext->userData;
- GLbyte vShaderStr[] =
- "uniform float u_offset; \n"
- "attribute vec4 a_position; \n"
- "attribute vec2 a_texCoord; \n"
- "varying vec2 v_texCoord; \n"
- "void main() \n"
- "{ \n"
- " gl_Position = a_position; \n"
- " gl_Position.x += u_offset;\n"
- " v_texCoord = a_texCoord; \n"
- "} \n";
-
- GLbyte fShaderStr[] =
- "precision mediump float; \n"
- "varying vec2 v_texCoord; \n"
- "uniform sampler2D s_texture; \n"
- "void main() \n"
- "{ \n"
- " gl_FragColor = texture2D( s_texture, v_texCoord );\n"
- "} \n";
-
- // Load the shaders and get a linked program object
- userData->programObject = esLoadProgram ( vShaderStr, fShaderStr );
-
- // Get the attribute locations
- userData->positionLoc = glGetAttribLocation ( userData->programObject, "a_position" );
- userData->texCoordLoc = glGetAttribLocation ( userData->programObject, "a_texCoord" );
-
- // Get the sampler location
- userData->samplerLoc = glGetUniformLocation ( userData->programObject, "s_texture" );
-
- // Get the offset location
- userData->offsetLoc = glGetUniformLocation( userData->programObject, "u_offset" );
-
- // Load the texture
- userData->textureId = CreateTexture2D ();
-
- glClearColor ( 0.0f, 0.0f, 0.0f, 0.0f );
- return TRUE;
-}
-
-///
-// Draw a triangle using the shader pair created in Init()
-//
-void Draw ( ESContext *esContext )
-{
- UserData *userData = esContext->userData;
- GLfloat vVertices[] = { -0.3f, 0.3f, 0.0f, 1.0f, // Position 0
- -1.0f, -1.0f, // TexCoord 0
- -0.3f, -0.3f, 0.0f, 1.0f, // Position 1
- -1.0f, 2.0f, // TexCoord 1
- 0.3f, -0.3f, 0.0f, 1.0f, // Position 2
- 2.0f, 2.0f, // TexCoord 2
- 0.3f, 0.3f, 0.0f, 1.0f, // Position 3
- 2.0f, -1.0f // TexCoord 3
- };
- GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
-
- // Set the viewport
- glViewport ( 0, 0, esContext->width, esContext->height );
-
- // Clear the color buffer
- glClear ( GL_COLOR_BUFFER_BIT );
-
- // Use the program object
- glUseProgram ( userData->programObject );
-
- // Load the vertex position
- glVertexAttribPointer ( userData->positionLoc, 4, GL_FLOAT,
- GL_FALSE, 6 * sizeof(GLfloat), vVertices );
- // Load the texture coordinate
- glVertexAttribPointer ( userData->texCoordLoc, 2, GL_FLOAT,
- GL_FALSE, 6 * sizeof(GLfloat), &vVertices[4] );
-
- glEnableVertexAttribArray ( userData->positionLoc );
- glEnableVertexAttribArray ( userData->texCoordLoc );
-
- // Bind the texture
- glActiveTexture ( GL_TEXTURE0 );
- glBindTexture ( GL_TEXTURE_2D, userData->textureId );
-
- // Set the sampler texture unit to 0
- glUniform1i ( userData->samplerLoc, 0 );
-
- // Draw quad with repeat wrap mode
- glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
- glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
- glUniform1f ( userData->offsetLoc, -0.7f );
- glDrawElements ( GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices );
-
- // Draw quad with clamp to edge wrap mode
- glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
- glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
- glUniform1f ( userData->offsetLoc, 0.0f );
- glDrawElements ( GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices );
-
- // Draw quad with mirrored repeat
- glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT );
- glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT );
- glUniform1f ( userData->offsetLoc, 0.7f );
- glDrawElements ( GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices );
-
- eglSwapBuffers ( esContext->eglDisplay, esContext->eglSurface );
-}
-
-///
-// Cleanup
-//
-void ShutDown ( ESContext *esContext )
-{
- UserData *userData = esContext->userData;
-
- // Delete texture object
- glDeleteTextures ( 1, &userData->textureId );
-
- // Delete program object
- glDeleteProgram ( userData->programObject );
-}
-
-
-int main ( int argc, char *argv[] )
-{
- ESContext esContext;
- UserData userData;
-
- esInitContext ( &esContext );
- esContext.userData = &userData;
-
- esCreateWindow ( &esContext, TEXT("Texture Wrap"), 640, 480, ES_WINDOW_RGB );
-
- if ( !Init ( &esContext ) )
- return 0;
-
- esRegisterDrawFunc ( &esContext, Draw );
-
- esMainLoop ( &esContext );
-
- ShutDown ( &esContext );
-}
diff --git a/chromium/third_party/angle/samples/gles2_book/TextureWrap/TextureWrap.vcxproj b/chromium/third_party/angle/samples/gles2_book/TextureWrap/TextureWrap.vcxproj
deleted file mode 100644
index eff3e1176ce..00000000000
--- a/chromium/third_party/angle/samples/gles2_book/TextureWrap/TextureWrap.vcxproj
+++ /dev/null
@@ -1,105 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{CC1DE9A2-B456-4565-9C21-932253E969B9}</ProjectGuid>
- <RootNamespace>TextureWrap</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>NotSet</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>NotSet</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
- <EmbedManifest Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</EmbedManifest>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>../Common;../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>../Common;../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="TextureWrap.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\Common\esUtil.vcxproj">
- <Project>{47c93f52-ab4e-4ff9-8d4f-b38cd60a183f}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/chromium/third_party/angle/samples/samples.gyp b/chromium/third_party/angle/samples/samples.gyp
new file mode 100644
index 00000000000..9f85ce1fd82
--- /dev/null
+++ b/chromium/third_party/angle/samples/samples.gyp
@@ -0,0 +1,199 @@
+# Copyright (c) 2010 The ANGLE Project Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets':
+ [
+ {
+ 'target_name': 'essl_to_glsl',
+ 'type': 'executable',
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'dependencies': [ '../src/angle.gyp:translator_static', ],
+ 'include_dirs': [ '../include', ],
+ 'sources': [ '<!@(python <(angle_path)/enumerate_files.py translator -types *.cpp *.h)' ],
+ },
+ ],
+ 'conditions':
+ [
+ ['OS=="win"',
+ {
+ 'targets':
+ [
+ {
+ 'target_name': 'essl_to_hlsl',
+ 'type': 'executable',
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'dependencies': [ '../src/angle.gyp:translator_static', ],
+ 'include_dirs':
+ [
+ '../include',
+ '../src',
+ ],
+ 'sources':
+ [
+ '<!@(python <(angle_path)/enumerate_files.py translator -types *.cpp *.h)',
+ ],
+ },
+
+ {
+ 'target_name': 'dds_to_header',
+ 'type': 'executable',
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'sources':
+ [
+ '<!@(python <(angle_path)/enumerate_files.py dds_to_header -types *.cpp)',
+ ],
+ },
+
+ {
+ 'target_name': 'sample_util',
+ 'type': 'static_library',
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'dependencies':
+ [
+ '../src/angle.gyp:libEGL',
+ '../src/angle.gyp:libGLESv2',
+ ],
+ 'include_dirs':
+ [
+ '../include',
+ 'angle/sample_util',
+ ],
+ 'sources':
+ [
+ '<!@(python <(angle_path)/enumerate_files.py angle/sample_util -types *.cpp *.h)'
+ ],
+ 'msvs_disabled_warnings': [ 4201 ],
+ 'direct_dependent_settings':
+ {
+ 'msvs_disabled_warnings': [ 4201 ],
+ 'include_dirs':
+ [
+ '../include',
+ 'angle/sample_util',
+ ],
+ },
+ },
+
+ {
+ 'target_name': 'hello_triangle',
+ 'type': 'executable',
+ 'dependencies': [ 'sample_util' ],
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'sources': [ '<!@(python <(angle_path)/enumerate_files.py angle/hello_triangle -types *.cpp *.h)' ],
+ },
+
+ {
+ 'target_name': 'mip_map_2d',
+ 'type': 'executable',
+ 'dependencies': [ 'sample_util' ],
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'sources': [ '<!@(python <(angle_path)/enumerate_files.py angle/mip_map_2d -types *.cpp *.h)' ],
+ },
+
+ {
+ 'target_name': 'multi_texture',
+ 'type': 'executable',
+ 'dependencies': [ 'sample_util' ],
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'sources': [ '<!@(python <(angle_path)/enumerate_files.py angle/multi_texture -types *.cpp *.h)' ],
+ 'copies':
+ [
+ {
+ 'destination': '<(PRODUCT_DIR)',
+ 'files': [ '<!@(python <(angle_path)/enumerate_files.py angle/multi_texture -types *.tga)' ],
+ },
+ ]
+ },
+
+ {
+ 'target_name': 'particle_system',
+ 'type': 'executable',
+ 'dependencies': [ 'sample_util' ],
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'sources': [ '<!@(python <(angle_path)/enumerate_files.py angle/particle_system -types *.cpp *.h)' ],
+ 'copies':
+ [
+ {
+ 'destination': '<(PRODUCT_DIR)',
+ 'files': [ '<!@(python <(angle_path)/enumerate_files.py angle/particle_system -types *.tga)' ],
+ }
+ ]
+ },
+
+ {
+ 'target_name': 'simple_instancing',
+ 'type': 'executable',
+ 'dependencies': [ 'sample_util' ],
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'sources': [ '<!@(python <(angle_path)/enumerate_files.py angle/simple_instancing -types *.cpp *.h)' ],
+ },
+
+ {
+ 'target_name': 'multiple_draw_buffers',
+ 'type': 'executable',
+ 'dependencies': [ 'sample_util' ],
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'sources': [ '<!@(python <(angle_path)/enumerate_files.py angle/multiple_draw_buffers -types *.cpp *.h *.glsl)' ],
+ 'copies':
+ [
+ {
+ 'destination': '<(PRODUCT_DIR)',
+ 'files': [ '<!@(python <(angle_path)/enumerate_files.py angle/multiple_draw_buffers -types *.glsl)' ],
+ }
+ ]
+ },
+
+ {
+ 'target_name': 'simple_texture_2d',
+ 'type': 'executable',
+ 'dependencies': [ 'sample_util' ],
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'sources': [ '<!@(python <(angle_path)/enumerate_files.py angle/simple_texture_2d -types *.cpp *.h)' ],
+ },
+
+ {
+ 'target_name': 'simple_texture_cubemap',
+ 'type': 'executable',
+ 'dependencies': [ 'sample_util' ],
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'sources': [ '<!@(python <(angle_path)/enumerate_files.py angle/simple_texture_cubemap -types *.cpp *.h)' ],
+ },
+
+ {
+ 'target_name': 'simple_vertex_shader',
+ 'type': 'executable',
+ 'dependencies': [ 'sample_util' ],
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'sources': [ '<!@(python <(angle_path)/enumerate_files.py angle/simple_vertex_shader -types *.cpp *.h)' ],
+ },
+
+ {
+ 'target_name': 'stencil_operations',
+ 'type': 'executable',
+ 'dependencies': [ 'sample_util' ],
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'sources': [ '<!@(python <(angle_path)/enumerate_files.py angle/stencil_operations -types *.cpp *.h)' ],
+ },
+
+ {
+ 'target_name': 'texture_wrap',
+ 'type': 'executable',
+ 'dependencies': [ 'sample_util' ],
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'sources': [ '<!@(python <(angle_path)/enumerate_files.py angle/texture_wrap -types *.cpp *.h)' ],
+ },
+
+ {
+ 'target_name': 'post_sub_buffer',
+ 'type': 'executable',
+ 'dependencies': [ 'sample_util' ],
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'sources': [ '<!@(python <(angle_path)/enumerate_files.py angle/post_sub_buffer -types *.cpp *.h)' ],
+ },
+ ],
+ }
+ ],
+ ],
+}
diff --git a/chromium/third_party/angle/samples/samples.sln b/chromium/third_party/angle/samples/samples.sln
deleted file mode 100644
index 9e0ab1f74a6..00000000000
--- a/chromium/third_party/angle/samples/samples.sln
+++ /dev/null
@@ -1,167 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual C++ Express 2010
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "esUtil", "gles2_book\Common\esUtil.vcxproj", "{47C93F52-AB4E-4FF9-8D4F-B38CD60A183F}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Hello_Triangle", "gles2_book\Hello_Triangle\Hello_Triangle.vcxproj", "{8278251F-6C1F-4D80-8499-FA7B590FAFE6}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MipMap2D", "gles2_book\MipMap2D\MipMap2D.vcxproj", "{4E69AC1F-1C7A-4D58-917C-E764FBEB489A}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MultiTexture", "gles2_book\MultiTexture\MultiTexture.vcxproj", "{120CFF94-ED4B-4C5B-9587-9E40889F15F7}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ParticleSystem", "gles2_book\ParticleSystem\ParticleSystem.vcxproj", "{B9E5BFFC-D843-4E0E-9D3E-23913A613473}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Simple_Texture2D", "gles2_book\Simple_Texture2D\Simple_Texture2D.vcxproj", "{2E54D748-781B-4DF2-A1DD-B9384A821810}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Simple_TextureCubemap", "gles2_book\Simple_TextureCubemap\Simple_TextureCubemap.vcxproj", "{5EE56061-643D-406E-B42D-4299D2411056}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Simple_VertexShader", "gles2_book\Simple_VertexShader\Simple_VertexShader.vcxproj", "{667CE95F-5DD8-4395-8C18-5CA8A175B12D}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Stencil_Test", "gles2_book\Stencil_Test\Stencil_Test.vcxproj", "{EEACE995-26BC-4D56-A8B3-3E7A9AB3EB26}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TextureWrap", "gles2_book\TextureWrap\TextureWrap.vcxproj", "{CC1DE9A2-B456-4565-9C21-932253E969B9}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libEGL", "..\src\libEGL\libEGL.vcxproj", "{E746FCA9-64C3-433E-85E8-9A5A67AB7ED6}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libGLESv2", "..\src\libGLESv2\libGLESv2.vcxproj", "{B5871A7A-968C-42E3-A33B-981E6F448E78}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "essl_to_hlsl", "translator\essl_to_hlsl.vcxproj", "{E12EA115-EBC7-47C2-B651-30A0CE986025}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PostSubBuffer", "gles2_book\PostSubBuffer\PostSubBuffer.vcxproj", "{667CE95F-5DD8-4495-8C18-5CA8A175B12D}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "preprocessor", "..\src\compiler\preprocessor\preprocessor.vcxproj", "{FBE32DF3-0FB0-4F2F-A424-2C21BD7BC325}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Simple_Instancing", "angle\Simple_Instancing\Simple_Instancing.vcxproj", "{EB6E138B-9DE5-41E8-A127-3675AA2BA607}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MultipleRenderTargets", "gles2_book\MultipleRenderTargets\MultipleRenderTargets.vcxproj", "{DD670DCB-2554-4FAE-B7C9-D7F0C3087C10}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "translator", "..\src\compiler\translator.vcxproj", "{5B3A6DB8-1E7E-40D7-92B9-DA8AAE619FAD}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Debug|x64 = Debug|x64
- Release|Win32 = Release|Win32
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {47C93F52-AB4E-4FF9-8D4F-B38CD60A183F}.Debug|Win32.ActiveCfg = Debug|Win32
- {47C93F52-AB4E-4FF9-8D4F-B38CD60A183F}.Debug|Win32.Build.0 = Debug|Win32
- {47C93F52-AB4E-4FF9-8D4F-B38CD60A183F}.Debug|x64.ActiveCfg = Debug|Win32
- {47C93F52-AB4E-4FF9-8D4F-B38CD60A183F}.Release|Win32.ActiveCfg = Release|Win32
- {47C93F52-AB4E-4FF9-8D4F-B38CD60A183F}.Release|Win32.Build.0 = Release|Win32
- {47C93F52-AB4E-4FF9-8D4F-B38CD60A183F}.Release|x64.ActiveCfg = Release|Win32
- {8278251F-6C1F-4D80-8499-FA7B590FAFE6}.Debug|Win32.ActiveCfg = Debug|Win32
- {8278251F-6C1F-4D80-8499-FA7B590FAFE6}.Debug|Win32.Build.0 = Debug|Win32
- {8278251F-6C1F-4D80-8499-FA7B590FAFE6}.Debug|x64.ActiveCfg = Debug|Win32
- {8278251F-6C1F-4D80-8499-FA7B590FAFE6}.Release|Win32.ActiveCfg = Release|Win32
- {8278251F-6C1F-4D80-8499-FA7B590FAFE6}.Release|Win32.Build.0 = Release|Win32
- {8278251F-6C1F-4D80-8499-FA7B590FAFE6}.Release|x64.ActiveCfg = Release|Win32
- {4E69AC1F-1C7A-4D58-917C-E764FBEB489A}.Debug|Win32.ActiveCfg = Debug|Win32
- {4E69AC1F-1C7A-4D58-917C-E764FBEB489A}.Debug|Win32.Build.0 = Debug|Win32
- {4E69AC1F-1C7A-4D58-917C-E764FBEB489A}.Debug|x64.ActiveCfg = Debug|Win32
- {4E69AC1F-1C7A-4D58-917C-E764FBEB489A}.Release|Win32.ActiveCfg = Release|Win32
- {4E69AC1F-1C7A-4D58-917C-E764FBEB489A}.Release|Win32.Build.0 = Release|Win32
- {4E69AC1F-1C7A-4D58-917C-E764FBEB489A}.Release|x64.ActiveCfg = Release|Win32
- {120CFF94-ED4B-4C5B-9587-9E40889F15F7}.Debug|Win32.ActiveCfg = Debug|Win32
- {120CFF94-ED4B-4C5B-9587-9E40889F15F7}.Debug|Win32.Build.0 = Debug|Win32
- {120CFF94-ED4B-4C5B-9587-9E40889F15F7}.Debug|x64.ActiveCfg = Debug|Win32
- {120CFF94-ED4B-4C5B-9587-9E40889F15F7}.Release|Win32.ActiveCfg = Release|Win32
- {120CFF94-ED4B-4C5B-9587-9E40889F15F7}.Release|Win32.Build.0 = Release|Win32
- {120CFF94-ED4B-4C5B-9587-9E40889F15F7}.Release|x64.ActiveCfg = Release|Win32
- {B9E5BFFC-D843-4E0E-9D3E-23913A613473}.Debug|Win32.ActiveCfg = Debug|Win32
- {B9E5BFFC-D843-4E0E-9D3E-23913A613473}.Debug|Win32.Build.0 = Debug|Win32
- {B9E5BFFC-D843-4E0E-9D3E-23913A613473}.Debug|x64.ActiveCfg = Debug|Win32
- {B9E5BFFC-D843-4E0E-9D3E-23913A613473}.Release|Win32.ActiveCfg = Release|Win32
- {B9E5BFFC-D843-4E0E-9D3E-23913A613473}.Release|Win32.Build.0 = Release|Win32
- {B9E5BFFC-D843-4E0E-9D3E-23913A613473}.Release|x64.ActiveCfg = Release|Win32
- {2E54D748-781B-4DF2-A1DD-B9384A821810}.Debug|Win32.ActiveCfg = Debug|Win32
- {2E54D748-781B-4DF2-A1DD-B9384A821810}.Debug|Win32.Build.0 = Debug|Win32
- {2E54D748-781B-4DF2-A1DD-B9384A821810}.Debug|x64.ActiveCfg = Debug|Win32
- {2E54D748-781B-4DF2-A1DD-B9384A821810}.Release|Win32.ActiveCfg = Release|Win32
- {2E54D748-781B-4DF2-A1DD-B9384A821810}.Release|Win32.Build.0 = Release|Win32
- {2E54D748-781B-4DF2-A1DD-B9384A821810}.Release|x64.ActiveCfg = Release|Win32
- {5EE56061-643D-406E-B42D-4299D2411056}.Debug|Win32.ActiveCfg = Debug|Win32
- {5EE56061-643D-406E-B42D-4299D2411056}.Debug|Win32.Build.0 = Debug|Win32
- {5EE56061-643D-406E-B42D-4299D2411056}.Debug|x64.ActiveCfg = Debug|Win32
- {5EE56061-643D-406E-B42D-4299D2411056}.Release|Win32.ActiveCfg = Release|Win32
- {5EE56061-643D-406E-B42D-4299D2411056}.Release|Win32.Build.0 = Release|Win32
- {5EE56061-643D-406E-B42D-4299D2411056}.Release|x64.ActiveCfg = Release|Win32
- {667CE95F-5DD8-4395-8C18-5CA8A175B12D}.Debug|Win32.ActiveCfg = Debug|Win32
- {667CE95F-5DD8-4395-8C18-5CA8A175B12D}.Debug|Win32.Build.0 = Debug|Win32
- {667CE95F-5DD8-4395-8C18-5CA8A175B12D}.Debug|x64.ActiveCfg = Debug|Win32
- {667CE95F-5DD8-4395-8C18-5CA8A175B12D}.Release|Win32.ActiveCfg = Release|Win32
- {667CE95F-5DD8-4395-8C18-5CA8A175B12D}.Release|Win32.Build.0 = Release|Win32
- {667CE95F-5DD8-4395-8C18-5CA8A175B12D}.Release|x64.ActiveCfg = Release|Win32
- {EEACE995-26BC-4D56-A8B3-3E7A9AB3EB26}.Debug|Win32.ActiveCfg = Debug|Win32
- {EEACE995-26BC-4D56-A8B3-3E7A9AB3EB26}.Debug|Win32.Build.0 = Debug|Win32
- {EEACE995-26BC-4D56-A8B3-3E7A9AB3EB26}.Debug|x64.ActiveCfg = Debug|Win32
- {EEACE995-26BC-4D56-A8B3-3E7A9AB3EB26}.Release|Win32.ActiveCfg = Release|Win32
- {EEACE995-26BC-4D56-A8B3-3E7A9AB3EB26}.Release|Win32.Build.0 = Release|Win32
- {EEACE995-26BC-4D56-A8B3-3E7A9AB3EB26}.Release|x64.ActiveCfg = Release|Win32
- {CC1DE9A2-B456-4565-9C21-932253E969B9}.Debug|Win32.ActiveCfg = Debug|Win32
- {CC1DE9A2-B456-4565-9C21-932253E969B9}.Debug|Win32.Build.0 = Debug|Win32
- {CC1DE9A2-B456-4565-9C21-932253E969B9}.Debug|x64.ActiveCfg = Debug|Win32
- {CC1DE9A2-B456-4565-9C21-932253E969B9}.Release|Win32.ActiveCfg = Release|Win32
- {CC1DE9A2-B456-4565-9C21-932253E969B9}.Release|Win32.Build.0 = Release|Win32
- {CC1DE9A2-B456-4565-9C21-932253E969B9}.Release|x64.ActiveCfg = Release|Win32
- {E746FCA9-64C3-433E-85E8-9A5A67AB7ED6}.Debug|Win32.ActiveCfg = Debug|Win32
- {E746FCA9-64C3-433E-85E8-9A5A67AB7ED6}.Debug|Win32.Build.0 = Debug|Win32
- {E746FCA9-64C3-433E-85E8-9A5A67AB7ED6}.Debug|x64.ActiveCfg = Debug|x64
- {E746FCA9-64C3-433E-85E8-9A5A67AB7ED6}.Debug|x64.Build.0 = Debug|x64
- {E746FCA9-64C3-433E-85E8-9A5A67AB7ED6}.Release|Win32.ActiveCfg = Release|Win32
- {E746FCA9-64C3-433E-85E8-9A5A67AB7ED6}.Release|Win32.Build.0 = Release|Win32
- {E746FCA9-64C3-433E-85E8-9A5A67AB7ED6}.Release|x64.ActiveCfg = Release|x64
- {E746FCA9-64C3-433E-85E8-9A5A67AB7ED6}.Release|x64.Build.0 = Release|x64
- {B5871A7A-968C-42E3-A33B-981E6F448E78}.Debug|Win32.ActiveCfg = Debug|Win32
- {B5871A7A-968C-42E3-A33B-981E6F448E78}.Debug|Win32.Build.0 = Debug|Win32
- {B5871A7A-968C-42E3-A33B-981E6F448E78}.Debug|x64.ActiveCfg = Debug|x64
- {B5871A7A-968C-42E3-A33B-981E6F448E78}.Debug|x64.Build.0 = Debug|x64
- {B5871A7A-968C-42E3-A33B-981E6F448E78}.Release|Win32.ActiveCfg = Release|Win32
- {B5871A7A-968C-42E3-A33B-981E6F448E78}.Release|Win32.Build.0 = Release|Win32
- {B5871A7A-968C-42E3-A33B-981E6F448E78}.Release|x64.ActiveCfg = Release|x64
- {B5871A7A-968C-42E3-A33B-981E6F448E78}.Release|x64.Build.0 = Release|x64
- {E12EA115-EBC7-47C2-B651-30A0CE986025}.Debug|Win32.ActiveCfg = Debug|Win32
- {E12EA115-EBC7-47C2-B651-30A0CE986025}.Debug|Win32.Build.0 = Debug|Win32
- {E12EA115-EBC7-47C2-B651-30A0CE986025}.Debug|x64.ActiveCfg = Debug|Win32
- {E12EA115-EBC7-47C2-B651-30A0CE986025}.Release|Win32.ActiveCfg = Release|Win32
- {E12EA115-EBC7-47C2-B651-30A0CE986025}.Release|Win32.Build.0 = Release|Win32
- {E12EA115-EBC7-47C2-B651-30A0CE986025}.Release|x64.ActiveCfg = Release|Win32
- {667CE95F-5DD8-4495-8C18-5CA8A175B12D}.Debug|Win32.ActiveCfg = Debug|Win32
- {667CE95F-5DD8-4495-8C18-5CA8A175B12D}.Debug|Win32.Build.0 = Debug|Win32
- {667CE95F-5DD8-4495-8C18-5CA8A175B12D}.Debug|x64.ActiveCfg = Debug|Win32
- {667CE95F-5DD8-4495-8C18-5CA8A175B12D}.Release|Win32.ActiveCfg = Release|Win32
- {667CE95F-5DD8-4495-8C18-5CA8A175B12D}.Release|Win32.Build.0 = Release|Win32
- {667CE95F-5DD8-4495-8C18-5CA8A175B12D}.Release|x64.ActiveCfg = Release|Win32
- {FBE32DF3-0FB0-4F2F-A424-2C21BD7BC325}.Debug|Win32.ActiveCfg = Debug|Win32
- {FBE32DF3-0FB0-4F2F-A424-2C21BD7BC325}.Debug|Win32.Build.0 = Debug|Win32
- {FBE32DF3-0FB0-4F2F-A424-2C21BD7BC325}.Debug|x64.ActiveCfg = Debug|x64
- {FBE32DF3-0FB0-4F2F-A424-2C21BD7BC325}.Debug|x64.Build.0 = Debug|x64
- {FBE32DF3-0FB0-4F2F-A424-2C21BD7BC325}.Release|Win32.ActiveCfg = Release|Win32
- {FBE32DF3-0FB0-4F2F-A424-2C21BD7BC325}.Release|Win32.Build.0 = Release|Win32
- {FBE32DF3-0FB0-4F2F-A424-2C21BD7BC325}.Release|x64.ActiveCfg = Release|x64
- {FBE32DF3-0FB0-4F2F-A424-2C21BD7BC325}.Release|x64.Build.0 = Release|x64
- {EB6E138B-9DE5-41E8-A127-3675AA2BA607}.Debug|Win32.ActiveCfg = Debug|Win32
- {EB6E138B-9DE5-41E8-A127-3675AA2BA607}.Debug|Win32.Build.0 = Debug|Win32
- {EB6E138B-9DE5-41E8-A127-3675AA2BA607}.Debug|x64.ActiveCfg = Debug|Win32
- {EB6E138B-9DE5-41E8-A127-3675AA2BA607}.Release|Win32.ActiveCfg = Release|Win32
- {EB6E138B-9DE5-41E8-A127-3675AA2BA607}.Release|Win32.Build.0 = Release|Win32
- {EB6E138B-9DE5-41E8-A127-3675AA2BA607}.Release|x64.ActiveCfg = Release|Win32
- {DD670DCB-2554-4FAE-B7C9-D7F0C3087C10}.Debug|Win32.ActiveCfg = Debug|Win32
- {DD670DCB-2554-4FAE-B7C9-D7F0C3087C10}.Debug|Win32.Build.0 = Debug|Win32
- {DD670DCB-2554-4FAE-B7C9-D7F0C3087C10}.Debug|x64.ActiveCfg = Debug|Win32
- {DD670DCB-2554-4FAE-B7C9-D7F0C3087C10}.Release|Win32.ActiveCfg = Release|Win32
- {DD670DCB-2554-4FAE-B7C9-D7F0C3087C10}.Release|Win32.Build.0 = Release|Win32
- {DD670DCB-2554-4FAE-B7C9-D7F0C3087C10}.Release|x64.ActiveCfg = Release|Win32
- {5B3A6DB8-1E7E-40D7-92B9-DA8AAE619FAD}.Debug|Win32.ActiveCfg = Debug|Win32
- {5B3A6DB8-1E7E-40D7-92B9-DA8AAE619FAD}.Debug|Win32.Build.0 = Debug|Win32
- {5B3A6DB8-1E7E-40D7-92B9-DA8AAE619FAD}.Debug|x64.ActiveCfg = Debug|x64
- {5B3A6DB8-1E7E-40D7-92B9-DA8AAE619FAD}.Debug|x64.Build.0 = Debug|x64
- {5B3A6DB8-1E7E-40D7-92B9-DA8AAE619FAD}.Release|Win32.ActiveCfg = Release|Win32
- {5B3A6DB8-1E7E-40D7-92B9-DA8AAE619FAD}.Release|Win32.Build.0 = Release|Win32
- {5B3A6DB8-1E7E-40D7-92B9-DA8AAE619FAD}.Release|x64.ActiveCfg = Release|x64
- {5B3A6DB8-1E7E-40D7-92B9-DA8AAE619FAD}.Release|x64.Build.0 = Release|x64
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/chromium/third_party/angle/samples/translator/essl_to_glsl.vcproj b/chromium/third_party/angle/samples/translator/essl_to_glsl.vcproj
deleted file mode 100644
index 027632cae5c..00000000000
--- a/chromium/third_party/angle/samples/translator/essl_to_glsl.vcproj
+++ /dev/null
@@ -1,193 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="essl_to_glsl"
- ProjectGUID="{EADEBCCD-65ED-45D1-9E06-949A21EBAB9E}"
- RootNamespace="essl_to_glsl"
- Keyword="Win32Proj"
- TargetFrameworkVersion="196613"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../include"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- EnableIntrinsicFunctions="true"
- AdditionalIncludeDirectories="../../include"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
- RuntimeLibrary="0"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\src\common\debug.cpp"
- >
- </File>
- <File
- RelativePath=".\translator.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/chromium/third_party/angle/samples/translator/essl_to_hlsl.vcxproj b/chromium/third_party/angle/samples/translator/essl_to_hlsl.vcxproj
deleted file mode 100644
index de6a6a74455..00000000000
--- a/chromium/third_party/angle/samples/translator/essl_to_hlsl.vcxproj
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{E12EA115-EBC7-47C2-B651-30A0CE986025}</ProjectGuid>
- <RootNamespace>essl_to_hlsl</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>../../include;../../src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalDependencies>d3d9.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <Optimization>MaxSpeed</Optimization>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <AdditionalIncludeDirectories>../../include;../../src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalDependencies>d3d9.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="..\..\src\common\debug.cpp" />
- <ClCompile Include="translator.cpp" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\src\compiler\preprocessor\preprocessor.vcxproj">
- <Project>{fbe32df3-0fb0-4f2f-a424-2c21bd7bc325}</Project>
- </ProjectReference>
- <ProjectReference Include="..\..\src\compiler\translator.vcxproj">
- <Project>{5b3a6db8-1e7e-40d7-92b9-da8aae619fad}</Project>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/chromium/third_party/angle/samples/translator/essl_to_hlsl.vcxproj.filters b/chromium/third_party/angle/samples/translator/essl_to_hlsl.vcxproj.filters
deleted file mode 100644
index ddfed9fff8e..00000000000
--- a/chromium/third_party/angle/samples/translator/essl_to_hlsl.vcxproj.filters
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="Header Files">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\..\src\common\debug.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="translator.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/chromium/third_party/angle/samples/translator/translator.cpp b/chromium/third_party/angle/samples/translator/translator.cpp
index 81fcfa3ee8d..8d0696c97a4 100644
--- a/chromium/third_party/angle/samples/translator/translator.cpp
+++ b/chromium/third_party/angle/samples/translator/translator.cpp
@@ -27,7 +27,7 @@ static void usage();
static ShShaderType FindShaderType(const char* fileName);
static bool CompileFile(char* fileName, ShHandle compiler, int compileOptions);
static void LogMsg(const char* msg, const char* name, const int num, const char* logName);
-static void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType, bool mapLongVariableNames);
+static void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType);
// If NUM_SOURCE_STRINGS is set to a value > 1, the input file data is
// broken into that many chunks.
@@ -66,7 +66,6 @@ int main(int argc, char* argv[])
ShHandle fragmentCompiler = 0;
char* buffer = 0;
size_t bufferLen = 0;
- int numAttribs = 0, numUniforms = 0;
ShShaderSpec spec = SH_GLES2_SPEC;
ShShaderOutput output = SH_ESSL_OUTPUT;
@@ -81,7 +80,6 @@ int main(int argc, char* argv[])
if (argv[0][0] == '-') {
switch (argv[0][1]) {
case 'i': compileOptions |= SH_INTERMEDIATE_TREE; break;
- case 'm': compileOptions |= SH_MAP_LONG_VARIABLE_NAMES; break;
case 'o': compileOptions |= SH_OBJECT_CODE; break;
case 'u': compileOptions |= SH_VARIABLES; break;
case 'l': compileOptions |= SH_UNROLL_FOR_LOOP_WITH_INTEGER_INDEX; break;
@@ -127,6 +125,7 @@ int main(int argc, char* argv[])
case 'i': resources.OES_EGL_image_external = 1; break;
case 'd': resources.OES_standard_derivatives = 1; break;
case 'r': resources.ARB_texture_rectangle = 1; break;
+ case 'l': resources.EXT_shader_texture_lod = 1; break;
default: failCode = EFailUsage;
}
} else {
@@ -174,12 +173,12 @@ int main(int argc, char* argv[])
}
if (compiled && (compileOptions & SH_VARIABLES)) {
LogMsg("BEGIN", "COMPILER", numCompiles, "ACTIVE ATTRIBS");
- PrintActiveVariables(compiler, SH_ACTIVE_ATTRIBUTES, (compileOptions & SH_MAP_LONG_VARIABLE_NAMES) != 0);
+ PrintActiveVariables(compiler, SH_ACTIVE_ATTRIBUTES);
LogMsg("END", "COMPILER", numCompiles, "ACTIVE ATTRIBS");
printf("\n\n");
LogMsg("BEGIN", "COMPILER", numCompiles, "ACTIVE UNIFORMS");
- PrintActiveVariables(compiler, SH_ACTIVE_UNIFORMS, (compileOptions & SH_MAP_LONG_VARIABLE_NAMES) != 0);
+ PrintActiveVariables(compiler, SH_ACTIVE_UNIFORMS);
LogMsg("END", "COMPILER", numCompiles, "ACTIVE UNIFORMS");
printf("\n\n");
}
@@ -232,7 +231,8 @@ void usage()
" -b=h11 : output HLSL11 code\n"
" -x=i : enable GL_OES_EGL_image_external\n"
" -x=d : enable GL_OES_EGL_standard_derivatives\n"
- " -x=r : enable ARB_texture_rectangle\n");
+ " -x=r : enable ARB_texture_rectangle\n"
+ " -x=l : enable EXT_shader_texture_lod\n");
}
//
@@ -280,7 +280,7 @@ void LogMsg(const char* msg, const char* name, const int num, const char* logNam
printf("#### %s %s %d %s ####\n", msg, name, num, logName);
}
-void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType, bool mapLongVariableNames)
+void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType)
{
size_t nameSize = 0;
switch (varType) {
@@ -295,13 +295,6 @@ void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType, bool mapLongV
if (nameSize <= 1) return;
char* name = new char[nameSize];
- char* mappedName = NULL;
- if (mapLongVariableNames) {
- size_t mappedNameSize = 0;
- ShGetInfo(compiler, SH_MAPPED_NAME_MAX_LENGTH, &mappedNameSize);
- mappedName = new char[mappedNameSize];
- }
-
size_t activeVars = 0;
int size = 0;
ShDataType type = SH_NONE;
@@ -312,10 +305,10 @@ void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType, bool mapLongV
for (size_t i = 0; i < activeVars; ++i) {
switch (varType) {
case SH_ACTIVE_ATTRIBUTES:
- ShGetVariableInfo(compiler, SH_ACTIVE_ATTRIBUTES, static_cast<int>(i), NULL, &size, &type, &precision, &staticUse, name, mappedName);
+ ShGetVariableInfo(compiler, SH_ACTIVE_ATTRIBUTES, static_cast<int>(i), NULL, &size, &type, &precision, &staticUse, name, NULL);
break;
case SH_ACTIVE_UNIFORMS:
- ShGetVariableInfo(compiler, SH_ACTIVE_UNIFORMS, static_cast<int>(i), NULL, &size, &type, &precision, &staticUse, name, mappedName);
+ ShGetVariableInfo(compiler, SH_ACTIVE_UNIFORMS, static_cast<int>(i), NULL, &size, &type, &precision, &staticUse, name, NULL);
break;
default: assert(0);
}
@@ -328,6 +321,10 @@ void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType, bool mapLongV
case SH_INT_VEC2: typeName = "GL_INT_VEC2"; break;
case SH_INT_VEC3: typeName = "GL_INT_VEC3"; break;
case SH_INT_VEC4: typeName = "GL_INT_VEC4"; break;
+ case SH_UNSIGNED_INT: typeName = "GL_UNSIGNED_INT"; break;
+ case SH_UNSIGNED_INT_VEC2: typeName = "GL_UNSIGNED_INT_VEC2"; break;
+ case SH_UNSIGNED_INT_VEC3: typeName = "GL_UNSIGNED_INT_VEC3"; break;
+ case SH_UNSIGNED_INT_VEC4: typeName = "GL_UNSIGNED_INT_VEC4"; break;
case SH_BOOL: typeName = "GL_BOOL"; break;
case SH_BOOL_VEC2: typeName = "GL_BOOL_VEC2"; break;
case SH_BOOL_VEC3: typeName = "GL_BOOL_VEC3"; break;
@@ -335,19 +332,20 @@ void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType, bool mapLongV
case SH_FLOAT_MAT2: typeName = "GL_FLOAT_MAT2"; break;
case SH_FLOAT_MAT3: typeName = "GL_FLOAT_MAT3"; break;
case SH_FLOAT_MAT4: typeName = "GL_FLOAT_MAT4"; break;
+ case SH_FLOAT_MAT2x3: typeName = "GL_FLOAT_MAT2x3"; break;
+ case SH_FLOAT_MAT3x2: typeName = "GL_FLOAT_MAT3x2"; break;
+ case SH_FLOAT_MAT4x2: typeName = "GL_FLOAT_MAT4x2"; break;
+ case SH_FLOAT_MAT2x4: typeName = "GL_FLOAT_MAT2x4"; break;
+ case SH_FLOAT_MAT3x4: typeName = "GL_FLOAT_MAT3x4"; break;
+ case SH_FLOAT_MAT4x3: typeName = "GL_FLOAT_MAT4x3"; break;
case SH_SAMPLER_2D: typeName = "GL_SAMPLER_2D"; break;
case SH_SAMPLER_CUBE: typeName = "GL_SAMPLER_CUBE"; break;
case SH_SAMPLER_EXTERNAL_OES: typeName = "GL_SAMPLER_EXTERNAL_OES"; break;
default: assert(0);
}
- printf("%u: name:%s type:%s size:%d", i, name, typeName, size);
- if (mapLongVariableNames)
- printf(" mapped name:%s", mappedName);
- printf("\n");
+ printf("%lu: name:%s type:%s size:%d\n", i, name, typeName, size);
}
delete [] name;
- if (mappedName)
- delete [] mappedName;
}
static bool ReadShaderSource(const char* fileName, ShaderSource& source) {
@@ -359,7 +357,7 @@ static bool ReadShaderSource(const char* fileName, ShaderSource& source) {
// Obtain file size.
fseek(in, 0, SEEK_END);
- int count = ftell(in);
+ size_t count = ftell(in);
rewind(in);
int len = (int)ceil((float)count / (float)NUM_SOURCE_STRINGS);
@@ -369,7 +367,7 @@ static bool ReadShaderSource(const char* fileName, ShaderSource& source) {
// string is added to vector.
do {
char* data = new char[len + 1];
- int nread = fread(data, 1, len, in);
+ size_t nread = fread(data, 1, len, in);
data[nread] = '\0';
source.push_back(data);
diff --git a/chromium/third_party/angle/src/ANGLE.sln b/chromium/third_party/angle/src/ANGLE.sln
deleted file mode 100644
index af932ac3c5e..00000000000
--- a/chromium/third_party/angle/src/ANGLE.sln
+++ /dev/null
@@ -1,56 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual C++ Express 2010
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libEGL", "libEGL\libEGL.vcxproj", "{E746FCA9-64C3-433E-85E8-9A5A67AB7ED6}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libGLESv2", "libGLESv2\libGLESv2.vcxproj", "{B5871A7A-968C-42E3-A33B-981E6F448E78}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "translator", "compiler\translator.vcxproj", "{5B3A6DB8-1E7E-40D7-92B9-DA8AAE619FAD}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "preprocessor", "compiler\preprocessor\preprocessor.vcxproj", "{FBE32DF3-0FB0-4F2F-A424-2C21BD7BC325}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Debug|x64 = Debug|x64
- Release|Win32 = Release|Win32
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {E746FCA9-64C3-433E-85E8-9A5A67AB7ED6}.Debug|Win32.ActiveCfg = Debug|Win32
- {E746FCA9-64C3-433E-85E8-9A5A67AB7ED6}.Debug|Win32.Build.0 = Debug|Win32
- {E746FCA9-64C3-433E-85E8-9A5A67AB7ED6}.Debug|x64.ActiveCfg = Debug|x64
- {E746FCA9-64C3-433E-85E8-9A5A67AB7ED6}.Debug|x64.Build.0 = Debug|x64
- {E746FCA9-64C3-433E-85E8-9A5A67AB7ED6}.Release|Win32.ActiveCfg = Release|Win32
- {E746FCA9-64C3-433E-85E8-9A5A67AB7ED6}.Release|Win32.Build.0 = Release|Win32
- {E746FCA9-64C3-433E-85E8-9A5A67AB7ED6}.Release|x64.ActiveCfg = Release|x64
- {E746FCA9-64C3-433E-85E8-9A5A67AB7ED6}.Release|x64.Build.0 = Release|x64
- {B5871A7A-968C-42E3-A33B-981E6F448E78}.Debug|Win32.ActiveCfg = Debug|Win32
- {B5871A7A-968C-42E3-A33B-981E6F448E78}.Debug|Win32.Build.0 = Debug|Win32
- {B5871A7A-968C-42E3-A33B-981E6F448E78}.Debug|x64.ActiveCfg = Debug|x64
- {B5871A7A-968C-42E3-A33B-981E6F448E78}.Debug|x64.Build.0 = Debug|x64
- {B5871A7A-968C-42E3-A33B-981E6F448E78}.Release|Win32.ActiveCfg = Release|Win32
- {B5871A7A-968C-42E3-A33B-981E6F448E78}.Release|Win32.Build.0 = Release|Win32
- {B5871A7A-968C-42E3-A33B-981E6F448E78}.Release|x64.ActiveCfg = Release|x64
- {B5871A7A-968C-42E3-A33B-981E6F448E78}.Release|x64.Build.0 = Release|x64
- {5B3A6DB8-1E7E-40D7-92B9-DA8AAE619FAD}.Debug|Win32.ActiveCfg = Debug|Win32
- {5B3A6DB8-1E7E-40D7-92B9-DA8AAE619FAD}.Debug|Win32.Build.0 = Debug|Win32
- {5B3A6DB8-1E7E-40D7-92B9-DA8AAE619FAD}.Debug|x64.ActiveCfg = Debug|x64
- {5B3A6DB8-1E7E-40D7-92B9-DA8AAE619FAD}.Debug|x64.Build.0 = Debug|x64
- {5B3A6DB8-1E7E-40D7-92B9-DA8AAE619FAD}.Release|Win32.ActiveCfg = Release|Win32
- {5B3A6DB8-1E7E-40D7-92B9-DA8AAE619FAD}.Release|Win32.Build.0 = Release|Win32
- {5B3A6DB8-1E7E-40D7-92B9-DA8AAE619FAD}.Release|x64.ActiveCfg = Release|x64
- {5B3A6DB8-1E7E-40D7-92B9-DA8AAE619FAD}.Release|x64.Build.0 = Release|x64
- {FBE32DF3-0FB0-4F2F-A424-2C21BD7BC325}.Debug|Win32.ActiveCfg = Debug|Win32
- {FBE32DF3-0FB0-4F2F-A424-2C21BD7BC325}.Debug|Win32.Build.0 = Debug|Win32
- {FBE32DF3-0FB0-4F2F-A424-2C21BD7BC325}.Debug|x64.ActiveCfg = Debug|x64
- {FBE32DF3-0FB0-4F2F-A424-2C21BD7BC325}.Debug|x64.Build.0 = Debug|x64
- {FBE32DF3-0FB0-4F2F-A424-2C21BD7BC325}.Release|Win32.ActiveCfg = Release|Win32
- {FBE32DF3-0FB0-4F2F-A424-2C21BD7BC325}.Release|Win32.Build.0 = Release|Win32
- {FBE32DF3-0FB0-4F2F-A424-2C21BD7BC325}.Release|x64.ActiveCfg = Release|x64
- {FBE32DF3-0FB0-4F2F-A424-2C21BD7BC325}.Release|x64.Build.0 = Release|x64
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/chromium/third_party/angle/src/angle.gyp b/chromium/third_party/angle/src/angle.gyp
new file mode 100644
index 00000000000..024694ca921
--- /dev/null
+++ b/chromium/third_party/angle/src/angle.gyp
@@ -0,0 +1,10 @@
+# Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'includes':
+ [
+ 'angle.gypi',
+ ],
+}
diff --git a/chromium/third_party/angle/src/angle.gypi b/chromium/third_party/angle/src/angle.gypi
new file mode 100644
index 00000000000..ef167495b14
--- /dev/null
+++ b/chromium/third_party/angle/src/angle.gypi
@@ -0,0 +1,150 @@
+# Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'variables':
+ {
+ 'angle_code': 1,
+ 'angle_post_build_script%': 0,
+ 'angle_gen_path': '<(SHARED_INTERMEDIATE_DIR)/angle',
+ 'angle_id_script_base': 'commit_id.py',
+ 'angle_id_script': '<(angle_gen_path)/<(angle_id_script_base)',
+ 'angle_id_header_base': 'commit.h',
+ 'angle_id_header': '<(angle_gen_path)/id/<(angle_id_header_base)',
+ 'angle_use_commit_id%': '<!(python <(angle_id_script_base) check ..)',
+ },
+ 'includes':
+ [
+ 'compiler.gypi',
+ 'libGLESv2.gypi',
+ 'libEGL.gypi'
+ ],
+
+ 'targets':
+ [
+ {
+ 'target_name': 'copy_scripts',
+ 'type': 'none',
+ 'copies':
+ [
+ {
+ 'destination': '<(angle_gen_path)',
+ 'files': [ 'copy_compiler_dll.bat', '<(angle_id_script_base)' ],
+ },
+ ],
+ },
+ ],
+ 'conditions':
+ [
+ ['angle_use_commit_id!=0',
+ {
+ 'targets':
+ [
+ {
+ 'target_name': 'commit_id',
+ 'type': 'none',
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'dependencies': [ 'copy_scripts', ],
+ 'actions':
+ [
+ {
+ 'action_name': 'Generate ANGLE Commit ID Header',
+ 'message': 'Generating ANGLE Commit ID',
+ # reference the git index as an input, so we rebuild on changes to the index
+ 'inputs': [ '<(angle_id_script)', '<(angle_path)/.git/index' ],
+ 'outputs': [ '<(angle_id_header)' ],
+ 'msvs_cygwin_shell': 0,
+ 'action':
+ [
+ 'python', '<(angle_id_script)', 'gen', '<(angle_path)', '<(angle_id_header)'
+ ],
+ },
+ ],
+ 'direct_dependent_settings':
+ {
+ 'include_dirs':
+ [
+ '<(angle_gen_path)',
+ ],
+ },
+ }
+ ]
+ },
+ { # angle_use_commit_id==0
+ 'targets':
+ [
+ {
+ 'target_name': 'commit_id',
+ 'type': 'none',
+ 'copies':
+ [
+ {
+ 'destination': '<(angle_gen_path)/id',
+ 'files': [ '<(angle_id_header_base)' ]
+ }
+ ],
+ 'direct_dependent_settings':
+ {
+ 'include_dirs':
+ [
+ '<(angle_gen_path)',
+ ],
+ },
+ }
+ ]
+ }],
+ ['OS=="win"',
+ {
+ 'targets':
+ [
+ {
+ 'target_name': 'copy_compiler_dll',
+ 'type': 'none',
+ 'dependencies': [ 'copy_scripts', ],
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'actions':
+ [
+ {
+ 'action_name': 'copy_dll',
+ 'message': 'Copying D3D Compiler DLL...',
+ 'msvs_cygwin_shell': 0,
+ 'inputs': [ 'copy_compiler_dll.bat' ],
+ 'outputs': [ '<(PRODUCT_DIR)/D3DCompiler_46.dll' ],
+ 'action':
+ [
+ "<(angle_gen_path)/copy_compiler_dll.bat",
+ "$(PlatformName)",
+ "<(windows_sdk_path)",
+ "<(PRODUCT_DIR)"
+ ],
+ },
+ ], #actions
+ },
+ ], # targets
+ }],
+ ['angle_post_build_script!=0 and OS=="win"',
+ {
+ 'targets':
+ [
+ {
+ 'target_name': 'post_build',
+ 'type': 'none',
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'dependencies': [ 'libGLESv2', 'libEGL' ],
+ 'actions':
+ [
+ {
+ 'action_name': 'ANGLE Post-Build Script',
+ 'message': 'Running <(angle_post_build_script)...',
+ 'msvs_cygwin_shell': 0,
+ 'inputs': [ '<(angle_post_build_script)', '<!@(["python", "<(angle_post_build_script)", "inputs", "<(angle_path)", "<(CONFIGURATION_NAME)", "$(PlatformName)", "<(PRODUCT_DIR)"])' ],
+ 'outputs': [ '<!@(python <(angle_post_build_script) outputs "<(angle_path)" "<(CONFIGURATION_NAME)" "$(PlatformName)" "<(PRODUCT_DIR)")' ],
+ 'action': ['python', '<(angle_post_build_script)', 'run', '<(angle_path)', '<(CONFIGURATION_NAME)', '$(PlatformName)', '<(PRODUCT_DIR)'],
+ },
+ ], #actions
+ },
+ ], # targets
+ }],
+ ] # conditions
+}
diff --git a/chromium/third_party/angle/src/build_angle.gyp b/chromium/third_party/angle/src/build_angle.gyp
index 6adf1423ae7..024694ca921 100644
--- a/chromium/third_party/angle/src/build_angle.gyp
+++ b/chromium/third_party/angle/src/build_angle.gyp
@@ -3,13 +3,8 @@
# found in the LICENSE file.
{
- 'includes': [
- 'build_angle.gypi',
- ],
+ 'includes':
+ [
+ 'angle.gypi',
+ ],
}
-
-# Local Variables:
-# tab-width:2
-# indent-tabs-mode:nil
-# End:
-# vim: set expandtab tabstop=2 shiftwidth=2:
diff --git a/chromium/third_party/angle/src/build_angle.gypi b/chromium/third_party/angle/src/build_angle.gypi
deleted file mode 100644
index d87ff4e6860..00000000000
--- a/chromium/third_party/angle/src/build_angle.gypi
+++ /dev/null
@@ -1,431 +0,0 @@
-# Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-{
- 'variables': {
- 'angle_code': 1,
- 'translator_sources': [
- 'compiler/BaseTypes.h',
- 'compiler/BuiltInFunctionEmulator.cpp',
- 'compiler/BuiltInFunctionEmulator.h',
- 'compiler/CodeGen.cpp',
- 'compiler/Common.h',
- 'compiler/Compiler.cpp',
- 'compiler/ConstantUnion.h',
- 'compiler/debug.cpp',
- 'compiler/debug.h',
- 'compiler/DetectCallDepth.cpp',
- 'compiler/DetectCallDepth.h',
- 'compiler/DetectDiscontinuity.cpp',
- 'compiler/DetectDiscontinuity.h',
- 'compiler/Diagnostics.h',
- 'compiler/Diagnostics.cpp',
- 'compiler/DirectiveHandler.h',
- 'compiler/DirectiveHandler.cpp',
- 'compiler/ExtensionBehavior.h',
- 'compiler/ForLoopUnroll.cpp',
- 'compiler/ForLoopUnroll.h',
- 'compiler/glslang.h',
- 'compiler/glslang_lex.cpp',
- 'compiler/glslang_tab.cpp',
- 'compiler/glslang_tab.h',
- 'compiler/HashNames.h',
- 'compiler/InfoSink.cpp',
- 'compiler/InfoSink.h',
- 'compiler/Initialize.cpp',
- 'compiler/Initialize.h',
- 'compiler/InitializeDll.cpp',
- 'compiler/InitializeDll.h',
- 'compiler/InitializeGlobals.h',
- 'compiler/InitializeGLPosition.cpp',
- 'compiler/InitializeGLPosition.h',
- 'compiler/InitializeParseContext.cpp',
- 'compiler/InitializeParseContext.h',
- 'compiler/Intermediate.cpp',
- 'compiler/intermediate.h',
- 'compiler/intermOut.cpp',
- 'compiler/IntermTraverse.cpp',
- 'compiler/localintermediate.h',
- 'compiler/MapLongVariableNames.cpp',
- 'compiler/MapLongVariableNames.h',
- 'compiler/MMap.h',
- 'compiler/osinclude.h',
- 'compiler/OutputESSL.cpp',
- 'compiler/OutputESSL.h',
- 'compiler/OutputGLSLBase.cpp',
- 'compiler/OutputGLSLBase.h',
- 'compiler/OutputGLSL.cpp',
- 'compiler/OutputGLSL.h',
- 'compiler/OutputHLSL.cpp',
- 'compiler/OutputHLSL.h',
- 'compiler/parseConst.cpp',
- 'compiler/ParseContext.cpp',
- 'compiler/ParseContext.h',
- 'compiler/PoolAlloc.cpp',
- 'compiler/PoolAlloc.h',
- 'compiler/QualifierAlive.cpp',
- 'compiler/QualifierAlive.h',
- 'compiler/RemoveTree.cpp',
- 'compiler/RemoveTree.h',
- 'compiler/RenameFunction.h',
- 'compiler/SearchSymbol.cpp',
- 'compiler/SearchSymbol.h',
- 'compiler/ShaderLang.cpp',
- 'compiler/ShHandle.h',
- 'compiler/SymbolTable.cpp',
- 'compiler/SymbolTable.h',
- 'compiler/TranslatorESSL.cpp',
- 'compiler/TranslatorESSL.h',
- 'compiler/TranslatorGLSL.cpp',
- 'compiler/TranslatorGLSL.h',
- 'compiler/TranslatorHLSL.cpp',
- 'compiler/TranslatorHLSL.h',
- 'compiler/Types.h',
- 'compiler/UnfoldShortCircuitAST.cpp',
- 'compiler/UnfoldShortCircuitAST.h',
- 'compiler/UnfoldShortCircuit.cpp',
- 'compiler/UnfoldShortCircuit.h',
- 'compiler/Uniform.cpp',
- 'compiler/Uniform.h',
- 'compiler/util.cpp',
- 'compiler/util.h',
- 'compiler/ValidateLimitations.cpp',
- 'compiler/ValidateLimitations.h',
- 'compiler/VariableInfo.cpp',
- 'compiler/VariableInfo.h',
- 'compiler/VariablePacker.cpp',
- 'compiler/VariablePacker.h',
- 'compiler/VersionGLSL.cpp',
- 'compiler/VersionGLSL.h',
- # Dependency graph
- 'compiler/depgraph/DependencyGraph.cpp',
- 'compiler/depgraph/DependencyGraph.h',
- 'compiler/depgraph/DependencyGraphBuilder.cpp',
- 'compiler/depgraph/DependencyGraphBuilder.h',
- 'compiler/depgraph/DependencyGraphOutput.cpp',
- 'compiler/depgraph/DependencyGraphOutput.h',
- 'compiler/depgraph/DependencyGraphTraverse.cpp',
- # Timing restrictions
- 'compiler/timing/RestrictFragmentShaderTiming.cpp',
- 'compiler/timing/RestrictFragmentShaderTiming.h',
- 'compiler/timing/RestrictVertexShaderTiming.cpp',
- 'compiler/timing/RestrictVertexShaderTiming.h',
- 'third_party/compiler/ArrayBoundsClamper.cpp',
- 'third_party/compiler/ArrayBoundsClamper.h',
- ],
- },
- 'target_defaults': {
- 'defines': [
- 'ANGLE_DISABLE_TRACE',
- 'ANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1',
- 'ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT("d3dcompiler_46.dll"), TEXT("d3dcompiler_43.dll") }',
- ],
- },
- 'targets': [
- {
- 'target_name': 'preprocessor',
- 'type': 'static_library',
- 'include_dirs': [
- ],
- 'sources': [
- 'compiler/preprocessor/DiagnosticsBase.cpp',
- 'compiler/preprocessor/DiagnosticsBase.h',
- 'compiler/preprocessor/DirectiveHandlerBase.cpp',
- 'compiler/preprocessor/DirectiveHandlerBase.h',
- 'compiler/preprocessor/DirectiveParser.cpp',
- 'compiler/preprocessor/DirectiveParser.h',
- 'compiler/preprocessor/ExpressionParser.cpp',
- 'compiler/preprocessor/ExpressionParser.h',
- 'compiler/preprocessor/Input.cpp',
- 'compiler/preprocessor/Input.h',
- 'compiler/preprocessor/length_limits.h',
- 'compiler/preprocessor/Lexer.cpp',
- 'compiler/preprocessor/Lexer.h',
- 'compiler/preprocessor/Macro.cpp',
- 'compiler/preprocessor/Macro.h',
- 'compiler/preprocessor/MacroExpander.cpp',
- 'compiler/preprocessor/MacroExpander.h',
- 'compiler/preprocessor/numeric_lex.h',
- 'compiler/preprocessor/pp_utils.h',
- 'compiler/preprocessor/Preprocessor.cpp',
- 'compiler/preprocessor/Preprocessor.h',
- 'compiler/preprocessor/SourceLocation.h',
- 'compiler/preprocessor/Token.cpp',
- 'compiler/preprocessor/Token.h',
- 'compiler/preprocessor/Tokenizer.cpp',
- 'compiler/preprocessor/Tokenizer.h',
- ],
- # TODO(jschuh): http://crbug.com/167187
- 'msvs_disabled_warnings': [
- 4267,
- ],
- },
- {
- 'target_name': 'translator',
- 'type': '<(component)',
- 'dependencies': ['preprocessor'],
- 'include_dirs': [
- '.',
- '../include',
- ],
- 'defines': [
- 'ANGLE_TRANSLATOR_IMPLEMENTATION',
- ],
- 'sources': ['<@(translator_sources)'],
- # TODO(jschuh): http://crbug.com/167187 size_t -> int
- 'msvs_disabled_warnings': [ 4267 ],
- 'conditions': [
- ['OS=="win"', {
- 'sources': ['compiler/ossource_win.cpp'],
- }, { # else: posix
- 'sources': ['compiler/ossource_posix.cpp'],
- }],
- ],
- },
- {
- 'target_name': 'translator_static',
- 'type': 'static_library',
- 'dependencies': ['preprocessor'],
- 'include_dirs': [
- '.',
- '../include',
- ],
- 'direct_dependent_settings': {
- 'defines': [
- 'ANGLE_TRANSLATOR_STATIC',
- ],
- },
- 'defines': [
- 'ANGLE_TRANSLATOR_STATIC',
- ],
- 'sources': ['<@(translator_sources)'],
- # TODO(jschuh): http://crbug.com/167187 size_t -> int
- 'msvs_disabled_warnings': [ 4267 ],
- 'conditions': [
- ['OS=="win"', {
- 'sources': ['compiler/ossource_win.cpp'],
- }, { # else: posix
- 'sources': ['compiler/ossource_posix.cpp'],
- }],
- ],
- },
- ],
- 'conditions': [
- ['OS=="win"', {
- 'targets': [
- {
- 'target_name': 'libGLESv2',
- 'type': 'shared_library',
- 'dependencies': ['translator'],
- 'include_dirs': [
- '.',
- '../include',
- 'libGLESv2',
- ],
- 'sources': [
- 'third_party/murmurhash/MurmurHash3.h',
- 'third_party/murmurhash/MurmurHash3.cpp',
- 'third_party/trace_event/trace_event.h',
- 'common/angleutils.h',
- 'common/debug.cpp',
- 'common/debug.h',
- 'common/event_tracer.cpp',
- 'common/event_tracer.h',
- 'common/RefCountObject.cpp',
- 'common/RefCountObject.h',
- 'common/version.h',
- 'libGLESv2/precompiled.h',
- 'libGLESv2/precompiled.cpp',
- 'libGLESv2/BinaryStream.h',
- 'libGLESv2/Buffer.cpp',
- 'libGLESv2/Buffer.h',
- 'libGLESv2/constants.h',
- 'libGLESv2/Context.cpp',
- 'libGLESv2/Context.h',
- 'libGLESv2/angletypes.h',
- 'libGLESv2/Fence.cpp',
- 'libGLESv2/Fence.h',
- 'libGLESv2/Float16ToFloat32.cpp',
- 'libGLESv2/Framebuffer.cpp',
- 'libGLESv2/Framebuffer.h',
- 'libGLESv2/HandleAllocator.cpp',
- 'libGLESv2/HandleAllocator.h',
- 'libGLESv2/libGLESv2.cpp',
- 'libGLESv2/libGLESv2.def',
- 'libGLESv2/libGLESv2.rc',
- 'libGLESv2/main.cpp',
- 'libGLESv2/main.h',
- 'libGLESv2/mathutil.h',
- 'libGLESv2/Program.cpp',
- 'libGLESv2/Program.h',
- 'libGLESv2/ProgramBinary.cpp',
- 'libGLESv2/ProgramBinary.h',
- 'libGLESv2/Query.h',
- 'libGLESv2/Query.cpp',
- 'libGLESv2/Renderbuffer.cpp',
- 'libGLESv2/Renderbuffer.h',
- 'libGLESv2/renderer/Blit.cpp',
- 'libGLESv2/renderer/Blit.h',
- 'libGLESv2/renderer/BufferStorage.h',
- 'libGLESv2/renderer/BufferStorage.cpp',
- 'libGLESv2/renderer/BufferStorage9.cpp',
- 'libGLESv2/renderer/BufferStorage9.h',
- 'libGLESv2/renderer/BufferStorage11.cpp',
- 'libGLESv2/renderer/BufferStorage11.h',
- 'libGLESv2/renderer/FenceImpl.h',
- 'libGLESv2/renderer/Fence9.cpp',
- 'libGLESv2/renderer/Fence9.h',
- 'libGLESv2/renderer/Fence11.cpp',
- 'libGLESv2/renderer/Fence11.h',
- 'libGLESv2/renderer/generatemip.h',
- 'libGLESv2/renderer/Image.cpp',
- 'libGLESv2/renderer/Image.h',
- 'libGLESv2/renderer/Image11.cpp',
- 'libGLESv2/renderer/Image11.h',
- 'libGLESv2/renderer/Image9.cpp',
- 'libGLESv2/renderer/Image9.h',
- 'libGLESv2/renderer/ImageSSE2.cpp',
- 'libGLESv2/renderer/IndexBuffer.cpp',
- 'libGLESv2/renderer/IndexBuffer.h',
- 'libGLESv2/renderer/IndexBuffer9.cpp',
- 'libGLESv2/renderer/IndexBuffer9.h',
- 'libGLESv2/renderer/IndexBuffer11.cpp',
- 'libGLESv2/renderer/IndexBuffer11.h',
- 'libGLESv2/renderer/IndexDataManager.cpp',
- 'libGLESv2/renderer/IndexDataManager.h',
- 'libGLESv2/renderer/IndexRangeCache.cpp',
- 'libGLESv2/renderer/IndexRangeCache.h',
- 'libGLESv2/renderer/InputLayoutCache.cpp',
- 'libGLESv2/renderer/InputLayoutCache.h',
- 'libGLESv2/renderer/QueryImpl.h',
- 'libGLESv2/renderer/Query9.cpp',
- 'libGLESv2/renderer/Query9.h',
- 'libGLESv2/renderer/Query11.cpp',
- 'libGLESv2/renderer/Query11.h',
- 'libGLESv2/renderer/Renderer.cpp',
- 'libGLESv2/renderer/Renderer.h',
- 'libGLESv2/renderer/Renderer11.cpp',
- 'libGLESv2/renderer/Renderer11.h',
- 'libGLESv2/renderer/renderer11_utils.cpp',
- 'libGLESv2/renderer/renderer11_utils.h',
- 'libGLESv2/renderer/Renderer9.cpp',
- 'libGLESv2/renderer/Renderer9.h',
- 'libGLESv2/renderer/renderer9_utils.cpp',
- 'libGLESv2/renderer/renderer9_utils.h',
- 'libGLESv2/renderer/RenderStateCache.cpp',
- 'libGLESv2/renderer/RenderStateCache.h',
- 'libGLESv2/renderer/RenderTarget.h',
- 'libGLESv2/renderer/RenderTarget11.h',
- 'libGLESv2/renderer/RenderTarget11.cpp',
- 'libGLESv2/renderer/RenderTarget9.h',
- 'libGLESv2/renderer/RenderTarget9.cpp',
- 'libGLESv2/renderer/ShaderCache.h',
- 'libGLESv2/renderer/ShaderExecutable.h',
- 'libGLESv2/renderer/ShaderExecutable9.cpp',
- 'libGLESv2/renderer/ShaderExecutable9.h',
- 'libGLESv2/renderer/ShaderExecutable11.cpp',
- 'libGLESv2/renderer/ShaderExecutable11.h',
- 'libGLESv2/renderer/SwapChain.h',
- 'libGLESv2/renderer/SwapChain9.cpp',
- 'libGLESv2/renderer/SwapChain9.h',
- 'libGLESv2/renderer/SwapChain11.cpp',
- 'libGLESv2/renderer/SwapChain11.h',
- 'libGLESv2/renderer/TextureStorage.cpp',
- 'libGLESv2/renderer/TextureStorage.h',
- 'libGLESv2/renderer/TextureStorage11.cpp',
- 'libGLESv2/renderer/TextureStorage11.h',
- 'libGLESv2/renderer/TextureStorage9.cpp',
- 'libGLESv2/renderer/TextureStorage9.h',
- 'libGLESv2/renderer/VertexBuffer.cpp',
- 'libGLESv2/renderer/VertexBuffer.h',
- 'libGLESv2/renderer/VertexBuffer9.cpp',
- 'libGLESv2/renderer/VertexBuffer9.h',
- 'libGLESv2/renderer/VertexBuffer11.cpp',
- 'libGLESv2/renderer/VertexBuffer11.h',
- 'libGLESv2/renderer/vertexconversion.h',
- 'libGLESv2/renderer/VertexDataManager.cpp',
- 'libGLESv2/renderer/VertexDataManager.h',
- 'libGLESv2/renderer/VertexDeclarationCache.cpp',
- 'libGLESv2/renderer/VertexDeclarationCache.h',
- 'libGLESv2/ResourceManager.cpp',
- 'libGLESv2/ResourceManager.h',
- 'libGLESv2/Shader.cpp',
- 'libGLESv2/Shader.h',
- 'libGLESv2/Texture.cpp',
- 'libGLESv2/Texture.h',
- 'libGLESv2/Uniform.cpp',
- 'libGLESv2/Uniform.h',
- 'libGLESv2/utilities.cpp',
- 'libGLESv2/utilities.h',
- ],
- # TODO(jschuh): http://crbug.com/167187 size_t -> int
- 'msvs_disabled_warnings': [ 4267 ],
- 'msvs_settings': {
- 'VCLinkerTool': {
- 'AdditionalDependencies': [
- 'd3d9.lib',
- 'dxguid.lib',
- ],
- }
- },
- 'copies': [
- {
- 'destination': '<(PRODUCT_DIR)',
- 'files': [
- '<(windows_sdk_path)/Redist/D3D/<(winsdk_arch)/d3dcompiler_46.dll',
- ],
- },
- ],
- },
- {
- 'target_name': 'libEGL',
- 'type': 'shared_library',
- 'dependencies': ['libGLESv2'],
- 'include_dirs': [
- '.',
- '../include',
- 'libGLESv2',
- ],
- 'sources': [
- 'common/angleutils.h',
- 'common/debug.cpp',
- 'common/debug.h',
- 'common/RefCountObject.cpp',
- 'common/RefCountObject.h',
- 'common/version.h',
- 'libEGL/Config.cpp',
- 'libEGL/Config.h',
- 'libEGL/Display.cpp',
- 'libEGL/Display.h',
- 'libEGL/libEGL.cpp',
- 'libEGL/libEGL.def',
- 'libEGL/libEGL.rc',
- 'libEGL/main.cpp',
- 'libEGL/main.h',
- 'libEGL/Surface.cpp',
- 'libEGL/Surface.h',
- ],
- # TODO(jschuh): http://crbug.com/167187 size_t -> int
- 'msvs_disabled_warnings': [ 4267 ],
- 'msvs_settings': {
- 'VCLinkerTool': {
- 'AdditionalDependencies': [
- 'd3d9.lib',
- ],
- }
- },
- },
- ],
- }],
- ],
-}
-
-# Local Variables:
-# tab-width:2
-# indent-tabs-mode:nil
-# End:
-# vim: set expandtab tabstop=2 shiftwidth=2:
-# Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
diff --git a/chromium/third_party/angle/src/commit.h b/chromium/third_party/angle/src/commit.h
new file mode 100644
index 00000000000..4c89a657c5e
--- /dev/null
+++ b/chromium/third_party/angle/src/commit.h
@@ -0,0 +1,14 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// commit.h:
+// This is a default commit hash header, when git is not available.
+//
+
+#define ANGLE_COMMIT_HASH "unknown hash"
+#define ANGLE_COMMIT_HASH_SIZE 12
+#define ANGLE_COMMIT_DATE "unknown date"
+
+#define ANGLE_DISABLE_PROGRAM_BINARY_LOAD
diff --git a/chromium/third_party/angle/src/commit_id.py b/chromium/third_party/angle/src/commit_id.py
new file mode 100644
index 00000000000..7f711e75a62
--- /dev/null
+++ b/chromium/third_party/angle/src/commit_id.py
@@ -0,0 +1,38 @@
+import subprocess as sp
+import sys
+import os
+
+# Usage: commit_id.py check <angle_dir> (checks if git is present)
+# Usage: commit_id.py gen <angle_dir> <file_to_write> (generates commit id)
+
+def grab_output(command, cwd):
+ return sp.Popen(command, stdout=sp.PIPE, shell=True, cwd=cwd).communicate()[0].strip()
+
+operation = sys.argv[1]
+cwd = sys.argv[2]
+
+if operation == 'check':
+ index_path = os.path.join(cwd, '.git', 'index')
+ if os.path.exists(index_path):
+ print("1")
+ else:
+ print("0")
+ sys.exit(0)
+
+output_file = sys.argv[3]
+commit_id_size = 12
+
+try:
+ commit_id = grab_output('git rev-parse --short=%d HEAD' % commit_id_size, cwd)
+ commit_date = grab_output('git show -s --format=%ci HEAD', cwd)
+except:
+ commit_id = 'invalid-hash'
+ commit_date = 'invalid-date'
+
+hfile = open(output_file, 'w')
+
+hfile.write('#define ANGLE_COMMIT_HASH "%s"\n' % commit_id)
+hfile.write('#define ANGLE_COMMIT_HASH_SIZE %d\n' % commit_id_size)
+hfile.write('#define ANGLE_COMMIT_DATE "%s"\n' % commit_date)
+
+hfile.close()
diff --git a/chromium/third_party/angle/src/common/RefCountObject.cpp b/chromium/third_party/angle/src/common/RefCountObject.cpp
index 0364adf2cd5..c1ef90cdccc 100644
--- a/chromium/third_party/angle/src/common/RefCountObject.cpp
+++ b/chromium/third_party/angle/src/common/RefCountObject.cpp
@@ -1,4 +1,3 @@
-#include "precompiled.h"
//
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
diff --git a/chromium/third_party/angle/src/common/RefCountObject.h b/chromium/third_party/angle/src/common/RefCountObject.h
index 727c71c3624..88b63931224 100644
--- a/chromium/third_party/angle/src/common/RefCountObject.h
+++ b/chromium/third_party/angle/src/common/RefCountObject.h
@@ -14,7 +14,7 @@
#include <cstddef>
-#define GL_APICALL
+#include <GLES3/gl3.h>
#include <GLES2/gl2.h>
#include "common/debug.h"
@@ -47,7 +47,7 @@ class RefCountObjectBindingPointer
public:
GLuint id() const { return (mObject != NULL) ? mObject->id() : 0; }
- bool operator ! () const { return (get() == NULL); }
+ bool operator!() const { return (get() == NULL); }
private:
RefCountObject *mObject;
@@ -59,7 +59,65 @@ class BindingPointer : public RefCountObjectBindingPointer
public:
void set(ObjectType *newObject) { RefCountObjectBindingPointer::set(newObject); }
ObjectType *get() const { return static_cast<ObjectType*>(RefCountObjectBindingPointer::get()); }
- ObjectType *operator -> () const { return get(); }
+ ObjectType *operator->() const { return get(); }
+};
+
+template <class ObjectType>
+class FramebufferTextureBindingPointer : public RefCountObjectBindingPointer
+{
+public:
+ FramebufferTextureBindingPointer() : mType(GL_NONE), mMipLevel(0), mLayer(0) { }
+
+ void set(ObjectType *newObject, GLenum type, GLint mipLevel, GLint layer)
+ {
+ RefCountObjectBindingPointer::set(newObject);
+ mType = type;
+ mMipLevel = mipLevel;
+ mLayer = layer;
+ }
+
+ ObjectType *get() const { return static_cast<ObjectType*>(RefCountObjectBindingPointer::get()); }
+ ObjectType *operator->() const { return get(); }
+
+ GLenum type() const { return mType; }
+ GLint mipLevel() const { return mMipLevel; }
+ GLint layer() const { return mLayer; }
+
+private:
+ GLenum mType;
+ GLint mMipLevel;
+ GLint mLayer;
+};
+
+template <class ObjectType>
+class OffsetBindingPointer : public RefCountObjectBindingPointer
+{
+ public:
+ OffsetBindingPointer() : mOffset(0), mSize(0) { }
+
+ void set(ObjectType *newObject)
+ {
+ RefCountObjectBindingPointer::set(newObject);
+ mOffset = 0;
+ mSize = 0;
+ }
+
+ void set(ObjectType *newObject, GLintptr offset, GLsizeiptr size)
+ {
+ RefCountObjectBindingPointer::set(newObject);
+ mOffset = offset;
+ mSize = size;
+ }
+
+ GLintptr getOffset() const { return mOffset; }
+ GLsizeiptr getSize() const { return mSize; }
+
+ ObjectType *get() const { return static_cast<ObjectType*>(RefCountObjectBindingPointer::get()); }
+ ObjectType *operator->() const { return get(); }
+
+ private:
+ GLintptr mOffset;
+ GLsizeiptr mSize;
};
#endif // COMMON_REFCOUNTOBJECT_H_
diff --git a/chromium/third_party/angle/src/common/angleutils.h b/chromium/third_party/angle/src/common/angleutils.h
index 7723f0fb727..9c182a8c95f 100644
--- a/chromium/third_party/angle/src/common/angleutils.h
+++ b/chromium/third_party/angle/src/common/angleutils.h
@@ -56,6 +56,28 @@ void SafeDeleteArray(T*& resource)
resource = NULL;
}
+// Provide a less-than function for comparing structs
+// Note: struct memory must be initialized to zero, because of packing gaps
+template <typename T>
+inline bool StructLessThan(const T &a, const T &b)
+{
+ return (memcmp(&a, &b, sizeof(T)) < 0);
+}
+
+// Provide a less-than function for comparing structs
+// Note: struct memory must be initialized to zero, because of packing gaps
+template <typename T>
+inline bool StructEquals(const T &a, const T &b)
+{
+ return (memcmp(&a, &b, sizeof(T)) == 0);
+}
+
+template <typename T>
+inline void StructZero(T *obj)
+{
+ memset(obj, 0, sizeof(T));
+}
+
#if defined(_MSC_VER)
#define snprintf _snprintf
#endif
@@ -66,5 +88,7 @@ void SafeDeleteArray(T*& resource)
#define GL_BGRA4_ANGLEX 0x6ABC
#define GL_BGR5_A1_ANGLEX 0x6ABD
+#define GL_INT_64_ANGLEX 0x6ABE
+#define GL_STRUCT_ANGLEX 0x6ABF
#endif // COMMON_ANGLEUTILS_H_
diff --git a/chromium/third_party/angle/src/common/blocklayout.cpp b/chromium/third_party/angle/src/common/blocklayout.cpp
new file mode 100644
index 00000000000..a0c9289d790
--- /dev/null
+++ b/chromium/third_party/angle/src/common/blocklayout.cpp
@@ -0,0 +1,339 @@
+//
+// Copyright (c) 2013-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// blocklayout.cpp:
+// Implementation for block layout classes and methods.
+//
+
+#include "common/blocklayout.h"
+#include "common/shadervars.h"
+#include "common/mathutil.h"
+#include "common/utilities.h"
+
+namespace gl
+{
+
+BlockLayoutEncoder::BlockLayoutEncoder(std::vector<BlockMemberInfo> *blockInfoOut)
+ : mCurrentOffset(0),
+ mBlockInfoOut(blockInfoOut)
+{
+}
+
+void BlockLayoutEncoder::encodeInterfaceBlockFields(const std::vector<InterfaceBlockField> &fields)
+{
+ for (unsigned int fieldIndex = 0; fieldIndex < fields.size(); fieldIndex++)
+ {
+ const InterfaceBlockField &variable = fields[fieldIndex];
+
+ if (variable.fields.size() > 0)
+ {
+ const unsigned int elementCount = std::max(1u, variable.arraySize);
+
+ for (unsigned int elementIndex = 0; elementIndex < elementCount; elementIndex++)
+ {
+ enterAggregateType();
+ encodeInterfaceBlockFields(variable.fields);
+ exitAggregateType();
+ }
+ }
+ else
+ {
+ encodeInterfaceBlockField(variable);
+ }
+ }
+}
+
+void BlockLayoutEncoder::encodeInterfaceBlockField(const InterfaceBlockField &field)
+{
+ int arrayStride;
+ int matrixStride;
+
+ ASSERT(field.fields.empty());
+ getBlockLayoutInfo(field.type, field.arraySize, field.isRowMajorMatrix, &arrayStride, &matrixStride);
+
+ const BlockMemberInfo memberInfo(mCurrentOffset * BytesPerComponent, arrayStride * BytesPerComponent, matrixStride * BytesPerComponent, field.isRowMajorMatrix);
+
+ if (mBlockInfoOut)
+ {
+ mBlockInfoOut->push_back(memberInfo);
+ }
+
+ advanceOffset(field.type, field.arraySize, field.isRowMajorMatrix, arrayStride, matrixStride);
+}
+
+void BlockLayoutEncoder::encodeType(GLenum type, unsigned int arraySize, bool isRowMajorMatrix)
+{
+ int arrayStride;
+ int matrixStride;
+
+ getBlockLayoutInfo(type, arraySize, isRowMajorMatrix, &arrayStride, &matrixStride);
+
+ const BlockMemberInfo memberInfo(mCurrentOffset * BytesPerComponent, arrayStride * BytesPerComponent, matrixStride * BytesPerComponent, isRowMajorMatrix);
+
+ if (mBlockInfoOut)
+ {
+ mBlockInfoOut->push_back(memberInfo);
+ }
+
+ advanceOffset(type, arraySize, isRowMajorMatrix, arrayStride, matrixStride);
+}
+
+void BlockLayoutEncoder::nextRegister()
+{
+ mCurrentOffset = rx::roundUp<size_t>(mCurrentOffset, ComponentsPerRegister);
+}
+
+Std140BlockEncoder::Std140BlockEncoder(std::vector<BlockMemberInfo> *blockInfoOut)
+ : BlockLayoutEncoder(blockInfoOut)
+{
+}
+
+void Std140BlockEncoder::enterAggregateType()
+{
+ nextRegister();
+}
+
+void Std140BlockEncoder::exitAggregateType()
+{
+ nextRegister();
+}
+
+void Std140BlockEncoder::getBlockLayoutInfo(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int *arrayStrideOut, int *matrixStrideOut)
+{
+ // We assume we are only dealing with 4 byte components (no doubles or half-words currently)
+ ASSERT(gl::UniformComponentSize(gl::UniformComponentType(type)) == BytesPerComponent);
+
+ size_t baseAlignment = 0;
+ int matrixStride = 0;
+ int arrayStride = 0;
+
+ if (gl::IsMatrixType(type))
+ {
+ baseAlignment = ComponentsPerRegister;
+ matrixStride = ComponentsPerRegister;
+
+ if (arraySize > 0)
+ {
+ const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
+ arrayStride = ComponentsPerRegister * numRegisters;
+ }
+ }
+ else if (arraySize > 0)
+ {
+ baseAlignment = ComponentsPerRegister;
+ arrayStride = ComponentsPerRegister;
+ }
+ else
+ {
+ const int numComponents = gl::UniformComponentCount(type);
+ baseAlignment = (numComponents == 3 ? 4u : static_cast<size_t>(numComponents));
+ }
+
+ mCurrentOffset = rx::roundUp(mCurrentOffset, baseAlignment);
+
+ *matrixStrideOut = matrixStride;
+ *arrayStrideOut = arrayStride;
+}
+
+void Std140BlockEncoder::advanceOffset(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int arrayStride, int matrixStride)
+{
+ if (arraySize > 0)
+ {
+ mCurrentOffset += arrayStride * arraySize;
+ }
+ else if (gl::IsMatrixType(type))
+ {
+ ASSERT(matrixStride == ComponentsPerRegister);
+ const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
+ mCurrentOffset += ComponentsPerRegister * numRegisters;
+ }
+ else
+ {
+ mCurrentOffset += gl::UniformComponentCount(type);
+ }
+}
+
+HLSLBlockEncoder::HLSLBlockEncoder(std::vector<BlockMemberInfo> *blockInfoOut, HLSLBlockEncoderStrategy strategy)
+ : BlockLayoutEncoder(blockInfoOut),
+ mEncoderStrategy(strategy)
+{
+}
+
+void HLSLBlockEncoder::enterAggregateType()
+{
+ nextRegister();
+}
+
+void HLSLBlockEncoder::exitAggregateType()
+{
+}
+
+void HLSLBlockEncoder::getBlockLayoutInfo(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int *arrayStrideOut, int *matrixStrideOut)
+{
+ // We assume we are only dealing with 4 byte components (no doubles or half-words currently)
+ ASSERT(gl::UniformComponentSize(gl::UniformComponentType(type)) == BytesPerComponent);
+
+ int matrixStride = 0;
+ int arrayStride = 0;
+
+ // if variables are not to be packed, or we're about to
+ // pack a matrix or array, skip to the start of the next
+ // register
+ if (!isPacked() ||
+ gl::IsMatrixType(type) ||
+ arraySize > 0)
+ {
+ nextRegister();
+ }
+
+ if (gl::IsMatrixType(type))
+ {
+ matrixStride = ComponentsPerRegister;
+
+ if (arraySize > 0)
+ {
+ const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
+ arrayStride = ComponentsPerRegister * numRegisters;
+ }
+ }
+ else if (arraySize > 0)
+ {
+ arrayStride = ComponentsPerRegister;
+ }
+ else if (isPacked())
+ {
+ int numComponents = gl::UniformComponentCount(type);
+ if ((numComponents + (mCurrentOffset % ComponentsPerRegister)) > ComponentsPerRegister)
+ {
+ nextRegister();
+ }
+ }
+
+ *matrixStrideOut = matrixStride;
+ *arrayStrideOut = arrayStride;
+}
+
+void HLSLBlockEncoder::advanceOffset(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int arrayStride, int matrixStride)
+{
+ if (arraySize > 0)
+ {
+ mCurrentOffset += arrayStride * (arraySize - 1);
+ }
+
+ if (gl::IsMatrixType(type))
+ {
+ ASSERT(matrixStride == ComponentsPerRegister);
+ const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
+ const int numComponents = gl::MatrixComponentCount(type, isRowMajorMatrix);
+ mCurrentOffset += ComponentsPerRegister * (numRegisters - 1);
+ mCurrentOffset += numComponents;
+ }
+ else if (isPacked())
+ {
+ mCurrentOffset += gl::UniformComponentCount(type);
+ }
+ else
+ {
+ mCurrentOffset += ComponentsPerRegister;
+ }
+}
+
+void HLSLBlockEncoder::skipRegisters(unsigned int numRegisters)
+{
+ mCurrentOffset += (numRegisters * ComponentsPerRegister);
+}
+
+void HLSLVariableGetRegisterInfo(unsigned int baseRegisterIndex, gl::Uniform *variable, HLSLBlockEncoder *encoder,
+ const std::vector<gl::BlockMemberInfo> &blockInfo, ShShaderOutput outputType)
+{
+ // because this method computes offsets (element indexes) instead of any total sizes,
+ // we can ignore the array size of the variable
+
+ if (variable->isStruct())
+ {
+ encoder->enterAggregateType();
+
+ variable->registerIndex = baseRegisterIndex;
+
+ for (size_t fieldIndex = 0; fieldIndex < variable->fields.size(); fieldIndex++)
+ {
+ HLSLVariableGetRegisterInfo(baseRegisterIndex, &variable->fields[fieldIndex], encoder, blockInfo, outputType);
+ }
+
+ // Since the above loop only encodes one element of an array, ensure we don't lose track of the
+ // current register offset
+ if (variable->isArray())
+ {
+ unsigned int structRegisterCount = (HLSLVariableRegisterCount(*variable, outputType) / variable->arraySize);
+ encoder->skipRegisters(structRegisterCount * (variable->arraySize - 1));
+ }
+
+ encoder->exitAggregateType();
+ }
+ else
+ {
+ encoder->encodeType(variable->type, variable->arraySize, false);
+
+ const size_t registerBytes = (encoder->BytesPerComponent * encoder->ComponentsPerRegister);
+ variable->registerIndex = baseRegisterIndex + (blockInfo.back().offset / registerBytes);
+ variable->elementIndex = (blockInfo.back().offset % registerBytes) / sizeof(float);
+ }
+}
+
+void HLSLVariableGetRegisterInfo(unsigned int baseRegisterIndex, gl::Uniform *variable, ShShaderOutput outputType)
+{
+ std::vector<BlockMemberInfo> blockInfo;
+ HLSLBlockEncoder encoder(&blockInfo,
+ outputType == SH_HLSL9_OUTPUT ? HLSLBlockEncoder::ENCODE_LOOSE
+ : HLSLBlockEncoder::ENCODE_PACKED);
+ HLSLVariableGetRegisterInfo(baseRegisterIndex, variable, &encoder, blockInfo, outputType);
+}
+
+template <class ShaderVarType>
+void HLSLVariableRegisterCount(const ShaderVarType &variable, HLSLBlockEncoder *encoder)
+{
+ if (variable.isStruct())
+ {
+ for (size_t arrayElement = 0; arrayElement < variable.elementCount(); arrayElement++)
+ {
+ encoder->enterAggregateType();
+
+ for (size_t fieldIndex = 0; fieldIndex < variable.fields.size(); fieldIndex++)
+ {
+ HLSLVariableRegisterCount(variable.fields[fieldIndex], encoder);
+ }
+
+ encoder->exitAggregateType();
+ }
+ }
+ else
+ {
+ // We operate only on varyings and uniforms, which do not have matrix layout qualifiers
+ encoder->encodeType(variable.type, variable.arraySize, false);
+ }
+}
+
+unsigned int HLSLVariableRegisterCount(const Varying &variable)
+{
+ HLSLBlockEncoder encoder(NULL, HLSLBlockEncoder::ENCODE_PACKED);
+ HLSLVariableRegisterCount(variable, &encoder);
+
+ const size_t registerBytes = (encoder.BytesPerComponent * encoder.ComponentsPerRegister);
+ return static_cast<unsigned int>(rx::roundUp<size_t>(encoder.getBlockSize(), registerBytes) / registerBytes);
+}
+
+unsigned int HLSLVariableRegisterCount(const Uniform &variable, ShShaderOutput outputType)
+{
+ HLSLBlockEncoder encoder(NULL,
+ outputType == SH_HLSL9_OUTPUT ? HLSLBlockEncoder::ENCODE_LOOSE
+ : HLSLBlockEncoder::ENCODE_PACKED);
+
+ HLSLVariableRegisterCount(variable, &encoder);
+
+ const size_t registerBytes = (encoder.BytesPerComponent * encoder.ComponentsPerRegister);
+ return static_cast<unsigned int>(rx::roundUp<size_t>(encoder.getBlockSize(), registerBytes) / registerBytes);
+}
+
+}
diff --git a/chromium/third_party/angle/src/common/blocklayout.h b/chromium/third_party/angle/src/common/blocklayout.h
new file mode 100644
index 00000000000..e6ffff1a9e5
--- /dev/null
+++ b/chromium/third_party/angle/src/common/blocklayout.h
@@ -0,0 +1,111 @@
+//
+// Copyright (c) 2013-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// blocklayout.h:
+// Methods and classes related to uniform layout and packing in GLSL and HLSL.
+//
+
+#ifndef COMMON_BLOCKLAYOUT_H_
+#define COMMON_BLOCKLAYOUT_H_
+
+#include <vector>
+#include <GLES3/gl3.h>
+#include <GLES2/gl2.h>
+#include <GLSLANG/ShaderLang.h>
+#include <cstddef>
+
+namespace gl
+{
+
+struct ShaderVariable;
+struct InterfaceBlockField;
+struct BlockMemberInfo;
+struct Uniform;
+struct Varying;
+
+class BlockLayoutEncoder
+{
+ public:
+ BlockLayoutEncoder(std::vector<BlockMemberInfo> *blockInfoOut);
+
+ void encodeInterfaceBlockFields(const std::vector<InterfaceBlockField> &fields);
+ void encodeInterfaceBlockField(const InterfaceBlockField &field);
+ void encodeType(GLenum type, unsigned int arraySize, bool isRowMajorMatrix);
+ size_t getBlockSize() const { return mCurrentOffset * BytesPerComponent; }
+
+ static const size_t BytesPerComponent = 4u;
+ static const unsigned int ComponentsPerRegister = 4u;
+
+ protected:
+ size_t mCurrentOffset;
+
+ void nextRegister();
+
+ virtual void enterAggregateType() = 0;
+ virtual void exitAggregateType() = 0;
+ virtual void getBlockLayoutInfo(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int *arrayStrideOut, int *matrixStrideOut) = 0;
+ virtual void advanceOffset(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int arrayStride, int matrixStride) = 0;
+
+ private:
+ std::vector<BlockMemberInfo> *mBlockInfoOut;
+};
+
+// Block layout according to the std140 block layout
+// See "Standard Uniform Block Layout" in Section 2.11.6 of the OpenGL ES 3.0 specification
+
+class Std140BlockEncoder : public BlockLayoutEncoder
+{
+ public:
+ Std140BlockEncoder(std::vector<BlockMemberInfo> *blockInfoOut);
+
+ protected:
+ virtual void enterAggregateType();
+ virtual void exitAggregateType();
+ virtual void getBlockLayoutInfo(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int *arrayStrideOut, int *matrixStrideOut);
+ virtual void advanceOffset(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int arrayStride, int matrixStride);
+};
+
+// Block layout packed according to the D3D9 or default D3D10+ register packing rules
+// See http://msdn.microsoft.com/en-us/library/windows/desktop/bb509632(v=vs.85).aspx
+// The strategy should be ENCODE_LOOSE for D3D9 constnat blocks, and ENCODE_PACKED
+// for everything else (D3D10+ constant blocks and all attributes/varyings).
+
+class HLSLBlockEncoder : public BlockLayoutEncoder
+{
+ public:
+ enum HLSLBlockEncoderStrategy
+ {
+ ENCODE_PACKED,
+ ENCODE_LOOSE
+ };
+
+ HLSLBlockEncoder(std::vector<BlockMemberInfo> *blockInfoOut,
+ HLSLBlockEncoderStrategy strategy);
+
+ virtual void enterAggregateType();
+ virtual void exitAggregateType();
+ void skipRegisters(unsigned int numRegisters);
+
+ bool isPacked() const { return mEncoderStrategy == ENCODE_PACKED; }
+
+ protected:
+ virtual void getBlockLayoutInfo(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int *arrayStrideOut, int *matrixStrideOut);
+ virtual void advanceOffset(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int arrayStride, int matrixStride);
+
+ HLSLBlockEncoderStrategy mEncoderStrategy;
+};
+
+// This method assigns values to the variable's "registerIndex" and "elementIndex" fields.
+// "elementIndex" is only used for structures.
+void HLSLVariableGetRegisterInfo(unsigned int baseRegisterIndex, Uniform *variable, ShShaderOutput outputType);
+
+// This method returns the number of used registers for a ShaderVariable. It is dependent on the HLSLBlockEncoder
+// class to count the number of used registers in a struct (which are individually packed according to the same rules).
+unsigned int HLSLVariableRegisterCount(const Varying &variable);
+unsigned int HLSLVariableRegisterCount(const Uniform &variable, ShShaderOutput outputType);
+
+}
+
+#endif // COMMON_BLOCKLAYOUT_H_
diff --git a/chromium/third_party/angle/src/common/debug.cpp b/chromium/third_party/angle/src/common/debug.cpp
index 23337405ed1..ac0a86ae2ef 100644
--- a/chromium/third_party/angle/src/common/debug.cpp
+++ b/chromium/third_party/angle/src/common/debug.cpp
@@ -7,96 +7,119 @@
// debug.cpp: Debugging utilities.
#include "common/debug.h"
-#include "common/system.h"
+#include <stdarg.h>
+#include <vector>
+#include <fstream>
+#include <cstdio>
+
+#if defined(ANGLE_ENABLE_PERF)
#include <d3d9.h>
+#endif
namespace gl
{
-
+#if defined(ANGLE_ENABLE_PERF)
typedef void (WINAPI *PerfOutputFunction)(D3DCOLOR, LPCWSTR);
+#else
+typedef void (*PerfOutputFunction)(unsigned int, const wchar_t*);
+#endif
static void output(bool traceFileDebugOnly, PerfOutputFunction perfFunc, const char *format, va_list vararg)
{
-#if !defined(ANGLE_DISABLE_PERF)
+#if defined(ANGLE_ENABLE_PERF) || defined(ANGLE_ENABLE_TRACE)
+ static std::vector<char> asciiMessageBuffer(512);
+
+ // Attempt to just print to the current buffer
+ int len = vsnprintf(&asciiMessageBuffer[0], asciiMessageBuffer.size(), format, vararg);
+ if (len < 0 || static_cast<size_t>(len) >= asciiMessageBuffer.size())
+ {
+ // Buffer was not large enough, calculate the required size and resize the buffer
+ len = vsnprintf(NULL, 0, format, vararg);
+ asciiMessageBuffer.resize(len + 1);
+
+ // Print again
+ vsnprintf(&asciiMessageBuffer[0], asciiMessageBuffer.size(), format, vararg);
+ }
+
+ // NULL terminate the buffer to be safe
+ asciiMessageBuffer[len] = '\0';
+#endif
+
+#if defined(ANGLE_ENABLE_PERF)
if (perfActive())
{
- char message[32768];
- int len = vsprintf_s(message, format, vararg);
- if (len < 0)
+ // The perf function only accepts wide strings, widen the ascii message
+ static std::wstring wideMessage;
+ if (wideMessage.capacity() < asciiMessageBuffer.size())
{
- return;
+ wideMessage.reserve(asciiMessageBuffer.size());
}
- // There are no ASCII variants of these D3DPERF functions.
- wchar_t wideMessage[32768];
- for (int i = 0; i < len; ++i)
- {
- wideMessage[i] = message[i];
- }
- wideMessage[len] = 0;
+ wideMessage.assign(asciiMessageBuffer.begin(), asciiMessageBuffer.begin() + len);
- perfFunc(0, wideMessage);
+ perfFunc(0, wideMessage.c_str());
}
-#endif
+#endif // ANGLE_ENABLE_PERF
-#if !defined(ANGLE_DISABLE_TRACE)
+#if defined(ANGLE_ENABLE_TRACE)
#if defined(NDEBUG)
if (traceFileDebugOnly)
{
return;
}
-#endif
+#endif // NDEBUG
- FILE* file = fopen(TRACE_OUTPUT_FILE, "a");
+ static std::ofstream file(TRACE_OUTPUT_FILE, std::ofstream::app);
if (file)
{
- vfprintf(file, format, vararg);
- fclose(file);
+ file.write(&asciiMessageBuffer[0], len);
+ file.flush();
}
-#endif
+
+#endif // ANGLE_ENABLE_TRACE
}
void trace(bool traceFileDebugOnly, const char *format, ...)
{
va_list vararg;
va_start(vararg, format);
-#if defined(ANGLE_DISABLE_PERF)
- output(traceFileDebugOnly, NULL, format, vararg);
-#else
+#if defined(ANGLE_ENABLE_PERF)
output(traceFileDebugOnly, D3DPERF_SetMarker, format, vararg);
+#else
+ output(traceFileDebugOnly, NULL, format, vararg);
#endif
va_end(vararg);
}
bool perfActive()
{
-#if defined(ANGLE_DISABLE_PERF)
- return false;
-#else
+#if defined(ANGLE_ENABLE_PERF)
static bool active = D3DPERF_GetStatus() != 0;
return active;
+#else
+ return false;
#endif
}
ScopedPerfEventHelper::ScopedPerfEventHelper(const char* format, ...)
{
-#if !defined(ANGLE_DISABLE_PERF)
-#if defined(ANGLE_DISABLE_TRACE)
+#if defined(ANGLE_ENABLE_PERF)
+#if !defined(ANGLE_ENABLE_TRACE)
if (!perfActive())
{
return;
}
-#endif
+#endif // !ANGLE_ENABLE_TRACE
va_list vararg;
va_start(vararg, format);
output(true, reinterpret_cast<PerfOutputFunction>(D3DPERF_BeginEvent), format, vararg);
va_end(vararg);
-#endif
+#endif // ANGLE_ENABLE_PERF
}
ScopedPerfEventHelper::~ScopedPerfEventHelper()
{
-#if !defined(ANGLE_DISABLE_PERF)
+#if defined(ANGLE_ENABLE_PERF)
if (perfActive())
{
D3DPERF_EndEvent();
diff --git a/chromium/third_party/angle/src/common/debug.h b/chromium/third_party/angle/src/common/debug.h
index 060b7272eb3..8c079717414 100644
--- a/chromium/third_party/angle/src/common/debug.h
+++ b/chromium/third_party/angle/src/common/debug.h
@@ -39,33 +39,35 @@ namespace gl
}
// A macro to output a trace of a function call and its arguments to the debugging log
-#if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
-#define TRACE(message, ...) (void(0))
-#else
+#if defined(ANGLE_ENABLE_TRACE) || defined(ANGLE_ENABLE_PERF)
#define TRACE(message, ...) gl::trace(true, "trace: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#else
+#define TRACE(message, ...) (void(0))
#endif
// A macro to output a function call and its arguments to the debugging log, to denote an item in need of fixing.
-#if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
-#define FIXME(message, ...) (void(0))
-#else
+#if defined(ANGLE_ENABLE_TRACE) || defined(ANGLE_ENABLE_PERF)
#define FIXME(message, ...) gl::trace(false, "fixme: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#else
+#define FIXME(message, ...) (void(0))
#endif
// A macro to output a function call and its arguments to the debugging log, in case of error.
-#if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
-#define ERR(message, ...) (void(0))
-#else
+#if defined(ANGLE_ENABLE_TRACE) || defined(ANGLE_ENABLE_PERF)
#define ERR(message, ...) gl::trace(false, "err: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#else
+#define ERR(message, ...) (void(0))
#endif
// A macro to log a performance event around a scope.
-#if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
-#define EVENT(message, ...) (void(0))
-#elif defined(_MSC_VER)
+#if defined(ANGLE_ENABLE_TRACE) || defined(ANGLE_ENABLE_PERF)
+#if defined(_MSC_VER)
#define EVENT(message, ...) gl::ScopedPerfEventHelper scopedPerfEventHelper ## __LINE__(__FUNCTION__ message "\n", __VA_ARGS__);
#else
#define EVENT(message, ...) gl::ScopedPerfEventHelper scopedPerfEventHelper(message "\n", ##__VA_ARGS__);
+#endif // _MSC_VER
+#else
+#define EVENT(message, ...) (void(0))
#endif
// A macro asserting a condition and outputting failures to the debug log
@@ -75,15 +77,24 @@ namespace gl
ERR("\t! Assert failed in %s(%d): "#expression"\n", __FUNCTION__, __LINE__); \
assert(expression); \
} while(0)
+#define UNUSED_ASSERTION_VARIABLE(variable)
#else
#define ASSERT(expression) (void(0))
+#define UNUSED_ASSERTION_VARIABLE(variable) ((void)variable)
#endif
// A macro to indicate unimplemented functionality
+
+// Define NOASSERT_UNIMPLEMENTED to non zero to skip the assert fail in the unimplemented checks
+// This will allow us to test with some automated test suites (eg dEQP) without crashing
+#ifndef NOASSERT_UNIMPLEMENTED
+#define NOASSERT_UNIMPLEMENTED 0
+#endif
+
#if !defined(NDEBUG)
#define UNIMPLEMENTED() do { \
FIXME("\t! Unimplemented: %s(%d)\n", __FUNCTION__, __LINE__); \
- assert(false); \
+ assert(NOASSERT_UNIMPLEMENTED); \
} while(0)
#else
#define UNIMPLEMENTED() FIXME("\t! Unimplemented: %s(%d)\n", __FUNCTION__, __LINE__)
@@ -99,9 +110,7 @@ namespace gl
#define UNREACHABLE() ERR("\t! Unreachable reached: %s(%d)\n", __FUNCTION__, __LINE__)
#endif
-// A macro that determines whether an object has a given runtime type. MSVC uses _CPPRTTI.
-// GCC uses __GXX_RTTI, but the macro was introduced in version 4.3, so we assume that all older
-// versions support RTTI.
+// A macro that determines whether an object has a given runtime type.
#if !defined(NDEBUG) && (!defined(_MSC_VER) || defined(_CPPRTTI)) && (!defined(__GNUC__) || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) || defined(__GXX_RTTI))
#define HAS_DYNAMIC_TYPE(type, obj) (dynamic_cast<type >(obj) != NULL)
#else
@@ -109,6 +118,13 @@ namespace gl
#endif
// A macro functioning as a compile-time assert to validate constant conditions
-#define META_ASSERT(condition) typedef int COMPILE_TIME_ASSERT_##__LINE__[static_cast<bool>(condition)?1:-1]
+#if defined(_MSC_VER) && _MSC_VER >= 1600
+#define META_ASSERT_MSG(condition, msg) static_assert(condition, msg)
+#else
+#define META_ASSERT_CONCAT(a, b) a ## b
+#define META_ASSERT_CONCAT2(a, b) META_ASSERT_CONCAT(a, b)
+#define META_ASSERT_MSG(condition, msg) typedef int META_ASSERT_CONCAT2(COMPILE_TIME_ASSERT_, __LINE__)[static_cast<bool>(condition)?1:-1]
+#endif
+#define META_ASSERT(condition) META_ASSERT_MSG(condition, "compile time assertion failed.")
#endif // COMMON_DEBUG_H_
diff --git a/chromium/third_party/angle/src/common/event_tracer.cpp b/chromium/third_party/angle/src/common/event_tracer.cpp
index 96cbb010614..353c69d05c5 100644
--- a/chromium/third_party/angle/src/common/event_tracer.cpp
+++ b/chromium/third_party/angle/src/common/event_tracer.cpp
@@ -14,8 +14,8 @@ AddTraceEventFunc g_addTraceEvent;
extern "C" {
-void __stdcall SetTraceFunctionPointers(GetCategoryEnabledFlagFunc getCategoryEnabledFlag,
- AddTraceEventFunc addTraceEvent)
+void TRACE_ENTRY SetTraceFunctionPointers(GetCategoryEnabledFlagFunc getCategoryEnabledFlag,
+ AddTraceEventFunc addTraceEvent)
{
gl::g_getCategoryEnabledFlag = getCategoryEnabledFlag;
gl::g_addTraceEvent = addTraceEvent;
diff --git a/chromium/third_party/angle/src/common/event_tracer.h b/chromium/third_party/angle/src/common/event_tracer.h
index ae397e7db99..14b7b298fd8 100644
--- a/chromium/third_party/angle/src/common/event_tracer.h
+++ b/chromium/third_party/angle/src/common/event_tracer.h
@@ -5,6 +5,14 @@
#ifndef COMMON_EVENT_TRACER_H_
#define COMMON_EVENT_TRACER_H_
+#if !defined(TRACE_ENTRY)
+#if defined(_WIN32)
+#define TRACE_ENTRY __stdcall
+#else
+#define TRACE_ENTRY
+#endif // // _WIN32
+#endif //TRACE_ENTRY
+
extern "C" {
typedef const unsigned char* (*GetCategoryEnabledFlagFunc)(const char* name);
@@ -14,8 +22,8 @@ typedef void (*AddTraceEventFunc)(char phase, const unsigned char* categoryGroup
unsigned char flags);
// extern "C" so that it has a reasonable name for GetProcAddress.
-void __stdcall SetTraceFunctionPointers(GetCategoryEnabledFlagFunc get_category_enabled_flag,
- AddTraceEventFunc add_trace_event_func);
+void TRACE_ENTRY SetTraceFunctionPointers(GetCategoryEnabledFlagFunc get_category_enabled_flag,
+ AddTraceEventFunc add_trace_event_func);
}
diff --git a/chromium/third_party/angle/src/common/mathutil.cpp b/chromium/third_party/angle/src/common/mathutil.cpp
new file mode 100644
index 00000000000..20b3f0c113a
--- /dev/null
+++ b/chromium/third_party/angle/src/common/mathutil.cpp
@@ -0,0 +1,66 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// mathutil.cpp: Math and bit manipulation functions.
+
+#include "common/mathutil.h"
+#include <algorithm>
+#include <math.h>
+
+namespace gl
+{
+
+struct RGB9E5Data
+{
+ unsigned int R : 9;
+ unsigned int G : 9;
+ unsigned int B : 9;
+ unsigned int E : 5;
+};
+
+// B is the exponent bias (15)
+static const int g_sharedexp_bias = 15;
+
+// N is the number of mantissa bits per component (9)
+static const int g_sharedexp_mantissabits = 9;
+
+// Emax is the maximum allowed biased exponent value (31)
+static const int g_sharedexp_maxexponent = 31;
+
+static const float g_sharedexp_max = ((pow(2.0f, g_sharedexp_mantissabits) - 1) /
+ pow(2.0f, g_sharedexp_mantissabits)) *
+ pow(2.0f, g_sharedexp_maxexponent - g_sharedexp_bias);
+
+unsigned int convertRGBFloatsTo999E5(float red, float green, float blue)
+{
+ const float red_c = std::max<float>(0, std::min(g_sharedexp_max, red));
+ const float green_c = std::max<float>(0, std::min(g_sharedexp_max, green));
+ const float blue_c = std::max<float>(0, std::min(g_sharedexp_max, blue));
+
+ const float max_c = std::max<float>(std::max<float>(red_c, green_c), blue_c);
+ const float exp_p = std::max<float>(-g_sharedexp_bias - 1, floor(log(max_c))) + 1 + g_sharedexp_bias;
+ const int max_s = floor((max_c / (pow(2.0f, exp_p - g_sharedexp_bias - g_sharedexp_mantissabits))) + 0.5f);
+ const int exp_s = (max_s < pow(2.0f, g_sharedexp_mantissabits)) ? exp_p : exp_p + 1;
+
+ RGB9E5Data output;
+ output.R = floor((red_c / (pow(2.0f, exp_s - g_sharedexp_bias - g_sharedexp_mantissabits))) + 0.5f);
+ output.G = floor((green_c / (pow(2.0f, exp_s - g_sharedexp_bias - g_sharedexp_mantissabits))) + 0.5f);
+ output.B = floor((blue_c / (pow(2.0f, exp_s - g_sharedexp_bias - g_sharedexp_mantissabits))) + 0.5f);
+ output.E = exp_s;
+
+ return *reinterpret_cast<unsigned int*>(&output);
+}
+
+void convert999E5toRGBFloats(unsigned int input, float *red, float *green, float *blue)
+{
+ const RGB9E5Data *inputData = reinterpret_cast<const RGB9E5Data*>(&input);
+
+ *red = inputData->R * pow(2.0f, (int)inputData->E - g_sharedexp_bias - g_sharedexp_mantissabits);
+ *green = inputData->G * pow(2.0f, (int)inputData->E - g_sharedexp_bias - g_sharedexp_mantissabits);
+ *blue = inputData->B * pow(2.0f, (int)inputData->E - g_sharedexp_bias - g_sharedexp_mantissabits);
+}
+
+}
diff --git a/chromium/third_party/angle/src/common/mathutil.h b/chromium/third_party/angle/src/common/mathutil.h
new file mode 100644
index 00000000000..2d36631b411
--- /dev/null
+++ b/chromium/third_party/angle/src/common/mathutil.h
@@ -0,0 +1,546 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// mathutil.h: Math and bit manipulation functions.
+
+#ifndef LIBGLESV2_MATHUTIL_H_
+#define LIBGLESV2_MATHUTIL_H_
+
+#include "common/debug.h"
+
+#if defined(_WIN32)
+#include <intrin.h>
+#endif
+
+#include <limits>
+#include <algorithm>
+#include <string.h>
+
+namespace gl
+{
+
+const unsigned int Float32One = 0x3F800000;
+const unsigned short Float16One = 0x3C00;
+
+struct Vector4
+{
+ Vector4() {}
+ Vector4(float x, float y, float z, float w) : x(x), y(y), z(z), w(w) {}
+
+ float x;
+ float y;
+ float z;
+ float w;
+};
+
+inline bool isPow2(int x)
+{
+ return (x & (x - 1)) == 0 && (x != 0);
+}
+
+inline int log2(int x)
+{
+ int r = 0;
+ while ((x >> r) > 1) r++;
+ return r;
+}
+
+inline unsigned int ceilPow2(unsigned int x)
+{
+ if (x != 0) x--;
+ x |= x >> 1;
+ x |= x >> 2;
+ x |= x >> 4;
+ x |= x >> 8;
+ x |= x >> 16;
+ x++;
+
+ return x;
+}
+
+inline int clampToInt(unsigned int x)
+{
+ return static_cast<int>(std::min(x, static_cast<unsigned int>(std::numeric_limits<int>::max())));
+}
+
+template <typename DestT, typename SrcT>
+inline DestT clampCast(SrcT value)
+{
+ // This assumes SrcT can properly represent DestT::min/max
+ // Unfortunately we can't use META_ASSERT without C++11 constexpr support
+ ASSERT(static_cast<DestT>(static_cast<SrcT>(std::numeric_limits<DestT>::min())) == std::numeric_limits<DestT>::min());
+ ASSERT(static_cast<DestT>(static_cast<SrcT>(std::numeric_limits<DestT>::max())) == std::numeric_limits<DestT>::max());
+
+ SrcT lo = static_cast<SrcT>(std::numeric_limits<DestT>::min());
+ SrcT hi = static_cast<SrcT>(std::numeric_limits<DestT>::max());
+ return static_cast<DestT>(value > lo ? (value > hi ? hi : value) : lo);
+}
+
+template<typename T, typename MIN, typename MAX>
+inline T clamp(T x, MIN min, MAX max)
+{
+ // Since NaNs fail all comparison tests, a NaN value will default to min
+ return x > min ? (x > max ? max : x) : min;
+}
+
+inline float clamp01(float x)
+{
+ return clamp(x, 0.0f, 1.0f);
+}
+
+template<const int n>
+inline unsigned int unorm(float x)
+{
+ const unsigned int max = 0xFFFFFFFF >> (32 - n);
+
+ if (x > 1)
+ {
+ return max;
+ }
+ else if (x < 0)
+ {
+ return 0;
+ }
+ else
+ {
+ return (unsigned int)(max * x + 0.5f);
+ }
+}
+
+inline bool supportsSSE2()
+{
+#if defined(_WIN32)
+ static bool checked = false;
+ static bool supports = false;
+
+ if (checked)
+ {
+ return supports;
+ }
+
+ int info[4];
+ __cpuid(info, 0);
+
+ if (info[0] >= 1)
+ {
+ __cpuid(info, 1);
+
+ supports = (info[3] >> 26) & 1;
+ }
+
+ checked = true;
+
+ return supports;
+#else
+ UNIMPLEMENTED();
+ return false;
+#endif
+}
+
+template <typename destType, typename sourceType>
+destType bitCast(const sourceType &source)
+{
+ size_t copySize = std::min(sizeof(destType), sizeof(sourceType));
+ destType output;
+ memcpy(&output, &source, copySize);
+ return output;
+}
+
+inline unsigned short float32ToFloat16(float fp32)
+{
+ unsigned int fp32i = (unsigned int&)fp32;
+ unsigned int sign = (fp32i & 0x80000000) >> 16;
+ unsigned int abs = fp32i & 0x7FFFFFFF;
+
+ if(abs > 0x47FFEFFF) // Infinity
+ {
+ return sign | 0x7FFF;
+ }
+ else if(abs < 0x38800000) // Denormal
+ {
+ unsigned int mantissa = (abs & 0x007FFFFF) | 0x00800000;
+ int e = 113 - (abs >> 23);
+
+ if(e < 24)
+ {
+ abs = mantissa >> e;
+ }
+ else
+ {
+ abs = 0;
+ }
+
+ return sign | (abs + 0x00000FFF + ((abs >> 13) & 1)) >> 13;
+ }
+ else
+ {
+ return sign | (abs + 0xC8000000 + 0x00000FFF + ((abs >> 13) & 1)) >> 13;
+ }
+}
+
+float float16ToFloat32(unsigned short h);
+
+unsigned int convertRGBFloatsTo999E5(float red, float green, float blue);
+void convert999E5toRGBFloats(unsigned int input, float *red, float *green, float *blue);
+
+inline unsigned short float32ToFloat11(float fp32)
+{
+ const unsigned int float32MantissaMask = 0x7FFFFF;
+ const unsigned int float32ExponentMask = 0x7F800000;
+ const unsigned int float32SignMask = 0x80000000;
+ const unsigned int float32ValueMask = ~float32SignMask;
+ const unsigned int float32ExponentFirstBit = 23;
+ const unsigned int float32ExponentBias = 127;
+
+ const unsigned short float11Max = 0x7BF;
+ const unsigned short float11MantissaMask = 0x3F;
+ const unsigned short float11ExponentMask = 0x7C0;
+ const unsigned short float11BitMask = 0x7FF;
+ const unsigned int float11ExponentBias = 14;
+
+ const unsigned int float32Maxfloat11 = 0x477E0000;
+ const unsigned int float32Minfloat11 = 0x38800000;
+
+ const unsigned int float32Bits = bitCast<unsigned int>(fp32);
+ const bool float32Sign = (float32Bits & float32SignMask) == float32SignMask;
+
+ unsigned int float32Val = float32Bits & float32ValueMask;
+
+ if ((float32Val & float32ExponentMask) == float32ExponentMask)
+ {
+ // INF or NAN
+ if ((float32Val & float32MantissaMask) != 0)
+ {
+ return float11ExponentMask | (((float32Val >> 17) | (float32Val >> 11) | (float32Val >> 6) | (float32Val)) & float11MantissaMask);
+ }
+ else if (float32Sign)
+ {
+ // -INF is clamped to 0 since float11 is positive only
+ return 0;
+ }
+ else
+ {
+ return float11ExponentMask;
+ }
+ }
+ else if (float32Sign)
+ {
+ // float11 is positive only, so clamp to zero
+ return 0;
+ }
+ else if (float32Val > float32Maxfloat11)
+ {
+ // The number is too large to be represented as a float11, set to max
+ return float11Max;
+ }
+ else
+ {
+ if (float32Val < float32Minfloat11)
+ {
+ // The number is too small to be represented as a normalized float11
+ // Convert it to a denormalized value.
+ const unsigned int shift = (float32ExponentBias - float11ExponentBias) - (float32Val >> float32ExponentFirstBit);
+ float32Val = ((1 << float32ExponentFirstBit) | (float32Val & float32MantissaMask)) >> shift;
+ }
+ else
+ {
+ // Rebias the exponent to represent the value as a normalized float11
+ float32Val += 0xC8000000;
+ }
+
+ return ((float32Val + 0xFFFF + ((float32Val >> 17) & 1)) >> 17) & float11BitMask;
+ }
+}
+
+inline unsigned short float32ToFloat10(float fp32)
+{
+ const unsigned int float32MantissaMask = 0x7FFFFF;
+ const unsigned int float32ExponentMask = 0x7F800000;
+ const unsigned int float32SignMask = 0x80000000;
+ const unsigned int float32ValueMask = ~float32SignMask;
+ const unsigned int float32ExponentFirstBit = 23;
+ const unsigned int float32ExponentBias = 127;
+
+ const unsigned short float10Max = 0x3DF;
+ const unsigned short float10MantissaMask = 0x1F;
+ const unsigned short float10ExponentMask = 0x3E0;
+ const unsigned short float10BitMask = 0x3FF;
+ const unsigned int float10ExponentBias = 14;
+
+ const unsigned int float32Maxfloat10 = 0x477C0000;
+ const unsigned int float32Minfloat10 = 0x38800000;
+
+ const unsigned int float32Bits = bitCast<unsigned int>(fp32);
+ const bool float32Sign = (float32Bits & float32SignMask) == float32SignMask;
+
+ unsigned int float32Val = float32Bits & float32ValueMask;
+
+ if ((float32Val & float32ExponentMask) == float32ExponentMask)
+ {
+ // INF or NAN
+ if ((float32Val & float32MantissaMask) != 0)
+ {
+ return float10ExponentMask | (((float32Val >> 18) | (float32Val >> 13) | (float32Val >> 3) | (float32Val)) & float10MantissaMask);
+ }
+ else if (float32Sign)
+ {
+ // -INF is clamped to 0 since float11 is positive only
+ return 0;
+ }
+ else
+ {
+ return float10ExponentMask;
+ }
+ }
+ else if (float32Sign)
+ {
+ // float10 is positive only, so clamp to zero
+ return 0;
+ }
+ else if (float32Val > float32Maxfloat10)
+ {
+ // The number is too large to be represented as a float11, set to max
+ return float10Max;
+ }
+ else
+ {
+ if (float32Val < float32Minfloat10)
+ {
+ // The number is too small to be represented as a normalized float11
+ // Convert it to a denormalized value.
+ const unsigned int shift = (float32ExponentBias - float10ExponentBias) - (float32Val >> float32ExponentFirstBit);
+ float32Val = ((1 << float32ExponentFirstBit) | (float32Val & float32MantissaMask)) >> shift;
+ }
+ else
+ {
+ // Rebias the exponent to represent the value as a normalized float11
+ float32Val += 0xC8000000;
+ }
+
+ return ((float32Val + 0x1FFFF + ((float32Val >> 18) & 1)) >> 18) & float10BitMask;
+ }
+}
+
+inline float float11ToFloat32(unsigned short fp11)
+{
+ unsigned short exponent = (fp11 >> 6) & 0x1F;
+ unsigned short mantissa = fp11 & 0x3F;
+
+ if (exponent == 0x1F)
+ {
+ // INF or NAN
+ return bitCast<float>(0x7f800000 | (mantissa << 17));
+ }
+ else
+ {
+ if (exponent != 0)
+ {
+ // normalized
+ }
+ else if (mantissa != 0)
+ {
+ // The value is denormalized
+ exponent = 1;
+
+ do
+ {
+ exponent--;
+ mantissa <<= 1;
+ }
+ while ((mantissa & 0x40) == 0);
+
+ mantissa = mantissa & 0x3F;
+ }
+ else // The value is zero
+ {
+ exponent = -112;
+ }
+
+ return bitCast<float>(((exponent + 112) << 23) | (mantissa << 17));
+ }
+}
+
+inline float float10ToFloat32(unsigned short fp11)
+{
+ unsigned short exponent = (fp11 >> 5) & 0x1F;
+ unsigned short mantissa = fp11 & 0x1F;
+
+ if (exponent == 0x1F)
+ {
+ // INF or NAN
+ return bitCast<float>(0x7f800000 | (mantissa << 17));
+ }
+ else
+ {
+ if (exponent != 0)
+ {
+ // normalized
+ }
+ else if (mantissa != 0)
+ {
+ // The value is denormalized
+ exponent = 1;
+
+ do
+ {
+ exponent--;
+ mantissa <<= 1;
+ }
+ while ((mantissa & 0x20) == 0);
+
+ mantissa = mantissa & 0x1F;
+ }
+ else // The value is zero
+ {
+ exponent = -112;
+ }
+
+ return bitCast<float>(((exponent + 112) << 23) | (mantissa << 18));
+ }
+}
+
+template <typename T>
+inline float normalizedToFloat(T input)
+{
+ META_ASSERT(std::numeric_limits<T>::is_integer);
+
+ const float inverseMax = 1.0f / std::numeric_limits<T>::max();
+ return input * inverseMax;
+}
+
+template <unsigned int inputBitCount, typename T>
+inline float normalizedToFloat(T input)
+{
+ META_ASSERT(std::numeric_limits<T>::is_integer);
+ META_ASSERT(inputBitCount < (sizeof(T) * 8));
+
+ const float inverseMax = 1.0f / ((1 << inputBitCount) - 1);
+ return input * inverseMax;
+}
+
+template <typename T>
+inline T floatToNormalized(float input)
+{
+ return std::numeric_limits<T>::max() * input + 0.5f;
+}
+
+template <unsigned int outputBitCount, typename T>
+inline T floatToNormalized(float input)
+{
+ META_ASSERT(outputBitCount < (sizeof(T) * 8));
+ return ((1 << outputBitCount) - 1) * input + 0.5f;
+}
+
+template <unsigned int inputBitCount, unsigned int inputBitStart, typename T>
+inline T getShiftedData(T input)
+{
+ META_ASSERT(inputBitCount + inputBitStart <= (sizeof(T) * 8));
+ const T mask = (1 << inputBitCount) - 1;
+ return (input >> inputBitStart) & mask;
+}
+
+template <unsigned int inputBitCount, unsigned int inputBitStart, typename T>
+inline T shiftData(T input)
+{
+ META_ASSERT(inputBitCount + inputBitStart <= (sizeof(T) * 8));
+ const T mask = (1 << inputBitCount) - 1;
+ return (input & mask) << inputBitStart;
+}
+
+
+inline unsigned char average(unsigned char a, unsigned char b)
+{
+ return ((a ^ b) >> 1) + (a & b);
+}
+
+inline signed char average(signed char a, signed char b)
+{
+ return ((short)a + (short)b) / 2;
+}
+
+inline unsigned short average(unsigned short a, unsigned short b)
+{
+ return ((a ^ b) >> 1) + (a & b);
+}
+
+inline signed short average(signed short a, signed short b)
+{
+ return ((int)a + (int)b) / 2;
+}
+
+inline unsigned int average(unsigned int a, unsigned int b)
+{
+ return ((a ^ b) >> 1) + (a & b);
+}
+
+inline signed int average(signed int a, signed int b)
+{
+ return ((long long)a + (long long)b) / 2;
+}
+
+inline float average(float a, float b)
+{
+ return (a + b) * 0.5f;
+}
+
+inline unsigned short averageHalfFloat(unsigned short a, unsigned short b)
+{
+ return float32ToFloat16((float16ToFloat32(a) + float16ToFloat32(b)) * 0.5f);
+}
+
+inline unsigned int averageFloat11(unsigned int a, unsigned int b)
+{
+ return float32ToFloat11((float11ToFloat32(a) + float11ToFloat32(b)) * 0.5f);
+}
+
+inline unsigned int averageFloat10(unsigned int a, unsigned int b)
+{
+ return float32ToFloat10((float10ToFloat32(a) + float10ToFloat32(b)) * 0.5f);
+}
+
+}
+
+namespace rx
+{
+
+struct Range
+{
+ Range() {}
+ Range(int lo, int hi) : start(lo), end(hi) { ASSERT(lo <= hi); }
+
+ int start;
+ int end;
+};
+
+template <typename T>
+T roundUp(const T value, const T alignment)
+{
+ return value + alignment - 1 - (value - 1) % alignment;
+}
+
+template <class T>
+inline bool IsUnsignedAdditionSafe(T lhs, T rhs)
+{
+ META_ASSERT(!std::numeric_limits<T>::is_signed);
+ return (rhs <= std::numeric_limits<T>::max() - lhs);
+}
+
+template <class T>
+inline bool IsUnsignedMultiplicationSafe(T lhs, T rhs)
+{
+ META_ASSERT(!std::numeric_limits<T>::is_signed);
+ return (lhs == T(0) || rhs == T(0) || (rhs <= std::numeric_limits<T>::max() / lhs));
+}
+
+template <class SmallIntT, class BigIntT>
+inline bool IsIntegerCastSafe(BigIntT bigValue)
+{
+ return (static_cast<BigIntT>(static_cast<SmallIntT>(bigValue)) == bigValue);
+}
+
+}
+
+#endif // LIBGLESV2_MATHUTIL_H_
diff --git a/chromium/third_party/angle/src/common/shadervars.h b/chromium/third_party/angle/src/common/shadervars.h
new file mode 100644
index 00000000000..99187a0dc19
--- /dev/null
+++ b/chromium/third_party/angle/src/common/shadervars.h
@@ -0,0 +1,162 @@
+//
+// Copyright (c) 2013-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// shadervars.h:
+// Types to represent GL variables (varyings, uniforms, etc)
+//
+
+#ifndef COMMON_SHADERVARIABLE_H_
+#define COMMON_SHADERVARIABLE_H_
+
+#include <string>
+#include <vector>
+#include <algorithm>
+
+#include <GLES3/gl3.h>
+#include <GLES2/gl2.h>
+
+namespace gl
+{
+
+// Varying interpolation qualifier, see section 4.3.9 of the ESSL 3.00.4 spec
+enum InterpolationType
+{
+ INTERPOLATION_SMOOTH,
+ INTERPOLATION_CENTROID,
+ INTERPOLATION_FLAT
+};
+
+// Uniform block layout qualifier, see section 4.3.8.3 of the ESSL 3.00.4 spec
+enum BlockLayoutType
+{
+ BLOCKLAYOUT_STANDARD,
+ BLOCKLAYOUT_PACKED,
+ BLOCKLAYOUT_SHARED
+};
+
+// Base class for all variables defined in shaders, including Varyings, Uniforms, etc
+struct ShaderVariable
+{
+ GLenum type;
+ GLenum precision;
+ std::string name;
+ unsigned int arraySize;
+
+ ShaderVariable(GLenum typeIn, GLenum precisionIn, const char *nameIn, unsigned int arraySizeIn)
+ : type(typeIn),
+ precision(precisionIn),
+ name(nameIn),
+ arraySize(arraySizeIn)
+ {}
+
+ bool isArray() const { return arraySize > 0; }
+ unsigned int elementCount() const { return std::max(1u, arraySize); }
+};
+
+// Uniform registers (and element indices) are assigned when outputting shader code
+struct Uniform : public ShaderVariable
+{
+ unsigned int registerIndex;
+ unsigned int elementIndex; // Offset within a register, for struct members
+ std::vector<Uniform> fields;
+
+ Uniform(GLenum typeIn, GLenum precisionIn, const char *nameIn, unsigned int arraySizeIn,
+ unsigned int registerIndexIn, unsigned int elementIndexIn)
+ : ShaderVariable(typeIn, precisionIn, nameIn, arraySizeIn),
+ registerIndex(registerIndexIn),
+ elementIndex(elementIndexIn)
+ {}
+
+ bool isStruct() const { return !fields.empty(); }
+};
+
+struct Attribute : public ShaderVariable
+{
+ int location;
+
+ Attribute()
+ : ShaderVariable(GL_NONE, GL_NONE, "", 0),
+ location(-1)
+ {}
+
+ Attribute(GLenum typeIn, GLenum precisionIn, const char *nameIn, unsigned int arraySizeIn, int locationIn)
+ : ShaderVariable(typeIn, precisionIn, nameIn, arraySizeIn),
+ location(locationIn)
+ {}
+};
+
+struct InterfaceBlockField : public ShaderVariable
+{
+ bool isRowMajorMatrix;
+ std::vector<InterfaceBlockField> fields;
+
+ InterfaceBlockField(GLenum typeIn, GLenum precisionIn, const char *nameIn, unsigned int arraySizeIn, bool isRowMajorMatrix)
+ : ShaderVariable(typeIn, precisionIn, nameIn, arraySizeIn),
+ isRowMajorMatrix(isRowMajorMatrix)
+ {}
+
+ bool isStruct() const { return !fields.empty(); }
+};
+
+struct Varying : public ShaderVariable
+{
+ InterpolationType interpolation;
+ std::vector<Varying> fields;
+ std::string structName;
+
+ Varying(GLenum typeIn, GLenum precisionIn, const char *nameIn, unsigned int arraySizeIn, InterpolationType interpolationIn)
+ : ShaderVariable(typeIn, precisionIn, nameIn, arraySizeIn),
+ interpolation(interpolationIn)
+ {}
+
+ bool isStruct() const { return !fields.empty(); }
+};
+
+struct BlockMemberInfo
+{
+ int offset;
+ int arrayStride;
+ int matrixStride;
+ bool isRowMajorMatrix;
+
+ static BlockMemberInfo getDefaultBlockInfo()
+ {
+ return BlockMemberInfo(-1, -1, -1, false);
+ }
+
+ BlockMemberInfo(int offset, int arrayStride, int matrixStride, bool isRowMajorMatrix)
+ : offset(offset),
+ arrayStride(arrayStride),
+ matrixStride(matrixStride),
+ isRowMajorMatrix(isRowMajorMatrix)
+ {}
+};
+
+typedef std::vector<BlockMemberInfo> BlockMemberInfoArray;
+
+struct InterfaceBlock
+{
+ std::string name;
+ unsigned int arraySize;
+ size_t dataSize;
+ BlockLayoutType layout;
+ bool isRowMajorLayout;
+ std::vector<InterfaceBlockField> fields;
+ std::vector<BlockMemberInfo> blockInfo;
+
+ unsigned int registerIndex;
+
+ InterfaceBlock(const char *name, unsigned int arraySize, unsigned int registerIndex)
+ : name(name),
+ arraySize(arraySize),
+ layout(BLOCKLAYOUT_SHARED),
+ registerIndex(registerIndex),
+ isRowMajorLayout(false)
+ {}
+};
+
+}
+
+#endif // COMMON_SHADERVARIABLE_H_
diff --git a/chromium/third_party/angle/src/common/system.h b/chromium/third_party/angle/src/common/system.h
deleted file mode 100644
index 5eb140bccd2..00000000000
--- a/chromium/third_party/angle/src/common/system.h
+++ /dev/null
@@ -1,26 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// system.h: Includes Windows system headers and undefines macros that conflict.
-
-#ifndef COMMON_SYSTEM_H
-#define COMMON_SYSTEM_H
-
-#if !defined(WIN32_LEAN_AND_MEAN)
-#define WIN32_LEAN_AND_MEAN
-#endif
-
-#include <windows.h>
-
-#if defined(min)
-#undef min
-#endif
-
-#if defined(max)
-#undef max
-#endif
-
-#endif // COMMON_SYSTEM_H
diff --git a/chromium/third_party/angle/src/common/utilities.cpp b/chromium/third_party/angle/src/common/utilities.cpp
new file mode 100644
index 00000000000..b1e989bbf64
--- /dev/null
+++ b/chromium/third_party/angle/src/common/utilities.cpp
@@ -0,0 +1,473 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// utilities.cpp: Conversion functions and other utility routines.
+
+#include "common/utilities.h"
+#include "common/mathutil.h"
+
+#if defined(_WIN32)
+#include <windows.h>
+#endif
+
+#include <set>
+
+namespace gl
+{
+
+int UniformComponentCount(GLenum type)
+{
+ switch (type)
+ {
+ case GL_BOOL:
+ case GL_FLOAT:
+ case GL_INT:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_3D:
+ case GL_SAMPLER_CUBE:
+ case GL_SAMPLER_2D_ARRAY:
+ case GL_INT_SAMPLER_2D:
+ case GL_INT_SAMPLER_3D:
+ case GL_INT_SAMPLER_CUBE:
+ case GL_INT_SAMPLER_2D_ARRAY:
+ case GL_UNSIGNED_INT_SAMPLER_2D:
+ case GL_UNSIGNED_INT_SAMPLER_3D:
+ case GL_UNSIGNED_INT_SAMPLER_CUBE:
+ case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
+ case GL_SAMPLER_2D_SHADOW:
+ case GL_SAMPLER_CUBE_SHADOW:
+ case GL_SAMPLER_2D_ARRAY_SHADOW:
+ case GL_UNSIGNED_INT:
+ return 1;
+ case GL_BOOL_VEC2:
+ case GL_FLOAT_VEC2:
+ case GL_INT_VEC2:
+ case GL_UNSIGNED_INT_VEC2:
+ return 2;
+ case GL_INT_VEC3:
+ case GL_FLOAT_VEC3:
+ case GL_BOOL_VEC3:
+ case GL_UNSIGNED_INT_VEC3:
+ return 3;
+ case GL_BOOL_VEC4:
+ case GL_FLOAT_VEC4:
+ case GL_INT_VEC4:
+ case GL_UNSIGNED_INT_VEC4:
+ case GL_FLOAT_MAT2:
+ return 4;
+ case GL_FLOAT_MAT2x3:
+ case GL_FLOAT_MAT3x2:
+ return 6;
+ case GL_FLOAT_MAT2x4:
+ case GL_FLOAT_MAT4x2:
+ return 8;
+ case GL_FLOAT_MAT3:
+ return 9;
+ case GL_FLOAT_MAT3x4:
+ case GL_FLOAT_MAT4x3:
+ return 12;
+ case GL_FLOAT_MAT4:
+ return 16;
+ default:
+ UNREACHABLE();
+ }
+
+ return 0;
+}
+
+GLenum UniformComponentType(GLenum type)
+{
+ switch(type)
+ {
+ case GL_BOOL:
+ case GL_BOOL_VEC2:
+ case GL_BOOL_VEC3:
+ case GL_BOOL_VEC4:
+ return GL_BOOL;
+ case GL_FLOAT:
+ case GL_FLOAT_VEC2:
+ case GL_FLOAT_VEC3:
+ case GL_FLOAT_VEC4:
+ case GL_FLOAT_MAT2:
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT4:
+ case GL_FLOAT_MAT2x3:
+ case GL_FLOAT_MAT3x2:
+ case GL_FLOAT_MAT2x4:
+ case GL_FLOAT_MAT4x2:
+ case GL_FLOAT_MAT3x4:
+ case GL_FLOAT_MAT4x3:
+ return GL_FLOAT;
+ case GL_INT:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_3D:
+ case GL_SAMPLER_CUBE:
+ case GL_SAMPLER_2D_ARRAY:
+ case GL_INT_SAMPLER_2D:
+ case GL_INT_SAMPLER_3D:
+ case GL_INT_SAMPLER_CUBE:
+ case GL_INT_SAMPLER_2D_ARRAY:
+ case GL_UNSIGNED_INT_SAMPLER_2D:
+ case GL_UNSIGNED_INT_SAMPLER_3D:
+ case GL_UNSIGNED_INT_SAMPLER_CUBE:
+ case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
+ case GL_SAMPLER_2D_SHADOW:
+ case GL_SAMPLER_CUBE_SHADOW:
+ case GL_SAMPLER_2D_ARRAY_SHADOW:
+ case GL_INT_VEC2:
+ case GL_INT_VEC3:
+ case GL_INT_VEC4:
+ return GL_INT;
+ case GL_UNSIGNED_INT:
+ case GL_UNSIGNED_INT_VEC2:
+ case GL_UNSIGNED_INT_VEC3:
+ case GL_UNSIGNED_INT_VEC4:
+ return GL_UNSIGNED_INT;
+ default:
+ UNREACHABLE();
+ }
+
+ return GL_NONE;
+}
+
+size_t UniformComponentSize(GLenum type)
+{
+ switch(type)
+ {
+ case GL_BOOL: return sizeof(GLint);
+ case GL_FLOAT: return sizeof(GLfloat);
+ case GL_INT: return sizeof(GLint);
+ case GL_UNSIGNED_INT: return sizeof(GLuint);
+ default: UNREACHABLE();
+ }
+
+ return 0;
+}
+
+size_t UniformInternalSize(GLenum type)
+{
+ // Expanded to 4-element vectors
+ return UniformComponentSize(UniformComponentType(type)) * VariableRowCount(type) * 4;
+}
+
+size_t UniformExternalSize(GLenum type)
+{
+ return UniformComponentSize(UniformComponentType(type)) * UniformComponentCount(type);
+}
+
+GLenum UniformBoolVectorType(GLenum type)
+{
+ switch (type)
+ {
+ case GL_FLOAT:
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ return GL_BOOL;
+ case GL_FLOAT_VEC2:
+ case GL_INT_VEC2:
+ case GL_UNSIGNED_INT_VEC2:
+ return GL_BOOL_VEC2;
+ case GL_FLOAT_VEC3:
+ case GL_INT_VEC3:
+ case GL_UNSIGNED_INT_VEC3:
+ return GL_BOOL_VEC3;
+ case GL_FLOAT_VEC4:
+ case GL_INT_VEC4:
+ case GL_UNSIGNED_INT_VEC4:
+ return GL_BOOL_VEC4;
+
+ default:
+ UNREACHABLE();
+ return GL_NONE;
+ }
+}
+
+int VariableRowCount(GLenum type)
+{
+ switch (type)
+ {
+ case GL_NONE:
+ case GL_STRUCT_ANGLEX:
+ return 0;
+ case GL_BOOL:
+ case GL_FLOAT:
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_BOOL_VEC2:
+ case GL_FLOAT_VEC2:
+ case GL_INT_VEC2:
+ case GL_UNSIGNED_INT_VEC2:
+ case GL_BOOL_VEC3:
+ case GL_FLOAT_VEC3:
+ case GL_INT_VEC3:
+ case GL_UNSIGNED_INT_VEC3:
+ case GL_BOOL_VEC4:
+ case GL_FLOAT_VEC4:
+ case GL_INT_VEC4:
+ case GL_UNSIGNED_INT_VEC4:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_3D:
+ case GL_SAMPLER_CUBE:
+ case GL_SAMPLER_2D_ARRAY:
+ case GL_INT_SAMPLER_2D:
+ case GL_INT_SAMPLER_3D:
+ case GL_INT_SAMPLER_CUBE:
+ case GL_INT_SAMPLER_2D_ARRAY:
+ case GL_UNSIGNED_INT_SAMPLER_2D:
+ case GL_UNSIGNED_INT_SAMPLER_3D:
+ case GL_UNSIGNED_INT_SAMPLER_CUBE:
+ case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
+ case GL_SAMPLER_2D_SHADOW:
+ case GL_SAMPLER_CUBE_SHADOW:
+ case GL_SAMPLER_2D_ARRAY_SHADOW:
+ return 1;
+ case GL_FLOAT_MAT2:
+ case GL_FLOAT_MAT3x2:
+ case GL_FLOAT_MAT4x2:
+ return 2;
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT2x3:
+ case GL_FLOAT_MAT4x3:
+ return 3;
+ case GL_FLOAT_MAT4:
+ case GL_FLOAT_MAT2x4:
+ case GL_FLOAT_MAT3x4:
+ return 4;
+ default:
+ UNREACHABLE();
+ }
+
+ return 0;
+}
+
+int VariableColumnCount(GLenum type)
+{
+ switch (type)
+ {
+ case GL_NONE:
+ case GL_STRUCT_ANGLEX:
+ return 0;
+ case GL_BOOL:
+ case GL_FLOAT:
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_3D:
+ case GL_SAMPLER_CUBE:
+ case GL_SAMPLER_2D_ARRAY:
+ case GL_INT_SAMPLER_2D:
+ case GL_INT_SAMPLER_3D:
+ case GL_INT_SAMPLER_CUBE:
+ case GL_INT_SAMPLER_2D_ARRAY:
+ case GL_UNSIGNED_INT_SAMPLER_2D:
+ case GL_UNSIGNED_INT_SAMPLER_3D:
+ case GL_UNSIGNED_INT_SAMPLER_CUBE:
+ case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
+ case GL_SAMPLER_2D_SHADOW:
+ case GL_SAMPLER_CUBE_SHADOW:
+ case GL_SAMPLER_2D_ARRAY_SHADOW:
+ return 1;
+ case GL_BOOL_VEC2:
+ case GL_FLOAT_VEC2:
+ case GL_INT_VEC2:
+ case GL_UNSIGNED_INT_VEC2:
+ case GL_FLOAT_MAT2:
+ case GL_FLOAT_MAT2x3:
+ case GL_FLOAT_MAT2x4:
+ return 2;
+ case GL_BOOL_VEC3:
+ case GL_FLOAT_VEC3:
+ case GL_INT_VEC3:
+ case GL_UNSIGNED_INT_VEC3:
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT3x2:
+ case GL_FLOAT_MAT3x4:
+ return 3;
+ case GL_BOOL_VEC4:
+ case GL_FLOAT_VEC4:
+ case GL_INT_VEC4:
+ case GL_UNSIGNED_INT_VEC4:
+ case GL_FLOAT_MAT4:
+ case GL_FLOAT_MAT4x2:
+ case GL_FLOAT_MAT4x3:
+ return 4;
+ default:
+ UNREACHABLE();
+ }
+
+ return 0;
+}
+
+bool IsSampler(GLenum type)
+{
+ switch (type)
+ {
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_3D:
+ case GL_SAMPLER_CUBE:
+ case GL_SAMPLER_2D_ARRAY:
+ case GL_INT_SAMPLER_2D:
+ case GL_INT_SAMPLER_3D:
+ case GL_INT_SAMPLER_CUBE:
+ case GL_INT_SAMPLER_2D_ARRAY:
+ case GL_UNSIGNED_INT_SAMPLER_2D:
+ case GL_UNSIGNED_INT_SAMPLER_3D:
+ case GL_UNSIGNED_INT_SAMPLER_CUBE:
+ case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
+ case GL_SAMPLER_2D_SHADOW:
+ case GL_SAMPLER_CUBE_SHADOW:
+ case GL_SAMPLER_2D_ARRAY_SHADOW:
+ return true;
+ }
+
+ return false;
+}
+
+bool IsMatrixType(GLenum type)
+{
+ return VariableRowCount(type) > 1;
+}
+
+GLenum TransposeMatrixType(GLenum type)
+{
+ if (!IsMatrixType(type))
+ {
+ return type;
+ }
+
+ switch (type)
+ {
+ case GL_FLOAT_MAT2: return GL_FLOAT_MAT2;
+ case GL_FLOAT_MAT3: return GL_FLOAT_MAT3;
+ case GL_FLOAT_MAT4: return GL_FLOAT_MAT4;
+ case GL_FLOAT_MAT2x3: return GL_FLOAT_MAT3x2;
+ case GL_FLOAT_MAT3x2: return GL_FLOAT_MAT2x3;
+ case GL_FLOAT_MAT2x4: return GL_FLOAT_MAT4x2;
+ case GL_FLOAT_MAT4x2: return GL_FLOAT_MAT2x4;
+ case GL_FLOAT_MAT3x4: return GL_FLOAT_MAT4x3;
+ case GL_FLOAT_MAT4x3: return GL_FLOAT_MAT3x4;
+ default: UNREACHABLE(); return GL_NONE;
+ }
+}
+
+int MatrixRegisterCount(GLenum type, bool isRowMajorMatrix)
+{
+ ASSERT(IsMatrixType(type));
+ return isRowMajorMatrix ? VariableRowCount(type) : VariableColumnCount(type);
+}
+
+int MatrixComponentCount(GLenum type, bool isRowMajorMatrix)
+{
+ ASSERT(IsMatrixType(type));
+ return isRowMajorMatrix ? VariableColumnCount(type) : VariableRowCount(type);
+}
+
+int AttributeRegisterCount(GLenum type)
+{
+ return IsMatrixType(type) ? VariableColumnCount(type) : 1;
+}
+
+int AllocateFirstFreeBits(unsigned int *bits, unsigned int allocationSize, unsigned int bitsSize)
+{
+ ASSERT(allocationSize <= bitsSize);
+
+ unsigned int mask = std::numeric_limits<unsigned int>::max() >> (std::numeric_limits<unsigned int>::digits - allocationSize);
+
+ for (unsigned int i = 0; i < bitsSize - allocationSize + 1; i++)
+ {
+ if ((*bits & mask) == 0)
+ {
+ *bits |= mask;
+ return i;
+ }
+
+ mask <<= 1;
+ }
+
+ return -1;
+}
+
+bool IsCubemapTextureTarget(GLenum target)
+{
+ return (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z);
+}
+
+bool IsInternalTextureTarget(GLenum target, GLuint clientVersion)
+{
+ if (clientVersion == 2)
+ {
+ return target == GL_TEXTURE_2D || IsCubemapTextureTarget(target);
+ }
+ else if (clientVersion == 3)
+ {
+ return target == GL_TEXTURE_2D || IsCubemapTextureTarget(target) ||
+ target == GL_TEXTURE_3D || target == GL_TEXTURE_2D_ARRAY;
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool IsTriangleMode(GLenum drawMode)
+{
+ switch (drawMode)
+ {
+ case GL_TRIANGLES:
+ case GL_TRIANGLE_FAN:
+ case GL_TRIANGLE_STRIP:
+ return true;
+ case GL_POINTS:
+ case GL_LINES:
+ case GL_LINE_LOOP:
+ case GL_LINE_STRIP:
+ return false;
+ default: UNREACHABLE();
+ }
+
+ return false;
+}
+
+}
+
+std::string getTempPath()
+{
+#if defined (_WIN32)
+ char path[MAX_PATH];
+ DWORD pathLen = GetTempPathA(sizeof(path) / sizeof(path[0]), path);
+ if (pathLen == 0)
+ {
+ UNREACHABLE();
+ return std::string();
+ }
+
+ UINT unique = GetTempFileNameA(path, "sh", 0, path);
+ if (unique == 0)
+ {
+ UNREACHABLE();
+ return std::string();
+ }
+
+ return path;
+#else
+ UNIMPLEMENTED();
+ return "";
+#endif
+}
+
+void writeFile(const char* path, const void* content, size_t size)
+{
+ FILE* file = fopen(path, "w");
+ if (!file)
+ {
+ UNREACHABLE();
+ return;
+ }
+
+ fwrite(content, sizeof(char), size, file);
+ fclose(file);
+}
diff --git a/chromium/third_party/angle/src/common/utilities.h b/chromium/third_party/angle/src/common/utilities.h
new file mode 100644
index 00000000000..f69e33a79d2
--- /dev/null
+++ b/chromium/third_party/angle/src/common/utilities.h
@@ -0,0 +1,56 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// utilities.h: Conversion functions and other utility routines.
+
+#ifndef LIBGLESV2_UTILITIES_H
+#define LIBGLESV2_UTILITIES_H
+
+#include <GLES3/gl3.h>
+#include <GLES3/gl3ext.h>
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+
+#include <string>
+#include <math.h>
+
+namespace gl
+{
+
+int UniformComponentCount(GLenum type);
+GLenum UniformComponentType(GLenum type);
+size_t UniformComponentSize(GLenum type);
+size_t UniformInternalSize(GLenum type);
+size_t UniformExternalSize(GLenum type);
+GLenum UniformBoolVectorType(GLenum type);
+int VariableRowCount(GLenum type);
+int VariableColumnCount(GLenum type);
+bool IsSampler(GLenum type);
+bool IsMatrixType(GLenum type);
+GLenum TransposeMatrixType(GLenum type);
+int AttributeRegisterCount(GLenum type);
+int MatrixRegisterCount(GLenum type, bool isRowMajorMatrix);
+int MatrixComponentCount(GLenum type, bool isRowMajorMatrix);
+
+int AllocateFirstFreeBits(unsigned int *bits, unsigned int allocationSize, unsigned int bitsSize);
+
+bool IsCubemapTextureTarget(GLenum target);
+bool IsInternalTextureTarget(GLenum target, GLuint clientVersion);
+
+bool IsTriangleMode(GLenum drawMode);
+
+// [OpenGL ES 3.0.2] Section 2.3.1 page 14
+// Data Conversion For State-Setting Commands
+// Floating-point values are rounded to the nearest integer, instead of truncated, as done by static_cast.
+template <typename outT> outT iround(GLfloat value) { return static_cast<outT>(value > 0.0f ? floor(value + 0.5f) : ceil(value - 0.5f)); }
+template <typename outT> outT uiround(GLfloat value) { return static_cast<outT>(value + 0.5f); }
+
+}
+
+std::string getTempPath();
+void writeFile(const char* path, const void* data, size_t size);
+
+#endif // LIBGLESV2_UTILITIES_H
diff --git a/chromium/third_party/angle/src/common/version.h b/chromium/third_party/angle/src/common/version.h
index eb0285742f3..d9148d19594 100644
--- a/chromium/third_party/angle/src/common/version.h
+++ b/chromium/third_party/angle/src/common/version.h
@@ -1,12 +1,12 @@
-#define MAJOR_VERSION 1
-#define MINOR_VERSION 2
-#define BUILD_VERSION 0
-#define BUILD_REVISION 2451
+#include "id/commit.h"
-#define STRINGIFY(x) #x
-#define MACRO_STRINGIFY(x) STRINGIFY(x)
+#define ANGLE_MAJOR_VERSION 2
+#define ANGLE_MINOR_VERSION 1
-#define REVISION_STRING MACRO_STRINGIFY(BUILD_REVISION)
-#define VERSION_STRING MACRO_STRINGIFY(MAJOR_VERSION) "." MACRO_STRINGIFY(MINOR_VERSION) "." MACRO_STRINGIFY(BUILD_VERSION) "." MACRO_STRINGIFY(BUILD_REVISION)
+#define ANGLE_STRINGIFY(x) #x
+#define ANGLE_MACRO_STRINGIFY(x) ANGLE_STRINGIFY(x)
-#define VERSION_DWORD ((MAJOR_VERSION << 24) | (MINOR_VERSION << 16) | BUILD_REVISION)
+#define ANGLE_VERSION_STRING \
+ ANGLE_MACRO_STRINGIFY(ANGLE_MAJOR_VERSION) "." \
+ ANGLE_MACRO_STRINGIFY(ANGLE_MINOR_VERSION) "." \
+ ANGLE_COMMIT_HASH
diff --git a/chromium/third_party/angle/src/compiler.gypi b/chromium/third_party/angle/src/compiler.gypi
new file mode 100644
index 00000000000..df62d1171f2
--- /dev/null
+++ b/chromium/third_party/angle/src/compiler.gypi
@@ -0,0 +1,99 @@
+# Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets':
+ [
+ {
+ 'target_name': 'preprocessor',
+ 'type': 'static_library',
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'sources': [ '<!@(python <(angle_path)/enumerate_files.py compiler/preprocessor -types *.cpp *.h *.y *.l )' ],
+ },
+ {
+ 'target_name': 'translator_lib',
+ 'type': 'static_library',
+ 'dependencies': [ 'preprocessor' ],
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'include_dirs':
+ [
+ '.',
+ '../include',
+ ],
+ 'sources':
+ [
+ '<!@(python <(angle_path)/enumerate_files.py \
+ -dirs compiler/translator third_party/compiler common ../include \
+ -excludes compiler/translator/ShaderLang.cpp \
+ -types *.cpp *.h *.y *.l)',
+ ],
+ 'conditions':
+ [
+ ['OS=="win"',
+ {
+ 'msvs_disabled_warnings': [ 4267 ],
+ 'sources/': [ [ 'exclude', 'compiler/translator/ossource_posix.cpp' ], ],
+ },
+ { # else: posix
+ 'sources/': [ [ 'exclude', 'compiler/translator/ossource_win.cpp' ], ],
+ }
+ ],
+ ],
+ 'msvs_settings':
+ {
+ 'VCLibrarianTool':
+ {
+ 'AdditionalOptions': ['/ignore:4221']
+ },
+ },
+ },
+
+ {
+ 'target_name': 'translator',
+ 'type': '<(component)',
+ 'dependencies': [ 'translator_lib' ],
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'include_dirs':
+ [
+ '.',
+ '../include',
+ ],
+ 'defines':
+ [
+ 'ANGLE_TRANSLATOR_IMPLEMENTATION',
+ ],
+ 'sources':
+ [
+ 'compiler/translator/ShaderLang.cpp'
+ ],
+ },
+
+ {
+ 'target_name': 'translator_static',
+ 'type': 'static_library',
+ 'dependencies': [ 'translator_lib' ],
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'include_dirs':
+ [
+ '.',
+ '../include',
+ ],
+ 'defines':
+ [
+ 'ANGLE_TRANSLATOR_STATIC',
+ ],
+ 'direct_dependent_settings':
+ {
+ 'defines':
+ [
+ 'ANGLE_TRANSLATOR_STATIC',
+ ],
+ },
+ 'sources':
+ [
+ 'compiler/translator/ShaderLang.cpp'
+ ],
+ },
+ ],
+}
diff --git a/chromium/third_party/angle/src/compiler/BaseTypes.h b/chromium/third_party/angle/src/compiler/BaseTypes.h
deleted file mode 100644
index 1631f4f779f..00000000000
--- a/chromium/third_party/angle/src/compiler/BaseTypes.h
+++ /dev/null
@@ -1,148 +0,0 @@
-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#ifndef _BASICTYPES_INCLUDED_
-#define _BASICTYPES_INCLUDED_
-
-//
-// Precision qualifiers
-//
-enum TPrecision
-{
- // These need to be kept sorted
- EbpUndefined,
- EbpLow,
- EbpMedium,
- EbpHigh
-};
-
-inline const char* getPrecisionString(TPrecision p)
-{
- switch(p)
- {
- case EbpHigh: return "highp"; break;
- case EbpMedium: return "mediump"; break;
- case EbpLow: return "lowp"; break;
- default: return "mediump"; break; // Safest fallback
- }
-}
-
-//
-// Basic type. Arrays, vectors, etc., are orthogonal to this.
-//
-enum TBasicType
-{
- EbtVoid,
- EbtFloat,
- EbtInt,
- EbtBool,
- EbtGuardSamplerBegin, // non type: see implementation of IsSampler()
- EbtSampler2D,
- EbtSamplerCube,
- EbtSamplerExternalOES, // Only valid if OES_EGL_image_external exists.
- EbtSampler2DRect, // Only valid if GL_ARB_texture_rectangle exists.
- EbtGuardSamplerEnd, // non type: see implementation of IsSampler()
- EbtStruct,
- EbtAddress, // should be deprecated??
- EbtInvariant // used as a type when qualifying a previously declared variable as being invariant
-};
-
-inline const char* getBasicString(TBasicType t)
-{
- switch (t)
- {
- case EbtVoid: return "void"; break;
- case EbtFloat: return "float"; break;
- case EbtInt: return "int"; break;
- case EbtBool: return "bool"; break;
- case EbtSampler2D: return "sampler2D"; break;
- case EbtSamplerCube: return "samplerCube"; break;
- case EbtSamplerExternalOES: return "samplerExternalOES"; break;
- case EbtSampler2DRect: return "sampler2DRect"; break;
- case EbtStruct: return "structure"; break;
- default: return "unknown type";
- }
-}
-
-inline bool IsSampler(TBasicType type)
-{
- return type > EbtGuardSamplerBegin && type < EbtGuardSamplerEnd;
-}
-
-//
-// Qualifiers and built-ins. These are mainly used to see what can be read
-// or written, and by the machine dependent translator to know which registers
-// to allocate variables in. Since built-ins tend to go to different registers
-// than varying or uniform, it makes sense they are peers, not sub-classes.
-//
-enum TQualifier
-{
- EvqTemporary, // For temporaries (within a function), read/write
- EvqGlobal, // For globals read/write
- EvqConst, // User defined constants and non-output parameters in functions
- EvqAttribute, // Readonly
- EvqVaryingIn, // readonly, fragment shaders only
- EvqVaryingOut, // vertex shaders only read/write
- EvqInvariantVaryingIn, // readonly, fragment shaders only
- EvqInvariantVaryingOut, // vertex shaders only read/write
- EvqUniform, // Readonly, vertex and fragment
-
- // parameters
- EvqIn,
- EvqOut,
- EvqInOut,
- EvqConstReadOnly,
-
- // built-ins written by vertex shader
- EvqPosition,
- EvqPointSize,
-
- // built-ins read by fragment shader
- EvqFragCoord,
- EvqFrontFacing,
- EvqPointCoord,
-
- // built-ins written by fragment shader
- EvqFragColor,
- EvqFragData,
- EvqFragDepth,
-
- // end of list
- EvqLast
-};
-
-//
-// This is just for debug print out, carried along with the definitions above.
-//
-inline const char* getQualifierString(TQualifier q)
-{
- switch(q)
- {
- case EvqTemporary: return "Temporary"; break;
- case EvqGlobal: return "Global"; break;
- case EvqConst: return "const"; break;
- case EvqConstReadOnly: return "const"; break;
- case EvqAttribute: return "attribute"; break;
- case EvqVaryingIn: return "varying"; break;
- case EvqVaryingOut: return "varying"; break;
- case EvqInvariantVaryingIn: return "invariant varying"; break;
- case EvqInvariantVaryingOut:return "invariant varying"; break;
- case EvqUniform: return "uniform"; break;
- case EvqIn: return "in"; break;
- case EvqOut: return "out"; break;
- case EvqInOut: return "inout"; break;
- case EvqPosition: return "Position"; break;
- case EvqPointSize: return "PointSize"; break;
- case EvqFragCoord: return "FragCoord"; break;
- case EvqFrontFacing: return "FrontFacing"; break;
- case EvqFragColor: return "FragColor"; break;
- case EvqFragData: return "FragData"; break;
- case EvqFragDepth: return "FragDepth"; break;
- default: return "unknown qualifier";
- }
-}
-
-#endif // _BASICTYPES_INCLUDED_
diff --git a/chromium/third_party/angle/src/compiler/ForLoopUnroll.cpp b/chromium/third_party/angle/src/compiler/ForLoopUnroll.cpp
deleted file mode 100644
index 27a13eababb..00000000000
--- a/chromium/third_party/angle/src/compiler/ForLoopUnroll.cpp
+++ /dev/null
@@ -1,215 +0,0 @@
-//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#include "compiler/ForLoopUnroll.h"
-
-namespace {
-
-class IntegerForLoopUnrollMarker : public TIntermTraverser {
-public:
-
- virtual bool visitLoop(Visit, TIntermLoop* node)
- {
- // This is called after ValidateLimitations pass, so all the ASSERT
- // should never fail.
- // See ValidateLimitations::validateForLoopInit().
- ASSERT(node);
- ASSERT(node->getType() == ELoopFor);
- ASSERT(node->getInit());
- TIntermAggregate* decl = node->getInit()->getAsAggregate();
- ASSERT(decl && decl->getOp() == EOpDeclaration);
- TIntermSequence& declSeq = decl->getSequence();
- ASSERT(declSeq.size() == 1);
- TIntermBinary* declInit = declSeq[0]->getAsBinaryNode();
- ASSERT(declInit && declInit->getOp() == EOpInitialize);
- ASSERT(declInit->getLeft());
- TIntermSymbol* symbol = declInit->getLeft()->getAsSymbolNode();
- ASSERT(symbol);
- TBasicType type = symbol->getBasicType();
- ASSERT(type == EbtInt || type == EbtFloat);
- if (type == EbtInt)
- node->setUnrollFlag(true);
- return true;
- }
-
-};
-
-} // anonymous namepsace
-
-void ForLoopUnroll::FillLoopIndexInfo(TIntermLoop* node, TLoopIndexInfo& info)
-{
- ASSERT(node->getType() == ELoopFor);
- ASSERT(node->getUnrollFlag());
-
- TIntermNode* init = node->getInit();
- ASSERT(init != NULL);
- TIntermAggregate* decl = init->getAsAggregate();
- ASSERT((decl != NULL) && (decl->getOp() == EOpDeclaration));
- TIntermSequence& declSeq = decl->getSequence();
- ASSERT(declSeq.size() == 1);
- TIntermBinary* declInit = declSeq[0]->getAsBinaryNode();
- ASSERT((declInit != NULL) && (declInit->getOp() == EOpInitialize));
- TIntermSymbol* symbol = declInit->getLeft()->getAsSymbolNode();
- ASSERT(symbol != NULL);
- ASSERT(symbol->getBasicType() == EbtInt);
-
- info.id = symbol->getId();
-
- ASSERT(declInit->getRight() != NULL);
- TIntermConstantUnion* initNode = declInit->getRight()->getAsConstantUnion();
- ASSERT(initNode != NULL);
-
- info.initValue = evaluateIntConstant(initNode);
- info.currentValue = info.initValue;
-
- TIntermNode* cond = node->getCondition();
- ASSERT(cond != NULL);
- TIntermBinary* binOp = cond->getAsBinaryNode();
- ASSERT(binOp != NULL);
- ASSERT(binOp->getRight() != NULL);
- ASSERT(binOp->getRight()->getAsConstantUnion() != NULL);
-
- info.incrementValue = getLoopIncrement(node);
- info.stopValue = evaluateIntConstant(
- binOp->getRight()->getAsConstantUnion());
- info.op = binOp->getOp();
-}
-
-void ForLoopUnroll::Step()
-{
- ASSERT(mLoopIndexStack.size() > 0);
- TLoopIndexInfo& info = mLoopIndexStack[mLoopIndexStack.size() - 1];
- info.currentValue += info.incrementValue;
-}
-
-bool ForLoopUnroll::SatisfiesLoopCondition()
-{
- ASSERT(mLoopIndexStack.size() > 0);
- TLoopIndexInfo& info = mLoopIndexStack[mLoopIndexStack.size() - 1];
- // Relational operator is one of: > >= < <= == or !=.
- switch (info.op) {
- case EOpEqual:
- return (info.currentValue == info.stopValue);
- case EOpNotEqual:
- return (info.currentValue != info.stopValue);
- case EOpLessThan:
- return (info.currentValue < info.stopValue);
- case EOpGreaterThan:
- return (info.currentValue > info.stopValue);
- case EOpLessThanEqual:
- return (info.currentValue <= info.stopValue);
- case EOpGreaterThanEqual:
- return (info.currentValue >= info.stopValue);
- default:
- UNREACHABLE();
- }
- return false;
-}
-
-bool ForLoopUnroll::NeedsToReplaceSymbolWithValue(TIntermSymbol* symbol)
-{
- for (TVector<TLoopIndexInfo>::iterator i = mLoopIndexStack.begin();
- i != mLoopIndexStack.end();
- ++i) {
- if (i->id == symbol->getId())
- return true;
- }
- return false;
-}
-
-int ForLoopUnroll::GetLoopIndexValue(TIntermSymbol* symbol)
-{
- for (TVector<TLoopIndexInfo>::iterator i = mLoopIndexStack.begin();
- i != mLoopIndexStack.end();
- ++i) {
- if (i->id == symbol->getId())
- return i->currentValue;
- }
- UNREACHABLE();
- return false;
-}
-
-void ForLoopUnroll::Push(TLoopIndexInfo& info)
-{
- mLoopIndexStack.push_back(info);
-}
-
-void ForLoopUnroll::Pop()
-{
- mLoopIndexStack.pop_back();
-}
-
-// static
-void ForLoopUnroll::MarkForLoopsWithIntegerIndicesForUnrolling(
- TIntermNode* root)
-{
- ASSERT(root);
-
- IntegerForLoopUnrollMarker marker;
- root->traverse(&marker);
-}
-
-int ForLoopUnroll::getLoopIncrement(TIntermLoop* node)
-{
- TIntermNode* expr = node->getExpression();
- ASSERT(expr != NULL);
- // for expression has one of the following forms:
- // loop_index++
- // loop_index--
- // loop_index += constant_expression
- // loop_index -= constant_expression
- // ++loop_index
- // --loop_index
- // The last two forms are not specified in the spec, but I am assuming
- // its an oversight.
- TIntermUnary* unOp = expr->getAsUnaryNode();
- TIntermBinary* binOp = unOp ? NULL : expr->getAsBinaryNode();
-
- TOperator op = EOpNull;
- TIntermConstantUnion* incrementNode = NULL;
- if (unOp != NULL) {
- op = unOp->getOp();
- } else if (binOp != NULL) {
- op = binOp->getOp();
- ASSERT(binOp->getRight() != NULL);
- incrementNode = binOp->getRight()->getAsConstantUnion();
- ASSERT(incrementNode != NULL);
- }
-
- int increment = 0;
- // The operator is one of: ++ -- += -=.
- switch (op) {
- case EOpPostIncrement:
- case EOpPreIncrement:
- ASSERT((unOp != NULL) && (binOp == NULL));
- increment = 1;
- break;
- case EOpPostDecrement:
- case EOpPreDecrement:
- ASSERT((unOp != NULL) && (binOp == NULL));
- increment = -1;
- break;
- case EOpAddAssign:
- ASSERT((unOp == NULL) && (binOp != NULL));
- increment = evaluateIntConstant(incrementNode);
- break;
- case EOpSubAssign:
- ASSERT((unOp == NULL) && (binOp != NULL));
- increment = - evaluateIntConstant(incrementNode);
- break;
- default:
- ASSERT(false);
- }
-
- return increment;
-}
-
-int ForLoopUnroll::evaluateIntConstant(TIntermConstantUnion* node)
-{
- ASSERT((node != NULL) && (node->getUnionArrayPointer() != NULL));
- return node->getIConst(0);
-}
-
diff --git a/chromium/third_party/angle/src/compiler/ForLoopUnroll.h b/chromium/third_party/angle/src/compiler/ForLoopUnroll.h
deleted file mode 100644
index 738b76925e4..00000000000
--- a/chromium/third_party/angle/src/compiler/ForLoopUnroll.h
+++ /dev/null
@@ -1,52 +0,0 @@
-//
-// Copyright (c) 2011 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#ifndef COMPILER_FORLOOPUNROLL_H_
-#define COMPILER_FORLOOPUNROLL_H_
-
-#include "compiler/intermediate.h"
-
-struct TLoopIndexInfo {
- int id;
- int initValue;
- int stopValue;
- int incrementValue;
- TOperator op;
- int currentValue;
-};
-
-class ForLoopUnroll {
-public:
- ForLoopUnroll() { }
-
- void FillLoopIndexInfo(TIntermLoop* node, TLoopIndexInfo& info);
-
- // Update the info.currentValue for the next loop iteration.
- void Step();
-
- // Return false if loop condition is no longer satisfied.
- bool SatisfiesLoopCondition();
-
- // Check if the symbol is the index of a loop that's unrolled.
- bool NeedsToReplaceSymbolWithValue(TIntermSymbol* symbol);
-
- // Return the current value of a given loop index symbol.
- int GetLoopIndexValue(TIntermSymbol* symbol);
-
- void Push(TLoopIndexInfo& info);
- void Pop();
-
- static void MarkForLoopsWithIntegerIndicesForUnrolling(TIntermNode* root);
-
-private:
- int getLoopIncrement(TIntermLoop* node);
-
- int evaluateIntConstant(TIntermConstantUnion* node);
-
- TVector<TLoopIndexInfo> mLoopIndexStack;
-};
-
-#endif
diff --git a/chromium/third_party/angle/src/compiler/Initialize.cpp b/chromium/third_party/angle/src/compiler/Initialize.cpp
deleted file mode 100644
index 2cdbe17aa6d..00000000000
--- a/chromium/third_party/angle/src/compiler/Initialize.cpp
+++ /dev/null
@@ -1,564 +0,0 @@
-//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-//
-// Create strings that declare built-in definitions, add built-ins that
-// cannot be expressed in the files, and establish mappings between
-// built-in functions and operators.
-//
-
-#include "compiler/Initialize.h"
-
-#include "compiler/intermediate.h"
-
-void InsertBuiltInFunctions(ShShaderType type, ShShaderSpec spec, const ShBuiltInResources &resources, TSymbolTable &symbolTable)
-{
- TType *float1 = new TType(EbtFloat, EbpUndefined, EvqGlobal, 1);
- TType *float2 = new TType(EbtFloat, EbpUndefined, EvqGlobal, 2);
- TType *float3 = new TType(EbtFloat, EbpUndefined, EvqGlobal, 3);
- TType *float4 = new TType(EbtFloat, EbpUndefined, EvqGlobal, 4);
-
- TType *int2 = new TType(EbtInt, EbpUndefined, EvqGlobal, 2);
- TType *int3 = new TType(EbtInt, EbpUndefined, EvqGlobal, 3);
- TType *int4 = new TType(EbtInt, EbpUndefined, EvqGlobal, 4);
-
- //
- // Angle and Trigonometric Functions.
- //
- symbolTable.insertBuiltIn(float1, "radians", float1);
- symbolTable.insertBuiltIn(float2, "radians", float2);
- symbolTable.insertBuiltIn(float3, "radians", float3);
- symbolTable.insertBuiltIn(float4, "radians", float4);
-
- symbolTable.insertBuiltIn(float1, "degrees", float1);
- symbolTable.insertBuiltIn(float2, "degrees", float2);
- symbolTable.insertBuiltIn(float3, "degrees", float3);
- symbolTable.insertBuiltIn(float4, "degrees", float4);
-
- symbolTable.insertBuiltIn(float1, "sin", float1);
- symbolTable.insertBuiltIn(float2, "sin", float2);
- symbolTable.insertBuiltIn(float3, "sin", float3);
- symbolTable.insertBuiltIn(float4, "sin", float4);
-
- symbolTable.insertBuiltIn(float1, "cos", float1);
- symbolTable.insertBuiltIn(float2, "cos", float2);
- symbolTable.insertBuiltIn(float3, "cos", float3);
- symbolTable.insertBuiltIn(float4, "cos", float4);
-
- symbolTable.insertBuiltIn(float1, "tan", float1);
- symbolTable.insertBuiltIn(float2, "tan", float2);
- symbolTable.insertBuiltIn(float3, "tan", float3);
- symbolTable.insertBuiltIn(float4, "tan", float4);
-
- symbolTable.insertBuiltIn(float1, "asin", float1);
- symbolTable.insertBuiltIn(float2, "asin", float2);
- symbolTable.insertBuiltIn(float3, "asin", float3);
- symbolTable.insertBuiltIn(float4, "asin", float4);
-
- symbolTable.insertBuiltIn(float1, "acos", float1);
- symbolTable.insertBuiltIn(float2, "acos", float2);
- symbolTable.insertBuiltIn(float3, "acos", float3);
- symbolTable.insertBuiltIn(float4, "acos", float4);
-
- symbolTable.insertBuiltIn(float1, "atan", float1, float1);
- symbolTable.insertBuiltIn(float2, "atan", float2, float2);
- symbolTable.insertBuiltIn(float3, "atan", float3, float3);
- symbolTable.insertBuiltIn(float4, "atan", float4, float4);
-
- symbolTable.insertBuiltIn(float1, "atan", float1);
- symbolTable.insertBuiltIn(float2, "atan", float2);
- symbolTable.insertBuiltIn(float3, "atan", float3);
- symbolTable.insertBuiltIn(float4, "atan", float4);
-
- //
- // Exponential Functions.
- //
- symbolTable.insertBuiltIn(float1, "pow", float1, float1);
- symbolTable.insertBuiltIn(float2, "pow", float2, float2);
- symbolTable.insertBuiltIn(float3, "pow", float3, float3);
- symbolTable.insertBuiltIn(float4, "pow", float4, float4);
-
- symbolTable.insertBuiltIn(float1, "exp", float1);
- symbolTable.insertBuiltIn(float2, "exp", float2);
- symbolTable.insertBuiltIn(float3, "exp", float3);
- symbolTable.insertBuiltIn(float4, "exp", float4);
-
- symbolTable.insertBuiltIn(float1, "log", float1);
- symbolTable.insertBuiltIn(float2, "log", float2);
- symbolTable.insertBuiltIn(float3, "log", float3);
- symbolTable.insertBuiltIn(float4, "log", float4);
-
- symbolTable.insertBuiltIn(float1, "exp2", float1);
- symbolTable.insertBuiltIn(float2, "exp2", float2);
- symbolTable.insertBuiltIn(float3, "exp2", float3);
- symbolTable.insertBuiltIn(float4, "exp2", float4);
-
- symbolTable.insertBuiltIn(float1, "log2", float1);
- symbolTable.insertBuiltIn(float2, "log2", float2);
- symbolTable.insertBuiltIn(float3, "log2", float3);
- symbolTable.insertBuiltIn(float4, "log2", float4);
-
- symbolTable.insertBuiltIn(float1, "sqrt", float1);
- symbolTable.insertBuiltIn(float2, "sqrt", float2);
- symbolTable.insertBuiltIn(float3, "sqrt", float3);
- symbolTable.insertBuiltIn(float4, "sqrt", float4);
-
- symbolTable.insertBuiltIn(float1, "inversesqrt", float1);
- symbolTable.insertBuiltIn(float2, "inversesqrt", float2);
- symbolTable.insertBuiltIn(float3, "inversesqrt", float3);
- symbolTable.insertBuiltIn(float4, "inversesqrt", float4);
-
- //
- // Common Functions.
- //
- symbolTable.insertBuiltIn(float1, "abs", float1);
- symbolTable.insertBuiltIn(float2, "abs", float2);
- symbolTable.insertBuiltIn(float3, "abs", float3);
- symbolTable.insertBuiltIn(float4, "abs", float4);
-
- symbolTable.insertBuiltIn(float1, "sign", float1);
- symbolTable.insertBuiltIn(float2, "sign", float2);
- symbolTable.insertBuiltIn(float3, "sign", float3);
- symbolTable.insertBuiltIn(float4, "sign", float4);
-
- symbolTable.insertBuiltIn(float1, "floor", float1);
- symbolTable.insertBuiltIn(float2, "floor", float2);
- symbolTable.insertBuiltIn(float3, "floor", float3);
- symbolTable.insertBuiltIn(float4, "floor", float4);
-
- symbolTable.insertBuiltIn(float1, "ceil", float1);
- symbolTable.insertBuiltIn(float2, "ceil", float2);
- symbolTable.insertBuiltIn(float3, "ceil", float3);
- symbolTable.insertBuiltIn(float4, "ceil", float4);
-
- symbolTable.insertBuiltIn(float1, "fract", float1);
- symbolTable.insertBuiltIn(float2, "fract", float2);
- symbolTable.insertBuiltIn(float3, "fract", float3);
- symbolTable.insertBuiltIn(float4, "fract", float4);
-
- symbolTable.insertBuiltIn(float1, "mod", float1, float1);
- symbolTable.insertBuiltIn(float2, "mod", float2, float1);
- symbolTable.insertBuiltIn(float3, "mod", float3, float1);
- symbolTable.insertBuiltIn(float4, "mod", float4, float1);
- symbolTable.insertBuiltIn(float2, "mod", float2, float2);
- symbolTable.insertBuiltIn(float3, "mod", float3, float3);
- symbolTable.insertBuiltIn(float4, "mod", float4, float4);
-
- symbolTable.insertBuiltIn(float1, "min", float1, float1);
- symbolTable.insertBuiltIn(float2, "min", float2, float1);
- symbolTable.insertBuiltIn(float3, "min", float3, float1);
- symbolTable.insertBuiltIn(float4, "min", float4, float1);
- symbolTable.insertBuiltIn(float2, "min", float2, float2);
- symbolTable.insertBuiltIn(float3, "min", float3, float3);
- symbolTable.insertBuiltIn(float4, "min", float4, float4);
-
- symbolTable.insertBuiltIn(float1, "max", float1, float1);
- symbolTable.insertBuiltIn(float2, "max", float2, float1);
- symbolTable.insertBuiltIn(float3, "max", float3, float1);
- symbolTable.insertBuiltIn(float4, "max", float4, float1);
- symbolTable.insertBuiltIn(float2, "max", float2, float2);
- symbolTable.insertBuiltIn(float3, "max", float3, float3);
- symbolTable.insertBuiltIn(float4, "max", float4, float4);
-
- symbolTable.insertBuiltIn(float1, "clamp", float1, float1, float1);
- symbolTable.insertBuiltIn(float2, "clamp", float2, float1, float1);
- symbolTable.insertBuiltIn(float3, "clamp", float3, float1, float1);
- symbolTable.insertBuiltIn(float4, "clamp", float4, float1, float1);
- symbolTable.insertBuiltIn(float2, "clamp", float2, float2, float2);
- symbolTable.insertBuiltIn(float3, "clamp", float3, float3, float3);
- symbolTable.insertBuiltIn(float4, "clamp", float4, float4, float4);
-
- symbolTable.insertBuiltIn(float1, "mix", float1, float1, float1);
- symbolTable.insertBuiltIn(float2, "mix", float2, float2, float1);
- symbolTable.insertBuiltIn(float3, "mix", float3, float3, float1);
- symbolTable.insertBuiltIn(float4, "mix", float4, float4, float1);
- symbolTable.insertBuiltIn(float2, "mix", float2, float2, float2);
- symbolTable.insertBuiltIn(float3, "mix", float3, float3, float3);
- symbolTable.insertBuiltIn(float4, "mix", float4, float4, float4);
-
- symbolTable.insertBuiltIn(float1, "step", float1, float1);
- symbolTable.insertBuiltIn(float2, "step", float2, float2);
- symbolTable.insertBuiltIn(float3, "step", float3, float3);
- symbolTable.insertBuiltIn(float4, "step", float4, float4);
- symbolTable.insertBuiltIn(float2, "step", float1, float2);
- symbolTable.insertBuiltIn(float3, "step", float1, float3);
- symbolTable.insertBuiltIn(float4, "step", float1, float4);
-
- symbolTable.insertBuiltIn(float1, "smoothstep", float1, float1, float1);
- symbolTable.insertBuiltIn(float2, "smoothstep", float2, float2, float2);
- symbolTable.insertBuiltIn(float3, "smoothstep", float3, float3, float3);
- symbolTable.insertBuiltIn(float4, "smoothstep", float4, float4, float4);
- symbolTable.insertBuiltIn(float2, "smoothstep", float1, float1, float2);
- symbolTable.insertBuiltIn(float3, "smoothstep", float1, float1, float3);
- symbolTable.insertBuiltIn(float4, "smoothstep", float1, float1, float4);
-
- //
- // Geometric Functions.
- //
- symbolTable.insertBuiltIn(float1, "length", float1);
- symbolTable.insertBuiltIn(float1, "length", float2);
- symbolTable.insertBuiltIn(float1, "length", float3);
- symbolTable.insertBuiltIn(float1, "length", float4);
-
- symbolTable.insertBuiltIn(float1, "distance", float1, float1);
- symbolTable.insertBuiltIn(float1, "distance", float2, float2);
- symbolTable.insertBuiltIn(float1, "distance", float3, float3);
- symbolTable.insertBuiltIn(float1, "distance", float4, float4);
-
- symbolTable.insertBuiltIn(float1, "dot", float1, float1);
- symbolTable.insertBuiltIn(float1, "dot", float2, float2);
- symbolTable.insertBuiltIn(float1, "dot", float3, float3);
- symbolTable.insertBuiltIn(float1, "dot", float4, float4);
-
- symbolTable.insertBuiltIn(float3, "cross", float3, float3);
- symbolTable.insertBuiltIn(float1, "normalize", float1);
- symbolTable.insertBuiltIn(float2, "normalize", float2);
- symbolTable.insertBuiltIn(float3, "normalize", float3);
- symbolTable.insertBuiltIn(float4, "normalize", float4);
-
- symbolTable.insertBuiltIn(float1, "faceforward", float1, float1, float1);
- symbolTable.insertBuiltIn(float2, "faceforward", float2, float2, float2);
- symbolTable.insertBuiltIn(float3, "faceforward", float3, float3, float3);
- symbolTable.insertBuiltIn(float4, "faceforward", float4, float4, float4);
-
- symbolTable.insertBuiltIn(float1, "reflect", float1, float1);
- symbolTable.insertBuiltIn(float2, "reflect", float2, float2);
- symbolTable.insertBuiltIn(float3, "reflect", float3, float3);
- symbolTable.insertBuiltIn(float4, "reflect", float4, float4);
-
- symbolTable.insertBuiltIn(float1, "refract", float1, float1, float1);
- symbolTable.insertBuiltIn(float2, "refract", float2, float2, float1);
- symbolTable.insertBuiltIn(float3, "refract", float3, float3, float1);
- symbolTable.insertBuiltIn(float4, "refract", float4, float4, float1);
-
- TType *mat2 = new TType(EbtFloat, EbpUndefined, EvqGlobal, 2, true);
- TType *mat3 = new TType(EbtFloat, EbpUndefined, EvqGlobal, 3, true);
- TType *mat4 = new TType(EbtFloat, EbpUndefined, EvqGlobal, 4, true);
-
- //
- // Matrix Functions.
- //
- symbolTable.insertBuiltIn(mat2, "matrixCompMult", mat2, mat2);
- symbolTable.insertBuiltIn(mat3, "matrixCompMult", mat3, mat3);
- symbolTable.insertBuiltIn(mat4, "matrixCompMult", mat4, mat4);
-
- TType *bool1 = new TType(EbtBool, EbpUndefined, EvqGlobal, 1);
- TType *bool2 = new TType(EbtBool, EbpUndefined, EvqGlobal, 2);
- TType *bool3 = new TType(EbtBool, EbpUndefined, EvqGlobal, 3);
- TType *bool4 = new TType(EbtBool, EbpUndefined, EvqGlobal, 4);
-
- //
- // Vector relational functions.
- //
- symbolTable.insertBuiltIn(bool2, "lessThan", float2, float2);
- symbolTable.insertBuiltIn(bool3, "lessThan", float3, float3);
- symbolTable.insertBuiltIn(bool4, "lessThan", float4, float4);
-
- symbolTable.insertBuiltIn(bool2, "lessThan", int2, int2);
- symbolTable.insertBuiltIn(bool3, "lessThan", int3, int3);
- symbolTable.insertBuiltIn(bool4, "lessThan", int4, int4);
-
- symbolTable.insertBuiltIn(bool2, "lessThanEqual", float2, float2);
- symbolTable.insertBuiltIn(bool3, "lessThanEqual", float3, float3);
- symbolTable.insertBuiltIn(bool4, "lessThanEqual", float4, float4);
-
- symbolTable.insertBuiltIn(bool2, "lessThanEqual", int2, int2);
- symbolTable.insertBuiltIn(bool3, "lessThanEqual", int3, int3);
- symbolTable.insertBuiltIn(bool4, "lessThanEqual", int4, int4);
-
- symbolTable.insertBuiltIn(bool2, "greaterThan", float2, float2);
- symbolTable.insertBuiltIn(bool3, "greaterThan", float3, float3);
- symbolTable.insertBuiltIn(bool4, "greaterThan", float4, float4);
-
- symbolTable.insertBuiltIn(bool2, "greaterThan", int2, int2);
- symbolTable.insertBuiltIn(bool3, "greaterThan", int3, int3);
- symbolTable.insertBuiltIn(bool4, "greaterThan", int4, int4);
-
- symbolTable.insertBuiltIn(bool2, "greaterThanEqual", float2, float2);
- symbolTable.insertBuiltIn(bool3, "greaterThanEqual", float3, float3);
- symbolTable.insertBuiltIn(bool4, "greaterThanEqual", float4, float4);
-
- symbolTable.insertBuiltIn(bool2, "greaterThanEqual", int2, int2);
- symbolTable.insertBuiltIn(bool3, "greaterThanEqual", int3, int3);
- symbolTable.insertBuiltIn(bool4, "greaterThanEqual", int4, int4);
-
- symbolTable.insertBuiltIn(bool2, "equal", float2, float2);
- symbolTable.insertBuiltIn(bool3, "equal", float3, float3);
- symbolTable.insertBuiltIn(bool4, "equal", float4, float4);
-
- symbolTable.insertBuiltIn(bool2, "equal", int2, int2);
- symbolTable.insertBuiltIn(bool3, "equal", int3, int3);
- symbolTable.insertBuiltIn(bool4, "equal", int4, int4);
-
- symbolTable.insertBuiltIn(bool2, "equal", bool2, bool2);
- symbolTable.insertBuiltIn(bool3, "equal", bool3, bool3);
- symbolTable.insertBuiltIn(bool4, "equal", bool4, bool4);
-
- symbolTable.insertBuiltIn(bool2, "notEqual", float2, float2);
- symbolTable.insertBuiltIn(bool3, "notEqual", float3, float3);
- symbolTable.insertBuiltIn(bool4, "notEqual", float4, float4);
-
- symbolTable.insertBuiltIn(bool2, "notEqual", int2, int2);
- symbolTable.insertBuiltIn(bool3, "notEqual", int3, int3);
- symbolTable.insertBuiltIn(bool4, "notEqual", int4, int4);
-
- symbolTable.insertBuiltIn(bool2, "notEqual", bool2, bool2);
- symbolTable.insertBuiltIn(bool3, "notEqual", bool3, bool3);
- symbolTable.insertBuiltIn(bool4, "notEqual", bool4, bool4);
-
- symbolTable.insertBuiltIn(bool1, "any", bool2);
- symbolTable.insertBuiltIn(bool1, "any", bool3);
- symbolTable.insertBuiltIn(bool1, "any", bool4);
-
- symbolTable.insertBuiltIn(bool1, "all", bool2);
- symbolTable.insertBuiltIn(bool1, "all", bool3);
- symbolTable.insertBuiltIn(bool1, "all", bool4);
-
- symbolTable.insertBuiltIn(bool2, "not", bool2);
- symbolTable.insertBuiltIn(bool3, "not", bool3);
- symbolTable.insertBuiltIn(bool4, "not", bool4);
-
- TType *sampler2D = new TType(EbtSampler2D, EbpUndefined, EvqGlobal, 1);
- TType *samplerCube = new TType(EbtSamplerCube, EbpUndefined, EvqGlobal, 1);
-
- //
- // Texture Functions for GLSL ES 1.0
- //
- symbolTable.insertBuiltIn(float4, "texture2D", sampler2D, float2);
- symbolTable.insertBuiltIn(float4, "texture2DProj", sampler2D, float3);
- symbolTable.insertBuiltIn(float4, "texture2DProj", sampler2D, float4);
- symbolTable.insertBuiltIn(float4, "textureCube", samplerCube, float3);
-
- if (resources.OES_EGL_image_external)
- {
- TType *samplerExternalOES = new TType(EbtSamplerExternalOES, EbpUndefined, EvqGlobal, 1);
-
- symbolTable.insertBuiltIn(float4, "texture2D", samplerExternalOES, float2);
- symbolTable.insertBuiltIn(float4, "texture2DProj", samplerExternalOES, float3);
- symbolTable.insertBuiltIn(float4, "texture2DProj", samplerExternalOES, float4);
- }
-
- if (resources.ARB_texture_rectangle)
- {
- TType *sampler2DRect = new TType(EbtSampler2DRect, EbpUndefined, EvqGlobal, 1);
-
- symbolTable.insertBuiltIn(float4, "texture2DRect", sampler2DRect, float2);
- symbolTable.insertBuiltIn(float4, "texture2DRectProj", sampler2DRect, float3);
- symbolTable.insertBuiltIn(float4, "texture2DRectProj", sampler2DRect, float4);
- }
-
- if (type == SH_FRAGMENT_SHADER)
- {
- symbolTable.insertBuiltIn(float4, "texture2D", sampler2D, float2, float1);
- symbolTable.insertBuiltIn(float4, "texture2DProj", sampler2D, float3, float1);
- symbolTable.insertBuiltIn(float4, "texture2DProj", sampler2D, float4, float1);
- symbolTable.insertBuiltIn(float4, "textureCube", samplerCube, float3, float1);
-
- if (resources.OES_standard_derivatives)
- {
- symbolTable.insertBuiltIn(float1, "dFdx", float1);
- symbolTable.insertBuiltIn(float2, "dFdx", float2);
- symbolTable.insertBuiltIn(float3, "dFdx", float3);
- symbolTable.insertBuiltIn(float4, "dFdx", float4);
-
- symbolTable.insertBuiltIn(float1, "dFdy", float1);
- symbolTable.insertBuiltIn(float2, "dFdy", float2);
- symbolTable.insertBuiltIn(float3, "dFdy", float3);
- symbolTable.insertBuiltIn(float4, "dFdy", float4);
-
- symbolTable.insertBuiltIn(float1, "fwidth", float1);
- symbolTable.insertBuiltIn(float2, "fwidth", float2);
- symbolTable.insertBuiltIn(float3, "fwidth", float3);
- symbolTable.insertBuiltIn(float4, "fwidth", float4);
- }
- }
-
- if(type == SH_VERTEX_SHADER)
- {
- symbolTable.insertBuiltIn(float4, "texture2DLod", sampler2D, float2, float1);
- symbolTable.insertBuiltIn(float4, "texture2DProjLod", sampler2D, float3, float1);
- symbolTable.insertBuiltIn(float4, "texture2DProjLod", sampler2D, float4, float1);
- symbolTable.insertBuiltIn(float4, "textureCubeLod", samplerCube, float3, float1);
- }
-
- //
- // Depth range in window coordinates
- //
- TFieldList *fields = NewPoolTFieldList();
- TField *near = new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1), NewPoolTString("near"));
- TField *far = new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1), NewPoolTString("far"));
- TField *diff = new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1), NewPoolTString("diff"));
- fields->push_back(near);
- fields->push_back(far);
- fields->push_back(diff);
- TStructure *depthRangeStruct = new TStructure(NewPoolTString("gl_DepthRangeParameters"), fields);
- TVariable *depthRangeParameters = new TVariable(&depthRangeStruct->name(), depthRangeStruct, true);
- symbolTable.insert(*depthRangeParameters);
- TVariable *depthRange = new TVariable(NewPoolTString("gl_DepthRange"), TType(depthRangeStruct));
- depthRange->setQualifier(EvqUniform);
- symbolTable.insert(*depthRange);
-
- //
- // Implementation dependent built-in constants.
- //
- symbolTable.insertConstInt("gl_MaxVertexAttribs", resources.MaxVertexAttribs);
- symbolTable.insertConstInt("gl_MaxVertexUniformVectors", resources.MaxVertexUniformVectors);
- symbolTable.insertConstInt("gl_MaxVaryingVectors", resources.MaxVaryingVectors);
- symbolTable.insertConstInt("gl_MaxVertexTextureImageUnits", resources.MaxVertexTextureImageUnits);
- symbolTable.insertConstInt("gl_MaxCombinedTextureImageUnits", resources.MaxCombinedTextureImageUnits);
- symbolTable.insertConstInt("gl_MaxTextureImageUnits", resources.MaxTextureImageUnits);
- symbolTable.insertConstInt("gl_MaxFragmentUniformVectors", resources.MaxFragmentUniformVectors);
-
- if (spec != SH_CSS_SHADERS_SPEC)
- {
- symbolTable.insertConstInt("gl_MaxDrawBuffers", resources.MaxDrawBuffers);
- }
-}
-
-void IdentifyBuiltIns(ShShaderType type, ShShaderSpec spec,
- const ShBuiltInResources &resources,
- TSymbolTable &symbolTable)
-{
- //
- // First, insert some special built-in variables that are not in
- // the built-in header files.
- //
- switch(type) {
- case SH_FRAGMENT_SHADER:
- symbolTable.insert(*new TVariable(NewPoolTString("gl_FragCoord"), TType(EbtFloat, EbpMedium, EvqFragCoord, 4)));
- symbolTable.insert(*new TVariable(NewPoolTString("gl_FrontFacing"), TType(EbtBool, EbpUndefined, EvqFrontFacing, 1)));
- symbolTable.insert(*new TVariable(NewPoolTString("gl_PointCoord"), TType(EbtFloat, EbpMedium, EvqPointCoord, 2)));
-
- //
- // In CSS Shaders, gl_FragColor, gl_FragData, and gl_MaxDrawBuffers are not available.
- // Instead, css_MixColor and css_ColorMatrix are available.
- //
- if (spec != SH_CSS_SHADERS_SPEC) {
- symbolTable.insert(*new TVariable(NewPoolTString("gl_FragColor"), TType(EbtFloat, EbpMedium, EvqFragColor, 4)));
- symbolTable.insert(*new TVariable(NewPoolTString("gl_FragData[gl_MaxDrawBuffers]"), TType(EbtFloat, EbpMedium, EvqFragData, 4)));
- if (resources.EXT_frag_depth) {
- symbolTable.insert(*new TVariable(NewPoolTString("gl_FragDepthEXT"), TType(EbtFloat, resources.FragmentPrecisionHigh ? EbpHigh : EbpMedium, EvqFragDepth, 1)));
- symbolTable.relateToExtension("gl_FragDepthEXT", "GL_EXT_frag_depth");
- }
- } else {
- symbolTable.insert(*new TVariable(NewPoolTString("css_MixColor"), TType(EbtFloat, EbpMedium, EvqGlobal, 4)));
- symbolTable.insert(*new TVariable(NewPoolTString("css_ColorMatrix"), TType(EbtFloat, EbpMedium, EvqGlobal, 4, true)));
- }
-
- break;
-
- case SH_VERTEX_SHADER:
- symbolTable.insert(*new TVariable(NewPoolTString("gl_Position"), TType(EbtFloat, EbpHigh, EvqPosition, 4)));
- symbolTable.insert(*new TVariable(NewPoolTString("gl_PointSize"), TType(EbtFloat, EbpMedium, EvqPointSize, 1)));
- break;
-
- default: assert(false && "Language not supported");
- }
-
- //
- // Next, identify which built-ins from the already loaded headers have
- // a mapping to an operator. Those that are not identified as such are
- // expected to be resolved through a library of functions, versus as
- // operations.
- //
- symbolTable.relateToOperator("matrixCompMult", EOpMul);
-
- symbolTable.relateToOperator("equal", EOpVectorEqual);
- symbolTable.relateToOperator("notEqual", EOpVectorNotEqual);
- symbolTable.relateToOperator("lessThan", EOpLessThan);
- symbolTable.relateToOperator("greaterThan", EOpGreaterThan);
- symbolTable.relateToOperator("lessThanEqual", EOpLessThanEqual);
- symbolTable.relateToOperator("greaterThanEqual", EOpGreaterThanEqual);
-
- symbolTable.relateToOperator("radians", EOpRadians);
- symbolTable.relateToOperator("degrees", EOpDegrees);
- symbolTable.relateToOperator("sin", EOpSin);
- symbolTable.relateToOperator("cos", EOpCos);
- symbolTable.relateToOperator("tan", EOpTan);
- symbolTable.relateToOperator("asin", EOpAsin);
- symbolTable.relateToOperator("acos", EOpAcos);
- symbolTable.relateToOperator("atan", EOpAtan);
-
- symbolTable.relateToOperator("pow", EOpPow);
- symbolTable.relateToOperator("exp2", EOpExp2);
- symbolTable.relateToOperator("log", EOpLog);
- symbolTable.relateToOperator("exp", EOpExp);
- symbolTable.relateToOperator("log2", EOpLog2);
- symbolTable.relateToOperator("sqrt", EOpSqrt);
- symbolTable.relateToOperator("inversesqrt", EOpInverseSqrt);
-
- symbolTable.relateToOperator("abs", EOpAbs);
- symbolTable.relateToOperator("sign", EOpSign);
- symbolTable.relateToOperator("floor", EOpFloor);
- symbolTable.relateToOperator("ceil", EOpCeil);
- symbolTable.relateToOperator("fract", EOpFract);
- symbolTable.relateToOperator("mod", EOpMod);
- symbolTable.relateToOperator("min", EOpMin);
- symbolTable.relateToOperator("max", EOpMax);
- symbolTable.relateToOperator("clamp", EOpClamp);
- symbolTable.relateToOperator("mix", EOpMix);
- symbolTable.relateToOperator("step", EOpStep);
- symbolTable.relateToOperator("smoothstep", EOpSmoothStep);
-
- symbolTable.relateToOperator("length", EOpLength);
- symbolTable.relateToOperator("distance", EOpDistance);
- symbolTable.relateToOperator("dot", EOpDot);
- symbolTable.relateToOperator("cross", EOpCross);
- symbolTable.relateToOperator("normalize", EOpNormalize);
- symbolTable.relateToOperator("faceforward", EOpFaceForward);
- symbolTable.relateToOperator("reflect", EOpReflect);
- symbolTable.relateToOperator("refract", EOpRefract);
-
- symbolTable.relateToOperator("any", EOpAny);
- symbolTable.relateToOperator("all", EOpAll);
- symbolTable.relateToOperator("not", EOpVectorLogicalNot);
-
- // Map language-specific operators.
- switch(type) {
- case SH_VERTEX_SHADER:
- break;
- case SH_FRAGMENT_SHADER:
- if (resources.OES_standard_derivatives) {
- symbolTable.relateToOperator("dFdx", EOpDFdx);
- symbolTable.relateToOperator("dFdy", EOpDFdy);
- symbolTable.relateToOperator("fwidth", EOpFwidth);
-
- symbolTable.relateToExtension("dFdx", "GL_OES_standard_derivatives");
- symbolTable.relateToExtension("dFdy", "GL_OES_standard_derivatives");
- symbolTable.relateToExtension("fwidth", "GL_OES_standard_derivatives");
- }
- break;
- default: break;
- }
-
- // Finally add resource-specific variables.
- switch(type) {
- case SH_FRAGMENT_SHADER:
- if (spec != SH_CSS_SHADERS_SPEC) {
- // Set up gl_FragData. The array size.
- TType fragData(EbtFloat, EbpMedium, EvqFragData, 4, false, true);
- fragData.setArraySize(resources.MaxDrawBuffers);
- symbolTable.insert(*new TVariable(NewPoolTString("gl_FragData"), fragData));
- }
- break;
- default: break;
- }
-}
-
-void InitExtensionBehavior(const ShBuiltInResources& resources,
- TExtensionBehavior& extBehavior)
-{
- if (resources.OES_standard_derivatives)
- extBehavior["GL_OES_standard_derivatives"] = EBhUndefined;
- if (resources.OES_EGL_image_external)
- extBehavior["GL_OES_EGL_image_external"] = EBhUndefined;
- if (resources.ARB_texture_rectangle)
- extBehavior["GL_ARB_texture_rectangle"] = EBhUndefined;
- if (resources.EXT_draw_buffers)
- extBehavior["GL_EXT_draw_buffers"] = EBhUndefined;
- if (resources.EXT_frag_depth)
- extBehavior["GL_EXT_frag_depth"] = EBhUndefined;
-}
diff --git a/chromium/third_party/angle/src/compiler/InitializeGLPosition.cpp b/chromium/third_party/angle/src/compiler/InitializeGLPosition.cpp
deleted file mode 100644
index e0193e39d2e..00000000000
--- a/chromium/third_party/angle/src/compiler/InitializeGLPosition.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#include "compiler/InitializeGLPosition.h"
-#include "compiler/debug.h"
-
-bool InitializeGLPosition::visitAggregate(Visit visit, TIntermAggregate* node)
-{
- bool visitChildren = !mCodeInserted;
- switch (node->getOp())
- {
- case EOpSequence: break;
- case EOpFunction:
- {
- // Function definition.
- ASSERT(visit == PreVisit);
- if (node->getName() == "main(")
- {
- TIntermSequence &sequence = node->getSequence();
- ASSERT((sequence.size() == 1) || (sequence.size() == 2));
- TIntermAggregate *body = NULL;
- if (sequence.size() == 1)
- {
- body = new TIntermAggregate(EOpSequence);
- sequence.push_back(body);
- }
- else
- {
- body = sequence[1]->getAsAggregate();
- }
- ASSERT(body);
- insertCode(body->getSequence());
- mCodeInserted = true;
- }
- break;
- }
- default: visitChildren = false; break;
- }
- return visitChildren;
-}
-
-void InitializeGLPosition::insertCode(TIntermSequence& sequence)
-{
- TIntermBinary *binary = new TIntermBinary(EOpAssign);
- sequence.insert(sequence.begin(), binary);
-
- TIntermSymbol *left = new TIntermSymbol(
- 0, "gl_Position", TType(EbtFloat, EbpUndefined, EvqPosition, 4));
- binary->setLeft(left);
-
- ConstantUnion *u = new ConstantUnion[4];
- for (int ii = 0; ii < 3; ++ii)
- u[ii].setFConst(0.0f);
- u[3].setFConst(1.0f);
- TIntermConstantUnion *right = new TIntermConstantUnion(
- u, TType(EbtFloat, EbpUndefined, EvqConst, 4));
- binary->setRight(right);
-}
diff --git a/chromium/third_party/angle/src/compiler/InitializeGLPosition.h b/chromium/third_party/angle/src/compiler/InitializeGLPosition.h
deleted file mode 100644
index 1b11075a137..00000000000
--- a/chromium/third_party/angle/src/compiler/InitializeGLPosition.h
+++ /dev/null
@@ -1,33 +0,0 @@
-//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#ifndef COMPILER_INITIALIZE_GL_POSITION_H_
-#define COMPILER_INITIALIZE_GL_POSITION_H_
-
-#include "compiler/intermediate.h"
-
-class InitializeGLPosition : public TIntermTraverser
-{
-public:
- InitializeGLPosition() : mCodeInserted(false) { }
-
-protected:
- virtual bool visitBinary(Visit visit, TIntermBinary* node) { return false; }
- virtual bool visitUnary(Visit visit, TIntermUnary* node) { return false; }
- virtual bool visitSelection(Visit visit, TIntermSelection* node) { return false; }
- virtual bool visitLoop(Visit visit, TIntermLoop* node) { return false; }
- virtual bool visitBranch(Visit visit, TIntermBranch* node) { return false; }
-
- virtual bool visitAggregate(Visit visit, TIntermAggregate* node);
-
-private:
- // Insert AST node in the beginning of main() for "gl_Position = vec4(0.0, 0.0, 0.0, 1.0);".
- void insertCode(TIntermSequence& sequence);
-
- bool mCodeInserted;
-};
-
-#endif // COMPILER_INITIALIZE_GL_POSITION_H_
diff --git a/chromium/third_party/angle/src/compiler/MapLongVariableNames.cpp b/chromium/third_party/angle/src/compiler/MapLongVariableNames.cpp
deleted file mode 100644
index 077ef5d72eb..00000000000
--- a/chromium/third_party/angle/src/compiler/MapLongVariableNames.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#include "compiler/MapLongVariableNames.h"
-
-namespace {
-
-TString mapLongName(size_t id, const TString& name, bool isGlobal)
-{
- ASSERT(name.size() > MAX_SHORTENED_IDENTIFIER_SIZE);
- TStringStream stream;
- stream << "webgl_";
- if (isGlobal)
- stream << "g";
- stream << id;
- if (name[0] != '_')
- stream << "_";
- stream << name.substr(0, MAX_SHORTENED_IDENTIFIER_SIZE - stream.str().size());
- return stream.str();
-}
-
-LongNameMap* gLongNameMapInstance = NULL;
-
-} // anonymous namespace
-
-LongNameMap::LongNameMap()
- : refCount(0)
-{
-}
-
-LongNameMap::~LongNameMap()
-{
-}
-
-// static
-LongNameMap* LongNameMap::GetInstance()
-{
- if (gLongNameMapInstance == NULL)
- gLongNameMapInstance = new LongNameMap;
- gLongNameMapInstance->refCount++;
- return gLongNameMapInstance;
-}
-
-void LongNameMap::Release()
-{
- ASSERT(gLongNameMapInstance == this);
- ASSERT(refCount > 0);
- refCount--;
- if (refCount == 0) {
- delete gLongNameMapInstance;
- gLongNameMapInstance = NULL;
- }
-}
-
-const char* LongNameMap::Find(const char* originalName) const
-{
- std::map<std::string, std::string>::const_iterator it = mLongNameMap.find(
- originalName);
- if (it != mLongNameMap.end())
- return (*it).second.c_str();
- return NULL;
-}
-
-void LongNameMap::Insert(const char* originalName, const char* mappedName)
-{
- mLongNameMap.insert(std::map<std::string, std::string>::value_type(
- originalName, mappedName));
-}
-
-size_t LongNameMap::Size() const
-{
- return mLongNameMap.size();
-}
-
-MapLongVariableNames::MapLongVariableNames(LongNameMap* globalMap)
-{
- ASSERT(globalMap);
- mGlobalMap = globalMap;
-}
-
-void MapLongVariableNames::visitSymbol(TIntermSymbol* symbol)
-{
- ASSERT(symbol != NULL);
- if (symbol->getSymbol().size() > MAX_SHORTENED_IDENTIFIER_SIZE) {
- switch (symbol->getQualifier()) {
- case EvqVaryingIn:
- case EvqVaryingOut:
- case EvqInvariantVaryingIn:
- case EvqInvariantVaryingOut:
- case EvqUniform:
- symbol->setSymbol(
- mapGlobalLongName(symbol->getSymbol()));
- break;
- default:
- symbol->setSymbol(
- mapLongName(symbol->getId(), symbol->getSymbol(), false));
- break;
- };
- }
-}
-
-TString MapLongVariableNames::mapGlobalLongName(const TString& name)
-{
- ASSERT(mGlobalMap);
- const char* mappedName = mGlobalMap->Find(name.c_str());
- if (mappedName != NULL)
- return mappedName;
- size_t id = mGlobalMap->Size();
- TString rt = mapLongName(id, name, true);
- mGlobalMap->Insert(name.c_str(), rt.c_str());
- return rt;
-}
diff --git a/chromium/third_party/angle/src/compiler/MapLongVariableNames.h b/chromium/third_party/angle/src/compiler/MapLongVariableNames.h
deleted file mode 100644
index fd2ff82613c..00000000000
--- a/chromium/third_party/angle/src/compiler/MapLongVariableNames.h
+++ /dev/null
@@ -1,58 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#ifndef COMPILER_MAP_LONG_VARIABLE_NAMES_H_
-#define COMPILER_MAP_LONG_VARIABLE_NAMES_H_
-
-#include "GLSLANG/ShaderLang.h"
-
-#include "compiler/intermediate.h"
-#include "compiler/VariableInfo.h"
-
-// This size does not include '\0' in the end.
-#define MAX_SHORTENED_IDENTIFIER_SIZE 32
-
-// This is a ref-counted singleton. GetInstance() returns a pointer to the
-// singleton, and after use, call Release(). GetInstance() and Release() should
-// be paired.
-class LongNameMap {
-public:
- static LongNameMap* GetInstance();
- void Release();
-
- // Return the mapped name if <originalName, mappedName> is in the map;
- // otherwise, return NULL.
- const char* Find(const char* originalName) const;
-
- // Insert a pair into the map.
- void Insert(const char* originalName, const char* mappedName);
-
- // Return the number of entries in the map.
- size_t Size() const;
-
-private:
- LongNameMap();
- ~LongNameMap();
-
- size_t refCount;
- std::map<std::string, std::string> mLongNameMap;
-};
-
-// Traverses intermediate tree to map attributes and uniforms names that are
-// longer than MAX_SHORTENED_IDENTIFIER_SIZE to MAX_SHORTENED_IDENTIFIER_SIZE.
-class MapLongVariableNames : public TIntermTraverser {
-public:
- MapLongVariableNames(LongNameMap* globalMap);
-
- virtual void visitSymbol(TIntermSymbol*);
-
-private:
- TString mapGlobalLongName(const TString& name);
-
- LongNameMap* mGlobalMap;
-};
-
-#endif // COMPILER_MAP_LONG_VARIABLE_NAMES_H_
diff --git a/chromium/third_party/angle/src/compiler/OutputGLSL.cpp b/chromium/third_party/angle/src/compiler/OutputGLSL.cpp
deleted file mode 100644
index 10a451c0d76..00000000000
--- a/chromium/third_party/angle/src/compiler/OutputGLSL.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-//
-// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#include "compiler/OutputGLSL.h"
-
-TOutputGLSL::TOutputGLSL(TInfoSinkBase& objSink,
- ShArrayIndexClampingStrategy clampingStrategy,
- ShHashFunction64 hashFunction,
- NameMap& nameMap,
- TSymbolTable& symbolTable)
- : TOutputGLSLBase(objSink, clampingStrategy, hashFunction, nameMap, symbolTable)
-{
-}
-
-bool TOutputGLSL::writeVariablePrecision(TPrecision)
-{
- return false;
-}
-
-void TOutputGLSL::visitSymbol(TIntermSymbol* node)
-{
- TInfoSinkBase& out = objSink();
-
- if (node->getSymbol() == "gl_FragDepthEXT")
- {
- out << "gl_FragDepth";
- }
- else
- {
- TOutputGLSLBase::visitSymbol(node);
- }
-}
diff --git a/chromium/third_party/angle/src/compiler/OutputGLSLBase.cpp b/chromium/third_party/angle/src/compiler/OutputGLSLBase.cpp
deleted file mode 100644
index b90bd67ecd7..00000000000
--- a/chromium/third_party/angle/src/compiler/OutputGLSLBase.cpp
+++ /dev/null
@@ -1,817 +0,0 @@
-//
-// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#include "compiler/OutputGLSLBase.h"
-#include "compiler/debug.h"
-
-#include <cfloat>
-
-namespace
-{
-TString arrayBrackets(const TType& type)
-{
- ASSERT(type.isArray());
- TInfoSinkBase out;
- out << "[" << type.getArraySize() << "]";
- return TString(out.c_str());
-}
-
-bool isSingleStatement(TIntermNode* node) {
- if (const TIntermAggregate* aggregate = node->getAsAggregate())
- {
- return (aggregate->getOp() != EOpFunction) &&
- (aggregate->getOp() != EOpSequence);
- }
- else if (const TIntermSelection* selection = node->getAsSelectionNode())
- {
- // Ternary operators are usually part of an assignment operator.
- // This handles those rare cases in which they are all by themselves.
- return selection->usesTernaryOperator();
- }
- else if (node->getAsLoopNode())
- {
- return false;
- }
- return true;
-}
-} // namespace
-
-TOutputGLSLBase::TOutputGLSLBase(TInfoSinkBase& objSink,
- ShArrayIndexClampingStrategy clampingStrategy,
- ShHashFunction64 hashFunction,
- NameMap& nameMap,
- TSymbolTable& symbolTable)
- : TIntermTraverser(true, true, true),
- mObjSink(objSink),
- mDeclaringVariables(false),
- mClampingStrategy(clampingStrategy),
- mHashFunction(hashFunction),
- mNameMap(nameMap),
- mSymbolTable(symbolTable)
-{
-}
-
-void TOutputGLSLBase::writeTriplet(Visit visit, const char* preStr, const char* inStr, const char* postStr)
-{
- TInfoSinkBase& out = objSink();
- if (visit == PreVisit && preStr)
- {
- out << preStr;
- }
- else if (visit == InVisit && inStr)
- {
- out << inStr;
- }
- else if (visit == PostVisit && postStr)
- {
- out << postStr;
- }
-}
-
-void TOutputGLSLBase::writeVariableType(const TType& type)
-{
- TInfoSinkBase& out = objSink();
- TQualifier qualifier = type.getQualifier();
- // TODO(alokp): Validate qualifier for variable declarations.
- if ((qualifier != EvqTemporary) && (qualifier != EvqGlobal))
- out << type.getQualifierString() << " ";
- // Declare the struct if we have not done so already.
- if ((type.getBasicType() == EbtStruct) && !structDeclared(type.getStruct()))
- {
- declareStruct(type.getStruct());
- }
- else
- {
- if (writeVariablePrecision(type.getPrecision()))
- out << " ";
- out << getTypeName(type);
- }
-}
-
-void TOutputGLSLBase::writeFunctionParameters(const TIntermSequence& args)
-{
- TInfoSinkBase& out = objSink();
- for (TIntermSequence::const_iterator iter = args.begin();
- iter != args.end(); ++iter)
- {
- const TIntermSymbol* arg = (*iter)->getAsSymbolNode();
- ASSERT(arg != NULL);
-
- const TType& type = arg->getType();
- writeVariableType(type);
-
- const TString& name = arg->getSymbol();
- if (!name.empty())
- out << " " << hashName(name);
- if (type.isArray())
- out << arrayBrackets(type);
-
- // Put a comma if this is not the last argument.
- if (iter != args.end() - 1)
- out << ", ";
- }
-}
-
-const ConstantUnion* TOutputGLSLBase::writeConstantUnion(const TType& type,
- const ConstantUnion* pConstUnion)
-{
- TInfoSinkBase& out = objSink();
-
- if (type.getBasicType() == EbtStruct)
- {
- const TStructure* structure = type.getStruct();
- out << hashName(structure->name()) << "(";
-
- const TFieldList& fields = structure->fields();
- for (size_t i = 0; i < fields.size(); ++i)
- {
- const TType* fieldType = fields[i]->type();
- ASSERT(fieldType != NULL);
- pConstUnion = writeConstantUnion(*fieldType, pConstUnion);
- if (i != fields.size() - 1) out << ", ";
- }
- out << ")";
- }
- else
- {
- size_t size = type.getObjectSize();
- bool writeType = size > 1;
- if (writeType) out << getTypeName(type) << "(";
- for (size_t i = 0; i < size; ++i, ++pConstUnion)
- {
- switch (pConstUnion->getType())
- {
- case EbtFloat: out << std::min(FLT_MAX, std::max(-FLT_MAX, pConstUnion->getFConst())); break;
- case EbtInt: out << pConstUnion->getIConst(); break;
- case EbtBool: out << pConstUnion->getBConst(); break;
- default: UNREACHABLE();
- }
- if (i != size - 1) out << ", ";
- }
- if (writeType) out << ")";
- }
- return pConstUnion;
-}
-
-void TOutputGLSLBase::visitSymbol(TIntermSymbol* node)
-{
- TInfoSinkBase& out = objSink();
- if (mLoopUnroll.NeedsToReplaceSymbolWithValue(node))
- out << mLoopUnroll.GetLoopIndexValue(node);
- else
- out << hashVariableName(node->getSymbol());
-
- if (mDeclaringVariables && node->getType().isArray())
- out << arrayBrackets(node->getType());
-}
-
-void TOutputGLSLBase::visitConstantUnion(TIntermConstantUnion* node)
-{
- writeConstantUnion(node->getType(), node->getUnionArrayPointer());
-}
-
-bool TOutputGLSLBase::visitBinary(Visit visit, TIntermBinary* node)
-{
- bool visitChildren = true;
- TInfoSinkBase& out = objSink();
- switch (node->getOp())
- {
- case EOpInitialize:
- if (visit == InVisit)
- {
- out << " = ";
- // RHS of initialize is not being declared.
- mDeclaringVariables = false;
- }
- break;
- case EOpAssign: writeTriplet(visit, "(", " = ", ")"); break;
- case EOpAddAssign: writeTriplet(visit, "(", " += ", ")"); break;
- case EOpSubAssign: writeTriplet(visit, "(", " -= ", ")"); break;
- case EOpDivAssign: writeTriplet(visit, "(", " /= ", ")"); break;
- // Notice the fall-through.
- case EOpMulAssign:
- case EOpVectorTimesMatrixAssign:
- case EOpVectorTimesScalarAssign:
- case EOpMatrixTimesScalarAssign:
- case EOpMatrixTimesMatrixAssign:
- writeTriplet(visit, "(", " *= ", ")");
- break;
-
- case EOpIndexDirect:
- writeTriplet(visit, NULL, "[", "]");
- break;
- case EOpIndexIndirect:
- if (node->getAddIndexClamp())
- {
- if (visit == InVisit)
- {
- if (mClampingStrategy == SH_CLAMP_WITH_CLAMP_INTRINSIC) {
- out << "[int(clamp(float(";
- } else {
- out << "[webgl_int_clamp(";
- }
- }
- else if (visit == PostVisit)
- {
- int maxSize;
- TIntermTyped *left = node->getLeft();
- TType leftType = left->getType();
-
- if (left->isArray())
- {
- // The shader will fail validation if the array length is not > 0.
- maxSize = leftType.getArraySize() - 1;
- }
- else
- {
- maxSize = leftType.getNominalSize() - 1;
- }
-
- if (mClampingStrategy == SH_CLAMP_WITH_CLAMP_INTRINSIC) {
- out << "), 0.0, float(" << maxSize << ")))]";
- } else {
- out << ", 0, " << maxSize << ")]";
- }
- }
- }
- else
- {
- writeTriplet(visit, NULL, "[", "]");
- }
- break;
- case EOpIndexDirectStruct:
- if (visit == InVisit)
- {
- // Here we are writing out "foo.bar", where "foo" is struct
- // and "bar" is field. In AST, it is represented as a binary
- // node, where left child represents "foo" and right child "bar".
- // The node itself represents ".". The struct field "bar" is
- // actually stored as an index into TStructure::fields.
- out << ".";
- const TStructure* structure = node->getLeft()->getType().getStruct();
- const TIntermConstantUnion* index = node->getRight()->getAsConstantUnion();
- const TField* field = structure->fields()[index->getIConst(0)];
-
- TString fieldName = field->name();
- if (!mSymbolTable.findBuiltIn(structure->name()))
- fieldName = hashName(fieldName);
-
- out << fieldName;
- visitChildren = false;
- }
- break;
- case EOpVectorSwizzle:
- if (visit == InVisit)
- {
- out << ".";
- TIntermAggregate* rightChild = node->getRight()->getAsAggregate();
- TIntermSequence& sequence = rightChild->getSequence();
- for (TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); ++sit)
- {
- TIntermConstantUnion* element = (*sit)->getAsConstantUnion();
- ASSERT(element->getBasicType() == EbtInt);
- ASSERT(element->getNominalSize() == 1);
- const ConstantUnion& data = element->getUnionArrayPointer()[0];
- ASSERT(data.getType() == EbtInt);
- switch (data.getIConst())
- {
- case 0: out << "x"; break;
- case 1: out << "y"; break;
- case 2: out << "z"; break;
- case 3: out << "w"; break;
- default: UNREACHABLE(); break;
- }
- }
- visitChildren = false;
- }
- break;
-
- case EOpAdd: writeTriplet(visit, "(", " + ", ")"); break;
- case EOpSub: writeTriplet(visit, "(", " - ", ")"); break;
- case EOpMul: writeTriplet(visit, "(", " * ", ")"); break;
- case EOpDiv: writeTriplet(visit, "(", " / ", ")"); break;
- case EOpMod: UNIMPLEMENTED(); break;
- case EOpEqual: writeTriplet(visit, "(", " == ", ")"); break;
- case EOpNotEqual: writeTriplet(visit, "(", " != ", ")"); break;
- case EOpLessThan: writeTriplet(visit, "(", " < ", ")"); break;
- case EOpGreaterThan: writeTriplet(visit, "(", " > ", ")"); break;
- case EOpLessThanEqual: writeTriplet(visit, "(", " <= ", ")"); break;
- case EOpGreaterThanEqual: writeTriplet(visit, "(", " >= ", ")"); break;
-
- // Notice the fall-through.
- case EOpVectorTimesScalar:
- case EOpVectorTimesMatrix:
- case EOpMatrixTimesVector:
- case EOpMatrixTimesScalar:
- case EOpMatrixTimesMatrix:
- writeTriplet(visit, "(", " * ", ")");
- break;
-
- case EOpLogicalOr: writeTriplet(visit, "(", " || ", ")"); break;
- case EOpLogicalXor: writeTriplet(visit, "(", " ^^ ", ")"); break;
- case EOpLogicalAnd: writeTriplet(visit, "(", " && ", ")"); break;
- default: UNREACHABLE(); break;
- }
-
- return visitChildren;
-}
-
-bool TOutputGLSLBase::visitUnary(Visit visit, TIntermUnary* node)
-{
- TString preString;
- TString postString = ")";
-
- switch (node->getOp())
- {
- case EOpNegative: preString = "(-"; break;
- case EOpVectorLogicalNot: preString = "not("; break;
- case EOpLogicalNot: preString = "(!"; break;
-
- case EOpPostIncrement: preString = "("; postString = "++)"; break;
- case EOpPostDecrement: preString = "("; postString = "--)"; break;
- case EOpPreIncrement: preString = "(++"; break;
- case EOpPreDecrement: preString = "(--"; break;
-
- case EOpConvIntToBool:
- case EOpConvFloatToBool:
- switch (node->getOperand()->getType().getNominalSize())
- {
- case 1: preString = "bool("; break;
- case 2: preString = "bvec2("; break;
- case 3: preString = "bvec3("; break;
- case 4: preString = "bvec4("; break;
- default: UNREACHABLE();
- }
- break;
- case EOpConvBoolToFloat:
- case EOpConvIntToFloat:
- switch (node->getOperand()->getType().getNominalSize())
- {
- case 1: preString = "float("; break;
- case 2: preString = "vec2("; break;
- case 3: preString = "vec3("; break;
- case 4: preString = "vec4("; break;
- default: UNREACHABLE();
- }
- break;
- case EOpConvFloatToInt:
- case EOpConvBoolToInt:
- switch (node->getOperand()->getType().getNominalSize())
- {
- case 1: preString = "int("; break;
- case 2: preString = "ivec2("; break;
- case 3: preString = "ivec3("; break;
- case 4: preString = "ivec4("; break;
- default: UNREACHABLE();
- }
- break;
-
- case EOpRadians: preString = "radians("; break;
- case EOpDegrees: preString = "degrees("; break;
- case EOpSin: preString = "sin("; break;
- case EOpCos: preString = "cos("; break;
- case EOpTan: preString = "tan("; break;
- case EOpAsin: preString = "asin("; break;
- case EOpAcos: preString = "acos("; break;
- case EOpAtan: preString = "atan("; break;
-
- case EOpExp: preString = "exp("; break;
- case EOpLog: preString = "log("; break;
- case EOpExp2: preString = "exp2("; break;
- case EOpLog2: preString = "log2("; break;
- case EOpSqrt: preString = "sqrt("; break;
- case EOpInverseSqrt: preString = "inversesqrt("; break;
-
- case EOpAbs: preString = "abs("; break;
- case EOpSign: preString = "sign("; break;
- case EOpFloor: preString = "floor("; break;
- case EOpCeil: preString = "ceil("; break;
- case EOpFract: preString = "fract("; break;
-
- case EOpLength: preString = "length("; break;
- case EOpNormalize: preString = "normalize("; break;
-
- case EOpDFdx: preString = "dFdx("; break;
- case EOpDFdy: preString = "dFdy("; break;
- case EOpFwidth: preString = "fwidth("; break;
-
- case EOpAny: preString = "any("; break;
- case EOpAll: preString = "all("; break;
-
- default: UNREACHABLE(); break;
- }
-
- if (visit == PreVisit && node->getUseEmulatedFunction())
- preString = BuiltInFunctionEmulator::GetEmulatedFunctionName(preString);
- writeTriplet(visit, preString.c_str(), NULL, postString.c_str());
-
- return true;
-}
-
-bool TOutputGLSLBase::visitSelection(Visit visit, TIntermSelection* node)
-{
- TInfoSinkBase& out = objSink();
-
- if (node->usesTernaryOperator())
- {
- // Notice two brackets at the beginning and end. The outer ones
- // encapsulate the whole ternary expression. This preserves the
- // order of precedence when ternary expressions are used in a
- // compound expression, i.e., c = 2 * (a < b ? 1 : 2).
- out << "((";
- node->getCondition()->traverse(this);
- out << ") ? (";
- node->getTrueBlock()->traverse(this);
- out << ") : (";
- node->getFalseBlock()->traverse(this);
- out << "))";
- }
- else
- {
- out << "if (";
- node->getCondition()->traverse(this);
- out << ")\n";
-
- incrementDepth(node);
- visitCodeBlock(node->getTrueBlock());
-
- if (node->getFalseBlock())
- {
- out << "else\n";
- visitCodeBlock(node->getFalseBlock());
- }
- decrementDepth();
- }
- return false;
-}
-
-bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate* node)
-{
- bool visitChildren = true;
- TInfoSinkBase& out = objSink();
- TString preString;
- bool delayedWrite = false;
- switch (node->getOp())
- {
- case EOpSequence: {
- // Scope the sequences except when at the global scope.
- if (depth > 0) out << "{\n";
-
- incrementDepth(node);
- const TIntermSequence& sequence = node->getSequence();
- for (TIntermSequence::const_iterator iter = sequence.begin();
- iter != sequence.end(); ++iter)
- {
- TIntermNode* node = *iter;
- ASSERT(node != NULL);
- node->traverse(this);
-
- if (isSingleStatement(node))
- out << ";\n";
- }
- decrementDepth();
-
- // Scope the sequences except when at the global scope.
- if (depth > 0) out << "}\n";
- visitChildren = false;
- break;
- }
- case EOpPrototype: {
- // Function declaration.
- ASSERT(visit == PreVisit);
- writeVariableType(node->getType());
- out << " " << hashName(node->getName());
-
- out << "(";
- writeFunctionParameters(node->getSequence());
- out << ")";
-
- visitChildren = false;
- break;
- }
- case EOpFunction: {
- // Function definition.
- ASSERT(visit == PreVisit);
- writeVariableType(node->getType());
- out << " " << hashFunctionName(node->getName());
-
- incrementDepth(node);
- // Function definition node contains one or two children nodes
- // representing function parameters and function body. The latter
- // is not present in case of empty function bodies.
- const TIntermSequence& sequence = node->getSequence();
- ASSERT((sequence.size() == 1) || (sequence.size() == 2));
- TIntermSequence::const_iterator seqIter = sequence.begin();
-
- // Traverse function parameters.
- TIntermAggregate* params = (*seqIter)->getAsAggregate();
- ASSERT(params != NULL);
- ASSERT(params->getOp() == EOpParameters);
- params->traverse(this);
-
- // Traverse function body.
- TIntermAggregate* body = ++seqIter != sequence.end() ?
- (*seqIter)->getAsAggregate() : NULL;
- visitCodeBlock(body);
- decrementDepth();
-
- // Fully processed; no need to visit children.
- visitChildren = false;
- break;
- }
- case EOpFunctionCall:
- // Function call.
- if (visit == PreVisit)
- {
- out << hashFunctionName(node->getName()) << "(";
- }
- else if (visit == InVisit)
- {
- out << ", ";
- }
- else
- {
- out << ")";
- }
- break;
- case EOpParameters: {
- // Function parameters.
- ASSERT(visit == PreVisit);
- out << "(";
- writeFunctionParameters(node->getSequence());
- out << ")";
- visitChildren = false;
- break;
- }
- case EOpDeclaration: {
- // Variable declaration.
- if (visit == PreVisit)
- {
- const TIntermSequence& sequence = node->getSequence();
- const TIntermTyped* variable = sequence.front()->getAsTyped();
- writeVariableType(variable->getType());
- out << " ";
- mDeclaringVariables = true;
- }
- else if (visit == InVisit)
- {
- out << ", ";
- mDeclaringVariables = true;
- }
- else
- {
- mDeclaringVariables = false;
- }
- break;
- }
- case EOpConstructFloat: writeTriplet(visit, "float(", NULL, ")"); break;
- case EOpConstructVec2: writeTriplet(visit, "vec2(", ", ", ")"); break;
- case EOpConstructVec3: writeTriplet(visit, "vec3(", ", ", ")"); break;
- case EOpConstructVec4: writeTriplet(visit, "vec4(", ", ", ")"); break;
- case EOpConstructBool: writeTriplet(visit, "bool(", NULL, ")"); break;
- case EOpConstructBVec2: writeTriplet(visit, "bvec2(", ", ", ")"); break;
- case EOpConstructBVec3: writeTriplet(visit, "bvec3(", ", ", ")"); break;
- case EOpConstructBVec4: writeTriplet(visit, "bvec4(", ", ", ")"); break;
- case EOpConstructInt: writeTriplet(visit, "int(", NULL, ")"); break;
- case EOpConstructIVec2: writeTriplet(visit, "ivec2(", ", ", ")"); break;
- case EOpConstructIVec3: writeTriplet(visit, "ivec3(", ", ", ")"); break;
- case EOpConstructIVec4: writeTriplet(visit, "ivec4(", ", ", ")"); break;
- case EOpConstructMat2: writeTriplet(visit, "mat2(", ", ", ")"); break;
- case EOpConstructMat3: writeTriplet(visit, "mat3(", ", ", ")"); break;
- case EOpConstructMat4: writeTriplet(visit, "mat4(", ", ", ")"); break;
- case EOpConstructStruct:
- if (visit == PreVisit)
- {
- const TType& type = node->getType();
- ASSERT(type.getBasicType() == EbtStruct);
- out << hashName(type.getStruct()->name()) << "(";
- }
- else if (visit == InVisit)
- {
- out << ", ";
- }
- else
- {
- out << ")";
- }
- break;
-
- case EOpLessThan: preString = "lessThan("; delayedWrite = true; break;
- case EOpGreaterThan: preString = "greaterThan("; delayedWrite = true; break;
- case EOpLessThanEqual: preString = "lessThanEqual("; delayedWrite = true; break;
- case EOpGreaterThanEqual: preString = "greaterThanEqual("; delayedWrite = true; break;
- case EOpVectorEqual: preString = "equal("; delayedWrite = true; break;
- case EOpVectorNotEqual: preString = "notEqual("; delayedWrite = true; break;
- case EOpComma: writeTriplet(visit, NULL, ", ", NULL); break;
-
- case EOpMod: preString = "mod("; delayedWrite = true; break;
- case EOpPow: preString = "pow("; delayedWrite = true; break;
- case EOpAtan: preString = "atan("; delayedWrite = true; break;
- case EOpMin: preString = "min("; delayedWrite = true; break;
- case EOpMax: preString = "max("; delayedWrite = true; break;
- case EOpClamp: preString = "clamp("; delayedWrite = true; break;
- case EOpMix: preString = "mix("; delayedWrite = true; break;
- case EOpStep: preString = "step("; delayedWrite = true; break;
- case EOpSmoothStep: preString = "smoothstep("; delayedWrite = true; break;
-
- case EOpDistance: preString = "distance("; delayedWrite = true; break;
- case EOpDot: preString = "dot("; delayedWrite = true; break;
- case EOpCross: preString = "cross("; delayedWrite = true; break;
- case EOpFaceForward: preString = "faceforward("; delayedWrite = true; break;
- case EOpReflect: preString = "reflect("; delayedWrite = true; break;
- case EOpRefract: preString = "refract("; delayedWrite = true; break;
- case EOpMul: preString = "matrixCompMult("; delayedWrite = true; break;
-
- default: UNREACHABLE(); break;
- }
- if (delayedWrite && visit == PreVisit && node->getUseEmulatedFunction())
- preString = BuiltInFunctionEmulator::GetEmulatedFunctionName(preString);
- if (delayedWrite)
- writeTriplet(visit, preString.c_str(), ", ", ")");
- return visitChildren;
-}
-
-bool TOutputGLSLBase::visitLoop(Visit visit, TIntermLoop* node)
-{
- TInfoSinkBase& out = objSink();
-
- incrementDepth(node);
- // Loop header.
- TLoopType loopType = node->getType();
- if (loopType == ELoopFor) // for loop
- {
- if (!node->getUnrollFlag()) {
- out << "for (";
- if (node->getInit())
- node->getInit()->traverse(this);
- out << "; ";
-
- if (node->getCondition())
- node->getCondition()->traverse(this);
- out << "; ";
-
- if (node->getExpression())
- node->getExpression()->traverse(this);
- out << ")\n";
- }
- }
- else if (loopType == ELoopWhile) // while loop
- {
- out << "while (";
- ASSERT(node->getCondition() != NULL);
- node->getCondition()->traverse(this);
- out << ")\n";
- }
- else // do-while loop
- {
- ASSERT(loopType == ELoopDoWhile);
- out << "do\n";
- }
-
- // Loop body.
- if (node->getUnrollFlag())
- {
- TLoopIndexInfo indexInfo;
- mLoopUnroll.FillLoopIndexInfo(node, indexInfo);
- mLoopUnroll.Push(indexInfo);
- while (mLoopUnroll.SatisfiesLoopCondition())
- {
- visitCodeBlock(node->getBody());
- mLoopUnroll.Step();
- }
- mLoopUnroll.Pop();
- }
- else
- {
- visitCodeBlock(node->getBody());
- }
-
- // Loop footer.
- if (loopType == ELoopDoWhile) // do-while loop
- {
- out << "while (";
- ASSERT(node->getCondition() != NULL);
- node->getCondition()->traverse(this);
- out << ");\n";
- }
- decrementDepth();
-
- // No need to visit children. They have been already processed in
- // this function.
- return false;
-}
-
-bool TOutputGLSLBase::visitBranch(Visit visit, TIntermBranch* node)
-{
- switch (node->getFlowOp())
- {
- case EOpKill: writeTriplet(visit, "discard", NULL, NULL); break;
- case EOpBreak: writeTriplet(visit, "break", NULL, NULL); break;
- case EOpContinue: writeTriplet(visit, "continue", NULL, NULL); break;
- case EOpReturn: writeTriplet(visit, "return ", NULL, NULL); break;
- default: UNREACHABLE(); break;
- }
-
- return true;
-}
-
-void TOutputGLSLBase::visitCodeBlock(TIntermNode* node) {
- TInfoSinkBase &out = objSink();
- if (node != NULL)
- {
- node->traverse(this);
- // Single statements not part of a sequence need to be terminated
- // with semi-colon.
- if (isSingleStatement(node))
- out << ";\n";
- }
- else
- {
- out << "{\n}\n"; // Empty code block.
- }
-}
-
-TString TOutputGLSLBase::getTypeName(const TType& type)
-{
- TInfoSinkBase out;
- if (type.isMatrix())
- {
- out << "mat";
- out << type.getNominalSize();
- }
- else if (type.isVector())
- {
- switch (type.getBasicType())
- {
- case EbtFloat: out << "vec"; break;
- case EbtInt: out << "ivec"; break;
- case EbtBool: out << "bvec"; break;
- default: UNREACHABLE(); break;
- }
- out << type.getNominalSize();
- }
- else
- {
- if (type.getBasicType() == EbtStruct)
- out << hashName(type.getStruct()->name());
- else
- out << type.getBasicString();
- }
- return TString(out.c_str());
-}
-
-TString TOutputGLSLBase::hashName(const TString& name)
-{
- if (mHashFunction == NULL || name.empty())
- return name;
- NameMap::const_iterator it = mNameMap.find(name.c_str());
- if (it != mNameMap.end())
- return it->second.c_str();
- TString hashedName = TIntermTraverser::hash(name, mHashFunction);
- mNameMap[name.c_str()] = hashedName.c_str();
- return hashedName;
-}
-
-TString TOutputGLSLBase::hashVariableName(const TString& name)
-{
- if (mSymbolTable.findBuiltIn(name) != NULL)
- return name;
- return hashName(name);
-}
-
-TString TOutputGLSLBase::hashFunctionName(const TString& mangled_name)
-{
- TString name = TFunction::unmangleName(mangled_name);
- if (mSymbolTable.findBuiltIn(mangled_name) != NULL || name == "main")
- return name;
- return hashName(name);
-}
-
-bool TOutputGLSLBase::structDeclared(const TStructure* structure) const
-{
- return mDeclaredStructs.find(structure->name()) != mDeclaredStructs.end();
-}
-
-void TOutputGLSLBase::declareStruct(const TStructure* structure)
-{
- TInfoSinkBase& out = objSink();
-
- out << "struct " << hashName(structure->name()) << "{\n";
- const TFieldList& fields = structure->fields();
- for (size_t i = 0; i < fields.size(); ++i)
- {
- const TField* field = fields[i];
- if (writeVariablePrecision(field->type()->getPrecision()))
- out << " ";
- out << getTypeName(*field->type()) << " " << hashName(field->name());
- if (field->type()->isArray())
- out << arrayBrackets(*field->type());
- out << ";\n";
- }
- out << "}";
-
- mDeclaredStructs.insert(structure->name());
-}
diff --git a/chromium/third_party/angle/src/compiler/OutputGLSLBase.h b/chromium/third_party/angle/src/compiler/OutputGLSLBase.h
deleted file mode 100644
index 69868c09ccf..00000000000
--- a/chromium/third_party/angle/src/compiler/OutputGLSLBase.h
+++ /dev/null
@@ -1,79 +0,0 @@
-//
-// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#ifndef CROSSCOMPILERGLSL_OUTPUTGLSLBASE_H_
-#define CROSSCOMPILERGLSL_OUTPUTGLSLBASE_H_
-
-#include <set>
-
-#include "compiler/ForLoopUnroll.h"
-#include "compiler/intermediate.h"
-#include "compiler/ParseContext.h"
-
-class TOutputGLSLBase : public TIntermTraverser
-{
-public:
- TOutputGLSLBase(TInfoSinkBase& objSink,
- ShArrayIndexClampingStrategy clampingStrategy,
- ShHashFunction64 hashFunction,
- NameMap& nameMap,
- TSymbolTable& symbolTable);
-
-protected:
- TInfoSinkBase& objSink() { return mObjSink; }
- void writeTriplet(Visit visit, const char* preStr, const char* inStr, const char* postStr);
- void writeVariableType(const TType& type);
- virtual bool writeVariablePrecision(TPrecision precision) = 0;
- void writeFunctionParameters(const TIntermSequence& args);
- const ConstantUnion* writeConstantUnion(const TType& type, const ConstantUnion* pConstUnion);
- TString getTypeName(const TType& type);
-
- virtual void visitSymbol(TIntermSymbol* node);
- virtual void visitConstantUnion(TIntermConstantUnion* node);
- virtual bool visitBinary(Visit visit, TIntermBinary* node);
- virtual bool visitUnary(Visit visit, TIntermUnary* node);
- virtual bool visitSelection(Visit visit, TIntermSelection* node);
- virtual bool visitAggregate(Visit visit, TIntermAggregate* node);
- virtual bool visitLoop(Visit visit, TIntermLoop* node);
- virtual bool visitBranch(Visit visit, TIntermBranch* node);
-
- void visitCodeBlock(TIntermNode* node);
-
-
- // Return the original name if hash function pointer is NULL;
- // otherwise return the hashed name.
- TString hashName(const TString& name);
- // Same as hashName(), but without hashing built-in variables.
- TString hashVariableName(const TString& name);
- // Same as hashName(), but without hashing built-in functions.
- TString hashFunctionName(const TString& mangled_name);
-
-private:
- bool structDeclared(const TStructure* structure) const;
- void declareStruct(const TStructure* structure);
-
- TInfoSinkBase& mObjSink;
- bool mDeclaringVariables;
-
- // Structs are declared as the tree is traversed. This set contains all
- // the structs already declared. It is maintained so that a struct is
- // declared only once.
- typedef std::set<TString> DeclaredStructs;
- DeclaredStructs mDeclaredStructs;
-
- ForLoopUnroll mLoopUnroll;
-
- ShArrayIndexClampingStrategy mClampingStrategy;
-
- // name hashing.
- ShHashFunction64 mHashFunction;
-
- NameMap& mNameMap;
-
- TSymbolTable& mSymbolTable;
-};
-
-#endif // CROSSCOMPILERGLSL_OUTPUTGLSLBASE_H_
diff --git a/chromium/third_party/angle/src/compiler/OutputHLSL.cpp b/chromium/third_party/angle/src/compiler/OutputHLSL.cpp
deleted file mode 100644
index 53799dffe76..00000000000
--- a/chromium/third_party/angle/src/compiler/OutputHLSL.cpp
+++ /dev/null
@@ -1,3133 +0,0 @@
-//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#include "compiler/OutputHLSL.h"
-
-#include "common/angleutils.h"
-#include "compiler/debug.h"
-#include "compiler/DetectDiscontinuity.h"
-#include "compiler/InfoSink.h"
-#include "compiler/SearchSymbol.h"
-#include "compiler/UnfoldShortCircuit.h"
-#include "compiler/NodeSearch.h"
-
-#include <algorithm>
-#include <cfloat>
-#include <stdio.h>
-
-namespace sh
-{
-// Integer to TString conversion
-TString str(int i)
-{
- char buffer[20];
- snprintf(buffer, sizeof(buffer), "%d", i);
- return buffer;
-}
-
-OutputHLSL::OutputHLSL(TParseContext &context, const ShBuiltInResources& resources, ShShaderOutput outputType)
- : TIntermTraverser(true, true, true), mContext(context), mOutputType(outputType)
-{
- mUnfoldShortCircuit = new UnfoldShortCircuit(context, this);
- mInsideFunction = false;
-
- mUsesTexture2D = false;
- mUsesTexture2D_bias = false;
- mUsesTexture2DProj = false;
- mUsesTexture2DProj_bias = false;
- mUsesTexture2DProjLod = false;
- mUsesTexture2DLod = false;
- mUsesTextureCube = false;
- mUsesTextureCube_bias = false;
- mUsesTextureCubeLod = false;
- mUsesTexture2DLod0 = false;
- mUsesTexture2DLod0_bias = false;
- mUsesTexture2DProjLod0 = false;
- mUsesTexture2DProjLod0_bias = false;
- mUsesTextureCubeLod0 = false;
- mUsesTextureCubeLod0_bias = false;
- mUsesFragColor = false;
- mUsesFragData = false;
- mUsesDepthRange = false;
- mUsesFragCoord = false;
- mUsesPointCoord = false;
- mUsesFrontFacing = false;
- mUsesPointSize = false;
- mUsesFragDepth = false;
- mUsesXor = false;
- mUsesMod1 = false;
- mUsesMod2v = false;
- mUsesMod2f = false;
- mUsesMod3v = false;
- mUsesMod3f = false;
- mUsesMod4v = false;
- mUsesMod4f = false;
- mUsesFaceforward1 = false;
- mUsesFaceforward2 = false;
- mUsesFaceforward3 = false;
- mUsesFaceforward4 = false;
- mUsesAtan2_1 = false;
- mUsesAtan2_2 = false;
- mUsesAtan2_3 = false;
- mUsesAtan2_4 = false;
- mUsesDiscardRewriting = false;
-
- mNumRenderTargets = resources.EXT_draw_buffers ? resources.MaxDrawBuffers : 1;
-
- mScopeDepth = 0;
-
- mUniqueIndex = 0;
-
- mContainsLoopDiscontinuity = false;
- mOutputLod0Function = false;
- mInsideDiscontinuousLoop = false;
-
- mExcessiveLoopIndex = NULL;
-
- if (mOutputType == SH_HLSL9_OUTPUT)
- {
- if (mContext.shaderType == SH_FRAGMENT_SHADER)
- {
- mUniformRegister = 3; // Reserve registers for dx_DepthRange, dx_ViewCoords and dx_DepthFront
- }
- else
- {
- mUniformRegister = 2; // Reserve registers for dx_DepthRange and dx_ViewAdjust
- }
- }
- else
- {
- mUniformRegister = 0;
- }
-
- mSamplerRegister = 0;
-}
-
-OutputHLSL::~OutputHLSL()
-{
- delete mUnfoldShortCircuit;
-}
-
-void OutputHLSL::output()
-{
- mContainsLoopDiscontinuity = mContext.shaderType == SH_FRAGMENT_SHADER && containsLoopDiscontinuity(mContext.treeRoot);
-
- mContext.treeRoot->traverse(this); // Output the body first to determine what has to go in the header
- header();
-
- mContext.infoSink().obj << mHeader.c_str();
- mContext.infoSink().obj << mBody.c_str();
-}
-
-TInfoSinkBase &OutputHLSL::getBodyStream()
-{
- return mBody;
-}
-
-const ActiveUniforms &OutputHLSL::getUniforms()
-{
- return mActiveUniforms;
-}
-
-int OutputHLSL::vectorSize(const TType &type) const
-{
- int elementSize = type.isMatrix() ? type.getNominalSize() : 1;
- int arraySize = type.isArray() ? type.getArraySize() : 1;
-
- return elementSize * arraySize;
-}
-
-void OutputHLSL::header()
-{
- ShShaderType shaderType = mContext.shaderType;
- TInfoSinkBase &out = mHeader;
-
- for (StructDeclarations::iterator structDeclaration = mStructDeclarations.begin(); structDeclaration != mStructDeclarations.end(); structDeclaration++)
- {
- out << *structDeclaration;
- }
-
- for (Constructors::iterator constructor = mConstructors.begin(); constructor != mConstructors.end(); constructor++)
- {
- out << *constructor;
- }
-
- TString uniforms;
- TString varyings;
- TString attributes;
-
- for (ReferencedSymbols::const_iterator uniform = mReferencedUniforms.begin(); uniform != mReferencedUniforms.end(); uniform++)
- {
- const TType &type = uniform->second->getType();
- const TString &name = uniform->second->getSymbol();
-
- if (mOutputType == SH_HLSL11_OUTPUT && IsSampler(type.getBasicType())) // Also declare the texture
- {
- int index = samplerRegister(mReferencedUniforms[name]);
-
- uniforms += "uniform SamplerState sampler_" + decorateUniform(name, type) + arrayString(type) +
- " : register(s" + str(index) + ");\n";
-
- uniforms += "uniform " + textureString(type) + " texture_" + decorateUniform(name, type) + arrayString(type) +
- " : register(t" + str(index) + ");\n";
- }
- else
- {
- uniforms += "uniform " + typeString(type) + " " + decorateUniform(name, type) + arrayString(type) +
- " : register(" + registerString(mReferencedUniforms[name]) + ");\n";
- }
- }
-
- for (ReferencedSymbols::const_iterator varying = mReferencedVaryings.begin(); varying != mReferencedVaryings.end(); varying++)
- {
- const TType &type = varying->second->getType();
- const TString &name = varying->second->getSymbol();
-
- // Program linking depends on this exact format
- varyings += "static " + typeString(type) + " " + decorate(name) + arrayString(type) + " = " + initializer(type) + ";\n";
- }
-
- for (ReferencedSymbols::const_iterator attribute = mReferencedAttributes.begin(); attribute != mReferencedAttributes.end(); attribute++)
- {
- const TType &type = attribute->second->getType();
- const TString &name = attribute->second->getSymbol();
-
- attributes += "static " + typeString(type) + " " + decorate(name) + arrayString(type) + " = " + initializer(type) + ";\n";
- }
-
- if (mUsesDiscardRewriting)
- {
- out << "#define ANGLE_USES_DISCARD_REWRITING" << "\n";
- }
-
- if (shaderType == SH_FRAGMENT_SHADER)
- {
- TExtensionBehavior::const_iterator iter = mContext.extensionBehavior().find("GL_EXT_draw_buffers");
- const bool usingMRTExtension = (iter != mContext.extensionBehavior().end() && (iter->second == EBhEnable || iter->second == EBhRequire));
-
- const unsigned int numColorValues = usingMRTExtension ? mNumRenderTargets : 1;
-
- out << "// Varyings\n";
- out << varyings;
- out << "\n"
- "static float4 gl_Color[" << numColorValues << "] =\n"
- "{\n";
- for (unsigned int i = 0; i < numColorValues; i++)
- {
- out << " float4(0, 0, 0, 0)";
- if (i + 1 != numColorValues)
- {
- out << ",";
- }
- out << "\n";
- }
- out << "};\n";
-
- if (mUsesFragDepth)
- {
- out << "static float gl_Depth = 0.0;\n";
- }
-
- if (mUsesFragCoord)
- {
- out << "static float4 gl_FragCoord = float4(0, 0, 0, 0);\n";
- }
-
- if (mUsesPointCoord)
- {
- out << "static float2 gl_PointCoord = float2(0.5, 0.5);\n";
- }
-
- if (mUsesFrontFacing)
- {
- out << "static bool gl_FrontFacing = false;\n";
- }
-
- out << "\n";
-
- if (mUsesDepthRange)
- {
- out << "struct gl_DepthRangeParameters\n"
- "{\n"
- " float near;\n"
- " float far;\n"
- " float diff;\n"
- "};\n"
- "\n";
- }
-
- if (mOutputType == SH_HLSL11_OUTPUT)
- {
- out << "cbuffer DriverConstants : register(b1)\n"
- "{\n";
-
- if (mUsesDepthRange)
- {
- out << " float3 dx_DepthRange : packoffset(c0);\n";
- }
-
- if (mUsesFragCoord)
- {
- out << " float4 dx_ViewCoords : packoffset(c1);\n";
- }
-
- if (mUsesFragCoord || mUsesFrontFacing)
- {
- out << " float3 dx_DepthFront : packoffset(c2);\n";
- }
-
- out << "};\n";
- }
- else
- {
- if (mUsesDepthRange)
- {
- out << "uniform float3 dx_DepthRange : register(c0);";
- }
-
- if (mUsesFragCoord)
- {
- out << "uniform float4 dx_ViewCoords : register(c1);\n";
- }
-
- if (mUsesFragCoord || mUsesFrontFacing)
- {
- out << "uniform float3 dx_DepthFront : register(c2);\n";
- }
- }
-
- out << "\n";
-
- if (mUsesDepthRange)
- {
- out << "static gl_DepthRangeParameters gl_DepthRange = {dx_DepthRange.x, dx_DepthRange.y, dx_DepthRange.z};\n"
- "\n";
- }
-
- out << uniforms;
- out << "\n";
-
- if (mUsesTexture2D)
- {
- if (mOutputType == SH_HLSL9_OUTPUT)
- {
- out << "float4 gl_texture2D(sampler2D s, float2 t)\n"
- "{\n"
- " return tex2D(s, t);\n"
- "}\n"
- "\n";
- }
- else if (mOutputType == SH_HLSL11_OUTPUT)
- {
- out << "float4 gl_texture2D(Texture2D t, SamplerState s, float2 uv)\n"
- "{\n"
- " return t.Sample(s, uv);\n"
- "}\n"
- "\n";
- }
- else UNREACHABLE();
- }
-
- if (mUsesTexture2D_bias)
- {
- if (mOutputType == SH_HLSL9_OUTPUT)
- {
- out << "float4 gl_texture2D(sampler2D s, float2 t, float bias)\n"
- "{\n"
- " return tex2Dbias(s, float4(t.x, t.y, 0, bias));\n"
- "}\n"
- "\n";
- }
- else if (mOutputType == SH_HLSL11_OUTPUT)
- {
- out << "float4 gl_texture2D(Texture2D t, SamplerState s, float2 uv, float bias)\n"
- "{\n"
- " return t.SampleBias(s, uv, bias);\n"
- "}\n"
- "\n";
- }
- else UNREACHABLE();
- }
-
- if (mUsesTexture2DProj)
- {
- if (mOutputType == SH_HLSL9_OUTPUT)
- {
- out << "float4 gl_texture2DProj(sampler2D s, float3 t)\n"
- "{\n"
- " return tex2Dproj(s, float4(t.x, t.y, 0, t.z));\n"
- "}\n"
- "\n"
- "float4 gl_texture2DProj(sampler2D s, float4 t)\n"
- "{\n"
- " return tex2Dproj(s, t);\n"
- "}\n"
- "\n";
- }
- else if (mOutputType == SH_HLSL11_OUTPUT)
- {
- out << "float4 gl_texture2DProj(Texture2D t, SamplerState s, float3 uvw)\n"
- "{\n"
- " return t.Sample(s, float2(uvw.x / uvw.z, uvw.y / uvw.z));\n"
- "}\n"
- "\n"
- "float4 gl_texture2DProj(Texture2D t, SamplerState s, float4 uvw)\n"
- "{\n"
- " return t.Sample(s, float2(uvw.x / uvw.w, uvw.y / uvw.w));\n"
- "}\n"
- "\n";
- }
- else UNREACHABLE();
- }
-
- if (mUsesTexture2DProj_bias)
- {
- if (mOutputType == SH_HLSL9_OUTPUT)
- {
- out << "float4 gl_texture2DProj(sampler2D s, float3 t, float bias)\n"
- "{\n"
- " return tex2Dbias(s, float4(t.x / t.z, t.y / t.z, 0, bias));\n"
- "}\n"
- "\n"
- "float4 gl_texture2DProj(sampler2D s, float4 t, float bias)\n"
- "{\n"
- " return tex2Dbias(s, float4(t.x / t.w, t.y / t.w, 0, bias));\n"
- "}\n"
- "\n";
- }
- else if (mOutputType == SH_HLSL11_OUTPUT)
- {
- out << "float4 gl_texture2DProj(Texture2D t, SamplerState s, float3 uvw, float bias)\n"
- "{\n"
- " return t.SampleBias(s, float2(uvw.x / uvw.z, uvw.y / uvw.z), bias);\n"
- "}\n"
- "\n"
- "float4 gl_texture2DProj(Texture2D t, SamplerState s, float4 uvw, float bias)\n"
- "{\n"
- " return t.SampleBias(s, float2(uvw.x / uvw.w, uvw.y / uvw.w), bias);\n"
- "}\n"
- "\n";
- }
- else UNREACHABLE();
- }
-
- if (mUsesTextureCube)
- {
- if (mOutputType == SH_HLSL9_OUTPUT)
- {
- out << "float4 gl_textureCube(samplerCUBE s, float3 t)\n"
- "{\n"
- " return texCUBE(s, t);\n"
- "}\n"
- "\n";
- }
- else if (mOutputType == SH_HLSL11_OUTPUT)
- {
- out << "float4 gl_textureCube(TextureCube t, SamplerState s, float3 uvw)\n"
- "{\n"
- " return t.Sample(s, uvw);\n"
- "}\n"
- "\n";
- }
- else UNREACHABLE();
- }
-
- if (mUsesTextureCube_bias)
- {
- if (mOutputType == SH_HLSL9_OUTPUT)
- {
- out << "float4 gl_textureCube(samplerCUBE s, float3 t, float bias)\n"
- "{\n"
- " return texCUBEbias(s, float4(t.x, t.y, t.z, bias));\n"
- "}\n"
- "\n";
- }
- else if (mOutputType == SH_HLSL11_OUTPUT)
- {
- out << "float4 gl_textureCube(TextureCube t, SamplerState s, float3 uvw, float bias)\n"
- "{\n"
- " return t.SampleBias(s, uvw, bias);\n"
- "}\n"
- "\n";
- }
- else UNREACHABLE();
- }
-
- // These *Lod0 intrinsics are not available in GL fragment shaders.
- // They are used to sample using discontinuous texture coordinates.
- if (mUsesTexture2DLod0)
- {
- if (mOutputType == SH_HLSL9_OUTPUT)
- {
- out << "float4 gl_texture2DLod0(sampler2D s, float2 t)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x, t.y, 0, 0));\n"
- "}\n"
- "\n";
- }
- else if (mOutputType == SH_HLSL11_OUTPUT)
- {
- out << "float4 gl_texture2DLod0(Texture2D t, SamplerState s, float2 uv)\n"
- "{\n"
- " return t.SampleLevel(s, uv, 0);\n"
- "}\n"
- "\n";
- }
- else UNREACHABLE();
- }
-
- if (mUsesTexture2DLod0_bias)
- {
- if (mOutputType == SH_HLSL9_OUTPUT)
- {
- out << "float4 gl_texture2DLod0(sampler2D s, float2 t, float bias)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x, t.y, 0, 0));\n"
- "}\n"
- "\n";
- }
- else if (mOutputType == SH_HLSL11_OUTPUT)
- {
- out << "float4 gl_texture2DLod0(Texture2D t, SamplerState s, float2 uv, float bias)\n"
- "{\n"
- " return t.SampleLevel(s, uv, 0);\n"
- "}\n"
- "\n";
- }
- else UNREACHABLE();
- }
-
- if (mUsesTexture2DProjLod0)
- {
- if (mOutputType == SH_HLSL9_OUTPUT)
- {
- out << "float4 gl_texture2DProjLod0(sampler2D s, float3 t)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x / t.z, t.y / t.z, 0, 0));\n"
- "}\n"
- "\n"
- "float4 gl_texture2DProjLod(sampler2D s, float4 t)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x / t.w, t.y / t.w, 0, 0));\n"
- "}\n"
- "\n";
- }
- else if (mOutputType == SH_HLSL11_OUTPUT)
- {
- out << "float4 gl_texture2DProjLod0(Texture2D t, SamplerState s, float3 uvw)\n"
- "{\n"
- " return t.SampleLevel(s, float2(uvw.x / uvw.z, uvw.y / uvw.z), 0);\n"
- "}\n"
- "\n"
- "float4 gl_texture2DProjLod0(Texture2D t, SamplerState s, float4 uvw)\n"
- "{\n"
- " return t.SampleLevel(s, float2(uvw.x / uvw.w, uvw.y / uvw.w), 0);\n"
- "}\n"
- "\n";
- }
- else UNREACHABLE();
- }
-
- if (mUsesTexture2DProjLod0_bias)
- {
- if (mOutputType == SH_HLSL9_OUTPUT)
- {
- out << "float4 gl_texture2DProjLod0_bias(sampler2D s, float3 t, float bias)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x / t.z, t.y / t.z, 0, 0));\n"
- "}\n"
- "\n"
- "float4 gl_texture2DProjLod_bias(sampler2D s, float4 t, float bias)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x / t.w, t.y / t.w, 0, 0));\n"
- "}\n"
- "\n";
- }
- else if (mOutputType == SH_HLSL11_OUTPUT)
- {
- out << "float4 gl_texture2DProjLod_bias(Texture2D t, SamplerState s, float3 uvw, float bias)\n"
- "{\n"
- " return t.SampleLevel(s, float2(uvw.x / uvw.z, uvw.y / uvw.z), 0);\n"
- "}\n"
- "\n"
- "float4 gl_texture2DProjLod_bias(Texture2D t, SamplerState s, float4 uvw, float bias)\n"
- "{\n"
- " return t.SampleLevel(s, float2(uvw.x / uvw.w, uvw.y / uvw.w), 0);\n"
- "}\n"
- "\n";
- }
- else UNREACHABLE();
- }
-
- if (mUsesTextureCubeLod0)
- {
- if (mOutputType == SH_HLSL9_OUTPUT)
- {
- out << "float4 gl_textureCubeLod0(samplerCUBE s, float3 t)\n"
- "{\n"
- " return texCUBElod(s, float4(t.x, t.y, t.z, 0));\n"
- "}\n"
- "\n";
- }
- else if (mOutputType == SH_HLSL11_OUTPUT)
- {
- out << "float4 gl_textureCubeLod0(TextureCube t, SamplerState s, float3 uvw)\n"
- "{\n"
- " return t.SampleLevel(s, uvw, 0);\n"
- "}\n"
- "\n";
- }
- else UNREACHABLE();
- }
-
- if (mUsesTextureCubeLod0_bias)
- {
- if (mOutputType == SH_HLSL9_OUTPUT)
- {
- out << "float4 gl_textureCubeLod0(samplerCUBE s, float3 t, float bias)\n"
- "{\n"
- " return texCUBElod(s, float4(t.x, t.y, t.z, 0));\n"
- "}\n"
- "\n";
- }
- else if (mOutputType == SH_HLSL11_OUTPUT)
- {
- out << "float4 gl_textureCubeLod0(TextureCube t, SamplerState s, float3 uvw, float bias)\n"
- "{\n"
- " return t.SampleLevel(s, uvw, 0);\n"
- "}\n"
- "\n";
- }
- else UNREACHABLE();
- }
-
- if (usingMRTExtension && mNumRenderTargets > 1)
- {
- out << "#define GL_USES_MRT\n";
- }
-
- if (mUsesFragColor)
- {
- out << "#define GL_USES_FRAG_COLOR\n";
- }
-
- if (mUsesFragData)
- {
- out << "#define GL_USES_FRAG_DATA\n";
- }
- }
- else // Vertex shader
- {
- out << "// Attributes\n";
- out << attributes;
- out << "\n"
- "static float4 gl_Position = float4(0, 0, 0, 0);\n";
-
- if (mUsesPointSize)
- {
- out << "static float gl_PointSize = float(1);\n";
- }
-
- out << "\n"
- "// Varyings\n";
- out << varyings;
- out << "\n";
-
- if (mUsesDepthRange)
- {
- out << "struct gl_DepthRangeParameters\n"
- "{\n"
- " float near;\n"
- " float far;\n"
- " float diff;\n"
- "};\n"
- "\n";
- }
-
- if (mOutputType == SH_HLSL11_OUTPUT)
- {
- if (mUsesDepthRange)
- {
- out << "cbuffer DriverConstants : register(b1)\n"
- "{\n"
- " float3 dx_DepthRange : packoffset(c0);\n"
- "};\n"
- "\n";
- }
- }
- else
- {
- if (mUsesDepthRange)
- {
- out << "uniform float3 dx_DepthRange : register(c0);\n";
- }
-
- out << "uniform float4 dx_ViewAdjust : register(c1);\n"
- "\n";
- }
-
- if (mUsesDepthRange)
- {
- out << "static gl_DepthRangeParameters gl_DepthRange = {dx_DepthRange.x, dx_DepthRange.y, dx_DepthRange.z};\n"
- "\n";
- }
-
- out << uniforms;
- out << "\n";
-
- if (mUsesTexture2D)
- {
- if (mOutputType == SH_HLSL9_OUTPUT)
- {
- out << "float4 gl_texture2D(sampler2D s, float2 t)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x, t.y, 0, 0));\n"
- "}\n"
- "\n";
- }
- else if (mOutputType == SH_HLSL11_OUTPUT)
- {
- out << "float4 gl_texture2D(Texture2D t, SamplerState s, float2 uv)\n"
- "{\n"
- " return t.SampleLevel(s, uv, 0);\n"
- "}\n"
- "\n";
- }
- else UNREACHABLE();
- }
-
- if (mUsesTexture2DLod)
- {
- if (mOutputType == SH_HLSL9_OUTPUT)
- {
- out << "float4 gl_texture2DLod(sampler2D s, float2 t, float lod)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x, t.y, 0, lod));\n"
- "}\n"
- "\n";
- }
- else if (mOutputType == SH_HLSL11_OUTPUT)
- {
- out << "float4 gl_texture2DLod(Texture2D t, SamplerState s, float2 uv, float lod)\n"
- "{\n"
- " return t.SampleLevel(s, uv, lod);\n"
- "}\n"
- "\n";
- }
- else UNREACHABLE();
- }
-
- if (mUsesTexture2DProj)
- {
- if (mOutputType == SH_HLSL9_OUTPUT)
- {
- out << "float4 gl_texture2DProj(sampler2D s, float3 t)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x / t.z, t.y / t.z, 0, 0));\n"
- "}\n"
- "\n"
- "float4 gl_texture2DProj(sampler2D s, float4 t)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x / t.w, t.y / t.w, 0, 0));\n"
- "}\n"
- "\n";
- }
- else if (mOutputType == SH_HLSL11_OUTPUT)
- {
- out << "float4 gl_texture2DProj(Texture2D t, SamplerState s, float3 uvw)\n"
- "{\n"
- " return t.SampleLevel(s, float2(uvw.x / uvw.z, uvw.y / uvw.z), 0);\n"
- "}\n"
- "\n"
- "float4 gl_texture2DProj(Texture2D t, SamplerState s, float4 uvw)\n"
- "{\n"
- " return t.SampleLevel(s, float2(uvw.x / uvw.w, uvw.y / uvw.w), 0);\n"
- "}\n"
- "\n";
- }
- else UNREACHABLE();
- }
-
- if (mUsesTexture2DProjLod)
- {
- if (mOutputType == SH_HLSL9_OUTPUT)
- {
- out << "float4 gl_texture2DProjLod(sampler2D s, float3 t, float lod)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x / t.z, t.y / t.z, 0, lod));\n"
- "}\n"
- "\n"
- "float4 gl_texture2DProjLod(sampler2D s, float4 t, float lod)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x / t.w, t.y / t.w, 0, lod));\n"
- "}\n"
- "\n";
- }
- else if (mOutputType == SH_HLSL11_OUTPUT)
- {
- out << "float4 gl_texture2DProj(Texture2D t, SamplerState s, float3 uvw, float lod)\n"
- "{\n"
- " return t.SampleLevel(s, float2(uvw.x / uvw.z, uvw.y / uvw.z), lod);\n"
- "}\n"
- "\n"
- "float4 gl_texture2DProj(Texture2D t, SamplerState s, float4 uvw)\n"
- "{\n"
- " return t.SampleLevel(s, float2(uvw.x / uvw.w, uvw.y / uvw.w), lod);\n"
- "}\n"
- "\n";
- }
- else UNREACHABLE();
- }
-
- if (mUsesTextureCube)
- {
- if (mOutputType == SH_HLSL9_OUTPUT)
- {
- out << "float4 gl_textureCube(samplerCUBE s, float3 t)\n"
- "{\n"
- " return texCUBElod(s, float4(t.x, t.y, t.z, 0));\n"
- "}\n"
- "\n";
- }
- else if (mOutputType == SH_HLSL11_OUTPUT)
- {
- out << "float4 gl_textureCube(TextureCube t, SamplerState s, float3 uvw)\n"
- "{\n"
- " return t.SampleLevel(s, uvw, 0);\n"
- "}\n"
- "\n";
- }
- else UNREACHABLE();
- }
-
- if (mUsesTextureCubeLod)
- {
- if (mOutputType == SH_HLSL9_OUTPUT)
- {
- out << "float4 gl_textureCubeLod(samplerCUBE s, float3 t, float lod)\n"
- "{\n"
- " return texCUBElod(s, float4(t.x, t.y, t.z, lod));\n"
- "}\n"
- "\n";
- }
- else if (mOutputType == SH_HLSL11_OUTPUT)
- {
- out << "float4 gl_textureCubeLod(TextureCube t, SamplerState s, float3 uvw, float lod)\n"
- "{\n"
- " return t.SampleLevel(s, uvw, lod);\n"
- "}\n"
- "\n";
- }
- else UNREACHABLE();
- }
- }
-
- if (mUsesFragCoord)
- {
- out << "#define GL_USES_FRAG_COORD\n";
- }
-
- if (mUsesPointCoord)
- {
- out << "#define GL_USES_POINT_COORD\n";
- }
-
- if (mUsesFrontFacing)
- {
- out << "#define GL_USES_FRONT_FACING\n";
- }
-
- if (mUsesPointSize)
- {
- out << "#define GL_USES_POINT_SIZE\n";
- }
-
- if (mUsesFragDepth)
- {
- out << "#define GL_USES_FRAG_DEPTH\n";
- }
-
- if (mUsesDepthRange)
- {
- out << "#define GL_USES_DEPTH_RANGE\n";
- }
-
- if (mUsesXor)
- {
- out << "bool xor(bool p, bool q)\n"
- "{\n"
- " return (p || q) && !(p && q);\n"
- "}\n"
- "\n";
- }
-
- if (mUsesMod1)
- {
- out << "float mod(float x, float y)\n"
- "{\n"
- " return x - y * floor(x / y);\n"
- "}\n"
- "\n";
- }
-
- if (mUsesMod2v)
- {
- out << "float2 mod(float2 x, float2 y)\n"
- "{\n"
- " return x - y * floor(x / y);\n"
- "}\n"
- "\n";
- }
-
- if (mUsesMod2f)
- {
- out << "float2 mod(float2 x, float y)\n"
- "{\n"
- " return x - y * floor(x / y);\n"
- "}\n"
- "\n";
- }
-
- if (mUsesMod3v)
- {
- out << "float3 mod(float3 x, float3 y)\n"
- "{\n"
- " return x - y * floor(x / y);\n"
- "}\n"
- "\n";
- }
-
- if (mUsesMod3f)
- {
- out << "float3 mod(float3 x, float y)\n"
- "{\n"
- " return x - y * floor(x / y);\n"
- "}\n"
- "\n";
- }
-
- if (mUsesMod4v)
- {
- out << "float4 mod(float4 x, float4 y)\n"
- "{\n"
- " return x - y * floor(x / y);\n"
- "}\n"
- "\n";
- }
-
- if (mUsesMod4f)
- {
- out << "float4 mod(float4 x, float y)\n"
- "{\n"
- " return x - y * floor(x / y);\n"
- "}\n"
- "\n";
- }
-
- if (mUsesFaceforward1)
- {
- out << "float faceforward(float N, float I, float Nref)\n"
- "{\n"
- " if(dot(Nref, I) >= 0)\n"
- " {\n"
- " return -N;\n"
- " }\n"
- " else\n"
- " {\n"
- " return N;\n"
- " }\n"
- "}\n"
- "\n";
- }
-
- if (mUsesFaceforward2)
- {
- out << "float2 faceforward(float2 N, float2 I, float2 Nref)\n"
- "{\n"
- " if(dot(Nref, I) >= 0)\n"
- " {\n"
- " return -N;\n"
- " }\n"
- " else\n"
- " {\n"
- " return N;\n"
- " }\n"
- "}\n"
- "\n";
- }
-
- if (mUsesFaceforward3)
- {
- out << "float3 faceforward(float3 N, float3 I, float3 Nref)\n"
- "{\n"
- " if(dot(Nref, I) >= 0)\n"
- " {\n"
- " return -N;\n"
- " }\n"
- " else\n"
- " {\n"
- " return N;\n"
- " }\n"
- "}\n"
- "\n";
- }
-
- if (mUsesFaceforward4)
- {
- out << "float4 faceforward(float4 N, float4 I, float4 Nref)\n"
- "{\n"
- " if(dot(Nref, I) >= 0)\n"
- " {\n"
- " return -N;\n"
- " }\n"
- " else\n"
- " {\n"
- " return N;\n"
- " }\n"
- "}\n"
- "\n";
- }
-
- if (mUsesAtan2_1)
- {
- out << "float atanyx(float y, float x)\n"
- "{\n"
- " if(x == 0 && y == 0) x = 1;\n" // Avoid producing a NaN
- " return atan2(y, x);\n"
- "}\n";
- }
-
- if (mUsesAtan2_2)
- {
- out << "float2 atanyx(float2 y, float2 x)\n"
- "{\n"
- " if(x[0] == 0 && y[0] == 0) x[0] = 1;\n"
- " if(x[1] == 0 && y[1] == 0) x[1] = 1;\n"
- " return float2(atan2(y[0], x[0]), atan2(y[1], x[1]));\n"
- "}\n";
- }
-
- if (mUsesAtan2_3)
- {
- out << "float3 atanyx(float3 y, float3 x)\n"
- "{\n"
- " if(x[0] == 0 && y[0] == 0) x[0] = 1;\n"
- " if(x[1] == 0 && y[1] == 0) x[1] = 1;\n"
- " if(x[2] == 0 && y[2] == 0) x[2] = 1;\n"
- " return float3(atan2(y[0], x[0]), atan2(y[1], x[1]), atan2(y[2], x[2]));\n"
- "}\n";
- }
-
- if (mUsesAtan2_4)
- {
- out << "float4 atanyx(float4 y, float4 x)\n"
- "{\n"
- " if(x[0] == 0 && y[0] == 0) x[0] = 1;\n"
- " if(x[1] == 0 && y[1] == 0) x[1] = 1;\n"
- " if(x[2] == 0 && y[2] == 0) x[2] = 1;\n"
- " if(x[3] == 0 && y[3] == 0) x[3] = 1;\n"
- " return float4(atan2(y[0], x[0]), atan2(y[1], x[1]), atan2(y[2], x[2]), atan2(y[3], x[3]));\n"
- "}\n";
- }
-}
-
-void OutputHLSL::visitSymbol(TIntermSymbol *node)
-{
- TInfoSinkBase &out = mBody;
-
- TString name = node->getSymbol();
-
- if (name == "gl_FragColor")
- {
- out << "gl_Color[0]";
- mUsesFragColor = true;
- }
- else if (name == "gl_FragData")
- {
- out << "gl_Color";
- mUsesFragData = true;
- }
- else if (name == "gl_DepthRange")
- {
- mUsesDepthRange = true;
- out << name;
- }
- else if (name == "gl_FragCoord")
- {
- mUsesFragCoord = true;
- out << name;
- }
- else if (name == "gl_PointCoord")
- {
- mUsesPointCoord = true;
- out << name;
- }
- else if (name == "gl_FrontFacing")
- {
- mUsesFrontFacing = true;
- out << name;
- }
- else if (name == "gl_PointSize")
- {
- mUsesPointSize = true;
- out << name;
- }
- else if (name == "gl_FragDepthEXT")
- {
- mUsesFragDepth = true;
- out << "gl_Depth";
- }
- else
- {
- TQualifier qualifier = node->getQualifier();
-
- if (qualifier == EvqUniform)
- {
- mReferencedUniforms[name] = node;
- out << decorateUniform(name, node->getType());
- }
- else if (qualifier == EvqAttribute)
- {
- mReferencedAttributes[name] = node;
- out << decorate(name);
- }
- else if (qualifier == EvqVaryingOut || qualifier == EvqInvariantVaryingOut || qualifier == EvqVaryingIn || qualifier == EvqInvariantVaryingIn)
- {
- mReferencedVaryings[name] = node;
- out << decorate(name);
- }
- else
- {
- out << decorate(name);
- }
- }
-}
-
-bool OutputHLSL::visitBinary(Visit visit, TIntermBinary *node)
-{
- TInfoSinkBase &out = mBody;
-
- switch (node->getOp())
- {
- case EOpAssign: outputTriplet(visit, "(", " = ", ")"); break;
- case EOpInitialize:
- if (visit == PreVisit)
- {
- // GLSL allows to write things like "float x = x;" where a new variable x is defined
- // and the value of an existing variable x is assigned. HLSL uses C semantics (the
- // new variable is created before the assignment is evaluated), so we need to convert
- // this to "float t = x, x = t;".
-
- TIntermSymbol *symbolNode = node->getLeft()->getAsSymbolNode();
- TIntermTyped *expression = node->getRight();
-
- sh::SearchSymbol searchSymbol(symbolNode->getSymbol());
- expression->traverse(&searchSymbol);
- bool sameSymbol = searchSymbol.foundMatch();
-
- if (sameSymbol)
- {
- // Type already printed
- out << "t" + str(mUniqueIndex) + " = ";
- expression->traverse(this);
- out << ", ";
- symbolNode->traverse(this);
- out << " = t" + str(mUniqueIndex);
-
- mUniqueIndex++;
- return false;
- }
- }
- else if (visit == InVisit)
- {
- out << " = ";
- }
- break;
- case EOpAddAssign: outputTriplet(visit, "(", " += ", ")"); break;
- case EOpSubAssign: outputTriplet(visit, "(", " -= ", ")"); break;
- case EOpMulAssign: outputTriplet(visit, "(", " *= ", ")"); break;
- case EOpVectorTimesScalarAssign: outputTriplet(visit, "(", " *= ", ")"); break;
- case EOpMatrixTimesScalarAssign: outputTriplet(visit, "(", " *= ", ")"); break;
- case EOpVectorTimesMatrixAssign:
- if (visit == PreVisit)
- {
- out << "(";
- }
- else if (visit == InVisit)
- {
- out << " = mul(";
- node->getLeft()->traverse(this);
- out << ", transpose(";
- }
- else
- {
- out << ")))";
- }
- break;
- case EOpMatrixTimesMatrixAssign:
- if (visit == PreVisit)
- {
- out << "(";
- }
- else if (visit == InVisit)
- {
- out << " = mul(";
- node->getLeft()->traverse(this);
- out << ", ";
- }
- else
- {
- out << "))";
- }
- break;
- case EOpDivAssign: outputTriplet(visit, "(", " /= ", ")"); break;
- case EOpIndexDirect: outputTriplet(visit, "", "[", "]"); break;
- case EOpIndexIndirect: outputTriplet(visit, "", "[", "]"); break;
- case EOpIndexDirectStruct:
- if (visit == InVisit)
- {
- const TStructure* structure = node->getLeft()->getType().getStruct();
- const TIntermConstantUnion* index = node->getRight()->getAsConstantUnion();
- const TField* field = structure->fields()[index->getIConst(0)];
- out << "." + decorateField(field->name(), node->getLeft()->getType());
-
- return false;
- }
- break;
- case EOpVectorSwizzle:
- if (visit == InVisit)
- {
- out << ".";
-
- TIntermAggregate *swizzle = node->getRight()->getAsAggregate();
-
- if (swizzle)
- {
- TIntermSequence &sequence = swizzle->getSequence();
-
- for (TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); sit++)
- {
- TIntermConstantUnion *element = (*sit)->getAsConstantUnion();
-
- if (element)
- {
- int i = element->getIConst(0);
-
- switch (i)
- {
- case 0: out << "x"; break;
- case 1: out << "y"; break;
- case 2: out << "z"; break;
- case 3: out << "w"; break;
- default: UNREACHABLE();
- }
- }
- else UNREACHABLE();
- }
- }
- else UNREACHABLE();
-
- return false; // Fully processed
- }
- break;
- case EOpAdd: outputTriplet(visit, "(", " + ", ")"); break;
- case EOpSub: outputTriplet(visit, "(", " - ", ")"); break;
- case EOpMul: outputTriplet(visit, "(", " * ", ")"); break;
- case EOpDiv: outputTriplet(visit, "(", " / ", ")"); break;
- case EOpEqual:
- case EOpNotEqual:
- if (node->getLeft()->isScalar())
- {
- if (node->getOp() == EOpEqual)
- {
- outputTriplet(visit, "(", " == ", ")");
- }
- else
- {
- outputTriplet(visit, "(", " != ", ")");
- }
- }
- else if (node->getLeft()->getBasicType() == EbtStruct)
- {
- if (node->getOp() == EOpEqual)
- {
- out << "(";
- }
- else
- {
- out << "!(";
- }
-
- const TFieldList &fields = node->getLeft()->getType().getStruct()->fields();
-
- for (size_t i = 0; i < fields.size(); i++)
- {
- const TField *field = fields[i];
-
- node->getLeft()->traverse(this);
- out << "." + decorateField(field->name(), node->getLeft()->getType()) + " == ";
- node->getRight()->traverse(this);
- out << "." + decorateField(field->name(), node->getLeft()->getType());
-
- if (i < fields.size() - 1)
- {
- out << " && ";
- }
- }
-
- out << ")";
-
- return false;
- }
- else
- {
- ASSERT(node->getLeft()->isMatrix() || node->getLeft()->isVector());
-
- if (node->getOp() == EOpEqual)
- {
- outputTriplet(visit, "all(", " == ", ")");
- }
- else
- {
- outputTriplet(visit, "!all(", " == ", ")");
- }
- }
- break;
- case EOpLessThan: outputTriplet(visit, "(", " < ", ")"); break;
- case EOpGreaterThan: outputTriplet(visit, "(", " > ", ")"); break;
- case EOpLessThanEqual: outputTriplet(visit, "(", " <= ", ")"); break;
- case EOpGreaterThanEqual: outputTriplet(visit, "(", " >= ", ")"); break;
- case EOpVectorTimesScalar: outputTriplet(visit, "(", " * ", ")"); break;
- case EOpMatrixTimesScalar: outputTriplet(visit, "(", " * ", ")"); break;
- case EOpVectorTimesMatrix: outputTriplet(visit, "mul(", ", transpose(", "))"); break;
- case EOpMatrixTimesVector: outputTriplet(visit, "mul(transpose(", "), ", ")"); break;
- case EOpMatrixTimesMatrix: outputTriplet(visit, "transpose(mul(transpose(", "), transpose(", ")))"); break;
- case EOpLogicalOr:
- if (node->getRight()->hasSideEffects())
- {
- out << "s" << mUnfoldShortCircuit->getNextTemporaryIndex();
- return false;
- }
- else
- {
- outputTriplet(visit, "(", " || ", ")");
- return true;
- }
- case EOpLogicalXor:
- mUsesXor = true;
- outputTriplet(visit, "xor(", ", ", ")");
- break;
- case EOpLogicalAnd:
- if (node->getRight()->hasSideEffects())
- {
- out << "s" << mUnfoldShortCircuit->getNextTemporaryIndex();
- return false;
- }
- else
- {
- outputTriplet(visit, "(", " && ", ")");
- return true;
- }
- default: UNREACHABLE();
- }
-
- return true;
-}
-
-bool OutputHLSL::visitUnary(Visit visit, TIntermUnary *node)
-{
- switch (node->getOp())
- {
- case EOpNegative: outputTriplet(visit, "(-", "", ")"); break;
- case EOpVectorLogicalNot: outputTriplet(visit, "(!", "", ")"); break;
- case EOpLogicalNot: outputTriplet(visit, "(!", "", ")"); break;
- case EOpPostIncrement: outputTriplet(visit, "(", "", "++)"); break;
- case EOpPostDecrement: outputTriplet(visit, "(", "", "--)"); break;
- case EOpPreIncrement: outputTriplet(visit, "(++", "", ")"); break;
- case EOpPreDecrement: outputTriplet(visit, "(--", "", ")"); break;
- case EOpConvIntToBool:
- case EOpConvFloatToBool:
- switch (node->getOperand()->getType().getNominalSize())
- {
- case 1: outputTriplet(visit, "bool(", "", ")"); break;
- case 2: outputTriplet(visit, "bool2(", "", ")"); break;
- case 3: outputTriplet(visit, "bool3(", "", ")"); break;
- case 4: outputTriplet(visit, "bool4(", "", ")"); break;
- default: UNREACHABLE();
- }
- break;
- case EOpConvBoolToFloat:
- case EOpConvIntToFloat:
- switch (node->getOperand()->getType().getNominalSize())
- {
- case 1: outputTriplet(visit, "float(", "", ")"); break;
- case 2: outputTriplet(visit, "float2(", "", ")"); break;
- case 3: outputTriplet(visit, "float3(", "", ")"); break;
- case 4: outputTriplet(visit, "float4(", "", ")"); break;
- default: UNREACHABLE();
- }
- break;
- case EOpConvFloatToInt:
- case EOpConvBoolToInt:
- switch (node->getOperand()->getType().getNominalSize())
- {
- case 1: outputTriplet(visit, "int(", "", ")"); break;
- case 2: outputTriplet(visit, "int2(", "", ")"); break;
- case 3: outputTriplet(visit, "int3(", "", ")"); break;
- case 4: outputTriplet(visit, "int4(", "", ")"); break;
- default: UNREACHABLE();
- }
- break;
- case EOpRadians: outputTriplet(visit, "radians(", "", ")"); break;
- case EOpDegrees: outputTriplet(visit, "degrees(", "", ")"); break;
- case EOpSin: outputTriplet(visit, "sin(", "", ")"); break;
- case EOpCos: outputTriplet(visit, "cos(", "", ")"); break;
- case EOpTan: outputTriplet(visit, "tan(", "", ")"); break;
- case EOpAsin: outputTriplet(visit, "asin(", "", ")"); break;
- case EOpAcos: outputTriplet(visit, "acos(", "", ")"); break;
- case EOpAtan: outputTriplet(visit, "atan(", "", ")"); break;
- case EOpExp: outputTriplet(visit, "exp(", "", ")"); break;
- case EOpLog: outputTriplet(visit, "log(", "", ")"); break;
- case EOpExp2: outputTriplet(visit, "exp2(", "", ")"); break;
- case EOpLog2: outputTriplet(visit, "log2(", "", ")"); break;
- case EOpSqrt: outputTriplet(visit, "sqrt(", "", ")"); break;
- case EOpInverseSqrt: outputTriplet(visit, "rsqrt(", "", ")"); break;
- case EOpAbs: outputTriplet(visit, "abs(", "", ")"); break;
- case EOpSign: outputTriplet(visit, "sign(", "", ")"); break;
- case EOpFloor: outputTriplet(visit, "floor(", "", ")"); break;
- case EOpCeil: outputTriplet(visit, "ceil(", "", ")"); break;
- case EOpFract: outputTriplet(visit, "frac(", "", ")"); break;
- case EOpLength: outputTriplet(visit, "length(", "", ")"); break;
- case EOpNormalize: outputTriplet(visit, "normalize(", "", ")"); break;
- case EOpDFdx:
- if(mInsideDiscontinuousLoop || mOutputLod0Function)
- {
- outputTriplet(visit, "(", "", ", 0.0)");
- }
- else
- {
- outputTriplet(visit, "ddx(", "", ")");
- }
- break;
- case EOpDFdy:
- if(mInsideDiscontinuousLoop || mOutputLod0Function)
- {
- outputTriplet(visit, "(", "", ", 0.0)");
- }
- else
- {
- outputTriplet(visit, "ddy(", "", ")");
- }
- break;
- case EOpFwidth:
- if(mInsideDiscontinuousLoop || mOutputLod0Function)
- {
- outputTriplet(visit, "(", "", ", 0.0)");
- }
- else
- {
- outputTriplet(visit, "fwidth(", "", ")");
- }
- break;
- case EOpAny: outputTriplet(visit, "any(", "", ")"); break;
- case EOpAll: outputTriplet(visit, "all(", "", ")"); break;
- default: UNREACHABLE();
- }
-
- return true;
-}
-
-bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
-{
- TInfoSinkBase &out = mBody;
-
- switch (node->getOp())
- {
- case EOpSequence:
- {
- if (mInsideFunction)
- {
- outputLineDirective(node->getLine().first_line);
- out << "{\n";
-
- mScopeDepth++;
-
- if (mScopeBracket.size() < mScopeDepth)
- {
- mScopeBracket.push_back(0); // New scope level
- }
- else
- {
- mScopeBracket[mScopeDepth - 1]++; // New scope at existing level
- }
- }
-
- for (TIntermSequence::iterator sit = node->getSequence().begin(); sit != node->getSequence().end(); sit++)
- {
- outputLineDirective((*sit)->getLine().first_line);
-
- traverseStatements(*sit);
-
- out << ";\n";
- }
-
- if (mInsideFunction)
- {
- outputLineDirective(node->getLine().last_line);
- out << "}\n";
-
- mScopeDepth--;
- }
-
- return false;
- }
- case EOpDeclaration:
- if (visit == PreVisit)
- {
- TIntermSequence &sequence = node->getSequence();
- TIntermTyped *variable = sequence[0]->getAsTyped();
-
- if (variable && (variable->getQualifier() == EvqTemporary || variable->getQualifier() == EvqGlobal))
- {
- if (variable->getType().getStruct())
- {
- addConstructor(variable->getType(), scopedStruct(variable->getType().getStruct()->name()), NULL);
- }
-
- if (!variable->getAsSymbolNode() || variable->getAsSymbolNode()->getSymbol() != "") // Variable declaration
- {
- if (!mInsideFunction)
- {
- out << "static ";
- }
-
- out << typeString(variable->getType()) + " ";
-
- for (TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); sit++)
- {
- TIntermSymbol *symbol = (*sit)->getAsSymbolNode();
-
- if (symbol)
- {
- symbol->traverse(this);
- out << arrayString(symbol->getType());
- out << " = " + initializer(variable->getType());
- }
- else
- {
- (*sit)->traverse(this);
- }
-
- if (*sit != sequence.back())
- {
- out << ", ";
- }
- }
- }
- else if (variable->getAsSymbolNode() && variable->getAsSymbolNode()->getSymbol() == "") // Type (struct) declaration
- {
- // Already added to constructor map
- }
- else UNREACHABLE();
- }
- else if (variable && (variable->getQualifier() == EvqVaryingOut || variable->getQualifier() == EvqInvariantVaryingOut))
- {
- for (TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); sit++)
- {
- TIntermSymbol *symbol = (*sit)->getAsSymbolNode();
-
- if (symbol)
- {
- // Vertex (output) varyings which are declared but not written to should still be declared to allow successful linking
- mReferencedVaryings[symbol->getSymbol()] = symbol;
- }
- else
- {
- (*sit)->traverse(this);
- }
- }
- }
-
- return false;
- }
- else if (visit == InVisit)
- {
- out << ", ";
- }
- break;
- case EOpPrototype:
- if (visit == PreVisit)
- {
- out << typeString(node->getType()) << " " << decorate(node->getName()) << (mOutputLod0Function ? "Lod0(" : "(");
-
- TIntermSequence &arguments = node->getSequence();
-
- for (unsigned int i = 0; i < arguments.size(); i++)
- {
- TIntermSymbol *symbol = arguments[i]->getAsSymbolNode();
-
- if (symbol)
- {
- out << argumentString(symbol);
-
- if (i < arguments.size() - 1)
- {
- out << ", ";
- }
- }
- else UNREACHABLE();
- }
-
- out << ");\n";
-
- // Also prototype the Lod0 variant if needed
- if (mContainsLoopDiscontinuity && !mOutputLod0Function)
- {
- mOutputLod0Function = true;
- node->traverse(this);
- mOutputLod0Function = false;
- }
-
- return false;
- }
- break;
- case EOpComma: outputTriplet(visit, "(", ", ", ")"); break;
- case EOpFunction:
- {
- TString name = TFunction::unmangleName(node->getName());
-
- out << typeString(node->getType()) << " ";
-
- if (name == "main")
- {
- out << "gl_main(";
- }
- else
- {
- out << decorate(name) << (mOutputLod0Function ? "Lod0(" : "(");
- }
-
- TIntermSequence &sequence = node->getSequence();
- TIntermSequence &arguments = sequence[0]->getAsAggregate()->getSequence();
-
- for (unsigned int i = 0; i < arguments.size(); i++)
- {
- TIntermSymbol *symbol = arguments[i]->getAsSymbolNode();
-
- if (symbol)
- {
- if (symbol->getType().getStruct())
- {
- addConstructor(symbol->getType(), scopedStruct(symbol->getType().getStruct()->name()), NULL);
- }
-
- out << argumentString(symbol);
-
- if (i < arguments.size() - 1)
- {
- out << ", ";
- }
- }
- else UNREACHABLE();
- }
-
- out << ")\n"
- "{\n";
-
- if (sequence.size() > 1)
- {
- mInsideFunction = true;
- sequence[1]->traverse(this);
- mInsideFunction = false;
- }
-
- out << "}\n";
-
- if (mContainsLoopDiscontinuity && !mOutputLod0Function)
- {
- if (name != "main")
- {
- mOutputLod0Function = true;
- node->traverse(this);
- mOutputLod0Function = false;
- }
- }
-
- return false;
- }
- break;
- case EOpFunctionCall:
- {
- TString name = TFunction::unmangleName(node->getName());
- bool lod0 = mInsideDiscontinuousLoop || mOutputLod0Function;
-
- if (node->isUserDefined())
- {
- out << decorate(name) << (lod0 ? "Lod0(" : "(");
- }
- else
- {
- if (name == "texture2D")
- {
- if (!lod0)
- {
- if (node->getSequence().size() == 2)
- {
- mUsesTexture2D = true;
- }
- else if (node->getSequence().size() == 3)
- {
- mUsesTexture2D_bias = true;
- }
- else UNREACHABLE();
-
- out << "gl_texture2D(";
- }
- else
- {
- if (node->getSequence().size() == 2)
- {
- mUsesTexture2DLod0 = true;
- }
- else if (node->getSequence().size() == 3)
- {
- mUsesTexture2DLod0_bias = true;
- }
- else UNREACHABLE();
-
- out << "gl_texture2DLod0(";
- }
- }
- else if (name == "texture2DProj")
- {
- if (!lod0)
- {
- if (node->getSequence().size() == 2)
- {
- mUsesTexture2DProj = true;
- }
- else if (node->getSequence().size() == 3)
- {
- mUsesTexture2DProj_bias = true;
- }
- else UNREACHABLE();
-
- out << "gl_texture2DProj(";
- }
- else
- {
- if (node->getSequence().size() == 2)
- {
- mUsesTexture2DProjLod0 = true;
- }
- else if (node->getSequence().size() == 3)
- {
- mUsesTexture2DProjLod0_bias = true;
- }
- else UNREACHABLE();
-
- out << "gl_texture2DProjLod0(";
- }
- }
- else if (name == "textureCube")
- {
- if (!lod0)
- {
- if (node->getSequence().size() == 2)
- {
- mUsesTextureCube = true;
- }
- else if (node->getSequence().size() == 3)
- {
- mUsesTextureCube_bias = true;
- }
- else UNREACHABLE();
-
- out << "gl_textureCube(";
- }
- else
- {
- if (node->getSequence().size() == 2)
- {
- mUsesTextureCubeLod0 = true;
- }
- else if (node->getSequence().size() == 3)
- {
- mUsesTextureCubeLod0_bias = true;
- }
- else UNREACHABLE();
-
- out << "gl_textureCubeLod0(";
- }
- }
- else if (name == "texture2DLod")
- {
- if (node->getSequence().size() == 3)
- {
- mUsesTexture2DLod = true;
- }
- else UNREACHABLE();
-
- out << "gl_texture2DLod(";
- }
- else if (name == "texture2DProjLod")
- {
- if (node->getSequence().size() == 3)
- {
- mUsesTexture2DProjLod = true;
- }
- else UNREACHABLE();
-
- out << "gl_texture2DProjLod(";
- }
- else if (name == "textureCubeLod")
- {
- if (node->getSequence().size() == 3)
- {
- mUsesTextureCubeLod = true;
- }
- else UNREACHABLE();
-
- out << "gl_textureCubeLod(";
- }
- else UNREACHABLE();
- }
-
- TIntermSequence &arguments = node->getSequence();
-
- for (TIntermSequence::iterator arg = arguments.begin(); arg != arguments.end(); arg++)
- {
- if (mOutputType == SH_HLSL11_OUTPUT && IsSampler((*arg)->getAsTyped()->getBasicType()))
- {
- out << "texture_";
- (*arg)->traverse(this);
- out << ", sampler_";
- }
-
- (*arg)->traverse(this);
-
- if (arg < arguments.end() - 1)
- {
- out << ", ";
- }
- }
-
- out << ")";
-
- return false;
- }
- break;
- case EOpParameters: outputTriplet(visit, "(", ", ", ")\n{\n"); break;
- case EOpConstructFloat:
- addConstructor(node->getType(), "vec1", &node->getSequence());
- outputTriplet(visit, "vec1(", "", ")");
- break;
- case EOpConstructVec2:
- addConstructor(node->getType(), "vec2", &node->getSequence());
- outputTriplet(visit, "vec2(", ", ", ")");
- break;
- case EOpConstructVec3:
- addConstructor(node->getType(), "vec3", &node->getSequence());
- outputTriplet(visit, "vec3(", ", ", ")");
- break;
- case EOpConstructVec4:
- addConstructor(node->getType(), "vec4", &node->getSequence());
- outputTriplet(visit, "vec4(", ", ", ")");
- break;
- case EOpConstructBool:
- addConstructor(node->getType(), "bvec1", &node->getSequence());
- outputTriplet(visit, "bvec1(", "", ")");
- break;
- case EOpConstructBVec2:
- addConstructor(node->getType(), "bvec2", &node->getSequence());
- outputTriplet(visit, "bvec2(", ", ", ")");
- break;
- case EOpConstructBVec3:
- addConstructor(node->getType(), "bvec3", &node->getSequence());
- outputTriplet(visit, "bvec3(", ", ", ")");
- break;
- case EOpConstructBVec4:
- addConstructor(node->getType(), "bvec4", &node->getSequence());
- outputTriplet(visit, "bvec4(", ", ", ")");
- break;
- case EOpConstructInt:
- addConstructor(node->getType(), "ivec1", &node->getSequence());
- outputTriplet(visit, "ivec1(", "", ")");
- break;
- case EOpConstructIVec2:
- addConstructor(node->getType(), "ivec2", &node->getSequence());
- outputTriplet(visit, "ivec2(", ", ", ")");
- break;
- case EOpConstructIVec3:
- addConstructor(node->getType(), "ivec3", &node->getSequence());
- outputTriplet(visit, "ivec3(", ", ", ")");
- break;
- case EOpConstructIVec4:
- addConstructor(node->getType(), "ivec4", &node->getSequence());
- outputTriplet(visit, "ivec4(", ", ", ")");
- break;
- case EOpConstructMat2:
- addConstructor(node->getType(), "mat2", &node->getSequence());
- outputTriplet(visit, "mat2(", ", ", ")");
- break;
- case EOpConstructMat3:
- addConstructor(node->getType(), "mat3", &node->getSequence());
- outputTriplet(visit, "mat3(", ", ", ")");
- break;
- case EOpConstructMat4:
- addConstructor(node->getType(), "mat4", &node->getSequence());
- outputTriplet(visit, "mat4(", ", ", ")");
- break;
- case EOpConstructStruct:
- addConstructor(node->getType(), scopedStruct(node->getType().getStruct()->name()), &node->getSequence());
- outputTriplet(visit, structLookup(node->getType().getStruct()->name()) + "_ctor(", ", ", ")");
- break;
- case EOpLessThan: outputTriplet(visit, "(", " < ", ")"); break;
- case EOpGreaterThan: outputTriplet(visit, "(", " > ", ")"); break;
- case EOpLessThanEqual: outputTriplet(visit, "(", " <= ", ")"); break;
- case EOpGreaterThanEqual: outputTriplet(visit, "(", " >= ", ")"); break;
- case EOpVectorEqual: outputTriplet(visit, "(", " == ", ")"); break;
- case EOpVectorNotEqual: outputTriplet(visit, "(", " != ", ")"); break;
- case EOpMod:
- {
- // We need to look at the number of components in both arguments
- switch (node->getSequence()[0]->getAsTyped()->getNominalSize() * 10
- + node->getSequence()[1]->getAsTyped()->getNominalSize())
- {
- case 11: mUsesMod1 = true; break;
- case 22: mUsesMod2v = true; break;
- case 21: mUsesMod2f = true; break;
- case 33: mUsesMod3v = true; break;
- case 31: mUsesMod3f = true; break;
- case 44: mUsesMod4v = true; break;
- case 41: mUsesMod4f = true; break;
- default: UNREACHABLE();
- }
-
- outputTriplet(visit, "mod(", ", ", ")");
- }
- break;
- case EOpPow: outputTriplet(visit, "pow(", ", ", ")"); break;
- case EOpAtan:
- ASSERT(node->getSequence().size() == 2); // atan(x) is a unary operator
- switch (node->getSequence()[0]->getAsTyped()->getNominalSize())
- {
- case 1: mUsesAtan2_1 = true; break;
- case 2: mUsesAtan2_2 = true; break;
- case 3: mUsesAtan2_3 = true; break;
- case 4: mUsesAtan2_4 = true; break;
- default: UNREACHABLE();
- }
- outputTriplet(visit, "atanyx(", ", ", ")");
- break;
- case EOpMin: outputTriplet(visit, "min(", ", ", ")"); break;
- case EOpMax: outputTriplet(visit, "max(", ", ", ")"); break;
- case EOpClamp: outputTriplet(visit, "clamp(", ", ", ")"); break;
- case EOpMix: outputTriplet(visit, "lerp(", ", ", ")"); break;
- case EOpStep: outputTriplet(visit, "step(", ", ", ")"); break;
- case EOpSmoothStep: outputTriplet(visit, "smoothstep(", ", ", ")"); break;
- case EOpDistance: outputTriplet(visit, "distance(", ", ", ")"); break;
- case EOpDot: outputTriplet(visit, "dot(", ", ", ")"); break;
- case EOpCross: outputTriplet(visit, "cross(", ", ", ")"); break;
- case EOpFaceForward:
- {
- switch (node->getSequence()[0]->getAsTyped()->getNominalSize()) // Number of components in the first argument
- {
- case 1: mUsesFaceforward1 = true; break;
- case 2: mUsesFaceforward2 = true; break;
- case 3: mUsesFaceforward3 = true; break;
- case 4: mUsesFaceforward4 = true; break;
- default: UNREACHABLE();
- }
-
- outputTriplet(visit, "faceforward(", ", ", ")");
- }
- break;
- case EOpReflect: outputTriplet(visit, "reflect(", ", ", ")"); break;
- case EOpRefract: outputTriplet(visit, "refract(", ", ", ")"); break;
- case EOpMul: outputTriplet(visit, "(", " * ", ")"); break;
- default: UNREACHABLE();
- }
-
- return true;
-}
-
-bool OutputHLSL::visitSelection(Visit visit, TIntermSelection *node)
-{
- TInfoSinkBase &out = mBody;
-
- if (node->usesTernaryOperator())
- {
- out << "s" << mUnfoldShortCircuit->getNextTemporaryIndex();
- }
- else // if/else statement
- {
- mUnfoldShortCircuit->traverse(node->getCondition());
-
- out << "if (";
-
- node->getCondition()->traverse(this);
-
- out << ")\n";
-
- outputLineDirective(node->getLine().first_line);
- out << "{\n";
-
- bool discard = false;
-
- if (node->getTrueBlock())
- {
- traverseStatements(node->getTrueBlock());
-
- // Detect true discard
- discard = (discard || FindDiscard::search(node->getTrueBlock()));
- }
-
- outputLineDirective(node->getLine().first_line);
- out << ";\n}\n";
-
- if (node->getFalseBlock())
- {
- out << "else\n";
-
- outputLineDirective(node->getFalseBlock()->getLine().first_line);
- out << "{\n";
-
- outputLineDirective(node->getFalseBlock()->getLine().first_line);
- traverseStatements(node->getFalseBlock());
-
- outputLineDirective(node->getFalseBlock()->getLine().first_line);
- out << ";\n}\n";
-
- // Detect false discard
- discard = (discard || FindDiscard::search(node->getFalseBlock()));
- }
-
- // ANGLE issue 486: Detect problematic conditional discard
- if (discard && FindSideEffectRewriting::search(node))
- {
- mUsesDiscardRewriting = true;
- }
- }
-
- return false;
-}
-
-void OutputHLSL::visitConstantUnion(TIntermConstantUnion *node)
-{
- writeConstantUnion(node->getType(), node->getUnionArrayPointer());
-}
-
-bool OutputHLSL::visitLoop(Visit visit, TIntermLoop *node)
-{
- bool wasDiscontinuous = mInsideDiscontinuousLoop;
-
- if (mContainsLoopDiscontinuity && !mInsideDiscontinuousLoop)
- {
- mInsideDiscontinuousLoop = containsLoopDiscontinuity(node);
- }
-
- if (mOutputType == SH_HLSL9_OUTPUT)
- {
- if (handleExcessiveLoop(node))
- {
- return false;
- }
- }
-
- TInfoSinkBase &out = mBody;
-
- if (node->getType() == ELoopDoWhile)
- {
- out << "{do\n";
-
- outputLineDirective(node->getLine().first_line);
- out << "{\n";
- }
- else
- {
- out << "{for(";
-
- if (node->getInit())
- {
- node->getInit()->traverse(this);
- }
-
- out << "; ";
-
- if (node->getCondition())
- {
- node->getCondition()->traverse(this);
- }
-
- out << "; ";
-
- if (node->getExpression())
- {
- node->getExpression()->traverse(this);
- }
-
- out << ")\n";
-
- outputLineDirective(node->getLine().first_line);
- out << "{\n";
- }
-
- if (node->getBody())
- {
- traverseStatements(node->getBody());
- }
-
- outputLineDirective(node->getLine().first_line);
- out << ";}\n";
-
- if (node->getType() == ELoopDoWhile)
- {
- outputLineDirective(node->getCondition()->getLine().first_line);
- out << "while(\n";
-
- node->getCondition()->traverse(this);
-
- out << ");";
- }
-
- out << "}\n";
-
- mInsideDiscontinuousLoop = wasDiscontinuous;
-
- return false;
-}
-
-bool OutputHLSL::visitBranch(Visit visit, TIntermBranch *node)
-{
- TInfoSinkBase &out = mBody;
-
- switch (node->getFlowOp())
- {
- case EOpKill:
- outputTriplet(visit, "discard;\n", "", "");
- break;
- case EOpBreak:
- if (visit == PreVisit)
- {
- if (mExcessiveLoopIndex)
- {
- out << "{Break";
- mExcessiveLoopIndex->traverse(this);
- out << " = true; break;}\n";
- }
- else
- {
- out << "break;\n";
- }
- }
- break;
- case EOpContinue: outputTriplet(visit, "continue;\n", "", ""); break;
- case EOpReturn:
- if (visit == PreVisit)
- {
- if (node->getExpression())
- {
- out << "return ";
- }
- else
- {
- out << "return;\n";
- }
- }
- else if (visit == PostVisit)
- {
- if (node->getExpression())
- {
- out << ";\n";
- }
- }
- break;
- default: UNREACHABLE();
- }
-
- return true;
-}
-
-void OutputHLSL::traverseStatements(TIntermNode *node)
-{
- if (isSingleStatement(node))
- {
- mUnfoldShortCircuit->traverse(node);
- }
-
- node->traverse(this);
-}
-
-bool OutputHLSL::isSingleStatement(TIntermNode *node)
-{
- TIntermAggregate *aggregate = node->getAsAggregate();
-
- if (aggregate)
- {
- if (aggregate->getOp() == EOpSequence)
- {
- return false;
- }
- else
- {
- for (TIntermSequence::iterator sit = aggregate->getSequence().begin(); sit != aggregate->getSequence().end(); sit++)
- {
- if (!isSingleStatement(*sit))
- {
- return false;
- }
- }
-
- return true;
- }
- }
-
- return true;
-}
-
-// Handle loops with more than 254 iterations (unsupported by D3D9) by splitting them
-// (The D3D documentation says 255 iterations, but the compiler complains at anything more than 254).
-bool OutputHLSL::handleExcessiveLoop(TIntermLoop *node)
-{
- const int MAX_LOOP_ITERATIONS = 254;
- TInfoSinkBase &out = mBody;
-
- // Parse loops of the form:
- // for(int index = initial; index [comparator] limit; index += increment)
- TIntermSymbol *index = NULL;
- TOperator comparator = EOpNull;
- int initial = 0;
- int limit = 0;
- int increment = 0;
-
- // Parse index name and intial value
- if (node->getInit())
- {
- TIntermAggregate *init = node->getInit()->getAsAggregate();
-
- if (init)
- {
- TIntermSequence &sequence = init->getSequence();
- TIntermTyped *variable = sequence[0]->getAsTyped();
-
- if (variable && variable->getQualifier() == EvqTemporary)
- {
- TIntermBinary *assign = variable->getAsBinaryNode();
-
- if (assign->getOp() == EOpInitialize)
- {
- TIntermSymbol *symbol = assign->getLeft()->getAsSymbolNode();
- TIntermConstantUnion *constant = assign->getRight()->getAsConstantUnion();
-
- if (symbol && constant)
- {
- if (constant->getBasicType() == EbtInt && constant->getNominalSize() == 1)
- {
- index = symbol;
- initial = constant->getIConst(0);
- }
- }
- }
- }
- }
- }
-
- // Parse comparator and limit value
- if (index != NULL && node->getCondition())
- {
- TIntermBinary *test = node->getCondition()->getAsBinaryNode();
-
- if (test && test->getLeft()->getAsSymbolNode()->getId() == index->getId())
- {
- TIntermConstantUnion *constant = test->getRight()->getAsConstantUnion();
-
- if (constant)
- {
- if (constant->getBasicType() == EbtInt && constant->getNominalSize() == 1)
- {
- comparator = test->getOp();
- limit = constant->getIConst(0);
- }
- }
- }
- }
-
- // Parse increment
- if (index != NULL && comparator != EOpNull && node->getExpression())
- {
- TIntermBinary *binaryTerminal = node->getExpression()->getAsBinaryNode();
- TIntermUnary *unaryTerminal = node->getExpression()->getAsUnaryNode();
-
- if (binaryTerminal)
- {
- TOperator op = binaryTerminal->getOp();
- TIntermConstantUnion *constant = binaryTerminal->getRight()->getAsConstantUnion();
-
- if (constant)
- {
- if (constant->getBasicType() == EbtInt && constant->getNominalSize() == 1)
- {
- int value = constant->getIConst(0);
-
- switch (op)
- {
- case EOpAddAssign: increment = value; break;
- case EOpSubAssign: increment = -value; break;
- default: UNIMPLEMENTED();
- }
- }
- }
- }
- else if (unaryTerminal)
- {
- TOperator op = unaryTerminal->getOp();
-
- switch (op)
- {
- case EOpPostIncrement: increment = 1; break;
- case EOpPostDecrement: increment = -1; break;
- case EOpPreIncrement: increment = 1; break;
- case EOpPreDecrement: increment = -1; break;
- default: UNIMPLEMENTED();
- }
- }
- }
-
- if (index != NULL && comparator != EOpNull && increment != 0)
- {
- if (comparator == EOpLessThanEqual)
- {
- comparator = EOpLessThan;
- limit += 1;
- }
-
- if (comparator == EOpLessThan)
- {
- int iterations = (limit - initial) / increment;
-
- if (iterations <= MAX_LOOP_ITERATIONS)
- {
- return false; // Not an excessive loop
- }
-
- TIntermSymbol *restoreIndex = mExcessiveLoopIndex;
- mExcessiveLoopIndex = index;
-
- out << "{int ";
- index->traverse(this);
- out << ";\n"
- "bool Break";
- index->traverse(this);
- out << " = false;\n";
-
- bool firstLoopFragment = true;
-
- while (iterations > 0)
- {
- int clampedLimit = initial + increment * std::min(MAX_LOOP_ITERATIONS, iterations);
-
- if (!firstLoopFragment)
- {
- out << "if (!Break";
- index->traverse(this);
- out << ") {\n";
- }
-
- if (iterations <= MAX_LOOP_ITERATIONS) // Last loop fragment
- {
- mExcessiveLoopIndex = NULL; // Stops setting the Break flag
- }
-
- // for(int index = initial; index < clampedLimit; index += increment)
-
- out << "for(";
- index->traverse(this);
- out << " = ";
- out << initial;
-
- out << "; ";
- index->traverse(this);
- out << " < ";
- out << clampedLimit;
-
- out << "; ";
- index->traverse(this);
- out << " += ";
- out << increment;
- out << ")\n";
-
- outputLineDirective(node->getLine().first_line);
- out << "{\n";
-
- if (node->getBody())
- {
- node->getBody()->traverse(this);
- }
-
- outputLineDirective(node->getLine().first_line);
- out << ";}\n";
-
- if (!firstLoopFragment)
- {
- out << "}\n";
- }
-
- firstLoopFragment = false;
-
- initial += MAX_LOOP_ITERATIONS * increment;
- iterations -= MAX_LOOP_ITERATIONS;
- }
-
- out << "}";
-
- mExcessiveLoopIndex = restoreIndex;
-
- return true;
- }
- else UNIMPLEMENTED();
- }
-
- return false; // Not handled as an excessive loop
-}
-
-void OutputHLSL::outputTriplet(Visit visit, const TString &preString, const TString &inString, const TString &postString)
-{
- TInfoSinkBase &out = mBody;
-
- if (visit == PreVisit)
- {
- out << preString;
- }
- else if (visit == InVisit)
- {
- out << inString;
- }
- else if (visit == PostVisit)
- {
- out << postString;
- }
-}
-
-void OutputHLSL::outputLineDirective(int line)
-{
- if ((mContext.compileOptions & SH_LINE_DIRECTIVES) && (line > 0))
- {
- mBody << "\n";
- mBody << "#line " << line;
-
- if (mContext.sourcePath)
- {
- mBody << " \"" << mContext.sourcePath << "\"";
- }
-
- mBody << "\n";
- }
-}
-
-TString OutputHLSL::argumentString(const TIntermSymbol *symbol)
-{
- TQualifier qualifier = symbol->getQualifier();
- const TType &type = symbol->getType();
- TString name = symbol->getSymbol();
-
- if (name.empty()) // HLSL demands named arguments, also for prototypes
- {
- name = "x" + str(mUniqueIndex++);
- }
- else
- {
- name = decorate(name);
- }
-
- if (mOutputType == SH_HLSL11_OUTPUT && IsSampler(type.getBasicType()))
- {
- return qualifierString(qualifier) + " " + textureString(type) + " texture_" + name + arrayString(type) + ", " +
- qualifierString(qualifier) + " SamplerState sampler_" + name + arrayString(type);
- }
-
- return qualifierString(qualifier) + " " + typeString(type) + " " + name + arrayString(type);
-}
-
-TString OutputHLSL::qualifierString(TQualifier qualifier)
-{
- switch(qualifier)
- {
- case EvqIn: return "in";
- case EvqOut: return "out";
- case EvqInOut: return "inout";
- case EvqConstReadOnly: return "const";
- default: UNREACHABLE();
- }
-
- return "";
-}
-
-TString OutputHLSL::typeString(const TType &type)
-{
- if (type.getBasicType() == EbtStruct)
- {
- const TString& typeName = type.getStruct()->name();
- if (typeName != "")
- {
- return structLookup(typeName);
- }
- else // Nameless structure, define in place
- {
- const TFieldList &fields = type.getStruct()->fields();
-
- TString string = "struct\n"
- "{\n";
-
- for (unsigned int i = 0; i < fields.size(); i++)
- {
- const TField *field = fields[i];
-
- string += " " + typeString(*field->type()) + " " + decorate(field->name()) + arrayString(*field->type()) + ";\n";
- }
-
- string += "} ";
-
- return string;
- }
- }
- else if (type.isMatrix())
- {
- switch (type.getNominalSize())
- {
- case 2: return "float2x2";
- case 3: return "float3x3";
- case 4: return "float4x4";
- }
- }
- else
- {
- switch (type.getBasicType())
- {
- case EbtFloat:
- switch (type.getNominalSize())
- {
- case 1: return "float";
- case 2: return "float2";
- case 3: return "float3";
- case 4: return "float4";
- }
- case EbtInt:
- switch (type.getNominalSize())
- {
- case 1: return "int";
- case 2: return "int2";
- case 3: return "int3";
- case 4: return "int4";
- }
- case EbtBool:
- switch (type.getNominalSize())
- {
- case 1: return "bool";
- case 2: return "bool2";
- case 3: return "bool3";
- case 4: return "bool4";
- }
- case EbtVoid:
- return "void";
- case EbtSampler2D:
- return "sampler2D";
- case EbtSamplerCube:
- return "samplerCUBE";
- case EbtSamplerExternalOES:
- return "sampler2D";
- default:
- break;
- }
- }
-
- UNREACHABLE();
- return "<unknown type>";
-}
-
-TString OutputHLSL::textureString(const TType &type)
-{
- switch (type.getBasicType())
- {
- case EbtSampler2D:
- return "Texture2D";
- case EbtSamplerCube:
- return "TextureCube";
- case EbtSamplerExternalOES:
- return "Texture2D";
- default:
- break;
- }
-
- UNREACHABLE();
- return "<unknown texture type>";
-}
-
-TString OutputHLSL::arrayString(const TType &type)
-{
- if (!type.isArray())
- {
- return "";
- }
-
- return "[" + str(type.getArraySize()) + "]";
-}
-
-TString OutputHLSL::initializer(const TType &type)
-{
- TString string;
-
- size_t size = type.getObjectSize();
- for (size_t component = 0; component < size; component++)
- {
- string += "0";
-
- if (component + 1 < size)
- {
- string += ", ";
- }
- }
-
- return "{" + string + "}";
-}
-
-void OutputHLSL::addConstructor(const TType &type, const TString &name, const TIntermSequence *parameters)
-{
- if (name == "")
- {
- return; // Nameless structures don't have constructors
- }
-
- if (type.getStruct() && mStructNames.find(decorate(name)) != mStructNames.end())
- {
- return; // Already added
- }
-
- TType ctorType = type;
- ctorType.clearArrayness();
- ctorType.setPrecision(EbpHigh);
- ctorType.setQualifier(EvqTemporary);
-
- TString ctorName = type.getStruct() ? decorate(name) : name;
-
- typedef std::vector<TType> ParameterArray;
- ParameterArray ctorParameters;
-
- if (type.getStruct())
- {
- mStructNames.insert(decorate(name));
-
- TString structure;
- structure += "struct " + decorate(name) + "\n"
- "{\n";
-
- const TFieldList &fields = type.getStruct()->fields();
-
- for (unsigned int i = 0; i < fields.size(); i++)
- {
- const TField *field = fields[i];
-
- structure += " " + typeString(*field->type()) + " " + decorateField(field->name(), type) + arrayString(*field->type()) + ";\n";
- }
-
- structure += "};\n";
-
- if (std::find(mStructDeclarations.begin(), mStructDeclarations.end(), structure) == mStructDeclarations.end())
- {
- mStructDeclarations.push_back(structure);
- }
-
- for (unsigned int i = 0; i < fields.size(); i++)
- {
- ctorParameters.push_back(*fields[i]->type());
- }
- }
- else if (parameters)
- {
- for (TIntermSequence::const_iterator parameter = parameters->begin(); parameter != parameters->end(); parameter++)
- {
- ctorParameters.push_back((*parameter)->getAsTyped()->getType());
- }
- }
- else UNREACHABLE();
-
- TString constructor;
-
- if (ctorType.getStruct())
- {
- constructor += ctorName + " " + ctorName + "_ctor(";
- }
- else // Built-in type
- {
- constructor += typeString(ctorType) + " " + ctorName + "(";
- }
-
- for (unsigned int parameter = 0; parameter < ctorParameters.size(); parameter++)
- {
- const TType &type = ctorParameters[parameter];
-
- constructor += typeString(type) + " x" + str(parameter) + arrayString(type);
-
- if (parameter < ctorParameters.size() - 1)
- {
- constructor += ", ";
- }
- }
-
- constructor += ")\n"
- "{\n";
-
- if (ctorType.getStruct())
- {
- constructor += " " + ctorName + " structure = {";
- }
- else
- {
- constructor += " return " + typeString(ctorType) + "(";
- }
-
- if (ctorType.isMatrix() && ctorParameters.size() == 1)
- {
- int dim = ctorType.getNominalSize();
- const TType &parameter = ctorParameters[0];
-
- if (parameter.isScalar())
- {
- for (int row = 0; row < dim; row++)
- {
- for (int col = 0; col < dim; col++)
- {
- constructor += TString((row == col) ? "x0" : "0.0");
-
- if (row < dim - 1 || col < dim - 1)
- {
- constructor += ", ";
- }
- }
- }
- }
- else if (parameter.isMatrix())
- {
- for (int row = 0; row < dim; row++)
- {
- for (int col = 0; col < dim; col++)
- {
- if (row < parameter.getNominalSize() && col < parameter.getNominalSize())
- {
- constructor += TString("x0") + "[" + str(row) + "]" + "[" + str(col) + "]";
- }
- else
- {
- constructor += TString((row == col) ? "1.0" : "0.0");
- }
-
- if (row < dim - 1 || col < dim - 1)
- {
- constructor += ", ";
- }
- }
- }
- }
- else UNREACHABLE();
- }
- else
- {
- size_t remainingComponents = ctorType.getObjectSize();
- size_t parameterIndex = 0;
-
- while (remainingComponents > 0)
- {
- const TType &parameter = ctorParameters[parameterIndex];
- const size_t parameterSize = parameter.getObjectSize();
- bool moreParameters = parameterIndex + 1 < ctorParameters.size();
-
- constructor += "x" + str(parameterIndex);
-
- if (parameter.isScalar())
- {
- ASSERT(parameterSize <= remainingComponents);
- remainingComponents -= parameterSize;
- }
- else if (parameter.isVector())
- {
- if (remainingComponents == parameterSize || moreParameters)
- {
- ASSERT(parameterSize <= remainingComponents);
- remainingComponents -= parameterSize;
- }
- else if (remainingComponents < static_cast<size_t>(parameter.getNominalSize()))
- {
- switch (remainingComponents)
- {
- case 1: constructor += ".x"; break;
- case 2: constructor += ".xy"; break;
- case 3: constructor += ".xyz"; break;
- case 4: constructor += ".xyzw"; break;
- default: UNREACHABLE();
- }
-
- remainingComponents = 0;
- }
- else UNREACHABLE();
- }
- else if (parameter.isMatrix() || parameter.getStruct())
- {
- ASSERT(remainingComponents == parameterSize || moreParameters);
- ASSERT(parameterSize <= remainingComponents);
-
- remainingComponents -= parameterSize;
- }
- else UNREACHABLE();
-
- if (moreParameters)
- {
- parameterIndex++;
- }
-
- if (remainingComponents)
- {
- constructor += ", ";
- }
- }
- }
-
- if (ctorType.getStruct())
- {
- constructor += "};\n"
- " return structure;\n"
- "}\n";
- }
- else
- {
- constructor += ");\n"
- "}\n";
- }
-
- mConstructors.insert(constructor);
-}
-
-const ConstantUnion *OutputHLSL::writeConstantUnion(const TType &type, const ConstantUnion *constUnion)
-{
- TInfoSinkBase &out = mBody;
-
- if (type.getBasicType() == EbtStruct)
- {
- out << structLookup(type.getStruct()->name()) + "_ctor(";
-
- const TFieldList &fields = type.getStruct()->fields();
-
- for (size_t i = 0; i < fields.size(); i++)
- {
- const TType *fieldType = fields[i]->type();
-
- constUnion = writeConstantUnion(*fieldType, constUnion);
-
- if (i != fields.size() - 1)
- {
- out << ", ";
- }
- }
-
- out << ")";
- }
- else
- {
- size_t size = type.getObjectSize();
- bool writeType = size > 1;
-
- if (writeType)
- {
- out << typeString(type) << "(";
- }
-
- for (size_t i = 0; i < size; i++, constUnion++)
- {
- switch (constUnion->getType())
- {
- case EbtFloat: out << std::min(FLT_MAX, std::max(-FLT_MAX, constUnion->getFConst())); break;
- case EbtInt: out << constUnion->getIConst(); break;
- case EbtBool: out << constUnion->getBConst(); break;
- default: UNREACHABLE();
- }
-
- if (i != size - 1)
- {
- out << ", ";
- }
- }
-
- if (writeType)
- {
- out << ")";
- }
- }
-
- return constUnion;
-}
-
-TString OutputHLSL::scopeString(unsigned int depthLimit)
-{
- TString string;
-
- for (unsigned int i = 0; i < mScopeBracket.size() && i < depthLimit; i++)
- {
- string += "_" + str(i);
- }
-
- return string;
-}
-
-TString OutputHLSL::scopedStruct(const TString &typeName)
-{
- if (typeName == "")
- {
- return typeName;
- }
-
- return typeName + scopeString(mScopeDepth);
-}
-
-TString OutputHLSL::structLookup(const TString &typeName)
-{
- for (int depth = mScopeDepth; depth >= 0; depth--)
- {
- TString scopedName = decorate(typeName + scopeString(depth));
-
- for (StructNames::iterator structName = mStructNames.begin(); structName != mStructNames.end(); structName++)
- {
- if (*structName == scopedName)
- {
- return scopedName;
- }
- }
- }
-
- UNREACHABLE(); // Should have found a matching constructor
-
- return typeName;
-}
-
-TString OutputHLSL::decorate(const TString &string)
-{
- if (string.compare(0, 3, "gl_") != 0 && string.compare(0, 3, "dx_") != 0)
- {
- return "_" + string;
- }
-
- return string;
-}
-
-TString OutputHLSL::decorateUniform(const TString &string, const TType &type)
-{
- if (type.getBasicType() == EbtSamplerExternalOES)
- {
- return "ex_" + string;
- }
-
- return decorate(string);
-}
-
-TString OutputHLSL::decorateField(const TString &string, const TType &structure)
-{
- if (structure.getStruct()->name().compare(0, 3, "gl_") != 0)
- {
- return decorate(string);
- }
-
- return string;
-}
-
-TString OutputHLSL::registerString(TIntermSymbol *operand)
-{
- ASSERT(operand->getQualifier() == EvqUniform);
-
- if (IsSampler(operand->getBasicType()))
- {
- return "s" + str(samplerRegister(operand));
- }
-
- return "c" + str(uniformRegister(operand));
-}
-
-int OutputHLSL::samplerRegister(TIntermSymbol *sampler)
-{
- const TType &type = sampler->getType();
- ASSERT(IsSampler(type.getBasicType()));
-
- int index = mSamplerRegister;
- mSamplerRegister += sampler->totalRegisterCount();
-
- declareUniform(type, sampler->getSymbol(), index);
-
- return index;
-}
-
-int OutputHLSL::uniformRegister(TIntermSymbol *uniform)
-{
- const TType &type = uniform->getType();
- ASSERT(!IsSampler(type.getBasicType()));
-
- int index = mUniformRegister;
- mUniformRegister += uniform->totalRegisterCount();
-
- declareUniform(type, uniform->getSymbol(), index);
-
- return index;
-}
-
-void OutputHLSL::declareUniform(const TType &type, const TString &name, int index)
-{
- TStructure *structure = type.getStruct();
-
- if (!structure)
- {
- mActiveUniforms.push_back(Uniform(glVariableType(type), glVariablePrecision(type), name.c_str(), type.getArraySize(), index));
- }
- else
- {
- const TFieldList &fields = structure->fields();
-
- if (type.isArray())
- {
- int elementIndex = index;
-
- for (int i = 0; i < type.getArraySize(); i++)
- {
- for (size_t j = 0; j < fields.size(); j++)
- {
- const TType &fieldType = *fields[j]->type();
- const TString uniformName = name + "[" + str(i) + "]." + fields[j]->name();
- declareUniform(fieldType, uniformName, elementIndex);
- elementIndex += fieldType.totalRegisterCount();
- }
- }
- }
- else
- {
- int fieldIndex = index;
-
- for (size_t i = 0; i < fields.size(); i++)
- {
- const TType &fieldType = *fields[i]->type();
- const TString uniformName = name + "." + fields[i]->name();
- declareUniform(fieldType, uniformName, fieldIndex);
- fieldIndex += fieldType.totalRegisterCount();
- }
- }
- }
-}
-
-GLenum OutputHLSL::glVariableType(const TType &type)
-{
- if (type.getBasicType() == EbtFloat)
- {
- if (type.isScalar())
- {
- return GL_FLOAT;
- }
- else if (type.isVector())
- {
- switch(type.getNominalSize())
- {
- case 2: return GL_FLOAT_VEC2;
- case 3: return GL_FLOAT_VEC3;
- case 4: return GL_FLOAT_VEC4;
- default: UNREACHABLE();
- }
- }
- else if (type.isMatrix())
- {
- switch(type.getNominalSize())
- {
- case 2: return GL_FLOAT_MAT2;
- case 3: return GL_FLOAT_MAT3;
- case 4: return GL_FLOAT_MAT4;
- default: UNREACHABLE();
- }
- }
- else UNREACHABLE();
- }
- else if (type.getBasicType() == EbtInt)
- {
- if (type.isScalar())
- {
- return GL_INT;
- }
- else if (type.isVector())
- {
- switch(type.getNominalSize())
- {
- case 2: return GL_INT_VEC2;
- case 3: return GL_INT_VEC3;
- case 4: return GL_INT_VEC4;
- default: UNREACHABLE();
- }
- }
- else UNREACHABLE();
- }
- else if (type.getBasicType() == EbtBool)
- {
- if (type.isScalar())
- {
- return GL_BOOL;
- }
- else if (type.isVector())
- {
- switch(type.getNominalSize())
- {
- case 2: return GL_BOOL_VEC2;
- case 3: return GL_BOOL_VEC3;
- case 4: return GL_BOOL_VEC4;
- default: UNREACHABLE();
- }
- }
- else UNREACHABLE();
- }
- else if (type.getBasicType() == EbtSampler2D)
- {
- return GL_SAMPLER_2D;
- }
- else if (type.getBasicType() == EbtSamplerCube)
- {
- return GL_SAMPLER_CUBE;
- }
- else UNREACHABLE();
-
- return GL_NONE;
-}
-
-GLenum OutputHLSL::glVariablePrecision(const TType &type)
-{
- if (type.getBasicType() == EbtFloat)
- {
- switch (type.getPrecision())
- {
- case EbpHigh: return GL_HIGH_FLOAT;
- case EbpMedium: return GL_MEDIUM_FLOAT;
- case EbpLow: return GL_LOW_FLOAT;
- case EbpUndefined:
- // Should be defined as the default precision by the parser
- default: UNREACHABLE();
- }
- }
- else if (type.getBasicType() == EbtInt)
- {
- switch (type.getPrecision())
- {
- case EbpHigh: return GL_HIGH_INT;
- case EbpMedium: return GL_MEDIUM_INT;
- case EbpLow: return GL_LOW_INT;
- case EbpUndefined:
- // Should be defined as the default precision by the parser
- default: UNREACHABLE();
- }
- }
-
- // Other types (boolean, sampler) don't have a precision
- return GL_NONE;
-}
-
-}
diff --git a/chromium/third_party/angle/src/compiler/RemoveTree.cpp b/chromium/third_party/angle/src/compiler/RemoveTree.cpp
deleted file mode 100644
index a4b8c1e63e1..00000000000
--- a/chromium/third_party/angle/src/compiler/RemoveTree.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#include "compiler/intermediate.h"
-#include "compiler/RemoveTree.h"
-
-//
-// Code to recursively delete the intermediate tree.
-//
-
-class RemoveTree : public TIntermTraverser
-{
-public:
- RemoveTree() : TIntermTraverser(false, false, true)
- {
- }
-
-protected:
- void visitSymbol(TIntermSymbol*);
- void visitConstantUnion(TIntermConstantUnion*);
- bool visitBinary(Visit visit, TIntermBinary*);
- bool visitUnary(Visit visit, TIntermUnary*);
- bool visitSelection(Visit visit, TIntermSelection*);
- bool visitAggregate(Visit visit, TIntermAggregate*);
-};
-
-void RemoveTree::visitSymbol(TIntermSymbol* node)
-{
- delete node;
-}
-
-bool RemoveTree::visitBinary(Visit visit, TIntermBinary* node)
-{
- delete node;
-
- return true;
-}
-
-bool RemoveTree::visitUnary(Visit visit, TIntermUnary* node)
-{
- delete node;
-
- return true;
-}
-
-bool RemoveTree::visitAggregate(Visit visit, TIntermAggregate* node)
-{
- delete node;
-
- return true;
-}
-
-bool RemoveTree::visitSelection(Visit visit, TIntermSelection* node)
-{
- delete node;
-
- return true;
-}
-
-void RemoveTree::visitConstantUnion(TIntermConstantUnion* node)
-{
- delete node;
-}
-
-//
-// Entry point.
-//
-void RemoveAllTreeNodes(TIntermNode* root)
-{
- RemoveTree it;
-
- root->traverse(&it);
-}
-
diff --git a/chromium/third_party/angle/src/compiler/SymbolTable.cpp b/chromium/third_party/angle/src/compiler/SymbolTable.cpp
deleted file mode 100644
index a7ce21680f5..00000000000
--- a/chromium/third_party/angle/src/compiler/SymbolTable.cpp
+++ /dev/null
@@ -1,216 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-//
-// Symbol table for parsing. Most functionaliy and main ideas
-// are documented in the header file.
-//
-
-#if defined(_MSC_VER)
-#pragma warning(disable: 4718)
-#endif
-
-#include "compiler/SymbolTable.h"
-
-#include <stdio.h>
-#include <algorithm>
-#include <climits>
-
-TType::TType(const TPublicType &p) :
- type(p.type), precision(p.precision), qualifier(p.qualifier), size(p.size), matrix(p.matrix), array(p.array), arraySize(p.arraySize), structure(0)
-{
- if (p.userDef)
- structure = p.userDef->getStruct();
-}
-
-//
-// Recursively generate mangled names.
-//
-TString TType::buildMangledName() const
-{
- TString mangledName;
- if (isMatrix())
- mangledName += 'm';
- else if (isVector())
- mangledName += 'v';
-
- switch (type) {
- case EbtFloat: mangledName += 'f'; break;
- case EbtInt: mangledName += 'i'; break;
- case EbtBool: mangledName += 'b'; break;
- case EbtSampler2D: mangledName += "s2"; break;
- case EbtSamplerCube: mangledName += "sC"; break;
- case EbtStruct: mangledName += structure->mangledName(); break;
- default: break;
- }
-
- mangledName += static_cast<char>('0' + getNominalSize());
- if (isArray()) {
- char buf[20];
- snprintf(buf, sizeof(buf), "%d", arraySize);
- mangledName += '[';
- mangledName += buf;
- mangledName += ']';
- }
- return mangledName;
-}
-
-size_t TType::getObjectSize() const
-{
- size_t totalSize = 0;
-
- if (getBasicType() == EbtStruct)
- totalSize = structure->objectSize();
- else if (matrix)
- totalSize = size * size;
- else
- totalSize = size;
-
- if (isArray()) {
- size_t arraySize = getArraySize();
- if (arraySize > INT_MAX / totalSize)
- totalSize = INT_MAX;
- else
- totalSize *= arraySize;
- }
-
- return totalSize;
-}
-
-bool TStructure::containsArrays() const
-{
- for (size_t i = 0; i < mFields->size(); ++i) {
- const TType* fieldType = (*mFields)[i]->type();
- if (fieldType->isArray() || fieldType->isStructureContainingArrays())
- return true;
- }
- return false;
-}
-
-TString TStructure::buildMangledName() const
-{
- TString mangledName("struct-");
- mangledName += *mName;
- for (size_t i = 0; i < mFields->size(); ++i) {
- mangledName += '-';
- mangledName += (*mFields)[i]->type()->getMangledName();
- }
- return mangledName;
-}
-
-size_t TStructure::calculateObjectSize() const
-{
- size_t size = 0;
- for (size_t i = 0; i < mFields->size(); ++i) {
- size_t fieldSize = (*mFields)[i]->type()->getObjectSize();
- if (fieldSize > INT_MAX - size)
- size = INT_MAX;
- else
- size += fieldSize;
- }
- return size;
-}
-
-int TStructure::calculateDeepestNesting() const
-{
- int maxNesting = 0;
- for (size_t i = 0; i < mFields->size(); ++i) {
- maxNesting = std::max(maxNesting, (*mFields)[i]->type()->getDeepestStructNesting());
- }
- return 1 + maxNesting;
-}
-
-//
-// Dump functions.
-//
-
-void TVariable::dump(TInfoSink& infoSink) const
-{
- infoSink.debug << getName().c_str() << ": " << type.getQualifierString() << " " << type.getPrecisionString() << " " << type.getBasicString();
- if (type.isArray()) {
- infoSink.debug << "[0]";
- }
- infoSink.debug << "\n";
-}
-
-void TFunction::dump(TInfoSink &infoSink) const
-{
- infoSink.debug << getName().c_str() << ": " << returnType.getBasicString() << " " << getMangledName().c_str() << "\n";
-}
-
-void TSymbolTableLevel::dump(TInfoSink &infoSink) const
-{
- tLevel::const_iterator it;
- for (it = level.begin(); it != level.end(); ++it)
- (*it).second->dump(infoSink);
-}
-
-void TSymbolTable::dump(TInfoSink &infoSink) const
-{
- for (int level = currentLevel(); level >= 0; --level) {
- infoSink.debug << "LEVEL " << level << "\n";
- table[level]->dump(infoSink);
- }
-}
-
-//
-// Functions have buried pointers to delete.
-//
-TFunction::~TFunction()
-{
- for (TParamList::iterator i = parameters.begin(); i != parameters.end(); ++i)
- delete (*i).type;
-}
-
-//
-// Symbol table levels are a map of pointers to symbols that have to be deleted.
-//
-TSymbolTableLevel::~TSymbolTableLevel()
-{
- for (tLevel::iterator it = level.begin(); it != level.end(); ++it)
- delete (*it).second;
-}
-
-//
-// Change all function entries in the table with the non-mangled name
-// to be related to the provided built-in operation. This is a low
-// performance operation, and only intended for symbol tables that
-// live across a large number of compiles.
-//
-void TSymbolTableLevel::relateToOperator(const char* name, TOperator op)
-{
- tLevel::iterator it;
- for (it = level.begin(); it != level.end(); ++it) {
- if ((*it).second->isFunction()) {
- TFunction* function = static_cast<TFunction*>((*it).second);
- if (function->getName() == name)
- function->relateToOperator(op);
- }
- }
-}
-
-//
-// Change all function entries in the table with the non-mangled name
-// to be related to the provided built-in extension. This is a low
-// performance operation, and only intended for symbol tables that
-// live across a large number of compiles.
-//
-void TSymbolTableLevel::relateToExtension(const char* name, const TString& ext)
-{
- for (tLevel::iterator it = level.begin(); it != level.end(); ++it) {
- TSymbol* symbol = it->second;
- if (symbol->getName() == name)
- symbol->relateToExtension(ext);
- }
-}
-
-TSymbolTable::~TSymbolTable()
-{
- for (size_t i = 0; i < table.size(); ++i)
- delete table[i];
- for (size_t i = 0; i < precisionStack.size(); ++i)
- delete precisionStack[i];
-}
diff --git a/chromium/third_party/angle/src/compiler/SymbolTable.h b/chromium/third_party/angle/src/compiler/SymbolTable.h
deleted file mode 100644
index bebad4b92e7..00000000000
--- a/chromium/third_party/angle/src/compiler/SymbolTable.h
+++ /dev/null
@@ -1,382 +0,0 @@
-//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#ifndef _SYMBOL_TABLE_INCLUDED_
-#define _SYMBOL_TABLE_INCLUDED_
-
-//
-// Symbol table for parsing. Has these design characteristics:
-//
-// * Same symbol table can be used to compile many shaders, to preserve
-// effort of creating and loading with the large numbers of built-in
-// symbols.
-//
-// * Name mangling will be used to give each function a unique name
-// so that symbol table lookups are never ambiguous. This allows
-// a simpler symbol table structure.
-//
-// * Pushing and popping of scope, so symbol table will really be a stack
-// of symbol tables. Searched from the top, with new inserts going into
-// the top.
-//
-// * Constants: Compile time constant symbols will keep their values
-// in the symbol table. The parser can substitute constants at parse
-// time, including doing constant folding and constant propagation.
-//
-// * No temporaries: Temporaries made from operations (+, --, .xy, etc.)
-// are tracked in the intermediate representation, not the symbol table.
-//
-
-#include <assert.h>
-
-#include "common/angleutils.h"
-#include "compiler/InfoSink.h"
-#include "compiler/intermediate.h"
-
-//
-// Symbol base class. (Can build functions or variables out of these...)
-//
-class TSymbol {
-public:
- POOL_ALLOCATOR_NEW_DELETE();
- TSymbol(const TString* n) : uniqueId(0), name(n) { }
- virtual ~TSymbol() { /* don't delete name, it's from the pool */ }
-
- const TString& getName() const { return *name; }
- virtual const TString& getMangledName() const { return getName(); }
- virtual bool isFunction() const { return false; }
- virtual bool isVariable() const { return false; }
- void setUniqueId(int id) { uniqueId = id; }
- int getUniqueId() const { return uniqueId; }
- virtual void dump(TInfoSink &infoSink) const = 0;
- void relateToExtension(const TString& ext) { extension = ext; }
- const TString& getExtension() const { return extension; }
-
-private:
- DISALLOW_COPY_AND_ASSIGN(TSymbol);
-
- int uniqueId; // For real comparing during code generation
- const TString *name;
- TString extension;
-};
-
-//
-// Variable class, meaning a symbol that's not a function.
-//
-// There could be a separate class heirarchy for Constant variables;
-// Only one of int, bool, or float, (or none) is correct for
-// any particular use, but it's easy to do this way, and doesn't
-// seem worth having separate classes, and "getConst" can't simply return
-// different values for different types polymorphically, so this is
-// just simple and pragmatic.
-//
-class TVariable : public TSymbol {
-public:
- TVariable(const TString *name, const TType& t, bool uT = false ) : TSymbol(name), type(t), userType(uT), unionArray(0) { }
- virtual ~TVariable() { }
- virtual bool isVariable() const { return true; }
- TType& getType() { return type; }
- const TType& getType() const { return type; }
- bool isUserType() const { return userType; }
- void setQualifier(TQualifier qualifier) { type.setQualifier(qualifier); }
-
- virtual void dump(TInfoSink &infoSink) const;
-
- ConstantUnion* getConstPointer()
- {
- if (!unionArray)
- unionArray = new ConstantUnion[type.getObjectSize()];
-
- return unionArray;
- }
-
- ConstantUnion* getConstPointer() const { return unionArray; }
-
- void shareConstPointer( ConstantUnion *constArray)
- {
- if (unionArray == constArray)
- return;
-
- delete[] unionArray;
- unionArray = constArray;
- }
-
-private:
- DISALLOW_COPY_AND_ASSIGN(TVariable);
-
- TType type;
- bool userType;
- // we are assuming that Pool Allocator will free the memory allocated to unionArray
- // when this object is destroyed
- ConstantUnion *unionArray;
-};
-
-//
-// The function sub-class of symbols and the parser will need to
-// share this definition of a function parameter.
-//
-struct TParameter {
- TString *name;
- TType* type;
-};
-
-//
-// The function sub-class of a symbol.
-//
-class TFunction : public TSymbol {
-public:
- TFunction(TOperator o) :
- TSymbol(0),
- returnType(TType(EbtVoid, EbpUndefined)),
- op(o),
- defined(false) { }
- TFunction(const TString *name, TType& retType, TOperator tOp = EOpNull) :
- TSymbol(name),
- returnType(retType),
- mangledName(TFunction::mangleName(*name)),
- op(tOp),
- defined(false) { }
- virtual ~TFunction();
- virtual bool isFunction() const { return true; }
-
- static TString mangleName(const TString& name) { return name + '('; }
- static TString unmangleName(const TString& mangledName)
- {
- return TString(mangledName.c_str(), mangledName.find_first_of('('));
- }
-
- void addParameter(TParameter& p)
- {
- parameters.push_back(p);
- mangledName = mangledName + p.type->getMangledName();
- }
-
- const TString& getMangledName() const { return mangledName; }
- const TType& getReturnType() const { return returnType; }
-
- void relateToOperator(TOperator o) { op = o; }
- TOperator getBuiltInOp() const { return op; }
-
- void setDefined() { defined = true; }
- bool isDefined() { return defined; }
-
- size_t getParamCount() const { return parameters.size(); }
- const TParameter& getParam(size_t i) const { return parameters[i]; }
-
- virtual void dump(TInfoSink &infoSink) const;
-
-private:
- DISALLOW_COPY_AND_ASSIGN(TFunction);
-
- typedef TVector<TParameter> TParamList;
- TParamList parameters;
- TType returnType;
- TString mangledName;
- TOperator op;
- bool defined;
-};
-
-
-class TSymbolTableLevel {
-public:
- typedef TMap<TString, TSymbol*> tLevel;
- typedef tLevel::const_iterator const_iterator;
- typedef const tLevel::value_type tLevelPair;
- typedef std::pair<tLevel::iterator, bool> tInsertResult;
-
- TSymbolTableLevel() { }
- ~TSymbolTableLevel();
-
- bool insert(const TString &name, TSymbol &symbol)
- {
- //
- // returning true means symbol was added to the table
- //
- tInsertResult result = level.insert(tLevelPair(name, &symbol));
-
- return result.second;
- }
-
- bool insert(TSymbol &symbol)
- {
- return insert(symbol.getMangledName(), symbol);
- }
-
- TSymbol* find(const TString& name) const
- {
- tLevel::const_iterator it = level.find(name);
- if (it == level.end())
- return 0;
- else
- return (*it).second;
- }
-
- const_iterator begin() const
- {
- return level.begin();
- }
-
- const_iterator end() const
- {
- return level.end();
- }
-
- void relateToOperator(const char* name, TOperator op);
- void relateToExtension(const char* name, const TString& ext);
- void dump(TInfoSink &infoSink) const;
-
-protected:
- tLevel level;
-};
-
-class TSymbolTable {
-public:
- TSymbolTable() : uniqueId(0)
- {
- //
- // The symbol table cannot be used until push() is called, but
- // the lack of an initial call to push() can be used to detect
- // that the symbol table has not been preloaded with built-ins.
- //
- }
- ~TSymbolTable();
-
- //
- // When the symbol table is initialized with the built-ins, there should
- // 'push' calls, so that built-ins are at level 0 and the shader
- // globals are at level 1.
- //
- bool isEmpty() { return table.size() == 0; }
- bool atBuiltInLevel() { return table.size() == 1; }
- bool atGlobalLevel() { return table.size() <= 2; }
- void push()
- {
- table.push_back(new TSymbolTableLevel);
- precisionStack.push_back(new PrecisionStackLevel);
- }
-
- void pop()
- {
- delete table.back();
- table.pop_back();
-
- delete precisionStack.back();
- precisionStack.pop_back();
- }
-
- bool insert(TSymbol& symbol)
- {
- symbol.setUniqueId(++uniqueId);
- return table[currentLevel()]->insert(symbol);
- }
-
- bool insertConstInt(const char *name, int value)
- {
- TVariable *constant = new TVariable(NewPoolTString(name), TType(EbtInt, EbpUndefined, EvqConst, 1));
- constant->getConstPointer()->setIConst(value);
- return insert(*constant);
- }
-
- bool insertBuiltIn(TType *rvalue, const char *name, TType *ptype1, TType *ptype2 = 0, TType *ptype3 = 0)
- {
- TFunction *function = new TFunction(NewPoolTString(name), *rvalue);
-
- TParameter param1 = {NULL, ptype1};
- function->addParameter(param1);
-
- if(ptype2)
- {
- TParameter param2 = {NULL, ptype2};
- function->addParameter(param2);
- }
-
- if(ptype3)
- {
- TParameter param3 = {NULL, ptype3};
- function->addParameter(param3);
- }
-
- return insert(*function);
- }
-
- TSymbol* find(const TString& name, bool* builtIn = 0, bool *sameScope = 0)
- {
- int level = currentLevel();
- TSymbol* symbol;
- do {
- symbol = table[level]->find(name);
- --level;
- } while (symbol == 0 && level >= 0);
- level++;
- if (builtIn)
- *builtIn = level == 0;
- if (sameScope)
- *sameScope = level == currentLevel();
- return symbol;
- }
-
- TSymbol* findBuiltIn(const TString &name)
- {
- return table[0]->find(name);
- }
-
- TSymbolTableLevel* getOuterLevel() {
- assert(table.size() >= 2);
- return table[currentLevel() - 1];
- }
-
- void relateToOperator(const char* name, TOperator op) {
- table[0]->relateToOperator(name, op);
- }
- void relateToExtension(const char* name, const TString& ext) {
- table[0]->relateToExtension(name, ext);
- }
- void dump(TInfoSink &infoSink) const;
-
- bool setDefaultPrecision(const TPublicType& type, TPrecision prec) {
- if (!supportsPrecision(type.type))
- return false;
- if (type.size != 1 || type.matrix || type.array)
- return false; // Not allowed to set for aggregate types
- int indexOfLastElement = static_cast<int>(precisionStack.size()) - 1;
- (*precisionStack[indexOfLastElement])[type.type] = prec; // Uses map operator [], overwrites the current value
- return true;
- }
-
- // Searches down the precisionStack for a precision qualifier for the specified TBasicType
- TPrecision getDefaultPrecision(TBasicType type) {
- if (!supportsPrecision(type))
- return EbpUndefined;
- int level = static_cast<int>(precisionStack.size()) - 1;
- assert(level >= 0); // Just to be safe. Should not happen.
- PrecisionStackLevel::iterator it;
- TPrecision prec = EbpUndefined; // If we dont find anything we return this. Should we error check this?
- while (level >= 0) {
- it = precisionStack[level]->find(type);
- if (it != precisionStack[level]->end()) {
- prec = (*it).second;
- break;
- }
- level--;
- }
- return prec;
- }
-
-private:
- int currentLevel() const { return static_cast<int>(table.size()) - 1; }
-
- bool supportsPrecision(TBasicType type) {
- // Only supports precision for int, float, and sampler types.
- return type == EbtFloat || type == EbtInt || IsSampler(type);
- }
-
- int uniqueId; // for unique identification in code generation
- std::vector<TSymbolTableLevel*> table;
- typedef TMap<TBasicType, TPrecision> PrecisionStackLevel;
- std::vector<PrecisionStackLevel*> precisionStack;
-};
-
-#endif // _SYMBOL_TABLE_INCLUDED_
diff --git a/chromium/third_party/angle/src/compiler/TranslatorHLSL.cpp b/chromium/third_party/angle/src/compiler/TranslatorHLSL.cpp
deleted file mode 100644
index 37408a07c49..00000000000
--- a/chromium/third_party/angle/src/compiler/TranslatorHLSL.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#include "compiler/TranslatorHLSL.h"
-
-#include "compiler/InitializeParseContext.h"
-#include "compiler/OutputHLSL.h"
-
-TranslatorHLSL::TranslatorHLSL(ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
- : TCompiler(type, spec), mOutputType(output)
-{
-}
-
-void TranslatorHLSL::translate(TIntermNode *root)
-{
- TParseContext& parseContext = *GetGlobalParseContext();
- sh::OutputHLSL outputHLSL(parseContext, getResources(), mOutputType);
-
- outputHLSL.output();
- mActiveUniforms = outputHLSL.getUniforms();
-}
diff --git a/chromium/third_party/angle/src/compiler/TranslatorHLSL.h b/chromium/third_party/angle/src/compiler/TranslatorHLSL.h
deleted file mode 100644
index 9550e15e8ef..00000000000
--- a/chromium/third_party/angle/src/compiler/TranslatorHLSL.h
+++ /dev/null
@@ -1,27 +0,0 @@
-//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#ifndef COMPILER_TRANSLATORHLSL_H_
-#define COMPILER_TRANSLATORHLSL_H_
-
-#include "compiler/ShHandle.h"
-#include "compiler/Uniform.h"
-
-class TranslatorHLSL : public TCompiler {
-public:
- TranslatorHLSL(ShShaderType type, ShShaderSpec spec, ShShaderOutput output);
-
- virtual TranslatorHLSL *getAsTranslatorHLSL() { return this; }
- const sh::ActiveUniforms &getUniforms() { return mActiveUniforms; }
-
-protected:
- virtual void translate(TIntermNode* root);
-
- sh::ActiveUniforms mActiveUniforms;
- ShShaderOutput mOutputType;
-};
-
-#endif // COMPILER_TRANSLATORHLSL_H_
diff --git a/chromium/third_party/angle/src/compiler/Types.h b/chromium/third_party/angle/src/compiler/Types.h
deleted file mode 100644
index 75560ddc6ef..00000000000
--- a/chromium/third_party/angle/src/compiler/Types.h
+++ /dev/null
@@ -1,307 +0,0 @@
-//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#ifndef _TYPES_INCLUDED
-#define _TYPES_INCLUDED
-
-#include "common/angleutils.h"
-
-#include "compiler/BaseTypes.h"
-#include "compiler/Common.h"
-#include "compiler/debug.h"
-
-struct TPublicType;
-class TType;
-
-class TField
-{
-public:
- POOL_ALLOCATOR_NEW_DELETE();
- TField(TType* type, TString* name) : mType(type), mName(name) {}
-
- // TODO(alokp): We should only return const type.
- // Fix it by tweaking grammar.
- TType* type() { return mType; }
- const TType* type() const { return mType; }
-
- const TString& name() const { return *mName; }
-
-private:
- DISALLOW_COPY_AND_ASSIGN(TField);
- TType* mType;
- TString* mName;
-};
-
-typedef TVector<TField*> TFieldList;
-inline TFieldList* NewPoolTFieldList()
-{
- void* memory = GetGlobalPoolAllocator()->allocate(sizeof(TFieldList));
- return new(memory) TFieldList;
-}
-
-class TStructure
-{
-public:
- POOL_ALLOCATOR_NEW_DELETE();
- TStructure(TString* name, TFieldList* fields)
- : mName(name),
- mFields(fields),
- mObjectSize(0),
- mDeepestNesting(0) {
- }
-
- const TString& name() const { return *mName; }
- const TFieldList& fields() const { return *mFields; }
-
- const TString& mangledName() const {
- if (mMangledName.empty())
- mMangledName = buildMangledName();
- return mMangledName;
- }
- size_t objectSize() const {
- if (mObjectSize == 0)
- mObjectSize = calculateObjectSize();
- return mObjectSize;
- };
- int deepestNesting() const {
- if (mDeepestNesting == 0)
- mDeepestNesting = calculateDeepestNesting();
- return mDeepestNesting;
- }
- bool containsArrays() const;
-
-private:
- DISALLOW_COPY_AND_ASSIGN(TStructure);
- TString buildMangledName() const;
- size_t calculateObjectSize() const;
- int calculateDeepestNesting() const;
-
- TString* mName;
- TFieldList* mFields;
-
- mutable TString mMangledName;
- mutable size_t mObjectSize;
- mutable int mDeepestNesting;
-};
-
-//
-// Base class for things that have a type.
-//
-class TType
-{
-public:
- POOL_ALLOCATOR_NEW_DELETE();
- TType() {}
- TType(TBasicType t, TPrecision p, TQualifier q = EvqTemporary, unsigned char s = 1, bool m = false, bool a = false) :
- type(t), precision(p), qualifier(q), size(s), matrix(m), array(a), arraySize(0), structure(0)
- {
- }
- explicit TType(const TPublicType &p);
- TType(TStructure* userDef, TPrecision p = EbpUndefined) :
- type(EbtStruct), precision(p), qualifier(EvqTemporary), size(1), matrix(false), array(false), arraySize(0), structure(userDef)
- {
- }
-
- TBasicType getBasicType() const { return type; }
- void setBasicType(TBasicType t) { type = t; }
-
- TPrecision getPrecision() const { return precision; }
- void setPrecision(TPrecision p) { precision = p; }
-
- TQualifier getQualifier() const { return qualifier; }
- void setQualifier(TQualifier q) { qualifier = q; }
-
- // One-dimensional size of single instance type
- int getNominalSize() const { return size; }
- void setNominalSize(unsigned char s) { size = s; }
- // Full size of single instance of type
- size_t getObjectSize() const;
-
- int elementRegisterCount() const
- {
- if (structure)
- {
- const TFieldList &fields = getStruct()->fields();
- int registerCount = 0;
-
- for (size_t i = 0; i < fields.size(); i++)
- {
- registerCount += fields[i]->type()->totalRegisterCount();
- }
-
- return registerCount;
- }
- else if (isMatrix())
- {
- return getNominalSize();
- }
- else
- {
- return 1;
- }
- }
-
- int totalRegisterCount() const
- {
- if (array)
- {
- return arraySize * elementRegisterCount();
- }
- else
- {
- return elementRegisterCount();
- }
- }
-
- bool isMatrix() const { return matrix ? true : false; }
- void setMatrix(bool m) { matrix = m; }
-
- bool isArray() const { return array ? true : false; }
- int getArraySize() const { return arraySize; }
- void setArraySize(int s) { array = true; arraySize = s; }
- void clearArrayness() { array = false; arraySize = 0; }
-
- bool isVector() const { return size > 1 && !matrix; }
- bool isScalar() const { return size == 1 && !matrix && !structure; }
-
- TStructure* getStruct() const { return structure; }
- void setStruct(TStructure* s) { structure = s; }
-
- const TString& getMangledName() const {
- if (mangled.empty()) {
- mangled = buildMangledName();
- mangled += ';';
- }
- return mangled;
- }
-
- bool sameElementType(const TType& right) const {
- return type == right.type &&
- size == right.size &&
- matrix == right.matrix &&
- structure == right.structure;
- }
- bool operator==(const TType& right) const {
- return type == right.type &&
- size == right.size &&
- matrix == right.matrix &&
- array == right.array && (!array || arraySize == right.arraySize) &&
- structure == right.structure;
- // don't check the qualifier, it's not ever what's being sought after
- }
- bool operator!=(const TType& right) const {
- return !operator==(right);
- }
- bool operator<(const TType& right) const {
- if (type != right.type) return type < right.type;
- if (size != right.size) return size < right.size;
- if (matrix != right.matrix) return matrix < right.matrix;
- if (array != right.array) return array < right.array;
- if (arraySize != right.arraySize) return arraySize < right.arraySize;
- if (structure != right.structure) return structure < right.structure;
-
- return false;
- }
-
- const char* getBasicString() const { return ::getBasicString(type); }
- const char* getPrecisionString() const { return ::getPrecisionString(precision); }
- const char* getQualifierString() const { return ::getQualifierString(qualifier); }
- TString getCompleteString() const;
-
- // If this type is a struct, returns the deepest struct nesting of
- // any field in the struct. For example:
- // struct nesting1 {
- // vec4 position;
- // };
- // struct nesting2 {
- // nesting1 field1;
- // vec4 field2;
- // };
- // For type "nesting2", this method would return 2 -- the number
- // of structures through which indirection must occur to reach the
- // deepest field (nesting2.field1.position).
- int getDeepestStructNesting() const {
- return structure ? structure->deepestNesting() : 0;
- }
-
- bool isStructureContainingArrays() const {
- return structure ? structure->containsArrays() : false;
- }
-
-private:
- TString buildMangledName() const;
-
- TBasicType type;
- TPrecision precision;
- TQualifier qualifier;
- unsigned char size;
- bool matrix;
- bool array;
- int arraySize;
-
- TStructure* structure; // 0 unless this is a struct
-
- mutable TString mangled;
-};
-
-//
-// This is a workaround for a problem with the yacc stack, It can't have
-// types that it thinks have non-trivial constructors. It should
-// just be used while recognizing the grammar, not anything else. Pointers
-// could be used, but also trying to avoid lots of memory management overhead.
-//
-// Not as bad as it looks, there is no actual assumption that the fields
-// match up or are name the same or anything like that.
-//
-struct TPublicType
-{
- TBasicType type;
- TQualifier qualifier;
- TPrecision precision;
- unsigned char size; // size of vector or matrix, not size of array
- bool matrix;
- bool array;
- int arraySize;
- TType* userDef;
- TSourceLoc line;
-
- void setBasic(TBasicType bt, TQualifier q, const TSourceLoc& ln)
- {
- type = bt;
- qualifier = q;
- precision = EbpUndefined;
- size = 1;
- matrix = false;
- array = false;
- arraySize = 0;
- userDef = 0;
- line = ln;
- }
-
- void setAggregate(unsigned char s, bool m = false)
- {
- size = s;
- matrix = m;
- }
-
- void setArray(bool a, int s = 0)
- {
- array = a;
- arraySize = s;
- }
-
- bool isStructureContainingArrays() const
- {
- if (!userDef)
- {
- return false;
- }
-
- return userDef->isStructureContainingArrays();
- }
-};
-
-#endif // _TYPES_INCLUDED_
diff --git a/chromium/third_party/angle/src/compiler/Uniform.cpp b/chromium/third_party/angle/src/compiler/Uniform.cpp
deleted file mode 100644
index f367db2be8e..00000000000
--- a/chromium/third_party/angle/src/compiler/Uniform.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-//
-// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#include "compiler/Uniform.h"
-
-namespace sh
-{
-
-Uniform::Uniform(GLenum type, GLenum precision, const char *name, int arraySize, int registerIndex)
-{
- this->type = type;
- this->precision = precision;
- this->name = name;
- this->arraySize = arraySize;
- this->registerIndex = registerIndex;
-}
-
-}
diff --git a/chromium/third_party/angle/src/compiler/Uniform.h b/chromium/third_party/angle/src/compiler/Uniform.h
deleted file mode 100644
index 4c53ffa7d2f..00000000000
--- a/chromium/third_party/angle/src/compiler/Uniform.h
+++ /dev/null
@@ -1,35 +0,0 @@
-//
-// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#ifndef COMPILER_UNIFORM_H_
-#define COMPILER_UNIFORM_H_
-
-#include <string>
-#include <vector>
-
-#define GL_APICALL
-#include <GLES2/gl2.h>
-
-namespace sh
-{
-
-struct Uniform
-{
- Uniform(GLenum type, GLenum precision, const char *name, int arraySize, int registerIndex);
-
- GLenum type;
- GLenum precision;
- std::string name;
- unsigned int arraySize;
-
- int registerIndex;
-};
-
-typedef std::vector<Uniform> ActiveUniforms;
-
-}
-
-#endif // COMPILER_UNIFORM_H_
diff --git a/chromium/third_party/angle/src/compiler/ValidateLimitations.h b/chromium/third_party/angle/src/compiler/ValidateLimitations.h
deleted file mode 100644
index a835cb3c226..00000000000
--- a/chromium/third_party/angle/src/compiler/ValidateLimitations.h
+++ /dev/null
@@ -1,59 +0,0 @@
-//
-// Copyright (c) 2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#include "GLSLANG/ShaderLang.h"
-#include "compiler/intermediate.h"
-
-class TInfoSinkBase;
-
-struct TLoopInfo {
- struct TIndex {
- int id; // symbol id.
- } index;
- TIntermLoop* loop;
-};
-typedef TVector<TLoopInfo> TLoopStack;
-
-// Traverses intermediate tree to ensure that the shader does not exceed the
-// minimum functionality mandated in GLSL 1.0 spec, Appendix A.
-class ValidateLimitations : public TIntermTraverser {
-public:
- ValidateLimitations(ShShaderType shaderType, TInfoSinkBase& sink);
-
- int numErrors() const { return mNumErrors; }
-
- virtual bool visitBinary(Visit, TIntermBinary*);
- virtual bool visitUnary(Visit, TIntermUnary*);
- virtual bool visitAggregate(Visit, TIntermAggregate*);
- virtual bool visitLoop(Visit, TIntermLoop*);
-
-private:
- void error(TSourceLoc loc, const char *reason, const char* token);
-
- bool withinLoopBody() const;
- bool isLoopIndex(const TIntermSymbol* symbol) const;
- bool validateLoopType(TIntermLoop* node);
- bool validateForLoopHeader(TIntermLoop* node, TLoopInfo* info);
- bool validateForLoopInit(TIntermLoop* node, TLoopInfo* info);
- bool validateForLoopCond(TIntermLoop* node, TLoopInfo* info);
- bool validateForLoopExpr(TIntermLoop* node, TLoopInfo* info);
- // Returns true if none of the loop indices is used as the argument to
- // the given function out or inout parameter.
- bool validateFunctionCall(TIntermAggregate* node);
- bool validateOperation(TIntermOperator* node, TIntermNode* operand);
-
- // Returns true if indexing does not exceed the minimum functionality
- // mandated in GLSL 1.0 spec, Appendix A, Section 5.
- bool isConstExpr(TIntermNode* node);
- bool isConstIndexExpr(TIntermNode* node);
- bool validateIndexing(TIntermBinary* node);
-
- ShShaderType mShaderType;
- TInfoSinkBase& mSink;
- int mNumErrors;
- TLoopStack mLoopStack;
-};
-
diff --git a/chromium/third_party/angle/src/compiler/glslang.l b/chromium/third_party/angle/src/compiler/glslang.l
deleted file mode 100644
index 430f8ca13bc..00000000000
--- a/chromium/third_party/angle/src/compiler/glslang.l
+++ /dev/null
@@ -1,355 +0,0 @@
-/*
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-This file contains the Lex specification for GLSL ES.
-Based on ANSI C grammar, Lex specification:
-http://www.lysator.liu.se/c/ANSI-C-grammar-l.html
-
-IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh,
-WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp).
-*/
-
-%top{
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
-
-// Ignore errors in auto-generated code.
-#if defined(__GNUC__)
-#pragma GCC diagnostic ignored "-Wunused-function"
-#pragma GCC diagnostic ignored "-Wunused-variable"
-#pragma GCC diagnostic ignored "-Wswitch-enum"
-#elif defined(_MSC_VER)
-#pragma warning(disable: 4065)
-#pragma warning(disable: 4189)
-#pragma warning(disable: 4505)
-#pragma warning(disable: 4701)
-#endif
-}
-
-%{
-#include "compiler/glslang.h"
-#include "compiler/ParseContext.h"
-#include "compiler/preprocessor/Token.h"
-#include "compiler/util.h"
-#include "glslang_tab.h"
-
-/* windows only pragma */
-#ifdef _MSC_VER
-#pragma warning(disable : 4102)
-#endif
-
-#define YY_USER_ACTION \
- yylloc->first_file = yylloc->last_file = yycolumn; \
- yylloc->first_line = yylloc->last_line = yylineno;
-
-#define YY_INPUT(buf, result, max_size) \
- result = string_input(buf, max_size, yyscanner);
-
-static yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner);
-static int check_type(yyscan_t yyscanner);
-static int reserved_word(yyscan_t yyscanner);
-static int int_constant(yyscan_t yyscanner);
-static int float_constant(yyscan_t yyscanner);
-%}
-
-%option noyywrap nounput never-interactive
-%option yylineno reentrant bison-bridge bison-locations
-%option extra-type="TParseContext*"
-
-D [0-9]
-L [a-zA-Z_]
-H [a-fA-F0-9]
-E [Ee][+-]?{D}+
-O [0-7]
-
-%%
-
-"invariant" { return INVARIANT; }
-"highp" { return HIGH_PRECISION; }
-"mediump" { return MEDIUM_PRECISION; }
-"lowp" { return LOW_PRECISION; }
-"precision" { return PRECISION; }
-
-"attribute" { return ATTRIBUTE; }
-"const" { return CONST_QUAL; }
-"uniform" { return UNIFORM; }
-"varying" { return VARYING; }
-
-"break" { return BREAK; }
-"continue" { return CONTINUE; }
-"do" { return DO; }
-"for" { return FOR; }
-"while" { return WHILE; }
-
-"if" { return IF; }
-"else" { return ELSE; }
-
-"in" { return IN_QUAL; }
-"out" { return OUT_QUAL; }
-"inout" { return INOUT_QUAL; }
-
-"float" { return FLOAT_TYPE; }
-"int" { return INT_TYPE; }
-"void" { return VOID_TYPE; }
-"bool" { return BOOL_TYPE; }
-"true" { yylval->lex.b = true; return BOOLCONSTANT; }
-"false" { yylval->lex.b = false; return BOOLCONSTANT; }
-
-"discard" { return DISCARD; }
-"return" { return RETURN; }
-
-"mat2" { return MATRIX2; }
-"mat3" { return MATRIX3; }
-"mat4" { return MATRIX4; }
-
-"vec2" { return VEC2; }
-"vec3" { return VEC3; }
-"vec4" { return VEC4; }
-"ivec2" { return IVEC2; }
-"ivec3" { return IVEC3; }
-"ivec4" { return IVEC4; }
-"bvec2" { return BVEC2; }
-"bvec3" { return BVEC3; }
-"bvec4" { return BVEC4; }
-
-"sampler2D" { return SAMPLER2D; }
-"samplerCube" { return SAMPLERCUBE; }
-"samplerExternalOES" { return SAMPLER_EXTERNAL_OES; }
-"sampler2DRect" { return SAMPLER2DRECT; }
-
-"struct" { return STRUCT; }
-
-"asm" { return reserved_word(yyscanner); }
-
-"class" { return reserved_word(yyscanner); }
-"union" { return reserved_word(yyscanner); }
-"enum" { return reserved_word(yyscanner); }
-"typedef" { return reserved_word(yyscanner); }
-"template" { return reserved_word(yyscanner); }
-"this" { return reserved_word(yyscanner); }
-"packed" { return reserved_word(yyscanner); }
-
-"goto" { return reserved_word(yyscanner); }
-"switch" { return reserved_word(yyscanner); }
-"default" { return reserved_word(yyscanner); }
-
-"inline" { return reserved_word(yyscanner); }
-"noinline" { return reserved_word(yyscanner); }
-"volatile" { return reserved_word(yyscanner); }
-"public" { return reserved_word(yyscanner); }
-"static" { return reserved_word(yyscanner); }
-"extern" { return reserved_word(yyscanner); }
-"external" { return reserved_word(yyscanner); }
-"interface" { return reserved_word(yyscanner); }
-"flat" { return reserved_word(yyscanner); }
-
-"long" { return reserved_word(yyscanner); }
-"short" { return reserved_word(yyscanner); }
-"double" { return reserved_word(yyscanner); }
-"half" { return reserved_word(yyscanner); }
-"fixed" { return reserved_word(yyscanner); }
-"unsigned" { return reserved_word(yyscanner); }
-"superp" { return reserved_word(yyscanner); }
-
-"input" { return reserved_word(yyscanner); }
-"output" { return reserved_word(yyscanner); }
-
-"hvec2" { return reserved_word(yyscanner); }
-"hvec3" { return reserved_word(yyscanner); }
-"hvec4" { return reserved_word(yyscanner); }
-"dvec2" { return reserved_word(yyscanner); }
-"dvec3" { return reserved_word(yyscanner); }
-"dvec4" { return reserved_word(yyscanner); }
-"fvec2" { return reserved_word(yyscanner); }
-"fvec3" { return reserved_word(yyscanner); }
-"fvec4" { return reserved_word(yyscanner); }
-
-"sampler1D" { return reserved_word(yyscanner); }
-"sampler3D" { return reserved_word(yyscanner); }
-"sampler1DShadow" { return reserved_word(yyscanner); }
-"sampler2DShadow" { return reserved_word(yyscanner); }
-"sampler3DRect" { return reserved_word(yyscanner); }
-"sampler2DRectShadow" { return reserved_word(yyscanner); }
-
-"sizeof" { return reserved_word(yyscanner); }
-"cast" { return reserved_word(yyscanner); }
-
-"namespace" { return reserved_word(yyscanner); }
-"using" { return reserved_word(yyscanner); }
-
-{L}({L}|{D})* {
- yylval->lex.string = NewPoolTString(yytext);
- return check_type(yyscanner);
-}
-
-0[xX]{H}+ { return int_constant(yyscanner); }
-0{O}+ { return int_constant(yyscanner); }
-{D}+ { return int_constant(yyscanner); }
-
-{D}+{E} { return float_constant(yyscanner); }
-{D}+"."{D}*({E})? { return float_constant(yyscanner); }
-"."{D}+({E})? { return float_constant(yyscanner); }
-
-"+=" { return ADD_ASSIGN; }
-"-=" { return SUB_ASSIGN; }
-"*=" { return MUL_ASSIGN; }
-"/=" { return DIV_ASSIGN; }
-"%=" { return MOD_ASSIGN; }
-"<<=" { return LEFT_ASSIGN; }
-">>=" { return RIGHT_ASSIGN; }
-"&=" { return AND_ASSIGN; }
-"^=" { return XOR_ASSIGN; }
-"|=" { return OR_ASSIGN; }
-
-"++" { return INC_OP; }
-"--" { return DEC_OP; }
-"&&" { return AND_OP; }
-"||" { return OR_OP; }
-"^^" { return XOR_OP; }
-"<=" { return LE_OP; }
-">=" { return GE_OP; }
-"==" { return EQ_OP; }
-"!=" { return NE_OP; }
-"<<" { return LEFT_OP; }
-">>" { return RIGHT_OP; }
-";" { return SEMICOLON; }
-("{"|"<%") { return LEFT_BRACE; }
-("}"|"%>") { return RIGHT_BRACE; }
-"," { return COMMA; }
-":" { return COLON; }
-"=" { return EQUAL; }
-"(" { return LEFT_PAREN; }
-")" { return RIGHT_PAREN; }
-("["|"<:") { return LEFT_BRACKET; }
-("]"|":>") { return RIGHT_BRACKET; }
-"." { return DOT; }
-"!" { return BANG; }
-"-" { return DASH; }
-"~" { return TILDE; }
-"+" { return PLUS; }
-"*" { return STAR; }
-"/" { return SLASH; }
-"%" { return PERCENT; }
-"<" { return LEFT_ANGLE; }
-">" { return RIGHT_ANGLE; }
-"|" { return VERTICAL_BAR; }
-"^" { return CARET; }
-"&" { return AMPERSAND; }
-"?" { return QUESTION; }
-
-[ \t\v\n\f\r] { }
-<<EOF>> { yyterminate(); }
-. { assert(false); return 0; }
-
-%%
-
-yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner) {
- pp::Token token;
- yyget_extra(yyscanner)->preprocessor.lex(&token);
- yy_size_t len = token.type == pp::Token::LAST ? 0 : token.text.size();
- if (len < max_size)
- memcpy(buf, token.text.c_str(), len);
- yyset_column(token.location.file, yyscanner);
- yyset_lineno(token.location.line, yyscanner);
-
- if (len >= max_size)
- YY_FATAL_ERROR("Input buffer overflow");
- else if (len > 0)
- buf[len++] = ' ';
- return len;
-}
-
-int check_type(yyscan_t yyscanner) {
- struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
-
- int token = IDENTIFIER;
- TSymbol* symbol = yyextra->symbolTable.find(yytext);
- if (symbol && symbol->isVariable()) {
- TVariable* variable = static_cast<TVariable*>(symbol);
- if (variable->isUserType())
- token = TYPE_NAME;
- }
- yylval->lex.symbol = symbol;
- return token;
-}
-
-int reserved_word(yyscan_t yyscanner) {
- struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
-
- yyextra->error(*yylloc, "Illegal use of reserved word", yytext, "");
- yyextra->recover();
- return 0;
-}
-
-void yyerror(YYLTYPE* lloc, TParseContext* context, const char* reason) {
- context->error(*lloc, reason, yyget_text(context->scanner));
- context->recover();
-}
-
-int int_constant(yyscan_t yyscanner) {
- struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
-
- if (!atoi_clamp(yytext, &(yylval->lex.i)))
- yyextra->warning(*yylloc, "Integer overflow", yytext, "");
- return INTCONSTANT;
-}
-
-int float_constant(yyscan_t yyscanner) {
- struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
-
- if (!atof_clamp(yytext, &(yylval->lex.f)))
- yyextra->warning(*yylloc, "Float overflow", yytext, "");
- return FLOATCONSTANT;
-}
-
-int glslang_initialize(TParseContext* context) {
- yyscan_t scanner = NULL;
- if (yylex_init_extra(context, &scanner))
- return 1;
-
- context->scanner = scanner;
- return 0;
-}
-
-int glslang_finalize(TParseContext* context) {
- yyscan_t scanner = context->scanner;
- if (scanner == NULL) return 0;
-
- context->scanner = NULL;
- yylex_destroy(scanner);
-
- return 0;
-}
-
-int glslang_scan(size_t count, const char* const string[], const int length[],
- TParseContext* context) {
- yyrestart(NULL, context->scanner);
- yyset_column(0, context->scanner);
- yyset_lineno(1, context->scanner);
-
- // Initialize preprocessor.
- if (!context->preprocessor.init(count, string, length))
- return 1;
- context->preprocessor.setMaxTokenLength(SH_MAX_TOKEN_LENGTH);
-
- // Define extension macros.
- const TExtensionBehavior& extBehavior = context->extensionBehavior();
- for (TExtensionBehavior::const_iterator iter = extBehavior.begin();
- iter != extBehavior.end(); ++iter) {
- context->preprocessor.predefineMacro(iter->first.c_str(), 1);
- }
- if (context->fragmentPrecisionHigh)
- context->preprocessor.predefineMacro("GL_FRAGMENT_PRECISION_HIGH", 1);
-
- return 0;
-}
-
diff --git a/chromium/third_party/angle/src/compiler/preprocessor/DiagnosticsBase.cpp b/chromium/third_party/angle/src/compiler/preprocessor/DiagnosticsBase.cpp
index a7ce862bcb4..cf60bc2349d 100644
--- a/chromium/third_party/angle/src/compiler/preprocessor/DiagnosticsBase.cpp
+++ b/chromium/third_party/angle/src/compiler/preprocessor/DiagnosticsBase.cpp
@@ -16,8 +16,8 @@ Diagnostics::~Diagnostics()
}
void Diagnostics::report(ID id,
- const SourceLocation& loc,
- const std::string& text)
+ const SourceLocation &loc,
+ const std::string &text)
{
// TODO(alokp): Keep a count of errors and warnings.
print(id, loc, text);
@@ -41,86 +41,86 @@ std::string Diagnostics::message(ID id)
{
// Errors begin.
case PP_INTERNAL_ERROR:
- return "internal error";
+ return "internal error";
case PP_OUT_OF_MEMORY:
- return "out of memory";
+ return "out of memory";
case PP_INVALID_CHARACTER:
- return "invalid character";
+ return "invalid character";
case PP_INVALID_NUMBER:
- return "invalid number";
+ return "invalid number";
case PP_INTEGER_OVERFLOW:
- return "integer overflow";
+ return "integer overflow";
case PP_FLOAT_OVERFLOW:
- return "float overflow";
+ return "float overflow";
case PP_TOKEN_TOO_LONG:
- return "token too long";
+ return "token too long";
case PP_INVALID_EXPRESSION:
- return "invalid expression";
+ return "invalid expression";
case PP_DIVISION_BY_ZERO:
- return "division by zero";
+ return "division by zero";
case PP_EOF_IN_COMMENT:
- return "unexpected end of file found in comment";
+ return "unexpected end of file found in comment";
case PP_UNEXPECTED_TOKEN:
- return "unexpected token";
+ return "unexpected token";
case PP_DIRECTIVE_INVALID_NAME:
- return "invalid directive name";
+ return "invalid directive name";
case PP_MACRO_NAME_RESERVED:
- return "macro name is reserved";
+ return "macro name is reserved";
case PP_MACRO_REDEFINED:
- return "macro redefined";
+ return "macro redefined";
case PP_MACRO_PREDEFINED_REDEFINED:
- return "predefined macro redefined";
+ return "predefined macro redefined";
case PP_MACRO_PREDEFINED_UNDEFINED:
- return "predefined macro undefined";
+ return "predefined macro undefined";
case PP_MACRO_UNTERMINATED_INVOCATION:
- return "unterminated macro invocation";
+ return "unterminated macro invocation";
case PP_MACRO_TOO_FEW_ARGS:
- return "Not enough arguments for macro";
+ return "Not enough arguments for macro";
case PP_MACRO_TOO_MANY_ARGS:
- return "Too many arguments for macro";
+ return "Too many arguments for macro";
case PP_CONDITIONAL_ENDIF_WITHOUT_IF:
- return "unexpected #endif found without a matching #if";
+ return "unexpected #endif found without a matching #if";
case PP_CONDITIONAL_ELSE_WITHOUT_IF:
- return "unexpected #else found without a matching #if";
+ return "unexpected #else found without a matching #if";
case PP_CONDITIONAL_ELSE_AFTER_ELSE:
- return "unexpected #else found after another #else";
+ return "unexpected #else found after another #else";
case PP_CONDITIONAL_ELIF_WITHOUT_IF:
- return "unexpected #elif found without a matching #if";
+ return "unexpected #elif found without a matching #if";
case PP_CONDITIONAL_ELIF_AFTER_ELSE:
- return "unexpected #elif found after #else";
+ return "unexpected #elif found after #else";
case PP_CONDITIONAL_UNTERMINATED:
- return "unexpected end of file found in conditional block";
+ return "unexpected end of file found in conditional block";
case PP_INVALID_EXTENSION_NAME:
- return "invalid extension name";
+ return "invalid extension name";
case PP_INVALID_EXTENSION_BEHAVIOR:
- return "invalid extension behavior";
+ return "invalid extension behavior";
case PP_INVALID_EXTENSION_DIRECTIVE:
- return "invalid extension directive";
+ return "invalid extension directive";
case PP_INVALID_VERSION_NUMBER:
- return "invalid version number";
+ return "invalid version number";
case PP_INVALID_VERSION_DIRECTIVE:
- return "invalid version directive";
+ return "invalid version directive";
case PP_VERSION_NOT_FIRST_STATEMENT:
return "#version directive must occur before anything else, "
"except for comments and white space";
case PP_INVALID_LINE_NUMBER:
- return "invalid line number";
+ return "invalid line number";
case PP_INVALID_FILE_NUMBER:
- return "invalid file number";
+ return "invalid file number";
case PP_INVALID_LINE_DIRECTIVE:
- return "invalid line directive";
+ return "invalid line directive";
// Errors end.
// Warnings begin.
case PP_EOF_IN_DIRECTIVE:
- return "unexpected end of file found in directive";
+ return "unexpected end of file found in directive";
case PP_CONDITIONAL_UNEXPECTED_TOKEN:
- return "unexpected token after conditional expression";
+ return "unexpected token after conditional expression";
case PP_UNRECOGNIZED_PRAGMA:
- return "unrecognized pragma";
+ return "unrecognized pragma";
// Warnings end.
default:
- assert(false);
- return "";
+ assert(false);
+ return "";
}
}
diff --git a/chromium/third_party/angle/src/compiler/preprocessor/DiagnosticsBase.h b/chromium/third_party/angle/src/compiler/preprocessor/DiagnosticsBase.h
index 2c8c539137b..a7587ed6577 100644
--- a/chromium/third_party/angle/src/compiler/preprocessor/DiagnosticsBase.h
+++ b/chromium/third_party/angle/src/compiler/preprocessor/DiagnosticsBase.h
@@ -72,15 +72,15 @@ class Diagnostics
virtual ~Diagnostics();
- void report(ID id, const SourceLocation& loc, const std::string& text);
+ void report(ID id, const SourceLocation &loc, const std::string &text);
protected:
Severity severity(ID id);
std::string message(ID id);
virtual void print(ID id,
- const SourceLocation& loc,
- const std::string& text) = 0;
+ const SourceLocation &loc,
+ const std::string &text) = 0;
};
} // namespace pp
diff --git a/chromium/third_party/angle/src/compiler/preprocessor/DirectiveHandlerBase.h b/chromium/third_party/angle/src/compiler/preprocessor/DirectiveHandlerBase.h
index 2aaeec28180..040b25c6a24 100644
--- a/chromium/third_party/angle/src/compiler/preprocessor/DirectiveHandlerBase.h
+++ b/chromium/third_party/angle/src/compiler/preprocessor/DirectiveHandlerBase.h
@@ -23,19 +23,19 @@ class DirectiveHandler
public:
virtual ~DirectiveHandler();
- virtual void handleError(const SourceLocation& loc,
- const std::string& msg) = 0;
+ virtual void handleError(const SourceLocation &loc,
+ const std::string &msg) = 0;
// Handle pragma of form: #pragma name[(value)]
- virtual void handlePragma(const SourceLocation& loc,
- const std::string& name,
- const std::string& value) = 0;
+ virtual void handlePragma(const SourceLocation &loc,
+ const std::string &name,
+ const std::string &value) = 0;
- virtual void handleExtension(const SourceLocation& loc,
- const std::string& name,
- const std::string& behavior) = 0;
+ virtual void handleExtension(const SourceLocation &loc,
+ const std::string &name,
+ const std::string &behavior) = 0;
- virtual void handleVersion(const SourceLocation& loc,
+ virtual void handleVersion(const SourceLocation &loc,
int version) = 0;
};
diff --git a/chromium/third_party/angle/src/compiler/preprocessor/DirectiveParser.cpp b/chromium/third_party/angle/src/compiler/preprocessor/DirectiveParser.cpp
index ebec79804dc..6434d5cb5c8 100644
--- a/chromium/third_party/angle/src/compiler/preprocessor/DirectiveParser.cpp
+++ b/chromium/third_party/angle/src/compiler/preprocessor/DirectiveParser.cpp
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2011 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2011-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -35,9 +35,8 @@ enum DirectiveType
DIRECTIVE_VERSION,
DIRECTIVE_LINE
};
-} // namespace
-static DirectiveType getDirective(const pp::Token* token)
+DirectiveType getDirective(const pp::Token *token)
{
static const std::string kDirectiveDefine("define");
static const std::string kDirectiveUndef("undef");
@@ -58,35 +57,35 @@ static DirectiveType getDirective(const pp::Token* token)
if (token->text == kDirectiveDefine)
return DIRECTIVE_DEFINE;
- else if (token->text == kDirectiveUndef)
+ if (token->text == kDirectiveUndef)
return DIRECTIVE_UNDEF;
- else if (token->text == kDirectiveIf)
+ if (token->text == kDirectiveIf)
return DIRECTIVE_IF;
- else if (token->text == kDirectiveIfdef)
+ if (token->text == kDirectiveIfdef)
return DIRECTIVE_IFDEF;
- else if (token->text == kDirectiveIfndef)
+ if (token->text == kDirectiveIfndef)
return DIRECTIVE_IFNDEF;
- else if (token->text == kDirectiveElse)
+ if (token->text == kDirectiveElse)
return DIRECTIVE_ELSE;
- else if (token->text == kDirectiveElif)
+ if (token->text == kDirectiveElif)
return DIRECTIVE_ELIF;
- else if (token->text == kDirectiveEndif)
+ if (token->text == kDirectiveEndif)
return DIRECTIVE_ENDIF;
- else if (token->text == kDirectiveError)
+ if (token->text == kDirectiveError)
return DIRECTIVE_ERROR;
- else if (token->text == kDirectivePragma)
+ if (token->text == kDirectivePragma)
return DIRECTIVE_PRAGMA;
- else if (token->text == kDirectiveExtension)
+ if (token->text == kDirectiveExtension)
return DIRECTIVE_EXTENSION;
- else if (token->text == kDirectiveVersion)
+ if (token->text == kDirectiveVersion)
return DIRECTIVE_VERSION;
- else if (token->text == kDirectiveLine)
+ if (token->text == kDirectiveLine)
return DIRECTIVE_LINE;
return DIRECTIVE_NONE;
}
-static bool isConditionalDirective(DirectiveType directive)
+bool isConditionalDirective(DirectiveType directive)
{
switch (directive)
{
@@ -103,12 +102,12 @@ static bool isConditionalDirective(DirectiveType directive)
}
// Returns true if the token represents End Of Directive.
-static bool isEOD(const pp::Token* token)
+bool isEOD(const pp::Token *token)
{
return (token->type == '\n') || (token->type == pp::Token::LAST);
}
-static void skipUntilEOD(pp::Lexer* lexer, pp::Token* token)
+void skipUntilEOD(pp::Lexer *lexer, pp::Token *token)
{
while(!isEOD(token))
{
@@ -116,7 +115,7 @@ static void skipUntilEOD(pp::Lexer* lexer, pp::Token* token)
}
}
-static bool isMacroNameReserved(const std::string& name)
+bool isMacroNameReserved(const std::string &name)
{
// Names prefixed with "GL_" are reserved.
if (name.substr(0, 3) == "GL_")
@@ -129,30 +128,32 @@ static bool isMacroNameReserved(const std::string& name)
return false;
}
-static bool isMacroPredefined(const std::string& name,
- const pp::MacroSet& macroSet)
+bool isMacroPredefined(const std::string &name,
+ const pp::MacroSet &macroSet)
{
pp::MacroSet::const_iterator iter = macroSet.find(name);
return iter != macroSet.end() ? iter->second.predefined : false;
}
+} // namespace anonymous
+
namespace pp
{
class DefinedParser : public Lexer
{
public:
- DefinedParser(Lexer* lexer,
- const MacroSet* macroSet,
- Diagnostics* diagnostics) :
- mLexer(lexer),
- mMacroSet(macroSet),
- mDiagnostics(diagnostics)
+ DefinedParser(Lexer *lexer,
+ const MacroSet *macroSet,
+ Diagnostics *diagnostics)
+ : mLexer(lexer),
+ mMacroSet(macroSet),
+ mDiagnostics(diagnostics)
{
}
protected:
- virtual void lex(Token* token)
+ virtual void lex(Token *token)
{
static const std::string kDefined("defined");
@@ -199,24 +200,24 @@ class DefinedParser : public Lexer
}
private:
- Lexer* mLexer;
- const MacroSet* mMacroSet;
- Diagnostics* mDiagnostics;
+ Lexer *mLexer;
+ const MacroSet *mMacroSet;
+ Diagnostics *mDiagnostics;
};
-DirectiveParser::DirectiveParser(Tokenizer* tokenizer,
- MacroSet* macroSet,
- Diagnostics* diagnostics,
- DirectiveHandler* directiveHandler) :
- mPastFirstStatement(false),
- mTokenizer(tokenizer),
- mMacroSet(macroSet),
- mDiagnostics(diagnostics),
- mDirectiveHandler(directiveHandler)
+DirectiveParser::DirectiveParser(Tokenizer *tokenizer,
+ MacroSet *macroSet,
+ Diagnostics *diagnostics,
+ DirectiveHandler *directiveHandler)
+ : mPastFirstStatement(false),
+ mTokenizer(tokenizer),
+ mMacroSet(macroSet),
+ mDiagnostics(diagnostics),
+ mDirectiveHandler(directiveHandler)
{
}
-void DirectiveParser::lex(Token* token)
+void DirectiveParser::lex(Token *token)
{
do
{
@@ -232,19 +233,20 @@ void DirectiveParser::lex(Token* token)
{
if (!mConditionalStack.empty())
{
- const ConditionalBlock& block = mConditionalStack.back();
+ const ConditionalBlock &block = mConditionalStack.back();
mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNTERMINATED,
block.location, block.type);
}
break;
}
- } while (skipping() || (token->type == '\n'));
+ }
+ while (skipping() || (token->type == '\n'));
mPastFirstStatement = true;
}
-void DirectiveParser::parseDirective(Token* token)
+void DirectiveParser::parseDirective(Token *token)
{
assert(token->type == Token::PP_HASH);
@@ -324,7 +326,7 @@ void DirectiveParser::parseDirective(Token* token)
}
}
-void DirectiveParser::parseDefine(Token* token)
+void DirectiveParser::parseDefine(Token *token)
{
assert(getDirective(token) == DIRECTIVE_DEFINE);
@@ -357,14 +359,16 @@ void DirectiveParser::parseDefine(Token* token)
{
// Function-like macro. Collect arguments.
macro.type = Macro::kTypeFunc;
- do {
+ do
+ {
mTokenizer->lex(token);
if (token->type != Token::IDENTIFIER)
break;
macro.parameters.push_back(token->text);
mTokenizer->lex(token); // Get ','.
- } while (token->type == ',');
+ }
+ while (token->type == ',');
if (token->type != ')')
{
@@ -404,7 +408,7 @@ void DirectiveParser::parseDefine(Token* token)
mMacroSet->insert(std::make_pair(macro.name, macro));
}
-void DirectiveParser::parseUndef(Token* token)
+void DirectiveParser::parseUndef(Token *token)
{
assert(getDirective(token) == DIRECTIVE_UNDEF);
@@ -433,25 +437,25 @@ void DirectiveParser::parseUndef(Token* token)
mTokenizer->lex(token);
}
-void DirectiveParser::parseIf(Token* token)
+void DirectiveParser::parseIf(Token *token)
{
assert(getDirective(token) == DIRECTIVE_IF);
parseConditionalIf(token);
}
-void DirectiveParser::parseIfdef(Token* token)
+void DirectiveParser::parseIfdef(Token *token)
{
assert(getDirective(token) == DIRECTIVE_IFDEF);
parseConditionalIf(token);
}
-void DirectiveParser::parseIfndef(Token* token)
+void DirectiveParser::parseIfndef(Token *token)
{
assert(getDirective(token) == DIRECTIVE_IFNDEF);
parseConditionalIf(token);
}
-void DirectiveParser::parseElse(Token* token)
+void DirectiveParser::parseElse(Token *token)
{
assert(getDirective(token) == DIRECTIVE_ELSE);
@@ -463,7 +467,7 @@ void DirectiveParser::parseElse(Token* token)
return;
}
- ConditionalBlock& block = mConditionalStack.back();
+ ConditionalBlock &block = mConditionalStack.back();
if (block.skipBlock)
{
// No diagnostics. Just skip the whole line.
@@ -492,7 +496,7 @@ void DirectiveParser::parseElse(Token* token)
}
}
-void DirectiveParser::parseElif(Token* token)
+void DirectiveParser::parseElif(Token *token)
{
assert(getDirective(token) == DIRECTIVE_ELIF);
@@ -504,7 +508,7 @@ void DirectiveParser::parseElif(Token* token)
return;
}
- ConditionalBlock& block = mConditionalStack.back();
+ ConditionalBlock &block = mConditionalStack.back();
if (block.skipBlock)
{
// No diagnostics. Just skip the whole line.
@@ -532,7 +536,7 @@ void DirectiveParser::parseElif(Token* token)
block.foundValidGroup = expression != 0;
}
-void DirectiveParser::parseEndif(Token* token)
+void DirectiveParser::parseEndif(Token *token)
{
assert(getDirective(token) == DIRECTIVE_ENDIF);
@@ -556,7 +560,7 @@ void DirectiveParser::parseEndif(Token* token)
}
}
-void DirectiveParser::parseError(Token* token)
+void DirectiveParser::parseError(Token *token)
{
assert(getDirective(token) == DIRECTIVE_ERROR);
@@ -571,7 +575,7 @@ void DirectiveParser::parseError(Token* token)
}
// Parses pragma of form: #pragma name[(value)].
-void DirectiveParser::parsePragma(Token* token)
+void DirectiveParser::parsePragma(Token *token)
{
assert(getDirective(token) == DIRECTIVE_PRAGMA);
@@ -627,7 +631,7 @@ void DirectiveParser::parsePragma(Token* token)
}
}
-void DirectiveParser::parseExtension(Token* token)
+void DirectiveParser::parseExtension(Token *token)
{
assert(getDirective(token) == DIRECTIVE_EXTENSION);
@@ -694,7 +698,7 @@ void DirectiveParser::parseExtension(Token* token)
mDirectiveHandler->handleExtension(token->location, name, behavior);
}
-void DirectiveParser::parseVersion(Token* token)
+void DirectiveParser::parseVersion(Token *token)
{
assert(getDirective(token) == DIRECTIVE_VERSION);
@@ -708,7 +712,9 @@ void DirectiveParser::parseVersion(Token* token)
enum State
{
- VERSION_NUMBER
+ VERSION_NUMBER,
+ VERSION_PROFILE,
+ VERSION_ENDLINE
};
bool valid = true;
@@ -716,12 +722,12 @@ void DirectiveParser::parseVersion(Token* token)
int state = VERSION_NUMBER;
mTokenizer->lex(token);
- while ((token->type != '\n') && (token->type != Token::LAST))
+ while (valid && (token->type != '\n') && (token->type != Token::LAST))
{
- switch (state++)
+ switch (state)
{
case VERSION_NUMBER:
- if (valid && (token->type != Token::CONST_INT))
+ if (token->type != Token::CONST_INT)
{
mDiagnostics->report(Diagnostics::PP_INVALID_VERSION_NUMBER,
token->location, token->text);
@@ -733,29 +739,44 @@ void DirectiveParser::parseVersion(Token* token)
token->location, token->text);
valid = false;
}
- break;
- default:
if (valid)
{
- mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
+ state = (version < 300) ? VERSION_ENDLINE : VERSION_PROFILE;
+ }
+ break;
+ case VERSION_PROFILE:
+ if (token->type != Token::IDENTIFIER || token->text != "es")
+ {
+ mDiagnostics->report(Diagnostics::PP_INVALID_VERSION_DIRECTIVE,
token->location, token->text);
valid = false;
}
+ state = VERSION_ENDLINE;
+ break;
+ default:
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
+ token->location, token->text);
+ valid = false;
break;
}
+
mTokenizer->lex(token);
}
- if (valid && (state != VERSION_NUMBER + 1))
+
+ if (valid && (state != VERSION_ENDLINE))
{
mDiagnostics->report(Diagnostics::PP_INVALID_VERSION_DIRECTIVE,
token->location, token->text);
valid = false;
}
+
if (valid)
+ {
mDirectiveHandler->handleVersion(token->location, version);
+ }
}
-void DirectiveParser::parseLine(Token* token)
+void DirectiveParser::parseLine(Token *token)
{
assert(getDirective(token) == DIRECTIVE_LINE);
@@ -824,19 +845,21 @@ void DirectiveParser::parseLine(Token* token)
if (valid)
{
mTokenizer->setLineNumber(line);
- if (state == FILE_NUMBER + 1) mTokenizer->setFileNumber(file);
+ if (state == FILE_NUMBER + 1)
+ mTokenizer->setFileNumber(file);
}
}
bool DirectiveParser::skipping() const
{
- if (mConditionalStack.empty()) return false;
+ if (mConditionalStack.empty())
+ return false;
const ConditionalBlock& block = mConditionalStack.back();
return block.skipBlock || block.skipGroup;
}
-void DirectiveParser::parseConditionalIf(Token* token)
+void DirectiveParser::parseConditionalIf(Token *token)
{
ConditionalBlock block;
block.type = token->text;
@@ -877,7 +900,7 @@ void DirectiveParser::parseConditionalIf(Token* token)
mConditionalStack.push_back(block);
}
-int DirectiveParser::parseExpressionIf(Token* token)
+int DirectiveParser::parseExpressionIf(Token *token)
{
assert((getDirective(token) == DIRECTIVE_IF) ||
(getDirective(token) == DIRECTIVE_ELIF));
@@ -901,7 +924,7 @@ int DirectiveParser::parseExpressionIf(Token* token)
return expression;
}
-int DirectiveParser::parseExpressionIfdef(Token* token)
+int DirectiveParser::parseExpressionIfdef(Token *token)
{
assert((getDirective(token) == DIRECTIVE_IFDEF) ||
(getDirective(token) == DIRECTIVE_IFNDEF));
diff --git a/chromium/third_party/angle/src/compiler/preprocessor/DirectiveParser.h b/chromium/third_party/angle/src/compiler/preprocessor/DirectiveParser.h
index 8a7f0072bae..335091781c1 100644
--- a/chromium/third_party/angle/src/compiler/preprocessor/DirectiveParser.h
+++ b/chromium/third_party/angle/src/compiler/preprocessor/DirectiveParser.h
@@ -22,35 +22,35 @@ class Tokenizer;
class DirectiveParser : public Lexer
{
public:
- DirectiveParser(Tokenizer* tokenizer,
- MacroSet* macroSet,
- Diagnostics* diagnostics,
- DirectiveHandler* directiveHandler);
+ DirectiveParser(Tokenizer *tokenizer,
+ MacroSet *macroSet,
+ Diagnostics *diagnostics,
+ DirectiveHandler *directiveHandler);
- virtual void lex(Token* token);
+ virtual void lex(Token *token);
private:
PP_DISALLOW_COPY_AND_ASSIGN(DirectiveParser);
- void parseDirective(Token* token);
- void parseDefine(Token* token);
- void parseUndef(Token* token);
- void parseIf(Token* token);
- void parseIfdef(Token* token);
- void parseIfndef(Token* token);
- void parseElse(Token* token);
- void parseElif(Token* token);
- void parseEndif(Token* token);
- void parseError(Token* token);
- void parsePragma(Token* token);
- void parseExtension(Token* token);
- void parseVersion(Token* token);
- void parseLine(Token* token);
+ void parseDirective(Token *token);
+ void parseDefine(Token *token);
+ void parseUndef(Token *token);
+ void parseIf(Token *token);
+ void parseIfdef(Token *token);
+ void parseIfndef(Token *token);
+ void parseElse(Token *token);
+ void parseElif(Token *token);
+ void parseEndif(Token *token);
+ void parseError(Token *token);
+ void parsePragma(Token *token);
+ void parseExtension(Token *token);
+ void parseVersion(Token *token);
+ void parseLine(Token *token);
bool skipping() const;
- void parseConditionalIf(Token* token);
- int parseExpressionIf(Token* token);
- int parseExpressionIfdef(Token* token);
+ void parseConditionalIf(Token *token);
+ int parseExpressionIf(Token *token);
+ int parseExpressionIfdef(Token *token);
struct ConditionalBlock
{
@@ -61,20 +61,20 @@ class DirectiveParser : public Lexer
bool foundValidGroup;
bool foundElseGroup;
- ConditionalBlock() :
- skipBlock(false),
- skipGroup(false),
- foundValidGroup(false),
- foundElseGroup(false)
+ ConditionalBlock()
+ : skipBlock(false),
+ skipGroup(false),
+ foundValidGroup(false),
+ foundElseGroup(false)
{
}
};
bool mPastFirstStatement;
std::vector<ConditionalBlock> mConditionalStack;
- Tokenizer* mTokenizer;
- MacroSet* mMacroSet;
- Diagnostics* mDiagnostics;
- DirectiveHandler* mDirectiveHandler;
+ Tokenizer *mTokenizer;
+ MacroSet *mMacroSet;
+ Diagnostics *mDiagnostics;
+ DirectiveHandler *mDirectiveHandler;
};
} // namespace pp
diff --git a/chromium/third_party/angle/src/compiler/preprocessor/ExpressionParser.cpp b/chromium/third_party/angle/src/compiler/preprocessor/ExpressionParser.cpp
index 2d374961845..f4126380876 100644
--- a/chromium/third_party/angle/src/compiler/preprocessor/ExpressionParser.cpp
+++ b/chromium/third_party/angle/src/compiler/preprocessor/ExpressionParser.cpp
@@ -1,8 +1,8 @@
-/* A Bison parser, made by GNU Bison 2.7. */
+/* A Bison parser, made by GNU Bison 2.7.1. */
/* Bison implementation for Yacc-like parsers in C
- Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -44,7 +44,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "2.7"
+#define YYBISON_VERSION "2.7.1"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -264,6 +264,14 @@ typedef short int yytype_int16;
# endif
#endif
+#ifndef __attribute__
+/* This feature is available in gcc versions 2.5 and later. */
+# if (! defined __GNUC__ || __GNUC__ < 2 \
+ || (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
+# define __attribute__(Spec) /* empty */
+# endif
+#endif
+
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
# define YYUSE(E) ((void) (E))
@@ -271,6 +279,7 @@ typedef short int yytype_int16;
# define YYUSE(E) /* empty */
#endif
+
/* Identity function, used to suppress warnings about constant conditions. */
#ifndef lint
# define YYID(N) (N)
@@ -501,9 +510,9 @@ static const yytype_int8 yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
- 0, 91, 91, 98, 99, 102, 105, 108, 111, 114,
- 117, 120, 123, 126, 129, 132, 135, 138, 141, 144,
- 157, 170, 173, 176, 179, 182, 185
+ 0, 97, 97, 104, 105, 108, 111, 114, 117, 120,
+ 123, 126, 129, 132, 135, 138, 141, 144, 147, 150,
+ 163, 176, 179, 182, 185, 188, 191
};
#endif
@@ -768,11 +777,7 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, context)
# else
YYUSE (yyoutput);
# endif
- switch (yytype)
- {
- default:
- break;
- }
+ YYUSE (yytype);
}
@@ -1166,12 +1171,7 @@ yydestruct (yymsg, yytype, yyvaluep, context)
yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
- switch (yytype)
- {
-
- default:
- break;
- }
+ YYUSE (yytype);
}
@@ -1891,15 +1891,14 @@ yyreturn:
-int yylex(YYSTYPE* lvalp, Context* context)
+int yylex(YYSTYPE *lvalp, Context *context)
{
int type = 0;
- pp::Token* token = context->token;
+ pp::Token *token = context->token;
switch (token->type)
{
- case pp::Token::CONST_INT:
- {
+ case pp::Token::CONST_INT: {
unsigned int val = 0;
if (!token->uValue(&val))
{
@@ -1910,39 +1909,59 @@ int yylex(YYSTYPE* lvalp, Context* context)
type = TOK_CONST_INT;
break;
}
- case pp::Token::OP_OR: type = TOK_OP_OR; break;
- case pp::Token::OP_AND: type = TOK_OP_AND; break;
- case pp::Token::OP_NE: type = TOK_OP_NE; break;
- case pp::Token::OP_EQ: type = TOK_OP_EQ; break;
- case pp::Token::OP_GE: type = TOK_OP_GE; break;
- case pp::Token::OP_LE: type = TOK_OP_LE; break;
- case pp::Token::OP_RIGHT: type = TOK_OP_RIGHT; break;
- case pp::Token::OP_LEFT: type = TOK_OP_LEFT; break;
- case '|': type = '|'; break;
- case '^': type = '^'; break;
- case '&': type = '&'; break;
- case '>': type = '>'; break;
- case '<': type = '<'; break;
- case '-': type = '-'; break;
- case '+': type = '+'; break;
- case '%': type = '%'; break;
- case '/': type = '/'; break;
- case '*': type = '*'; break;
- case '!': type = '!'; break;
- case '~': type = '~'; break;
- case '(': type = '('; break;
- case ')': type = ')'; break;
+ case pp::Token::OP_OR:
+ type = TOK_OP_OR;
+ break;
+ case pp::Token::OP_AND:
+ type = TOK_OP_AND;
+ break;
+ case pp::Token::OP_NE:
+ type = TOK_OP_NE;
+ break;
+ case pp::Token::OP_EQ:
+ type = TOK_OP_EQ;
+ break;
+ case pp::Token::OP_GE:
+ type = TOK_OP_GE;
+ break;
+ case pp::Token::OP_LE:
+ type = TOK_OP_LE;
+ break;
+ case pp::Token::OP_RIGHT:
+ type = TOK_OP_RIGHT;
+ break;
+ case pp::Token::OP_LEFT:
+ type = TOK_OP_LEFT;
+ break;
+ case '|':
+ case '^':
+ case '&':
+ case '>':
+ case '<':
+ case '-':
+ case '+':
+ case '%':
+ case '/':
+ case '*':
+ case '!':
+ case '~':
+ case '(':
+ case ')':
+ type = token->type;
+ break;
- default: break;
+ default:
+ break;
}
// Advance to the next token if the current one is valid.
- if (type != 0) context->lexer->lex(token);
+ if (type != 0)
+ context->lexer->lex(token);
return type;
}
-void yyerror(Context* context, const char* reason)
+void yyerror(Context *context, const char *reason)
{
context->diagnostics->report(pp::Diagnostics::PP_INVALID_EXPRESSION,
context->token->location,
@@ -1951,13 +1970,13 @@ void yyerror(Context* context, const char* reason)
namespace pp {
-ExpressionParser::ExpressionParser(Lexer* lexer, Diagnostics* diagnostics) :
- mLexer(lexer),
- mDiagnostics(diagnostics)
+ExpressionParser::ExpressionParser(Lexer *lexer, Diagnostics *diagnostics)
+ : mLexer(lexer),
+ mDiagnostics(diagnostics)
{
}
-bool ExpressionParser::parse(Token* token, int* result)
+bool ExpressionParser::parse(Token *token, int *result)
{
Context context;
context.diagnostics = mDiagnostics;
diff --git a/chromium/third_party/angle/src/compiler/preprocessor/ExpressionParser.h b/chromium/third_party/angle/src/compiler/preprocessor/ExpressionParser.h
index 092d059413b..f040cb01fa5 100644
--- a/chromium/third_party/angle/src/compiler/preprocessor/ExpressionParser.h
+++ b/chromium/third_party/angle/src/compiler/preprocessor/ExpressionParser.h
@@ -19,15 +19,15 @@ struct Token;
class ExpressionParser
{
public:
- ExpressionParser(Lexer* lexer, Diagnostics* diagnostics);
+ ExpressionParser(Lexer *lexer, Diagnostics *diagnostics);
- bool parse(Token* token, int* result);
+ bool parse(Token *token, int *result);
private:
PP_DISALLOW_COPY_AND_ASSIGN(ExpressionParser);
- Lexer* mLexer;
- Diagnostics* mDiagnostics;
+ Lexer *mLexer;
+ Diagnostics *mDiagnostics;
};
} // namespace pp
diff --git a/chromium/third_party/angle/src/compiler/preprocessor/ExpressionParser.y b/chromium/third_party/angle/src/compiler/preprocessor/ExpressionParser.y
index 27ed6ad5f2f..662a31b6500 100644
--- a/chromium/third_party/angle/src/compiler/preprocessor/ExpressionParser.y
+++ b/chromium/third_party/angle/src/compiler/preprocessor/ExpressionParser.y
@@ -152,7 +152,7 @@ expression
std::ostringstream stream;
stream << $1 << " % " << $3;
std::string text = stream.str();
- context->diagnostics->report(pp::Diagnostics::DIVISION_BY_ZERO,
+ context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
context->token->location,
text.c_str());
YYABORT;
@@ -165,7 +165,7 @@ expression
std::ostringstream stream;
stream << $1 << " / " << $3;
std::string text = stream.str();
- context->diagnostics->report(pp::Diagnostics::DIVISION_BY_ZERO,
+ context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
context->token->location,
text.c_str());
YYABORT;
@@ -195,73 +195,92 @@ expression
%%
-int yylex(YYSTYPE* lvalp, Context* context)
+int yylex(YYSTYPE *lvalp, Context *context)
{
int type = 0;
- pp::Token* token = context->token;
+ pp::Token *token = context->token;
switch (token->type)
{
- case pp::Token::CONST_INT:
- {
+ case pp::Token::CONST_INT: {
unsigned int val = 0;
if (!token->uValue(&val))
{
- context->diagnostics->report(pp::Diagnostics::INTEGER_OVERFLOW,
+ context->diagnostics->report(pp::Diagnostics::PP_INTEGER_OVERFLOW,
token->location, token->text);
}
*lvalp = static_cast<YYSTYPE>(val);
type = TOK_CONST_INT;
break;
}
- case pp::Token::OP_OR: type = TOK_OP_OR; break;
- case pp::Token::OP_AND: type = TOK_OP_AND; break;
- case pp::Token::OP_NE: type = TOK_OP_NE; break;
- case pp::Token::OP_EQ: type = TOK_OP_EQ; break;
- case pp::Token::OP_GE: type = TOK_OP_GE; break;
- case pp::Token::OP_LE: type = TOK_OP_LE; break;
- case pp::Token::OP_RIGHT: type = TOK_OP_RIGHT; break;
- case pp::Token::OP_LEFT: type = TOK_OP_LEFT; break;
- case '|': type = '|'; break;
- case '^': type = '^'; break;
- case '&': type = '&'; break;
- case '>': type = '>'; break;
- case '<': type = '<'; break;
- case '-': type = '-'; break;
- case '+': type = '+'; break;
- case '%': type = '%'; break;
- case '/': type = '/'; break;
- case '*': type = '*'; break;
- case '!': type = '!'; break;
- case '~': type = '~'; break;
- case '(': type = '('; break;
- case ')': type = ')'; break;
+ case pp::Token::OP_OR:
+ type = TOK_OP_OR;
+ break;
+ case pp::Token::OP_AND:
+ type = TOK_OP_AND;
+ break;
+ case pp::Token::OP_NE:
+ type = TOK_OP_NE;
+ break;
+ case pp::Token::OP_EQ:
+ type = TOK_OP_EQ;
+ break;
+ case pp::Token::OP_GE:
+ type = TOK_OP_GE;
+ break;
+ case pp::Token::OP_LE:
+ type = TOK_OP_LE;
+ break;
+ case pp::Token::OP_RIGHT:
+ type = TOK_OP_RIGHT;
+ break;
+ case pp::Token::OP_LEFT:
+ type = TOK_OP_LEFT;
+ break;
+ case '|':
+ case '^':
+ case '&':
+ case '>':
+ case '<':
+ case '-':
+ case '+':
+ case '%':
+ case '/':
+ case '*':
+ case '!':
+ case '~':
+ case '(':
+ case ')':
+ type = token->type;
+ break;
- default: break;
+ default:
+ break;
}
// Advance to the next token if the current one is valid.
- if (type != 0) context->lexer->lex(token);
+ if (type != 0)
+ context->lexer->lex(token);
return type;
}
-void yyerror(Context* context, const char* reason)
+void yyerror(Context *context, const char *reason)
{
- context->diagnostics->report(pp::Diagnostics::INVALID_EXPRESSION,
+ context->diagnostics->report(pp::Diagnostics::PP_INVALID_EXPRESSION,
context->token->location,
reason);
}
namespace pp {
-ExpressionParser::ExpressionParser(Lexer* lexer, Diagnostics* diagnostics) :
- mLexer(lexer),
- mDiagnostics(diagnostics)
+ExpressionParser::ExpressionParser(Lexer *lexer, Diagnostics *diagnostics)
+ : mLexer(lexer),
+ mDiagnostics(diagnostics)
{
}
-bool ExpressionParser::parse(Token* token, int* result)
+bool ExpressionParser::parse(Token *token, int *result)
{
Context context;
context.diagnostics = mDiagnostics;
@@ -276,12 +295,12 @@ bool ExpressionParser::parse(Token* token, int* result)
break;
case 2:
- mDiagnostics->report(Diagnostics::OUT_OF_MEMORY, token->location, "");
+ mDiagnostics->report(Diagnostics::PP_OUT_OF_MEMORY, token->location, "");
break;
default:
assert(false);
- mDiagnostics->report(Diagnostics::INTERNAL_ERROR, token->location, "");
+ mDiagnostics->report(Diagnostics::PP_INTERNAL_ERROR, token->location, "");
break;
}
diff --git a/chromium/third_party/angle/src/compiler/preprocessor/Input.cpp b/chromium/third_party/angle/src/compiler/preprocessor/Input.cpp
index b4d970a97d0..f9910a6cc31 100644
--- a/chromium/third_party/angle/src/compiler/preprocessor/Input.cpp
+++ b/chromium/third_party/angle/src/compiler/preprocessor/Input.cpp
@@ -17,7 +17,7 @@ Input::Input() : mCount(0), mString(0)
{
}
-Input::Input(size_t count, const char* const string[], const int length[]) :
+Input::Input(size_t count, const char *const string[], const int length[]) :
mCount(count),
mString(string)
{
@@ -29,7 +29,7 @@ Input::Input(size_t count, const char* const string[], const int length[]) :
}
}
-size_t Input::read(char* buf, size_t maxSize)
+size_t Input::read(char *buf, size_t maxSize)
{
size_t nRead = 0;
while ((nRead < maxSize) && (mReadLoc.sIndex < mCount))
diff --git a/chromium/third_party/angle/src/compiler/preprocessor/Input.h b/chromium/third_party/angle/src/compiler/preprocessor/Input.h
index 14b7597cb48..2ac4f0c1704 100644
--- a/chromium/third_party/angle/src/compiler/preprocessor/Input.h
+++ b/chromium/third_party/angle/src/compiler/preprocessor/Input.h
@@ -18,27 +18,40 @@ class Input
{
public:
Input();
- Input(size_t count, const char* const string[], const int length[]);
+ Input(size_t count, const char *const string[], const int length[]);
- size_t count() const { return mCount; }
- const char* string(size_t index) const { return mString[index]; }
- size_t length(size_t index) const { return mLength[index]; }
+ size_t count() const
+ {
+ return mCount;
+ }
+ const char *string(size_t index) const
+ {
+ return mString[index];
+ }
+ size_t length(size_t index) const
+ {
+ return mLength[index];
+ }
- size_t read(char* buf, size_t maxSize);
+ size_t read(char *buf, size_t maxSize);
struct Location
{
size_t sIndex; // String index;
size_t cIndex; // Char index.
- Location() : sIndex(0), cIndex(0) { }
+ Location()
+ : sIndex(0),
+ cIndex(0)
+ {
+ }
};
- const Location& readLoc() const { return mReadLoc; }
+ const Location &readLoc() const { return mReadLoc; }
private:
// Input.
size_t mCount;
- const char* const* mString;
+ const char * const *mString;
std::vector<size_t> mLength;
Location mReadLoc;
diff --git a/chromium/third_party/angle/src/compiler/preprocessor/Lexer.h b/chromium/third_party/angle/src/compiler/preprocessor/Lexer.h
index eb85cea8734..d42d3db7e09 100644
--- a/chromium/third_party/angle/src/compiler/preprocessor/Lexer.h
+++ b/chromium/third_party/angle/src/compiler/preprocessor/Lexer.h
@@ -17,7 +17,7 @@ class Lexer
public:
virtual ~Lexer();
- virtual void lex(Token* token) = 0;
+ virtual void lex(Token *token) = 0;
};
} // namespace pp
diff --git a/chromium/third_party/angle/src/compiler/preprocessor/Macro.cpp b/chromium/third_party/angle/src/compiler/preprocessor/Macro.cpp
index b2e3088e32b..13cb14e3dc8 100644
--- a/chromium/third_party/angle/src/compiler/preprocessor/Macro.cpp
+++ b/chromium/third_party/angle/src/compiler/preprocessor/Macro.cpp
@@ -11,7 +11,7 @@
namespace pp
{
-bool Macro::equals(const Macro& other) const
+bool Macro::equals(const Macro &other) const
{
return (type == other.type) &&
(name == other.name) &&
diff --git a/chromium/third_party/angle/src/compiler/preprocessor/Macro.h b/chromium/third_party/angle/src/compiler/preprocessor/Macro.h
index 7ec01491166..b77e7bc15c2 100644
--- a/chromium/third_party/angle/src/compiler/preprocessor/Macro.h
+++ b/chromium/third_party/angle/src/compiler/preprocessor/Macro.h
@@ -26,8 +26,13 @@ struct Macro
typedef std::vector<std::string> Parameters;
typedef std::vector<Token> Replacements;
- Macro() : predefined(false), disabled(false), type(kTypeObj) { }
- bool equals(const Macro& other) const;
+ Macro()
+ : predefined(false),
+ disabled(false),
+ type(kTypeObj)
+ {
+ }
+ bool equals(const Macro &other) const;
bool predefined;
mutable bool disabled;
diff --git a/chromium/third_party/angle/src/compiler/preprocessor/MacroExpander.cpp b/chromium/third_party/angle/src/compiler/preprocessor/MacroExpander.cpp
index b789260af91..d7e0c834657 100644
--- a/chromium/third_party/angle/src/compiler/preprocessor/MacroExpander.cpp
+++ b/chromium/third_party/angle/src/compiler/preprocessor/MacroExpander.cpp
@@ -20,13 +20,13 @@ class TokenLexer : public Lexer
public:
typedef std::vector<Token> TokenVector;
- TokenLexer(TokenVector* tokens)
+ TokenLexer(TokenVector *tokens)
{
tokens->swap(mTokens);
mIter = mTokens.begin();
}
- virtual void lex(Token* token)
+ virtual void lex(Token *token)
{
if (mIter == mTokens.end())
{
@@ -46,12 +46,12 @@ class TokenLexer : public Lexer
TokenVector::const_iterator mIter;
};
-MacroExpander::MacroExpander(Lexer* lexer,
- MacroSet* macroSet,
- Diagnostics* diagnostics) :
- mLexer(lexer),
- mMacroSet(macroSet),
- mDiagnostics(diagnostics)
+MacroExpander::MacroExpander(Lexer *lexer,
+ MacroSet *macroSet,
+ Diagnostics *diagnostics)
+ : mLexer(lexer),
+ mMacroSet(macroSet),
+ mDiagnostics(diagnostics)
{
}
@@ -63,7 +63,7 @@ MacroExpander::~MacroExpander()
}
}
-void MacroExpander::lex(Token* token)
+void MacroExpander::lex(Token *token)
{
while (true)
{
@@ -97,7 +97,7 @@ void MacroExpander::lex(Token* token)
}
}
-void MacroExpander::getToken(Token* token)
+void MacroExpander::getToken(Token *token)
{
if (mReserveToken.get())
{
@@ -122,11 +122,11 @@ void MacroExpander::getToken(Token* token)
}
}
-void MacroExpander::ungetToken(const Token& token)
+void MacroExpander::ungetToken(const Token &token)
{
if (!mContextStack.empty())
{
- MacroContext* context = mContextStack.back();
+ MacroContext *context = mContextStack.back();
context->unget();
assert(context->replacements[context->index] == token);
}
@@ -148,7 +148,7 @@ bool MacroExpander::isNextTokenLeftParen()
return lparen;
}
-bool MacroExpander::pushMacro(const Macro& macro, const Token& identifier)
+bool MacroExpander::pushMacro(const Macro &macro, const Token &identifier)
{
assert(!macro.disabled);
assert(!identifier.expansionDisabled());
@@ -162,7 +162,7 @@ bool MacroExpander::pushMacro(const Macro& macro, const Token& identifier)
// Macro is disabled for expansion until it is popped off the stack.
macro.disabled = true;
- MacroContext* context = new MacroContext;
+ MacroContext *context = new MacroContext;
context->macro = &macro;
context->replacements.swap(replacements);
mContextStack.push_back(context);
@@ -173,7 +173,7 @@ void MacroExpander::popMacro()
{
assert(!mContextStack.empty());
- MacroContext* context = mContextStack.back();
+ MacroContext *context = mContextStack.back();
mContextStack.pop_back();
assert(context->empty());
@@ -182,9 +182,9 @@ void MacroExpander::popMacro()
delete context;
}
-bool MacroExpander::expandMacro(const Macro& macro,
- const Token& identifier,
- std::vector<Token>* replacements)
+bool MacroExpander::expandMacro(const Macro &macro,
+ const Token &identifier,
+ std::vector<Token> *replacements)
{
replacements->clear();
if (macro.type == Macro::kTypeObj)
@@ -239,9 +239,9 @@ bool MacroExpander::expandMacro(const Macro& macro,
return true;
}
-bool MacroExpander::collectMacroArgs(const Macro& macro,
- const Token& identifier,
- std::vector<MacroArg>* args)
+bool MacroExpander::collectMacroArgs(const Macro &macro,
+ const Token &identifier,
+ std::vector<MacroArg> *args)
{
Token token;
getToken(&token);
@@ -276,7 +276,8 @@ bool MacroExpander::collectMacroArgs(const Macro& macro,
// The individual arguments are separated by comma tokens, but
// the comma tokens between matching inner parentheses do not
// seperate arguments.
- if (openParens == 1) args->push_back(MacroArg());
+ if (openParens == 1)
+ args->push_back(MacroArg());
isArg = openParens != 1;
break;
default:
@@ -285,14 +286,15 @@ bool MacroExpander::collectMacroArgs(const Macro& macro,
}
if (isArg)
{
- MacroArg& arg = args->back();
+ MacroArg &arg = args->back();
// Initial whitespace is not part of the argument.
- if (arg.empty()) token.setHasLeadingSpace(false);
+ if (arg.empty())
+ token.setHasLeadingSpace(false);
arg.push_back(token);
}
}
- const Macro::Parameters& params = macro.parameters;
+ const Macro::Parameters &params = macro.parameters;
// If there is only one empty argument, it is equivalent to no argument.
if (params.empty() && (args->size() == 1) && args->front().empty())
{
@@ -313,7 +315,7 @@ bool MacroExpander::collectMacroArgs(const Macro& macro,
// inserted into the macro body.
for (std::size_t i = 0; i < args->size(); ++i)
{
- MacroArg& arg = args->at(i);
+ MacroArg &arg = args->at(i);
TokenLexer lexer(&arg);
MacroExpander expander(&lexer, mMacroSet, mDiagnostics);
@@ -328,13 +330,13 @@ bool MacroExpander::collectMacroArgs(const Macro& macro,
return true;
}
-void MacroExpander::replaceMacroParams(const Macro& macro,
- const std::vector<MacroArg>& args,
- std::vector<Token>* replacements)
+void MacroExpander::replaceMacroParams(const Macro &macro,
+ const std::vector<MacroArg> &args,
+ std::vector<Token> *replacements)
{
for (std::size_t i = 0; i < macro.replacements.size(); ++i)
{
- const Token& repl = macro.replacements[i];
+ const Token &repl = macro.replacements[i];
if (repl.type != Token::IDENTIFIER)
{
replacements->push_back(repl);
@@ -353,7 +355,7 @@ void MacroExpander::replaceMacroParams(const Macro& macro,
}
std::size_t iArg = std::distance(macro.parameters.begin(), iter);
- const MacroArg& arg = args[iArg];
+ const MacroArg &arg = args[iArg];
if (arg.empty())
{
continue;
diff --git a/chromium/third_party/angle/src/compiler/preprocessor/MacroExpander.h b/chromium/third_party/angle/src/compiler/preprocessor/MacroExpander.h
index 21b67571f19..d4fd0917868 100644
--- a/chromium/third_party/angle/src/compiler/preprocessor/MacroExpander.h
+++ b/chromium/third_party/angle/src/compiler/preprocessor/MacroExpander.h
@@ -23,51 +23,65 @@ class Diagnostics;
class MacroExpander : public Lexer
{
public:
- MacroExpander(Lexer* lexer, MacroSet* macroSet, Diagnostics* diagnostics);
+ MacroExpander(Lexer *lexer, MacroSet *macroSet, Diagnostics *diagnostics);
virtual ~MacroExpander();
- virtual void lex(Token* token);
+ virtual void lex(Token *token);
private:
PP_DISALLOW_COPY_AND_ASSIGN(MacroExpander);
- void getToken(Token* token);
- void ungetToken(const Token& token);
+ void getToken(Token *token);
+ void ungetToken(const Token &token);
bool isNextTokenLeftParen();
- bool pushMacro(const Macro& macro, const Token& identifier);
+ bool pushMacro(const Macro &macro, const Token &identifier);
void popMacro();
- bool expandMacro(const Macro& macro,
- const Token& identifier,
- std::vector<Token>* replacements);
+ bool expandMacro(const Macro &macro,
+ const Token &identifier,
+ std::vector<Token> *replacements);
typedef std::vector<Token> MacroArg;
- bool collectMacroArgs(const Macro& macro,
- const Token& identifier,
- std::vector<MacroArg>* args);
- void replaceMacroParams(const Macro& macro,
- const std::vector<MacroArg>& args,
- std::vector<Token>* replacements);
+ bool collectMacroArgs(const Macro &macro,
+ const Token &identifier,
+ std::vector<MacroArg> *args);
+ void replaceMacroParams(const Macro &macro,
+ const std::vector<MacroArg> &args,
+ std::vector<Token> *replacements);
struct MacroContext
{
- const Macro* macro;
+ const Macro *macro;
std::size_t index;
std::vector<Token> replacements;
- MacroContext() : macro(0), index(0) { }
- bool empty() const { return index == replacements.size(); }
- const Token& get() { return replacements[index++]; }
- void unget() { assert(index > 0); --index; }
+ MacroContext()
+ : macro(0),
+ index(0)
+ {
+ }
+ bool empty() const
+ {
+ return index == replacements.size();
+ }
+ const Token &get()
+ {
+ return replacements[index++];
+ }
+ void unget()
+ {
+ assert(index > 0);
+ --index;
+ }
};
- Lexer* mLexer;
- MacroSet* mMacroSet;
- Diagnostics* mDiagnostics;
+ Lexer *mLexer;
+ MacroSet *mMacroSet;
+ Diagnostics *mDiagnostics;
std::auto_ptr<Token> mReserveToken;
- std::vector<MacroContext*> mContextStack;
+ std::vector<MacroContext *> mContextStack;
};
} // namespace pp
diff --git a/chromium/third_party/angle/src/compiler/preprocessor/Preprocessor.cpp b/chromium/third_party/angle/src/compiler/preprocessor/Preprocessor.cpp
index 580ffba459f..3522fa1abb9 100644
--- a/chromium/third_party/angle/src/compiler/preprocessor/Preprocessor.cpp
+++ b/chromium/third_party/angle/src/compiler/preprocessor/Preprocessor.cpp
@@ -21,24 +21,24 @@ namespace pp
struct PreprocessorImpl
{
- Diagnostics* diagnostics;
+ Diagnostics *diagnostics;
MacroSet macroSet;
Tokenizer tokenizer;
DirectiveParser directiveParser;
MacroExpander macroExpander;
- PreprocessorImpl(Diagnostics* diag,
- DirectiveHandler* directiveHandler) :
- diagnostics(diag),
- tokenizer(diag),
- directiveParser(&tokenizer, &macroSet, diag, directiveHandler),
- macroExpander(&directiveParser, &macroSet, diag)
+ PreprocessorImpl(Diagnostics *diag,
+ DirectiveHandler *directiveHandler)
+ : diagnostics(diag),
+ tokenizer(diag),
+ directiveParser(&tokenizer, &macroSet, diag, directiveHandler),
+ macroExpander(&directiveParser, &macroSet, diag)
{
}
};
-Preprocessor::Preprocessor(Diagnostics* diagnostics,
- DirectiveHandler* directiveHandler)
+Preprocessor::Preprocessor(Diagnostics *diagnostics,
+ DirectiveHandler *directiveHandler)
{
mImpl = new PreprocessorImpl(diagnostics, directiveHandler);
}
@@ -49,7 +49,7 @@ Preprocessor::~Preprocessor()
}
bool Preprocessor::init(size_t count,
- const char* const string[],
+ const char * const string[],
const int length[])
{
static const int kGLSLVersion = 100;
@@ -63,7 +63,7 @@ bool Preprocessor::init(size_t count,
return mImpl->tokenizer.init(count, string, length);
}
-void Preprocessor::predefineMacro(const char* name, int value)
+void Preprocessor::predefineMacro(const char *name, int value)
{
std::ostringstream stream;
stream << value;
@@ -81,12 +81,7 @@ void Preprocessor::predefineMacro(const char* name, int value)
mImpl->macroSet[name] = macro;
}
-void Preprocessor::setMaxTokenLength(size_t maxLength)
-{
- mImpl->tokenizer.setMaxTokenLength(maxLength);
-}
-
-void Preprocessor::lex(Token* token)
+void Preprocessor::lex(Token *token)
{
bool validToken = false;
while (!validToken)
@@ -115,5 +110,9 @@ void Preprocessor::lex(Token* token)
}
}
-} // namespace pp
+void Preprocessor::setMaxTokenSize(size_t maxTokenSize)
+{
+ mImpl->tokenizer.setMaxTokenSize(maxTokenSize);
+}
+} // namespace pp
diff --git a/chromium/third_party/angle/src/compiler/preprocessor/Preprocessor.h b/chromium/third_party/angle/src/compiler/preprocessor/Preprocessor.h
index 9a90d79a1a1..0a55f1c9c16 100644
--- a/chromium/third_party/angle/src/compiler/preprocessor/Preprocessor.h
+++ b/chromium/third_party/angle/src/compiler/preprocessor/Preprocessor.h
@@ -22,7 +22,7 @@ struct Token;
class Preprocessor
{
public:
- Preprocessor(Diagnostics* diagnostics, DirectiveHandler* directiveHandler);
+ Preprocessor(Diagnostics *diagnostics, DirectiveHandler *directiveHandler);
~Preprocessor();
// count: specifies the number of elements in the string and length arrays.
@@ -34,22 +34,19 @@ class Preprocessor
// Each element in the length array may contain the length of the
// corresponding string or a value less than 0 to indicate that the string
// is null terminated.
- bool init(size_t count, const char* const string[], const int length[]);
+ bool init(size_t count, const char * const string[], const int length[]);
// Adds a pre-defined macro.
- void predefineMacro(const char* name, int value);
- // Sets maximum allowed token length.
- // If token length exceeds this limit,
- // the token text will be truncated to the given maximum length, and
- // TOKEN_TOO_LONG diagnostic will be generated.
- // The maximum length defaults to 256.
- void setMaxTokenLength(size_t maxLength);
+ void predefineMacro(const char *name, int value);
- void lex(Token* token);
+ void lex(Token *token);
+
+ // Set maximum preprocessor token size
+ void setMaxTokenSize(size_t maxTokenSize);
private:
PP_DISALLOW_COPY_AND_ASSIGN(Preprocessor);
- PreprocessorImpl* mImpl;
+ PreprocessorImpl *mImpl;
};
} // namespace pp
diff --git a/chromium/third_party/angle/src/compiler/preprocessor/SourceLocation.h b/chromium/third_party/angle/src/compiler/preprocessor/SourceLocation.h
index 6982613ac74..d4c1a5e1788 100644
--- a/chromium/third_party/angle/src/compiler/preprocessor/SourceLocation.h
+++ b/chromium/third_party/angle/src/compiler/preprocessor/SourceLocation.h
@@ -12,10 +12,18 @@ namespace pp
struct SourceLocation
{
- SourceLocation() : file(0), line(0) { }
- SourceLocation(int f, int l) : file(f), line(l) { }
+ SourceLocation()
+ : file(0),
+ line(0)
+ {
+ }
+ SourceLocation(int f, int l)
+ : file(f),
+ line(l)
+ {
+ }
- bool equals(const SourceLocation& other) const
+ bool equals(const SourceLocation &other) const
{
return (file == other.file) && (line == other.line);
}
@@ -24,12 +32,12 @@ struct SourceLocation
int line;
};
-inline bool operator==(const SourceLocation& lhs, const SourceLocation& rhs)
+inline bool operator==(const SourceLocation &lhs, const SourceLocation &rhs)
{
return lhs.equals(rhs);
}
-inline bool operator!=(const SourceLocation& lhs, const SourceLocation& rhs)
+inline bool operator!=(const SourceLocation &lhs, const SourceLocation &rhs)
{
return !lhs.equals(rhs);
}
diff --git a/chromium/third_party/angle/src/compiler/preprocessor/Token.cpp b/chromium/third_party/angle/src/compiler/preprocessor/Token.cpp
index 67f50aa32ce..d102654747d 100644
--- a/chromium/third_party/angle/src/compiler/preprocessor/Token.cpp
+++ b/chromium/third_party/angle/src/compiler/preprocessor/Token.cpp
@@ -21,7 +21,7 @@ void Token::reset()
text.clear();
}
-bool Token::equals(const Token& other) const
+bool Token::equals(const Token &other) const
{
return (type == other.type) &&
(flags == other.flags) &&
@@ -53,25 +53,25 @@ void Token::setExpansionDisabled(bool disable)
flags &= ~EXPANSION_DISABLED;
}
-bool Token::iValue(int* value) const
+bool Token::iValue(int *value) const
{
assert(type == CONST_INT);
return numeric_lex_int(text, value);
}
-bool Token::uValue(unsigned int* value) const
+bool Token::uValue(unsigned int *value) const
{
assert(type == CONST_INT);
return numeric_lex_int(text, value);
}
-bool Token::fValue(float* value) const
+bool Token::fValue(float *value) const
{
assert(type == CONST_FLOAT);
return numeric_lex_float(text, value);
}
-std::ostream& operator<<(std::ostream& out, const Token& token)
+std::ostream &operator<<(std::ostream &out, const Token &token)
{
if (token.hasLeadingSpace())
out << " ";
diff --git a/chromium/third_party/angle/src/compiler/preprocessor/Token.h b/chromium/third_party/angle/src/compiler/preprocessor/Token.h
index 8b553aecb68..8832e279c74 100644
--- a/chromium/third_party/angle/src/compiler/preprocessor/Token.h
+++ b/chromium/third_party/angle/src/compiler/preprocessor/Token.h
@@ -62,27 +62,40 @@ struct Token
EXPANSION_DISABLED = 1 << 2
};
- Token() : type(0), flags(0) { }
+ Token()
+ : type(0),
+ flags(0)
+ {
+ }
void reset();
- bool equals(const Token& other) const;
+ bool equals(const Token &other) const;
// Returns true if this is the first token on line.
// It disregards any leading whitespace.
- bool atStartOfLine() const { return (flags & AT_START_OF_LINE) != 0; }
+ bool atStartOfLine() const
+ {
+ return (flags & AT_START_OF_LINE) != 0;
+ }
void setAtStartOfLine(bool start);
- bool hasLeadingSpace() const { return (flags & HAS_LEADING_SPACE) != 0; }
+ bool hasLeadingSpace() const
+ {
+ return (flags & HAS_LEADING_SPACE) != 0;
+ }
void setHasLeadingSpace(bool space);
- bool expansionDisabled() const { return (flags & EXPANSION_DISABLED) != 0; }
+ bool expansionDisabled() const
+ {
+ return (flags & EXPANSION_DISABLED) != 0;
+ }
void setExpansionDisabled(bool disable);
// Converts text into numeric value for CONST_INT and CONST_FLOAT token.
// Returns false if the parsed value cannot fit into an int or float.
- bool iValue(int* value) const;
- bool uValue(unsigned int* value) const;
- bool fValue(float* value) const;
+ bool iValue(int *value) const;
+ bool uValue(unsigned int *value) const;
+ bool fValue(float *value) const;
int type;
unsigned int flags;
@@ -90,17 +103,17 @@ struct Token
std::string text;
};
-inline bool operator==(const Token& lhs, const Token& rhs)
+inline bool operator==(const Token &lhs, const Token &rhs)
{
return lhs.equals(rhs);
}
-inline bool operator!=(const Token& lhs, const Token& rhs)
+inline bool operator!=(const Token &lhs, const Token &rhs)
{
return !lhs.equals(rhs);
}
-extern std::ostream& operator<<(std::ostream& out, const Token& token);
+extern std::ostream &operator<<(std::ostream &out, const Token &token);
} // namepsace pp
#endif // COMPILER_PREPROCESSOR_TOKEN_H_
diff --git a/chromium/third_party/angle/src/compiler/preprocessor/Tokenizer.cpp b/chromium/third_party/angle/src/compiler/preprocessor/Tokenizer.cpp
index 21f11041d06..04ed9fc7e01 100644
--- a/chromium/third_party/angle/src/compiler/preprocessor/Tokenizer.cpp
+++ b/chromium/third_party/angle/src/compiler/preprocessor/Tokenizer.cpp
@@ -1,6 +1,6 @@
#line 16 "./Tokenizer.l"
//
-// Copyright (c) 2011-2013 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2011-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -18,7 +18,7 @@
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 35
+#define YY_FLEX_SUBMINOR_VERSION 37
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
@@ -64,7 +64,6 @@ typedef int flex_int32_t;
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
-#endif /* ! C99 */
/* Limits of integral types. */
#ifndef INT8_MIN
@@ -95,6 +94,8 @@ typedef unsigned int flex_uint32_t;
#define UINT32_MAX (4294967295U)
#endif
+#endif /* ! C99 */
+
#endif /* ! FLEXINT_H */
#ifdef __cplusplus
@@ -185,6 +186,11 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
typedef size_t yy_size_t;
#endif
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
#define EOB_ACT_CONTINUE_SCAN 0
#define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2
@@ -335,7 +341,7 @@ void ppfree (void * ,yyscan_t yyscanner );
/* Begin user sect3 */
-#define ppwrap(n) 1
+#define ppwrap(yyscanner) 1
#define YY_SKIP_YYWRAP
typedef unsigned char YY_CHAR;
@@ -368,17 +374,19 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[87] =
+static yyconst flex_int16_t yy_accept[98] =
{ 0,
0, 0, 0, 0, 39, 37, 34, 35, 35, 33,
7, 33, 33, 33, 33, 33, 33, 33, 33, 9,
9, 33, 33, 33, 8, 37, 33, 33, 3, 5,
5, 4, 34, 35, 19, 27, 20, 30, 25, 12,
23, 13, 24, 10, 2, 1, 26, 10, 9, 11,
- 11, 11, 11, 9, 14, 16, 18, 17, 15, 8,
- 36, 36, 31, 21, 32, 22, 3, 5, 6, 11,
- 10, 11, 1, 10, 11, 0, 10, 9, 28, 29,
- 0, 10, 10, 10, 10, 0
+ 11, 11, 9, 11, 9, 9, 14, 16, 18, 17,
+ 15, 8, 36, 36, 31, 21, 32, 22, 3, 5,
+ 6, 11, 10, 11, 10, 1, 10, 11, 10, 0,
+ 10, 9, 9, 9, 28, 29, 0, 10, 10, 10,
+ 10, 9, 10, 10, 9, 10, 0
+
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -389,14 +397,14 @@ static yyconst flex_int32_t yy_ec[256] =
1, 2, 5, 1, 6, 1, 7, 8, 1, 9,
9, 10, 11, 9, 12, 13, 14, 15, 16, 16,
16, 16, 16, 16, 16, 17, 17, 9, 9, 18,
- 19, 20, 9, 1, 21, 21, 21, 21, 22, 21,
- 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
- 23, 23, 23, 23, 23, 23, 23, 24, 23, 23,
- 9, 25, 9, 26, 23, 1, 21, 21, 21, 21,
-
- 22, 21, 23, 23, 23, 23, 23, 23, 23, 23,
- 23, 23, 23, 23, 23, 23, 23, 23, 23, 24,
- 23, 23, 9, 27, 9, 9, 1, 1, 1, 1,
+ 19, 20, 9, 1, 21, 21, 21, 21, 22, 23,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 25, 24, 24, 26, 24, 24,
+ 9, 27, 9, 28, 24, 1, 21, 21, 21, 21,
+
+ 22, 23, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 24, 24, 25, 24, 24, 26,
+ 24, 24, 9, 29, 9, 9, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -413,89 +421,101 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static yyconst flex_int32_t yy_meta[28] =
+static yyconst flex_int32_t yy_meta[30] =
{ 0,
1, 1, 2, 2, 1, 1, 1, 1, 1, 3,
1, 1, 4, 1, 5, 5, 5, 1, 1, 1,
- 5, 5, 5, 5, 1, 1, 1
+ 5, 5, 5, 5, 5, 5, 1, 1, 1
} ;
-static yyconst flex_int16_t yy_base[92] =
+static yyconst flex_int16_t yy_base[103] =
{ 0,
- 0, 0, 25, 27, 162, 163, 159, 163, 152, 132,
- 163, 131, 24, 163, 116, 22, 26, 31, 30, 37,
- 40, 44, 115, 46, 0, 64, 50, 15, 0, 163,
- 124, 91, 88, 163, 163, 163, 163, 163, 163, 163,
- 163, 163, 163, 64, 163, 0, 163, 76, 54, 58,
- 79, 91, 91, 0, 56, 163, 163, 163, 32, 0,
- 163, 36, 163, 163, 163, 163, 0, 163, 163, 94,
- 0, 106, 0, 0, 113, 55, 72, 113, 163, 163,
- 116, 101, 108, 123, 126, 163, 143, 31, 148, 153,
- 155
-
+ 0, 0, 27, 29, 137, 194, 133, 194, 117, 100,
+ 194, 98, 26, 194, 94, 24, 28, 33, 32, 39,
+ 51, 39, 80, 50, 0, 68, 25, 54, 0, 194,
+ 88, 71, 80, 194, 194, 194, 194, 194, 194, 194,
+ 194, 194, 194, 71, 194, 0, 194, 85, 55, 64,
+ 99, 111, 53, 105, 0, 50, 55, 194, 194, 194,
+ 40, 0, 194, 38, 194, 194, 194, 194, 0, 194,
+ 194, 117, 0, 130, 0, 0, 0, 137, 0, 88,
+ 113, 0, 131, 0, 194, 194, 143, 139, 152, 150,
+ 0, 13, 153, 194, 0, 194, 194, 176, 31, 181,
+
+ 186, 188
} ;
-static yyconst flex_int16_t yy_def[92] =
+static yyconst flex_int16_t yy_def[103] =
{ 0,
- 86, 1, 87, 87, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 20, 86, 86, 86, 88, 86, 86, 86, 89, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 90, 86, 86, 20, 20,
- 48, 51, 91, 21, 86, 86, 86, 86, 86, 88,
- 86, 86, 86, 86, 86, 86, 89, 86, 86, 44,
- 44, 70, 90, 48, 51, 86, 52, 91, 86, 86,
- 86, 72, 75, 86, 86, 0, 86, 86, 86, 86,
- 86
-
+ 97, 1, 98, 98, 97, 97, 97, 97, 97, 97,
+ 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
+ 20, 97, 97, 97, 99, 97, 97, 97, 100, 97,
+ 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
+ 97, 97, 97, 97, 97, 101, 97, 97, 20, 20,
+ 50, 51, 51, 102, 21, 51, 97, 97, 97, 97,
+ 97, 99, 97, 97, 97, 97, 97, 97, 100, 97,
+ 97, 44, 44, 72, 72, 101, 48, 51, 51, 97,
+ 52, 51, 102, 51, 97, 97, 97, 74, 78, 97,
+ 51, 51, 97, 97, 51, 97, 0, 97, 97, 97,
+
+ 97, 97
} ;
-static yyconst flex_int16_t yy_nxt[191] =
+static yyconst flex_int16_t yy_nxt[224] =
{ 0,
6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 21, 22, 23, 24,
- 25, 25, 25, 25, 26, 27, 28, 30, 31, 30,
- 31, 37, 40, 65, 32, 60, 32, 42, 61, 45,
- 41, 66, 38, 46, 43, 44, 44, 44, 47, 48,
- 80, 49, 49, 50, 54, 54, 54, 51, 52, 51,
- 53, 55, 56, 51, 58, 59, 61, 62, 63, 84,
- 84, 84, 50, 50, 79, 64, 70, 51, 71, 71,
- 71, 51, 86, 86, 70, 72, 70, 70, 51, 33,
- 74, 74, 74, 51, 51, 51, 51, 75, 51, 51,
-
- 51, 76, 76, 51, 69, 77, 77, 77, 70, 70,
- 70, 86, 86, 51, 51, 70, 81, 81, 86, 86,
- 82, 82, 82, 81, 81, 51, 68, 83, 83, 83,
- 85, 85, 85, 57, 39, 51, 51, 84, 84, 84,
- 85, 85, 85, 29, 29, 29, 29, 29, 67, 36,
- 35, 67, 67, 73, 34, 73, 73, 73, 78, 78,
- 33, 86, 5, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86
+ 25, 25, 25, 25, 25, 25, 26, 27, 28, 30,
+ 31, 30, 31, 37, 40, 62, 32, 95, 32, 42,
+ 63, 45, 41, 65, 38, 46, 43, 44, 44, 44,
+ 47, 48, 66, 49, 49, 50, 57, 58, 86, 51,
+ 52, 51, 51, 53, 54, 55, 55, 55, 60, 61,
+ 63, 64, 67, 85, 84, 56, 51, 82, 50, 50,
+ 51, 33, 68, 72, 71, 73, 73, 73, 51, 51,
+ 70, 72, 74, 75, 72, 72, 72, 51, 59, 77,
+
+ 77, 77, 90, 90, 90, 51, 78, 79, 51, 51,
+ 51, 51, 39, 51, 51, 51, 36, 51, 35, 34,
+ 51, 80, 80, 97, 97, 81, 81, 81, 51, 51,
+ 51, 72, 72, 72, 33, 91, 97, 97, 72, 72,
+ 87, 87, 97, 51, 88, 88, 88, 87, 87, 97,
+ 97, 89, 89, 89, 51, 92, 51, 93, 93, 93,
+ 97, 75, 97, 97, 90, 90, 90, 93, 93, 93,
+ 97, 97, 94, 97, 79, 96, 29, 29, 29, 29,
+ 29, 69, 97, 97, 69, 69, 76, 97, 76, 76,
+ 76, 83, 83, 5, 97, 97, 97, 97, 97, 97,
+
+ 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
+ 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
+ 97, 97, 97
} ;
-static yyconst flex_int16_t yy_chk[191] =
+static yyconst flex_int16_t yy_chk[224] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 3, 3, 4,
- 4, 13, 16, 28, 3, 88, 4, 17, 62, 19,
- 16, 28, 13, 19, 17, 18, 18, 18, 19, 20,
- 59, 20, 20, 20, 21, 21, 21, 20, 20, 20,
- 20, 22, 22, 21, 24, 24, 26, 26, 27, 76,
- 76, 76, 50, 50, 55, 27, 44, 49, 44, 44,
- 44, 50, 77, 77, 44, 44, 44, 44, 48, 33,
- 48, 48, 48, 51, 51, 51, 48, 48, 48, 48,
-
- 51, 52, 52, 53, 32, 52, 52, 52, 70, 70,
- 70, 82, 82, 53, 53, 70, 72, 72, 83, 83,
- 72, 72, 72, 75, 75, 78, 31, 75, 75, 75,
- 81, 81, 81, 23, 15, 78, 78, 84, 84, 84,
- 85, 85, 85, 87, 87, 87, 87, 87, 89, 12,
- 10, 89, 89, 90, 9, 90, 90, 90, 91, 91,
- 7, 5, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
+ 3, 4, 4, 13, 16, 99, 3, 92, 4, 17,
+ 64, 19, 16, 27, 13, 19, 17, 18, 18, 18,
+ 19, 20, 27, 20, 20, 20, 22, 22, 61, 20,
+ 20, 20, 20, 20, 20, 21, 21, 21, 24, 24,
+ 26, 26, 28, 57, 56, 21, 21, 53, 50, 50,
+ 49, 33, 28, 44, 32, 44, 44, 44, 50, 50,
+ 31, 44, 44, 44, 44, 44, 44, 48, 23, 48,
+
+ 48, 48, 80, 80, 80, 48, 48, 48, 48, 48,
+ 48, 51, 15, 51, 51, 51, 12, 54, 10, 9,
+ 51, 52, 52, 81, 81, 52, 52, 52, 54, 54,
+ 54, 72, 72, 72, 7, 81, 5, 0, 72, 72,
+ 74, 74, 0, 83, 74, 74, 74, 78, 78, 88,
+ 88, 78, 78, 78, 83, 83, 83, 87, 87, 87,
+ 0, 88, 89, 89, 90, 90, 90, 93, 93, 93,
+ 0, 0, 90, 0, 89, 93, 98, 98, 98, 98,
+ 98, 100, 0, 0, 100, 100, 101, 0, 101, 101,
+ 101, 102, 102, 97, 97, 97, 97, 97, 97, 97,
+
+ 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
+ 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
+ 97, 97, 97
} ;
/* The intent behind this definition is that it'll catch
@@ -507,7 +527,7 @@ static yyconst flex_int16_t yy_chk[191] =
#define YY_RESTORE_YY_MORE_OFFSET
/*
//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -646,6 +666,10 @@ int ppget_lineno (yyscan_t yyscanner );
void ppset_lineno (int line_number ,yyscan_t yyscanner );
+int ppget_column (yyscan_t yyscanner );
+
+void ppset_column (int column_no ,yyscan_t yyscanner );
+
YYSTYPE * ppget_lval (yyscan_t yyscanner );
void ppset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
@@ -694,7 +718,7 @@ static int input (yyscan_t yyscanner );
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
-#define ECHO fwrite( yytext, yyleng, 1, yyout )
+#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
@@ -705,7 +729,7 @@ static int input (yyscan_t yyscanner );
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
{ \
int c = '*'; \
- yy_size_t n; \
+ size_t n; \
for ( n = 0; n < max_size && \
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \
@@ -847,13 +871,13 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 87 )
+ if ( yy_current_state >= 98 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
- while ( yy_current_state != 86 );
+ while ( yy_current_state != 97 );
yy_cp = yyg->yy_last_accepting_cpos;
yy_current_state = yyg->yy_last_accepting_state;
@@ -1346,7 +1370,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
{ /* Not enough room in the buffer - grow it. */
/* just a shorter name for the current buffer */
- YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
+ YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
int yy_c_buf_p_offset =
(int) (yyg->yy_c_buf_p - b->yy_ch_buf);
@@ -1446,7 +1470,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 87 )
+ if ( yy_current_state >= 98 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1475,12 +1499,13 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 87 )
+ if ( yy_current_state >= 98 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 86);
+ yy_is_jam = (yy_current_state == 97);
+ (void)yyg;
return yy_is_jam ? 0 : yy_current_state;
}
@@ -1882,8 +1907,8 @@ YY_BUFFER_STATE pp_scan_string (yyconst char * yystr , yyscan_t yyscanner)
/** Setup the input buffer state to scan the given bytes. The next call to pplex() will
* scan from a @e copy of @a bytes.
- * @param bytes the byte buffer to scan
- * @param len the number of bytes in the buffer pointed to by @a bytes.
+ * @param yybytes the byte buffer to scan
+ * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
* @param yyscanner The scanner object.
* @return the newly allocated buffer state object.
*/
@@ -1891,7 +1916,8 @@ YY_BUFFER_STATE pp_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len
{
YY_BUFFER_STATE b;
char *buf;
- yy_size_t n, i;
+ yy_size_t n;
+ yy_size_t i;
/* Get memory for full buffer, including space for trailing EOB's. */
n = _yybytes_len + 2;
@@ -2037,7 +2063,7 @@ void ppset_lineno (int line_number , yyscan_t yyscanner)
/* lineno is only valid if an input buffer exists. */
if (! YY_CURRENT_BUFFER )
- yy_fatal_error( "ppset_lineno called with no buffer" , yyscanner);
+ YY_FATAL_ERROR( "ppset_lineno called with no buffer" );
yylineno = line_number;
}
@@ -2052,7 +2078,7 @@ void ppset_column (int column_no , yyscan_t yyscanner)
/* column is only valid if an input buffer exists. */
if (! YY_CURRENT_BUFFER )
- yy_fatal_error( "ppset_column called with no buffer" , yyscanner);
+ YY_FATAL_ERROR( "ppset_column called with no buffer" );
yycolumn = column_no;
}
@@ -2290,9 +2316,9 @@ void ppfree (void * ptr , yyscan_t yyscanner)
namespace pp {
-Tokenizer::Tokenizer(Diagnostics* diagnostics)
+Tokenizer::Tokenizer(Diagnostics *diagnostics)
: mHandle(0),
- mMaxTokenLength(256)
+ mMaxTokenSize(256)
{
mContext.diagnostics = diagnostics;
}
@@ -2302,9 +2328,10 @@ Tokenizer::~Tokenizer()
destroyScanner();
}
-bool Tokenizer::init(size_t count, const char* const string[], const int length[])
+bool Tokenizer::init(size_t count, const char * const string[], const int length[])
{
- if ((count > 0) && (string == 0)) return false;
+ if ((count > 0) && (string == 0))
+ return false;
mContext.input = Input(count, string, length);
return initScanner();
@@ -2322,14 +2349,19 @@ void Tokenizer::setLineNumber(int line)
ppset_lineno(line,mHandle);
}
-void Tokenizer::lex(Token* token)
+void Tokenizer::setMaxTokenSize(size_t maxTokenSize)
+{
+ mMaxTokenSize = maxTokenSize;
+}
+
+void Tokenizer::lex(Token *token)
{
token->type = pplex(&token->text,&token->location,mHandle);
- if (token->text.size() > mMaxTokenLength)
+ if (token->text.size() > mMaxTokenSize)
{
mContext.diagnostics->report(Diagnostics::PP_TOKEN_TOO_LONG,
token->location, token->text);
- token->text.erase(mMaxTokenLength);
+ token->text.erase(mMaxTokenSize);
}
token->flags = 0;
diff --git a/chromium/third_party/angle/src/compiler/preprocessor/Tokenizer.h b/chromium/third_party/angle/src/compiler/preprocessor/Tokenizer.h
index 9d131f865a2..07ad93da052 100644
--- a/chromium/third_party/angle/src/compiler/preprocessor/Tokenizer.h
+++ b/chromium/third_party/angle/src/compiler/preprocessor/Tokenizer.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2012-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -21,7 +21,7 @@ class Tokenizer : public Lexer
public:
struct Context
{
- Diagnostics* diagnostics;
+ Diagnostics *diagnostics;
Input input;
// The location where yytext points to. Token location should track
@@ -33,25 +33,25 @@ class Tokenizer : public Lexer
bool lineStart;
};
- Tokenizer(Diagnostics* diagnostics);
+ Tokenizer(Diagnostics *diagnostics);
~Tokenizer();
- bool init(size_t count, const char* const string[], const int length[]);
+ bool init(size_t count, const char * const string[], const int length[]);
- void setMaxTokenLength(size_t maxLength) { mMaxTokenLength = maxLength; }
void setFileNumber(int file);
void setLineNumber(int line);
+ void setMaxTokenSize(size_t maxTokenSize);
- virtual void lex(Token* token);
+ virtual void lex(Token *token);
private:
PP_DISALLOW_COPY_AND_ASSIGN(Tokenizer);
bool initScanner();
void destroyScanner();
- void* mHandle; // Scanner handle.
+ void *mHandle; // Scanner handle.
Context mContext; // Scanner extra.
- size_t mMaxTokenLength;
+ size_t mMaxTokenSize; // Maximum token size
};
} // namespace pp
diff --git a/chromium/third_party/angle/src/compiler/preprocessor/Tokenizer.l b/chromium/third_party/angle/src/compiler/preprocessor/Tokenizer.l
index 01f0177b6c2..2a77b905a4c 100644
--- a/chromium/third_party/angle/src/compiler/preprocessor/Tokenizer.l
+++ b/chromium/third_party/angle/src/compiler/preprocessor/Tokenizer.l
@@ -1,6 +1,6 @@
/*
//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -14,7 +14,7 @@ IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh.
%top{
//
-// Copyright (c) 2011-2013 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2011-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -78,9 +78,9 @@ NEWLINE \n|\r|\r\n
IDENTIFIER [_a-zA-Z][_a-zA-Z0-9]*
PUNCTUATOR [][<>(){}.+-/*%^|&~=!:;,?]
-DECIMAL_CONSTANT [1-9][0-9]*
-OCTAL_CONSTANT 0[0-7]*
-HEXADECIMAL_CONSTANT 0[xX][0-9a-fA-F]+
+DECIMAL_CONSTANT [1-9][0-9]*[uU]?
+OCTAL_CONSTANT 0[0-7]*[uU]?
+HEXADECIMAL_CONSTANT 0[xX][0-9a-fA-F]+[uU]?
DIGIT [0-9]
EXPONENT_PART [eE][+-]?{DIGIT}+
@@ -114,12 +114,12 @@ FRACTIONAL_CONSTANT ({DIGIT}*"."{DIGIT}+)|({DIGIT}+".")
return pp::Token::IDENTIFIER;
}
-{DECIMAL_CONSTANT}|{OCTAL_CONSTANT}|{HEXADECIMAL_CONSTANT} {
+({DECIMAL_CONSTANT}[uU]?)|({OCTAL_CONSTANT}[uU]?)|({HEXADECIMAL_CONSTANT}[uU]?) {
yylval->assign(yytext, yyleng);
return pp::Token::CONST_INT;
}
-({DIGIT}+{EXPONENT_PART})|({FRACTIONAL_CONSTANT}{EXPONENT_PART}?) {
+({DIGIT}+{EXPONENT_PART}[fF]?)|({FRACTIONAL_CONSTANT}{EXPONENT_PART}?[fF]?) {
yylval->assign(yytext, yyleng);
return pp::Token::CONST_FLOAT;
}
@@ -256,7 +256,7 @@ FRACTIONAL_CONSTANT ({DIGIT}*"."{DIGIT}+)|({DIGIT}+".")
if (YY_START == COMMENT)
{
- yyextra->diagnostics->report(pp::Diagnostics::EOF_IN_COMMENT,
+ yyextra->diagnostics->report(pp::Diagnostics::PP_EOF_IN_COMMENT,
pp::SourceLocation(yyfileno, yylineno),
"");
}
@@ -267,9 +267,7 @@ FRACTIONAL_CONSTANT ({DIGIT}*"."{DIGIT}+)|({DIGIT}+".")
namespace pp {
-Tokenizer::Tokenizer(Diagnostics* diagnostics)
- : mHandle(0),
- mMaxTokenLength(256)
+Tokenizer::Tokenizer(Diagnostics *diagnostics) : mHandle(0)
{
mContext.diagnostics = diagnostics;
}
@@ -279,9 +277,10 @@ Tokenizer::~Tokenizer()
destroyScanner();
}
-bool Tokenizer::init(size_t count, const char* const string[], const int length[])
+bool Tokenizer::init(size_t count, const char * const string[], const int length[])
{
- if ((count > 0) && (string == 0)) return false;
+ if ((count > 0) && (string == 0))
+ return false;
mContext.input = Input(count, string, length);
return initScanner();
@@ -299,14 +298,19 @@ void Tokenizer::setLineNumber(int line)
yyset_lineno(line, mHandle);
}
-void Tokenizer::lex(Token* token)
+void Tokenizer::setMaxTokenSize(size_t maxTokenSize)
+{
+ mMaxTokenSize = maxTokenSize;
+}
+
+void Tokenizer::lex(Token *token)
{
token->type = yylex(&token->text, &token->location, mHandle);
- if (token->text.size() > mMaxTokenLength)
+ if (token->text.size() > mMaxTokenSize)
{
- mContext.diagnostics->report(Diagnostics::TOKEN_TOO_LONG,
+ mContext.diagnostics->report(Diagnostics::PP_TOKEN_TOO_LONG,
token->location, token->text);
- token->text.erase(mMaxTokenLength);
+ token->text.erase(mMaxTokenSize);
}
token->flags = 0;
diff --git a/chromium/third_party/angle/src/compiler/preprocessor/numeric_lex.h b/chromium/third_party/angle/src/compiler/preprocessor/numeric_lex.h
index b04125d2309..8a24540696e 100644
--- a/chromium/third_party/angle/src/compiler/preprocessor/numeric_lex.h
+++ b/chromium/third_party/angle/src/compiler/preprocessor/numeric_lex.h
@@ -13,7 +13,7 @@
namespace pp {
-inline std::ios::fmtflags numeric_base_int(const std::string& str)
+inline std::ios::fmtflags numeric_base_int(const std::string &str)
{
if ((str.size() >= 2) &&
(str[0] == '0') &&
@@ -21,7 +21,7 @@ inline std::ios::fmtflags numeric_base_int(const std::string& str)
{
return std::ios::hex;
}
- else if ((str.size() >= 1) && (str[0] == '0'))
+ if ((str.size() >= 1) && (str[0] == '0'))
{
return std::ios::oct;
}
@@ -34,7 +34,7 @@ inline std::ios::fmtflags numeric_base_int(const std::string& str)
// in which case false is returned.
template<typename IntType>
-bool numeric_lex_int(const std::string& str, IntType* value)
+bool numeric_lex_int(const std::string &str, IntType *value)
{
std::istringstream stream(str);
// This should not be necessary, but MSVS has a buggy implementation.
@@ -46,7 +46,7 @@ bool numeric_lex_int(const std::string& str, IntType* value)
}
template<typename FloatType>
-bool numeric_lex_float(const std::string& str, FloatType* value)
+bool numeric_lex_float(const std::string &str, FloatType *value)
{
std::istringstream stream(str);
// Force "C" locale so that decimal character is always '.', and
diff --git a/chromium/third_party/angle/src/compiler/preprocessor/pp_utils.h b/chromium/third_party/angle/src/compiler/preprocessor/pp_utils.h
index 17164ea8b03..9fba9385c5e 100644
--- a/chromium/third_party/angle/src/compiler/preprocessor/pp_utils.h
+++ b/chromium/third_party/angle/src/compiler/preprocessor/pp_utils.h
@@ -12,7 +12,7 @@
// A macro to disallow the copy constructor and operator= functions
// This must be used in the private: declarations for a class.
#define PP_DISALLOW_COPY_AND_ASSIGN(TypeName) \
- TypeName(const TypeName&); \
- void operator=(const TypeName&)
+ TypeName(const TypeName &); \
+ void operator=(const TypeName &)
#endif // COMPILER_PREPROCESSOR_PPUTILS_H_
diff --git a/chromium/third_party/angle/src/compiler/preprocessor/preprocessor.vcxproj b/chromium/third_party/angle/src/compiler/preprocessor/preprocessor.vcxproj
deleted file mode 100644
index 14f701b01ef..00000000000
--- a/chromium/third_party/angle/src/compiler/preprocessor/preprocessor.vcxproj
+++ /dev/null
@@ -1,172 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{FBE32DF3-0FB0-4F2F-A424-2C21BD7BC325}</ProjectGuid>
- <RootNamespace>preprocessor</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level4</WarningLevel>
- <TreatWarningAsError>true</TreatWarningAsError>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- <DisableSpecificWarnings>4100;4127;4189;4239;4244;4245;4512;4702;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level4</WarningLevel>
- <TreatWarningAsError>true</TreatWarningAsError>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <DisableSpecificWarnings>4100;4127;4189;4239;4244;4245;4512;4702;4718;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <Optimization>MaxSpeed</Optimization>
- <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;_SECURE_SCL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level4</WarningLevel>
- <TreatWarningAsError>true</TreatWarningAsError>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <DisableSpecificWarnings>4100;4127;4189;4239;4244;4245;4512;4702;4718;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <Optimization>MaxSpeed</Optimization>
- <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;_SECURE_SCL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level4</WarningLevel>
- <TreatWarningAsError>true</TreatWarningAsError>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <DisableSpecificWarnings>4100;4127;4189;4239;4244;4245;4512;4702;4718;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="DiagnosticsBase.cpp" />
- <ClCompile Include="DirectiveHandlerBase.cpp" />
- <ClCompile Include="DirectiveParser.cpp" />
- <ClCompile Include="ExpressionParser.cpp" />
- <ClCompile Include="Input.cpp" />
- <ClCompile Include="Lexer.cpp" />
- <ClCompile Include="Macro.cpp" />
- <ClCompile Include="MacroExpander.cpp" />
- <ClCompile Include="Preprocessor.cpp" />
- <ClCompile Include="Token.cpp" />
- <ClCompile Include="Tokenizer.cpp" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="length_limits.h" />
- <ClInclude Include="DiagnosticsBase.h" />
- <ClInclude Include="DirectiveHandlerBase.h" />
- <ClInclude Include="DirectiveParser.h" />
- <ClInclude Include="ExpressionParser.h" />
- <ClInclude Include="Input.h" />
- <ClInclude Include="Lexer.h" />
- <ClInclude Include="Macro.h" />
- <ClInclude Include="MacroExpander.h" />
- <ClInclude Include="numeric_lex.h" />
- <ClInclude Include="pp_utils.h" />
- <ClInclude Include="Preprocessor.h" />
- <ClInclude Include="SourceLocation.h" />
- <ClInclude Include="Token.h" />
- <ClInclude Include="Tokenizer.h" />
- </ItemGroup>
- <ItemGroup>
- <None Include="Tokenizer.l" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/chromium/third_party/angle/src/compiler/preprocessor/preprocessor.vcxproj.filters b/chromium/third_party/angle/src/compiler/preprocessor/preprocessor.vcxproj.filters
deleted file mode 100644
index 8c8da8687ab..00000000000
--- a/chromium/third_party/angle/src/compiler/preprocessor/preprocessor.vcxproj.filters
+++ /dev/null
@@ -1,100 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="Header Files">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="DirectiveParser.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="ExpressionParser.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Input.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Lexer.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Macro.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="MacroExpander.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Preprocessor.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Token.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Tokenizer.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="DiagnosticsBase.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="DirectiveHandlerBase.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="DirectiveParser.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="ExpressionParser.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="Input.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="Lexer.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="Macro.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="MacroExpander.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="numeric_lex.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="pp_utils.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="Preprocessor.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="SourceLocation.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="Token.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="Tokenizer.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="length_limits.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="DiagnosticsBase.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="DirectiveHandlerBase.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <None Include="Tokenizer.l">
- <Filter>Source Files</Filter>
- </None>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/chromium/third_party/angle/src/compiler/translator.vcxproj b/chromium/third_party/angle/src/compiler/translator.vcxproj
deleted file mode 100644
index 54d71a1d61a..00000000000
--- a/chromium/third_party/angle/src/compiler/translator.vcxproj
+++ /dev/null
@@ -1,304 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{5B3A6DB8-1E7E-40D7-92B9-DA8AAE619FAD}</ProjectGuid>
- <RootNamespace>compiler</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- <ProjectName>translator</ProjectName>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>NotSet</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>NotSet</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>NotSet</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>NotSet</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\common\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\common\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)../;$(ProjectDir)../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level4</WarningLevel>
- <TreatWarningAsError>true</TreatWarningAsError>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- <DisableSpecificWarnings>4100;4127;4189;4239;4244;4245;4512;4702;4718;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)../;$(ProjectDir)../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level4</WarningLevel>
- <TreatWarningAsError>true</TreatWarningAsError>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <DisableSpecificWarnings>4100;4127;4189;4239;4244;4245;4267;4512;4702;4718;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <Optimization>MaxSpeed</Optimization>
- <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
- <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)../;$(ProjectDir)../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;_SECURE_SCL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level4</WarningLevel>
- <TreatWarningAsError>true</TreatWarningAsError>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <DisableSpecificWarnings>4100;4127;4189;4239;4244;4245;4512;4702;4718;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <Optimization>MaxSpeed</Optimization>
- <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
- <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)../;$(ProjectDir)../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;_SECURE_SCL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level4</WarningLevel>
- <TreatWarningAsError>true</TreatWarningAsError>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <DisableSpecificWarnings>4100;4127;4189;4239;4244;4245;4267;4512;4702;4718;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="BuiltInFunctionEmulator.cpp" />
- <ClCompile Include="CodeGen.cpp" />
- <ClCompile Include="Compiler.cpp" />
- <ClCompile Include="debug.cpp" />
- <ClCompile Include="DetectCallDepth.cpp" />
- <ClCompile Include="DetectDiscontinuity.cpp" />
- <ClCompile Include="Diagnostics.cpp" />
- <ClCompile Include="DirectiveHandler.cpp" />
- <ClCompile Include="ForLoopUnroll.cpp" />
- <ClCompile Include="InfoSink.cpp" />
- <ClCompile Include="Initialize.cpp" />
- <ClCompile Include="InitializeDll.cpp" />
- <ClCompile Include="InitializeGLPosition.cpp" />
- <ClCompile Include="InitializeParseContext.cpp" />
- <ClCompile Include="Intermediate.cpp" />
- <ClCompile Include="intermOut.cpp" />
- <ClCompile Include="IntermTraverse.cpp" />
- <ClCompile Include="MapLongVariableNames.cpp" />
- <ClCompile Include="ossource_win.cpp" />
- <ClCompile Include="OutputESSL.cpp" />
- <ClCompile Include="OutputGLSL.cpp" />
- <ClCompile Include="OutputGLSLBase.cpp" />
- <ClCompile Include="OutputHLSL.cpp" />
- <ClCompile Include="parseConst.cpp" />
- <ClCompile Include="ParseContext.cpp" />
- <ClCompile Include="PoolAlloc.cpp" />
- <ClCompile Include="QualifierAlive.cpp" />
- <ClCompile Include="RemoveTree.cpp" />
- <ClCompile Include="SearchSymbol.cpp" />
- <ClCompile Include="ShaderLang.cpp" />
- <ClCompile Include="SymbolTable.cpp" />
- <ClCompile Include="TranslatorESSL.cpp" />
- <ClCompile Include="TranslatorGLSL.cpp" />
- <ClCompile Include="TranslatorHLSL.cpp" />
- <ClCompile Include="UnfoldShortCircuit.cpp" />
- <ClCompile Include="UnfoldShortCircuitAST.cpp" />
- <ClCompile Include="Uniform.cpp" />
- <ClCompile Include="util.cpp" />
- <ClCompile Include="ValidateLimitations.cpp" />
- <ClCompile Include="VariableInfo.cpp" />
- <ClCompile Include="VariablePacker.cpp" />
- <ClCompile Include="glslang_lex.cpp" />
- <ClCompile Include="glslang_tab.cpp" />
- <ClCompile Include="depgraph\DependencyGraph.cpp" />
- <ClCompile Include="depgraph\DependencyGraphBuilder.cpp" />
- <ClCompile Include="depgraph\DependencyGraphOutput.cpp" />
- <ClCompile Include="depgraph\DependencyGraphTraverse.cpp" />
- <ClCompile Include="timing\RestrictFragmentShaderTiming.cpp" />
- <ClCompile Include="timing\RestrictVertexShaderTiming.cpp" />
- <ClCompile Include="..\third_party\compiler\ArrayBoundsClamper.cpp" />
- <ClCompile Include="VersionGLSL.cpp" />
- </ItemGroup>
- <ItemGroup>
- <CustomBuild Include="glslang.l">
- <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- </Message>
- <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- </Command>
- <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalInputs)</AdditionalInputs>
- <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(Outputs)</Outputs>
- <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- </Message>
- <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- </Command>
- <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalInputs)</AdditionalInputs>
- <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(Outputs)</Outputs>
- <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- </Message>
- <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- </Command>
- <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalInputs)</AdditionalInputs>
- <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(Outputs)</Outputs>
- <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- </Message>
- <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- </Command>
- <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalInputs)</AdditionalInputs>
- <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(Outputs)</Outputs>
- </CustomBuild>
- <CustomBuild Include="glslang.y">
- <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- </Message>
- <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- </Command>
- <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(Outputs)</Outputs>
- <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- </Message>
- <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- </Command>
- <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(Outputs)</Outputs>
- <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- </Message>
- <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- </Command>
- <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(Outputs)</Outputs>
- <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- </Message>
- <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- </Command>
- <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(Outputs)</Outputs>
- </CustomBuild>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="BaseTypes.h" />
- <ClInclude Include="BuiltInFunctionEmulator.h" />
- <ClInclude Include="Common.h" />
- <ClInclude Include="ConstantUnion.h" />
- <ClInclude Include="debug.h" />
- <ClInclude Include="DetectCallDepth.h" />
- <ClInclude Include="DetectDiscontinuity.h" />
- <ClInclude Include="Diagnostics.h" />
- <ClInclude Include="DirectiveHandler.h" />
- <ClInclude Include="ForLoopUnroll.h" />
- <ClInclude Include="HashNames.h" />
- <ClInclude Include="InfoSink.h" />
- <ClInclude Include="Initialize.h" />
- <ClInclude Include="InitializeDll.h" />
- <ClInclude Include="InitializeGlobals.h" />
- <ClInclude Include="InitializeGLPosition.h" />
- <ClInclude Include="InitializeParseContext.h" />
- <ClInclude Include="intermediate.h" />
- <ClInclude Include="localintermediate.h" />
- <ClInclude Include="MapLongVariableNames.h" />
- <ClInclude Include="MMap.h" />
- <ClInclude Include="NodeSearch.h" />
- <ClInclude Include="osinclude.h" />
- <ClInclude Include="OutputESSL.h" />
- <ClInclude Include="OutputGLSL.h" />
- <ClInclude Include="OutputGLSLBase.h" />
- <ClInclude Include="OutputHLSL.h" />
- <ClInclude Include="ParseContext.h" />
- <ClInclude Include="PoolAlloc.h" />
- <ClInclude Include="QualifierAlive.h" />
- <ClInclude Include="RemoveTree.h" />
- <ClInclude Include="RenameFunction.h" />
- <ClInclude Include="..\..\include\GLSLANG\ShaderLang.h" />
- <ClInclude Include="SearchSymbol.h" />
- <ClInclude Include="ShHandle.h" />
- <ClInclude Include="SymbolTable.h" />
- <ClInclude Include="TranslatorESSL.h" />
- <ClInclude Include="TranslatorGLSL.h" />
- <ClInclude Include="TranslatorHLSL.h" />
- <ClInclude Include="Types.h" />
- <ClInclude Include="UnfoldShortCircuit.h" />
- <ClInclude Include="UnfoldShortCircuitAST.h" />
- <ClInclude Include="Uniform.h" />
- <ClInclude Include="util.h" />
- <ClInclude Include="ValidateLimitations.h" />
- <ClInclude Include="VariableInfo.h" />
- <ClInclude Include="VariablePacker.h" />
- <ClInclude Include="glslang_tab.h" />
- <ClInclude Include="timing\RestrictFragmentShaderTiming.h" />
- <ClInclude Include="timing\RestrictVertexShaderTiming.h" />
- <ClInclude Include="depgraph\DependencyGraph.h" />
- <ClInclude Include="depgraph\DependencyGraphBuilder.h" />
- <ClInclude Include="depgraph\DependencyGraphOutput.h" />
- <ClInclude Include="..\third_party\compiler\ArrayBoundsClamper.h" />
- <ClInclude Include="VersionGLSL.h" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/chromium/third_party/angle/src/compiler/translator.vcxproj.filters b/chromium/third_party/angle/src/compiler/translator.vcxproj.filters
deleted file mode 100644
index 1df6c7c28ac..00000000000
--- a/chromium/third_party/angle/src/compiler/translator.vcxproj.filters
+++ /dev/null
@@ -1,361 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="Source Files\generated">
- <UniqueIdentifier>{eb8da157-b29c-43c3-880d-54679e176dc5}</UniqueIdentifier>
- </Filter>
- <Filter Include="Source Files\depgraph">
- <UniqueIdentifier>{b5410d3a-c3c8-4ae6-843a-b000d652632e}</UniqueIdentifier>
- </Filter>
- <Filter Include="Source Files\timing">
- <UniqueIdentifier>{a9847611-dcd5-4c89-8262-a22b96c7c98d}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="Header Files\generated">
- <UniqueIdentifier>{094f7115-35d3-4c63-870c-ab5f393dc2c2}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files\timing">
- <UniqueIdentifier>{5f5742e9-15e1-43b4-b1e7-0c118be14e04}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files\depgraph">
- <UniqueIdentifier>{c4007e35-3c11-44d6-95f7-bb81db528068}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="BuiltInFunctionEmulator.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Compiler.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="debug.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="DetectCallDepth.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Diagnostics.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="DirectiveHandler.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="ForLoopUnroll.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="InfoSink.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Initialize.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="InitializeDll.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="InitializeParseContext.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Intermediate.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="intermOut.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="IntermTraverse.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="MapLongVariableNames.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="ossource_win.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="parseConst.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="PoolAlloc.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="QualifierAlive.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="RemoveTree.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="ShaderLang.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="SymbolTable.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="util.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="ValidateLimitations.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="VariableInfo.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="VariablePacker.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="glslang_lex.cpp">
- <Filter>Source Files\generated</Filter>
- </ClCompile>
- <ClCompile Include="glslang_tab.cpp">
- <Filter>Source Files\generated</Filter>
- </ClCompile>
- <ClCompile Include="depgraph\DependencyGraph.cpp">
- <Filter>Source Files\depgraph</Filter>
- </ClCompile>
- <ClCompile Include="depgraph\DependencyGraphBuilder.cpp">
- <Filter>Source Files\depgraph</Filter>
- </ClCompile>
- <ClCompile Include="depgraph\DependencyGraphOutput.cpp">
- <Filter>Source Files\depgraph</Filter>
- </ClCompile>
- <ClCompile Include="depgraph\DependencyGraphTraverse.cpp">
- <Filter>Source Files\depgraph</Filter>
- </ClCompile>
- <ClCompile Include="timing\RestrictFragmentShaderTiming.cpp">
- <Filter>Source Files\timing</Filter>
- </ClCompile>
- <ClCompile Include="timing\RestrictVertexShaderTiming.cpp">
- <Filter>Source Files\timing</Filter>
- </ClCompile>
- <ClCompile Include="..\third_party\compiler\ArrayBoundsClamper.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="InitializeGLPosition.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="DetectDiscontinuity.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="OutputHLSL.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="SearchSymbol.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="TranslatorHLSL.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="UnfoldShortCircuit.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Uniform.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="CodeGen.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="TranslatorGLSL.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="TranslatorESSL.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="OutputESSL.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="OutputGLSL.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="OutputGLSLBase.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="VersionGLSL.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="UnfoldShortCircuitAST.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="ParseContext.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="BaseTypes.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="BuiltInFunctionEmulator.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="Common.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="ConstantUnion.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="debug.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="DetectCallDepth.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="Diagnostics.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="DirectiveHandler.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="ForLoopUnroll.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="InfoSink.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="Initialize.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="InitializeDll.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="InitializeGlobals.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="InitializeParseContext.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="intermediate.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="localintermediate.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="MapLongVariableNames.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="MMap.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="osinclude.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="PoolAlloc.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="QualifierAlive.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="RemoveTree.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="RenameFunction.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\GLSLANG\ShaderLang.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="ShHandle.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="SymbolTable.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="Types.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="util.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="ValidateLimitations.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="VariableInfo.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="VariablePacker.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="glslang_tab.h">
- <Filter>Header Files\generated</Filter>
- </ClInclude>
- <ClInclude Include="timing\RestrictFragmentShaderTiming.h">
- <Filter>Header Files\timing</Filter>
- </ClInclude>
- <ClInclude Include="timing\RestrictVertexShaderTiming.h">
- <Filter>Header Files\timing</Filter>
- </ClInclude>
- <ClInclude Include="depgraph\DependencyGraph.h">
- <Filter>Header Files\depgraph</Filter>
- </ClInclude>
- <ClInclude Include="depgraph\DependencyGraphBuilder.h">
- <Filter>Header Files\depgraph</Filter>
- </ClInclude>
- <ClInclude Include="depgraph\DependencyGraphOutput.h">
- <Filter>Header Files\depgraph</Filter>
- </ClInclude>
- <ClInclude Include="HashNames.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="InitializeGLPosition.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\third_party\compiler\ArrayBoundsClamper.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="DetectDiscontinuity.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="OutputHLSL.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="SearchSymbol.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="TranslatorHLSL.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="UnfoldShortCircuit.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="Uniform.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="TranslatorGLSL.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="TranslatorESSL.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="OutputESSL.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="OutputGLSL.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="OutputGLSLBase.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="VersionGLSL.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="UnfoldShortCircuitAST.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="ParseContext.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="NodeSearch.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <CustomBuild Include="glslang.l">
- <Filter>Source Files</Filter>
- </CustomBuild>
- <CustomBuild Include="glslang.y">
- <Filter>Source Files</Filter>
- </CustomBuild>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/chromium/third_party/angle/src/compiler/64bit-lexer-safety.patch b/chromium/third_party/angle/src/compiler/translator/64bit-lexer-safety.patch
index 7af91f57653..7af91f57653 100644
--- a/chromium/third_party/angle/src/compiler/64bit-lexer-safety.patch
+++ b/chromium/third_party/angle/src/compiler/translator/64bit-lexer-safety.patch
diff --git a/chromium/third_party/angle/src/compiler/translator/BaseTypes.h b/chromium/third_party/angle/src/compiler/translator/BaseTypes.h
new file mode 100644
index 00000000000..ba9ef5e609e
--- /dev/null
+++ b/chromium/third_party/angle/src/compiler/translator/BaseTypes.h
@@ -0,0 +1,471 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef _BASICTYPES_INCLUDED_
+#define _BASICTYPES_INCLUDED_
+
+#include <assert.h>
+
+//
+// Precision qualifiers
+//
+enum TPrecision
+{
+ // These need to be kept sorted
+ EbpUndefined,
+ EbpLow,
+ EbpMedium,
+ EbpHigh
+};
+
+inline const char* getPrecisionString(TPrecision p)
+{
+ switch(p)
+ {
+ case EbpHigh: return "highp"; break;
+ case EbpMedium: return "mediump"; break;
+ case EbpLow: return "lowp"; break;
+ default: return "mediump"; break; // Safest fallback
+ }
+}
+
+//
+// Basic type. Arrays, vectors, etc., are orthogonal to this.
+//
+enum TBasicType
+{
+ EbtVoid,
+ EbtFloat,
+ EbtInt,
+ EbtUInt,
+ EbtBool,
+ EbtGVec4, // non type: represents vec4, ivec4 and uvec4
+ EbtGuardSamplerBegin, // non type: see implementation of IsSampler()
+ EbtSampler2D,
+ EbtSampler3D,
+ EbtSamplerCube,
+ EbtSampler2DArray,
+ EbtSamplerExternalOES, // Only valid if OES_EGL_image_external exists.
+ EbtSampler2DRect, // Only valid if GL_ARB_texture_rectangle exists.
+ EbtISampler2D,
+ EbtISampler3D,
+ EbtISamplerCube,
+ EbtISampler2DArray,
+ EbtUSampler2D,
+ EbtUSampler3D,
+ EbtUSamplerCube,
+ EbtUSampler2DArray,
+ EbtSampler2DShadow,
+ EbtSamplerCubeShadow,
+ EbtSampler2DArrayShadow,
+ EbtGuardSamplerEnd, // non type: see implementation of IsSampler()
+ EbtGSampler2D, // non type: represents sampler2D, isampler2D and usampler2D
+ EbtGSampler3D, // non type: represents sampler3D, isampler3D and usampler3D
+ EbtGSamplerCube, // non type: represents samplerCube, isamplerCube and usamplerCube
+ EbtGSampler2DArray, // non type: represents sampler2DArray, isampler2DArray and usampler2DArray
+ EbtStruct,
+ EbtInterfaceBlock,
+ EbtAddress, // should be deprecated??
+ EbtInvariant // used as a type when qualifying a previously declared variable as being invariant
+};
+
+inline const char* getBasicString(TBasicType t)
+{
+ switch (t)
+ {
+ case EbtVoid: return "void"; break;
+ case EbtFloat: return "float"; break;
+ case EbtInt: return "int"; break;
+ case EbtUInt: return "uint"; break;
+ case EbtBool: return "bool"; break;
+ case EbtSampler2D: return "sampler2D"; break;
+ case EbtSampler3D: return "sampler3D"; break;
+ case EbtSamplerCube: return "samplerCube"; break;
+ case EbtSamplerExternalOES: return "samplerExternalOES"; break;
+ case EbtSampler2DRect: return "sampler2DRect"; break;
+ case EbtSampler2DArray: return "sampler2DArray"; break;
+ case EbtISampler2D: return "isampler2D"; break;
+ case EbtISampler3D: return "isampler3D"; break;
+ case EbtISamplerCube: return "isamplerCube"; break;
+ case EbtISampler2DArray: return "isampler2DArray"; break;
+ case EbtUSampler2D: return "usampler2D"; break;
+ case EbtUSampler3D: return "usampler3D"; break;
+ case EbtUSamplerCube: return "usamplerCube"; break;
+ case EbtUSampler2DArray: return "usampler2DArray"; break;
+ case EbtSampler2DShadow: return "sampler2DShadow"; break;
+ case EbtSamplerCubeShadow: return "samplerCubeShadow"; break;
+ case EbtSampler2DArrayShadow: return "sampler2DArrayShadow"; break;
+ case EbtStruct: return "structure"; break;
+ case EbtInterfaceBlock: return "interface block"; break;
+ default: return "unknown type";
+ }
+}
+
+inline bool IsSampler(TBasicType type)
+{
+ return type > EbtGuardSamplerBegin && type < EbtGuardSamplerEnd;
+}
+
+inline bool IsIntegerSampler(TBasicType type)
+{
+ switch (type)
+ {
+ case EbtISampler2D:
+ case EbtISampler3D:
+ case EbtISamplerCube:
+ case EbtISampler2DArray:
+ case EbtUSampler2D:
+ case EbtUSampler3D:
+ case EbtUSamplerCube:
+ case EbtUSampler2DArray:
+ return true;
+ case EbtSampler2D:
+ case EbtSampler3D:
+ case EbtSamplerCube:
+ case EbtSamplerExternalOES:
+ case EbtSampler2DRect:
+ case EbtSampler2DArray:
+ case EbtSampler2DShadow:
+ case EbtSamplerCubeShadow:
+ case EbtSampler2DArrayShadow:
+ return false;
+ default:
+ assert(!IsSampler(type));
+ }
+
+ return false;
+}
+
+inline bool IsSampler2D(TBasicType type)
+{
+ switch (type)
+ {
+ case EbtSampler2D:
+ case EbtISampler2D:
+ case EbtUSampler2D:
+ case EbtSampler2DArray:
+ case EbtISampler2DArray:
+ case EbtUSampler2DArray:
+ case EbtSampler2DRect:
+ case EbtSamplerExternalOES:
+ case EbtSampler2DShadow:
+ case EbtSampler2DArrayShadow:
+ return true;
+ case EbtSampler3D:
+ case EbtISampler3D:
+ case EbtUSampler3D:
+ case EbtISamplerCube:
+ case EbtUSamplerCube:
+ case EbtSamplerCube:
+ case EbtSamplerCubeShadow:
+ return false;
+ default:
+ assert(!IsSampler(type));
+ }
+
+ return false;
+}
+
+inline bool IsSamplerCube(TBasicType type)
+{
+ switch (type)
+ {
+ case EbtSamplerCube:
+ case EbtISamplerCube:
+ case EbtUSamplerCube:
+ case EbtSamplerCubeShadow:
+ return true;
+ case EbtSampler2D:
+ case EbtSampler3D:
+ case EbtSamplerExternalOES:
+ case EbtSampler2DRect:
+ case EbtSampler2DArray:
+ case EbtISampler2D:
+ case EbtISampler3D:
+ case EbtISampler2DArray:
+ case EbtUSampler2D:
+ case EbtUSampler3D:
+ case EbtUSampler2DArray:
+ case EbtSampler2DShadow:
+ case EbtSampler2DArrayShadow:
+ return false;
+ default:
+ assert(!IsSampler(type));
+ }
+
+ return false;
+}
+
+inline bool IsSampler3D(TBasicType type)
+{
+ switch (type)
+ {
+ case EbtSampler3D:
+ case EbtISampler3D:
+ case EbtUSampler3D:
+ return true;
+ case EbtSampler2D:
+ case EbtSamplerCube:
+ case EbtSamplerExternalOES:
+ case EbtSampler2DRect:
+ case EbtSampler2DArray:
+ case EbtISampler2D:
+ case EbtISamplerCube:
+ case EbtISampler2DArray:
+ case EbtUSampler2D:
+ case EbtUSamplerCube:
+ case EbtUSampler2DArray:
+ case EbtSampler2DShadow:
+ case EbtSamplerCubeShadow:
+ case EbtSampler2DArrayShadow:
+ return false;
+ default:
+ assert(!IsSampler(type));
+ }
+
+ return false;
+}
+
+inline bool IsSamplerArray(TBasicType type)
+{
+ switch (type)
+ {
+ case EbtSampler2DArray:
+ case EbtISampler2DArray:
+ case EbtUSampler2DArray:
+ case EbtSampler2DArrayShadow:
+ return true;
+ case EbtSampler2D:
+ case EbtISampler2D:
+ case EbtUSampler2D:
+ case EbtSampler2DRect:
+ case EbtSamplerExternalOES:
+ case EbtSampler3D:
+ case EbtISampler3D:
+ case EbtUSampler3D:
+ case EbtISamplerCube:
+ case EbtUSamplerCube:
+ case EbtSamplerCube:
+ case EbtSampler2DShadow:
+ case EbtSamplerCubeShadow:
+ return false;
+ default:
+ assert(!IsSampler(type));
+ }
+
+ return false;
+}
+
+inline bool IsShadowSampler(TBasicType type)
+{
+ switch (type)
+ {
+ case EbtSampler2DShadow:
+ case EbtSamplerCubeShadow:
+ case EbtSampler2DArrayShadow:
+ return true;
+ case EbtISampler2D:
+ case EbtISampler3D:
+ case EbtISamplerCube:
+ case EbtISampler2DArray:
+ case EbtUSampler2D:
+ case EbtUSampler3D:
+ case EbtUSamplerCube:
+ case EbtUSampler2DArray:
+ case EbtSampler2D:
+ case EbtSampler3D:
+ case EbtSamplerCube:
+ case EbtSamplerExternalOES:
+ case EbtSampler2DRect:
+ case EbtSampler2DArray:
+ return false;
+ default:
+ assert(!IsSampler(type));
+ }
+
+ return false;
+}
+
+inline bool SupportsPrecision(TBasicType type)
+{
+ return type == EbtFloat || type == EbtInt || type == EbtUInt || IsSampler(type);
+}
+
+//
+// Qualifiers and built-ins. These are mainly used to see what can be read
+// or written, and by the machine dependent translator to know which registers
+// to allocate variables in. Since built-ins tend to go to different registers
+// than varying or uniform, it makes sense they are peers, not sub-classes.
+//
+enum TQualifier
+{
+ EvqTemporary, // For temporaries (within a function), read/write
+ EvqGlobal, // For globals read/write
+ EvqInternal, // For internal use, not visible to the user
+ EvqConst, // User defined constants and non-output parameters in functions
+ EvqAttribute, // Readonly
+ EvqVaryingIn, // readonly, fragment shaders only
+ EvqVaryingOut, // vertex shaders only read/write
+ EvqInvariantVaryingIn, // readonly, fragment shaders only
+ EvqInvariantVaryingOut, // vertex shaders only read/write
+ EvqUniform, // Readonly, vertex and fragment
+
+ EvqVertexIn, // Vertex shader input
+ EvqFragmentOut, // Fragment shader output
+ EvqVertexOut, // Vertex shader output
+ EvqFragmentIn, // Fragment shader input
+
+ // parameters
+ EvqIn,
+ EvqOut,
+ EvqInOut,
+ EvqConstReadOnly,
+
+ // built-ins written by vertex shader
+ EvqPosition,
+ EvqPointSize,
+
+ // built-ins read by fragment shader
+ EvqFragCoord,
+ EvqFrontFacing,
+ EvqPointCoord,
+
+ // built-ins written by fragment shader
+ EvqFragColor,
+ EvqFragData,
+ EvqFragDepth,
+
+ // GLSL ES 3.0 vertex output and fragment input
+ EvqSmooth, // Incomplete qualifier, smooth is the default
+ EvqFlat, // Incomplete qualifier
+ EvqSmoothOut = EvqSmooth,
+ EvqFlatOut = EvqFlat,
+ EvqCentroidOut, // Implies smooth
+ EvqSmoothIn,
+ EvqFlatIn,
+ EvqCentroidIn, // Implies smooth
+
+ // end of list
+ EvqLast
+};
+
+enum TLayoutMatrixPacking
+{
+ EmpUnspecified,
+ EmpRowMajor,
+ EmpColumnMajor
+};
+
+enum TLayoutBlockStorage
+{
+ EbsUnspecified,
+ EbsShared,
+ EbsPacked,
+ EbsStd140
+};
+
+struct TLayoutQualifier
+{
+ int location;
+ TLayoutMatrixPacking matrixPacking;
+ TLayoutBlockStorage blockStorage;
+
+ static TLayoutQualifier create()
+ {
+ TLayoutQualifier layoutQualifier;
+
+ layoutQualifier.location = -1;
+ layoutQualifier.matrixPacking = EmpUnspecified;
+ layoutQualifier.blockStorage = EbsUnspecified;
+
+ return layoutQualifier;
+ }
+
+ bool isEmpty() const
+ {
+ return location == -1 && matrixPacking == EmpUnspecified && blockStorage == EbsUnspecified;
+ }
+};
+
+//
+// This is just for debug print out, carried along with the definitions above.
+//
+inline const char* getQualifierString(TQualifier q)
+{
+ switch(q)
+ {
+ case EvqTemporary: return "Temporary"; break;
+ case EvqGlobal: return "Global"; break;
+ case EvqConst: return "const"; break;
+ case EvqConstReadOnly: return "const"; break;
+ case EvqAttribute: return "attribute"; break;
+ case EvqVaryingIn: return "varying"; break;
+ case EvqVaryingOut: return "varying"; break;
+ case EvqInvariantVaryingIn: return "invariant varying"; break;
+ case EvqInvariantVaryingOut:return "invariant varying"; break;
+ case EvqUniform: return "uniform"; break;
+ case EvqVertexIn: return "in"; break;
+ case EvqFragmentOut: return "out"; break;
+ case EvqVertexOut: return "out"; break;
+ case EvqFragmentIn: return "in"; break;
+ case EvqIn: return "in"; break;
+ case EvqOut: return "out"; break;
+ case EvqInOut: return "inout"; break;
+ case EvqPosition: return "Position"; break;
+ case EvqPointSize: return "PointSize"; break;
+ case EvqFragCoord: return "FragCoord"; break;
+ case EvqFrontFacing: return "FrontFacing"; break;
+ case EvqFragColor: return "FragColor"; break;
+ case EvqFragData: return "FragData"; break;
+ case EvqFragDepth: return "FragDepth"; break;
+ case EvqSmoothOut: return "smooth out"; break;
+ case EvqCentroidOut: return "centroid out"; break;
+ case EvqFlatOut: return "flat out"; break;
+ case EvqSmoothIn: return "smooth in"; break;
+ case EvqCentroidIn: return "centroid in"; break;
+ case EvqFlatIn: return "flat in"; break;
+ default: return "unknown qualifier";
+ }
+}
+
+inline const char* getMatrixPackingString(TLayoutMatrixPacking mpq)
+{
+ switch (mpq)
+ {
+ case EmpUnspecified: return "mp_unspecified";
+ case EmpRowMajor: return "row_major";
+ case EmpColumnMajor: return "column_major";
+ default: return "unknown matrix packing";
+ }
+}
+
+inline const char* getBlockStorageString(TLayoutBlockStorage bsq)
+{
+ switch (bsq)
+ {
+ case EbsUnspecified: return "bs_unspecified";
+ case EbsShared: return "shared";
+ case EbsPacked: return "packed";
+ case EbsStd140: return "std140";
+ default: return "unknown block storage";
+ }
+}
+
+inline const char* getInterpolationString(TQualifier q)
+{
+ switch(q)
+ {
+ case EvqSmoothOut: return "smooth"; break;
+ case EvqCentroidOut: return "centroid"; break;
+ case EvqFlatOut: return "flat"; break;
+ case EvqSmoothIn: return "smooth"; break;
+ case EvqCentroidIn: return "centroid"; break;
+ case EvqFlatIn: return "flat"; break;
+ default: return "unknown interpolation";
+ }
+}
+
+#endif // _BASICTYPES_INCLUDED_
diff --git a/chromium/third_party/angle/src/compiler/BuiltInFunctionEmulator.cpp b/chromium/third_party/angle/src/compiler/translator/BuiltInFunctionEmulator.cpp
index 1c4b25f13f0..afbc16926ff 100644
--- a/chromium/third_party/angle/src/compiler/BuiltInFunctionEmulator.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/BuiltInFunctionEmulator.cpp
@@ -4,9 +4,9 @@
// found in the LICENSE file.
//
-#include "compiler/BuiltInFunctionEmulator.h"
+#include "compiler/translator/BuiltInFunctionEmulator.h"
-#include "compiler/SymbolTable.h"
+#include "compiler/translator/SymbolTable.h"
namespace {
@@ -327,7 +327,7 @@ BuiltInFunctionEmulator::TBuiltInFunction
BuiltInFunctionEmulator::IdentifyFunction(
TOperator op, const TType& param)
{
- if (param.getNominalSize() > 4)
+ if (param.getNominalSize() > 4 || param.getSecondarySize() > 4)
return TFunctionUnknown;
unsigned int function = TFunctionUnknown;
switch (op) {
@@ -356,9 +356,9 @@ BuiltInFunctionEmulator::IdentifyFunction(
{
// Right now for all the emulated functions with two parameters, the two
// parameters have the same type.
- if (param1.isVector() != param2.isVector() ||
- param1.getNominalSize() != param2.getNominalSize() ||
- param1.getNominalSize() > 4)
+ if (param1.getNominalSize() != param2.getNominalSize() ||
+ param1.getSecondarySize() != param2.getSecondarySize() ||
+ param1.getNominalSize() > 4 || param1.getSecondarySize() > 4)
return TFunctionUnknown;
unsigned int function = TFunctionUnknown;
diff --git a/chromium/third_party/angle/src/compiler/BuiltInFunctionEmulator.h b/chromium/third_party/angle/src/compiler/translator/BuiltInFunctionEmulator.h
index 0d904f41d09..9367b558ac0 100644
--- a/chromium/third_party/angle/src/compiler/BuiltInFunctionEmulator.h
+++ b/chromium/third_party/angle/src/compiler/translator/BuiltInFunctionEmulator.h
@@ -7,10 +7,8 @@
#ifndef COMPILIER_BUILT_IN_FUNCTION_EMULATOR_H_
#define COMPILIER_BUILT_IN_FUNCTION_EMULATOR_H_
-#include "GLSLANG/ShaderLang.h"
-
-#include "compiler/InfoSink.h"
-#include "compiler/intermediate.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/intermediate.h"
//
// This class decides which built-in functions need to be replaced with the
diff --git a/chromium/third_party/angle/src/compiler/CodeGen.cpp b/chromium/third_party/angle/src/compiler/translator/CodeGen.cpp
index 24f21b87617..c35dbdc77ff 100644
--- a/chromium/third_party/angle/src/compiler/CodeGen.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/CodeGen.cpp
@@ -1,12 +1,12 @@
//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-#include "compiler/TranslatorESSL.h"
-#include "compiler/TranslatorGLSL.h"
-#include "compiler/TranslatorHLSL.h"
+#include "compiler/translator/TranslatorESSL.h"
+#include "compiler/translator/TranslatorGLSL.h"
+#include "compiler/translator/TranslatorHLSL.h"
//
// This function must be provided to create the actual
@@ -17,14 +17,14 @@ TCompiler* ConstructCompiler(
ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
{
switch (output) {
- case SH_ESSL_OUTPUT:
+ case SH_ESSL_OUTPUT:
return new TranslatorESSL(type, spec);
- case SH_GLSL_OUTPUT:
+ case SH_GLSL_OUTPUT:
return new TranslatorGLSL(type, spec);
- case SH_HLSL9_OUTPUT:
- case SH_HLSL11_OUTPUT:
+ case SH_HLSL9_OUTPUT:
+ case SH_HLSL11_OUTPUT:
return new TranslatorHLSL(type, spec, output);
- default:
+ default:
return NULL;
}
}
diff --git a/chromium/third_party/angle/src/compiler/Common.h b/chromium/third_party/angle/src/compiler/translator/Common.h
index 46f9440fff1..1e4503e340c 100644
--- a/chromium/third_party/angle/src/compiler/Common.h
+++ b/chromium/third_party/angle/src/compiler/translator/Common.h
@@ -11,8 +11,12 @@
#include <sstream>
#include <string>
#include <vector>
+#include <limits>
+#include <stdio.h>
-#include "compiler/PoolAlloc.h"
+#include "compiler/translator/PoolAlloc.h"
+#include "compiler/translator/compilerdebug.h"
+#include "common/angleutils.h"
struct TSourceLoc {
int first_file;
@@ -74,4 +78,15 @@ public:
TMap(const tAllocator& a) : std::map<K, D, CMP, tAllocator>(std::map<K, D, CMP, tAllocator>::key_compare(), a) {}
};
+// Integer to TString conversion
+template <typename T>
+inline TString str(T i)
+{
+ ASSERT(std::numeric_limits<T>::is_integer);
+ char buffer[((8 * sizeof(T)) / 3) + 3];
+ const char *formatStr = std::numeric_limits<T>::is_signed ? "%d" : "%u";
+ snprintf(buffer, sizeof(buffer), formatStr, i);
+ return buffer;
+}
+
#endif // _COMMON_INCLUDED_
diff --git a/chromium/third_party/angle/src/compiler/Compiler.cpp b/chromium/third_party/angle/src/compiler/translator/Compiler.cpp
index 54ca70826ae..402715b8af1 100644
--- a/chromium/third_party/angle/src/compiler/Compiler.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/Compiler.cpp
@@ -1,78 +1,101 @@
//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-#include "compiler/BuiltInFunctionEmulator.h"
-#include "compiler/DetectCallDepth.h"
-#include "compiler/ForLoopUnroll.h"
-#include "compiler/Initialize.h"
-#include "compiler/InitializeGLPosition.h"
-#include "compiler/InitializeParseContext.h"
-#include "compiler/MapLongVariableNames.h"
-#include "compiler/ParseContext.h"
-#include "compiler/RenameFunction.h"
-#include "compiler/ShHandle.h"
-#include "compiler/UnfoldShortCircuitAST.h"
-#include "compiler/ValidateLimitations.h"
-#include "compiler/VariablePacker.h"
-#include "compiler/depgraph/DependencyGraph.h"
-#include "compiler/depgraph/DependencyGraphOutput.h"
-#include "compiler/timing/RestrictFragmentShaderTiming.h"
-#include "compiler/timing/RestrictVertexShaderTiming.h"
+#include "compiler/translator/BuiltInFunctionEmulator.h"
+#include "compiler/translator/DetectCallDepth.h"
+#include "compiler/translator/ForLoopUnroll.h"
+#include "compiler/translator/Initialize.h"
+#include "compiler/translator/InitializeParseContext.h"
+#include "compiler/translator/InitializeVariables.h"
+#include "compiler/translator/ParseContext.h"
+#include "compiler/translator/RenameFunction.h"
+#include "compiler/translator/ShHandle.h"
+#include "compiler/translator/UnfoldShortCircuitAST.h"
+#include "compiler/translator/ValidateLimitations.h"
+#include "compiler/translator/ValidateOutputs.h"
+#include "compiler/translator/VariablePacker.h"
+#include "compiler/translator/depgraph/DependencyGraph.h"
+#include "compiler/translator/depgraph/DependencyGraphOutput.h"
+#include "compiler/translator/timing/RestrictFragmentShaderTiming.h"
+#include "compiler/translator/timing/RestrictVertexShaderTiming.h"
#include "third_party/compiler/ArrayBoundsClamper.h"
-bool isWebGLBasedSpec(ShShaderSpec spec)
+bool IsWebGLBasedSpec(ShShaderSpec spec)
{
return spec == SH_WEBGL_SPEC || spec == SH_CSS_SHADERS_SPEC;
}
+size_t GetGlobalMaxTokenSize(ShShaderSpec spec)
+{
+ // WebGL defines a max token legnth of 256, while ES2 leaves max token
+ // size undefined. ES3 defines a max size of 1024 characters.
+ if (IsWebGLBasedSpec(spec))
+ {
+ return 256;
+ }
+ else
+ {
+ return 1024;
+ }
+}
+
namespace {
-class TScopedPoolAllocator {
-public:
- TScopedPoolAllocator(TPoolAllocator* allocator) : mAllocator(allocator) {
+class TScopedPoolAllocator
+{
+ public:
+ TScopedPoolAllocator(TPoolAllocator* allocator) : mAllocator(allocator)
+ {
mAllocator->push();
SetGlobalPoolAllocator(mAllocator);
}
- ~TScopedPoolAllocator() {
+ ~TScopedPoolAllocator()
+ {
SetGlobalPoolAllocator(NULL);
mAllocator->pop();
}
-private:
+ private:
TPoolAllocator* mAllocator;
};
-class TScopedSymbolTableLevel {
-public:
- TScopedSymbolTableLevel(TSymbolTable* table) : mTable(table) {
+class TScopedSymbolTableLevel
+{
+ public:
+ TScopedSymbolTableLevel(TSymbolTable* table) : mTable(table)
+ {
ASSERT(mTable->atBuiltInLevel());
mTable->push();
}
- ~TScopedSymbolTableLevel() {
+ ~TScopedSymbolTableLevel()
+ {
while (!mTable->atBuiltInLevel())
mTable->pop();
}
-private:
+ private:
TSymbolTable* mTable;
};
} // namespace
-TShHandleBase::TShHandleBase() {
+TShHandleBase::TShHandleBase()
+{
allocator.push();
SetGlobalPoolAllocator(&allocator);
}
-TShHandleBase::~TShHandleBase() {
+TShHandleBase::~TShHandleBase()
+{
SetGlobalPoolAllocator(NULL);
allocator.popAll();
}
-TCompiler::TCompiler(ShShaderType type, ShShaderSpec spec)
+TCompiler::TCompiler(ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
: shaderType(type),
shaderSpec(spec),
+ outputType(output),
maxUniformVectors(0),
maxExpressionComplexity(0),
maxCallStackDepth(0),
@@ -80,17 +103,15 @@ TCompiler::TCompiler(ShShaderType type, ShShaderSpec spec)
clampingStrategy(SH_CLAMP_WITH_CLAMP_INTRINSIC),
builtInFunctionEmulator(type)
{
- longNameMap = LongNameMap::GetInstance();
}
TCompiler::~TCompiler()
{
- ASSERT(longNameMap);
- longNameMap->Release();
}
bool TCompiler::Init(const ShBuiltInResources& resources)
{
+ shaderVersion = 100;
maxUniformVectors = (shaderType == SH_VERTEX_SHADER) ?
resources.MaxVertexUniformVectors :
resources.MaxFragmentUniformVectors;
@@ -124,7 +145,7 @@ bool TCompiler::compile(const char* const shaderStrings[],
return true;
// If compiling for WebGL, validate loop and indexing as well.
- if (isWebGLBasedSpec(shaderSpec))
+ if (IsWebGLBasedSpec(shaderSpec))
compileOptions |= SH_VALIDATE_LOOP_INDEXING;
// First string is path of source file if flag is set. The actual source follows.
@@ -151,13 +172,24 @@ bool TCompiler::compile(const char* const shaderStrings[],
bool success =
(PaParseStrings(numStrings - firstSource, &shaderStrings[firstSource], NULL, &parseContext) == 0) &&
(parseContext.treeRoot != NULL);
- if (success) {
+
+ shaderVersion = parseContext.getShaderVersion();
+
+ if (success)
+ {
TIntermNode* root = parseContext.treeRoot;
success = intermediate.postProcess(root);
+ // Disallow expressions deemed too complex.
+ if (success && (compileOptions & SH_LIMIT_EXPRESSION_COMPLEXITY))
+ success = limitExpressionComplexity(root);
+
if (success)
success = detectCallDepth(root, infoSink, (compileOptions & SH_LIMIT_CALL_STACK_DEPTH) != 0);
+ if (success && shaderVersion == 300 && shaderType == SH_FRAGMENT_SHADER)
+ success = validateOutputs(root);
+
if (success && (compileOptions & SH_VALIDATE_LOOP_INDEXING))
success = validateLimitations(root);
@@ -169,7 +201,21 @@ bool TCompiler::compile(const char* const shaderStrings[],
// Unroll for-loop markup needs to happen after validateLimitations pass.
if (success && (compileOptions & SH_UNROLL_FOR_LOOP_WITH_INTEGER_INDEX))
- ForLoopUnroll::MarkForLoopsWithIntegerIndicesForUnrolling(root);
+ {
+ ForLoopUnrollMarker marker(ForLoopUnrollMarker::kIntegerIndex);
+ root->traverse(&marker);
+ }
+ if (success && (compileOptions & SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX))
+ {
+ ForLoopUnrollMarker marker(ForLoopUnrollMarker::kSamplerArrayIndex);
+ root->traverse(&marker);
+ if (marker.samplerArrayIndexIsFloatLoopIndex())
+ {
+ infoSink.info.prefix(EPrefixError);
+ infoSink.info << "sampler array index is float loop index";
+ success = false;
+ }
+ }
// Built-in function emulation needs to happen after validateLimitations pass.
if (success && (compileOptions & SH_EMULATE_BUILT_IN_FUNCTIONS))
@@ -179,37 +225,31 @@ bool TCompiler::compile(const char* const shaderStrings[],
if (success && (compileOptions & SH_CLAMP_INDIRECT_ARRAY_BOUNDS))
arrayBoundsClamper.MarkIndirectArrayBoundsForClamping(root);
- // Disallow expressions deemed too complex.
- if (success && (compileOptions & SH_LIMIT_EXPRESSION_COMPLEXITY))
- success = limitExpressionComplexity(root);
-
- // Call mapLongVariableNames() before collectAttribsUniforms() so in
- // collectAttribsUniforms() we already have the mapped symbol names and
- // we could composite mapped and original variable names.
- // Also, if we hash all the names, then no need to do this for long names.
- if (success && (compileOptions & SH_MAP_LONG_VARIABLE_NAMES) && hashFunction == NULL)
- mapLongVariableNames(root);
+ if (success && shaderType == SH_VERTEX_SHADER && (compileOptions & SH_INIT_GL_POSITION))
+ initializeGLPosition(root);
- if (success && shaderType == SH_VERTEX_SHADER && (compileOptions & SH_INIT_GL_POSITION)) {
- InitializeGLPosition initGLPosition;
- root->traverse(&initGLPosition);
- }
-
- if (success && (compileOptions & SH_UNFOLD_SHORT_CIRCUIT)) {
+ if (success && (compileOptions & SH_UNFOLD_SHORT_CIRCUIT))
+ {
UnfoldShortCircuitAST unfoldShortCircuit;
root->traverse(&unfoldShortCircuit);
unfoldShortCircuit.updateTree();
- }
+ }
- if (success && (compileOptions & SH_VARIABLES)) {
+ if (success && (compileOptions & SH_VARIABLES))
+ {
collectVariables(root);
- if (compileOptions & SH_ENFORCE_PACKING_RESTRICTIONS) {
+ if (compileOptions & SH_ENFORCE_PACKING_RESTRICTIONS)
+ {
success = enforcePackingRestrictions();
- if (!success) {
+ if (!success)
+ {
infoSink.info.prefix(EPrefixError);
infoSink.info << "too many uniforms";
}
}
+ if (success && shaderType == SH_VERTEX_SHADER &&
+ (compileOptions & SH_INIT_VARYINGS_WITHOUT_STATIC_USE))
+ initializeVaryingsWithoutStaticUse(root);
}
if (success && (compileOptions & SH_INTERMEDIATE_TREE))
@@ -221,32 +261,35 @@ bool TCompiler::compile(const char* const shaderStrings[],
// Cleanup memory.
intermediate.remove(parseContext.treeRoot);
-
+ SetGlobalParseContext(NULL);
return success;
}
bool TCompiler::InitBuiltInSymbolTable(const ShBuiltInResources &resources)
{
compileResources = resources;
+ setResourceString();
assert(symbolTable.isEmpty());
- symbolTable.push();
+ symbolTable.push(); // COMMON_BUILTINS
+ symbolTable.push(); // ESSL1_BUILTINS
+ symbolTable.push(); // ESSL3_BUILTINS
TPublicType integer;
integer.type = EbtInt;
- integer.size = 1;
- integer.matrix = false;
+ integer.primarySize = 1;
+ integer.secondarySize = 1;
integer.array = false;
TPublicType floatingPoint;
floatingPoint.type = EbtFloat;
- floatingPoint.size = 1;
- floatingPoint.matrix = false;
+ floatingPoint.primarySize = 1;
+ floatingPoint.secondarySize = 1;
floatingPoint.array = false;
TPublicType sampler;
- sampler.size = 1;
- sampler.matrix = false;
+ sampler.primarySize = 1;
+ sampler.secondarySize = 1;
sampler.array = false;
switch(shaderType)
@@ -258,12 +301,14 @@ bool TCompiler::InitBuiltInSymbolTable(const ShBuiltInResources &resources)
symbolTable.setDefaultPrecision(integer, EbpHigh);
symbolTable.setDefaultPrecision(floatingPoint, EbpHigh);
break;
- default: assert(false && "Language not supported");
+ default:
+ assert(false && "Language not supported");
}
// We set defaults for all the sampler types, even those that are
// only available if an extension exists.
for (int samplerType = EbtGuardSamplerBegin + 1;
- samplerType < EbtGuardSamplerEnd; ++samplerType) {
+ samplerType < EbtGuardSamplerEnd; ++samplerType)
+ {
sampler.type = static_cast<TBasicType>(samplerType);
symbolTable.setDefaultPrecision(sampler, EbpLow);
}
@@ -275,6 +320,34 @@ bool TCompiler::InitBuiltInSymbolTable(const ShBuiltInResources &resources)
return true;
}
+void TCompiler::setResourceString()
+{
+ std::ostringstream strstream;
+ strstream << ":MaxVertexAttribs:" << compileResources.MaxVertexAttribs
+ << ":MaxVertexUniformVectors:" << compileResources.MaxVertexUniformVectors
+ << ":MaxVaryingVectors:" << compileResources.MaxVaryingVectors
+ << ":MaxVertexTextureImageUnits:" << compileResources.MaxVertexTextureImageUnits
+ << ":MaxCombinedTextureImageUnits:" << compileResources.MaxCombinedTextureImageUnits
+ << ":MaxTextureImageUnits:" << compileResources.MaxTextureImageUnits
+ << ":MaxFragmentUniformVectors:" << compileResources.MaxFragmentUniformVectors
+ << ":MaxDrawBuffers:" << compileResources.MaxDrawBuffers
+ << ":OES_standard_derivatives:" << compileResources.OES_standard_derivatives
+ << ":OES_EGL_image_external:" << compileResources.OES_EGL_image_external
+ << ":ARB_texture_rectangle:" << compileResources.ARB_texture_rectangle
+ << ":EXT_draw_buffers:" << compileResources.EXT_draw_buffers
+ << ":FragmentPrecisionHigh:" << compileResources.FragmentPrecisionHigh
+ << ":MaxExpressionComplexity:" << compileResources.MaxExpressionComplexity
+ << ":MaxCallStackDepth:" << compileResources.MaxCallStackDepth
+ << ":EXT_frag_depth:" << compileResources.EXT_frag_depth
+ << ":EXT_shader_texture_lod:" << compileResources.EXT_shader_texture_lod
+ << ":MaxVertexOutputVectors:" << compileResources.MaxVertexOutputVectors
+ << ":MaxFragmentInputVectors:" << compileResources.MaxFragmentInputVectors
+ << ":MinProgramTexelOffset:" << compileResources.MinProgramTexelOffset
+ << ":MaxProgramTexelOffset:" << compileResources.MaxProgramTexelOffset;
+
+ builtInResourcesString = strstream.str();
+}
+
void TCompiler::clearResults()
{
arrayBoundsClamper.Cleanup();
@@ -295,34 +368,43 @@ bool TCompiler::detectCallDepth(TIntermNode* root, TInfoSink& infoSink, bool lim
{
DetectCallDepth detect(infoSink, limitCallStackDepth, maxCallStackDepth);
root->traverse(&detect);
- switch (detect.detectCallDepth()) {
- case DetectCallDepth::kErrorNone:
- return true;
- case DetectCallDepth::kErrorMissingMain:
- infoSink.info.prefix(EPrefixError);
- infoSink.info << "Missing main()";
- return false;
- case DetectCallDepth::kErrorRecursion:
- infoSink.info.prefix(EPrefixError);
- infoSink.info << "Function recursion detected";
- return false;
- case DetectCallDepth::kErrorMaxDepthExceeded:
- infoSink.info.prefix(EPrefixError);
- infoSink.info << "Function call stack too deep";
- return false;
- default:
- UNREACHABLE();
- return false;
+ switch (detect.detectCallDepth())
+ {
+ case DetectCallDepth::kErrorNone:
+ return true;
+ case DetectCallDepth::kErrorMissingMain:
+ infoSink.info.prefix(EPrefixError);
+ infoSink.info << "Missing main()";
+ return false;
+ case DetectCallDepth::kErrorRecursion:
+ infoSink.info.prefix(EPrefixError);
+ infoSink.info << "Function recursion detected";
+ return false;
+ case DetectCallDepth::kErrorMaxDepthExceeded:
+ infoSink.info.prefix(EPrefixError);
+ infoSink.info << "Function call stack too deep";
+ return false;
+ default:
+ UNREACHABLE();
+ return false;
}
}
+bool TCompiler::validateOutputs(TIntermNode* root)
+{
+ ValidateOutputs validateOutputs(infoSink.info, compileResources.MaxDrawBuffers);
+ root->traverse(&validateOutputs);
+ return (validateOutputs.numErrors() == 0);
+}
+
void TCompiler::rewriteCSSShader(TIntermNode* root)
{
RenameFunction renamer("main(", "css_main(");
root->traverse(&renamer);
}
-bool TCompiler::validateLimitations(TIntermNode* root) {
+bool TCompiler::validateLimitations(TIntermNode* root)
+{
ValidateLimitations validate(shaderType, infoSink.info);
root->traverse(&validate);
return validate.numErrors() == 0;
@@ -330,34 +412,45 @@ bool TCompiler::validateLimitations(TIntermNode* root) {
bool TCompiler::enforceTimingRestrictions(TIntermNode* root, bool outputGraph)
{
- if (shaderSpec != SH_WEBGL_SPEC) {
+ if (shaderSpec != SH_WEBGL_SPEC)
+ {
infoSink.info << "Timing restrictions must be enforced under the WebGL spec.";
return false;
}
- if (shaderType == SH_FRAGMENT_SHADER) {
+ if (shaderType == SH_FRAGMENT_SHADER)
+ {
TDependencyGraph graph(root);
// Output any errors first.
bool success = enforceFragmentShaderTimingRestrictions(graph);
-
+
// Then, output the dependency graph.
- if (outputGraph) {
+ if (outputGraph)
+ {
TDependencyGraphOutput output(infoSink.info);
output.outputAllSpanningTrees(graph);
}
-
+
return success;
}
- else {
+ else
+ {
return enforceVertexShaderTimingRestrictions(root);
}
}
bool TCompiler::limitExpressionComplexity(TIntermNode* root)
{
- TIntermTraverser traverser;
+ TMaxDepthTraverser traverser(maxExpressionComplexity+1);
root->traverse(&traverser);
+
+ if (traverser.getMaxDepth() > maxExpressionComplexity)
+ {
+ infoSink.info << "Expression too complex.";
+ return false;
+ }
+
TDependencyGraph graph(root);
for (TFunctionCallVector::const_iterator iter = graph.beginUserDefinedFunctionCalls();
@@ -369,10 +462,6 @@ bool TCompiler::limitExpressionComplexity(TIntermNode* root)
samplerSymbol->traverse(&graphTraverser);
}
- if (traverser.getMaxDepth() > maxExpressionComplexity) {
- infoSink.info << "Expression too complex.";
- return false;
- }
return true;
}
@@ -402,16 +491,66 @@ bool TCompiler::enforcePackingRestrictions()
return packer.CheckVariablesWithinPackingLimits(maxUniformVectors, uniforms);
}
-void TCompiler::mapLongVariableNames(TIntermNode* root)
+void TCompiler::initializeGLPosition(TIntermNode* root)
{
- ASSERT(longNameMap);
- MapLongVariableNames map(longNameMap);
- root->traverse(&map);
+ InitializeVariables::InitVariableInfoList variables;
+ InitializeVariables::InitVariableInfo var(
+ "gl_Position", TType(EbtFloat, EbpUndefined, EvqPosition, 4));
+ variables.push_back(var);
+ InitializeVariables initializer(variables);
+ root->traverse(&initializer);
}
-int TCompiler::getMappedNameMaxLength() const
+void TCompiler::initializeVaryingsWithoutStaticUse(TIntermNode* root)
{
- return MAX_SHORTENED_IDENTIFIER_SIZE + 1;
+ InitializeVariables::InitVariableInfoList variables;
+ for (size_t ii = 0; ii < varyings.size(); ++ii)
+ {
+ const TVariableInfo& varying = varyings[ii];
+ if (varying.staticUse)
+ continue;
+ unsigned char primarySize = 1, secondarySize = 1;
+ switch (varying.type)
+ {
+ case SH_FLOAT:
+ break;
+ case SH_FLOAT_VEC2:
+ primarySize = 2;
+ break;
+ case SH_FLOAT_VEC3:
+ primarySize = 3;
+ break;
+ case SH_FLOAT_VEC4:
+ primarySize = 4;
+ break;
+ case SH_FLOAT_MAT2:
+ primarySize = 2;
+ secondarySize = 2;
+ break;
+ case SH_FLOAT_MAT3:
+ primarySize = 3;
+ secondarySize = 3;
+ break;
+ case SH_FLOAT_MAT4:
+ primarySize = 4;
+ secondarySize = 4;
+ break;
+ default:
+ ASSERT(false);
+ }
+ TType type(EbtFloat, EbpUndefined, EvqVaryingOut, primarySize, secondarySize, varying.isArray);
+ TString name = varying.name.c_str();
+ if (varying.isArray)
+ {
+ type.setArraySize(varying.size);
+ name = name.substr(0, name.find_first_of('['));
+ }
+
+ InitializeVariables::InitVariableInfo var(name, type);
+ variables.push_back(var);
+ }
+ InitializeVariables initializer(variables);
+ root->traverse(&initializer);
}
const TExtensionBehavior& TCompiler::getExtensionBehavior() const
diff --git a/chromium/third_party/angle/src/compiler/ConstantUnion.h b/chromium/third_party/angle/src/compiler/translator/ConstantUnion.h
index b1e37885f90..5fdba61546c 100644
--- a/chromium/third_party/angle/src/compiler/ConstantUnion.h
+++ b/chromium/third_party/angle/src/compiler/translator/ConstantUnion.h
@@ -19,13 +19,12 @@ public:
}
void setIConst(int i) {iConst = i; type = EbtInt; }
+ void setUConst(unsigned int u) { uConst = u; type = EbtUInt; }
void setFConst(float f) {fConst = f; type = EbtFloat; }
void setBConst(bool b) {bConst = b; type = EbtBool; }
- int getIConst() { return iConst; }
- float getFConst() { return fConst; }
- bool getBConst() { return bConst; }
int getIConst() const { return iConst; }
+ unsigned int getUConst() const { return uConst; }
float getFConst() const { return fConst; }
bool getBConst() const { return bConst; }
@@ -34,6 +33,11 @@ public:
return i == iConst;
}
+ bool operator==(const unsigned int u) const
+ {
+ return u == uConst;
+ }
+
bool operator==(const float f) const
{
return f == fConst;
@@ -52,6 +56,8 @@ public:
switch (type) {
case EbtInt:
return constant.iConst == iConst;
+ case EbtUInt:
+ return constant.uConst == uConst;
case EbtFloat:
return constant.fConst == fConst;
case EbtBool:
@@ -66,6 +72,11 @@ public:
return !operator==(i);
}
+ bool operator!=(const unsigned int u) const
+ {
+ return !operator==(u);
+ }
+
bool operator!=(const float f) const
{
return !operator==(f);
@@ -87,6 +98,8 @@ public:
switch (type) {
case EbtInt:
return iConst > constant.iConst;
+ case EbtUInt:
+ return uConst > constant.uConst;
case EbtFloat:
return fConst > constant.fConst;
default:
@@ -100,6 +113,8 @@ public:
switch (type) {
case EbtInt:
return iConst < constant.iConst;
+ case EbtUInt:
+ return uConst < constant.uConst;
case EbtFloat:
return fConst < constant.fConst;
default:
@@ -113,6 +128,7 @@ public:
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst + constant.iConst); break;
+ case EbtUInt: returnValue.setUConst(uConst + constant.uConst); break;
case EbtFloat: returnValue.setFConst(fConst + constant.fConst); break;
default: assert(false && "Default missing");
}
@@ -126,6 +142,7 @@ public:
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst - constant.iConst); break;
+ case EbtUInt: returnValue.setUConst(uConst - constant.uConst); break;
case EbtFloat: returnValue.setFConst(fConst - constant.fConst); break;
default: assert(false && "Default missing");
}
@@ -139,6 +156,7 @@ public:
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst * constant.iConst); break;
+ case EbtUInt: returnValue.setUConst(uConst * constant.uConst); break;
case EbtFloat: returnValue.setFConst(fConst * constant.fConst); break;
default: assert(false && "Default missing");
}
@@ -152,6 +170,7 @@ public:
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst % constant.iConst); break;
+ case EbtUInt: returnValue.setUConst(uConst % constant.uConst); break;
default: assert(false && "Default missing");
}
@@ -164,6 +183,7 @@ public:
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst >> constant.iConst); break;
+ case EbtUInt: returnValue.setUConst(uConst >> constant.uConst); break;
default: assert(false && "Default missing");
}
@@ -176,6 +196,7 @@ public:
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst << constant.iConst); break;
+ case EbtUInt: returnValue.setUConst(uConst << constant.uConst); break;
default: assert(false && "Default missing");
}
@@ -188,6 +209,7 @@ public:
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst & constant.iConst); break;
+ case EbtUInt: returnValue.setUConst(uConst & constant.uConst); break;
default: assert(false && "Default missing");
}
@@ -200,6 +222,7 @@ public:
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst | constant.iConst); break;
+ case EbtUInt: returnValue.setUConst(uConst | constant.uConst); break;
default: assert(false && "Default missing");
}
@@ -212,6 +235,7 @@ public:
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst ^ constant.iConst); break;
+ case EbtUInt: returnValue.setUConst(uConst ^ constant.uConst); break;
default: assert(false && "Default missing");
}
@@ -247,6 +271,7 @@ private:
union {
int iConst; // used for ivec, scalar ints
+ unsigned int uConst; // used for uvec, scalar uints
bool bConst; // used for bvec, scalar bools
float fConst; // used for vec, mat, scalar floats
} ;
diff --git a/chromium/third_party/angle/src/compiler/DetectCallDepth.cpp b/chromium/third_party/angle/src/compiler/translator/DetectCallDepth.cpp
index 60df52c7151..bfc1d5852ff 100644
--- a/chromium/third_party/angle/src/compiler/DetectCallDepth.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/DetectCallDepth.cpp
@@ -4,8 +4,8 @@
// found in the LICENSE file.
//
-#include "compiler/DetectCallDepth.h"
-#include "compiler/InfoSink.h"
+#include "compiler/translator/DetectCallDepth.h"
+#include "compiler/translator/InfoSink.h"
DetectCallDepth::FunctionNode::FunctionNode(const TString& fname)
: name(fname),
diff --git a/chromium/third_party/angle/src/compiler/DetectCallDepth.h b/chromium/third_party/angle/src/compiler/translator/DetectCallDepth.h
index 89e85f88f6e..cb76f1de02a 100644
--- a/chromium/third_party/angle/src/compiler/DetectCallDepth.h
+++ b/chromium/third_party/angle/src/compiler/translator/DetectCallDepth.h
@@ -7,11 +7,9 @@
#ifndef COMPILER_DETECT_RECURSION_H_
#define COMPILER_DETECT_RECURSION_H_
-#include "GLSLANG/ShaderLang.h"
-
#include <limits.h>
-#include "compiler/intermediate.h"
-#include "compiler/VariableInfo.h"
+#include "compiler/translator/intermediate.h"
+#include "compiler/translator/VariableInfo.h"
class TInfoSink;
diff --git a/chromium/third_party/angle/src/compiler/DetectDiscontinuity.cpp b/chromium/third_party/angle/src/compiler/translator/DetectDiscontinuity.cpp
index 8cfe49ba224..334eb0bfa8b 100644
--- a/chromium/third_party/angle/src/compiler/DetectDiscontinuity.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/DetectDiscontinuity.cpp
@@ -8,9 +8,9 @@
// gradients of functions with discontinuities.
//
-#include "compiler/DetectDiscontinuity.h"
+#include "compiler/translator/DetectDiscontinuity.h"
-#include "compiler/ParseContext.h"
+#include "compiler/translator/ParseContext.h"
namespace sh
{
diff --git a/chromium/third_party/angle/src/compiler/DetectDiscontinuity.h b/chromium/third_party/angle/src/compiler/translator/DetectDiscontinuity.h
index e5520bd5b02..1dd8be92335 100644
--- a/chromium/third_party/angle/src/compiler/DetectDiscontinuity.h
+++ b/chromium/third_party/angle/src/compiler/translator/DetectDiscontinuity.h
@@ -11,7 +11,7 @@
#ifndef COMPILER_DETECTDISCONTINUITY_H_
#define COMPILER_DETECTDISCONTINUITY_H_
-#include "compiler/intermediate.h"
+#include "compiler/translator/intermediate.h"
namespace sh
{
diff --git a/chromium/third_party/angle/src/compiler/Diagnostics.cpp b/chromium/third_party/angle/src/compiler/translator/Diagnostics.cpp
index 1c1b9b5ed53..92db3e55cfb 100644
--- a/chromium/third_party/angle/src/compiler/Diagnostics.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/Diagnostics.cpp
@@ -1,13 +1,13 @@
//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-#include "compiler/Diagnostics.h"
+#include "compiler/translator/Diagnostics.h"
-#include "compiler/debug.h"
-#include "compiler/InfoSink.h"
+#include "compiler/translator/compilerdebug.h"
+#include "compiler/translator/InfoSink.h"
#include "compiler/preprocessor/SourceLocation.h"
TDiagnostics::TDiagnostics(TInfoSink& infoSink) :
diff --git a/chromium/third_party/angle/src/compiler/Diagnostics.h b/chromium/third_party/angle/src/compiler/translator/Diagnostics.h
index cb71bb12042..664da7803b8 100644
--- a/chromium/third_party/angle/src/compiler/Diagnostics.h
+++ b/chromium/third_party/angle/src/compiler/translator/Diagnostics.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/third_party/angle/src/compiler/DirectiveHandler.cpp b/chromium/third_party/angle/src/compiler/translator/DirectiveHandler.cpp
index 6d3d831a399..59d2835f7b7 100644
--- a/chromium/third_party/angle/src/compiler/DirectiveHandler.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/DirectiveHandler.cpp
@@ -1,15 +1,15 @@
//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-#include "compiler/DirectiveHandler.h"
+#include "compiler/translator/DirectiveHandler.h"
#include <sstream>
-#include "compiler/debug.h"
-#include "compiler/Diagnostics.h"
+#include "compiler/translator/compilerdebug.h"
+#include "compiler/translator/Diagnostics.h"
static TBehavior getBehavior(const std::string& str)
{
@@ -26,9 +26,11 @@ static TBehavior getBehavior(const std::string& str)
}
TDirectiveHandler::TDirectiveHandler(TExtensionBehavior& extBehavior,
- TDiagnostics& diagnostics)
+ TDiagnostics& diagnostics,
+ int& shaderVersion)
: mExtensionBehavior(extBehavior),
- mDiagnostics(diagnostics)
+ mDiagnostics(diagnostics),
+ mShaderVersion(shaderVersion)
{
}
@@ -148,9 +150,12 @@ void TDirectiveHandler::handleExtension(const pp::SourceLocation& loc,
void TDirectiveHandler::handleVersion(const pp::SourceLocation& loc,
int version)
{
- static const int kVersion = 100;
-
- if (version != kVersion)
+ if (version == 100 ||
+ version == 300)
+ {
+ mShaderVersion = version;
+ }
+ else
{
std::stringstream stream;
stream << version;
diff --git a/chromium/third_party/angle/src/compiler/DirectiveHandler.h b/chromium/third_party/angle/src/compiler/translator/DirectiveHandler.h
index 95ca59d6fe5..69418c277af 100644
--- a/chromium/third_party/angle/src/compiler/DirectiveHandler.h
+++ b/chromium/third_party/angle/src/compiler/translator/DirectiveHandler.h
@@ -7,8 +7,8 @@
#ifndef COMPILER_DIRECTIVE_HANDLER_H_
#define COMPILER_DIRECTIVE_HANDLER_H_
-#include "compiler/ExtensionBehavior.h"
-#include "compiler/Pragma.h"
+#include "compiler/translator/ExtensionBehavior.h"
+#include "compiler/translator/Pragma.h"
#include "compiler/preprocessor/DirectiveHandlerBase.h"
class TDiagnostics;
@@ -17,7 +17,8 @@ class TDirectiveHandler : public pp::DirectiveHandler
{
public:
TDirectiveHandler(TExtensionBehavior& extBehavior,
- TDiagnostics& diagnostics);
+ TDiagnostics& diagnostics,
+ int& shaderVersion);
virtual ~TDirectiveHandler();
const TPragma& pragma() const { return mPragma; }
@@ -41,6 +42,7 @@ class TDirectiveHandler : public pp::DirectiveHandler
TPragma mPragma;
TExtensionBehavior& mExtensionBehavior;
TDiagnostics& mDiagnostics;
+ int& mShaderVersion;
};
#endif // COMPILER_DIRECTIVE_HANDLER_H_
diff --git a/chromium/third_party/angle/src/compiler/ExtensionBehavior.h b/chromium/third_party/angle/src/compiler/translator/ExtensionBehavior.h
index 5c1595fb212..5c1595fb212 100644
--- a/chromium/third_party/angle/src/compiler/ExtensionBehavior.h
+++ b/chromium/third_party/angle/src/compiler/translator/ExtensionBehavior.h
diff --git a/chromium/third_party/angle/src/compiler/translator/FlagStd140Structs.cpp b/chromium/third_party/angle/src/compiler/translator/FlagStd140Structs.cpp
new file mode 100644
index 00000000000..a751b768b78
--- /dev/null
+++ b/chromium/third_party/angle/src/compiler/translator/FlagStd140Structs.cpp
@@ -0,0 +1,77 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/translator/FlagStd140Structs.h"
+
+namespace sh
+{
+
+bool FlagStd140Structs::visitBinary(Visit visit, TIntermBinary *binaryNode)
+{
+ if (binaryNode->getRight()->getBasicType() == EbtStruct)
+ {
+ switch (binaryNode->getOp())
+ {
+ case EOpIndexDirectInterfaceBlock:
+ case EOpIndexDirectStruct:
+ if (isInStd140InterfaceBlock(binaryNode->getLeft()))
+ {
+ mFlaggedNodes.push_back(binaryNode);
+ }
+ break;
+
+ default: break;
+ }
+ return false;
+ }
+
+ if (binaryNode->getOp() == EOpIndexDirectStruct)
+ {
+ return false;
+ }
+
+ return visit == PreVisit;
+}
+
+void FlagStd140Structs::visitSymbol(TIntermSymbol *symbol)
+{
+ if (isInStd140InterfaceBlock(symbol) && symbol->getBasicType() == EbtStruct)
+ {
+ mFlaggedNodes.push_back(symbol);
+ }
+}
+
+bool FlagStd140Structs::isInStd140InterfaceBlock(TIntermTyped *node) const
+{
+ TIntermBinary *binaryNode = node->getAsBinaryNode();
+
+ if (binaryNode)
+ {
+ return isInStd140InterfaceBlock(binaryNode->getLeft());
+ }
+
+ const TType &type = node->getType();
+
+ // determine if we are in the standard layout
+ const TInterfaceBlock *interfaceBlock = type.getInterfaceBlock();
+ if (interfaceBlock)
+ {
+ return (interfaceBlock->blockStorage() == EbsStd140);
+ }
+
+ return false;
+}
+
+std::vector<TIntermTyped *> FlagStd140ValueStructs(TIntermNode *node)
+{
+ FlagStd140Structs flaggingTraversal;
+
+ node->traverse(&flaggingTraversal);
+
+ return flaggingTraversal.getFlaggedNodes();
+}
+
+}
diff --git a/chromium/third_party/angle/src/compiler/translator/FlagStd140Structs.h b/chromium/third_party/angle/src/compiler/translator/FlagStd140Structs.h
new file mode 100644
index 00000000000..610205eb92e
--- /dev/null
+++ b/chromium/third_party/angle/src/compiler/translator/FlagStd140Structs.h
@@ -0,0 +1,37 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_FLAGSTD140STRUCTS_H_
+#define COMPILER_FLAGSTD140STRUCTS_H_
+
+#include "compiler/translator/intermediate.h"
+
+namespace sh
+{
+
+// This class finds references to nested structs of std140 blocks that access
+// the nested struct "by value", where the padding added in the translator
+// conflicts with the "natural" unpadded type.
+class FlagStd140Structs : public TIntermTraverser
+{
+ public:
+ const std::vector<TIntermTyped *> getFlaggedNodes() const { return mFlaggedNodes; }
+
+ protected:
+ virtual bool visitBinary(Visit visit, TIntermBinary *binaryNode);
+ virtual void visitSymbol(TIntermSymbol *symbol);
+
+ private:
+ bool isInStd140InterfaceBlock(TIntermTyped *node) const;
+
+ std::vector<TIntermTyped *> mFlaggedNodes;
+};
+
+std::vector<TIntermTyped *> FlagStd140ValueStructs(TIntermNode *node);
+
+}
+
+#endif // COMPILER_FLAGSTD140STRUCTS_H_
diff --git a/chromium/third_party/angle/src/compiler/translator/ForLoopUnroll.cpp b/chromium/third_party/angle/src/compiler/translator/ForLoopUnroll.cpp
new file mode 100644
index 00000000000..5cb51645593
--- /dev/null
+++ b/chromium/third_party/angle/src/compiler/translator/ForLoopUnroll.cpp
@@ -0,0 +1,82 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/translator/ForLoopUnroll.h"
+
+bool ForLoopUnrollMarker::visitBinary(Visit, TIntermBinary *node)
+{
+ if (mUnrollCondition != kSamplerArrayIndex)
+ return true;
+
+ // If a sampler array index is also the loop index,
+ // 1) if the index type is integer, mark the loop for unrolling;
+ // 2) if the index type if float, set a flag to later fail compile.
+ switch (node->getOp())
+ {
+ case EOpIndexIndirect:
+ if (node->getLeft() != NULL && node->getRight() != NULL && node->getLeft()->getAsSymbolNode())
+ {
+ TIntermSymbol *symbol = node->getLeft()->getAsSymbolNode();
+ if (IsSampler(symbol->getBasicType()) && symbol->isArray() && !mLoopStack.empty())
+ {
+ mVisitSamplerArrayIndexNodeInsideLoop = true;
+ node->getRight()->traverse(this);
+ mVisitSamplerArrayIndexNodeInsideLoop = false;
+ // We have already visited all the children.
+ return false;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ return true;
+}
+
+bool ForLoopUnrollMarker::visitLoop(Visit, TIntermLoop *node)
+{
+ if (mUnrollCondition == kIntegerIndex)
+ {
+ // Check if loop index type is integer.
+ // This is called after ValidateLimitations pass, so all the calls
+ // should be valid. See ValidateLimitations::validateForLoopInit().
+ TIntermSequence& declSeq = node->getInit()->getAsAggregate()->getSequence();
+ TIntermSymbol* symbol = declSeq[0]->getAsBinaryNode()->getLeft()->getAsSymbolNode();
+ if (symbol->getBasicType() == EbtInt)
+ node->setUnrollFlag(true);
+ }
+
+ TIntermNode *body = node->getBody();
+ if (body != NULL)
+ {
+ mLoopStack.push(node);
+ body->traverse(this);
+ mLoopStack.pop();
+ }
+ // The loop is fully processed - no need to visit children.
+ return false;
+}
+
+void ForLoopUnrollMarker::visitSymbol(TIntermSymbol* symbol)
+{
+ if (!mVisitSamplerArrayIndexNodeInsideLoop)
+ return;
+ TIntermLoop *loop = mLoopStack.findLoop(symbol);
+ if (loop)
+ {
+ switch (symbol->getBasicType())
+ {
+ case EbtFloat:
+ mSamplerArrayIndexIsFloatLoopIndex = true;
+ break;
+ case EbtInt:
+ loop->setUnrollFlag(true);
+ break;
+ default:
+ UNREACHABLE();
+ }
+ }
+}
diff --git a/chromium/third_party/angle/src/compiler/translator/ForLoopUnroll.h b/chromium/third_party/angle/src/compiler/translator/ForLoopUnroll.h
new file mode 100644
index 00000000000..a820d2a20d6
--- /dev/null
+++ b/chromium/third_party/angle/src/compiler/translator/ForLoopUnroll.h
@@ -0,0 +1,50 @@
+//
+// Copyright (c) 2011 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_FORLOOPUNROLL_H_
+#define COMPILER_FORLOOPUNROLL_H_
+
+#include "compiler/translator/LoopInfo.h"
+
+// This class detects for-loops that needs to be unrolled.
+// Currently we support two unroll conditions:
+// 1) kForLoopWithIntegerIndex: unroll if the index type is integer.
+// 2) kForLoopWithSamplerArrayIndex: unroll where a sampler array index
+// is also the loop integer index, and reject and fail a compile
+// where a sampler array index is also the loop float index.
+class ForLoopUnrollMarker : public TIntermTraverser
+{
+ public:
+ enum UnrollCondition
+ {
+ kIntegerIndex,
+ kSamplerArrayIndex
+ };
+
+ ForLoopUnrollMarker(UnrollCondition condition)
+ : mUnrollCondition(condition),
+ mSamplerArrayIndexIsFloatLoopIndex(false),
+ mVisitSamplerArrayIndexNodeInsideLoop(false)
+ {
+ }
+
+ virtual bool visitBinary(Visit, TIntermBinary *node);
+ virtual bool visitLoop(Visit, TIntermLoop *node);
+ virtual void visitSymbol(TIntermSymbol *node);
+
+ bool samplerArrayIndexIsFloatLoopIndex() const
+ {
+ return mSamplerArrayIndexIsFloatLoopIndex;
+ }
+
+ private:
+ UnrollCondition mUnrollCondition;
+ TLoopStack mLoopStack;
+ bool mSamplerArrayIndexIsFloatLoopIndex;
+ bool mVisitSamplerArrayIndexNodeInsideLoop;
+};
+
+#endif
diff --git a/chromium/third_party/angle/src/compiler/HashNames.h b/chromium/third_party/angle/src/compiler/translator/HashNames.h
index d2141e2d853..85161428b2a 100644
--- a/chromium/third_party/angle/src/compiler/HashNames.h
+++ b/chromium/third_party/angle/src/compiler/translator/HashNames.h
@@ -9,8 +9,7 @@
#include <map>
-#include "compiler/intermediate.h"
-#include "GLSLANG/ShaderLang.h"
+#include "compiler/translator/intermediate.h"
#define HASHED_NAME_PREFIX "webgl_"
diff --git a/chromium/third_party/angle/src/compiler/InfoSink.cpp b/chromium/third_party/angle/src/compiler/translator/InfoSink.cpp
index d20a6c0175a..cd59658ff76 100644
--- a/chromium/third_party/angle/src/compiler/InfoSink.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/InfoSink.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/InfoSink.h"
+#include "compiler/translator/InfoSink.h"
void TInfoSinkBase::prefix(TPrefixType p) {
switch(p) {
diff --git a/chromium/third_party/angle/src/compiler/InfoSink.h b/chromium/third_party/angle/src/compiler/translator/InfoSink.h
index be0ddffe31f..698a8b454b3 100644
--- a/chromium/third_party/angle/src/compiler/InfoSink.h
+++ b/chromium/third_party/angle/src/compiler/translator/InfoSink.h
@@ -9,7 +9,7 @@
#include <math.h>
#include <stdlib.h>
-#include "compiler/Common.h"
+#include "compiler/translator/Common.h"
// Returns the fractional part of the given floating-point number.
inline float fractionalPart(float f) {
diff --git a/chromium/third_party/angle/src/compiler/translator/Initialize.cpp b/chromium/third_party/angle/src/compiler/translator/Initialize.cpp
new file mode 100644
index 00000000000..27e96f4014a
--- /dev/null
+++ b/chromium/third_party/angle/src/compiler/translator/Initialize.cpp
@@ -0,0 +1,760 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+//
+// Create symbols that declare built-in definitions, add built-ins that
+// cannot be expressed in the files, and establish mappings between
+// built-in functions and operators.
+//
+
+#include "compiler/translator/Initialize.h"
+
+#include "compiler/translator/intermediate.h"
+
+void InsertBuiltInFunctions(ShShaderType type, ShShaderSpec spec, const ShBuiltInResources &resources, TSymbolTable &symbolTable)
+{
+ TType *float1 = new TType(EbtFloat);
+ TType *float2 = new TType(EbtFloat, 2);
+ TType *float3 = new TType(EbtFloat, 3);
+ TType *float4 = new TType(EbtFloat, 4);
+
+ TType *int1 = new TType(EbtInt);
+ TType *int2 = new TType(EbtInt, 2);
+ TType *int3 = new TType(EbtInt, 3);
+ TType *int4 = new TType(EbtInt, 4);
+
+ //
+ // Angle and Trigonometric Functions.
+ //
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "radians", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "radians", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "radians", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "radians", float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "degrees", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "degrees", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "degrees", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "degrees", float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "sin", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "sin", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "sin", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "sin", float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "cos", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "cos", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "cos", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "cos", float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "tan", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "tan", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "tan", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "tan", float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "asin", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "asin", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "asin", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "asin", float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "acos", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "acos", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "acos", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "acos", float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "atan", float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "atan", float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "atan", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "atan", float4, float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "atan", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "atan", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "atan", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "atan", float4);
+
+ //
+ // Exponential Functions.
+ //
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "pow", float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "pow", float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "pow", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "pow", float4, float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "exp", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "exp", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "exp", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "exp", float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "log", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "log", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "log", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "log", float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "exp2", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "exp2", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "exp2", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "exp2", float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "log2", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "log2", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "log2", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "log2", float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "sqrt", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "sqrt", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "sqrt", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "sqrt", float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "inversesqrt", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "inversesqrt", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "inversesqrt", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "inversesqrt", float4);
+
+ //
+ // Common Functions.
+ //
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "abs", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "abs", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "abs", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "abs", float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "sign", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "sign", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "sign", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "sign", float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "floor", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "floor", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "floor", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "floor", float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "ceil", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "ceil", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "ceil", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "ceil", float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "fract", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "fract", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "fract", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "fract", float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "mod", float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "mod", float2, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "mod", float3, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "mod", float4, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "mod", float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "mod", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "mod", float4, float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "min", float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "min", float2, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "min", float3, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "min", float4, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "min", float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "min", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "min", float4, float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "max", float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "max", float2, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "max", float3, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "max", float4, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "max", float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "max", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "max", float4, float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "clamp", float1, float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "clamp", float2, float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "clamp", float3, float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "clamp", float4, float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "clamp", float2, float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "clamp", float3, float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "clamp", float4, float4, float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "mix", float1, float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "mix", float2, float2, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "mix", float3, float3, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "mix", float4, float4, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "mix", float2, float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "mix", float3, float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "mix", float4, float4, float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "step", float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "step", float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "step", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "step", float4, float4);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "step", float1, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "step", float1, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "step", float1, float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "smoothstep", float1, float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "smoothstep", float2, float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "smoothstep", float3, float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "smoothstep", float4, float4, float4);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "smoothstep", float1, float1, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "smoothstep", float1, float1, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "smoothstep", float1, float1, float4);
+
+ //
+ // Geometric Functions.
+ //
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "length", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "length", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "length", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "length", float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "distance", float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "distance", float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "distance", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "distance", float4, float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "dot", float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "dot", float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "dot", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "dot", float4, float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "cross", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "normalize", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "normalize", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "normalize", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "normalize", float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "faceforward", float1, float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "faceforward", float2, float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "faceforward", float3, float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "faceforward", float4, float4, float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "reflect", float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "reflect", float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "reflect", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "reflect", float4, float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "refract", float1, float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "refract", float2, float2, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "refract", float3, float3, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "refract", float4, float4, float1);
+
+ TType *mat2 = new TType(EbtFloat, 2, 2);
+ TType *mat3 = new TType(EbtFloat, 3, 3);
+ TType *mat4 = new TType(EbtFloat, 4, 4);
+
+ //
+ // Matrix Functions.
+ //
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, mat2, "matrixCompMult", mat2, mat2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, mat3, "matrixCompMult", mat3, mat3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, mat4, "matrixCompMult", mat4, mat4);
+
+ TType *bool1 = new TType(EbtBool);
+ TType *bool2 = new TType(EbtBool, 2);
+ TType *bool3 = new TType(EbtBool, 3);
+ TType *bool4 = new TType(EbtBool, 4);
+
+ //
+ // Vector relational functions.
+ //
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "lessThan", float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "lessThan", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "lessThan", float4, float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "lessThan", int2, int2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "lessThan", int3, int3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "lessThan", int4, int4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "lessThanEqual", float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "lessThanEqual", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "lessThanEqual", float4, float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "lessThanEqual", int2, int2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "lessThanEqual", int3, int3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "lessThanEqual", int4, int4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "greaterThan", float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "greaterThan", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "greaterThan", float4, float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "greaterThan", int2, int2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "greaterThan", int3, int3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "greaterThan", int4, int4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "greaterThanEqual", float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "greaterThanEqual", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "greaterThanEqual", float4, float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "greaterThanEqual", int2, int2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "greaterThanEqual", int3, int3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "greaterThanEqual", int4, int4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "equal", float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "equal", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "equal", float4, float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "equal", int2, int2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "equal", int3, int3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "equal", int4, int4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "equal", bool2, bool2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "equal", bool3, bool3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "equal", bool4, bool4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "notEqual", float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "notEqual", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "notEqual", float4, float4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "notEqual", int2, int2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "notEqual", int3, int3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "notEqual", int4, int4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "notEqual", bool2, bool2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "notEqual", bool3, bool3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "notEqual", bool4, bool4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool1, "any", bool2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool1, "any", bool3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool1, "any", bool4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool1, "all", bool2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool1, "all", bool3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool1, "all", bool4);
+
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "not", bool2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "not", bool3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "not", bool4);
+
+ TType *sampler2D = new TType(EbtSampler2D);
+ TType *samplerCube = new TType(EbtSamplerCube);
+
+ //
+ // Texture Functions for GLSL ES 1.0
+ //
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2D", sampler2D, float2);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float3);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float4);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "textureCube", samplerCube, float3);
+
+ if (resources.OES_EGL_image_external)
+ {
+ TType *samplerExternalOES = new TType(EbtSamplerExternalOES);
+
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2D", samplerExternalOES, float2);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", samplerExternalOES, float3);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", samplerExternalOES, float4);
+ }
+
+ if (resources.ARB_texture_rectangle)
+ {
+ TType *sampler2DRect = new TType(EbtSampler2DRect);
+
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DRect", sampler2DRect, float2);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DRectProj", sampler2DRect, float3);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DRectProj", sampler2DRect, float4);
+ }
+
+ if (resources.EXT_shader_texture_lod)
+ {
+ /* The *Grad* variants are new to both vertex and fragment shaders; the fragment
+ * shader specific pieces are added separately below.
+ */
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DGradEXT", sampler2D, float2, float2, float2);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProjGradEXT", sampler2D, float3, float2, float2);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProjGradEXT", sampler2D, float4, float2, float2);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "textureCubeGradEXT", samplerCube, float3, float3, float3);
+ }
+
+ if (type == SH_FRAGMENT_SHADER)
+ {
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2D", sampler2D, float2, float1);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float3, float1);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float4, float1);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "textureCube", samplerCube, float3, float1);
+
+ if (resources.OES_standard_derivatives)
+ {
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float1, "dFdx", float1);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float2, "dFdx", float2);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float3, "dFdx", float3);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "dFdx", float4);
+
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float1, "dFdy", float1);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float2, "dFdy", float2);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float3, "dFdy", float3);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "dFdy", float4);
+
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float1, "fwidth", float1);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float2, "fwidth", float2);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float3, "fwidth", float3);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "fwidth", float4);
+ }
+
+ if (resources.EXT_shader_texture_lod)
+ {
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DLodEXT", sampler2D, float2, float1);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProjLodEXT", sampler2D, float3, float1);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProjLodEXT", sampler2D, float4, float1);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "textureCubeLodEXT", samplerCube, float3, float1);
+ }
+ }
+
+ if(type == SH_VERTEX_SHADER)
+ {
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DLod", sampler2D, float2, float1);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProjLod", sampler2D, float3, float1);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProjLod", sampler2D, float4, float1);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "textureCubeLod", samplerCube, float3, float1);
+ }
+
+ TType *gvec4 = new TType(EbtGVec4);
+
+ TType *gsampler2D = new TType(EbtGSampler2D);
+ TType *gsamplerCube = new TType(EbtGSamplerCube);
+ TType *gsampler3D = new TType(EbtGSampler3D);
+ TType *gsampler2DArray = new TType(EbtGSampler2DArray);
+
+ //
+ // Texture Functions for GLSL ES 3.0
+ //
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2D, float2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler3D, float3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsamplerCube, float3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2DArray, float3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float4);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler3D, float4);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsampler2D, float2, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsampler3D, float3, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsamplerCube, float3, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsampler2DArray, float3, float1);
+
+ if (type == SH_FRAGMENT_SHADER)
+ {
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2D, float2, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler3D, float3, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsamplerCube, float3, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2DArray, float3, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float3, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float4, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler3D, float4, float1);
+ }
+
+ TType *sampler2DShadow = new TType(EbtSampler2DShadow);
+ TType *samplerCubeShadow = new TType(EbtSamplerCubeShadow);
+ TType *sampler2DArrayShadow = new TType(EbtSampler2DArrayShadow);
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", sampler2DShadow, float3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", samplerCubeShadow, float4);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", sampler2DArrayShadow, float4);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProj", sampler2DShadow, float4);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureLod", sampler2DShadow, float3, float1);
+
+ if (type == SH_FRAGMENT_SHADER)
+ {
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", sampler2DShadow, float3, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", samplerCubeShadow, float4, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProj", sampler2DShadow, float4, float1);
+ }
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", gsampler2D, int1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, int3, "textureSize", gsampler3D, int1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", gsamplerCube, int1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, int3, "textureSize", gsampler2DArray, int1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", sampler2DShadow, int1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", samplerCubeShadow, int1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, int3, "textureSize", sampler2DArrayShadow, int1);
+
+ if(type == SH_FRAGMENT_SHADER)
+ {
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "dFdx", float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float2, "dFdx", float2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float3, "dFdx", float3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "dFdx", float4);
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "dFdy", float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float2, "dFdy", float2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float3, "dFdy", float3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "dFdy", float4);
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "fwidth", float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float2, "fwidth", float2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float3, "fwidth", float3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "fwidth", float4);
+ }
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2D, float2, int2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler3D, float3, int3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureOffset", sampler2DShadow, float3, int2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2DArray, float3, int2);
+
+ if(type == SH_FRAGMENT_SHADER)
+ {
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2D, float2, int2, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler3D, float3, int3, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureOffset", sampler2DShadow, float3, int2, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2DArray, float3, int2, float1);
+ }
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float3, int2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float4, int2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler3D, float4, int3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjOffset", sampler2DShadow, float4, int2);
+
+ if(type == SH_FRAGMENT_SHADER)
+ {
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float3, int2, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float4, int2, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler3D, float4, int3, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjOffset", sampler2DShadow, float4, int2, float1);
+ }
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLodOffset", gsampler2D, float2, float1, int2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLodOffset", gsampler3D, float3, float1, int3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureLodOffset", sampler2DShadow, float3, float1, int2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLodOffset", gsampler2DArray, float3, float1, int2);
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLod", gsampler2D, float3, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLod", gsampler2D, float4, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLod", gsampler3D, float4, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjLod", sampler2DShadow, float4, float1);
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLodOffset", gsampler2D, float3, float1, int2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLodOffset", gsampler2D, float4, float1, int2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLodOffset", gsampler3D, float4, float1, int3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjLodOffset", sampler2DShadow, float4, float1, int2);
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetch", gsampler2D, int2, int1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetch", gsampler3D, int3, int1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetch", gsampler2DArray, int3, int1);
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetchOffset", gsampler2D, int2, int1, int2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetchOffset", gsampler3D, int3, int1, int3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetchOffset", gsampler2DArray, int3, int1, int2);
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsampler2D, float2, float2, float2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsampler3D, float3, float3, float3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsamplerCube, float3, float3, float3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGrad", sampler2DShadow, float3, float2, float2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGrad", samplerCubeShadow, float4, float3, float3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsampler2DArray, float3, float2, float2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGrad", sampler2DArrayShadow, float4, float2, float2);
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGradOffset", gsampler2D, float2, float2, float2, int2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGradOffset", gsampler3D, float3, float3, float3, int3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGradOffset", sampler2DShadow, float3, float2, float2, int2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGradOffset", gsampler2DArray, float3, float2, float2, int2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGradOffset", sampler2DArrayShadow, float4, float2, float2, int2);
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGrad", gsampler2D, float3, float2, float2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGrad", gsampler2D, float4, float2, float2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGrad", gsampler3D, float4, float3, float3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjGrad", sampler2DShadow, float4, float2, float2);
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGradOffset", gsampler2D, float3, float2, float2, int2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGradOffset", gsampler2D, float4, float2, float2, int2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGradOffset", gsampler3D, float4, float3, float3, int3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjGradOffset", sampler2DShadow, float4, float2, float2, int2);
+
+ //
+ // Depth range in window coordinates
+ //
+ TFieldList *fields = NewPoolTFieldList();
+ TSourceLoc zeroSourceLoc = {0, 0, 0, 0};
+ TField *near = new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1), NewPoolTString("near"), zeroSourceLoc);
+ TField *far = new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1), NewPoolTString("far"), zeroSourceLoc);
+ TField *diff = new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1), NewPoolTString("diff"), zeroSourceLoc);
+ fields->push_back(near);
+ fields->push_back(far);
+ fields->push_back(diff);
+ TStructure *depthRangeStruct = new TStructure(NewPoolTString("gl_DepthRangeParameters"), fields);
+ TVariable *depthRangeParameters = new TVariable(&depthRangeStruct->name(), depthRangeStruct, true);
+ symbolTable.insert(COMMON_BUILTINS, *depthRangeParameters);
+ TVariable *depthRange = new TVariable(NewPoolTString("gl_DepthRange"), TType(depthRangeStruct));
+ depthRange->setQualifier(EvqUniform);
+ symbolTable.insert(COMMON_BUILTINS, *depthRange);
+
+ //
+ // Implementation dependent built-in constants.
+ //
+ symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxVertexAttribs", resources.MaxVertexAttribs);
+ symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxVertexUniformVectors", resources.MaxVertexUniformVectors);
+ symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxVertexTextureImageUnits", resources.MaxVertexTextureImageUnits);
+ symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxCombinedTextureImageUnits", resources.MaxCombinedTextureImageUnits);
+ symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxTextureImageUnits", resources.MaxTextureImageUnits);
+ symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxFragmentUniformVectors", resources.MaxFragmentUniformVectors);
+
+ symbolTable.insertConstInt(ESSL1_BUILTINS, "gl_MaxVaryingVectors", resources.MaxVaryingVectors);
+
+ if (spec != SH_CSS_SHADERS_SPEC)
+ {
+ symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxDrawBuffers", resources.MaxDrawBuffers);
+ }
+
+ symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MaxVertexOutputVectors", resources.MaxVertexOutputVectors);
+ symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MaxFragmentInputVectors", resources.MaxFragmentInputVectors);
+ symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MinProgramTexelOffset", resources.MinProgramTexelOffset);
+ symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MaxProgramTexelOffset", resources.MaxProgramTexelOffset);
+}
+
+void IdentifyBuiltIns(ShShaderType type, ShShaderSpec spec,
+ const ShBuiltInResources &resources,
+ TSymbolTable &symbolTable)
+{
+ //
+ // First, insert some special built-in variables that are not in
+ // the built-in header files.
+ //
+ switch(type) {
+ case SH_FRAGMENT_SHADER:
+ symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_FragCoord"), TType(EbtFloat, EbpMedium, EvqFragCoord, 4)));
+ symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_FrontFacing"), TType(EbtBool, EbpUndefined, EvqFrontFacing, 1)));
+ symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_PointCoord"), TType(EbtFloat, EbpMedium, EvqPointCoord, 2)));
+
+ //
+ // In CSS Shaders, gl_FragColor, gl_FragData, and gl_MaxDrawBuffers are not available.
+ // Instead, css_MixColor and css_ColorMatrix are available.
+ //
+ if (spec != SH_CSS_SHADERS_SPEC) {
+ symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString("gl_FragColor"), TType(EbtFloat, EbpMedium, EvqFragColor, 4)));
+ symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString("gl_FragData[gl_MaxDrawBuffers]"), TType(EbtFloat, EbpMedium, EvqFragData, 4)));
+ if (resources.EXT_frag_depth) {
+ symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString("gl_FragDepthEXT"), TType(EbtFloat, resources.FragmentPrecisionHigh ? EbpHigh : EbpMedium, EvqFragDepth, 1)));
+ symbolTable.relateToExtension(ESSL1_BUILTINS, "gl_FragDepthEXT", "GL_EXT_frag_depth");
+ }
+ } else {
+ symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString("css_MixColor"), TType(EbtFloat, EbpMedium, EvqGlobal, 4)));
+ symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString("css_ColorMatrix"), TType(EbtFloat, EbpMedium, EvqGlobal, 4, 4)));
+ }
+
+ break;
+
+ case SH_VERTEX_SHADER:
+ symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_Position"), TType(EbtFloat, EbpHigh, EvqPosition, 4)));
+ symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_PointSize"), TType(EbtFloat, EbpMedium, EvqPointSize, 1)));
+ break;
+
+ default: assert(false && "Language not supported");
+ }
+
+ //
+ // Next, identify which built-ins from the already loaded headers have
+ // a mapping to an operator. Those that are not identified as such are
+ // expected to be resolved through a library of functions, versus as
+ // operations.
+ //
+ symbolTable.relateToOperator(COMMON_BUILTINS, "matrixCompMult", EOpMul);
+
+ symbolTable.relateToOperator(COMMON_BUILTINS, "equal", EOpVectorEqual);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "notEqual", EOpVectorNotEqual);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "lessThan", EOpLessThan);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "greaterThan", EOpGreaterThan);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "lessThanEqual", EOpLessThanEqual);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "greaterThanEqual", EOpGreaterThanEqual);
+
+ symbolTable.relateToOperator(COMMON_BUILTINS, "radians", EOpRadians);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "degrees", EOpDegrees);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "sin", EOpSin);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "cos", EOpCos);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "tan", EOpTan);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "asin", EOpAsin);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "acos", EOpAcos);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "atan", EOpAtan);
+
+ symbolTable.relateToOperator(COMMON_BUILTINS, "pow", EOpPow);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "exp2", EOpExp2);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "log", EOpLog);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "exp", EOpExp);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "log2", EOpLog2);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "sqrt", EOpSqrt);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "inversesqrt", EOpInverseSqrt);
+
+ symbolTable.relateToOperator(COMMON_BUILTINS, "abs", EOpAbs);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "sign", EOpSign);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "floor", EOpFloor);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "ceil", EOpCeil);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "fract", EOpFract);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "mod", EOpMod);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "min", EOpMin);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "max", EOpMax);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "clamp", EOpClamp);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "mix", EOpMix);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "step", EOpStep);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "smoothstep", EOpSmoothStep);
+
+ symbolTable.relateToOperator(COMMON_BUILTINS, "length", EOpLength);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "distance", EOpDistance);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "dot", EOpDot);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "cross", EOpCross);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "normalize", EOpNormalize);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "faceforward", EOpFaceForward);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "reflect", EOpReflect);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "refract", EOpRefract);
+
+ symbolTable.relateToOperator(COMMON_BUILTINS, "any", EOpAny);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "all", EOpAll);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "not", EOpVectorLogicalNot);
+
+ // Map language-specific operators.
+ switch(type) {
+ case SH_VERTEX_SHADER:
+ break;
+ case SH_FRAGMENT_SHADER:
+ if (resources.OES_standard_derivatives)
+ {
+ symbolTable.relateToOperator(ESSL1_BUILTINS, "dFdx", EOpDFdx);
+ symbolTable.relateToOperator(ESSL1_BUILTINS, "dFdy", EOpDFdy);
+ symbolTable.relateToOperator(ESSL1_BUILTINS, "fwidth", EOpFwidth);
+
+ symbolTable.relateToExtension(ESSL1_BUILTINS, "dFdx", "GL_OES_standard_derivatives");
+ symbolTable.relateToExtension(ESSL1_BUILTINS, "dFdy", "GL_OES_standard_derivatives");
+ symbolTable.relateToExtension(ESSL1_BUILTINS, "fwidth", "GL_OES_standard_derivatives");
+ }
+ if (resources.EXT_shader_texture_lod)
+ {
+ symbolTable.relateToExtension(ESSL1_BUILTINS, "texture2DLodEXT", "GL_EXT_shader_texture_lod");
+ symbolTable.relateToExtension(ESSL1_BUILTINS, "texture2DProjLodEXT", "GL_EXT_shader_texture_lod");
+ symbolTable.relateToExtension(ESSL1_BUILTINS, "textureCubeLodEXT", "GL_EXT_shader_texture_lod");
+ }
+ break;
+ default: break;
+ }
+
+ symbolTable.relateToOperator(ESSL3_BUILTINS, "dFdx", EOpDFdx);
+ symbolTable.relateToOperator(ESSL3_BUILTINS, "dFdy", EOpDFdy);
+ symbolTable.relateToOperator(ESSL3_BUILTINS, "fwidth", EOpFwidth);
+
+ if (resources.EXT_shader_texture_lod)
+ {
+ symbolTable.relateToExtension(ESSL1_BUILTINS, "texture2DGradEXT", "GL_EXT_shader_texture_lod");
+ symbolTable.relateToExtension(ESSL1_BUILTINS, "texture2DProjGradEXT", "GL_EXT_shader_texture_lod");
+ symbolTable.relateToExtension(ESSL1_BUILTINS, "textureCubeGradEXT", "GL_EXT_shader_texture_lod");
+ }
+
+ // Finally add resource-specific variables.
+ switch(type) {
+ case SH_FRAGMENT_SHADER:
+ if (spec != SH_CSS_SHADERS_SPEC) {
+ // Set up gl_FragData. The array size.
+ TType fragData(EbtFloat, EbpMedium, EvqFragData, 4, 1, true);
+ fragData.setArraySize(resources.MaxDrawBuffers);
+ symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString("gl_FragData"), fragData));
+ }
+ break;
+ default: break;
+ }
+}
+
+void InitExtensionBehavior(const ShBuiltInResources& resources,
+ TExtensionBehavior& extBehavior)
+{
+ if (resources.OES_standard_derivatives)
+ extBehavior["GL_OES_standard_derivatives"] = EBhUndefined;
+ if (resources.OES_EGL_image_external)
+ extBehavior["GL_OES_EGL_image_external"] = EBhUndefined;
+ if (resources.ARB_texture_rectangle)
+ extBehavior["GL_ARB_texture_rectangle"] = EBhUndefined;
+ if (resources.EXT_draw_buffers)
+ extBehavior["GL_EXT_draw_buffers"] = EBhUndefined;
+ if (resources.EXT_frag_depth)
+ extBehavior["GL_EXT_frag_depth"] = EBhUndefined;
+ if (resources.EXT_shader_texture_lod)
+ extBehavior["GL_EXT_shader_texture_lod"] = EBhUndefined;
+}
diff --git a/chromium/third_party/angle/src/compiler/Initialize.h b/chromium/third_party/angle/src/compiler/translator/Initialize.h
index 4aa13466aca..b5642869aa1 100644
--- a/chromium/third_party/angle/src/compiler/Initialize.h
+++ b/chromium/third_party/angle/src/compiler/translator/Initialize.h
@@ -7,9 +7,9 @@
#ifndef _INITIALIZE_INCLUDED_
#define _INITIALIZE_INCLUDED_
-#include "compiler/Common.h"
-#include "compiler/ShHandle.h"
-#include "compiler/SymbolTable.h"
+#include "compiler/translator/Common.h"
+#include "compiler/translator/ShHandle.h"
+#include "compiler/translator/SymbolTable.h"
void InsertBuiltInFunctions(ShShaderType type, ShShaderSpec spec, const ShBuiltInResources &resources, TSymbolTable &table);
diff --git a/chromium/third_party/angle/src/compiler/InitializeDll.cpp b/chromium/third_party/angle/src/compiler/translator/InitializeDll.cpp
index 6c7f27fced1..43f81784d0a 100644
--- a/chromium/third_party/angle/src/compiler/InitializeDll.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/InitializeDll.cpp
@@ -4,11 +4,11 @@
// found in the LICENSE file.
//
-#include "compiler/InitializeDll.h"
+#include "compiler/translator/InitializeDll.h"
-#include "compiler/InitializeGlobals.h"
-#include "compiler/InitializeParseContext.h"
-#include "compiler/osinclude.h"
+#include "compiler/translator/InitializeGlobals.h"
+#include "compiler/translator/InitializeParseContext.h"
+#include "compiler/translator/osinclude.h"
bool InitProcess()
{
diff --git a/chromium/third_party/angle/src/compiler/InitializeDll.h b/chromium/third_party/angle/src/compiler/translator/InitializeDll.h
index 43070cc3ff7..43070cc3ff7 100644
--- a/chromium/third_party/angle/src/compiler/InitializeDll.h
+++ b/chromium/third_party/angle/src/compiler/translator/InitializeDll.h
diff --git a/chromium/third_party/angle/src/compiler/InitializeGlobals.h b/chromium/third_party/angle/src/compiler/translator/InitializeGlobals.h
index 07159414247..07159414247 100644
--- a/chromium/third_party/angle/src/compiler/InitializeGlobals.h
+++ b/chromium/third_party/angle/src/compiler/translator/InitializeGlobals.h
diff --git a/chromium/third_party/angle/src/compiler/InitializeParseContext.cpp b/chromium/third_party/angle/src/compiler/translator/InitializeParseContext.cpp
index dfab027330d..b4defae5695 100644
--- a/chromium/third_party/angle/src/compiler/InitializeParseContext.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/InitializeParseContext.cpp
@@ -4,9 +4,9 @@
// found in the LICENSE file.
//
-#include "compiler/InitializeParseContext.h"
+#include "compiler/translator/InitializeParseContext.h"
-#include "compiler/osinclude.h"
+#include "compiler/translator/osinclude.h"
OS_TLSIndex GlobalParseContextIndex = OS_INVALID_TLS_INDEX;
diff --git a/chromium/third_party/angle/src/compiler/InitializeParseContext.h b/chromium/third_party/angle/src/compiler/translator/InitializeParseContext.h
index bffbab87d07..bffbab87d07 100644
--- a/chromium/third_party/angle/src/compiler/InitializeParseContext.h
+++ b/chromium/third_party/angle/src/compiler/translator/InitializeParseContext.h
diff --git a/chromium/third_party/angle/src/compiler/translator/InitializeVariables.cpp b/chromium/third_party/angle/src/compiler/translator/InitializeVariables.cpp
new file mode 100644
index 00000000000..115c561c775
--- /dev/null
+++ b/chromium/third_party/angle/src/compiler/translator/InitializeVariables.cpp
@@ -0,0 +1,116 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/translator/InitializeVariables.h"
+#include "compiler/translator/compilerdebug.h"
+
+namespace
+{
+
+TIntermConstantUnion* constructFloatConstUnionNode(const TType& type)
+{
+ TType myType = type;
+ unsigned char size = myType.getNominalSize();
+ if (myType.isMatrix())
+ size *= size;
+ ConstantUnion *u = new ConstantUnion[size];
+ for (int ii = 0; ii < size; ++ii)
+ u[ii].setFConst(0.0f);
+
+ myType.clearArrayness();
+ myType.setQualifier(EvqConst);
+ TIntermConstantUnion *node = new TIntermConstantUnion(u, myType);
+ return node;
+}
+
+TIntermConstantUnion* constructIndexNode(int index)
+{
+ ConstantUnion *u = new ConstantUnion[1];
+ u[0].setIConst(index);
+
+ TType type(EbtInt, EbpUndefined, EvqConst, 1);
+ TIntermConstantUnion *node = new TIntermConstantUnion(u, type);
+ return node;
+}
+
+} // namespace anonymous
+
+bool InitializeVariables::visitAggregate(Visit visit, TIntermAggregate* node)
+{
+ bool visitChildren = !mCodeInserted;
+ switch (node->getOp())
+ {
+ case EOpSequence:
+ break;
+ case EOpFunction:
+ {
+ // Function definition.
+ ASSERT(visit == PreVisit);
+ if (node->getName() == "main(")
+ {
+ TIntermSequence &sequence = node->getSequence();
+ ASSERT((sequence.size() == 1) || (sequence.size() == 2));
+ TIntermAggregate *body = NULL;
+ if (sequence.size() == 1)
+ {
+ body = new TIntermAggregate(EOpSequence);
+ sequence.push_back(body);
+ }
+ else
+ {
+ body = sequence[1]->getAsAggregate();
+ }
+ ASSERT(body);
+ insertInitCode(body->getSequence());
+ mCodeInserted = true;
+ }
+ break;
+ }
+ default:
+ visitChildren = false;
+ break;
+ }
+ return visitChildren;
+}
+
+void InitializeVariables::insertInitCode(TIntermSequence& sequence)
+{
+ for (size_t ii = 0; ii < mVariables.size(); ++ii)
+ {
+ const InitVariableInfo& varInfo = mVariables[ii];
+
+ if (varInfo.type.isArray())
+ {
+ for (int index = varInfo.type.getArraySize() - 1; index >= 0; --index)
+ {
+ TIntermBinary *assign = new TIntermBinary(EOpAssign);
+ sequence.insert(sequence.begin(), assign);
+
+ TIntermBinary *indexDirect = new TIntermBinary(EOpIndexDirect);
+ TIntermSymbol *symbol = new TIntermSymbol(0, varInfo.name, varInfo.type);
+ indexDirect->setLeft(symbol);
+ TIntermConstantUnion *indexNode = constructIndexNode(index);
+ indexDirect->setRight(indexNode);
+
+ assign->setLeft(indexDirect);
+
+ TIntermConstantUnion *zeroConst = constructFloatConstUnionNode(varInfo.type);
+ assign->setRight(zeroConst);
+ }
+ }
+ else
+ {
+ TIntermBinary *assign = new TIntermBinary(EOpAssign);
+ sequence.insert(sequence.begin(), assign);
+ TIntermSymbol *symbol = new TIntermSymbol(0, varInfo.name, varInfo.type);
+ assign->setLeft(symbol);
+ TIntermConstantUnion *zeroConst = constructFloatConstUnionNode(varInfo.type);
+ assign->setRight(zeroConst);
+ }
+
+ }
+}
+
diff --git a/chromium/third_party/angle/src/compiler/translator/InitializeVariables.h b/chromium/third_party/angle/src/compiler/translator/InitializeVariables.h
new file mode 100644
index 00000000000..1cd6d7e1b51
--- /dev/null
+++ b/chromium/third_party/angle/src/compiler/translator/InitializeVariables.h
@@ -0,0 +1,50 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_INITIALIZE_VARIABLES_H_
+#define COMPILER_INITIALIZE_VARIABLES_H_
+
+#include "compiler/translator/intermediate.h"
+
+class InitializeVariables : public TIntermTraverser
+{
+ public:
+ struct InitVariableInfo
+ {
+ TString name;
+ TType type;
+
+ InitVariableInfo(const TString& _name, const TType& _type)
+ : name(_name),
+ type(_type)
+ {
+ }
+ };
+ typedef TVector<InitVariableInfo> InitVariableInfoList;
+
+ InitializeVariables(const InitVariableInfoList& vars)
+ : mCodeInserted(false),
+ mVariables(vars)
+ {
+ }
+
+ protected:
+ virtual bool visitBinary(Visit visit, TIntermBinary* node) { return false; }
+ virtual bool visitUnary(Visit visit, TIntermUnary* node) { return false; }
+ virtual bool visitSelection(Visit visit, TIntermSelection* node) { return false; }
+ virtual bool visitLoop(Visit visit, TIntermLoop* node) { return false; }
+ virtual bool visitBranch(Visit visit, TIntermBranch* node) { return false; }
+
+ virtual bool visitAggregate(Visit visit, TIntermAggregate* node);
+
+ private:
+ void insertInitCode(TIntermSequence& sequence);
+
+ InitVariableInfoList mVariables;
+ bool mCodeInserted;
+};
+
+#endif // COMPILER_INITIALIZE_VARIABLES_H_
diff --git a/chromium/third_party/angle/src/compiler/IntermTraverse.cpp b/chromium/third_party/angle/src/compiler/translator/IntermTraverse.cpp
index 9a691da71fd..69f87c32847 100644
--- a/chromium/third_party/angle/src/compiler/IntermTraverse.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/IntermTraverse.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/intermediate.h"
+#include "compiler/translator/intermediate.h"
//
// Traverse the intermediate representation tree, and
@@ -45,7 +45,7 @@ void TIntermBinary::traverse(TIntermTraverser *it)
//
if (it->preVisit)
visit = it->visitBinary(PreVisit, this);
-
+
//
// Visit the children, in the right order.
//
@@ -53,11 +53,11 @@ void TIntermBinary::traverse(TIntermTraverser *it)
{
it->incrementDepth(this);
- if (it->rightToLeft)
+ if (it->rightToLeft)
{
if (right)
right->traverse(it);
-
+
if (it->inVisit)
visit = it->visitBinary(InVisit, this);
@@ -68,7 +68,7 @@ void TIntermBinary::traverse(TIntermTraverser *it)
{
if (left)
left->traverse(it);
-
+
if (it->inVisit)
visit = it->visitBinary(InVisit, this);
@@ -102,7 +102,7 @@ void TIntermUnary::traverse(TIntermTraverser *it)
operand->traverse(it);
it->decrementDepth();
}
-
+
if (visit && it->postVisit)
it->visitUnary(PostVisit, this);
}
@@ -113,10 +113,10 @@ void TIntermUnary::traverse(TIntermTraverser *it)
void TIntermAggregate::traverse(TIntermTraverser *it)
{
bool visit = true;
-
+
if (it->preVisit)
visit = it->visitAggregate(PreVisit, this);
-
+
if (visit)
{
it->incrementDepth(this);
@@ -147,7 +147,7 @@ void TIntermAggregate::traverse(TIntermTraverser *it)
}
}
}
-
+
it->decrementDepth();
}
@@ -164,7 +164,7 @@ void TIntermSelection::traverse(TIntermTraverser *it)
if (it->preVisit)
visit = it->visitSelection(PreVisit, this);
-
+
if (visit) {
it->incrementDepth(this);
if (it->rightToLeft) {
@@ -196,7 +196,7 @@ void TIntermLoop::traverse(TIntermTraverser *it)
if (it->preVisit)
visit = it->visitLoop(PreVisit, this);
-
+
if (visit)
{
it->incrementDepth(this);
@@ -246,7 +246,7 @@ void TIntermBranch::traverse(TIntermTraverser *it)
if (it->preVisit)
visit = it->visitBranch(PreVisit, this);
-
+
if (visit && expression) {
it->incrementDepth(this);
expression->traverse(it);
@@ -257,3 +257,7 @@ void TIntermBranch::traverse(TIntermTraverser *it)
it->visitBranch(PostVisit, this);
}
+void TIntermRaw::traverse(TIntermTraverser *it)
+{
+ it->visitRaw(this);
+}
diff --git a/chromium/third_party/angle/src/compiler/Intermediate.cpp b/chromium/third_party/angle/src/compiler/translator/Intermediate.cpp
index ef85821575a..9df2afc53c2 100644
--- a/chromium/third_party/angle/src/compiler/Intermediate.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/Intermediate.cpp
@@ -12,10 +12,11 @@
#include <limits.h>
#include <algorithm>
-#include "compiler/HashNames.h"
-#include "compiler/localintermediate.h"
-#include "compiler/QualifierAlive.h"
-#include "compiler/RemoveTree.h"
+#include "compiler/translator/HashNames.h"
+#include "compiler/translator/localintermediate.h"
+#include "compiler/translator/QualifierAlive.h"
+#include "compiler/translator/RemoveTree.h"
+#include "compiler/translator/SymbolTable.h"
bool CompareStructure(const TType& leftNodeType, ConstantUnion* rightUnionArray, ConstantUnion* leftUnionArray);
@@ -44,7 +45,8 @@ const char* getOperatorString(TOperator op)
case EOpIndexDirect:
case EOpIndexIndirect: return "[]";
- case EOpIndexDirectStruct: return ".";
+ case EOpIndexDirectStruct:
+ case EOpIndexDirectInterfaceBlock: return ".";
case EOpVectorSwizzle: return ".";
case EOpAdd: return "+";
case EOpSub: return "-";
@@ -78,16 +80,24 @@ const char* getOperatorString(TOperator op)
// Fall-through.
case EOpConvIntToBool:
+ case EOpConvUIntToBool:
case EOpConvFloatToBool: return "bool";
// Fall-through.
case EOpConvBoolToFloat:
+ case EOpConvUIntToFloat:
case EOpConvIntToFloat: return "float";
// Fall-through.
case EOpConvFloatToInt:
+ case EOpConvUIntToInt:
case EOpConvBoolToInt: return "int";
+ // Fall-through.
+ case EOpConvIntToUInt:
+ case EOpConvFloatToUInt:
+ case EOpConvBoolToUInt: return "uint";
+
case EOpRadians: return "radians";
case EOpDegrees: return "degrees";
case EOpSin: return "sin";
@@ -146,7 +156,7 @@ TIntermSymbol* TIntermediate::addSymbol(int id, const TString& name, const TType
//
// Returns the added node.
//
-TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc& line, TSymbolTable& symbolTable)
+TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc& line)
{
switch (op) {
case EOpEqual:
@@ -212,11 +222,10 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
//
// See if we can fold constants.
//
- TIntermTyped* typedReturnNode = 0;
TIntermConstantUnion *leftTempConstant = left->getAsConstantUnion();
TIntermConstantUnion *rightTempConstant = right->getAsConstantUnion();
if (leftTempConstant && rightTempConstant) {
- typedReturnNode = leftTempConstant->fold(node->getOp(), rightTempConstant, infoSink);
+ TIntermTyped *typedReturnNode = leftTempConstant->fold(node->getOp(), rightTempConstant, infoSink);
if (typedReturnNode)
return typedReturnNode;
@@ -275,7 +284,7 @@ TIntermTyped* TIntermediate::addIndex(TOperator op, TIntermTyped* base, TIntermT
//
// Returns the added node.
//
-TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermNode* childNode, const TSourceLoc& line, TSymbolTable& symbolTable)
+TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermNode* childNode, const TSourceLoc& line)
{
TIntermUnary* node;
TIntermTyped* child = childNode->getAsTyped();
@@ -310,6 +319,7 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermNode* childNode,
TBasicType newType = EbtVoid;
switch (op) {
case EOpConstructInt: newType = EbtInt; break;
+ case EOpConstructUInt: newType = EbtUInt; break;
case EOpConstructBool: newType = EbtBool; break;
case EOpConstructFloat: newType = EbtFloat; break;
default: break;
@@ -318,7 +328,7 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermNode* childNode,
if (newType != EbtVoid) {
child = addConversion(op, TType(newType, child->getPrecision(), EvqTemporary,
child->getNominalSize(),
- child->isMatrix(),
+ child->getSecondarySize(),
child->isArray()),
child);
if (child == 0)
@@ -330,6 +340,7 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermNode* childNode,
//
switch (op) {
case EOpConstructInt:
+ case EOpConstructUInt:
case EOpConstructBool:
case EOpConstructFloat:
return child;
@@ -411,12 +422,10 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
//
// Does the base type allow operation?
//
- switch (node->getBasicType()) {
- case EbtVoid:
- case EbtSampler2D:
- case EbtSamplerCube:
- return 0;
- default: break;
+ if (node->getBasicType() == EbtVoid ||
+ IsSampler(node->getBasicType()))
+ {
+ return 0;
}
//
@@ -452,6 +461,9 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
case EOpConstructInt:
promoteTo = EbtInt;
break;
+ case EOpConstructUInt:
+ promoteTo = EbtUInt;
+ break;
default:
//
// implicit conversions were removed from the language.
@@ -479,8 +491,9 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
switch (promoteTo) {
case EbtFloat:
switch (node->getBasicType()) {
- case EbtInt: newOp = EOpConvIntToFloat; break;
- case EbtBool: newOp = EOpConvBoolToFloat; break;
+ case EbtInt: newOp = EOpConvIntToFloat; break;
+ case EbtUInt: newOp = EOpConvFloatToUInt; break;
+ case EbtBool: newOp = EOpConvBoolToFloat; break;
default:
infoSink.info.message(EPrefixInternalError, node->getLine(), "Bad promotion node");
return 0;
@@ -488,8 +501,9 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
break;
case EbtBool:
switch (node->getBasicType()) {
- case EbtInt: newOp = EOpConvIntToBool; break;
- case EbtFloat: newOp = EOpConvFloatToBool; break;
+ case EbtInt: newOp = EOpConvIntToBool; break;
+ case EbtUInt: newOp = EOpConvBoolToUInt; break;
+ case EbtFloat: newOp = EOpConvFloatToBool; break;
default:
infoSink.info.message(EPrefixInternalError, node->getLine(), "Bad promotion node");
return 0;
@@ -497,6 +511,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
break;
case EbtInt:
switch (node->getBasicType()) {
+ case EbtUInt: newOp = EOpConvUIntToInt; break;
case EbtBool: newOp = EOpConvBoolToInt; break;
case EbtFloat: newOp = EOpConvFloatToInt; break;
default:
@@ -504,12 +519,22 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
return 0;
}
break;
+ case EbtUInt:
+ switch (node->getBasicType()) {
+ case EbtInt: newOp = EOpConvIntToUInt; break;
+ case EbtBool: newOp = EOpConvBoolToUInt; break;
+ case EbtFloat: newOp = EOpConvFloatToUInt; break;
+ default:
+ infoSink.info.message(EPrefixInternalError, node->getLine(), "Bad promotion node");
+ return 0;
+ }
+ break;
default:
infoSink.info.message(EPrefixInternalError, node->getLine(), "Bad promotion type");
return 0;
}
- TType type(promoteTo, node->getPrecision(), EvqTemporary, node->getNominalSize(), node->isMatrix(), node->isArray());
+ TType type(promoteTo, node->getPrecision(), EvqTemporary, node->getNominalSize(), node->getSecondarySize(), node->isArray());
newNode = new TIntermUnary(newOp, type);
newNode->setLine(node->getLine());
newNode->setOperand(node);
@@ -559,6 +584,7 @@ TIntermAggregate* TIntermediate::makeAggregate(TIntermNode* node, const TSourceL
TIntermAggregate* aggNode = new TIntermAggregate;
aggNode->getSequence().push_back(node);
+
aggNode->setLine(line);
return aggNode;
@@ -760,6 +786,26 @@ bool TIntermLoop::replaceChildNode(
return false;
}
+void TIntermLoop::enqueueChildren(std::queue<TIntermNode*> *nodeQueue) const
+{
+ if (init)
+ {
+ nodeQueue->push(init);
+ }
+ if (cond)
+ {
+ nodeQueue->push(cond);
+ }
+ if (expr)
+ {
+ nodeQueue->push(expr);
+ }
+ if (body)
+ {
+ nodeQueue->push(body);
+ }
+}
+
bool TIntermBranch::replaceChildNode(
TIntermNode *original, TIntermNode *replacement)
{
@@ -767,6 +813,14 @@ bool TIntermBranch::replaceChildNode(
return false;
}
+void TIntermBranch::enqueueChildren(std::queue<TIntermNode*> *nodeQueue) const
+{
+ if (expression)
+ {
+ nodeQueue->push(expression);
+ }
+}
+
bool TIntermBinary::replaceChildNode(
TIntermNode *original, TIntermNode *replacement)
{
@@ -775,6 +829,18 @@ bool TIntermBinary::replaceChildNode(
return false;
}
+void TIntermBinary::enqueueChildren(std::queue<TIntermNode*> *nodeQueue) const
+{
+ if (left)
+ {
+ nodeQueue->push(left);
+ }
+ if (right)
+ {
+ nodeQueue->push(right);
+ }
+}
+
bool TIntermUnary::replaceChildNode(
TIntermNode *original, TIntermNode *replacement)
{
@@ -782,6 +848,14 @@ bool TIntermUnary::replaceChildNode(
return false;
}
+void TIntermUnary::enqueueChildren(std::queue<TIntermNode*> *nodeQueue) const
+{
+ if (operand)
+ {
+ nodeQueue->push(operand);
+ }
+}
+
bool TIntermAggregate::replaceChildNode(
TIntermNode *original, TIntermNode *replacement)
{
@@ -792,6 +866,14 @@ bool TIntermAggregate::replaceChildNode(
return false;
}
+void TIntermAggregate::enqueueChildren(std::queue<TIntermNode*> *nodeQueue) const
+{
+ for (size_t childIndex = 0; childIndex < sequence.size(); childIndex++)
+ {
+ nodeQueue->push(sequence[childIndex]);
+ }
+}
+
bool TIntermSelection::replaceChildNode(
TIntermNode *original, TIntermNode *replacement)
{
@@ -801,6 +883,22 @@ bool TIntermSelection::replaceChildNode(
return false;
}
+void TIntermSelection::enqueueChildren(std::queue<TIntermNode*> *nodeQueue) const
+{
+ if (condition)
+ {
+ nodeQueue->push(condition);
+ }
+ if (trueBlock)
+ {
+ nodeQueue->push(trueBlock);
+ }
+ if (falseBlock)
+ {
+ nodeQueue->push(falseBlock);
+ }
+}
+
//
// Say whether or not an operation node changes the value of a variable.
//
@@ -843,6 +941,10 @@ bool TIntermOperator::isConstructor() const
case EOpConstructIVec3:
case EOpConstructIVec4:
case EOpConstructInt:
+ case EOpConstructUVec2:
+ case EOpConstructUVec3:
+ case EOpConstructUVec4:
+ case EOpConstructUInt:
case EOpConstructBVec2:
case EOpConstructBVec3:
case EOpConstructBVec4:
@@ -893,6 +995,36 @@ bool TIntermUnary::promote(TInfoSink&)
return true;
}
+bool validateMultiplication(TOperator op, const TType &left, const TType &right)
+{
+ switch (op)
+ {
+ case EOpMul:
+ case EOpMulAssign:
+ return left.getNominalSize() == right.getNominalSize() && left.getSecondarySize() == right.getSecondarySize();
+ case EOpVectorTimesScalar:
+ case EOpVectorTimesScalarAssign:
+ return true;
+ case EOpVectorTimesMatrix:
+ return left.getNominalSize() == right.getRows();
+ case EOpVectorTimesMatrixAssign:
+ return left.getNominalSize() == right.getRows() && left.getNominalSize() == right.getCols();
+ case EOpMatrixTimesVector:
+ return left.getCols() == right.getNominalSize();
+ case EOpMatrixTimesScalar:
+ case EOpMatrixTimesScalarAssign:
+ return true;
+ case EOpMatrixTimesMatrix:
+ return left.getCols() == right.getRows();
+ case EOpMatrixTimesMatrixAssign:
+ return left.getCols() == right.getCols() && left.getRows() == right.getRows();
+
+ default:
+ UNREACHABLE();
+ return false;
+ }
+}
+
//
// Establishes the type of the resultant operation, as well as
// makes the operator the correct one for the operands.
@@ -902,7 +1034,8 @@ bool TIntermUnary::promote(TInfoSink&)
bool TIntermBinary::promote(TInfoSink& infoSink)
{
// This function only handles scalars, vectors, and matrices.
- if (left->isArray() || right->isArray()) {
+ if (left->isArray() || right->isArray())
+ {
infoSink.info.message(EPrefixInternalError, getLine(), "Invalid operation for arrays");
return false;
}
@@ -924,17 +1057,20 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
// Binary operations results in temporary variables unless both
// operands are const.
- if (left->getQualifier() != EvqConst || right->getQualifier() != EvqConst) {
+ if (left->getQualifier() != EvqConst || right->getQualifier() != EvqConst)
+ {
getTypePointer()->setQualifier(EvqTemporary);
}
- int size = std::max(left->getNominalSize(), right->getNominalSize());
+ const int nominalSize = std::max(left->getNominalSize(), right->getNominalSize());
//
- // All scalars. Code after this test assumes this case is removed!
+ // All scalars or structs. Code after this test assumes this case is removed!
//
- if (size == 1) {
- switch (op) {
+ if (nominalSize == 1)
+ {
+ switch (op)
+ {
//
// Promote to conditional
//
@@ -954,7 +1090,9 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
case EOpLogicalOr:
// Both operands must be of type bool.
if (left->getBasicType() != EbtBool || right->getBasicType() != EbtBool)
+ {
return false;
+ }
setType(TType(EbtBool, EbpUndefined));
break;
@@ -966,80 +1104,118 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
// If we reach here, at least one of the operands is vector or matrix.
// The other operand could be a scalar, vector, or matrix.
- // Are the sizes compatible?
- //
- if (left->getNominalSize() != right->getNominalSize()) {
- // If the nominal size of operands do not match:
- // One of them must be scalar.
- if (left->getNominalSize() != 1 && right->getNominalSize() != 1)
- return false;
- // Operator cannot be of type pure assignment.
- if (op == EOpAssign || op == EOpInitialize)
- return false;
- }
-
- //
// Can these two operands be combined?
//
TBasicType basicType = left->getBasicType();
- switch (op) {
+ switch (op)
+ {
case EOpMul:
- if (!left->isMatrix() && right->isMatrix()) {
+ if (!left->isMatrix() && right->isMatrix())
+ {
if (left->isVector())
+ {
op = EOpVectorTimesMatrix;
- else {
+ setType(TType(basicType, higherPrecision, EvqTemporary, right->getCols(), 1));
+ }
+ else
+ {
op = EOpMatrixTimesScalar;
- setType(TType(basicType, higherPrecision, EvqTemporary, size, true));
+ setType(TType(basicType, higherPrecision, EvqTemporary, right->getCols(), right->getRows()));
}
- } else if (left->isMatrix() && !right->isMatrix()) {
- if (right->isVector()) {
+ }
+ else if (left->isMatrix() && !right->isMatrix())
+ {
+ if (right->isVector())
+ {
op = EOpMatrixTimesVector;
- setType(TType(basicType, higherPrecision, EvqTemporary, size, false));
- } else {
+ setType(TType(basicType, higherPrecision, EvqTemporary, left->getRows(), 1));
+ }
+ else
+ {
op = EOpMatrixTimesScalar;
}
- } else if (left->isMatrix() && right->isMatrix()) {
+ }
+ else if (left->isMatrix() && right->isMatrix())
+ {
op = EOpMatrixTimesMatrix;
- } else if (!left->isMatrix() && !right->isMatrix()) {
- if (left->isVector() && right->isVector()) {
+ setType(TType(basicType, higherPrecision, EvqTemporary, right->getCols(), left->getRows()));
+ }
+ else if (!left->isMatrix() && !right->isMatrix())
+ {
+ if (left->isVector() && right->isVector())
+ {
// leave as component product
- } else if (left->isVector() || right->isVector()) {
+ }
+ else if (left->isVector() || right->isVector())
+ {
op = EOpVectorTimesScalar;
- setType(TType(basicType, higherPrecision, EvqTemporary, size, false));
+ setType(TType(basicType, higherPrecision, EvqTemporary, nominalSize, 1));
}
- } else {
+ }
+ else
+ {
infoSink.info.message(EPrefixInternalError, getLine(), "Missing elses");
return false;
}
+
+ if (!validateMultiplication(op, left->getType(), right->getType()))
+ {
+ return false;
+ }
break;
+
case EOpMulAssign:
- if (!left->isMatrix() && right->isMatrix()) {
+ if (!left->isMatrix() && right->isMatrix())
+ {
if (left->isVector())
+ {
op = EOpVectorTimesMatrixAssign;
- else {
+ }
+ else
+ {
return false;
}
- } else if (left->isMatrix() && !right->isMatrix()) {
- if (right->isVector()) {
+ }
+ else if (left->isMatrix() && !right->isMatrix())
+ {
+ if (right->isVector())
+ {
return false;
- } else {
+ }
+ else
+ {
op = EOpMatrixTimesScalarAssign;
}
- } else if (left->isMatrix() && right->isMatrix()) {
+ }
+ else if (left->isMatrix() && right->isMatrix())
+ {
op = EOpMatrixTimesMatrixAssign;
- } else if (!left->isMatrix() && !right->isMatrix()) {
- if (left->isVector() && right->isVector()) {
+ setType(TType(basicType, higherPrecision, EvqTemporary, right->getCols(), left->getRows()));
+ }
+ else if (!left->isMatrix() && !right->isMatrix())
+ {
+ if (left->isVector() && right->isVector())
+ {
// leave as component product
- } else if (left->isVector() || right->isVector()) {
+ }
+ else if (left->isVector() || right->isVector())
+ {
if (! left->isVector())
return false;
op = EOpVectorTimesScalarAssign;
- setType(TType(basicType, higherPrecision, EvqTemporary, size, false));
+ setType(TType(basicType, higherPrecision, EvqTemporary, left->getNominalSize(), 1));
}
- } else {
+ }
+ else
+ {
infoSink.info.message(EPrefixInternalError, getLine(), "Missing elses");
return false;
}
+
+ if (!validateMultiplication(op, left->getType(), right->getType()))
+ {
+ return false;
+ }
break;
case EOpAssign:
@@ -1050,10 +1226,28 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
case EOpAddAssign:
case EOpSubAssign:
case EOpDivAssign:
- if ((left->isMatrix() && right->isVector()) ||
- (left->isVector() && right->isMatrix()))
- return false;
- setType(TType(basicType, higherPrecision, EvqTemporary, size, left->isMatrix() || right->isMatrix()));
+ {
+ if ((left->isMatrix() && right->isVector()) ||
+ (left->isVector() && right->isMatrix()))
+ return false;
+
+ // Are the sizes compatible?
+ if (left->getNominalSize() != right->getNominalSize() || left->getSecondarySize() != right->getSecondarySize())
+ {
+ // If the nominal size of operands do not match:
+ // One of them must be scalar.
+ if (!left->isScalar() && !right->isScalar())
+ return false;
+
+ // Operator cannot be of type pure assignment.
+ if (op == EOpAssign || op == EOpInitialize)
+ return false;
+ }
+
+ const int secondarySize = std::max(left->getSecondarySize(), right->getSecondarySize());
+
+ setType(TType(basicType, higherPrecision, EvqTemporary, nominalSize, secondarySize));
+ }
break;
case EOpEqual:
@@ -1062,8 +1256,8 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
case EOpGreaterThan:
case EOpLessThanEqual:
case EOpGreaterThanEqual:
- if ((left->isMatrix() && right->isVector()) ||
- (left->isVector() && right->isMatrix()))
+ if ((left->getNominalSize() != right->getNominalSize()) ||
+ (left->getSecondarySize() != right->getSecondarySize()))
return false;
setType(TType(EbtBool, EbpUndefined));
break;
@@ -1086,13 +1280,14 @@ bool CompareStruct(const TType& leftNodeType, ConstantUnion* rightUnionArray, Co
size_t size = fields[j]->type()->getObjectSize();
for (size_t i = 0; i < size; i++) {
if (fields[j]->type()->getBasicType() == EbtStruct) {
- if (!CompareStructure(*(fields[j]->type()), &rightUnionArray[index], &leftUnionArray[index]))
+ if (!CompareStructure(*fields[j]->type(), &rightUnionArray[index], &leftUnionArray[index]))
return false;
} else {
if (leftUnionArray[index] != rightUnionArray[index])
return false;
index++;
}
+
}
}
return true;
@@ -1127,24 +1322,40 @@ bool CompareStructure(const TType& leftNodeType, ConstantUnion* rightUnionArray,
TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNode, TInfoSink& infoSink)
{
ConstantUnion *unionArray = getUnionArrayPointer();
+
+ if (!unionArray)
+ return 0;
+
size_t objectSize = getType().getObjectSize();
- if (constantNode) { // binary operations
+ if (constantNode)
+ {
+ // binary operations
TIntermConstantUnion *node = constantNode->getAsConstantUnion();
ConstantUnion *rightUnionArray = node->getUnionArrayPointer();
TType returnType = getType();
+ if (!rightUnionArray)
+ return 0;
+
// for a case like float f = 1.2 + vec4(2,3,4,5);
- if (constantNode->getType().getObjectSize() == 1 && objectSize > 1) {
+ if (constantNode->getType().getObjectSize() == 1 && objectSize > 1)
+ {
rightUnionArray = new ConstantUnion[objectSize];
for (size_t i = 0; i < objectSize; ++i)
+ {
rightUnionArray[i] = *node->getUnionArrayPointer();
+ }
returnType = getType();
- } else if (constantNode->getType().getObjectSize() > 1 && objectSize == 1) {
+ }
+ else if (constantNode->getType().getObjectSize() > 1 && objectSize == 1)
+ {
// for a case like float f = vec4(2,3,4,5) + 1.2;
unionArray = new ConstantUnion[constantNode->getType().getObjectSize()];
for (size_t i = 0; i < constantNode->getType().getObjectSize(); ++i)
+ {
unionArray[i] = *getUnionArrayPointer();
+ }
returnType = node->getType();
objectSize = constantNode->getType().getObjectSize();
}
@@ -1154,261 +1365,357 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
bool boolNodeFlag = false;
switch(op) {
- case EOpAdd:
- tempConstArray = new ConstantUnion[objectSize];
- {// support MSVC++6.0
- for (size_t i = 0; i < objectSize; i++)
- tempConstArray[i] = unionArray[i] + rightUnionArray[i];
- }
- break;
- case EOpSub:
- tempConstArray = new ConstantUnion[objectSize];
- {// support MSVC++6.0
- for (size_t i = 0; i < objectSize; i++)
- tempConstArray[i] = unionArray[i] - rightUnionArray[i];
- }
- break;
+ case EOpAdd:
+ tempConstArray = new ConstantUnion[objectSize];
+ {
+ for (size_t i = 0; i < objectSize; i++)
+ tempConstArray[i] = unionArray[i] + rightUnionArray[i];
+ }
+ break;
+ case EOpSub:
+ tempConstArray = new ConstantUnion[objectSize];
+ {
+ for (size_t i = 0; i < objectSize; i++)
+ tempConstArray[i] = unionArray[i] - rightUnionArray[i];
+ }
+ break;
- case EOpMul:
- case EOpVectorTimesScalar:
- case EOpMatrixTimesScalar:
- tempConstArray = new ConstantUnion[objectSize];
- {// support MSVC++6.0
- for (size_t i = 0; i < objectSize; i++)
- tempConstArray[i] = unionArray[i] * rightUnionArray[i];
- }
- break;
- case EOpMatrixTimesMatrix:
- if (getType().getBasicType() != EbtFloat || node->getBasicType() != EbtFloat) {
+ case EOpMul:
+ case EOpVectorTimesScalar:
+ case EOpMatrixTimesScalar:
+ tempConstArray = new ConstantUnion[objectSize];
+ {
+ for (size_t i = 0; i < objectSize; i++)
+ tempConstArray[i] = unionArray[i] * rightUnionArray[i];
+ }
+ break;
+
+ case EOpMatrixTimesMatrix:
+ {
+ if (getType().getBasicType() != EbtFloat || node->getBasicType() != EbtFloat)
+ {
infoSink.info.message(EPrefixInternalError, getLine(), "Constant Folding cannot be done for matrix multiply");
return 0;
}
- {// support MSVC++6.0
- int size = getNominalSize();
- tempConstArray = new ConstantUnion[size*size];
- for (int row = 0; row < size; row++) {
- for (int column = 0; column < size; column++) {
- tempConstArray[size * column + row].setFConst(0.0f);
- for (int i = 0; i < size; i++) {
- tempConstArray[size * column + row].setFConst(tempConstArray[size * column + row].getFConst() + unionArray[i * size + row].getFConst() * (rightUnionArray[column * size + i].getFConst()));
- }
+
+ const int leftCols = getCols();
+ const int leftRows = getRows();
+ const int rightCols = constantNode->getType().getCols();
+ const int rightRows = constantNode->getType().getRows();
+ const int resultCols = rightCols;
+ const int resultRows = leftRows;
+
+ tempConstArray = new ConstantUnion[resultCols*resultRows];
+ for (int row = 0; row < resultRows; row++)
+ {
+ for (int column = 0; column < resultCols; column++)
+ {
+ tempConstArray[resultRows * column + row].setFConst(0.0f);
+ for (int i = 0; i < leftCols; i++)
+ {
+ tempConstArray[resultRows * column + row].setFConst(tempConstArray[resultRows * column + row].getFConst() + unionArray[i * leftRows + row].getFConst() * (rightUnionArray[column * rightRows + i].getFConst()));
}
}
}
- break;
- case EOpDiv:
+
+ // update return type for matrix product
+ returnType.setPrimarySize(resultCols);
+ returnType.setSecondarySize(resultRows);
+ }
+ break;
+
+ case EOpDiv:
+ {
tempConstArray = new ConstantUnion[objectSize];
- {// support MSVC++6.0
- for (size_t i = 0; i < objectSize; i++) {
- switch (getType().getBasicType()) {
- case EbtFloat:
- if (rightUnionArray[i] == 0.0f) {
- infoSink.info.message(EPrefixWarning, getLine(), "Divide by zero error during constant folding");
- tempConstArray[i].setFConst(unionArray[i].getFConst() < 0 ? -FLT_MAX : FLT_MAX);
- } else
- tempConstArray[i].setFConst(unionArray[i].getFConst() / rightUnionArray[i].getFConst());
- break;
+ for (size_t i = 0; i < objectSize; i++)
+ {
+ switch (getType().getBasicType())
+ {
+ case EbtFloat:
+ if (rightUnionArray[i] == 0.0f)
+ {
+ infoSink.info.message(EPrefixWarning, getLine(), "Divide by zero error during constant folding");
+ tempConstArray[i].setFConst(unionArray[i].getFConst() < 0 ? -FLT_MAX : FLT_MAX);
+ }
+ else
+ {
+ tempConstArray[i].setFConst(unionArray[i].getFConst() / rightUnionArray[i].getFConst());
+ }
+ break;
- case EbtInt:
- if (rightUnionArray[i] == 0) {
- infoSink.info.message(EPrefixWarning, getLine(), "Divide by zero error during constant folding");
- tempConstArray[i].setIConst(INT_MAX);
- } else
- tempConstArray[i].setIConst(unionArray[i].getIConst() / rightUnionArray[i].getIConst());
- break;
- default:
- infoSink.info.message(EPrefixInternalError, getLine(), "Constant folding cannot be done for \"/\"");
- return 0;
+ case EbtInt:
+ if (rightUnionArray[i] == 0)
+ {
+ infoSink.info.message(EPrefixWarning, getLine(), "Divide by zero error during constant folding");
+ tempConstArray[i].setIConst(INT_MAX);
+ }
+ else
+ {
+ tempConstArray[i].setIConst(unionArray[i].getIConst() / rightUnionArray[i].getIConst());
}
+ break;
+
+ case EbtUInt:
+ if (rightUnionArray[i] == 0)
+ {
+ infoSink.info.message(EPrefixWarning, getLine(), "Divide by zero error during constant folding");
+ tempConstArray[i].setUConst(UINT_MAX);
+ }
+ else
+ {
+ tempConstArray[i].setUConst(unionArray[i].getUConst() / rightUnionArray[i].getUConst());
+ }
+ break;
+
+ default:
+ infoSink.info.message(EPrefixInternalError, getLine(), "Constant folding cannot be done for \"/\"");
+ return 0;
}
}
- break;
+ }
+ break;
- case EOpMatrixTimesVector:
- if (node->getBasicType() != EbtFloat) {
+ case EOpMatrixTimesVector:
+ {
+ if (node->getBasicType() != EbtFloat)
+ {
infoSink.info.message(EPrefixInternalError, getLine(), "Constant Folding cannot be done for matrix times vector");
return 0;
}
- tempConstArray = new ConstantUnion[getNominalSize()];
- {// support MSVC++6.0
- for (int size = getNominalSize(), i = 0; i < size; i++) {
- tempConstArray[i].setFConst(0.0f);
- for (int j = 0; j < size; j++) {
- tempConstArray[i].setFConst(tempConstArray[i].getFConst() + ((unionArray[j*size + i].getFConst()) * rightUnionArray[j].getFConst()));
- }
+ const int matrixCols = getCols();
+ const int matrixRows = getRows();
+
+ tempConstArray = new ConstantUnion[matrixRows];
+
+ for (int matrixRow = 0; matrixRow < matrixRows; matrixRow++)
+ {
+ tempConstArray[matrixRow].setFConst(0.0f);
+ for (int col = 0; col < matrixCols; col++)
+ {
+ tempConstArray[matrixRow].setFConst(tempConstArray[matrixRow].getFConst() + ((unionArray[col * matrixRows + matrixRow].getFConst()) * rightUnionArray[col].getFConst()));
}
}
- tempNode = new TIntermConstantUnion(tempConstArray, node->getType());
+ returnType = node->getType();
+ returnType.setPrimarySize(matrixRows);
+
+ tempNode = new TIntermConstantUnion(tempConstArray, returnType);
tempNode->setLine(getLine());
return tempNode;
+ }
- case EOpVectorTimesMatrix:
- if (getType().getBasicType() != EbtFloat) {
+ case EOpVectorTimesMatrix:
+ {
+ if (getType().getBasicType() != EbtFloat)
+ {
infoSink.info.message(EPrefixInternalError, getLine(), "Constant Folding cannot be done for vector times matrix");
return 0;
}
- tempConstArray = new ConstantUnion[getNominalSize()];
- {// support MSVC++6.0
- for (int size = getNominalSize(), i = 0; i < size; i++) {
- tempConstArray[i].setFConst(0.0f);
- for (int j = 0; j < size; j++) {
- tempConstArray[i].setFConst(tempConstArray[i].getFConst() + ((unionArray[j].getFConst()) * rightUnionArray[i*size + j].getFConst()));
- }
+ const int matrixCols = constantNode->getType().getCols();
+ const int matrixRows = constantNode->getType().getRows();
+
+ tempConstArray = new ConstantUnion[matrixCols];
+
+ for (int matrixCol = 0; matrixCol < matrixCols; matrixCol++)
+ {
+ tempConstArray[matrixCol].setFConst(0.0f);
+ for (int matrixRow = 0; matrixRow < matrixRows; matrixRow++)
+ {
+ tempConstArray[matrixCol].setFConst(tempConstArray[matrixCol].getFConst() + ((unionArray[matrixRow].getFConst()) * rightUnionArray[matrixCol * matrixRows + matrixRow].getFConst()));
}
}
- break;
- case EOpLogicalAnd: // this code is written for possible future use, will not get executed currently
+ returnType.setPrimarySize(matrixCols);
+ }
+ break;
+
+ case EOpLogicalAnd: // this code is written for possible future use, will not get executed currently
+ {
tempConstArray = new ConstantUnion[objectSize];
- {// support MSVC++6.0
- for (size_t i = 0; i < objectSize; i++)
- tempConstArray[i] = unionArray[i] && rightUnionArray[i];
+ for (size_t i = 0; i < objectSize; i++)
+ {
+ tempConstArray[i] = unionArray[i] && rightUnionArray[i];
}
- break;
+ }
+ break;
- case EOpLogicalOr: // this code is written for possible future use, will not get executed currently
+ case EOpLogicalOr: // this code is written for possible future use, will not get executed currently
+ {
tempConstArray = new ConstantUnion[objectSize];
- {// support MSVC++6.0
- for (size_t i = 0; i < objectSize; i++)
- tempConstArray[i] = unionArray[i] || rightUnionArray[i];
+ for (size_t i = 0; i < objectSize; i++)
+ {
+ tempConstArray[i] = unionArray[i] || rightUnionArray[i];
}
- break;
+ }
+ break;
- case EOpLogicalXor:
+ case EOpLogicalXor:
+ {
tempConstArray = new ConstantUnion[objectSize];
- {// support MSVC++6.0
- for (size_t i = 0; i < objectSize; i++)
- switch (getType().getBasicType()) {
- case EbtBool: tempConstArray[i].setBConst((unionArray[i] == rightUnionArray[i]) ? false : true); break;
- default: assert(false && "Default missing");
+ for (size_t i = 0; i < objectSize; i++)
+ {
+ switch (getType().getBasicType())
+ {
+ case EbtBool:
+ tempConstArray[i].setBConst((unionArray[i] == rightUnionArray[i]) ? false : true);
+ break;
+ default:
+ UNREACHABLE();
+ break;
}
}
- break;
+ }
+ break;
- case EOpLessThan:
+ case EOpLessThan:
+ assert(objectSize == 1);
+ tempConstArray = new ConstantUnion[1];
+ tempConstArray->setBConst(*unionArray < *rightUnionArray);
+ returnType = TType(EbtBool, EbpUndefined, EvqConst);
+ break;
+
+ case EOpGreaterThan:
+ assert(objectSize == 1);
+ tempConstArray = new ConstantUnion[1];
+ tempConstArray->setBConst(*unionArray > *rightUnionArray);
+ returnType = TType(EbtBool, EbpUndefined, EvqConst);
+ break;
+
+ case EOpLessThanEqual:
+ {
assert(objectSize == 1);
+ ConstantUnion constant;
+ constant.setBConst(*unionArray > *rightUnionArray);
tempConstArray = new ConstantUnion[1];
- tempConstArray->setBConst(*unionArray < *rightUnionArray);
+ tempConstArray->setBConst(!constant.getBConst());
returnType = TType(EbtBool, EbpUndefined, EvqConst);
break;
- case EOpGreaterThan:
+ }
+
+ case EOpGreaterThanEqual:
+ {
assert(objectSize == 1);
+ ConstantUnion constant;
+ constant.setBConst(*unionArray < *rightUnionArray);
tempConstArray = new ConstantUnion[1];
- tempConstArray->setBConst(*unionArray > *rightUnionArray);
+ tempConstArray->setBConst(!constant.getBConst());
returnType = TType(EbtBool, EbpUndefined, EvqConst);
break;
- case EOpLessThanEqual:
- {
- assert(objectSize == 1);
- ConstantUnion constant;
- constant.setBConst(*unionArray > *rightUnionArray);
- tempConstArray = new ConstantUnion[1];
- tempConstArray->setBConst(!constant.getBConst());
- returnType = TType(EbtBool, EbpUndefined, EvqConst);
- break;
- }
- case EOpGreaterThanEqual:
- {
- assert(objectSize == 1);
- ConstantUnion constant;
- constant.setBConst(*unionArray < *rightUnionArray);
- tempConstArray = new ConstantUnion[1];
- tempConstArray->setBConst(!constant.getBConst());
- returnType = TType(EbtBool, EbpUndefined, EvqConst);
- break;
- }
+ }
- case EOpEqual:
- if (getType().getBasicType() == EbtStruct) {
- if (!CompareStructure(node->getType(), node->getUnionArrayPointer(), unionArray))
+ case EOpEqual:
+ if (getType().getBasicType() == EbtStruct)
+ {
+ if (!CompareStructure(node->getType(), node->getUnionArrayPointer(), unionArray))
+ boolNodeFlag = true;
+ }
+ else
+ {
+ for (size_t i = 0; i < objectSize; i++)
+ {
+ if (unionArray[i] != rightUnionArray[i])
+ {
boolNodeFlag = true;
- } else {
- for (size_t i = 0; i < objectSize; i++) {
- if (unionArray[i] != rightUnionArray[i]) {
- boolNodeFlag = true;
- break; // break out of for loop
- }
+ break; // break out of for loop
}
}
+ }
- tempConstArray = new ConstantUnion[1];
- if (!boolNodeFlag) {
- tempConstArray->setBConst(true);
- }
- else {
- tempConstArray->setBConst(false);
- }
+ tempConstArray = new ConstantUnion[1];
+ if (!boolNodeFlag)
+ {
+ tempConstArray->setBConst(true);
+ }
+ else
+ {
+ tempConstArray->setBConst(false);
+ }
- tempNode = new TIntermConstantUnion(tempConstArray, TType(EbtBool, EbpUndefined, EvqConst));
- tempNode->setLine(getLine());
+ tempNode = new TIntermConstantUnion(tempConstArray, TType(EbtBool, EbpUndefined, EvqConst));
+ tempNode->setLine(getLine());
- return tempNode;
+ return tempNode;
- case EOpNotEqual:
- if (getType().getBasicType() == EbtStruct) {
- if (CompareStructure(node->getType(), node->getUnionArrayPointer(), unionArray))
+ case EOpNotEqual:
+ if (getType().getBasicType() == EbtStruct)
+ {
+ if (CompareStructure(node->getType(), node->getUnionArrayPointer(), unionArray))
+ boolNodeFlag = true;
+ }
+ else
+ {
+ for (size_t i = 0; i < objectSize; i++)
+ {
+ if (unionArray[i] == rightUnionArray[i])
+ {
boolNodeFlag = true;
- } else {
- for (size_t i = 0; i < objectSize; i++) {
- if (unionArray[i] == rightUnionArray[i]) {
- boolNodeFlag = true;
- break; // break out of for loop
- }
+ break; // break out of for loop
}
}
+ }
- tempConstArray = new ConstantUnion[1];
- if (!boolNodeFlag) {
- tempConstArray->setBConst(true);
- }
- else {
- tempConstArray->setBConst(false);
- }
+ tempConstArray = new ConstantUnion[1];
+ if (!boolNodeFlag)
+ {
+ tempConstArray->setBConst(true);
+ }
+ else
+ {
+ tempConstArray->setBConst(false);
+ }
- tempNode = new TIntermConstantUnion(tempConstArray, TType(EbtBool, EbpUndefined, EvqConst));
- tempNode->setLine(getLine());
+ tempNode = new TIntermConstantUnion(tempConstArray, TType(EbtBool, EbpUndefined, EvqConst));
+ tempNode->setLine(getLine());
- return tempNode;
+ return tempNode;
- default:
- infoSink.info.message(EPrefixInternalError, getLine(), "Invalid operator for constant folding");
- return 0;
+ default:
+ infoSink.info.message(EPrefixInternalError, getLine(), "Invalid operator for constant folding");
+ return 0;
}
tempNode = new TIntermConstantUnion(tempConstArray, returnType);
tempNode->setLine(getLine());
return tempNode;
- } else {
+ }
+ else
+ {
//
// Do unary operations
//
TIntermConstantUnion *newNode = 0;
ConstantUnion* tempConstArray = new ConstantUnion[objectSize];
- for (size_t i = 0; i < objectSize; i++) {
- switch(op) {
- case EOpNegative:
- switch (getType().getBasicType()) {
- case EbtFloat: tempConstArray[i].setFConst(-unionArray[i].getFConst()); break;
- case EbtInt: tempConstArray[i].setIConst(-unionArray[i].getIConst()); break;
- default:
- infoSink.info.message(EPrefixInternalError, getLine(), "Unary operation not folded into constant");
- return 0;
- }
- break;
- case EOpLogicalNot: // this code is written for possible future use, will not get executed currently
- switch (getType().getBasicType()) {
- case EbtBool: tempConstArray[i].setBConst(!unionArray[i].getBConst()); break;
- default:
- infoSink.info.message(EPrefixInternalError, getLine(), "Unary operation not folded into constant");
- return 0;
- }
- break;
- default:
+ for (size_t i = 0; i < objectSize; i++)
+ {
+ switch(op)
+ {
+ case EOpNegative:
+ switch (getType().getBasicType())
+ {
+ case EbtFloat: tempConstArray[i].setFConst(-unionArray[i].getFConst()); break;
+ case EbtInt: tempConstArray[i].setIConst(-unionArray[i].getIConst()); break;
+ case EbtUInt: tempConstArray[i].setUConst(static_cast<unsigned int>(-static_cast<int>(unionArray[i].getUConst()))); break;
+ default:
+ infoSink.info.message(EPrefixInternalError, getLine(), "Unary operation not folded into constant");
return 0;
+ }
+ break;
+
+ case EOpLogicalNot: // this code is written for possible future use, will not get executed currently
+ switch (getType().getBasicType())
+ {
+ case EbtBool: tempConstArray[i].setBConst(!unionArray[i].getBConst()); break;
+ default:
+ infoSink.info.message(EPrefixInternalError, getLine(), "Unary operation not folded into constant");
+ return 0;
+ }
+ break;
+
+ default:
+ return 0;
}
}
newNode = new TIntermConstantUnion(tempConstArray, getType());
@@ -1423,7 +1730,7 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
ConstantUnion *leftUnionArray = new ConstantUnion[size];
- for (size_t i = 0; i < size; i++) {
+ for (size_t i=0; i < size; i++) {
switch (promoteTo) {
case EbtFloat:
@@ -1431,6 +1738,9 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
case EbtInt:
leftUnionArray[i].setFConst(static_cast<float>(node->getIConst(i)));
break;
+ case EbtUInt:
+ leftUnionArray[i].setFConst(static_cast<float>(node->getUConst(i)));
+ break;
case EbtBool:
leftUnionArray[i].setFConst(static_cast<float>(node->getBConst(i)));
break;
@@ -1447,6 +1757,9 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
case EbtInt:
leftUnionArray[i].setIConst(static_cast<int>(node->getIConst(i)));
break;
+ case EbtUInt:
+ leftUnionArray[i].setIConst(static_cast<int>(node->getUConst(i)));
+ break;
case EbtBool:
leftUnionArray[i].setIConst(static_cast<int>(node->getBConst(i)));
break;
@@ -1458,11 +1771,33 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
return 0;
}
break;
+ case EbtUInt:
+ switch (node->getType().getBasicType()) {
+ case EbtInt:
+ leftUnionArray[i].setUConst(static_cast<unsigned int>(node->getIConst(i)));
+ break;
+ case EbtUInt:
+ leftUnionArray[i].setUConst(static_cast<unsigned int>(node->getUConst(i)));
+ break;
+ case EbtBool:
+ leftUnionArray[i].setUConst(static_cast<unsigned int>(node->getBConst(i)));
+ break;
+ case EbtFloat:
+ leftUnionArray[i].setUConst(static_cast<unsigned int>(node->getFConst(i)));
+ break;
+ default:
+ infoSink.info.message(EPrefixInternalError, node->getLine(), "Cannot promote");
+ return 0;
+ }
+ break;
case EbtBool:
switch (node->getType().getBasicType()) {
case EbtInt:
leftUnionArray[i].setBConst(node->getIConst(i) != 0);
break;
+ case EbtUInt:
+ leftUnionArray[i].setBConst(node->getUConst(i) != 0);
+ break;
case EbtBool:
leftUnionArray[i].setBConst(node->getBConst(i));
break;
@@ -1484,7 +1819,7 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
const TType& t = node->getType();
- return addConstantUnion(leftUnionArray, TType(promoteTo, t.getPrecision(), t.getQualifier(), t.getNominalSize(), t.isMatrix(), t.isArray()), node->getLine());
+ return addConstantUnion(leftUnionArray, TType(promoteTo, t.getPrecision(), t.getQualifier(), t.getNominalSize(), t.getSecondarySize(), t.isArray()), node->getLine());
}
// static
diff --git a/chromium/third_party/angle/src/compiler/translator/LoopInfo.cpp b/chromium/third_party/angle/src/compiler/translator/LoopInfo.cpp
new file mode 100644
index 00000000000..226f1b23807
--- /dev/null
+++ b/chromium/third_party/angle/src/compiler/translator/LoopInfo.cpp
@@ -0,0 +1,211 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/translator/LoopInfo.h"
+
+namespace
+{
+
+int EvaluateIntConstant(TIntermConstantUnion *node)
+{
+ ASSERT(node && node->getUnionArrayPointer());
+ return node->getIConst(0);
+}
+
+int GetLoopIntIncrement(TIntermLoop *node)
+{
+ TIntermNode *expr = node->getExpression();
+ // for expression has one of the following forms:
+ // loop_index++
+ // loop_index--
+ // loop_index += constant_expression
+ // loop_index -= constant_expression
+ // ++loop_index
+ // --loop_index
+ // The last two forms are not specified in the spec, but I am assuming
+ // its an oversight.
+ TIntermUnary *unOp = expr->getAsUnaryNode();
+ TIntermBinary *binOp = unOp ? NULL : expr->getAsBinaryNode();
+
+ TOperator op = EOpNull;
+ TIntermConstantUnion *incrementNode = NULL;
+ if (unOp)
+ {
+ op = unOp->getOp();
+ }
+ else if (binOp)
+ {
+ op = binOp->getOp();
+ ASSERT(binOp->getRight());
+ incrementNode = binOp->getRight()->getAsConstantUnion();
+ ASSERT(incrementNode);
+ }
+
+ int increment = 0;
+ // The operator is one of: ++ -- += -=.
+ switch (op)
+ {
+ case EOpPostIncrement:
+ case EOpPreIncrement:
+ ASSERT(unOp && !binOp);
+ increment = 1;
+ break;
+ case EOpPostDecrement:
+ case EOpPreDecrement:
+ ASSERT(unOp && !binOp);
+ increment = -1;
+ break;
+ case EOpAddAssign:
+ ASSERT(!unOp && binOp);
+ increment = EvaluateIntConstant(incrementNode);
+ break;
+ case EOpSubAssign:
+ ASSERT(!unOp && binOp);
+ increment = - EvaluateIntConstant(incrementNode);
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ return increment;
+}
+
+} // namespace anonymous
+
+TLoopIndexInfo::TLoopIndexInfo()
+ : mId(-1),
+ mType(EbtVoid),
+ mInitValue(0),
+ mStopValue(0),
+ mIncrementValue(0),
+ mOp(EOpNull),
+ mCurrentValue(0)
+{
+}
+
+void TLoopIndexInfo::fillInfo(TIntermLoop *node)
+{
+ if (node == NULL)
+ return;
+
+ // Here we assume all the operations are valid, because the loop node is
+ // already validated in ValidateLimitations.
+ TIntermSequence &declSeq =
+ node->getInit()->getAsAggregate()->getSequence();
+ TIntermBinary *declInit = declSeq[0]->getAsBinaryNode();
+ TIntermSymbol *symbol = declInit->getLeft()->getAsSymbolNode();
+
+ mId = symbol->getId();
+ mType = symbol->getBasicType();
+
+ if (mType == EbtInt)
+ {
+ TIntermConstantUnion* initNode = declInit->getRight()->getAsConstantUnion();
+ mInitValue = EvaluateIntConstant(initNode);
+ mCurrentValue = mInitValue;
+ mIncrementValue = GetLoopIntIncrement(node);
+
+ TIntermBinary* binOp = node->getCondition()->getAsBinaryNode();
+ mStopValue = EvaluateIntConstant(
+ binOp->getRight()->getAsConstantUnion());
+ mOp = binOp->getOp();
+ }
+}
+
+bool TLoopIndexInfo::satisfiesLoopCondition() const
+{
+ // Relational operator is one of: > >= < <= == or !=.
+ switch (mOp)
+ {
+ case EOpEqual:
+ return (mCurrentValue == mStopValue);
+ case EOpNotEqual:
+ return (mCurrentValue != mStopValue);
+ case EOpLessThan:
+ return (mCurrentValue < mStopValue);
+ case EOpGreaterThan:
+ return (mCurrentValue > mStopValue);
+ case EOpLessThanEqual:
+ return (mCurrentValue <= mStopValue);
+ case EOpGreaterThanEqual:
+ return (mCurrentValue >= mStopValue);
+ default:
+ UNREACHABLE();
+ return false;
+ }
+}
+
+TLoopInfo::TLoopInfo()
+ : loop(NULL)
+{
+}
+
+TLoopInfo::TLoopInfo(TIntermLoop *node)
+ : loop(node)
+{
+ index.fillInfo(node);
+}
+
+TIntermLoop *TLoopStack::findLoop(TIntermSymbol *symbol)
+{
+ if (!symbol)
+ return NULL;
+ for (iterator iter = begin(); iter != end(); ++iter)
+ {
+ if (iter->index.getId() == symbol->getId())
+ return iter->loop;
+ }
+ return NULL;
+}
+
+TLoopIndexInfo *TLoopStack::getIndexInfo(TIntermSymbol *symbol)
+{
+ if (!symbol)
+ return NULL;
+ for (iterator iter = begin(); iter != end(); ++iter)
+ {
+ if (iter->index.getId() == symbol->getId())
+ return &(iter->index);
+ }
+ return NULL;
+}
+
+void TLoopStack::step()
+{
+ ASSERT(!empty());
+ rbegin()->index.step();
+}
+
+bool TLoopStack::satisfiesLoopCondition()
+{
+ ASSERT(!empty());
+ return rbegin()->index.satisfiesLoopCondition();
+}
+
+bool TLoopStack::needsToReplaceSymbolWithValue(TIntermSymbol *symbol)
+{
+ TIntermLoop *loop = findLoop(symbol);
+ return loop && loop->getUnrollFlag();
+}
+
+int TLoopStack::getLoopIndexValue(TIntermSymbol *symbol)
+{
+ TLoopIndexInfo *info = getIndexInfo(symbol);
+ ASSERT(info);
+ return info->getCurrentValue();
+}
+
+void TLoopStack::push(TIntermLoop *loop)
+{
+ TLoopInfo info(loop);
+ push_back(info);
+}
+
+void TLoopStack::pop()
+{
+ pop_back();
+}
+
diff --git a/chromium/third_party/angle/src/compiler/translator/LoopInfo.h b/chromium/third_party/angle/src/compiler/translator/LoopInfo.h
new file mode 100644
index 00000000000..5a140c339e9
--- /dev/null
+++ b/chromium/third_party/angle/src/compiler/translator/LoopInfo.h
@@ -0,0 +1,80 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_LOOP_INFO_H_
+#define COMPILER_TRANSLATOR_LOOP_INFO_H_
+
+#include "compiler/translator/intermediate.h"
+
+class TLoopIndexInfo
+{
+ public:
+ TLoopIndexInfo();
+
+ // If type is EbtInt, fill all fields of the structure with info
+ // extracted from a loop node.
+ // If type is not EbtInt, only fill id and type.
+ void fillInfo(TIntermLoop *node);
+
+ int getId() const { return mId; }
+ void setId(int id) { mId = id; }
+ TBasicType getType() const { return mType; }
+ void setType(TBasicType type) { mType = type; }
+ int getCurrentValue() const { return mCurrentValue; }
+
+ void step() { mCurrentValue += mIncrementValue; }
+
+ // Check if the current value satisfies the loop condition.
+ bool satisfiesLoopCondition() const;
+
+ private:
+ int mId;
+ TBasicType mType; // Either EbtInt or EbtFloat
+
+ // Below fields are only valid if the index's type is int.
+ int mInitValue;
+ int mStopValue;
+ int mIncrementValue;
+ TOperator mOp;
+ int mCurrentValue;
+};
+
+struct TLoopInfo
+{
+ TLoopIndexInfo index;
+ TIntermLoop *loop;
+
+ TLoopInfo();
+ TLoopInfo(TIntermLoop *node);
+};
+
+class TLoopStack : public TVector<TLoopInfo>
+{
+ public:
+ // Search loop stack for a loop whose index matches the input symbol.
+ TIntermLoop *findLoop(TIntermSymbol *symbol);
+
+ // Find the loop index info in the loop stack by the input symbol.
+ TLoopIndexInfo *getIndexInfo(TIntermSymbol *symbol);
+
+ // Update the currentValue for the next loop iteration.
+ void step();
+
+ // Return false if loop condition is no longer satisfied.
+ bool satisfiesLoopCondition();
+
+ // Check if the symbol is the index of a loop that's unrolled.
+ bool needsToReplaceSymbolWithValue(TIntermSymbol *symbol);
+
+ // Return the current value of a given loop index symbol.
+ int getLoopIndexValue(TIntermSymbol *symbol);
+
+ void push(TIntermLoop *info);
+ void pop();
+};
+
+#endif // COMPILER_TRANSLATOR_LOOP_INDEX_H_
+
diff --git a/chromium/third_party/angle/src/compiler/MMap.h b/chromium/third_party/angle/src/compiler/translator/MMap.h
index a308671514c..a308671514c 100644
--- a/chromium/third_party/angle/src/compiler/MMap.h
+++ b/chromium/third_party/angle/src/compiler/translator/MMap.h
diff --git a/chromium/third_party/angle/src/compiler/NodeSearch.h b/chromium/third_party/angle/src/compiler/translator/NodeSearch.h
index 27e471dbbc4..b58c7ec6894 100644
--- a/chromium/third_party/angle/src/compiler/NodeSearch.h
+++ b/chromium/third_party/angle/src/compiler/translator/NodeSearch.h
@@ -9,6 +9,8 @@
#ifndef TRANSLATOR_NODESEARCH_H_
#define TRANSLATOR_NODESEARCH_H_
+#include "compiler/translator/intermediate.h"
+
namespace sh
{
diff --git a/chromium/third_party/angle/src/compiler/OutputESSL.cpp b/chromium/third_party/angle/src/compiler/translator/OutputESSL.cpp
index c2048f1cec4..65635af1fff 100644
--- a/chromium/third_party/angle/src/compiler/OutputESSL.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/OutputESSL.cpp
@@ -1,17 +1,18 @@
//
-// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-#include "compiler/OutputESSL.h"
+#include "compiler/translator/OutputESSL.h"
TOutputESSL::TOutputESSL(TInfoSinkBase& objSink,
ShArrayIndexClampingStrategy clampingStrategy,
ShHashFunction64 hashFunction,
NameMap& nameMap,
- TSymbolTable& symbolTable)
- : TOutputGLSLBase(objSink, clampingStrategy, hashFunction, nameMap, symbolTable)
+ TSymbolTable& symbolTable,
+ int shaderVersion)
+ : TOutputGLSLBase(objSink, clampingStrategy, hashFunction, nameMap, symbolTable, shaderVersion)
{
}
diff --git a/chromium/third_party/angle/src/compiler/OutputESSL.h b/chromium/third_party/angle/src/compiler/translator/OutputESSL.h
index 05db96e4979..8a567fb8aa2 100644
--- a/chromium/third_party/angle/src/compiler/OutputESSL.h
+++ b/chromium/third_party/angle/src/compiler/translator/OutputESSL.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -7,7 +7,7 @@
#ifndef CROSSCOMPILERGLSL_OUTPUTESSL_H_
#define CROSSCOMPILERGLSL_OUTPUTESSL_H_
-#include "compiler/OutputGLSLBase.h"
+#include "compiler/translator/OutputGLSLBase.h"
class TOutputESSL : public TOutputGLSLBase
{
@@ -16,7 +16,8 @@ public:
ShArrayIndexClampingStrategy clampingStrategy,
ShHashFunction64 hashFunction,
NameMap& nameMap,
- TSymbolTable& symbolTable);
+ TSymbolTable& symbolTable,
+ int shaderVersion);
protected:
virtual bool writeVariablePrecision(TPrecision precision);
diff --git a/chromium/third_party/angle/src/compiler/translator/OutputGLSL.cpp b/chromium/third_party/angle/src/compiler/translator/OutputGLSL.cpp
new file mode 100644
index 00000000000..eb7cbb4ae86
--- /dev/null
+++ b/chromium/third_party/angle/src/compiler/translator/OutputGLSL.cpp
@@ -0,0 +1,57 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/translator/OutputGLSL.h"
+
+TOutputGLSL::TOutputGLSL(TInfoSinkBase& objSink,
+ ShArrayIndexClampingStrategy clampingStrategy,
+ ShHashFunction64 hashFunction,
+ NameMap& nameMap,
+ TSymbolTable& symbolTable,
+ int shaderVersion)
+ : TOutputGLSLBase(objSink, clampingStrategy, hashFunction, nameMap, symbolTable, shaderVersion)
+{
+}
+
+bool TOutputGLSL::writeVariablePrecision(TPrecision)
+{
+ return false;
+}
+
+void TOutputGLSL::visitSymbol(TIntermSymbol* node)
+{
+ TInfoSinkBase& out = objSink();
+
+ if (node->getSymbol() == "gl_FragDepthEXT")
+ {
+ out << "gl_FragDepth";
+ }
+ else
+ {
+ TOutputGLSLBase::visitSymbol(node);
+ }
+}
+
+TString TOutputGLSL::translateTextureFunction(TString& name)
+{
+ static const char *simpleRename[] = {
+ "texture2DLodEXT", "texture2DLod",
+ "texture2DProjLodEXT", "texture2DProjLod",
+ "textureCubeLodEXT", "textureCubeLod",
+ "texture2DGradEXT", "texture2DGradARB",
+ "texture2DProjGradEXT", "texture2DProjGradARB",
+ "textureCubeGradEXT", "textureCubeGradARB",
+ NULL, NULL
+ };
+
+ for (int i = 0; simpleRename[i] != NULL; i += 2) {
+ if (name == simpleRename[i]) {
+ return simpleRename[i+1];
+ }
+ }
+
+ return name;
+}
diff --git a/chromium/third_party/angle/src/compiler/OutputGLSL.h b/chromium/third_party/angle/src/compiler/translator/OutputGLSL.h
index fa68ac81030..bceebe397d7 100644
--- a/chromium/third_party/angle/src/compiler/OutputGLSL.h
+++ b/chromium/third_party/angle/src/compiler/translator/OutputGLSL.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -7,7 +7,7 @@
#ifndef CROSSCOMPILERGLSL_OUTPUTGLSL_H_
#define CROSSCOMPILERGLSL_OUTPUTGLSL_H_
-#include "compiler/OutputGLSLBase.h"
+#include "compiler/translator/OutputGLSLBase.h"
class TOutputGLSL : public TOutputGLSLBase
{
@@ -16,11 +16,13 @@ public:
ShArrayIndexClampingStrategy clampingStrategy,
ShHashFunction64 hashFunction,
NameMap& nameMap,
- TSymbolTable& symbolTable);
+ TSymbolTable& symbolTable,
+ int shaderVersion);
protected:
virtual bool writeVariablePrecision(TPrecision);
virtual void visitSymbol(TIntermSymbol* node);
+ virtual TString translateTextureFunction(TString& name);
};
#endif // CROSSCOMPILERGLSL_OUTPUTGLSL_H_
diff --git a/chromium/third_party/angle/src/compiler/translator/OutputGLSLBase.cpp b/chromium/third_party/angle/src/compiler/translator/OutputGLSLBase.cpp
new file mode 100644
index 00000000000..6995594e760
--- /dev/null
+++ b/chromium/third_party/angle/src/compiler/translator/OutputGLSLBase.cpp
@@ -0,0 +1,1080 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/translator/OutputGLSLBase.h"
+#include "compiler/translator/compilerdebug.h"
+
+#include <cfloat>
+
+namespace
+{
+TString arrayBrackets(const TType &type)
+{
+ ASSERT(type.isArray());
+ TInfoSinkBase out;
+ out << "[" << type.getArraySize() << "]";
+ return TString(out.c_str());
+}
+
+bool isSingleStatement(TIntermNode *node)
+{
+ if (const TIntermAggregate *aggregate = node->getAsAggregate())
+ {
+ return (aggregate->getOp() != EOpFunction) &&
+ (aggregate->getOp() != EOpSequence);
+ }
+ else if (const TIntermSelection *selection = node->getAsSelectionNode())
+ {
+ // Ternary operators are usually part of an assignment operator.
+ // This handles those rare cases in which they are all by themselves.
+ return selection->usesTernaryOperator();
+ }
+ else if (node->getAsLoopNode())
+ {
+ return false;
+ }
+ return true;
+}
+} // namespace
+
+TOutputGLSLBase::TOutputGLSLBase(TInfoSinkBase &objSink,
+ ShArrayIndexClampingStrategy clampingStrategy,
+ ShHashFunction64 hashFunction,
+ NameMap &nameMap,
+ TSymbolTable &symbolTable,
+ int shaderVersion)
+ : TIntermTraverser(true, true, true),
+ mObjSink(objSink),
+ mDeclaringVariables(false),
+ mClampingStrategy(clampingStrategy),
+ mHashFunction(hashFunction),
+ mNameMap(nameMap),
+ mSymbolTable(symbolTable),
+ mShaderVersion(shaderVersion)
+{
+ // Set up global scope.
+ mDeclaredStructs.push_back(ScopedDeclaredStructs());
+}
+
+void TOutputGLSLBase::writeTriplet(
+ Visit visit, const char *preStr, const char *inStr, const char *postStr)
+{
+ TInfoSinkBase &out = objSink();
+ if (visit == PreVisit && preStr)
+ out << preStr;
+ else if (visit == InVisit && inStr)
+ out << inStr;
+ else if (visit == PostVisit && postStr)
+ out << postStr;
+}
+
+void TOutputGLSLBase::writeBuiltInFunctionTriplet(
+ Visit visit, const char *preStr, bool useEmulatedFunction)
+{
+ TString preString = useEmulatedFunction ?
+ BuiltInFunctionEmulator::GetEmulatedFunctionName(preStr) : preStr;
+ writeTriplet(visit, preString.c_str(), ", ", ")");
+}
+
+void TOutputGLSLBase::writeVariableType(const TType &type)
+{
+ TInfoSinkBase &out = objSink();
+ TQualifier qualifier = type.getQualifier();
+ // TODO(alokp): Validate qualifier for variable declarations.
+ if (qualifier != EvqTemporary && qualifier != EvqGlobal)
+ out << type.getQualifierString() << " ";
+ // Declare the struct if we have not done so already.
+ if (type.getBasicType() == EbtStruct && !structDeclared(type.getStruct()))
+ {
+ declareStruct(type.getStruct());
+ mDeclaredStructs[mDeclaredStructs.size() - 1].push_back(type.getStruct());
+ }
+ else
+ {
+ if (writeVariablePrecision(type.getPrecision()))
+ out << " ";
+ out << getTypeName(type);
+ }
+}
+
+void TOutputGLSLBase::writeFunctionParameters(const TIntermSequence &args)
+{
+ TInfoSinkBase &out = objSink();
+ for (TIntermSequence::const_iterator iter = args.begin();
+ iter != args.end(); ++iter)
+ {
+ const TIntermSymbol *arg = (*iter)->getAsSymbolNode();
+ ASSERT(arg != NULL);
+
+ const TType &type = arg->getType();
+ writeVariableType(type);
+
+ const TString &name = arg->getSymbol();
+ if (!name.empty())
+ out << " " << hashName(name);
+ if (type.isArray())
+ out << arrayBrackets(type);
+
+ // Put a comma if this is not the last argument.
+ if (iter != args.end() - 1)
+ out << ", ";
+ }
+}
+
+const ConstantUnion *TOutputGLSLBase::writeConstantUnion(
+ const TType &type, const ConstantUnion *pConstUnion)
+{
+ TInfoSinkBase &out = objSink();
+
+ if (type.getBasicType() == EbtStruct)
+ {
+ const TStructure *structure = type.getStruct();
+ out << hashName(structure->name()) << "(";
+
+ const TFieldList &fields = structure->fields();
+ for (size_t i = 0; i < fields.size(); ++i)
+ {
+ const TType *fieldType = fields[i]->type();
+ ASSERT(fieldType != NULL);
+ pConstUnion = writeConstantUnion(*fieldType, pConstUnion);
+ if (i != fields.size() - 1)
+ out << ", ";
+ }
+ out << ")";
+ }
+ else
+ {
+ size_t size = type.getObjectSize();
+ bool writeType = size > 1;
+ if (writeType)
+ out << getTypeName(type) << "(";
+ for (size_t i = 0; i < size; ++i, ++pConstUnion)
+ {
+ switch (pConstUnion->getType())
+ {
+ case EbtFloat:
+ out << std::min(FLT_MAX, std::max(-FLT_MAX, pConstUnion->getFConst()));
+ break;
+ case EbtInt:
+ out << pConstUnion->getIConst();
+ break;
+ case EbtBool:
+ out << pConstUnion->getBConst();
+ break;
+ default: UNREACHABLE();
+ }
+ if (i != size - 1)
+ out << ", ";
+ }
+ if (writeType)
+ out << ")";
+ }
+ return pConstUnion;
+}
+
+void TOutputGLSLBase::visitSymbol(TIntermSymbol *node)
+{
+ TInfoSinkBase &out = objSink();
+ if (mLoopUnrollStack.needsToReplaceSymbolWithValue(node))
+ out << mLoopUnrollStack.getLoopIndexValue(node);
+ else
+ out << hashVariableName(node->getSymbol());
+
+ if (mDeclaringVariables && node->getType().isArray())
+ out << arrayBrackets(node->getType());
+}
+
+void TOutputGLSLBase::visitConstantUnion(TIntermConstantUnion *node)
+{
+ writeConstantUnion(node->getType(), node->getUnionArrayPointer());
+}
+
+bool TOutputGLSLBase::visitBinary(Visit visit, TIntermBinary *node)
+{
+ bool visitChildren = true;
+ TInfoSinkBase &out = objSink();
+ switch (node->getOp())
+ {
+ case EOpInitialize:
+ if (visit == InVisit)
+ {
+ out << " = ";
+ // RHS of initialize is not being declared.
+ mDeclaringVariables = false;
+ }
+ break;
+ case EOpAssign:
+ writeTriplet(visit, "(", " = ", ")");
+ break;
+ case EOpAddAssign:
+ writeTriplet(visit, "(", " += ", ")");
+ break;
+ case EOpSubAssign:
+ writeTriplet(visit, "(", " -= ", ")");
+ break;
+ case EOpDivAssign:
+ writeTriplet(visit, "(", " /= ", ")");
+ break;
+ // Notice the fall-through.
+ case EOpMulAssign:
+ case EOpVectorTimesMatrixAssign:
+ case EOpVectorTimesScalarAssign:
+ case EOpMatrixTimesScalarAssign:
+ case EOpMatrixTimesMatrixAssign:
+ writeTriplet(visit, "(", " *= ", ")");
+ break;
+
+ case EOpIndexDirect:
+ writeTriplet(visit, NULL, "[", "]");
+ break;
+ case EOpIndexIndirect:
+ if (node->getAddIndexClamp())
+ {
+ if (visit == InVisit)
+ {
+ if (mClampingStrategy == SH_CLAMP_WITH_CLAMP_INTRINSIC)
+ out << "[int(clamp(float(";
+ else
+ out << "[webgl_int_clamp(";
+ }
+ else if (visit == PostVisit)
+ {
+ int maxSize;
+ TIntermTyped *left = node->getLeft();
+ TType leftType = left->getType();
+
+ if (left->isArray())
+ {
+ // The shader will fail validation if the array length is not > 0.
+ maxSize = leftType.getArraySize() - 1;
+ }
+ else
+ {
+ maxSize = leftType.getNominalSize() - 1;
+ }
+
+ if (mClampingStrategy == SH_CLAMP_WITH_CLAMP_INTRINSIC)
+ out << "), 0.0, float(" << maxSize << ")))]";
+ else
+ out << ", 0, " << maxSize << ")]";
+ }
+ }
+ else
+ {
+ writeTriplet(visit, NULL, "[", "]");
+ }
+ break;
+ case EOpIndexDirectStruct:
+ if (visit == InVisit)
+ {
+ // Here we are writing out "foo.bar", where "foo" is struct
+ // and "bar" is field. In AST, it is represented as a binary
+ // node, where left child represents "foo" and right child "bar".
+ // The node itself represents ".". The struct field "bar" is
+ // actually stored as an index into TStructure::fields.
+ out << ".";
+ const TStructure *structure = node->getLeft()->getType().getStruct();
+ const TIntermConstantUnion *index = node->getRight()->getAsConstantUnion();
+ const TField *field = structure->fields()[index->getIConst(0)];
+
+ TString fieldName = field->name();
+ if (!mSymbolTable.findBuiltIn(structure->name(), mShaderVersion))
+ fieldName = hashName(fieldName);
+
+ out << fieldName;
+ visitChildren = false;
+ }
+ break;
+ case EOpVectorSwizzle:
+ if (visit == InVisit)
+ {
+ out << ".";
+ TIntermAggregate *rightChild = node->getRight()->getAsAggregate();
+ TIntermSequence &sequence = rightChild->getSequence();
+ for (TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); ++sit)
+ {
+ TIntermConstantUnion *element = (*sit)->getAsConstantUnion();
+ ASSERT(element->getBasicType() == EbtInt);
+ ASSERT(element->getNominalSize() == 1);
+ const ConstantUnion& data = element->getUnionArrayPointer()[0];
+ ASSERT(data.getType() == EbtInt);
+ switch (data.getIConst())
+ {
+ case 0:
+ out << "x";
+ break;
+ case 1:
+ out << "y";
+ break;
+ case 2:
+ out << "z";
+ break;
+ case 3:
+ out << "w";
+ break;
+ default:
+ UNREACHABLE();
+ }
+ }
+ visitChildren = false;
+ }
+ break;
+
+ case EOpAdd:
+ writeTriplet(visit, "(", " + ", ")");
+ break;
+ case EOpSub:
+ writeTriplet(visit, "(", " - ", ")");
+ break;
+ case EOpMul:
+ writeTriplet(visit, "(", " * ", ")");
+ break;
+ case EOpDiv:
+ writeTriplet(visit, "(", " / ", ")");
+ break;
+ case EOpMod:
+ UNIMPLEMENTED();
+ break;
+ case EOpEqual:
+ writeTriplet(visit, "(", " == ", ")");
+ break;
+ case EOpNotEqual:
+ writeTriplet(visit, "(", " != ", ")");
+ break;
+ case EOpLessThan:
+ writeTriplet(visit, "(", " < ", ")");
+ break;
+ case EOpGreaterThan:
+ writeTriplet(visit, "(", " > ", ")");
+ break;
+ case EOpLessThanEqual:
+ writeTriplet(visit, "(", " <= ", ")");
+ break;
+ case EOpGreaterThanEqual:
+ writeTriplet(visit, "(", " >= ", ")");
+ break;
+
+ // Notice the fall-through.
+ case EOpVectorTimesScalar:
+ case EOpVectorTimesMatrix:
+ case EOpMatrixTimesVector:
+ case EOpMatrixTimesScalar:
+ case EOpMatrixTimesMatrix:
+ writeTriplet(visit, "(", " * ", ")");
+ break;
+
+ case EOpLogicalOr:
+ writeTriplet(visit, "(", " || ", ")");
+ break;
+ case EOpLogicalXor:
+ writeTriplet(visit, "(", " ^^ ", ")");
+ break;
+ case EOpLogicalAnd:
+ writeTriplet(visit, "(", " && ", ")");
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ return visitChildren;
+}
+
+bool TOutputGLSLBase::visitUnary(Visit visit, TIntermUnary *node)
+{
+ TString preString;
+ TString postString = ")";
+
+ switch (node->getOp())
+ {
+ case EOpNegative: preString = "(-"; break;
+ case EOpVectorLogicalNot: preString = "not("; break;
+ case EOpLogicalNot: preString = "(!"; break;
+
+ case EOpPostIncrement: preString = "("; postString = "++)"; break;
+ case EOpPostDecrement: preString = "("; postString = "--)"; break;
+ case EOpPreIncrement: preString = "(++"; break;
+ case EOpPreDecrement: preString = "(--"; break;
+
+ case EOpConvIntToBool:
+ case EOpConvFloatToBool:
+ switch (node->getOperand()->getType().getNominalSize())
+ {
+ case 1:
+ preString = "bool(";
+ break;
+ case 2:
+ preString = "bvec2(";
+ break;
+ case 3:
+ preString = "bvec3(";
+ break;
+ case 4:
+ preString = "bvec4(";
+ break;
+ default:
+ UNREACHABLE();
+ }
+ break;
+ case EOpConvBoolToFloat:
+ case EOpConvIntToFloat:
+ switch (node->getOperand()->getType().getNominalSize())
+ {
+ case 1:
+ preString = "float(";
+ break;
+ case 2:
+ preString = "vec2(";
+ break;
+ case 3:
+ preString = "vec3(";
+ break;
+ case 4:
+ preString = "vec4(";
+ break;
+ default:
+ UNREACHABLE();
+ }
+ break;
+ case EOpConvFloatToInt:
+ case EOpConvBoolToInt:
+ switch (node->getOperand()->getType().getNominalSize())
+ {
+ case 1:
+ preString = "int(";
+ break;
+ case 2:
+ preString = "ivec2(";
+ break;
+ case 3:
+ preString = "ivec3(";
+ break;
+ case 4:
+ preString = "ivec4(";
+ break;
+ default:
+ UNREACHABLE();
+ }
+ break;
+
+ case EOpRadians:
+ preString = "radians(";
+ break;
+ case EOpDegrees:
+ preString = "degrees(";
+ break;
+ case EOpSin:
+ preString = "sin(";
+ break;
+ case EOpCos:
+ preString = "cos(";
+ break;
+ case EOpTan:
+ preString = "tan(";
+ break;
+ case EOpAsin:
+ preString = "asin(";
+ break;
+ case EOpAcos:
+ preString = "acos(";
+ break;
+ case EOpAtan:
+ preString = "atan(";
+ break;
+
+ case EOpExp:
+ preString = "exp(";
+ break;
+ case EOpLog:
+ preString = "log(";
+ break;
+ case EOpExp2:
+ preString = "exp2(";
+ break;
+ case EOpLog2:
+ preString = "log2(";
+ break;
+ case EOpSqrt:
+ preString = "sqrt(";
+ break;
+ case EOpInverseSqrt:
+ preString = "inversesqrt(";
+ break;
+
+ case EOpAbs:
+ preString = "abs(";
+ break;
+ case EOpSign:
+ preString = "sign(";
+ break;
+ case EOpFloor:
+ preString = "floor(";
+ break;
+ case EOpCeil:
+ preString = "ceil(";
+ break;
+ case EOpFract:
+ preString = "fract(";
+ break;
+
+ case EOpLength:
+ preString = "length(";
+ break;
+ case EOpNormalize:
+ preString = "normalize(";
+ break;
+
+ case EOpDFdx:
+ preString = "dFdx(";
+ break;
+ case EOpDFdy:
+ preString = "dFdy(";
+ break;
+ case EOpFwidth:
+ preString = "fwidth(";
+ break;
+
+ case EOpAny:
+ preString = "any(";
+ break;
+ case EOpAll:
+ preString = "all(";
+ break;
+
+ default:
+ UNREACHABLE();
+ }
+
+ if (visit == PreVisit && node->getUseEmulatedFunction())
+ preString = BuiltInFunctionEmulator::GetEmulatedFunctionName(preString);
+ writeTriplet(visit, preString.c_str(), NULL, postString.c_str());
+
+ return true;
+}
+
+bool TOutputGLSLBase::visitSelection(Visit visit, TIntermSelection *node)
+{
+ TInfoSinkBase &out = objSink();
+
+ if (node->usesTernaryOperator())
+ {
+ // Notice two brackets at the beginning and end. The outer ones
+ // encapsulate the whole ternary expression. This preserves the
+ // order of precedence when ternary expressions are used in a
+ // compound expression, i.e., c = 2 * (a < b ? 1 : 2).
+ out << "((";
+ node->getCondition()->traverse(this);
+ out << ") ? (";
+ node->getTrueBlock()->traverse(this);
+ out << ") : (";
+ node->getFalseBlock()->traverse(this);
+ out << "))";
+ }
+ else
+ {
+ out << "if (";
+ node->getCondition()->traverse(this);
+ out << ")\n";
+
+ incrementDepth(node);
+ visitCodeBlock(node->getTrueBlock());
+
+ if (node->getFalseBlock())
+ {
+ out << "else\n";
+ visitCodeBlock(node->getFalseBlock());
+ }
+ decrementDepth();
+ }
+ return false;
+}
+
+bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate *node)
+{
+ bool visitChildren = true;
+ TInfoSinkBase &out = objSink();
+ TString preString;
+ bool useEmulatedFunction = (visit == PreVisit && node->getUseEmulatedFunction());
+ switch (node->getOp())
+ {
+ case EOpSequence:
+ // Scope the sequences except when at the global scope.
+ if (depth > 0)
+ {
+ out << "{\n";
+ pushDeclaredStructsScope();
+ }
+
+ incrementDepth(node);
+ for (TIntermSequence::const_iterator iter = node->getSequence().begin();
+ iter != node->getSequence().end(); ++iter)
+ {
+ TIntermNode *node = *iter;
+ ASSERT(node != NULL);
+ node->traverse(this);
+
+ if (isSingleStatement(node))
+ out << ";\n";
+ }
+ decrementDepth();
+
+ // Scope the sequences except when at the global scope.
+ if (depth > 0)
+ {
+ popDeclaredStructsScope();
+ out << "}\n";
+ }
+ visitChildren = false;
+ break;
+ case EOpPrototype:
+ // Function declaration.
+ ASSERT(visit == PreVisit);
+ writeVariableType(node->getType());
+ out << " " << hashName(node->getName());
+
+ out << "(";
+ writeFunctionParameters(node->getSequence());
+ out << ")";
+
+ visitChildren = false;
+ break;
+ case EOpFunction: {
+ // Function definition.
+ ASSERT(visit == PreVisit);
+ writeVariableType(node->getType());
+ out << " " << hashFunctionName(node->getName());
+
+ incrementDepth(node);
+ // Function definition node contains one or two children nodes
+ // representing function parameters and function body. The latter
+ // is not present in case of empty function bodies.
+ const TIntermSequence &sequence = node->getSequence();
+ ASSERT((sequence.size() == 1) || (sequence.size() == 2));
+ TIntermSequence::const_iterator seqIter = sequence.begin();
+
+ // Traverse function parameters.
+ TIntermAggregate *params = (*seqIter)->getAsAggregate();
+ ASSERT(params != NULL);
+ ASSERT(params->getOp() == EOpParameters);
+ params->traverse(this);
+
+ // Traverse function body.
+ TIntermAggregate *body = ++seqIter != sequence.end() ?
+ (*seqIter)->getAsAggregate() : NULL;
+ visitCodeBlock(body);
+ decrementDepth();
+
+ // Fully processed; no need to visit children.
+ visitChildren = false;
+ break;
+ }
+ case EOpFunctionCall:
+ // Function call.
+ if (visit == PreVisit)
+ out << hashFunctionName(node->getName()) << "(";
+ else if (visit == InVisit)
+ out << ", ";
+ else
+ out << ")";
+ break;
+ case EOpParameters:
+ // Function parameters.
+ ASSERT(visit == PreVisit);
+ out << "(";
+ writeFunctionParameters(node->getSequence());
+ out << ")";
+ visitChildren = false;
+ break;
+ case EOpDeclaration:
+ // Variable declaration.
+ if (visit == PreVisit)
+ {
+ const TIntermSequence &sequence = node->getSequence();
+ const TIntermTyped *variable = sequence.front()->getAsTyped();
+ writeVariableType(variable->getType());
+ out << " ";
+ mDeclaringVariables = true;
+ }
+ else if (visit == InVisit)
+ {
+ out << ", ";
+ mDeclaringVariables = true;
+ }
+ else
+ {
+ mDeclaringVariables = false;
+ }
+ break;
+ case EOpConstructFloat:
+ writeTriplet(visit, "float(", NULL, ")");
+ break;
+ case EOpConstructVec2:
+ writeBuiltInFunctionTriplet(visit, "vec2(", false);
+ break;
+ case EOpConstructVec3:
+ writeBuiltInFunctionTriplet(visit, "vec3(", false);
+ break;
+ case EOpConstructVec4:
+ writeBuiltInFunctionTriplet(visit, "vec4(", false);
+ break;
+ case EOpConstructBool:
+ writeTriplet(visit, "bool(", NULL, ")");
+ break;
+ case EOpConstructBVec2:
+ writeBuiltInFunctionTriplet(visit, "bvec2(", false);
+ break;
+ case EOpConstructBVec3:
+ writeBuiltInFunctionTriplet(visit, "bvec3(", false);
+ break;
+ case EOpConstructBVec4:
+ writeBuiltInFunctionTriplet(visit, "bvec4(", false);
+ break;
+ case EOpConstructInt:
+ writeTriplet(visit, "int(", NULL, ")");
+ break;
+ case EOpConstructIVec2:
+ writeBuiltInFunctionTriplet(visit, "ivec2(", false);
+ break;
+ case EOpConstructIVec3:
+ writeBuiltInFunctionTriplet(visit, "ivec3(", false);
+ break;
+ case EOpConstructIVec4:
+ writeBuiltInFunctionTriplet(visit, "ivec4(", false);
+ break;
+ case EOpConstructMat2:
+ writeBuiltInFunctionTriplet(visit, "mat2(", false);
+ break;
+ case EOpConstructMat3:
+ writeBuiltInFunctionTriplet(visit, "mat3(", false);
+ break;
+ case EOpConstructMat4:
+ writeBuiltInFunctionTriplet(visit, "mat4(", false);
+ break;
+ case EOpConstructStruct:
+ if (visit == PreVisit)
+ {
+ const TType &type = node->getType();
+ ASSERT(type.getBasicType() == EbtStruct);
+ out << hashName(type.getStruct()->name()) << "(";
+ }
+ else if (visit == InVisit)
+ {
+ out << ", ";
+ }
+ else
+ {
+ out << ")";
+ }
+ break;
+
+ case EOpLessThan:
+ writeBuiltInFunctionTriplet(visit, "lessThan(", useEmulatedFunction);
+ break;
+ case EOpGreaterThan:
+ writeBuiltInFunctionTriplet(visit, "greaterThan(", useEmulatedFunction);
+ break;
+ case EOpLessThanEqual:
+ writeBuiltInFunctionTriplet(visit, "lessThanEqual(", useEmulatedFunction);
+ break;
+ case EOpGreaterThanEqual:
+ writeBuiltInFunctionTriplet(visit, "greaterThanEqual(", useEmulatedFunction);
+ break;
+ case EOpVectorEqual:
+ writeBuiltInFunctionTriplet(visit, "equal(", useEmulatedFunction);
+ break;
+ case EOpVectorNotEqual:
+ writeBuiltInFunctionTriplet(visit, "notEqual(", useEmulatedFunction);
+ break;
+ case EOpComma:
+ writeTriplet(visit, NULL, ", ", NULL);
+ break;
+
+ case EOpMod:
+ writeBuiltInFunctionTriplet(visit, "mod(", useEmulatedFunction);
+ break;
+ case EOpPow:
+ writeBuiltInFunctionTriplet(visit, "pow(", useEmulatedFunction);
+ break;
+ case EOpAtan:
+ writeBuiltInFunctionTriplet(visit, "atan(", useEmulatedFunction);
+ break;
+ case EOpMin:
+ writeBuiltInFunctionTriplet(visit, "min(", useEmulatedFunction);
+ break;
+ case EOpMax:
+ writeBuiltInFunctionTriplet(visit, "max(", useEmulatedFunction);
+ break;
+ case EOpClamp:
+ writeBuiltInFunctionTriplet(visit, "clamp(", useEmulatedFunction);
+ break;
+ case EOpMix:
+ writeBuiltInFunctionTriplet(visit, "mix(", useEmulatedFunction);
+ break;
+ case EOpStep:
+ writeBuiltInFunctionTriplet(visit, "step(", useEmulatedFunction);
+ break;
+ case EOpSmoothStep:
+ writeBuiltInFunctionTriplet(visit, "smoothstep(", useEmulatedFunction);
+ break;
+ case EOpDistance:
+ writeBuiltInFunctionTriplet(visit, "distance(", useEmulatedFunction);
+ break;
+ case EOpDot:
+ writeBuiltInFunctionTriplet(visit, "dot(", useEmulatedFunction);
+ break;
+ case EOpCross:
+ writeBuiltInFunctionTriplet(visit, "cross(", useEmulatedFunction);
+ break;
+ case EOpFaceForward:
+ writeBuiltInFunctionTriplet(visit, "faceforward(", useEmulatedFunction);
+ break;
+ case EOpReflect:
+ writeBuiltInFunctionTriplet(visit, "reflect(", useEmulatedFunction);
+ break;
+ case EOpRefract:
+ writeBuiltInFunctionTriplet(visit, "refract(", useEmulatedFunction);
+ break;
+ case EOpMul:
+ writeBuiltInFunctionTriplet(visit, "matrixCompMult(", useEmulatedFunction);
+ break;
+
+ default:
+ UNREACHABLE();
+ }
+ return visitChildren;
+}
+
+bool TOutputGLSLBase::visitLoop(Visit visit, TIntermLoop *node)
+{
+ TInfoSinkBase &out = objSink();
+
+ incrementDepth(node);
+ // Loop header.
+ TLoopType loopType = node->getType();
+ if (loopType == ELoopFor) // for loop
+ {
+ if (!node->getUnrollFlag())
+ {
+ out << "for (";
+ if (node->getInit())
+ node->getInit()->traverse(this);
+ out << "; ";
+
+ if (node->getCondition())
+ node->getCondition()->traverse(this);
+ out << "; ";
+
+ if (node->getExpression())
+ node->getExpression()->traverse(this);
+ out << ")\n";
+ }
+ else
+ {
+ // Need to put a one-iteration loop here to handle break.
+ TIntermSequence &declSeq =
+ node->getInit()->getAsAggregate()->getSequence();
+ TIntermSymbol *indexSymbol =
+ declSeq[0]->getAsBinaryNode()->getLeft()->getAsSymbolNode();
+ TString name = hashVariableName(indexSymbol->getSymbol());
+ out << "for (int " << name << " = 0; "
+ << name << " < 1; "
+ << "++" << name << ")\n";
+ }
+ }
+ else if (loopType == ELoopWhile) // while loop
+ {
+ out << "while (";
+ ASSERT(node->getCondition() != NULL);
+ node->getCondition()->traverse(this);
+ out << ")\n";
+ }
+ else // do-while loop
+ {
+ ASSERT(loopType == ELoopDoWhile);
+ out << "do\n";
+ }
+
+ // Loop body.
+ if (node->getUnrollFlag())
+ {
+ out << "{\n";
+ mLoopUnrollStack.push(node);
+ while (mLoopUnrollStack.satisfiesLoopCondition())
+ {
+ visitCodeBlock(node->getBody());
+ mLoopUnrollStack.step();
+ }
+ mLoopUnrollStack.pop();
+ out << "}\n";
+ }
+ else
+ {
+ visitCodeBlock(node->getBody());
+ }
+
+ // Loop footer.
+ if (loopType == ELoopDoWhile) // do-while loop
+ {
+ out << "while (";
+ ASSERT(node->getCondition() != NULL);
+ node->getCondition()->traverse(this);
+ out << ");\n";
+ }
+ decrementDepth();
+
+ // No need to visit children. They have been already processed in
+ // this function.
+ return false;
+}
+
+bool TOutputGLSLBase::visitBranch(Visit visit, TIntermBranch *node)
+{
+ switch (node->getFlowOp())
+ {
+ case EOpKill:
+ writeTriplet(visit, "discard", NULL, NULL);
+ break;
+ case EOpBreak:
+ writeTriplet(visit, "break", NULL, NULL);
+ break;
+ case EOpContinue:
+ writeTriplet(visit, "continue", NULL, NULL);
+ break;
+ case EOpReturn:
+ writeTriplet(visit, "return ", NULL, NULL);
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ return true;
+}
+
+void TOutputGLSLBase::visitCodeBlock(TIntermNode *node)
+{
+ TInfoSinkBase &out = objSink();
+ if (node != NULL)
+ {
+ node->traverse(this);
+ // Single statements not part of a sequence need to be terminated
+ // with semi-colon.
+ if (isSingleStatement(node))
+ out << ";\n";
+ }
+ else
+ {
+ out << "{\n}\n"; // Empty code block.
+ }
+}
+
+TString TOutputGLSLBase::getTypeName(const TType &type)
+{
+ TInfoSinkBase out;
+ if (type.isMatrix())
+ {
+ out << "mat";
+ out << type.getNominalSize();
+ }
+ else if (type.isVector())
+ {
+ switch (type.getBasicType())
+ {
+ case EbtFloat:
+ out << "vec";
+ break;
+ case EbtInt:
+ out << "ivec";
+ break;
+ case EbtBool:
+ out << "bvec";
+ break;
+ default:
+ UNREACHABLE();
+ }
+ out << type.getNominalSize();
+ }
+ else
+ {
+ if (type.getBasicType() == EbtStruct)
+ out << hashName(type.getStruct()->name());
+ else
+ out << type.getBasicString();
+ }
+ return TString(out.c_str());
+}
+
+TString TOutputGLSLBase::hashName(const TString &name)
+{
+ if (mHashFunction == NULL || name.empty())
+ return name;
+ NameMap::const_iterator it = mNameMap.find(name.c_str());
+ if (it != mNameMap.end())
+ return it->second.c_str();
+ TString hashedName = TIntermTraverser::hash(name, mHashFunction);
+ mNameMap[name.c_str()] = hashedName.c_str();
+ return hashedName;
+}
+
+TString TOutputGLSLBase::hashVariableName(const TString &name)
+{
+ if (mSymbolTable.findBuiltIn(name, mShaderVersion) != NULL)
+ return name;
+ return hashName(name);
+}
+
+TString TOutputGLSLBase::hashFunctionName(const TString &mangled_name)
+{
+ TString name = TFunction::unmangleName(mangled_name);
+ if (mSymbolTable.findBuiltIn(mangled_name, mShaderVersion) != NULL || name == "main")
+ return translateTextureFunction(name);
+ return hashName(name);
+}
+
+bool TOutputGLSLBase::structDeclared(const TStructure *structure) const
+{
+ ASSERT(structure);
+ ASSERT(mDeclaredStructs.size() > 0);
+ for (size_t ii = mDeclaredStructs.size(); ii > 0; --ii)
+ {
+ const ScopedDeclaredStructs &scope = mDeclaredStructs[ii - 1];
+ for (size_t jj = 0; jj < scope.size(); ++jj)
+ {
+ if (scope[jj]->equals(*structure))
+ return true;
+ }
+ }
+ return false;
+}
+
+void TOutputGLSLBase::declareStruct(const TStructure *structure)
+{
+ TInfoSinkBase &out = objSink();
+
+ out << "struct " << hashName(structure->name()) << "{\n";
+ const TFieldList &fields = structure->fields();
+ for (size_t i = 0; i < fields.size(); ++i)
+ {
+ const TField *field = fields[i];
+ if (writeVariablePrecision(field->type()->getPrecision()))
+ out << " ";
+ out << getTypeName(*field->type()) << " " << hashName(field->name());
+ if (field->type()->isArray())
+ out << arrayBrackets(*field->type());
+ out << ";\n";
+ }
+ out << "}";
+}
+
+void TOutputGLSLBase::pushDeclaredStructsScope()
+{
+ mDeclaredStructs.push_back(ScopedDeclaredStructs());
+}
+
+void TOutputGLSLBase::popDeclaredStructsScope()
+{
+ // We should never pop the global scope.
+ ASSERT(mDeclaredStructs.size() >= 2);
+ mDeclaredStructs.pop_back();
+}
diff --git a/chromium/third_party/angle/src/compiler/translator/OutputGLSLBase.h b/chromium/third_party/angle/src/compiler/translator/OutputGLSLBase.h
new file mode 100644
index 00000000000..ae40f85e0d5
--- /dev/null
+++ b/chromium/third_party/angle/src/compiler/translator/OutputGLSLBase.h
@@ -0,0 +1,91 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef CROSSCOMPILERGLSL_OUTPUTGLSLBASE_H_
+#define CROSSCOMPILERGLSL_OUTPUTGLSLBASE_H_
+
+#include <vector>
+
+#include "compiler/translator/intermediate.h"
+#include "compiler/translator/LoopInfo.h"
+#include "compiler/translator/ParseContext.h"
+
+class TOutputGLSLBase : public TIntermTraverser
+{
+ public:
+ TOutputGLSLBase(TInfoSinkBase &objSink,
+ ShArrayIndexClampingStrategy clampingStrategy,
+ ShHashFunction64 hashFunction,
+ NameMap &nameMap,
+ TSymbolTable& symbolTable,
+ int shaderVersion);
+
+ protected:
+ TInfoSinkBase &objSink() { return mObjSink; }
+ void writeTriplet(Visit visit, const char *preStr, const char *inStr, const char *postStr);
+ void writeVariableType(const TType &type);
+ virtual bool writeVariablePrecision(TPrecision precision) = 0;
+ void writeFunctionParameters(const TIntermSequence &args);
+ const ConstantUnion *writeConstantUnion(const TType &type, const ConstantUnion *pConstUnion);
+ TString getTypeName(const TType &type);
+
+ virtual void visitSymbol(TIntermSymbol *node);
+ virtual void visitConstantUnion(TIntermConstantUnion *node);
+ virtual bool visitBinary(Visit visit, TIntermBinary *node);
+ virtual bool visitUnary(Visit visit, TIntermUnary *node);
+ virtual bool visitSelection(Visit visit, TIntermSelection *node);
+ virtual bool visitAggregate(Visit visit, TIntermAggregate *node);
+ virtual bool visitLoop(Visit visit, TIntermLoop *node);
+ virtual bool visitBranch(Visit visit, TIntermBranch *node);
+
+ void visitCodeBlock(TIntermNode *node);
+
+ // Return the original name if hash function pointer is NULL;
+ // otherwise return the hashed name.
+ TString hashName(const TString &name);
+ // Same as hashName(), but without hashing built-in variables.
+ TString hashVariableName(const TString &name);
+ // Same as hashName(), but without hashing built-in functions.
+ TString hashFunctionName(const TString &mangled_name);
+ // Used to translate function names for differences between ESSL and GLSL
+ virtual TString translateTextureFunction(TString &name) { return name; }
+
+ private:
+ bool structDeclared(const TStructure *structure) const;
+ void declareStruct(const TStructure *structure);
+ void pushDeclaredStructsScope();
+ void popDeclaredStructsScope();
+
+ void writeBuiltInFunctionTriplet(Visit visit, const char *preStr, bool useEmulatedFunction);
+
+ TInfoSinkBase &mObjSink;
+ bool mDeclaringVariables;
+
+ // Structs are declared as the tree is traversed. This list contains all
+ // the structs already declared within a scope. It is maintained so that
+ // a struct is declared only once within a scope.
+ typedef std::vector<TStructure *> ScopedDeclaredStructs;
+ // This vector contains all the structs from the global scope to the
+ // current scope. When the traverser exits a scope, the scope is discarded.
+ typedef std::vector<ScopedDeclaredStructs> DeclaredStructs;
+ DeclaredStructs mDeclaredStructs;
+
+ // Stack of loops that need to be unrolled.
+ TLoopStack mLoopUnrollStack;
+
+ ShArrayIndexClampingStrategy mClampingStrategy;
+
+ // name hashing.
+ ShHashFunction64 mHashFunction;
+
+ NameMap &mNameMap;
+
+ TSymbolTable &mSymbolTable;
+
+ const int mShaderVersion;
+};
+
+#endif // CROSSCOMPILERGLSL_OUTPUTGLSLBASE_H_
diff --git a/chromium/third_party/angle/src/compiler/translator/OutputHLSL.cpp b/chromium/third_party/angle/src/compiler/translator/OutputHLSL.cpp
new file mode 100644
index 00000000000..5520c861b4d
--- /dev/null
+++ b/chromium/third_party/angle/src/compiler/translator/OutputHLSL.cpp
@@ -0,0 +1,4184 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/translator/OutputHLSL.h"
+
+#include "common/angleutils.h"
+#include "common/utilities.h"
+#include "common/blocklayout.h"
+#include "compiler/translator/compilerdebug.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/DetectDiscontinuity.h"
+#include "compiler/translator/SearchSymbol.h"
+#include "compiler/translator/UnfoldShortCircuit.h"
+#include "compiler/translator/FlagStd140Structs.h"
+#include "compiler/translator/NodeSearch.h"
+#include "compiler/translator/RewriteElseBlocks.h"
+
+#include <algorithm>
+#include <cfloat>
+#include <stdio.h>
+
+namespace sh
+{
+
+TString OutputHLSL::TextureFunction::name() const
+{
+ TString name = "gl_texture";
+
+ if (IsSampler2D(sampler))
+ {
+ name += "2D";
+ }
+ else if (IsSampler3D(sampler))
+ {
+ name += "3D";
+ }
+ else if (IsSamplerCube(sampler))
+ {
+ name += "Cube";
+ }
+ else UNREACHABLE();
+
+ if (proj)
+ {
+ name += "Proj";
+ }
+
+ if (offset)
+ {
+ name += "Offset";
+ }
+
+ switch(method)
+ {
+ case IMPLICIT: break;
+ case BIAS: break; // Extra parameter makes the signature unique
+ case LOD: name += "Lod"; break;
+ case LOD0: name += "Lod0"; break;
+ case LOD0BIAS: name += "Lod0"; break; // Extra parameter makes the signature unique
+ case SIZE: name += "Size"; break;
+ case FETCH: name += "Fetch"; break;
+ case GRAD: name += "Grad"; break;
+ default: UNREACHABLE();
+ }
+
+ return name + "(";
+}
+
+const char *RegisterPrefix(const TType &type)
+{
+ if (IsSampler(type.getBasicType()))
+ {
+ return "s";
+ }
+ else
+ {
+ return "c";
+ }
+}
+
+bool OutputHLSL::TextureFunction::operator<(const TextureFunction &rhs) const
+{
+ if (sampler < rhs.sampler) return true;
+ if (sampler > rhs.sampler) return false;
+
+ if (coords < rhs.coords) return true;
+ if (coords > rhs.coords) return false;
+
+ if (!proj && rhs.proj) return true;
+ if (proj && !rhs.proj) return false;
+
+ if (!offset && rhs.offset) return true;
+ if (offset && !rhs.offset) return false;
+
+ if (method < rhs.method) return true;
+ if (method > rhs.method) return false;
+
+ return false;
+}
+
+OutputHLSL::OutputHLSL(TParseContext &context, const ShBuiltInResources& resources, ShShaderOutput outputType)
+ : TIntermTraverser(true, true, true), mContext(context), mOutputType(outputType)
+{
+ mUnfoldShortCircuit = new UnfoldShortCircuit(context, this);
+ mInsideFunction = false;
+
+ mUsesFragColor = false;
+ mUsesFragData = false;
+ mUsesDepthRange = false;
+ mUsesFragCoord = false;
+ mUsesPointCoord = false;
+ mUsesFrontFacing = false;
+ mUsesPointSize = false;
+ mUsesFragDepth = false;
+ mUsesXor = false;
+ mUsesMod1 = false;
+ mUsesMod2v = false;
+ mUsesMod2f = false;
+ mUsesMod3v = false;
+ mUsesMod3f = false;
+ mUsesMod4v = false;
+ mUsesMod4f = false;
+ mUsesFaceforward1 = false;
+ mUsesFaceforward2 = false;
+ mUsesFaceforward3 = false;
+ mUsesFaceforward4 = false;
+ mUsesAtan2_1 = false;
+ mUsesAtan2_2 = false;
+ mUsesAtan2_3 = false;
+ mUsesAtan2_4 = false;
+ mUsesDiscardRewriting = false;
+ mUsesNestedBreak = false;
+
+ mNumRenderTargets = resources.EXT_draw_buffers ? resources.MaxDrawBuffers : 1;
+
+ mUniqueIndex = 0;
+
+ mContainsLoopDiscontinuity = false;
+ mOutputLod0Function = false;
+ mInsideDiscontinuousLoop = false;
+ mNestedLoopDepth = 0;
+
+ mExcessiveLoopIndex = NULL;
+
+ if (mOutputType == SH_HLSL9_OUTPUT)
+ {
+ if (mContext.shaderType == SH_FRAGMENT_SHADER)
+ {
+ mUniformRegister = 3; // Reserve registers for dx_DepthRange, dx_ViewCoords and dx_DepthFront
+ }
+ else
+ {
+ mUniformRegister = 2; // Reserve registers for dx_DepthRange and dx_ViewAdjust
+ }
+ }
+ else
+ {
+ mUniformRegister = 0;
+ }
+
+ mSamplerRegister = 0;
+ mInterfaceBlockRegister = 2; // Reserve registers for the default uniform block and driver constants
+ mPaddingCounter = 0;
+}
+
+OutputHLSL::~OutputHLSL()
+{
+ delete mUnfoldShortCircuit;
+}
+
+void OutputHLSL::output()
+{
+ mContainsLoopDiscontinuity = mContext.shaderType == SH_FRAGMENT_SHADER && containsLoopDiscontinuity(mContext.treeRoot);
+ const std::vector<TIntermTyped*> &flaggedStructs = FlagStd140ValueStructs(mContext.treeRoot);
+ makeFlaggedStructMaps(flaggedStructs);
+
+ // Work around D3D9 bug that would manifest in vertex shaders with selection blocks which
+ // use a vertex attribute as a condition, and some related computation in the else block.
+ if (mOutputType == SH_HLSL9_OUTPUT && mContext.shaderType == SH_VERTEX_SHADER)
+ {
+ RewriteElseBlocks(mContext.treeRoot);
+ }
+
+ mContext.treeRoot->traverse(this); // Output the body first to determine what has to go in the header
+ header();
+
+ mContext.infoSink().obj << mHeader.c_str();
+ mContext.infoSink().obj << mBody.c_str();
+}
+
+void OutputHLSL::makeFlaggedStructMaps(const std::vector<TIntermTyped *> &flaggedStructs)
+{
+ for (unsigned int structIndex = 0; structIndex < flaggedStructs.size(); structIndex++)
+ {
+ TIntermTyped *flaggedNode = flaggedStructs[structIndex];
+
+ // This will mark the necessary block elements as referenced
+ flaggedNode->traverse(this);
+ TString structName(mBody.c_str());
+ mBody.erase();
+
+ mFlaggedStructOriginalNames[flaggedNode] = structName;
+
+ for (size_t pos = structName.find('.'); pos != std::string::npos; pos = structName.find('.'))
+ {
+ structName.erase(pos, 1);
+ }
+
+ mFlaggedStructMappedNames[flaggedNode] = "map" + structName;
+ }
+}
+
+TInfoSinkBase &OutputHLSL::getBodyStream()
+{
+ return mBody;
+}
+
+const std::vector<gl::Uniform> &OutputHLSL::getUniforms()
+{
+ return mActiveUniforms;
+}
+
+const std::vector<gl::InterfaceBlock> &OutputHLSL::getInterfaceBlocks() const
+{
+ return mActiveInterfaceBlocks;
+}
+
+const std::vector<gl::Attribute> &OutputHLSL::getOutputVariables() const
+{
+ return mActiveOutputVariables;
+}
+
+const std::vector<gl::Attribute> &OutputHLSL::getAttributes() const
+{
+ return mActiveAttributes;
+}
+
+const std::vector<gl::Varying> &OutputHLSL::getVaryings() const
+{
+ return mActiveVaryings;
+}
+
+int OutputHLSL::vectorSize(const TType &type) const
+{
+ int elementSize = type.isMatrix() ? type.getCols() : 1;
+ int arraySize = type.isArray() ? type.getArraySize() : 1;
+
+ return elementSize * arraySize;
+}
+
+TString OutputHLSL::interfaceBlockFieldString(const TInterfaceBlock &interfaceBlock, const TField &field)
+{
+ if (interfaceBlock.hasInstanceName())
+ {
+ return interfaceBlock.name() + "." + field.name();
+ }
+ else
+ {
+ return field.name();
+ }
+}
+
+TString OutputHLSL::decoratePrivate(const TString &privateText)
+{
+ return "dx_" + privateText;
+}
+
+TString OutputHLSL::interfaceBlockStructNameString(const TInterfaceBlock &interfaceBlock)
+{
+ return decoratePrivate(interfaceBlock.name()) + "_type";
+}
+
+TString OutputHLSL::interfaceBlockInstanceString(const TInterfaceBlock& interfaceBlock, unsigned int arrayIndex)
+{
+ if (!interfaceBlock.hasInstanceName())
+ {
+ return "";
+ }
+ else if (interfaceBlock.isArray())
+ {
+ return decoratePrivate(interfaceBlock.instanceName()) + "_" + str(arrayIndex);
+ }
+ else
+ {
+ return decorate(interfaceBlock.instanceName());
+ }
+}
+
+TString OutputHLSL::interfaceBlockFieldTypeString(const TField &field, TLayoutBlockStorage blockStorage)
+{
+ const TType &fieldType = *field.type();
+ const TLayoutMatrixPacking matrixPacking = fieldType.getLayoutQualifier().matrixPacking;
+ ASSERT(matrixPacking != EmpUnspecified);
+
+ if (fieldType.isMatrix())
+ {
+ // Use HLSL row-major packing for GLSL column-major matrices
+ const TString &matrixPackString = (matrixPacking == EmpRowMajor ? "column_major" : "row_major");
+ return matrixPackString + " " + typeString(fieldType);
+ }
+ else if (fieldType.getStruct())
+ {
+ // Use HLSL row-major packing for GLSL column-major matrices
+ return structureTypeName(*fieldType.getStruct(), matrixPacking == EmpColumnMajor, blockStorage == EbsStd140);
+ }
+ else
+ {
+ return typeString(fieldType);
+ }
+}
+
+TString OutputHLSL::interfaceBlockFieldString(const TInterfaceBlock &interfaceBlock, TLayoutBlockStorage blockStorage)
+{
+ TString hlsl;
+
+ int elementIndex = 0;
+
+ for (unsigned int typeIndex = 0; typeIndex < interfaceBlock.fields().size(); typeIndex++)
+ {
+ const TField &field = *interfaceBlock.fields()[typeIndex];
+ const TType &fieldType = *field.type();
+
+ if (blockStorage == EbsStd140)
+ {
+ // 2 and 3 component vector types in some cases need pre-padding
+ hlsl += std140PrePaddingString(fieldType, &elementIndex);
+ }
+
+ hlsl += " " + interfaceBlockFieldTypeString(field, blockStorage) +
+ " " + decorate(field.name()) + arrayString(fieldType) + ";\n";
+
+ // must pad out after matrices and arrays, where HLSL usually allows itself room to pack stuff
+ if (blockStorage == EbsStd140)
+ {
+ const bool useHLSLRowMajorPacking = (fieldType.getLayoutQualifier().matrixPacking == EmpColumnMajor);
+ hlsl += std140PostPaddingString(fieldType, useHLSLRowMajorPacking);
+ }
+ }
+
+ return hlsl;
+}
+
+TString OutputHLSL::interfaceBlockStructString(const TInterfaceBlock &interfaceBlock)
+{
+ const TLayoutBlockStorage blockStorage = interfaceBlock.blockStorage();
+
+ return "struct " + interfaceBlockStructNameString(interfaceBlock) + "\n"
+ "{\n" +
+ interfaceBlockFieldString(interfaceBlock, blockStorage) +
+ "};\n\n";
+}
+
+TString OutputHLSL::interfaceBlockString(const TInterfaceBlock &interfaceBlock, unsigned int registerIndex, unsigned int arrayIndex)
+{
+ const TString &arrayIndexString = (arrayIndex != GL_INVALID_INDEX ? decorate(str(arrayIndex)) : "");
+ const TString &blockName = interfaceBlock.name() + arrayIndexString;
+ TString hlsl;
+
+ hlsl += "cbuffer " + blockName + " : register(b" + str(registerIndex) + ")\n"
+ "{\n";
+
+ if (interfaceBlock.hasInstanceName())
+ {
+ hlsl += " " + interfaceBlockStructNameString(interfaceBlock) + " " + interfaceBlockInstanceString(interfaceBlock, arrayIndex) + ";\n";
+ }
+ else
+ {
+ const TLayoutBlockStorage blockStorage = interfaceBlock.blockStorage();
+ hlsl += interfaceBlockFieldString(interfaceBlock, blockStorage);
+ }
+
+ hlsl += "};\n\n";
+
+ return hlsl;
+}
+
+TString OutputHLSL::std140PrePaddingString(const TType &type, int *elementIndex)
+{
+ if (type.getBasicType() == EbtStruct || type.isMatrix() || type.isArray())
+ {
+ // no padding needed, HLSL will align the field to a new register
+ *elementIndex = 0;
+ return "";
+ }
+
+ const GLenum glType = glVariableType(type);
+ const int numComponents = gl::UniformComponentCount(glType);
+
+ if (numComponents >= 4)
+ {
+ // no padding needed, HLSL will align the field to a new register
+ *elementIndex = 0;
+ return "";
+ }
+
+ if (*elementIndex + numComponents > 4)
+ {
+ // no padding needed, HLSL will align the field to a new register
+ *elementIndex = numComponents;
+ return "";
+ }
+
+ TString padding;
+
+ const int alignment = numComponents == 3 ? 4 : numComponents;
+ const int paddingOffset = (*elementIndex % alignment);
+
+ if (paddingOffset != 0)
+ {
+ // padding is neccessary
+ for (int paddingIndex = paddingOffset; paddingIndex < alignment; paddingIndex++)
+ {
+ padding += " float pad_" + str(mPaddingCounter++) + ";\n";
+ }
+
+ *elementIndex += (alignment - paddingOffset);
+ }
+
+ *elementIndex += numComponents;
+ *elementIndex %= 4;
+
+ return padding;
+}
+
+TString OutputHLSL::std140PostPaddingString(const TType &type, bool useHLSLRowMajorPacking)
+{
+ if (!type.isMatrix() && !type.isArray() && type.getBasicType() != EbtStruct)
+ {
+ return "";
+ }
+
+ int numComponents = 0;
+
+ if (type.isMatrix())
+ {
+ // This method can also be called from structureString, which does not use layout qualifiers.
+ // Thus, use the method parameter for determining the matrix packing.
+ //
+ // Note HLSL row major packing corresponds to GL API column-major, and vice-versa, since we
+ // wish to always transpose GL matrices to play well with HLSL's matrix array indexing.
+ //
+ const bool isRowMajorMatrix = !useHLSLRowMajorPacking;
+ const GLenum glType = glVariableType(type);
+ numComponents = gl::MatrixComponentCount(glType, isRowMajorMatrix);
+ }
+ else if (type.getStruct())
+ {
+ const TString &structName = structureTypeName(*type.getStruct(), useHLSLRowMajorPacking, true);
+ numComponents = mStd140StructElementIndexes[structName];
+
+ if (numComponents == 0)
+ {
+ return "";
+ }
+ }
+ else
+ {
+ const GLenum glType = glVariableType(type);
+ numComponents = gl::UniformComponentCount(glType);
+ }
+
+ TString padding;
+ for (int paddingOffset = numComponents; paddingOffset < 4; paddingOffset++)
+ {
+ padding += " float pad_" + str(mPaddingCounter++) + ";\n";
+ }
+ return padding;
+}
+
+// Use the same layout for packed and shared
+void setBlockLayout(gl::InterfaceBlock *interfaceBlock, gl::BlockLayoutType newLayout)
+{
+ interfaceBlock->layout = newLayout;
+ interfaceBlock->blockInfo.clear();
+
+ switch (newLayout)
+ {
+ case gl::BLOCKLAYOUT_SHARED:
+ case gl::BLOCKLAYOUT_PACKED:
+ {
+ gl::HLSLBlockEncoder hlslEncoder(&interfaceBlock->blockInfo, gl::HLSLBlockEncoder::ENCODE_PACKED);
+ hlslEncoder.encodeInterfaceBlockFields(interfaceBlock->fields);
+ interfaceBlock->dataSize = hlslEncoder.getBlockSize();
+ }
+ break;
+
+ case gl::BLOCKLAYOUT_STANDARD:
+ {
+ gl::Std140BlockEncoder stdEncoder(&interfaceBlock->blockInfo);
+ stdEncoder.encodeInterfaceBlockFields(interfaceBlock->fields);
+ interfaceBlock->dataSize = stdEncoder.getBlockSize();
+ }
+ break;
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+gl::BlockLayoutType convertBlockLayoutType(TLayoutBlockStorage blockStorage)
+{
+ switch (blockStorage)
+ {
+ case EbsPacked: return gl::BLOCKLAYOUT_PACKED;
+ case EbsShared: return gl::BLOCKLAYOUT_SHARED;
+ case EbsStd140: return gl::BLOCKLAYOUT_STANDARD;
+ default: UNREACHABLE(); return gl::BLOCKLAYOUT_SHARED;
+ }
+}
+
+TString OutputHLSL::structInitializerString(int indent, const TStructure &structure, const TString &rhsStructName)
+{
+ TString init;
+
+ TString preIndentString;
+ TString fullIndentString;
+
+ for (int spaces = 0; spaces < (indent * 4); spaces++)
+ {
+ preIndentString += ' ';
+ }
+
+ for (int spaces = 0; spaces < ((indent+1) * 4); spaces++)
+ {
+ fullIndentString += ' ';
+ }
+
+ init += preIndentString + "{\n";
+
+ const TFieldList &fields = structure.fields();
+ for (unsigned int fieldIndex = 0; fieldIndex < fields.size(); fieldIndex++)
+ {
+ const TField &field = *fields[fieldIndex];
+ const TString &fieldName = rhsStructName + "." + decorate(field.name());
+ const TType &fieldType = *field.type();
+
+ if (fieldType.getStruct())
+ {
+ init += structInitializerString(indent + 1, *fieldType.getStruct(), fieldName);
+ }
+ else
+ {
+ init += fullIndentString + fieldName + ",\n";
+ }
+ }
+
+ init += preIndentString + "}" + (indent == 0 ? ";" : ",") + "\n";
+
+ return init;
+}
+
+void OutputHLSL::header()
+{
+ TInfoSinkBase &out = mHeader;
+
+ TString uniforms;
+ TString interfaceBlocks;
+ TString varyings;
+ TString attributes;
+ TString flaggedStructs;
+
+ for (ReferencedSymbols::const_iterator uniformIt = mReferencedUniforms.begin(); uniformIt != mReferencedUniforms.end(); uniformIt++)
+ {
+ const TIntermSymbol &uniform = *uniformIt->second;
+ const TType &type = uniform.getType();
+ const TString &name = uniform.getSymbol();
+
+ int registerIndex = declareUniformAndAssignRegister(type, name);
+
+ if (mOutputType == SH_HLSL11_OUTPUT && IsSampler(type.getBasicType())) // Also declare the texture
+ {
+ uniforms += "uniform " + samplerString(type) + " sampler_" + decorateUniform(name, type) + arrayString(type) +
+ " : register(s" + str(registerIndex) + ");\n";
+
+ uniforms += "uniform " + textureString(type) + " texture_" + decorateUniform(name, type) + arrayString(type) +
+ " : register(t" + str(registerIndex) + ");\n";
+ }
+ else
+ {
+ const TStructure *structure = type.getStruct();
+ const TString &typeName = (structure ? structureTypeName(*structure, false, false) : typeString(type));
+
+ const TString &registerString = TString("register(") + RegisterPrefix(type) + str(registerIndex) + ")";
+
+ uniforms += "uniform " + typeName + " " + decorateUniform(name, type) + arrayString(type) + " : " + registerString + ";\n";
+ }
+ }
+
+ for (ReferencedSymbols::const_iterator interfaceBlockIt = mReferencedInterfaceBlocks.begin(); interfaceBlockIt != mReferencedInterfaceBlocks.end(); interfaceBlockIt++)
+ {
+ const TType &nodeType = interfaceBlockIt->second->getType();
+ const TInterfaceBlock &interfaceBlock = *nodeType.getInterfaceBlock();
+ const TFieldList &fieldList = interfaceBlock.fields();
+
+ unsigned int arraySize = static_cast<unsigned int>(interfaceBlock.arraySize());
+ gl::InterfaceBlock activeBlock(interfaceBlock.name().c_str(), arraySize, mInterfaceBlockRegister);
+ for (unsigned int typeIndex = 0; typeIndex < fieldList.size(); typeIndex++)
+ {
+ const TField &field = *fieldList[typeIndex];
+ const TString &fullUniformName = interfaceBlockFieldString(interfaceBlock, field);
+ declareInterfaceBlockField(*field.type(), fullUniformName, activeBlock.fields);
+ }
+
+ mInterfaceBlockRegister += std::max(1u, arraySize);
+
+ gl::BlockLayoutType blockLayoutType = convertBlockLayoutType(interfaceBlock.blockStorage());
+ setBlockLayout(&activeBlock, blockLayoutType);
+
+ if (interfaceBlock.matrixPacking() == EmpRowMajor)
+ {
+ activeBlock.isRowMajorLayout = true;
+ }
+
+ mActiveInterfaceBlocks.push_back(activeBlock);
+
+ if (interfaceBlock.hasInstanceName())
+ {
+ interfaceBlocks += interfaceBlockStructString(interfaceBlock);
+ }
+
+ if (arraySize > 0)
+ {
+ for (unsigned int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++)
+ {
+ interfaceBlocks += interfaceBlockString(interfaceBlock, activeBlock.registerIndex + arrayIndex, arrayIndex);
+ }
+ }
+ else
+ {
+ interfaceBlocks += interfaceBlockString(interfaceBlock, activeBlock.registerIndex, GL_INVALID_INDEX);
+ }
+ }
+
+ for (std::map<TIntermTyped*, TString>::const_iterator flaggedStructIt = mFlaggedStructMappedNames.begin(); flaggedStructIt != mFlaggedStructMappedNames.end(); flaggedStructIt++)
+ {
+ TIntermTyped *structNode = flaggedStructIt->first;
+ const TString &mappedName = flaggedStructIt->second;
+ const TStructure &structure = *structNode->getType().getStruct();
+ const TString &originalName = mFlaggedStructOriginalNames[structNode];
+
+ flaggedStructs += "static " + decorate(structure.name()) + " " + mappedName + " =\n";
+ flaggedStructs += structInitializerString(0, structure, originalName);
+ flaggedStructs += "\n";
+ }
+
+ for (ReferencedSymbols::const_iterator varying = mReferencedVaryings.begin(); varying != mReferencedVaryings.end(); varying++)
+ {
+ const TType &type = varying->second->getType();
+ const TString &name = varying->second->getSymbol();
+
+ // Program linking depends on this exact format
+ varyings += "static " + interpolationString(type.getQualifier()) + " " + typeString(type) + " " +
+ decorate(name) + arrayString(type) + " = " + initializer(type) + ";\n";
+
+ declareVaryingToList(type, type.getQualifier(), name, mActiveVaryings);
+ }
+
+ for (ReferencedSymbols::const_iterator attribute = mReferencedAttributes.begin(); attribute != mReferencedAttributes.end(); attribute++)
+ {
+ const TType &type = attribute->second->getType();
+ const TString &name = attribute->second->getSymbol();
+
+ attributes += "static " + typeString(type) + " " + decorate(name) + arrayString(type) + " = " + initializer(type) + ";\n";
+
+ gl::Attribute attributeVar(glVariableType(type), glVariablePrecision(type), name.c_str(),
+ (unsigned int)type.getArraySize(), type.getLayoutQualifier().location);
+ mActiveAttributes.push_back(attributeVar);
+ }
+
+ for (StructDeclarations::iterator structDeclaration = mStructDeclarations.begin(); structDeclaration != mStructDeclarations.end(); structDeclaration++)
+ {
+ out << *structDeclaration;
+ }
+
+ for (Constructors::iterator constructor = mConstructors.begin(); constructor != mConstructors.end(); constructor++)
+ {
+ out << *constructor;
+ }
+
+ if (mUsesDiscardRewriting)
+ {
+ out << "#define ANGLE_USES_DISCARD_REWRITING" << "\n";
+ }
+
+ if (mUsesNestedBreak)
+ {
+ out << "#define ANGLE_USES_NESTED_BREAK" << "\n";
+ }
+
+ if (mContext.shaderType == SH_FRAGMENT_SHADER)
+ {
+ TExtensionBehavior::const_iterator iter = mContext.extensionBehavior().find("GL_EXT_draw_buffers");
+ const bool usingMRTExtension = (iter != mContext.extensionBehavior().end() && (iter->second == EBhEnable || iter->second == EBhRequire));
+
+ out << "// Varyings\n";
+ out << varyings;
+ out << "\n";
+
+ if (mContext.getShaderVersion() >= 300)
+ {
+ for (ReferencedSymbols::const_iterator outputVariableIt = mReferencedOutputVariables.begin(); outputVariableIt != mReferencedOutputVariables.end(); outputVariableIt++)
+ {
+ const TString &variableName = outputVariableIt->first;
+ const TType &variableType = outputVariableIt->second->getType();
+ const TLayoutQualifier &layoutQualifier = variableType.getLayoutQualifier();
+
+ out << "static " + typeString(variableType) + " out_" + variableName + arrayString(variableType) +
+ " = " + initializer(variableType) + ";\n";
+
+ gl::Attribute outputVar(glVariableType(variableType), glVariablePrecision(variableType), variableName.c_str(),
+ (unsigned int)variableType.getArraySize(), layoutQualifier.location);
+ mActiveOutputVariables.push_back(outputVar);
+ }
+ }
+ else
+ {
+ const unsigned int numColorValues = usingMRTExtension ? mNumRenderTargets : 1;
+
+ out << "static float4 gl_Color[" << numColorValues << "] =\n"
+ "{\n";
+ for (unsigned int i = 0; i < numColorValues; i++)
+ {
+ out << " float4(0, 0, 0, 0)";
+ if (i + 1 != numColorValues)
+ {
+ out << ",";
+ }
+ out << "\n";
+ }
+
+ out << "};\n";
+ }
+
+ if (mUsesFragDepth)
+ {
+ out << "static float gl_Depth = 0.0;\n";
+ }
+
+ if (mUsesFragCoord)
+ {
+ out << "static float4 gl_FragCoord = float4(0, 0, 0, 0);\n";
+ }
+
+ if (mUsesPointCoord)
+ {
+ out << "static float2 gl_PointCoord = float2(0.5, 0.5);\n";
+ }
+
+ if (mUsesFrontFacing)
+ {
+ out << "static bool gl_FrontFacing = false;\n";
+ }
+
+ out << "\n";
+
+ if (mUsesDepthRange)
+ {
+ out << "struct gl_DepthRangeParameters\n"
+ "{\n"
+ " float near;\n"
+ " float far;\n"
+ " float diff;\n"
+ "};\n"
+ "\n";
+ }
+
+ if (mOutputType == SH_HLSL11_OUTPUT)
+ {
+ out << "cbuffer DriverConstants : register(b1)\n"
+ "{\n";
+
+ if (mUsesDepthRange)
+ {
+ out << " float3 dx_DepthRange : packoffset(c0);\n";
+ }
+
+ if (mUsesFragCoord)
+ {
+ out << " float4 dx_ViewCoords : packoffset(c1);\n";
+ }
+
+ if (mUsesFragCoord || mUsesFrontFacing)
+ {
+ out << " float3 dx_DepthFront : packoffset(c2);\n";
+ }
+
+ out << "};\n";
+ }
+ else
+ {
+ if (mUsesDepthRange)
+ {
+ out << "uniform float3 dx_DepthRange : register(c0);";
+ }
+
+ if (mUsesFragCoord)
+ {
+ out << "uniform float4 dx_ViewCoords : register(c1);\n";
+ }
+
+ if (mUsesFragCoord || mUsesFrontFacing)
+ {
+ out << "uniform float3 dx_DepthFront : register(c2);\n";
+ }
+ }
+
+ out << "\n";
+
+ if (mUsesDepthRange)
+ {
+ out << "static gl_DepthRangeParameters gl_DepthRange = {dx_DepthRange.x, dx_DepthRange.y, dx_DepthRange.z};\n"
+ "\n";
+ }
+
+ out << uniforms;
+ out << "\n";
+
+ if (!interfaceBlocks.empty())
+ {
+ out << interfaceBlocks;
+ out << "\n";
+
+ if (!flaggedStructs.empty())
+ {
+ out << "// Std140 Structures accessed by value\n";
+ out << "\n";
+ out << flaggedStructs;
+ out << "\n";
+ }
+ }
+
+ if (usingMRTExtension && mNumRenderTargets > 1)
+ {
+ out << "#define GL_USES_MRT\n";
+ }
+
+ if (mUsesFragColor)
+ {
+ out << "#define GL_USES_FRAG_COLOR\n";
+ }
+
+ if (mUsesFragData)
+ {
+ out << "#define GL_USES_FRAG_DATA\n";
+ }
+ }
+ else // Vertex shader
+ {
+ out << "// Attributes\n";
+ out << attributes;
+ out << "\n"
+ "static float4 gl_Position = float4(0, 0, 0, 0);\n";
+
+ if (mUsesPointSize)
+ {
+ out << "static float gl_PointSize = float(1);\n";
+ }
+
+ out << "\n"
+ "// Varyings\n";
+ out << varyings;
+ out << "\n";
+
+ if (mUsesDepthRange)
+ {
+ out << "struct gl_DepthRangeParameters\n"
+ "{\n"
+ " float near;\n"
+ " float far;\n"
+ " float diff;\n"
+ "};\n"
+ "\n";
+ }
+
+ if (mOutputType == SH_HLSL11_OUTPUT)
+ {
+ if (mUsesDepthRange)
+ {
+ out << "cbuffer DriverConstants : register(b1)\n"
+ "{\n"
+ " float3 dx_DepthRange : packoffset(c0);\n"
+ "};\n"
+ "\n";
+ }
+ }
+ else
+ {
+ if (mUsesDepthRange)
+ {
+ out << "uniform float3 dx_DepthRange : register(c0);\n";
+ }
+
+ out << "uniform float4 dx_ViewAdjust : register(c1);\n"
+ "\n";
+ }
+
+ if (mUsesDepthRange)
+ {
+ out << "static gl_DepthRangeParameters gl_DepthRange = {dx_DepthRange.x, dx_DepthRange.y, dx_DepthRange.z};\n"
+ "\n";
+ }
+
+ out << uniforms;
+ out << "\n";
+
+ if (!interfaceBlocks.empty())
+ {
+ out << interfaceBlocks;
+ out << "\n";
+
+ if (!flaggedStructs.empty())
+ {
+ out << "// Std140 Structures accessed by value\n";
+ out << "\n";
+ out << flaggedStructs;
+ out << "\n";
+ }
+ }
+ }
+
+ for (TextureFunctionSet::const_iterator textureFunction = mUsesTexture.begin(); textureFunction != mUsesTexture.end(); textureFunction++)
+ {
+ // Return type
+ if (textureFunction->method == TextureFunction::SIZE)
+ {
+ switch(textureFunction->sampler)
+ {
+ case EbtSampler2D: out << "int2 "; break;
+ case EbtSampler3D: out << "int3 "; break;
+ case EbtSamplerCube: out << "int2 "; break;
+ case EbtSampler2DArray: out << "int3 "; break;
+ case EbtISampler2D: out << "int2 "; break;
+ case EbtISampler3D: out << "int3 "; break;
+ case EbtISamplerCube: out << "int2 "; break;
+ case EbtISampler2DArray: out << "int3 "; break;
+ case EbtUSampler2D: out << "int2 "; break;
+ case EbtUSampler3D: out << "int3 "; break;
+ case EbtUSamplerCube: out << "int2 "; break;
+ case EbtUSampler2DArray: out << "int3 "; break;
+ case EbtSampler2DShadow: out << "int2 "; break;
+ case EbtSamplerCubeShadow: out << "int2 "; break;
+ case EbtSampler2DArrayShadow: out << "int3 "; break;
+ default: UNREACHABLE();
+ }
+ }
+ else // Sampling function
+ {
+ switch(textureFunction->sampler)
+ {
+ case EbtSampler2D: out << "float4 "; break;
+ case EbtSampler3D: out << "float4 "; break;
+ case EbtSamplerCube: out << "float4 "; break;
+ case EbtSampler2DArray: out << "float4 "; break;
+ case EbtISampler2D: out << "int4 "; break;
+ case EbtISampler3D: out << "int4 "; break;
+ case EbtISamplerCube: out << "int4 "; break;
+ case EbtISampler2DArray: out << "int4 "; break;
+ case EbtUSampler2D: out << "uint4 "; break;
+ case EbtUSampler3D: out << "uint4 "; break;
+ case EbtUSamplerCube: out << "uint4 "; break;
+ case EbtUSampler2DArray: out << "uint4 "; break;
+ case EbtSampler2DShadow: out << "float "; break;
+ case EbtSamplerCubeShadow: out << "float "; break;
+ case EbtSampler2DArrayShadow: out << "float "; break;
+ default: UNREACHABLE();
+ }
+ }
+
+ // Function name
+ out << textureFunction->name();
+
+ // Argument list
+ int hlslCoords = 4;
+
+ if (mOutputType == SH_HLSL9_OUTPUT)
+ {
+ switch(textureFunction->sampler)
+ {
+ case EbtSampler2D: out << "sampler2D s"; hlslCoords = 2; break;
+ case EbtSamplerCube: out << "samplerCUBE s"; hlslCoords = 3; break;
+ default: UNREACHABLE();
+ }
+
+ switch(textureFunction->method)
+ {
+ case TextureFunction::IMPLICIT: break;
+ case TextureFunction::BIAS: hlslCoords = 4; break;
+ case TextureFunction::LOD: hlslCoords = 4; break;
+ case TextureFunction::LOD0: hlslCoords = 4; break;
+ case TextureFunction::LOD0BIAS: hlslCoords = 4; break;
+ default: UNREACHABLE();
+ }
+ }
+ else if (mOutputType == SH_HLSL11_OUTPUT)
+ {
+ switch(textureFunction->sampler)
+ {
+ case EbtSampler2D: out << "Texture2D x, SamplerState s"; hlslCoords = 2; break;
+ case EbtSampler3D: out << "Texture3D x, SamplerState s"; hlslCoords = 3; break;
+ case EbtSamplerCube: out << "TextureCube x, SamplerState s"; hlslCoords = 3; break;
+ case EbtSampler2DArray: out << "Texture2DArray x, SamplerState s"; hlslCoords = 3; break;
+ case EbtISampler2D: out << "Texture2D<int4> x, SamplerState s"; hlslCoords = 2; break;
+ case EbtISampler3D: out << "Texture3D<int4> x, SamplerState s"; hlslCoords = 3; break;
+ case EbtISamplerCube: out << "Texture2DArray<int4> x, SamplerState s"; hlslCoords = 3; break;
+ case EbtISampler2DArray: out << "Texture2DArray<int4> x, SamplerState s"; hlslCoords = 3; break;
+ case EbtUSampler2D: out << "Texture2D<uint4> x, SamplerState s"; hlslCoords = 2; break;
+ case EbtUSampler3D: out << "Texture3D<uint4> x, SamplerState s"; hlslCoords = 3; break;
+ case EbtUSamplerCube: out << "Texture2DArray<uint4> x, SamplerState s"; hlslCoords = 3; break;
+ case EbtUSampler2DArray: out << "Texture2DArray<uint4> x, SamplerState s"; hlslCoords = 3; break;
+ case EbtSampler2DShadow: out << "Texture2D x, SamplerComparisonState s"; hlslCoords = 2; break;
+ case EbtSamplerCubeShadow: out << "TextureCube x, SamplerComparisonState s"; hlslCoords = 3; break;
+ case EbtSampler2DArrayShadow: out << "Texture2DArray x, SamplerComparisonState s"; hlslCoords = 3; break;
+ default: UNREACHABLE();
+ }
+ }
+ else UNREACHABLE();
+
+ if (textureFunction->method == TextureFunction::FETCH) // Integer coordinates
+ {
+ switch(textureFunction->coords)
+ {
+ case 2: out << ", int2 t"; break;
+ case 3: out << ", int3 t"; break;
+ default: UNREACHABLE();
+ }
+ }
+ else // Floating-point coordinates (except textureSize)
+ {
+ switch(textureFunction->coords)
+ {
+ case 1: out << ", int lod"; break; // textureSize()
+ case 2: out << ", float2 t"; break;
+ case 3: out << ", float3 t"; break;
+ case 4: out << ", float4 t"; break;
+ default: UNREACHABLE();
+ }
+ }
+
+ if (textureFunction->method == TextureFunction::GRAD)
+ {
+ switch(textureFunction->sampler)
+ {
+ case EbtSampler2D:
+ case EbtISampler2D:
+ case EbtUSampler2D:
+ case EbtSampler2DArray:
+ case EbtISampler2DArray:
+ case EbtUSampler2DArray:
+ case EbtSampler2DShadow:
+ case EbtSampler2DArrayShadow:
+ out << ", float2 ddx, float2 ddy";
+ break;
+ case EbtSampler3D:
+ case EbtISampler3D:
+ case EbtUSampler3D:
+ case EbtSamplerCube:
+ case EbtISamplerCube:
+ case EbtUSamplerCube:
+ case EbtSamplerCubeShadow:
+ out << ", float3 ddx, float3 ddy";
+ break;
+ default: UNREACHABLE();
+ }
+ }
+
+ switch(textureFunction->method)
+ {
+ case TextureFunction::IMPLICIT: break;
+ case TextureFunction::BIAS: break; // Comes after the offset parameter
+ case TextureFunction::LOD: out << ", float lod"; break;
+ case TextureFunction::LOD0: break;
+ case TextureFunction::LOD0BIAS: break; // Comes after the offset parameter
+ case TextureFunction::SIZE: break;
+ case TextureFunction::FETCH: out << ", int mip"; break;
+ case TextureFunction::GRAD: break;
+ default: UNREACHABLE();
+ }
+
+ if (textureFunction->offset)
+ {
+ switch(textureFunction->sampler)
+ {
+ case EbtSampler2D: out << ", int2 offset"; break;
+ case EbtSampler3D: out << ", int3 offset"; break;
+ case EbtSampler2DArray: out << ", int2 offset"; break;
+ case EbtISampler2D: out << ", int2 offset"; break;
+ case EbtISampler3D: out << ", int3 offset"; break;
+ case EbtISampler2DArray: out << ", int2 offset"; break;
+ case EbtUSampler2D: out << ", int2 offset"; break;
+ case EbtUSampler3D: out << ", int3 offset"; break;
+ case EbtUSampler2DArray: out << ", int2 offset"; break;
+ case EbtSampler2DShadow: out << ", int2 offset"; break;
+ case EbtSampler2DArrayShadow: out << ", int2 offset"; break;
+ default: UNREACHABLE();
+ }
+ }
+
+ if (textureFunction->method == TextureFunction::BIAS ||
+ textureFunction->method == TextureFunction::LOD0BIAS)
+ {
+ out << ", float bias";
+ }
+
+ out << ")\n"
+ "{\n";
+
+ if (textureFunction->method == TextureFunction::SIZE)
+ {
+ if (IsSampler2D(textureFunction->sampler) || IsSamplerCube(textureFunction->sampler))
+ {
+ if (IsSamplerArray(textureFunction->sampler))
+ {
+ out << " uint width; uint height; uint layers; uint numberOfLevels;\n"
+ " x.GetDimensions(lod, width, height, layers, numberOfLevels);\n";
+ }
+ else
+ {
+ out << " uint width; uint height; uint numberOfLevels;\n"
+ " x.GetDimensions(lod, width, height, numberOfLevels);\n";
+ }
+ }
+ else if (IsSampler3D(textureFunction->sampler))
+ {
+ out << " uint width; uint height; uint depth; uint numberOfLevels;\n"
+ " x.GetDimensions(lod, width, height, depth, numberOfLevels);\n";
+ }
+ else UNREACHABLE();
+
+ switch(textureFunction->sampler)
+ {
+ case EbtSampler2D: out << " return int2(width, height);"; break;
+ case EbtSampler3D: out << " return int3(width, height, depth);"; break;
+ case EbtSamplerCube: out << " return int2(width, height);"; break;
+ case EbtSampler2DArray: out << " return int3(width, height, layers);"; break;
+ case EbtISampler2D: out << " return int2(width, height);"; break;
+ case EbtISampler3D: out << " return int3(width, height, depth);"; break;
+ case EbtISamplerCube: out << " return int2(width, height);"; break;
+ case EbtISampler2DArray: out << " return int3(width, height, layers);"; break;
+ case EbtUSampler2D: out << " return int2(width, height);"; break;
+ case EbtUSampler3D: out << " return int3(width, height, depth);"; break;
+ case EbtUSamplerCube: out << " return int2(width, height);"; break;
+ case EbtUSampler2DArray: out << " return int3(width, height, layers);"; break;
+ case EbtSampler2DShadow: out << " return int2(width, height);"; break;
+ case EbtSamplerCubeShadow: out << " return int2(width, height);"; break;
+ case EbtSampler2DArrayShadow: out << " return int3(width, height, layers);"; break;
+ default: UNREACHABLE();
+ }
+ }
+ else
+ {
+ if (IsIntegerSampler(textureFunction->sampler) && IsSamplerCube(textureFunction->sampler))
+ {
+ out << " float width; float height; float layers; float levels;\n";
+
+ out << " uint mip = 0;\n";
+
+ out << " x.GetDimensions(mip, width, height, layers, levels);\n";
+
+ out << " bool xMajor = abs(t.x) > abs(t.y) && abs(t.x) > abs(t.z);\n";
+ out << " bool yMajor = abs(t.y) > abs(t.z) && abs(t.y) > abs(t.x);\n";
+ out << " bool zMajor = abs(t.z) > abs(t.x) && abs(t.z) > abs(t.y);\n";
+ out << " bool negative = (xMajor && t.x < 0.0f) || (yMajor && t.y < 0.0f) || (zMajor && t.z < 0.0f);\n";
+
+ // FACE_POSITIVE_X = 000b
+ // FACE_NEGATIVE_X = 001b
+ // FACE_POSITIVE_Y = 010b
+ // FACE_NEGATIVE_Y = 011b
+ // FACE_POSITIVE_Z = 100b
+ // FACE_NEGATIVE_Z = 101b
+ out << " int face = (int)negative + (int)yMajor * 2 + (int)zMajor * 4;\n";
+
+ out << " float u = xMajor ? -t.z : (yMajor && t.y < 0.0f ? -t.x : t.x);\n";
+ out << " float v = yMajor ? t.z : (negative ? t.y : -t.y);\n";
+ out << " float m = xMajor ? t.x : (yMajor ? t.y : t.z);\n";
+
+ out << " t.x = (u * 0.5f / m) + 0.5f;\n";
+ out << " t.y = (v * 0.5f / m) + 0.5f;\n";
+ }
+ else if (IsIntegerSampler(textureFunction->sampler) &&
+ textureFunction->method != TextureFunction::FETCH)
+ {
+ if (IsSampler2D(textureFunction->sampler))
+ {
+ if (IsSamplerArray(textureFunction->sampler))
+ {
+ out << " float width; float height; float layers; float levels;\n";
+
+ if (textureFunction->method == TextureFunction::LOD0)
+ {
+ out << " uint mip = 0;\n";
+ }
+ else if (textureFunction->method == TextureFunction::LOD0BIAS)
+ {
+ out << " uint mip = bias;\n";
+ }
+ else
+ {
+ if (textureFunction->method == TextureFunction::IMPLICIT ||
+ textureFunction->method == TextureFunction::BIAS)
+ {
+ out << " x.GetDimensions(0, width, height, layers, levels);\n"
+ " float2 tSized = float2(t.x * width, t.y * height);\n"
+ " float dx = length(ddx(tSized));\n"
+ " float dy = length(ddy(tSized));\n"
+ " float lod = log2(max(dx, dy));\n";
+
+ if (textureFunction->method == TextureFunction::BIAS)
+ {
+ out << " lod += bias;\n";
+ }
+ }
+ else if (textureFunction->method == TextureFunction::GRAD)
+ {
+ out << " x.GetDimensions(0, width, height, layers, levels);\n"
+ " float lod = log2(max(length(ddx), length(ddy)));\n";
+ }
+
+ out << " uint mip = uint(min(max(round(lod), 0), levels - 1));\n";
+ }
+
+ out << " x.GetDimensions(mip, width, height, layers, levels);\n";
+ }
+ else
+ {
+ out << " float width; float height; float levels;\n";
+
+ if (textureFunction->method == TextureFunction::LOD0)
+ {
+ out << " uint mip = 0;\n";
+ }
+ else if (textureFunction->method == TextureFunction::LOD0BIAS)
+ {
+ out << " uint mip = bias;\n";
+ }
+ else
+ {
+ if (textureFunction->method == TextureFunction::IMPLICIT ||
+ textureFunction->method == TextureFunction::BIAS)
+ {
+ out << " x.GetDimensions(0, width, height, levels);\n"
+ " float2 tSized = float2(t.x * width, t.y * height);\n"
+ " float dx = length(ddx(tSized));\n"
+ " float dy = length(ddy(tSized));\n"
+ " float lod = log2(max(dx, dy));\n";
+
+ if (textureFunction->method == TextureFunction::BIAS)
+ {
+ out << " lod += bias;\n";
+ }
+ }
+ else if (textureFunction->method == TextureFunction::LOD)
+ {
+ out << " x.GetDimensions(0, width, height, levels);\n";
+ }
+ else if (textureFunction->method == TextureFunction::GRAD)
+ {
+ out << " x.GetDimensions(0, width, height, levels);\n"
+ " float lod = log2(max(length(ddx), length(ddy)));\n";
+ }
+
+ out << " uint mip = uint(min(max(round(lod), 0), levels - 1));\n";
+ }
+
+ out << " x.GetDimensions(mip, width, height, levels);\n";
+ }
+ }
+ else if (IsSampler3D(textureFunction->sampler))
+ {
+ out << " float width; float height; float depth; float levels;\n";
+
+ if (textureFunction->method == TextureFunction::LOD0)
+ {
+ out << " uint mip = 0;\n";
+ }
+ else if (textureFunction->method == TextureFunction::LOD0BIAS)
+ {
+ out << " uint mip = bias;\n";
+ }
+ else
+ {
+ if (textureFunction->method == TextureFunction::IMPLICIT ||
+ textureFunction->method == TextureFunction::BIAS)
+ {
+ out << " x.GetDimensions(0, width, height, depth, levels);\n"
+ " float3 tSized = float3(t.x * width, t.y * height, t.z * depth);\n"
+ " float dx = length(ddx(tSized));\n"
+ " float dy = length(ddy(tSized));\n"
+ " float lod = log2(max(dx, dy));\n";
+
+ if (textureFunction->method == TextureFunction::BIAS)
+ {
+ out << " lod += bias;\n";
+ }
+ }
+ else if (textureFunction->method == TextureFunction::GRAD)
+ {
+ out << " x.GetDimensions(0, width, height, depth, levels);\n"
+ " float lod = log2(max(length(ddx), length(ddy)));\n";
+ }
+
+ out << " uint mip = uint(min(max(round(lod), 0), levels - 1));\n";
+ }
+
+ out << " x.GetDimensions(mip, width, height, depth, levels);\n";
+ }
+ else UNREACHABLE();
+ }
+
+ out << " return ";
+
+ // HLSL intrinsic
+ if (mOutputType == SH_HLSL9_OUTPUT)
+ {
+ switch(textureFunction->sampler)
+ {
+ case EbtSampler2D: out << "tex2D"; break;
+ case EbtSamplerCube: out << "texCUBE"; break;
+ default: UNREACHABLE();
+ }
+
+ switch(textureFunction->method)
+ {
+ case TextureFunction::IMPLICIT: out << "(s, "; break;
+ case TextureFunction::BIAS: out << "bias(s, "; break;
+ case TextureFunction::LOD: out << "lod(s, "; break;
+ case TextureFunction::LOD0: out << "lod(s, "; break;
+ case TextureFunction::LOD0BIAS: out << "lod(s, "; break;
+ default: UNREACHABLE();
+ }
+ }
+ else if (mOutputType == SH_HLSL11_OUTPUT)
+ {
+ if (textureFunction->method == TextureFunction::GRAD)
+ {
+ if (IsIntegerSampler(textureFunction->sampler))
+ {
+ out << "x.Load(";
+ }
+ else if (IsShadowSampler(textureFunction->sampler))
+ {
+ out << "x.SampleCmpLevelZero(s, ";
+ }
+ else
+ {
+ out << "x.SampleGrad(s, ";
+ }
+ }
+ else if (IsIntegerSampler(textureFunction->sampler) ||
+ textureFunction->method == TextureFunction::FETCH)
+ {
+ out << "x.Load(";
+ }
+ else if (IsShadowSampler(textureFunction->sampler))
+ {
+ out << "x.SampleCmp(s, ";
+ }
+ else
+ {
+ switch(textureFunction->method)
+ {
+ case TextureFunction::IMPLICIT: out << "x.Sample(s, "; break;
+ case TextureFunction::BIAS: out << "x.SampleBias(s, "; break;
+ case TextureFunction::LOD: out << "x.SampleLevel(s, "; break;
+ case TextureFunction::LOD0: out << "x.SampleLevel(s, "; break;
+ case TextureFunction::LOD0BIAS: out << "x.SampleLevel(s, "; break;
+ default: UNREACHABLE();
+ }
+ }
+ }
+ else UNREACHABLE();
+
+ // Integer sampling requires integer addresses
+ TString addressx = "";
+ TString addressy = "";
+ TString addressz = "";
+ TString close = "";
+
+ if (IsIntegerSampler(textureFunction->sampler) ||
+ textureFunction->method == TextureFunction::FETCH)
+ {
+ switch(hlslCoords)
+ {
+ case 2: out << "int3("; break;
+ case 3: out << "int4("; break;
+ default: UNREACHABLE();
+ }
+
+ // Convert from normalized floating-point to integer
+ if (textureFunction->method != TextureFunction::FETCH)
+ {
+ addressx = "int(floor(width * frac((";
+ addressy = "int(floor(height * frac((";
+
+ if (IsSamplerArray(textureFunction->sampler))
+ {
+ addressz = "int(max(0, min(layers - 1, floor(0.5 + ";
+ }
+ else if (IsSamplerCube(textureFunction->sampler))
+ {
+ addressz = "((((";
+ }
+ else
+ {
+ addressz = "int(floor(depth * frac((";
+ }
+
+ close = "))))";
+ }
+ }
+ else
+ {
+ switch(hlslCoords)
+ {
+ case 2: out << "float2("; break;
+ case 3: out << "float3("; break;
+ case 4: out << "float4("; break;
+ default: UNREACHABLE();
+ }
+ }
+
+ TString proj = ""; // Only used for projected textures
+
+ if (textureFunction->proj)
+ {
+ switch(textureFunction->coords)
+ {
+ case 3: proj = " / t.z"; break;
+ case 4: proj = " / t.w"; break;
+ default: UNREACHABLE();
+ }
+ }
+
+ out << addressx + ("t.x" + proj) + close + ", " + addressy + ("t.y" + proj) + close;
+
+ if (mOutputType == SH_HLSL9_OUTPUT)
+ {
+ if (hlslCoords >= 3)
+ {
+ if (textureFunction->coords < 3)
+ {
+ out << ", 0";
+ }
+ else
+ {
+ out << ", t.z" + proj;
+ }
+ }
+
+ if (hlslCoords == 4)
+ {
+ switch(textureFunction->method)
+ {
+ case TextureFunction::BIAS: out << ", bias"; break;
+ case TextureFunction::LOD: out << ", lod"; break;
+ case TextureFunction::LOD0: out << ", 0"; break;
+ case TextureFunction::LOD0BIAS: out << ", bias"; break;
+ default: UNREACHABLE();
+ }
+ }
+
+ out << "));\n";
+ }
+ else if (mOutputType == SH_HLSL11_OUTPUT)
+ {
+ if (hlslCoords >= 3)
+ {
+ if (IsIntegerSampler(textureFunction->sampler) && IsSamplerCube(textureFunction->sampler))
+ {
+ out << ", face";
+ }
+ else
+ {
+ out << ", " + addressz + ("t.z" + proj) + close;
+ }
+ }
+
+ if (textureFunction->method == TextureFunction::GRAD)
+ {
+ if (IsIntegerSampler(textureFunction->sampler))
+ {
+ out << ", mip)";
+ }
+ else if (IsShadowSampler(textureFunction->sampler))
+ {
+ // Compare value
+ switch(textureFunction->coords)
+ {
+ case 3: out << "), t.z"; break;
+ case 4: out << "), t.w"; break;
+ default: UNREACHABLE();
+ }
+ }
+ else
+ {
+ out << "), ddx, ddy";
+ }
+ }
+ else if (IsIntegerSampler(textureFunction->sampler) ||
+ textureFunction->method == TextureFunction::FETCH)
+ {
+ out << ", mip)";
+ }
+ else if (IsShadowSampler(textureFunction->sampler))
+ {
+ // Compare value
+ switch(textureFunction->coords)
+ {
+ case 3: out << "), t.z"; break;
+ case 4: out << "), t.w"; break;
+ default: UNREACHABLE();
+ }
+ }
+ else
+ {
+ switch(textureFunction->method)
+ {
+ case TextureFunction::IMPLICIT: out << ")"; break;
+ case TextureFunction::BIAS: out << "), bias"; break;
+ case TextureFunction::LOD: out << "), lod"; break;
+ case TextureFunction::LOD0: out << "), 0"; break;
+ case TextureFunction::LOD0BIAS: out << "), bias"; break;
+ default: UNREACHABLE();
+ }
+ }
+
+ if (textureFunction->offset)
+ {
+ out << ", offset";
+ }
+
+ out << ");";
+ }
+ else UNREACHABLE();
+ }
+
+ out << "\n"
+ "}\n"
+ "\n";
+ }
+
+ if (mUsesFragCoord)
+ {
+ out << "#define GL_USES_FRAG_COORD\n";
+ }
+
+ if (mUsesPointCoord)
+ {
+ out << "#define GL_USES_POINT_COORD\n";
+ }
+
+ if (mUsesFrontFacing)
+ {
+ out << "#define GL_USES_FRONT_FACING\n";
+ }
+
+ if (mUsesPointSize)
+ {
+ out << "#define GL_USES_POINT_SIZE\n";
+ }
+
+ if (mUsesFragDepth)
+ {
+ out << "#define GL_USES_FRAG_DEPTH\n";
+ }
+
+ if (mUsesDepthRange)
+ {
+ out << "#define GL_USES_DEPTH_RANGE\n";
+ }
+
+ if (mUsesXor)
+ {
+ out << "bool xor(bool p, bool q)\n"
+ "{\n"
+ " return (p || q) && !(p && q);\n"
+ "}\n"
+ "\n";
+ }
+
+ if (mUsesMod1)
+ {
+ out << "float mod(float x, float y)\n"
+ "{\n"
+ " return x - y * floor(x / y);\n"
+ "}\n"
+ "\n";
+ }
+
+ if (mUsesMod2v)
+ {
+ out << "float2 mod(float2 x, float2 y)\n"
+ "{\n"
+ " return x - y * floor(x / y);\n"
+ "}\n"
+ "\n";
+ }
+
+ if (mUsesMod2f)
+ {
+ out << "float2 mod(float2 x, float y)\n"
+ "{\n"
+ " return x - y * floor(x / y);\n"
+ "}\n"
+ "\n";
+ }
+
+ if (mUsesMod3v)
+ {
+ out << "float3 mod(float3 x, float3 y)\n"
+ "{\n"
+ " return x - y * floor(x / y);\n"
+ "}\n"
+ "\n";
+ }
+
+ if (mUsesMod3f)
+ {
+ out << "float3 mod(float3 x, float y)\n"
+ "{\n"
+ " return x - y * floor(x / y);\n"
+ "}\n"
+ "\n";
+ }
+
+ if (mUsesMod4v)
+ {
+ out << "float4 mod(float4 x, float4 y)\n"
+ "{\n"
+ " return x - y * floor(x / y);\n"
+ "}\n"
+ "\n";
+ }
+
+ if (mUsesMod4f)
+ {
+ out << "float4 mod(float4 x, float y)\n"
+ "{\n"
+ " return x - y * floor(x / y);\n"
+ "}\n"
+ "\n";
+ }
+
+ if (mUsesFaceforward1)
+ {
+ out << "float faceforward(float N, float I, float Nref)\n"
+ "{\n"
+ " if(dot(Nref, I) >= 0)\n"
+ " {\n"
+ " return -N;\n"
+ " }\n"
+ " else\n"
+ " {\n"
+ " return N;\n"
+ " }\n"
+ "}\n"
+ "\n";
+ }
+
+ if (mUsesFaceforward2)
+ {
+ out << "float2 faceforward(float2 N, float2 I, float2 Nref)\n"
+ "{\n"
+ " if(dot(Nref, I) >= 0)\n"
+ " {\n"
+ " return -N;\n"
+ " }\n"
+ " else\n"
+ " {\n"
+ " return N;\n"
+ " }\n"
+ "}\n"
+ "\n";
+ }
+
+ if (mUsesFaceforward3)
+ {
+ out << "float3 faceforward(float3 N, float3 I, float3 Nref)\n"
+ "{\n"
+ " if(dot(Nref, I) >= 0)\n"
+ " {\n"
+ " return -N;\n"
+ " }\n"
+ " else\n"
+ " {\n"
+ " return N;\n"
+ " }\n"
+ "}\n"
+ "\n";
+ }
+
+ if (mUsesFaceforward4)
+ {
+ out << "float4 faceforward(float4 N, float4 I, float4 Nref)\n"
+ "{\n"
+ " if(dot(Nref, I) >= 0)\n"
+ " {\n"
+ " return -N;\n"
+ " }\n"
+ " else\n"
+ " {\n"
+ " return N;\n"
+ " }\n"
+ "}\n"
+ "\n";
+ }
+
+ if (mUsesAtan2_1)
+ {
+ out << "float atanyx(float y, float x)\n"
+ "{\n"
+ " if(x == 0 && y == 0) x = 1;\n" // Avoid producing a NaN
+ " return atan2(y, x);\n"
+ "}\n";
+ }
+
+ if (mUsesAtan2_2)
+ {
+ out << "float2 atanyx(float2 y, float2 x)\n"
+ "{\n"
+ " if(x[0] == 0 && y[0] == 0) x[0] = 1;\n"
+ " if(x[1] == 0 && y[1] == 0) x[1] = 1;\n"
+ " return float2(atan2(y[0], x[0]), atan2(y[1], x[1]));\n"
+ "}\n";
+ }
+
+ if (mUsesAtan2_3)
+ {
+ out << "float3 atanyx(float3 y, float3 x)\n"
+ "{\n"
+ " if(x[0] == 0 && y[0] == 0) x[0] = 1;\n"
+ " if(x[1] == 0 && y[1] == 0) x[1] = 1;\n"
+ " if(x[2] == 0 && y[2] == 0) x[2] = 1;\n"
+ " return float3(atan2(y[0], x[0]), atan2(y[1], x[1]), atan2(y[2], x[2]));\n"
+ "}\n";
+ }
+
+ if (mUsesAtan2_4)
+ {
+ out << "float4 atanyx(float4 y, float4 x)\n"
+ "{\n"
+ " if(x[0] == 0 && y[0] == 0) x[0] = 1;\n"
+ " if(x[1] == 0 && y[1] == 0) x[1] = 1;\n"
+ " if(x[2] == 0 && y[2] == 0) x[2] = 1;\n"
+ " if(x[3] == 0 && y[3] == 0) x[3] = 1;\n"
+ " return float4(atan2(y[0], x[0]), atan2(y[1], x[1]), atan2(y[2], x[2]), atan2(y[3], x[3]));\n"
+ "}\n";
+ }
+}
+
+void OutputHLSL::visitSymbol(TIntermSymbol *node)
+{
+ TInfoSinkBase &out = mBody;
+
+ // Handle accessing std140 structs by value
+ if (mFlaggedStructMappedNames.count(node) > 0)
+ {
+ out << mFlaggedStructMappedNames[node];
+ return;
+ }
+
+ TString name = node->getSymbol();
+
+ if (name == "gl_DepthRange")
+ {
+ mUsesDepthRange = true;
+ out << name;
+ }
+ else
+ {
+ TQualifier qualifier = node->getQualifier();
+
+ if (qualifier == EvqUniform)
+ {
+ const TType& nodeType = node->getType();
+ const TInterfaceBlock* interfaceBlock = nodeType.getInterfaceBlock();
+
+ if (interfaceBlock)
+ {
+ mReferencedInterfaceBlocks[interfaceBlock->name()] = node;
+ }
+ else
+ {
+ mReferencedUniforms[name] = node;
+ }
+
+ out << decorateUniform(name, nodeType);
+ }
+ else if (qualifier == EvqAttribute || qualifier == EvqVertexIn)
+ {
+ mReferencedAttributes[name] = node;
+ out << decorate(name);
+ }
+ else if (isVarying(qualifier))
+ {
+ mReferencedVaryings[name] = node;
+ out << decorate(name);
+ }
+ else if (qualifier == EvqFragmentOut)
+ {
+ mReferencedOutputVariables[name] = node;
+ out << "out_" << name;
+ }
+ else if (qualifier == EvqFragColor)
+ {
+ out << "gl_Color[0]";
+ mUsesFragColor = true;
+ }
+ else if (qualifier == EvqFragData)
+ {
+ out << "gl_Color";
+ mUsesFragData = true;
+ }
+ else if (qualifier == EvqFragCoord)
+ {
+ mUsesFragCoord = true;
+ out << name;
+ }
+ else if (qualifier == EvqPointCoord)
+ {
+ mUsesPointCoord = true;
+ out << name;
+ }
+ else if (qualifier == EvqFrontFacing)
+ {
+ mUsesFrontFacing = true;
+ out << name;
+ }
+ else if (qualifier == EvqPointSize)
+ {
+ mUsesPointSize = true;
+ out << name;
+ }
+ else if (name == "gl_FragDepthEXT")
+ {
+ mUsesFragDepth = true;
+ out << "gl_Depth";
+ }
+ else if (qualifier == EvqInternal)
+ {
+ out << name;
+ }
+ else
+ {
+ out << decorate(name);
+ }
+ }
+}
+
+void OutputHLSL::visitRaw(TIntermRaw *node)
+{
+ mBody << node->getRawText();
+}
+
+bool OutputHLSL::visitBinary(Visit visit, TIntermBinary *node)
+{
+ TInfoSinkBase &out = mBody;
+
+ // Handle accessing std140 structs by value
+ if (mFlaggedStructMappedNames.count(node) > 0)
+ {
+ out << mFlaggedStructMappedNames[node];
+ return false;
+ }
+
+ switch (node->getOp())
+ {
+ case EOpAssign: outputTriplet(visit, "(", " = ", ")"); break;
+ case EOpInitialize:
+ if (visit == PreVisit)
+ {
+ // GLSL allows to write things like "float x = x;" where a new variable x is defined
+ // and the value of an existing variable x is assigned. HLSL uses C semantics (the
+ // new variable is created before the assignment is evaluated), so we need to convert
+ // this to "float t = x, x = t;".
+
+ TIntermSymbol *symbolNode = node->getLeft()->getAsSymbolNode();
+ TIntermTyped *expression = node->getRight();
+
+ sh::SearchSymbol searchSymbol(symbolNode->getSymbol());
+ expression->traverse(&searchSymbol);
+ bool sameSymbol = searchSymbol.foundMatch();
+
+ if (sameSymbol)
+ {
+ // Type already printed
+ out << "t" + str(mUniqueIndex) + " = ";
+ expression->traverse(this);
+ out << ", ";
+ symbolNode->traverse(this);
+ out << " = t" + str(mUniqueIndex);
+
+ mUniqueIndex++;
+ return false;
+ }
+ }
+ else if (visit == InVisit)
+ {
+ out << " = ";
+ }
+ break;
+ case EOpAddAssign: outputTriplet(visit, "(", " += ", ")"); break;
+ case EOpSubAssign: outputTriplet(visit, "(", " -= ", ")"); break;
+ case EOpMulAssign: outputTriplet(visit, "(", " *= ", ")"); break;
+ case EOpVectorTimesScalarAssign: outputTriplet(visit, "(", " *= ", ")"); break;
+ case EOpMatrixTimesScalarAssign: outputTriplet(visit, "(", " *= ", ")"); break;
+ case EOpVectorTimesMatrixAssign:
+ if (visit == PreVisit)
+ {
+ out << "(";
+ }
+ else if (visit == InVisit)
+ {
+ out << " = mul(";
+ node->getLeft()->traverse(this);
+ out << ", transpose(";
+ }
+ else
+ {
+ out << ")))";
+ }
+ break;
+ case EOpMatrixTimesMatrixAssign:
+ if (visit == PreVisit)
+ {
+ out << "(";
+ }
+ else if (visit == InVisit)
+ {
+ out << " = mul(";
+ node->getLeft()->traverse(this);
+ out << ", ";
+ }
+ else
+ {
+ out << "))";
+ }
+ break;
+ case EOpDivAssign: outputTriplet(visit, "(", " /= ", ")"); break;
+ case EOpIndexDirect:
+ {
+ const TType& leftType = node->getLeft()->getType();
+ if (leftType.isInterfaceBlock())
+ {
+ if (visit == PreVisit)
+ {
+ TInterfaceBlock* interfaceBlock = leftType.getInterfaceBlock();
+ const int arrayIndex = node->getRight()->getAsConstantUnion()->getIConst(0);
+
+ mReferencedInterfaceBlocks[interfaceBlock->instanceName()] = node->getLeft()->getAsSymbolNode();
+ out << interfaceBlockInstanceString(*interfaceBlock, arrayIndex);
+
+ return false;
+ }
+ }
+ else
+ {
+ outputTriplet(visit, "", "[", "]");
+ }
+ }
+ break;
+ case EOpIndexIndirect:
+ // We do not currently support indirect references to interface blocks
+ ASSERT(node->getLeft()->getBasicType() != EbtInterfaceBlock);
+ outputTriplet(visit, "", "[", "]");
+ break;
+ case EOpIndexDirectStruct:
+ if (visit == InVisit)
+ {
+ const TStructure* structure = node->getLeft()->getType().getStruct();
+ const TIntermConstantUnion* index = node->getRight()->getAsConstantUnion();
+ const TField* field = structure->fields()[index->getIConst(0)];
+ out << "." + decorateField(field->name(), *structure);
+
+ return false;
+ }
+ break;
+ case EOpIndexDirectInterfaceBlock:
+ if (visit == InVisit)
+ {
+ const TInterfaceBlock* interfaceBlock = node->getLeft()->getType().getInterfaceBlock();
+ const TIntermConstantUnion* index = node->getRight()->getAsConstantUnion();
+ const TField* field = interfaceBlock->fields()[index->getIConst(0)];
+ out << "." + decorate(field->name());
+
+ return false;
+ }
+ break;
+ case EOpVectorSwizzle:
+ if (visit == InVisit)
+ {
+ out << ".";
+
+ TIntermAggregate *swizzle = node->getRight()->getAsAggregate();
+
+ if (swizzle)
+ {
+ TIntermSequence &sequence = swizzle->getSequence();
+
+ for (TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); sit++)
+ {
+ TIntermConstantUnion *element = (*sit)->getAsConstantUnion();
+
+ if (element)
+ {
+ int i = element->getIConst(0);
+
+ switch (i)
+ {
+ case 0: out << "x"; break;
+ case 1: out << "y"; break;
+ case 2: out << "z"; break;
+ case 3: out << "w"; break;
+ default: UNREACHABLE();
+ }
+ }
+ else UNREACHABLE();
+ }
+ }
+ else UNREACHABLE();
+
+ return false; // Fully processed
+ }
+ break;
+ case EOpAdd: outputTriplet(visit, "(", " + ", ")"); break;
+ case EOpSub: outputTriplet(visit, "(", " - ", ")"); break;
+ case EOpMul: outputTriplet(visit, "(", " * ", ")"); break;
+ case EOpDiv: outputTriplet(visit, "(", " / ", ")"); break;
+ case EOpEqual:
+ case EOpNotEqual:
+ if (node->getLeft()->isScalar())
+ {
+ if (node->getOp() == EOpEqual)
+ {
+ outputTriplet(visit, "(", " == ", ")");
+ }
+ else
+ {
+ outputTriplet(visit, "(", " != ", ")");
+ }
+ }
+ else if (node->getLeft()->getBasicType() == EbtStruct)
+ {
+ if (node->getOp() == EOpEqual)
+ {
+ out << "(";
+ }
+ else
+ {
+ out << "!(";
+ }
+
+ const TStructure &structure = *node->getLeft()->getType().getStruct();
+ const TFieldList &fields = structure.fields();
+
+ for (size_t i = 0; i < fields.size(); i++)
+ {
+ const TField *field = fields[i];
+
+ node->getLeft()->traverse(this);
+ out << "." + decorateField(field->name(), structure) + " == ";
+ node->getRight()->traverse(this);
+ out << "." + decorateField(field->name(), structure);
+
+ if (i < fields.size() - 1)
+ {
+ out << " && ";
+ }
+ }
+
+ out << ")";
+
+ return false;
+ }
+ else
+ {
+ ASSERT(node->getLeft()->isMatrix() || node->getLeft()->isVector());
+
+ if (node->getOp() == EOpEqual)
+ {
+ outputTriplet(visit, "all(", " == ", ")");
+ }
+ else
+ {
+ outputTriplet(visit, "!all(", " == ", ")");
+ }
+ }
+ break;
+ case EOpLessThan: outputTriplet(visit, "(", " < ", ")"); break;
+ case EOpGreaterThan: outputTriplet(visit, "(", " > ", ")"); break;
+ case EOpLessThanEqual: outputTriplet(visit, "(", " <= ", ")"); break;
+ case EOpGreaterThanEqual: outputTriplet(visit, "(", " >= ", ")"); break;
+ case EOpVectorTimesScalar: outputTriplet(visit, "(", " * ", ")"); break;
+ case EOpMatrixTimesScalar: outputTriplet(visit, "(", " * ", ")"); break;
+ case EOpVectorTimesMatrix: outputTriplet(visit, "mul(", ", transpose(", "))"); break;
+ case EOpMatrixTimesVector: outputTriplet(visit, "mul(transpose(", "), ", ")"); break;
+ case EOpMatrixTimesMatrix: outputTriplet(visit, "transpose(mul(transpose(", "), transpose(", ")))"); break;
+ case EOpLogicalOr:
+ if (node->getRight()->hasSideEffects())
+ {
+ out << "s" << mUnfoldShortCircuit->getNextTemporaryIndex();
+ return false;
+ }
+ else
+ {
+ outputTriplet(visit, "(", " || ", ")");
+ return true;
+ }
+ case EOpLogicalXor:
+ mUsesXor = true;
+ outputTriplet(visit, "xor(", ", ", ")");
+ break;
+ case EOpLogicalAnd:
+ if (node->getRight()->hasSideEffects())
+ {
+ out << "s" << mUnfoldShortCircuit->getNextTemporaryIndex();
+ return false;
+ }
+ else
+ {
+ outputTriplet(visit, "(", " && ", ")");
+ return true;
+ }
+ default: UNREACHABLE();
+ }
+
+ return true;
+}
+
+bool OutputHLSL::visitUnary(Visit visit, TIntermUnary *node)
+{
+ switch (node->getOp())
+ {
+ case EOpNegative: outputTriplet(visit, "(-", "", ")"); break;
+ case EOpVectorLogicalNot: outputTriplet(visit, "(!", "", ")"); break;
+ case EOpLogicalNot: outputTriplet(visit, "(!", "", ")"); break;
+ case EOpPostIncrement: outputTriplet(visit, "(", "", "++)"); break;
+ case EOpPostDecrement: outputTriplet(visit, "(", "", "--)"); break;
+ case EOpPreIncrement: outputTriplet(visit, "(++", "", ")"); break;
+ case EOpPreDecrement: outputTriplet(visit, "(--", "", ")"); break;
+ case EOpConvIntToBool:
+ case EOpConvUIntToBool:
+ case EOpConvFloatToBool:
+ switch (node->getOperand()->getType().getNominalSize())
+ {
+ case 1: outputTriplet(visit, "bool(", "", ")"); break;
+ case 2: outputTriplet(visit, "bool2(", "", ")"); break;
+ case 3: outputTriplet(visit, "bool3(", "", ")"); break;
+ case 4: outputTriplet(visit, "bool4(", "", ")"); break;
+ default: UNREACHABLE();
+ }
+ break;
+ case EOpConvBoolToFloat:
+ case EOpConvIntToFloat:
+ case EOpConvUIntToFloat:
+ switch (node->getOperand()->getType().getNominalSize())
+ {
+ case 1: outputTriplet(visit, "float(", "", ")"); break;
+ case 2: outputTriplet(visit, "float2(", "", ")"); break;
+ case 3: outputTriplet(visit, "float3(", "", ")"); break;
+ case 4: outputTriplet(visit, "float4(", "", ")"); break;
+ default: UNREACHABLE();
+ }
+ break;
+ case EOpConvFloatToInt:
+ case EOpConvBoolToInt:
+ case EOpConvUIntToInt:
+ switch (node->getOperand()->getType().getNominalSize())
+ {
+ case 1: outputTriplet(visit, "int(", "", ")"); break;
+ case 2: outputTriplet(visit, "int2(", "", ")"); break;
+ case 3: outputTriplet(visit, "int3(", "", ")"); break;
+ case 4: outputTriplet(visit, "int4(", "", ")"); break;
+ default: UNREACHABLE();
+ }
+ break;
+ case EOpConvFloatToUInt:
+ case EOpConvBoolToUInt:
+ case EOpConvIntToUInt:
+ switch (node->getOperand()->getType().getNominalSize())
+ {
+ case 1: outputTriplet(visit, "uint(", "", ")"); break;
+ case 2: outputTriplet(visit, "uint2(", "", ")"); break;
+ case 3: outputTriplet(visit, "uint3(", "", ")"); break;
+ case 4: outputTriplet(visit, "uint4(", "", ")"); break;
+ default: UNREACHABLE();
+ }
+ break;
+ case EOpRadians: outputTriplet(visit, "radians(", "", ")"); break;
+ case EOpDegrees: outputTriplet(visit, "degrees(", "", ")"); break;
+ case EOpSin: outputTriplet(visit, "sin(", "", ")"); break;
+ case EOpCos: outputTriplet(visit, "cos(", "", ")"); break;
+ case EOpTan: outputTriplet(visit, "tan(", "", ")"); break;
+ case EOpAsin: outputTriplet(visit, "asin(", "", ")"); break;
+ case EOpAcos: outputTriplet(visit, "acos(", "", ")"); break;
+ case EOpAtan: outputTriplet(visit, "atan(", "", ")"); break;
+ case EOpExp: outputTriplet(visit, "exp(", "", ")"); break;
+ case EOpLog: outputTriplet(visit, "log(", "", ")"); break;
+ case EOpExp2: outputTriplet(visit, "exp2(", "", ")"); break;
+ case EOpLog2: outputTriplet(visit, "log2(", "", ")"); break;
+ case EOpSqrt: outputTriplet(visit, "sqrt(", "", ")"); break;
+ case EOpInverseSqrt: outputTriplet(visit, "rsqrt(", "", ")"); break;
+ case EOpAbs: outputTriplet(visit, "abs(", "", ")"); break;
+ case EOpSign: outputTriplet(visit, "sign(", "", ")"); break;
+ case EOpFloor: outputTriplet(visit, "floor(", "", ")"); break;
+ case EOpCeil: outputTriplet(visit, "ceil(", "", ")"); break;
+ case EOpFract: outputTriplet(visit, "frac(", "", ")"); break;
+ case EOpLength: outputTriplet(visit, "length(", "", ")"); break;
+ case EOpNormalize: outputTriplet(visit, "normalize(", "", ")"); break;
+ case EOpDFdx:
+ if(mInsideDiscontinuousLoop || mOutputLod0Function)
+ {
+ outputTriplet(visit, "(", "", ", 0.0)");
+ }
+ else
+ {
+ outputTriplet(visit, "ddx(", "", ")");
+ }
+ break;
+ case EOpDFdy:
+ if(mInsideDiscontinuousLoop || mOutputLod0Function)
+ {
+ outputTriplet(visit, "(", "", ", 0.0)");
+ }
+ else
+ {
+ outputTriplet(visit, "ddy(", "", ")");
+ }
+ break;
+ case EOpFwidth:
+ if(mInsideDiscontinuousLoop || mOutputLod0Function)
+ {
+ outputTriplet(visit, "(", "", ", 0.0)");
+ }
+ else
+ {
+ outputTriplet(visit, "fwidth(", "", ")");
+ }
+ break;
+ case EOpAny: outputTriplet(visit, "any(", "", ")"); break;
+ case EOpAll: outputTriplet(visit, "all(", "", ")"); break;
+ default: UNREACHABLE();
+ }
+
+ return true;
+}
+
+bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
+{
+ TInfoSinkBase &out = mBody;
+
+ switch (node->getOp())
+ {
+ case EOpSequence:
+ {
+ if (mInsideFunction)
+ {
+ outputLineDirective(node->getLine().first_line);
+ out << "{\n";
+ }
+
+ for (TIntermSequence::iterator sit = node->getSequence().begin(); sit != node->getSequence().end(); sit++)
+ {
+ outputLineDirective((*sit)->getLine().first_line);
+
+ traverseStatements(*sit);
+
+ out << ";\n";
+ }
+
+ if (mInsideFunction)
+ {
+ outputLineDirective(node->getLine().last_line);
+ out << "}\n";
+ }
+
+ return false;
+ }
+ case EOpDeclaration:
+ if (visit == PreVisit)
+ {
+ TIntermSequence &sequence = node->getSequence();
+ TIntermTyped *variable = sequence[0]->getAsTyped();
+
+ if (variable && (variable->getQualifier() == EvqTemporary || variable->getQualifier() == EvqGlobal))
+ {
+ if (variable->getType().getStruct())
+ {
+ addConstructor(variable->getType(), structNameString(*variable->getType().getStruct()), NULL);
+ }
+
+ if (!variable->getAsSymbolNode() || variable->getAsSymbolNode()->getSymbol() != "") // Variable declaration
+ {
+ if (!mInsideFunction)
+ {
+ out << "static ";
+ }
+
+ out << typeString(variable->getType()) + " ";
+
+ for (TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); sit++)
+ {
+ TIntermSymbol *symbol = (*sit)->getAsSymbolNode();
+
+ if (symbol)
+ {
+ symbol->traverse(this);
+ out << arrayString(symbol->getType());
+ out << " = " + initializer(symbol->getType());
+ }
+ else
+ {
+ (*sit)->traverse(this);
+ }
+
+ if (*sit != sequence.back())
+ {
+ out << ", ";
+ }
+ }
+ }
+ else if (variable->getAsSymbolNode() && variable->getAsSymbolNode()->getSymbol() == "") // Type (struct) declaration
+ {
+ // Already added to constructor map
+ }
+ else UNREACHABLE();
+ }
+ else if (variable && isVaryingOut(variable->getQualifier()))
+ {
+ for (TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); sit++)
+ {
+ TIntermSymbol *symbol = (*sit)->getAsSymbolNode();
+
+ if (symbol)
+ {
+ // Vertex (output) varyings which are declared but not written to should still be declared to allow successful linking
+ mReferencedVaryings[symbol->getSymbol()] = symbol;
+ }
+ else
+ {
+ (*sit)->traverse(this);
+ }
+ }
+ }
+
+ return false;
+ }
+ else if (visit == InVisit)
+ {
+ out << ", ";
+ }
+ break;
+ case EOpPrototype:
+ if (visit == PreVisit)
+ {
+ out << typeString(node->getType()) << " " << decorate(node->getName()) << (mOutputLod0Function ? "Lod0(" : "(");
+
+ TIntermSequence &arguments = node->getSequence();
+
+ for (unsigned int i = 0; i < arguments.size(); i++)
+ {
+ TIntermSymbol *symbol = arguments[i]->getAsSymbolNode();
+
+ if (symbol)
+ {
+ out << argumentString(symbol);
+
+ if (i < arguments.size() - 1)
+ {
+ out << ", ";
+ }
+ }
+ else UNREACHABLE();
+ }
+
+ out << ");\n";
+
+ // Also prototype the Lod0 variant if needed
+ if (mContainsLoopDiscontinuity && !mOutputLod0Function)
+ {
+ mOutputLod0Function = true;
+ node->traverse(this);
+ mOutputLod0Function = false;
+ }
+
+ return false;
+ }
+ break;
+ case EOpComma: outputTriplet(visit, "(", ", ", ")"); break;
+ case EOpFunction:
+ {
+ TString name = TFunction::unmangleName(node->getName());
+
+ out << typeString(node->getType()) << " ";
+
+ if (name == "main")
+ {
+ out << "gl_main(";
+ }
+ else
+ {
+ out << decorate(name) << (mOutputLod0Function ? "Lod0(" : "(");
+ }
+
+ TIntermSequence &sequence = node->getSequence();
+ TIntermSequence &arguments = sequence[0]->getAsAggregate()->getSequence();
+
+ for (unsigned int i = 0; i < arguments.size(); i++)
+ {
+ TIntermSymbol *symbol = arguments[i]->getAsSymbolNode();
+
+ if (symbol)
+ {
+ if (symbol->getType().getStruct())
+ {
+ addConstructor(symbol->getType(), structNameString(*symbol->getType().getStruct()), NULL);
+ }
+
+ out << argumentString(symbol);
+
+ if (i < arguments.size() - 1)
+ {
+ out << ", ";
+ }
+ }
+ else UNREACHABLE();
+ }
+
+ out << ")\n"
+ "{\n";
+
+ if (sequence.size() > 1)
+ {
+ mInsideFunction = true;
+ sequence[1]->traverse(this);
+ mInsideFunction = false;
+ }
+
+ out << "}\n";
+
+ if (mContainsLoopDiscontinuity && !mOutputLod0Function)
+ {
+ if (name != "main")
+ {
+ mOutputLod0Function = true;
+ node->traverse(this);
+ mOutputLod0Function = false;
+ }
+ }
+
+ return false;
+ }
+ break;
+ case EOpFunctionCall:
+ {
+ TString name = TFunction::unmangleName(node->getName());
+ bool lod0 = mInsideDiscontinuousLoop || mOutputLod0Function;
+ TIntermSequence &arguments = node->getSequence();
+
+ if (node->isUserDefined())
+ {
+ out << decorate(name) << (lod0 ? "Lod0(" : "(");
+ }
+ else
+ {
+ TBasicType samplerType = arguments[0]->getAsTyped()->getType().getBasicType();
+
+ TextureFunction textureFunction;
+ textureFunction.sampler = samplerType;
+ textureFunction.coords = arguments[1]->getAsTyped()->getNominalSize();
+ textureFunction.method = TextureFunction::IMPLICIT;
+ textureFunction.proj = false;
+ textureFunction.offset = false;
+
+ if (name == "texture2D" || name == "textureCube" || name == "texture")
+ {
+ textureFunction.method = TextureFunction::IMPLICIT;
+ }
+ else if (name == "texture2DProj" || name == "textureProj")
+ {
+ textureFunction.method = TextureFunction::IMPLICIT;
+ textureFunction.proj = true;
+ }
+ else if (name == "texture2DLod" || name == "textureCubeLod" || name == "textureLod" ||
+ name == "texture2DLodEXT" || name == "textureCubeLodEXT")
+ {
+ textureFunction.method = TextureFunction::LOD;
+ }
+ else if (name == "texture2DProjLod" || name == "textureProjLod" || name == "texture2DProjLodEXT")
+ {
+ textureFunction.method = TextureFunction::LOD;
+ textureFunction.proj = true;
+ }
+ else if (name == "textureSize")
+ {
+ textureFunction.method = TextureFunction::SIZE;
+ }
+ else if (name == "textureOffset")
+ {
+ textureFunction.method = TextureFunction::IMPLICIT;
+ textureFunction.offset = true;
+ }
+ else if (name == "textureProjOffset")
+ {
+ textureFunction.method = TextureFunction::IMPLICIT;
+ textureFunction.offset = true;
+ textureFunction.proj = true;
+ }
+ else if (name == "textureLodOffset")
+ {
+ textureFunction.method = TextureFunction::LOD;
+ textureFunction.offset = true;
+ }
+ else if (name == "textureProjLodOffset")
+ {
+ textureFunction.method = TextureFunction::LOD;
+ textureFunction.proj = true;
+ textureFunction.offset = true;
+ }
+ else if (name == "texelFetch")
+ {
+ textureFunction.method = TextureFunction::FETCH;
+ }
+ else if (name == "texelFetchOffset")
+ {
+ textureFunction.method = TextureFunction::FETCH;
+ textureFunction.offset = true;
+ }
+ else if (name == "textureGrad" || name == "texture2DGradEXT")
+ {
+ textureFunction.method = TextureFunction::GRAD;
+ }
+ else if (name == "textureGradOffset")
+ {
+ textureFunction.method = TextureFunction::GRAD;
+ textureFunction.offset = true;
+ }
+ else if (name == "textureProjGrad" || name == "texture2DProjGradEXT" || name == "textureCubeGradEXT")
+ {
+ textureFunction.method = TextureFunction::GRAD;
+ textureFunction.proj = true;
+ }
+ else if (name == "textureProjGradOffset")
+ {
+ textureFunction.method = TextureFunction::GRAD;
+ textureFunction.proj = true;
+ textureFunction.offset = true;
+ }
+ else UNREACHABLE();
+
+ if (textureFunction.method == TextureFunction::IMPLICIT) // Could require lod 0 or have a bias argument
+ {
+ unsigned int mandatoryArgumentCount = 2; // All functions have sampler and coordinate arguments
+
+ if (textureFunction.offset)
+ {
+ mandatoryArgumentCount++;
+ }
+
+ bool bias = (arguments.size() > mandatoryArgumentCount); // Bias argument is optional
+
+ if (lod0 || mContext.shaderType == SH_VERTEX_SHADER)
+ {
+ if (bias)
+ {
+ textureFunction.method = TextureFunction::LOD0BIAS;
+ }
+ else
+ {
+ textureFunction.method = TextureFunction::LOD0;
+ }
+ }
+ else if (bias)
+ {
+ textureFunction.method = TextureFunction::BIAS;
+ }
+ }
+
+ mUsesTexture.insert(textureFunction);
+
+ out << textureFunction.name();
+ }
+
+ for (TIntermSequence::iterator arg = arguments.begin(); arg != arguments.end(); arg++)
+ {
+ if (mOutputType == SH_HLSL11_OUTPUT && IsSampler((*arg)->getAsTyped()->getBasicType()))
+ {
+ out << "texture_";
+ (*arg)->traverse(this);
+ out << ", sampler_";
+ }
+
+ (*arg)->traverse(this);
+
+ if (arg < arguments.end() - 1)
+ {
+ out << ", ";
+ }
+ }
+
+ out << ")";
+
+ return false;
+ }
+ break;
+ case EOpParameters: outputTriplet(visit, "(", ", ", ")\n{\n"); break;
+ case EOpConstructFloat:
+ addConstructor(node->getType(), "vec1", &node->getSequence());
+ outputTriplet(visit, "vec1(", "", ")");
+ break;
+ case EOpConstructVec2:
+ addConstructor(node->getType(), "vec2", &node->getSequence());
+ outputTriplet(visit, "vec2(", ", ", ")");
+ break;
+ case EOpConstructVec3:
+ addConstructor(node->getType(), "vec3", &node->getSequence());
+ outputTriplet(visit, "vec3(", ", ", ")");
+ break;
+ case EOpConstructVec4:
+ addConstructor(node->getType(), "vec4", &node->getSequence());
+ outputTriplet(visit, "vec4(", ", ", ")");
+ break;
+ case EOpConstructBool:
+ addConstructor(node->getType(), "bvec1", &node->getSequence());
+ outputTriplet(visit, "bvec1(", "", ")");
+ break;
+ case EOpConstructBVec2:
+ addConstructor(node->getType(), "bvec2", &node->getSequence());
+ outputTriplet(visit, "bvec2(", ", ", ")");
+ break;
+ case EOpConstructBVec3:
+ addConstructor(node->getType(), "bvec3", &node->getSequence());
+ outputTriplet(visit, "bvec3(", ", ", ")");
+ break;
+ case EOpConstructBVec4:
+ addConstructor(node->getType(), "bvec4", &node->getSequence());
+ outputTriplet(visit, "bvec4(", ", ", ")");
+ break;
+ case EOpConstructInt:
+ addConstructor(node->getType(), "ivec1", &node->getSequence());
+ outputTriplet(visit, "ivec1(", "", ")");
+ break;
+ case EOpConstructIVec2:
+ addConstructor(node->getType(), "ivec2", &node->getSequence());
+ outputTriplet(visit, "ivec2(", ", ", ")");
+ break;
+ case EOpConstructIVec3:
+ addConstructor(node->getType(), "ivec3", &node->getSequence());
+ outputTriplet(visit, "ivec3(", ", ", ")");
+ break;
+ case EOpConstructIVec4:
+ addConstructor(node->getType(), "ivec4", &node->getSequence());
+ outputTriplet(visit, "ivec4(", ", ", ")");
+ break;
+ case EOpConstructUInt:
+ addConstructor(node->getType(), "uvec1", &node->getSequence());
+ outputTriplet(visit, "uvec1(", "", ")");
+ break;
+ case EOpConstructUVec2:
+ addConstructor(node->getType(), "uvec2", &node->getSequence());
+ outputTriplet(visit, "uvec2(", ", ", ")");
+ break;
+ case EOpConstructUVec3:
+ addConstructor(node->getType(), "uvec3", &node->getSequence());
+ outputTriplet(visit, "uvec3(", ", ", ")");
+ break;
+ case EOpConstructUVec4:
+ addConstructor(node->getType(), "uvec4", &node->getSequence());
+ outputTriplet(visit, "uvec4(", ", ", ")");
+ break;
+ case EOpConstructMat2:
+ addConstructor(node->getType(), "mat2", &node->getSequence());
+ outputTriplet(visit, "mat2(", ", ", ")");
+ break;
+ case EOpConstructMat3:
+ addConstructor(node->getType(), "mat3", &node->getSequence());
+ outputTriplet(visit, "mat3(", ", ", ")");
+ break;
+ case EOpConstructMat4:
+ addConstructor(node->getType(), "mat4", &node->getSequence());
+ outputTriplet(visit, "mat4(", ", ", ")");
+ break;
+ case EOpConstructStruct:
+ {
+ const TString &structName = structNameString(*node->getType().getStruct());
+ addConstructor(node->getType(), structName, &node->getSequence());
+ outputTriplet(visit, structName + "_ctor(", ", ", ")");
+ }
+ break;
+ case EOpLessThan: outputTriplet(visit, "(", " < ", ")"); break;
+ case EOpGreaterThan: outputTriplet(visit, "(", " > ", ")"); break;
+ case EOpLessThanEqual: outputTriplet(visit, "(", " <= ", ")"); break;
+ case EOpGreaterThanEqual: outputTriplet(visit, "(", " >= ", ")"); break;
+ case EOpVectorEqual: outputTriplet(visit, "(", " == ", ")"); break;
+ case EOpVectorNotEqual: outputTriplet(visit, "(", " != ", ")"); break;
+ case EOpMod:
+ {
+ // We need to look at the number of components in both arguments
+ const int modValue = node->getSequence()[0]->getAsTyped()->getNominalSize() * 10
+ + node->getSequence()[1]->getAsTyped()->getNominalSize();
+ switch (modValue)
+ {
+ case 11: mUsesMod1 = true; break;
+ case 22: mUsesMod2v = true; break;
+ case 21: mUsesMod2f = true; break;
+ case 33: mUsesMod3v = true; break;
+ case 31: mUsesMod3f = true; break;
+ case 44: mUsesMod4v = true; break;
+ case 41: mUsesMod4f = true; break;
+ default: UNREACHABLE();
+ }
+
+ outputTriplet(visit, "mod(", ", ", ")");
+ }
+ break;
+ case EOpPow: outputTriplet(visit, "pow(", ", ", ")"); break;
+ case EOpAtan:
+ ASSERT(node->getSequence().size() == 2); // atan(x) is a unary operator
+ switch (node->getSequence()[0]->getAsTyped()->getNominalSize())
+ {
+ case 1: mUsesAtan2_1 = true; break;
+ case 2: mUsesAtan2_2 = true; break;
+ case 3: mUsesAtan2_3 = true; break;
+ case 4: mUsesAtan2_4 = true; break;
+ default: UNREACHABLE();
+ }
+ outputTriplet(visit, "atanyx(", ", ", ")");
+ break;
+ case EOpMin: outputTriplet(visit, "min(", ", ", ")"); break;
+ case EOpMax: outputTriplet(visit, "max(", ", ", ")"); break;
+ case EOpClamp: outputTriplet(visit, "clamp(", ", ", ")"); break;
+ case EOpMix: outputTriplet(visit, "lerp(", ", ", ")"); break;
+ case EOpStep: outputTriplet(visit, "step(", ", ", ")"); break;
+ case EOpSmoothStep: outputTriplet(visit, "smoothstep(", ", ", ")"); break;
+ case EOpDistance: outputTriplet(visit, "distance(", ", ", ")"); break;
+ case EOpDot: outputTriplet(visit, "dot(", ", ", ")"); break;
+ case EOpCross: outputTriplet(visit, "cross(", ", ", ")"); break;
+ case EOpFaceForward:
+ {
+ switch (node->getSequence()[0]->getAsTyped()->getNominalSize()) // Number of components in the first argument
+ {
+ case 1: mUsesFaceforward1 = true; break;
+ case 2: mUsesFaceforward2 = true; break;
+ case 3: mUsesFaceforward3 = true; break;
+ case 4: mUsesFaceforward4 = true; break;
+ default: UNREACHABLE();
+ }
+
+ outputTriplet(visit, "faceforward(", ", ", ")");
+ }
+ break;
+ case EOpReflect: outputTriplet(visit, "reflect(", ", ", ")"); break;
+ case EOpRefract: outputTriplet(visit, "refract(", ", ", ")"); break;
+ case EOpMul: outputTriplet(visit, "(", " * ", ")"); break;
+ default: UNREACHABLE();
+ }
+
+ return true;
+}
+
+bool OutputHLSL::visitSelection(Visit visit, TIntermSelection *node)
+{
+ TInfoSinkBase &out = mBody;
+
+ if (node->usesTernaryOperator())
+ {
+ out << "s" << mUnfoldShortCircuit->getNextTemporaryIndex();
+ }
+ else // if/else statement
+ {
+ mUnfoldShortCircuit->traverse(node->getCondition());
+
+ out << "if (";
+
+ node->getCondition()->traverse(this);
+
+ out << ")\n";
+
+ outputLineDirective(node->getLine().first_line);
+ out << "{\n";
+
+ bool discard = false;
+
+ if (node->getTrueBlock())
+ {
+ traverseStatements(node->getTrueBlock());
+
+ // Detect true discard
+ discard = (discard || FindDiscard::search(node->getTrueBlock()));
+ }
+
+ outputLineDirective(node->getLine().first_line);
+ out << ";\n}\n";
+
+ if (node->getFalseBlock())
+ {
+ out << "else\n";
+
+ outputLineDirective(node->getFalseBlock()->getLine().first_line);
+ out << "{\n";
+
+ outputLineDirective(node->getFalseBlock()->getLine().first_line);
+ traverseStatements(node->getFalseBlock());
+
+ outputLineDirective(node->getFalseBlock()->getLine().first_line);
+ out << ";\n}\n";
+
+ // Detect false discard
+ discard = (discard || FindDiscard::search(node->getFalseBlock()));
+ }
+
+ // ANGLE issue 486: Detect problematic conditional discard
+ if (discard && FindSideEffectRewriting::search(node))
+ {
+ mUsesDiscardRewriting = true;
+ }
+ }
+
+ return false;
+}
+
+void OutputHLSL::visitConstantUnion(TIntermConstantUnion *node)
+{
+ writeConstantUnion(node->getType(), node->getUnionArrayPointer());
+}
+
+bool OutputHLSL::visitLoop(Visit visit, TIntermLoop *node)
+{
+ mNestedLoopDepth++;
+
+ bool wasDiscontinuous = mInsideDiscontinuousLoop;
+
+ if (mContainsLoopDiscontinuity && !mInsideDiscontinuousLoop)
+ {
+ mInsideDiscontinuousLoop = containsLoopDiscontinuity(node);
+ }
+
+ if (mOutputType == SH_HLSL9_OUTPUT)
+ {
+ if (handleExcessiveLoop(node))
+ {
+ mInsideDiscontinuousLoop = wasDiscontinuous;
+ mNestedLoopDepth--;
+
+ return false;
+ }
+ }
+
+ TInfoSinkBase &out = mBody;
+
+ if (node->getType() == ELoopDoWhile)
+ {
+ out << "{do\n";
+
+ outputLineDirective(node->getLine().first_line);
+ out << "{\n";
+ }
+ else
+ {
+ out << "{for(";
+
+ if (node->getInit())
+ {
+ node->getInit()->traverse(this);
+ }
+
+ out << "; ";
+
+ if (node->getCondition())
+ {
+ node->getCondition()->traverse(this);
+ }
+
+ out << "; ";
+
+ if (node->getExpression())
+ {
+ node->getExpression()->traverse(this);
+ }
+
+ out << ")\n";
+
+ outputLineDirective(node->getLine().first_line);
+ out << "{\n";
+ }
+
+ if (node->getBody())
+ {
+ traverseStatements(node->getBody());
+ }
+
+ outputLineDirective(node->getLine().first_line);
+ out << ";}\n";
+
+ if (node->getType() == ELoopDoWhile)
+ {
+ outputLineDirective(node->getCondition()->getLine().first_line);
+ out << "while(\n";
+
+ node->getCondition()->traverse(this);
+
+ out << ");";
+ }
+
+ out << "}\n";
+
+ mInsideDiscontinuousLoop = wasDiscontinuous;
+ mNestedLoopDepth--;
+
+ return false;
+}
+
+bool OutputHLSL::visitBranch(Visit visit, TIntermBranch *node)
+{
+ TInfoSinkBase &out = mBody;
+
+ switch (node->getFlowOp())
+ {
+ case EOpKill:
+ outputTriplet(visit, "discard;\n", "", "");
+ break;
+ case EOpBreak:
+ if (visit == PreVisit)
+ {
+ if (mNestedLoopDepth > 1)
+ {
+ mUsesNestedBreak = true;
+ }
+
+ if (mExcessiveLoopIndex)
+ {
+ out << "{Break";
+ mExcessiveLoopIndex->traverse(this);
+ out << " = true; break;}\n";
+ }
+ else
+ {
+ out << "break;\n";
+ }
+ }
+ break;
+ case EOpContinue: outputTriplet(visit, "continue;\n", "", ""); break;
+ case EOpReturn:
+ if (visit == PreVisit)
+ {
+ if (node->getExpression())
+ {
+ out << "return ";
+ }
+ else
+ {
+ out << "return;\n";
+ }
+ }
+ else if (visit == PostVisit)
+ {
+ if (node->getExpression())
+ {
+ out << ";\n";
+ }
+ }
+ break;
+ default: UNREACHABLE();
+ }
+
+ return true;
+}
+
+void OutputHLSL::traverseStatements(TIntermNode *node)
+{
+ if (isSingleStatement(node))
+ {
+ mUnfoldShortCircuit->traverse(node);
+ }
+
+ node->traverse(this);
+}
+
+bool OutputHLSL::isSingleStatement(TIntermNode *node)
+{
+ TIntermAggregate *aggregate = node->getAsAggregate();
+
+ if (aggregate)
+ {
+ if (aggregate->getOp() == EOpSequence)
+ {
+ return false;
+ }
+ else
+ {
+ for (TIntermSequence::iterator sit = aggregate->getSequence().begin(); sit != aggregate->getSequence().end(); sit++)
+ {
+ if (!isSingleStatement(*sit))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+ }
+
+ return true;
+}
+
+// Handle loops with more than 254 iterations (unsupported by D3D9) by splitting them
+// (The D3D documentation says 255 iterations, but the compiler complains at anything more than 254).
+bool OutputHLSL::handleExcessiveLoop(TIntermLoop *node)
+{
+ const int MAX_LOOP_ITERATIONS = 254;
+ TInfoSinkBase &out = mBody;
+
+ // Parse loops of the form:
+ // for(int index = initial; index [comparator] limit; index += increment)
+ TIntermSymbol *index = NULL;
+ TOperator comparator = EOpNull;
+ int initial = 0;
+ int limit = 0;
+ int increment = 0;
+
+ // Parse index name and intial value
+ if (node->getInit())
+ {
+ TIntermAggregate *init = node->getInit()->getAsAggregate();
+
+ if (init)
+ {
+ TIntermSequence &sequence = init->getSequence();
+ TIntermTyped *variable = sequence[0]->getAsTyped();
+
+ if (variable && variable->getQualifier() == EvqTemporary)
+ {
+ TIntermBinary *assign = variable->getAsBinaryNode();
+
+ if (assign->getOp() == EOpInitialize)
+ {
+ TIntermSymbol *symbol = assign->getLeft()->getAsSymbolNode();
+ TIntermConstantUnion *constant = assign->getRight()->getAsConstantUnion();
+
+ if (symbol && constant)
+ {
+ if (constant->getBasicType() == EbtInt && constant->isScalar())
+ {
+ index = symbol;
+ initial = constant->getIConst(0);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // Parse comparator and limit value
+ if (index != NULL && node->getCondition())
+ {
+ TIntermBinary *test = node->getCondition()->getAsBinaryNode();
+
+ if (test && test->getLeft()->getAsSymbolNode()->getId() == index->getId())
+ {
+ TIntermConstantUnion *constant = test->getRight()->getAsConstantUnion();
+
+ if (constant)
+ {
+ if (constant->getBasicType() == EbtInt && constant->isScalar())
+ {
+ comparator = test->getOp();
+ limit = constant->getIConst(0);
+ }
+ }
+ }
+ }
+
+ // Parse increment
+ if (index != NULL && comparator != EOpNull && node->getExpression())
+ {
+ TIntermBinary *binaryTerminal = node->getExpression()->getAsBinaryNode();
+ TIntermUnary *unaryTerminal = node->getExpression()->getAsUnaryNode();
+
+ if (binaryTerminal)
+ {
+ TOperator op = binaryTerminal->getOp();
+ TIntermConstantUnion *constant = binaryTerminal->getRight()->getAsConstantUnion();
+
+ if (constant)
+ {
+ if (constant->getBasicType() == EbtInt && constant->isScalar())
+ {
+ int value = constant->getIConst(0);
+
+ switch (op)
+ {
+ case EOpAddAssign: increment = value; break;
+ case EOpSubAssign: increment = -value; break;
+ default: UNIMPLEMENTED();
+ }
+ }
+ }
+ }
+ else if (unaryTerminal)
+ {
+ TOperator op = unaryTerminal->getOp();
+
+ switch (op)
+ {
+ case EOpPostIncrement: increment = 1; break;
+ case EOpPostDecrement: increment = -1; break;
+ case EOpPreIncrement: increment = 1; break;
+ case EOpPreDecrement: increment = -1; break;
+ default: UNIMPLEMENTED();
+ }
+ }
+ }
+
+ if (index != NULL && comparator != EOpNull && increment != 0)
+ {
+ if (comparator == EOpLessThanEqual)
+ {
+ comparator = EOpLessThan;
+ limit += 1;
+ }
+
+ if (comparator == EOpLessThan)
+ {
+ int iterations = (limit - initial) / increment;
+
+ if (iterations <= MAX_LOOP_ITERATIONS)
+ {
+ return false; // Not an excessive loop
+ }
+
+ TIntermSymbol *restoreIndex = mExcessiveLoopIndex;
+ mExcessiveLoopIndex = index;
+
+ out << "{int ";
+ index->traverse(this);
+ out << ";\n"
+ "bool Break";
+ index->traverse(this);
+ out << " = false;\n";
+
+ bool firstLoopFragment = true;
+
+ while (iterations > 0)
+ {
+ int clampedLimit = initial + increment * std::min(MAX_LOOP_ITERATIONS, iterations);
+
+ if (!firstLoopFragment)
+ {
+ out << "if (!Break";
+ index->traverse(this);
+ out << ") {\n";
+ }
+
+ if (iterations <= MAX_LOOP_ITERATIONS) // Last loop fragment
+ {
+ mExcessiveLoopIndex = NULL; // Stops setting the Break flag
+ }
+
+ // for(int index = initial; index < clampedLimit; index += increment)
+
+ out << "for(";
+ index->traverse(this);
+ out << " = ";
+ out << initial;
+
+ out << "; ";
+ index->traverse(this);
+ out << " < ";
+ out << clampedLimit;
+
+ out << "; ";
+ index->traverse(this);
+ out << " += ";
+ out << increment;
+ out << ")\n";
+
+ outputLineDirective(node->getLine().first_line);
+ out << "{\n";
+
+ if (node->getBody())
+ {
+ node->getBody()->traverse(this);
+ }
+
+ outputLineDirective(node->getLine().first_line);
+ out << ";}\n";
+
+ if (!firstLoopFragment)
+ {
+ out << "}\n";
+ }
+
+ firstLoopFragment = false;
+
+ initial += MAX_LOOP_ITERATIONS * increment;
+ iterations -= MAX_LOOP_ITERATIONS;
+ }
+
+ out << "}";
+
+ mExcessiveLoopIndex = restoreIndex;
+
+ return true;
+ }
+ else UNIMPLEMENTED();
+ }
+
+ return false; // Not handled as an excessive loop
+}
+
+void OutputHLSL::outputTriplet(Visit visit, const TString &preString, const TString &inString, const TString &postString)
+{
+ TInfoSinkBase &out = mBody;
+
+ if (visit == PreVisit)
+ {
+ out << preString;
+ }
+ else if (visit == InVisit)
+ {
+ out << inString;
+ }
+ else if (visit == PostVisit)
+ {
+ out << postString;
+ }
+}
+
+void OutputHLSL::outputLineDirective(int line)
+{
+ if ((mContext.compileOptions & SH_LINE_DIRECTIVES) && (line > 0))
+ {
+ mBody << "\n";
+ mBody << "#line " << line;
+
+ if (mContext.sourcePath)
+ {
+ mBody << " \"" << mContext.sourcePath << "\"";
+ }
+
+ mBody << "\n";
+ }
+}
+
+TString OutputHLSL::argumentString(const TIntermSymbol *symbol)
+{
+ TQualifier qualifier = symbol->getQualifier();
+ const TType &type = symbol->getType();
+ TString name = symbol->getSymbol();
+
+ if (name.empty()) // HLSL demands named arguments, also for prototypes
+ {
+ name = "x" + str(mUniqueIndex++);
+ }
+ else
+ {
+ name = decorate(name);
+ }
+
+ if (mOutputType == SH_HLSL11_OUTPUT && IsSampler(type.getBasicType()))
+ {
+ return qualifierString(qualifier) + " " + textureString(type) + " texture_" + name + arrayString(type) + ", " +
+ qualifierString(qualifier) + " " + samplerString(type) + " sampler_" + name + arrayString(type);
+ }
+
+ return qualifierString(qualifier) + " " + typeString(type) + " " + name + arrayString(type);
+}
+
+TString OutputHLSL::interpolationString(TQualifier qualifier)
+{
+ switch(qualifier)
+ {
+ case EvqVaryingIn: return "";
+ case EvqFragmentIn: return "";
+ case EvqInvariantVaryingIn: return "";
+ case EvqSmoothIn: return "linear";
+ case EvqFlatIn: return "nointerpolation";
+ case EvqCentroidIn: return "centroid";
+ case EvqVaryingOut: return "";
+ case EvqVertexOut: return "";
+ case EvqInvariantVaryingOut: return "";
+ case EvqSmoothOut: return "linear";
+ case EvqFlatOut: return "nointerpolation";
+ case EvqCentroidOut: return "centroid";
+ default: UNREACHABLE();
+ }
+
+ return "";
+}
+
+TString OutputHLSL::qualifierString(TQualifier qualifier)
+{
+ switch(qualifier)
+ {
+ case EvqIn: return "in";
+ case EvqOut: return "inout"; // 'out' results in an HLSL error if not all fields are written, for GLSL it's undefined
+ case EvqInOut: return "inout";
+ case EvqConstReadOnly: return "const";
+ default: UNREACHABLE();
+ }
+
+ return "";
+}
+
+TString OutputHLSL::typeString(const TType &type)
+{
+ const TStructure* structure = type.getStruct();
+ if (structure)
+ {
+ const TString& typeName = structure->name();
+ if (typeName != "")
+ {
+ return structNameString(*type.getStruct());
+ }
+ else // Nameless structure, define in place
+ {
+ return structureString(*structure, false, false);
+ }
+ }
+ else if (type.isMatrix())
+ {
+ int cols = type.getCols();
+ int rows = type.getRows();
+ return "float" + str(cols) + "x" + str(rows);
+ }
+ else
+ {
+ switch (type.getBasicType())
+ {
+ case EbtFloat:
+ switch (type.getNominalSize())
+ {
+ case 1: return "float";
+ case 2: return "float2";
+ case 3: return "float3";
+ case 4: return "float4";
+ }
+ case EbtInt:
+ switch (type.getNominalSize())
+ {
+ case 1: return "int";
+ case 2: return "int2";
+ case 3: return "int3";
+ case 4: return "int4";
+ }
+ case EbtUInt:
+ switch (type.getNominalSize())
+ {
+ case 1: return "uint";
+ case 2: return "uint2";
+ case 3: return "uint3";
+ case 4: return "uint4";
+ }
+ case EbtBool:
+ switch (type.getNominalSize())
+ {
+ case 1: return "bool";
+ case 2: return "bool2";
+ case 3: return "bool3";
+ case 4: return "bool4";
+ }
+ case EbtVoid:
+ return "void";
+ case EbtSampler2D:
+ case EbtISampler2D:
+ case EbtUSampler2D:
+ case EbtSampler2DArray:
+ case EbtISampler2DArray:
+ case EbtUSampler2DArray:
+ return "sampler2D";
+ case EbtSamplerCube:
+ case EbtISamplerCube:
+ case EbtUSamplerCube:
+ return "samplerCUBE";
+ case EbtSamplerExternalOES:
+ return "sampler2D";
+ default:
+ break;
+ }
+ }
+
+ UNREACHABLE();
+ return "<unknown type>";
+}
+
+TString OutputHLSL::textureString(const TType &type)
+{
+ switch (type.getBasicType())
+ {
+ case EbtSampler2D: return "Texture2D";
+ case EbtSamplerCube: return "TextureCube";
+ case EbtSamplerExternalOES: return "Texture2D";
+ case EbtSampler2DArray: return "Texture2DArray";
+ case EbtSampler3D: return "Texture3D";
+ case EbtISampler2D: return "Texture2D<int4>";
+ case EbtISampler3D: return "Texture3D<int4>";
+ case EbtISamplerCube: return "Texture2DArray<int4>";
+ case EbtISampler2DArray: return "Texture2DArray<int4>";
+ case EbtUSampler2D: return "Texture2D<uint4>";
+ case EbtUSampler3D: return "Texture3D<uint4>";
+ case EbtUSamplerCube: return "Texture2DArray<uint4>";
+ case EbtUSampler2DArray: return "Texture2DArray<uint4>";
+ case EbtSampler2DShadow: return "Texture2D";
+ case EbtSamplerCubeShadow: return "TextureCube";
+ case EbtSampler2DArrayShadow: return "Texture2DArray";
+ default: UNREACHABLE();
+ }
+
+ return "<unknown texture type>";
+}
+
+TString OutputHLSL::samplerString(const TType &type)
+{
+ if (IsShadowSampler(type.getBasicType()))
+ {
+ return "SamplerComparisonState";
+ }
+ else
+ {
+ return "SamplerState";
+ }
+}
+
+TString OutputHLSL::arrayString(const TType &type)
+{
+ if (!type.isArray())
+ {
+ return "";
+ }
+
+ return "[" + str(type.getArraySize()) + "]";
+}
+
+TString OutputHLSL::initializer(const TType &type)
+{
+ TString string;
+
+ size_t size = type.getObjectSize();
+ for (size_t component = 0; component < size; component++)
+ {
+ string += "0";
+
+ if (component + 1 < size)
+ {
+ string += ", ";
+ }
+ }
+
+ return "{" + string + "}";
+}
+
+TString OutputHLSL::structureString(const TStructure &structure, bool useHLSLRowMajorPacking, bool useStd140Packing)
+{
+ const TFieldList &fields = structure.fields();
+ const bool isNameless = (structure.name() == "");
+ const TString &structName = structureTypeName(structure, useHLSLRowMajorPacking, useStd140Packing);
+ const TString declareString = (isNameless ? "struct" : "struct " + structName);
+
+ TString string;
+ string += declareString + "\n"
+ "{\n";
+
+ int elementIndex = 0;
+
+ for (unsigned int i = 0; i < fields.size(); i++)
+ {
+ const TField &field = *fields[i];
+ const TType &fieldType = *field.type();
+ const TStructure *fieldStruct = fieldType.getStruct();
+ const TString &fieldTypeString = fieldStruct ? structureTypeName(*fieldStruct, useHLSLRowMajorPacking, useStd140Packing) : typeString(fieldType);
+
+ if (useStd140Packing)
+ {
+ string += std140PrePaddingString(*field.type(), &elementIndex);
+ }
+
+ string += " " + fieldTypeString + " " + decorateField(field.name(), structure) + arrayString(fieldType) + ";\n";
+
+ if (useStd140Packing)
+ {
+ string += std140PostPaddingString(*field.type(), useHLSLRowMajorPacking);
+ }
+ }
+
+ // Nameless structs do not finish with a semicolon and newline, to leave room for an instance variable
+ string += (isNameless ? "} " : "};\n");
+
+ // Add remaining element index to the global map, for use with nested structs in standard layouts
+ if (useStd140Packing)
+ {
+ mStd140StructElementIndexes[structName] = elementIndex;
+ }
+
+ return string;
+}
+
+TString OutputHLSL::structureTypeName(const TStructure &structure, bool useHLSLRowMajorPacking, bool useStd140Packing)
+{
+ if (structure.name() == "")
+ {
+ return "";
+ }
+
+ TString prefix = "";
+
+ // Structs packed with row-major matrices in HLSL are prefixed with "rm"
+ // GLSL column-major maps to HLSL row-major, and the converse is true
+
+ if (useStd140Packing)
+ {
+ prefix += "std";
+ }
+
+ if (useHLSLRowMajorPacking)
+ {
+ if (prefix != "") prefix += "_";
+ prefix += "rm";
+ }
+
+ return prefix + structNameString(structure);
+}
+
+void OutputHLSL::addConstructor(const TType &type, const TString &name, const TIntermSequence *parameters)
+{
+ if (name == "")
+ {
+ return; // Nameless structures don't have constructors
+ }
+
+ if (type.getStruct() && mStructNames.find(name) != mStructNames.end())
+ {
+ return; // Already added
+ }
+
+ TType ctorType = type;
+ ctorType.clearArrayness();
+ ctorType.setPrecision(EbpHigh);
+ ctorType.setQualifier(EvqTemporary);
+
+ typedef std::vector<TType> ParameterArray;
+ ParameterArray ctorParameters;
+
+ const TStructure* structure = type.getStruct();
+ if (structure)
+ {
+ mStructNames.insert(name);
+
+ const TString &structString = structureString(*structure, false, false);
+
+ if (std::find(mStructDeclarations.begin(), mStructDeclarations.end(), structString) == mStructDeclarations.end())
+ {
+ // Add row-major packed struct for interface blocks
+ TString rowMajorString = "#pragma pack_matrix(row_major)\n" +
+ structureString(*structure, true, false) +
+ "#pragma pack_matrix(column_major)\n";
+
+ TString std140String = structureString(*structure, false, true);
+ TString std140RowMajorString = "#pragma pack_matrix(row_major)\n" +
+ structureString(*structure, true, true) +
+ "#pragma pack_matrix(column_major)\n";
+
+ mStructDeclarations.push_back(structString);
+ mStructDeclarations.push_back(rowMajorString);
+ mStructDeclarations.push_back(std140String);
+ mStructDeclarations.push_back(std140RowMajorString);
+ }
+
+ const TFieldList &fields = structure->fields();
+ for (unsigned int i = 0; i < fields.size(); i++)
+ {
+ ctorParameters.push_back(*fields[i]->type());
+ }
+ }
+ else if (parameters)
+ {
+ for (TIntermSequence::const_iterator parameter = parameters->begin(); parameter != parameters->end(); parameter++)
+ {
+ ctorParameters.push_back((*parameter)->getAsTyped()->getType());
+ }
+ }
+ else UNREACHABLE();
+
+ TString constructor;
+
+ if (ctorType.getStruct())
+ {
+ constructor += name + " " + name + "_ctor(";
+ }
+ else // Built-in type
+ {
+ constructor += typeString(ctorType) + " " + name + "(";
+ }
+
+ for (unsigned int parameter = 0; parameter < ctorParameters.size(); parameter++)
+ {
+ const TType &type = ctorParameters[parameter];
+
+ constructor += typeString(type) + " x" + str(parameter) + arrayString(type);
+
+ if (parameter < ctorParameters.size() - 1)
+ {
+ constructor += ", ";
+ }
+ }
+
+ constructor += ")\n"
+ "{\n";
+
+ if (ctorType.getStruct())
+ {
+ constructor += " " + name + " structure = {";
+ }
+ else
+ {
+ constructor += " return " + typeString(ctorType) + "(";
+ }
+
+ if (ctorType.isMatrix() && ctorParameters.size() == 1)
+ {
+ int rows = ctorType.getRows();
+ int cols = ctorType.getCols();
+ const TType &parameter = ctorParameters[0];
+
+ if (parameter.isScalar())
+ {
+ for (int row = 0; row < rows; row++)
+ {
+ for (int col = 0; col < cols; col++)
+ {
+ constructor += TString((row == col) ? "x0" : "0.0");
+
+ if (row < rows - 1 || col < cols - 1)
+ {
+ constructor += ", ";
+ }
+ }
+ }
+ }
+ else if (parameter.isMatrix())
+ {
+ for (int row = 0; row < rows; row++)
+ {
+ for (int col = 0; col < cols; col++)
+ {
+ if (row < parameter.getRows() && col < parameter.getCols())
+ {
+ constructor += TString("x0") + "[" + str(row) + "]" + "[" + str(col) + "]";
+ }
+ else
+ {
+ constructor += TString((row == col) ? "1.0" : "0.0");
+ }
+
+ if (row < rows - 1 || col < cols - 1)
+ {
+ constructor += ", ";
+ }
+ }
+ }
+ }
+ else UNREACHABLE();
+ }
+ else
+ {
+ size_t remainingComponents = ctorType.getObjectSize();
+ size_t parameterIndex = 0;
+
+ while (remainingComponents > 0)
+ {
+ const TType &parameter = ctorParameters[parameterIndex];
+ const size_t parameterSize = parameter.getObjectSize();
+ bool moreParameters = parameterIndex + 1 < ctorParameters.size();
+
+ constructor += "x" + str(parameterIndex);
+
+ if (parameter.isScalar())
+ {
+ remainingComponents -= parameter.getObjectSize();
+ }
+ else if (parameter.isVector())
+ {
+ if (remainingComponents == parameterSize || moreParameters)
+ {
+ ASSERT(parameterSize <= remainingComponents);
+ remainingComponents -= parameterSize;
+ }
+ else if (remainingComponents < static_cast<size_t>(parameter.getNominalSize()))
+ {
+ switch (remainingComponents)
+ {
+ case 1: constructor += ".x"; break;
+ case 2: constructor += ".xy"; break;
+ case 3: constructor += ".xyz"; break;
+ case 4: constructor += ".xyzw"; break;
+ default: UNREACHABLE();
+ }
+
+ remainingComponents = 0;
+ }
+ else UNREACHABLE();
+ }
+ else if (parameter.isMatrix() || parameter.getStruct())
+ {
+ ASSERT(remainingComponents == parameterSize || moreParameters);
+ ASSERT(parameterSize <= remainingComponents);
+
+ remainingComponents -= parameterSize;
+ }
+ else UNREACHABLE();
+
+ if (moreParameters)
+ {
+ parameterIndex++;
+ }
+
+ if (remainingComponents)
+ {
+ constructor += ", ";
+ }
+ }
+ }
+
+ if (ctorType.getStruct())
+ {
+ constructor += "};\n"
+ " return structure;\n"
+ "}\n";
+ }
+ else
+ {
+ constructor += ");\n"
+ "}\n";
+ }
+
+ mConstructors.insert(constructor);
+}
+
+const ConstantUnion *OutputHLSL::writeConstantUnion(const TType &type, const ConstantUnion *constUnion)
+{
+ TInfoSinkBase &out = mBody;
+
+ const TStructure* structure = type.getStruct();
+ if (structure)
+ {
+ out << structNameString(*structure) + "_ctor(";
+
+ const TFieldList& fields = structure->fields();
+
+ for (size_t i = 0; i < fields.size(); i++)
+ {
+ const TType *fieldType = fields[i]->type();
+
+ constUnion = writeConstantUnion(*fieldType, constUnion);
+
+ if (i != fields.size() - 1)
+ {
+ out << ", ";
+ }
+ }
+
+ out << ")";
+ }
+ else
+ {
+ size_t size = type.getObjectSize();
+ bool writeType = size > 1;
+
+ if (writeType)
+ {
+ out << typeString(type) << "(";
+ }
+
+ for (size_t i = 0; i < size; i++, constUnion++)
+ {
+ switch (constUnion->getType())
+ {
+ case EbtFloat: out << std::min(FLT_MAX, std::max(-FLT_MAX, constUnion->getFConst())); break;
+ case EbtInt: out << constUnion->getIConst(); break;
+ case EbtUInt: out << constUnion->getUConst(); break;
+ case EbtBool: out << constUnion->getBConst(); break;
+ default: UNREACHABLE();
+ }
+
+ if (i != size - 1)
+ {
+ out << ", ";
+ }
+ }
+
+ if (writeType)
+ {
+ out << ")";
+ }
+ }
+
+ return constUnion;
+}
+
+TString OutputHLSL::structNameString(const TStructure &structure)
+{
+ if (structure.name().empty())
+ {
+ return "";
+ }
+
+ return "ss_" + str(structure.uniqueId()) + structure.name();
+}
+
+TString OutputHLSL::decorate(const TString &string)
+{
+ if (string.compare(0, 3, "gl_") != 0 && string.compare(0, 3, "dx_") != 0)
+ {
+ return "_" + string;
+ }
+
+ return string;
+}
+
+TString OutputHLSL::decorateUniform(const TString &string, const TType &type)
+{
+ if (type.getBasicType() == EbtSamplerExternalOES)
+ {
+ return "ex_" + string;
+ }
+
+ return decorate(string);
+}
+
+TString OutputHLSL::decorateField(const TString &string, const TStructure &structure)
+{
+ if (structure.name().compare(0, 3, "gl_") != 0)
+ {
+ return decorate(string);
+ }
+
+ return string;
+}
+
+void OutputHLSL::declareInterfaceBlockField(const TType &type, const TString &name, std::vector<gl::InterfaceBlockField>& output)
+{
+ const TStructure *structure = type.getStruct();
+
+ if (!structure)
+ {
+ const bool isRowMajorMatrix = (type.isMatrix() && type.getLayoutQualifier().matrixPacking == EmpRowMajor);
+ gl::InterfaceBlockField field(glVariableType(type), glVariablePrecision(type), name.c_str(),
+ (unsigned int)type.getArraySize(), isRowMajorMatrix);
+ output.push_back(field);
+ }
+ else
+ {
+ gl::InterfaceBlockField structField(GL_STRUCT_ANGLEX, GL_NONE, name.c_str(), (unsigned int)type.getArraySize(), false);
+
+ const TFieldList &fields = structure->fields();
+
+ for (size_t fieldIndex = 0; fieldIndex < fields.size(); fieldIndex++)
+ {
+ TField *field = fields[fieldIndex];
+ TType *fieldType = field->type();
+
+ // make sure to copy matrix packing information
+ fieldType->setLayoutQualifier(type.getLayoutQualifier());
+
+ declareInterfaceBlockField(*fieldType, field->name(), structField.fields);
+ }
+
+ output.push_back(structField);
+ }
+}
+
+gl::Uniform OutputHLSL::declareUniformToList(const TType &type, const TString &name, int registerIndex, std::vector<gl::Uniform>& output)
+{
+ const TStructure *structure = type.getStruct();
+
+ if (!structure)
+ {
+ gl::Uniform uniform(glVariableType(type), glVariablePrecision(type), name.c_str(),
+ (unsigned int)type.getArraySize(), (unsigned int)registerIndex, 0);
+ output.push_back(uniform);
+
+ return uniform;
+ }
+ else
+ {
+ gl::Uniform structUniform(GL_STRUCT_ANGLEX, GL_NONE, name.c_str(), (unsigned int)type.getArraySize(),
+ (unsigned int)registerIndex, GL_INVALID_INDEX);
+
+ const TFieldList &fields = structure->fields();
+
+ for (size_t fieldIndex = 0; fieldIndex < fields.size(); fieldIndex++)
+ {
+ TField *field = fields[fieldIndex];
+ TType *fieldType = field->type();
+
+ declareUniformToList(*fieldType, field->name(), GL_INVALID_INDEX, structUniform.fields);
+ }
+
+ // assign register offset information -- this will override the information in any sub-structures.
+ HLSLVariableGetRegisterInfo(registerIndex, &structUniform, mOutputType);
+
+ output.push_back(structUniform);
+
+ return structUniform;
+ }
+}
+
+gl::InterpolationType getInterpolationType(TQualifier qualifier)
+{
+ switch (qualifier)
+ {
+ case EvqFlatIn:
+ case EvqFlatOut:
+ return gl::INTERPOLATION_FLAT;
+
+ case EvqSmoothIn:
+ case EvqSmoothOut:
+ case EvqVertexOut:
+ case EvqFragmentIn:
+ case EvqVaryingIn:
+ case EvqVaryingOut:
+ return gl::INTERPOLATION_SMOOTH;
+
+ case EvqCentroidIn:
+ case EvqCentroidOut:
+ return gl::INTERPOLATION_CENTROID;
+
+ default: UNREACHABLE();
+ return gl::INTERPOLATION_SMOOTH;
+ }
+}
+
+void OutputHLSL::declareVaryingToList(const TType &type, TQualifier baseTypeQualifier, const TString &name, std::vector<gl::Varying>& fieldsOut)
+{
+ const TStructure *structure = type.getStruct();
+
+ gl::InterpolationType interpolation = getInterpolationType(baseTypeQualifier);
+ if (!structure)
+ {
+ gl::Varying varying(glVariableType(type), glVariablePrecision(type), name.c_str(), (unsigned int)type.getArraySize(), interpolation);
+ fieldsOut.push_back(varying);
+ }
+ else
+ {
+ gl::Varying structVarying(GL_STRUCT_ANGLEX, GL_NONE, name.c_str(), (unsigned int)type.getArraySize(), interpolation);
+ const TFieldList &fields = structure->fields();
+
+ structVarying.structName = structure->name().c_str();
+
+ for (size_t fieldIndex = 0; fieldIndex < fields.size(); fieldIndex++)
+ {
+ const TField &field = *fields[fieldIndex];
+ declareVaryingToList(*field.type(), baseTypeQualifier, field.name(), structVarying.fields);
+ }
+
+ fieldsOut.push_back(structVarying);
+ }
+}
+
+int OutputHLSL::declareUniformAndAssignRegister(const TType &type, const TString &name)
+{
+ int registerIndex = (IsSampler(type.getBasicType()) ? mSamplerRegister : mUniformRegister);
+
+ const gl::Uniform &uniform = declareUniformToList(type, name, registerIndex, mActiveUniforms);
+
+ if (IsSampler(type.getBasicType()))
+ {
+ mSamplerRegister += gl::HLSLVariableRegisterCount(uniform, mOutputType);
+ }
+ else
+ {
+ mUniformRegister += gl::HLSLVariableRegisterCount(uniform, mOutputType);
+ }
+
+ return registerIndex;
+}
+
+GLenum OutputHLSL::glVariableType(const TType &type)
+{
+ if (type.getBasicType() == EbtFloat)
+ {
+ if (type.isScalar())
+ {
+ return GL_FLOAT;
+ }
+ else if (type.isVector())
+ {
+ switch(type.getNominalSize())
+ {
+ case 2: return GL_FLOAT_VEC2;
+ case 3: return GL_FLOAT_VEC3;
+ case 4: return GL_FLOAT_VEC4;
+ default: UNREACHABLE();
+ }
+ }
+ else if (type.isMatrix())
+ {
+ switch (type.getCols())
+ {
+ case 2:
+ switch(type.getRows())
+ {
+ case 2: return GL_FLOAT_MAT2;
+ case 3: return GL_FLOAT_MAT2x3;
+ case 4: return GL_FLOAT_MAT2x4;
+ default: UNREACHABLE();
+ }
+
+ case 3:
+ switch(type.getRows())
+ {
+ case 2: return GL_FLOAT_MAT3x2;
+ case 3: return GL_FLOAT_MAT3;
+ case 4: return GL_FLOAT_MAT3x4;
+ default: UNREACHABLE();
+ }
+
+ case 4:
+ switch(type.getRows())
+ {
+ case 2: return GL_FLOAT_MAT4x2;
+ case 3: return GL_FLOAT_MAT4x3;
+ case 4: return GL_FLOAT_MAT4;
+ default: UNREACHABLE();
+ }
+
+ default: UNREACHABLE();
+ }
+ }
+ else UNREACHABLE();
+ }
+ else if (type.getBasicType() == EbtInt)
+ {
+ if (type.isScalar())
+ {
+ return GL_INT;
+ }
+ else if (type.isVector())
+ {
+ switch(type.getNominalSize())
+ {
+ case 2: return GL_INT_VEC2;
+ case 3: return GL_INT_VEC3;
+ case 4: return GL_INT_VEC4;
+ default: UNREACHABLE();
+ }
+ }
+ else UNREACHABLE();
+ }
+ else if (type.getBasicType() == EbtUInt)
+ {
+ if (type.isScalar())
+ {
+ return GL_UNSIGNED_INT;
+ }
+ else if (type.isVector())
+ {
+ switch(type.getNominalSize())
+ {
+ case 2: return GL_UNSIGNED_INT_VEC2;
+ case 3: return GL_UNSIGNED_INT_VEC3;
+ case 4: return GL_UNSIGNED_INT_VEC4;
+ default: UNREACHABLE();
+ }
+ }
+ else UNREACHABLE();
+ }
+ else if (type.getBasicType() == EbtBool)
+ {
+ if (type.isScalar())
+ {
+ return GL_BOOL;
+ }
+ else if (type.isVector())
+ {
+ switch(type.getNominalSize())
+ {
+ case 2: return GL_BOOL_VEC2;
+ case 3: return GL_BOOL_VEC3;
+ case 4: return GL_BOOL_VEC4;
+ default: UNREACHABLE();
+ }
+ }
+ else UNREACHABLE();
+ }
+
+ switch(type.getBasicType())
+ {
+ case EbtSampler2D: return GL_SAMPLER_2D;
+ case EbtSampler3D: return GL_SAMPLER_3D;
+ case EbtSamplerCube: return GL_SAMPLER_CUBE;
+ case EbtSampler2DArray: return GL_SAMPLER_2D_ARRAY;
+ case EbtISampler2D: return GL_INT_SAMPLER_2D;
+ case EbtISampler3D: return GL_INT_SAMPLER_3D;
+ case EbtISamplerCube: return GL_INT_SAMPLER_CUBE;
+ case EbtISampler2DArray: return GL_INT_SAMPLER_2D_ARRAY;
+ case EbtUSampler2D: return GL_UNSIGNED_INT_SAMPLER_2D;
+ case EbtUSampler3D: return GL_UNSIGNED_INT_SAMPLER_3D;
+ case EbtUSamplerCube: return GL_UNSIGNED_INT_SAMPLER_CUBE;
+ case EbtUSampler2DArray: return GL_UNSIGNED_INT_SAMPLER_2D_ARRAY;
+ case EbtSampler2DShadow: return GL_SAMPLER_2D_SHADOW;
+ case EbtSamplerCubeShadow: return GL_SAMPLER_CUBE_SHADOW;
+ case EbtSampler2DArrayShadow: return GL_SAMPLER_2D_ARRAY_SHADOW;
+ default: UNREACHABLE();
+ }
+
+ return GL_NONE;
+}
+
+GLenum OutputHLSL::glVariablePrecision(const TType &type)
+{
+ if (type.getBasicType() == EbtFloat)
+ {
+ switch (type.getPrecision())
+ {
+ case EbpHigh: return GL_HIGH_FLOAT;
+ case EbpMedium: return GL_MEDIUM_FLOAT;
+ case EbpLow: return GL_LOW_FLOAT;
+ case EbpUndefined:
+ // Should be defined as the default precision by the parser
+ default: UNREACHABLE();
+ }
+ }
+ else if (type.getBasicType() == EbtInt || type.getBasicType() == EbtUInt)
+ {
+ switch (type.getPrecision())
+ {
+ case EbpHigh: return GL_HIGH_INT;
+ case EbpMedium: return GL_MEDIUM_INT;
+ case EbpLow: return GL_LOW_INT;
+ case EbpUndefined:
+ // Should be defined as the default precision by the parser
+ default: UNREACHABLE();
+ }
+ }
+
+ // Other types (boolean, sampler) don't have a precision
+ return GL_NONE;
+}
+
+bool OutputHLSL::isVaryingOut(TQualifier qualifier)
+{
+ switch(qualifier)
+ {
+ case EvqVaryingOut:
+ case EvqInvariantVaryingOut:
+ case EvqSmoothOut:
+ case EvqFlatOut:
+ case EvqCentroidOut:
+ case EvqVertexOut:
+ return true;
+
+ default: break;
+ }
+
+ return false;
+}
+
+bool OutputHLSL::isVaryingIn(TQualifier qualifier)
+{
+ switch(qualifier)
+ {
+ case EvqVaryingIn:
+ case EvqInvariantVaryingIn:
+ case EvqSmoothIn:
+ case EvqFlatIn:
+ case EvqCentroidIn:
+ case EvqFragmentIn:
+ return true;
+
+ default: break;
+ }
+
+ return false;
+}
+
+bool OutputHLSL::isVarying(TQualifier qualifier)
+{
+ return isVaryingIn(qualifier) || isVaryingOut(qualifier);
+}
+
+}
diff --git a/chromium/third_party/angle/src/compiler/OutputHLSL.h b/chromium/third_party/angle/src/compiler/translator/OutputHLSL.h
index 586a76fb9c7..ab5a90be6e6 100644
--- a/chromium/third_party/angle/src/compiler/OutputHLSL.h
+++ b/chromium/third_party/angle/src/compiler/translator/OutputHLSL.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -11,12 +11,12 @@
#include <set>
#include <map>
-#define GL_APICALL
+#include <GLES3/gl3.h>
#include <GLES2/gl2.h>
-#include "compiler/intermediate.h"
-#include "compiler/ParseContext.h"
-#include "compiler/Uniform.h"
+#include "compiler/translator/intermediate.h"
+#include "compiler/translator/ParseContext.h"
+#include "common/shadervars.h"
namespace sh
{
@@ -31,22 +31,31 @@ class OutputHLSL : public TIntermTraverser
void output();
TInfoSinkBase &getBodyStream();
- const ActiveUniforms &getUniforms();
+ const std::vector<gl::Uniform> &getUniforms();
+ const std::vector<gl::InterfaceBlock> &getInterfaceBlocks() const;
+ const std::vector<gl::Attribute> &getOutputVariables() const;
+ const std::vector<gl::Attribute> &getAttributes() const;
+ const std::vector<gl::Varying> &getVaryings() const;
TString typeString(const TType &type);
TString textureString(const TType &type);
+ TString samplerString(const TType &type);
+ TString interpolationString(TQualifier qualifier);
+ TString structureString(const TStructure &structure, bool useHLSLRowMajorPacking, bool useStd140Packing);
+ TString structureTypeName(const TStructure &structure, bool useHLSLRowMajorPacking, bool useStd140Packing);
static TString qualifierString(TQualifier qualifier);
static TString arrayString(const TType &type);
static TString initializer(const TType &type);
static TString decorate(const TString &string); // Prepends an underscore to avoid naming clashes
static TString decorateUniform(const TString &string, const TType &type);
- static TString decorateField(const TString &string, const TType &structure);
+ static TString decorateField(const TString &string, const TStructure &structure);
protected:
void header();
// Visit AST nodes and output their code to the body stream
void visitSymbol(TIntermSymbol*);
+ void visitRaw(TIntermRaw*);
void visitConstantUnion(TIntermConstantUnion*);
bool visitBinary(Visit visit, TIntermBinary*);
bool visitUnary(Visit visit, TIntermUnary*);
@@ -66,9 +75,7 @@ class OutputHLSL : public TIntermTraverser
void addConstructor(const TType &type, const TString &name, const TIntermSequence *parameters);
const ConstantUnion *writeConstantUnion(const TType &type, const ConstantUnion *constUnion);
- TString scopeString(unsigned int depthLimit);
- TString scopedStruct(const TString &typeName);
- TString structLookup(const TString &typeName);
+ TString structNameString(const TStructure &structure);
TParseContext &mContext;
const ShShaderOutput mOutputType;
@@ -82,25 +89,40 @@ class OutputHLSL : public TIntermTraverser
typedef std::map<TString, TIntermSymbol*> ReferencedSymbols;
ReferencedSymbols mReferencedUniforms;
+ ReferencedSymbols mReferencedInterfaceBlocks;
ReferencedSymbols mReferencedAttributes;
ReferencedSymbols mReferencedVaryings;
+ ReferencedSymbols mReferencedOutputVariables;
+
+ struct TextureFunction
+ {
+ enum Method
+ {
+ IMPLICIT, // Mipmap LOD determined implicitly (standard lookup)
+ BIAS,
+ LOD,
+ LOD0,
+ LOD0BIAS,
+ SIZE, // textureSize()
+ FETCH,
+ GRAD
+ };
+
+ TBasicType sampler;
+ int coords;
+ bool proj;
+ bool offset;
+ Method method;
+
+ TString name() const;
+
+ bool operator<(const TextureFunction &rhs) const;
+ };
+
+ typedef std::set<TextureFunction> TextureFunctionSet;
// Parameters determining what goes in the header output
- bool mUsesTexture2D;
- bool mUsesTexture2D_bias;
- bool mUsesTexture2DLod;
- bool mUsesTexture2DProj;
- bool mUsesTexture2DProj_bias;
- bool mUsesTexture2DProjLod;
- bool mUsesTextureCube;
- bool mUsesTextureCube_bias;
- bool mUsesTextureCubeLod;
- bool mUsesTexture2DLod0;
- bool mUsesTexture2DLod0_bias;
- bool mUsesTexture2DProjLod0;
- bool mUsesTexture2DProjLod0_bias;
- bool mUsesTextureCubeLod0;
- bool mUsesTextureCubeLod0_bias;
+ TextureFunctionSet mUsesTexture;
bool mUsesFragColor;
bool mUsesFragData;
bool mUsesDepthRange;
@@ -126,6 +148,7 @@ class OutputHLSL : public TIntermTraverser
bool mUsesAtan2_3;
bool mUsesAtan2_4;
bool mUsesDiscardRewriting;
+ bool mUsesNestedBreak;
int mNumRenderTargets;
@@ -138,29 +161,59 @@ class OutputHLSL : public TIntermTraverser
typedef std::list<TString> StructDeclarations;
StructDeclarations mStructDeclarations;
- typedef std::vector<int> ScopeBracket;
- ScopeBracket mScopeBracket;
- unsigned int mScopeDepth;
-
int mUniqueIndex; // For creating unique names
bool mContainsLoopDiscontinuity;
bool mOutputLod0Function;
bool mInsideDiscontinuousLoop;
+ int mNestedLoopDepth;
TIntermSymbol *mExcessiveLoopIndex;
int mUniformRegister;
+ int mInterfaceBlockRegister;
int mSamplerRegister;
+ int mPaddingCounter;
TString registerString(TIntermSymbol *operand);
int samplerRegister(TIntermSymbol *sampler);
int uniformRegister(TIntermSymbol *uniform);
+ void declareInterfaceBlockField(const TType &type, const TString &name, std::vector<gl::InterfaceBlockField>& output);
+ gl::Uniform declareUniformToList(const TType &type, const TString &name, int registerIndex, std::vector<gl::Uniform>& output);
void declareUniform(const TType &type, const TString &name, int index);
+ void declareVaryingToList(const TType &type, TQualifier baseTypeQualifier, const TString &name, std::vector<gl::Varying>& fieldsOut);
+
+ // Returns the uniform's register index
+ int declareUniformAndAssignRegister(const TType &type, const TString &name);
+
+ TString interfaceBlockFieldString(const TInterfaceBlock &interfaceBlock, const TField &field);
+ TString decoratePrivate(const TString &privateText);
+ TString interfaceBlockStructNameString(const TInterfaceBlock &interfaceBlockType);
+ TString interfaceBlockInstanceString(const TInterfaceBlock& interfaceBlock, unsigned int arrayIndex);
+ TString interfaceBlockFieldTypeString(const TField &field, TLayoutBlockStorage blockStorage);
+ TString interfaceBlockFieldString(const TInterfaceBlock &interfaceBlock, TLayoutBlockStorage blockStorage);
+ TString interfaceBlockStructString(const TInterfaceBlock &interfaceBlock);
+ TString interfaceBlockString(const TInterfaceBlock &interfaceBlock, unsigned int registerIndex, unsigned int arrayIndex);
+ TString std140PrePaddingString(const TType &type, int *elementIndex);
+ TString std140PostPaddingString(const TType &type, bool useHLSLRowMajorPacking);
+ TString structInitializerString(int indent, const TStructure &structure, const TString &rhsStructName);
+
static GLenum glVariableType(const TType &type);
static GLenum glVariablePrecision(const TType &type);
-
- ActiveUniforms mActiveUniforms;
+ static bool isVaryingIn(TQualifier qualifier);
+ static bool isVaryingOut(TQualifier qualifier);
+ static bool isVarying(TQualifier qualifier);
+
+ std::vector<gl::Uniform> mActiveUniforms;
+ std::vector<gl::InterfaceBlock> mActiveInterfaceBlocks;
+ std::vector<gl::Attribute> mActiveOutputVariables;
+ std::vector<gl::Attribute> mActiveAttributes;
+ std::vector<gl::Varying> mActiveVaryings;
+ std::map<TString, int> mStd140StructElementIndexes;
+ std::map<TIntermTyped*, TString> mFlaggedStructMappedNames;
+ std::map<TIntermTyped*, TString> mFlaggedStructOriginalNames;
+
+ void makeFlaggedStructMaps(const std::vector<TIntermTyped *> &flaggedStructs);
};
}
diff --git a/chromium/third_party/angle/src/compiler/ParseContext.cpp b/chromium/third_party/angle/src/compiler/translator/ParseContext.cpp
index 4db9c0346e5..f9009668b02 100644
--- a/chromium/third_party/angle/src/compiler/ParseContext.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/ParseContext.cpp
@@ -4,12 +4,12 @@
// found in the LICENSE file.
//
-#include "compiler/ParseContext.h"
+#include "compiler/translator/ParseContext.h"
#include <stdarg.h>
#include <stdio.h>
-#include "compiler/glslang.h"
+#include "compiler/translator/glslang.h"
#include "compiler/preprocessor/SourceLocation.h"
///////////////////////////////////////////////////////////////////////
@@ -115,7 +115,7 @@ bool TParseContext::parseVectorFields(const TString& compString, int vecSize, TV
// Look at a '.' field selector string and change it into offsets
// for a matrix.
//
-bool TParseContext::parseMatrixFields(const TString& compString, int matSize, TMatrixFields& fields, const TSourceLoc& line)
+bool TParseContext::parseMatrixFields(const TString& compString, int matCols, int matRows, TMatrixFields& fields, const TSourceLoc& line)
{
fields.wholeRow = false;
fields.wholeCol = false;
@@ -151,7 +151,7 @@ bool TParseContext::parseMatrixFields(const TString& compString, int matSize, TM
fields.col = compString[1] - '0';
}
- if (fields.row >= matSize || fields.col >= matSize) {
+ if (fields.row >= matRows || fields.col >= matCols) {
error(line, "matrix field selection out of range", compString.c_str());
return false;
}
@@ -277,6 +277,7 @@ bool TParseContext::lValueErrorCheck(const TSourceLoc& line, const char* op, TIn
case EOpIndexDirect:
case EOpIndexIndirect:
case EOpIndexDirectStruct:
+ case EOpIndexDirectInterfaceBlock:
return lValueErrorCheck(line, op, binaryNode->getLeft());
case EOpVectorSwizzle:
errorReturn = lValueErrorCheck(line, op, binaryNode->getLeft());
@@ -317,6 +318,8 @@ bool TParseContext::lValueErrorCheck(const TSourceLoc& line, const char* op, TIn
case EvqConst: message = "can't modify a const"; break;
case EvqConstReadOnly: message = "can't modify a const"; break;
case EvqAttribute: message = "can't modify an attribute"; break;
+ case EvqFragmentIn: message = "can't modify an input"; break;
+ case EvqVertexIn: message = "can't modify an input"; break;
case EvqUniform: message = "can't modify a uniform"; break;
case EvqVaryingIn: message = "can't modify a varying"; break;
case EvqFragCoord: message = "can't modify gl_FragCoord"; break;
@@ -327,16 +330,11 @@ bool TParseContext::lValueErrorCheck(const TSourceLoc& line, const char* op, TIn
//
// Type that can't be written to?
//
- switch (node->getBasicType()) {
- case EbtSampler2D:
- case EbtSamplerCube:
- message = "can't modify a sampler";
- break;
- case EbtVoid:
+ if (node->getBasicType() == EbtVoid) {
message = "can't modify void";
- break;
- default:
- break;
+ }
+ if (IsSampler(node->getBasicType())) {
+ message = "can't modify a sampler";
}
}
@@ -396,7 +394,7 @@ bool TParseContext::constErrorCheck(TIntermTyped* node)
//
bool TParseContext::integerErrorCheck(TIntermTyped* node, const char* token)
{
- if (node->getBasicType() == EbtInt && node->getNominalSize() == 1)
+ if (node->isScalarInt())
return false;
error(node->getLine(), "integer expression required", token);
@@ -437,7 +435,7 @@ bool TParseContext::reservedErrorCheck(const TSourceLoc& line, const TString& id
error(line, reservedErrMsg, "gl_");
return true;
}
- if (isWebGLBasedSpec(shaderSpec)) {
+ if (IsWebGLBasedSpec(shaderSpec)) {
if (identifier.compare(0, 6, "webgl_") == 0) {
error(line, reservedErrMsg, "webgl_");
return true;
@@ -535,7 +533,7 @@ bool TParseContext::constructorErrorCheck(const TSourceLoc& line, TIntermNode* n
return true;
}
- if (op == EOpConstructStruct && !type->isArray() && int(type->getStruct()->fields().size()) != function.getParamCount()) {
+ if (op == EOpConstructStruct && !type->isArray() && type->getStruct()->fields().size() != function.getParamCount()) {
error(line, "Number of constructor parameters does not match the number of structure fields", "constructor");
return true;
}
@@ -599,7 +597,7 @@ bool TParseContext::boolErrorCheck(const TSourceLoc& line, const TIntermTyped* t
//
bool TParseContext::boolErrorCheck(const TSourceLoc& line, const TPublicType& pType)
{
- if (pType.type != EbtBool || pType.array || pType.matrix || (pType.size > 1)) {
+ if (pType.type != EbtBool || pType.isAggregate()) {
error(line, "boolean expression expected", "");
return true;
}
@@ -628,11 +626,20 @@ bool TParseContext::samplerErrorCheck(const TSourceLoc& line, const TPublicType&
bool TParseContext::structQualifierErrorCheck(const TSourceLoc& line, const TPublicType& pType)
{
- if ((pType.qualifier == EvqVaryingIn || pType.qualifier == EvqVaryingOut || pType.qualifier == EvqAttribute) &&
- pType.type == EbtStruct) {
- error(line, "cannot be used with a structure", getQualifierString(pType.qualifier));
-
- return true;
+ switch (pType.qualifier)
+ {
+ case EvqVaryingIn:
+ case EvqVaryingOut:
+ case EvqAttribute:
+ case EvqVertexIn:
+ case EvqFragmentOut:
+ if (pType.type == EbtStruct)
+ {
+ error(line, "cannot be used with a structure", getQualifierString(pType.qualifier));
+ return true;
+ }
+
+ default: break;
}
if (pType.qualifier != EvqUniform && samplerErrorCheck(line, pType, "samplers must be uniform"))
@@ -641,6 +648,17 @@ bool TParseContext::structQualifierErrorCheck(const TSourceLoc& line, const TPub
return false;
}
+bool TParseContext::locationDeclaratorListCheck(const TSourceLoc& line, const TPublicType &pType)
+{
+ if (pType.layoutQualifier.location != -1)
+ {
+ error(line, "location must only be specified for a single input or output variable", "location");
+ return true;
+ }
+
+ return false;
+}
+
bool TParseContext::parameterSamplerErrorCheck(const TSourceLoc& line, TQualifier qualifier, const TType& type)
{
if ((qualifier == EvqOut || qualifier == EvqInOut) &&
@@ -657,7 +675,7 @@ bool TParseContext::containsSampler(TType& type)
if (IsSampler(type.getBasicType()))
return true;
- if (type.getBasicType() == EbtStruct) {
+ if (type.getBasicType() == EbtStruct || type.isInterfaceBlock()) {
const TFieldList& fields = type.getStruct()->fields();
for (unsigned int i = 0; i < fields.size(); ++i) {
if (containsSampler(*fields[i]->type()))
@@ -676,15 +694,49 @@ bool TParseContext::containsSampler(TType& type)
bool TParseContext::arraySizeErrorCheck(const TSourceLoc& line, TIntermTyped* expr, int& size)
{
TIntermConstantUnion* constant = expr->getAsConstantUnion();
- if (constant == 0 || constant->getBasicType() != EbtInt) {
+
+ if (constant == 0 || !constant->isScalarInt())
+ {
error(line, "array size must be a constant integer expression", "");
return true;
}
- size = constant->getIConst(0);
+ unsigned int unsignedSize = 0;
+
+ if (constant->getBasicType() == EbtUInt)
+ {
+ unsignedSize = constant->getUConst(0);
+ size = static_cast<int>(unsignedSize);
+ }
+ else
+ {
+ size = constant->getIConst(0);
+
+ if (size < 0)
+ {
+ error(line, "array size must be non-negative", "");
+ size = 1;
+ return true;
+ }
+
+ unsignedSize = static_cast<unsigned int>(size);
+ }
- if (size <= 0) {
- error(line, "array size must be a positive integer", "");
+ if (size == 0)
+ {
+ error(line, "array size must be greater than zero", "");
+ size = 1;
+ return true;
+ }
+
+ // The size of arrays is restricted here to prevent issues further down the
+ // compiler/translator/driver stack. Shader Model 5 generation hardware is limited to
+ // 4096 registers so this should be reasonable even for aggressively optimizable code.
+ const unsigned int sizeLimit = 65536;
+
+ if (unsignedSize > sizeLimit)
+ {
+ error(line, "array size too large", "");
size = 1;
return true;
}
@@ -699,7 +751,7 @@ bool TParseContext::arraySizeErrorCheck(const TSourceLoc& line, TIntermTyped* ex
//
bool TParseContext::arrayQualifierErrorCheck(const TSourceLoc& line, TPublicType type)
{
- if ((type.qualifier == EvqAttribute) || (type.qualifier == EvqConst)) {
+ if ((type.qualifier == EvqAttribute) || (type.qualifier == EvqVertexIn) || (type.qualifier == EvqConst)) {
error(line, "cannot declare arrays of this qualifier", TType(type).getCompleteString().c_str());
return true;
}
@@ -733,7 +785,7 @@ bool TParseContext::arrayTypeErrorCheck(const TSourceLoc& line, TPublicType type
//
// Returns true if there was an error.
//
-bool TParseContext::arrayErrorCheck(const TSourceLoc& line, TString& identifier, TPublicType type, TVariable*& variable)
+bool TParseContext::arrayErrorCheck(const TSourceLoc& line, const TString& identifier, const TPublicType &type, TVariable*& variable)
{
//
// Don't check for reserved word use until after we know it's not in the symbol table,
@@ -742,7 +794,7 @@ bool TParseContext::arrayErrorCheck(const TSourceLoc& line, TString& identifier,
bool builtIn = false;
bool sameScope = false;
- TSymbol* symbol = symbolTable.find(identifier, &builtIn, &sameScope);
+ TSymbol* symbol = symbolTable.find(identifier, 0, &builtIn, &sameScope);
if (symbol == 0 || !sameScope) {
if (reservedErrorCheck(line, identifier))
return true;
@@ -752,7 +804,7 @@ bool TParseContext::arrayErrorCheck(const TSourceLoc& line, TString& identifier,
if (type.arraySize)
variable->getType().setArraySize(type.arraySize);
- if (! symbolTable.insert(*variable)) {
+ if (! symbolTable.declare(*variable)) {
delete variable;
error(line, "INTERNAL ERROR inserting new symbol", identifier.c_str());
return true;
@@ -793,7 +845,7 @@ bool TParseContext::arrayErrorCheck(const TSourceLoc& line, TString& identifier,
//
// Returns true if there was an error.
//
-bool TParseContext::nonInitConstErrorCheck(const TSourceLoc& line, TString& identifier, TPublicType& type, bool array)
+bool TParseContext::nonInitConstErrorCheck(const TSourceLoc& line, const TString& identifier, TPublicType& type, bool array)
{
if (type.qualifier == EvqConst)
{
@@ -825,14 +877,14 @@ bool TParseContext::nonInitConstErrorCheck(const TSourceLoc& line, TString& iden
//
// Returns true if there was an error.
//
-bool TParseContext::nonInitErrorCheck(const TSourceLoc& line, TString& identifier, TPublicType& type, TVariable*& variable)
+bool TParseContext::nonInitErrorCheck(const TSourceLoc& line, const TString& identifier, const TPublicType& type, TVariable*& variable)
{
if (reservedErrorCheck(line, identifier))
recover();
variable = new TVariable(&identifier, TType(type));
- if (! symbolTable.insert(*variable)) {
+ if (! symbolTable.declare(*variable)) {
error(line, "redefinition", variable->getName().c_str());
delete variable;
variable = 0;
@@ -885,6 +937,45 @@ bool TParseContext::extensionErrorCheck(const TSourceLoc& line, const TString& e
return false;
}
+bool TParseContext::singleDeclarationErrorCheck(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier)
+{
+ if (structQualifierErrorCheck(identifierLocation, publicType))
+ return true;
+
+ // check for layout qualifier issues
+ const TLayoutQualifier layoutQualifier = publicType.layoutQualifier;
+
+ if (layoutQualifier.matrixPacking != EmpUnspecified)
+ {
+ error(identifierLocation, "layout qualifier", getMatrixPackingString(layoutQualifier.matrixPacking), "only valid for interface blocks");
+ return true;
+ }
+
+ if (layoutQualifier.blockStorage != EbsUnspecified)
+ {
+ error(identifierLocation, "layout qualifier", getBlockStorageString(layoutQualifier.blockStorage), "only valid for interface blocks");
+ return true;
+ }
+
+ if (publicType.qualifier != EvqVertexIn && publicType.qualifier != EvqFragmentOut && layoutLocationErrorCheck(identifierLocation, publicType.layoutQualifier))
+ {
+ return true;
+ }
+
+ return false;
+}
+
+bool TParseContext::layoutLocationErrorCheck(const TSourceLoc& location, const TLayoutQualifier &layoutQualifier)
+{
+ if (layoutQualifier.location != -1)
+ {
+ error(location, "invalid layout qualifier:", "location", "only valid on program inputs and outputs");
+ return true;
+ }
+
+ return false;
+}
+
bool TParseContext::supportsExtension(const char* extension)
{
const TExtensionBehavior& extbehavior = extensionBehavior();
@@ -905,6 +996,22 @@ bool TParseContext::isExtensionEnabled(const char* extension) const
return (iter->second == EBhEnable || iter->second == EBhRequire);
}
+void TParseContext::handleExtensionDirective(const TSourceLoc& loc, const char* extName, const char* behavior)
+{
+ pp::SourceLocation srcLoc;
+ srcLoc.file = loc.first_file;
+ srcLoc.line = loc.first_line;
+ directiveHandler.handleExtension(srcLoc, extName, behavior);
+}
+
+void TParseContext::handlePragmaDirective(const TSourceLoc& loc, const char* name, const char* value)
+{
+ pp::SourceLocation srcLoc;
+ srcLoc.file = loc.first_file;
+ srcLoc.line = loc.first_line;
+ directiveHandler.handlePragma(srcLoc, name, value);
+}
+
/////////////////////////////////////////////////////////////////////////////////
//
// Non-Errors.
@@ -916,14 +1023,14 @@ bool TParseContext::isExtensionEnabled(const char* extension) const
//
// Return the function symbol if found, otherwise 0.
//
-const TFunction* TParseContext::findFunction(const TSourceLoc& line, TFunction* call, bool *builtIn)
+const TFunction* TParseContext::findFunction(const TSourceLoc& line, TFunction* call, int shaderVersion, bool *builtIn)
{
// First find by unmangled name to check whether the function name has been
// hidden by a variable name or struct typename.
// If a function is found, check for one with a matching argument list.
- const TSymbol* symbol = symbolTable.find(call->getName(), builtIn);
+ const TSymbol* symbol = symbolTable.find(call->getName(), shaderVersion, builtIn);
if (symbol == 0 || symbol->isFunction()) {
- symbol = symbolTable.find(call->getMangledName(), builtIn);
+ symbol = symbolTable.find(call->getMangledName(), shaderVersion, builtIn);
}
if (symbol == 0) {
@@ -943,7 +1050,7 @@ const TFunction* TParseContext::findFunction(const TSourceLoc& line, TFunction*
// Initializers show up in several places in the grammar. Have one set of
// code to handle them here.
//
-bool TParseContext::executeInitializer(const TSourceLoc& line, TString& identifier, TPublicType& pType,
+bool TParseContext::executeInitializer(const TSourceLoc& line, const TString& identifier, TPublicType& pType,
TIntermTyped* initializer, TIntermNode*& intermNode, TVariable* variable)
{
TType type = TType(pType);
@@ -959,7 +1066,7 @@ bool TParseContext::executeInitializer(const TSourceLoc& line, TString& identifi
// add variable to symbol table
//
variable = new TVariable(&identifier, type);
- if (! symbolTable.insert(*variable)) {
+ if (! symbolTable.declare(*variable)) {
error(line, "redefinition", variable->getName().c_str());
return true;
// don't delete variable, it's used by error recovery, and the pool
@@ -997,7 +1104,7 @@ bool TParseContext::executeInitializer(const TSourceLoc& line, TString& identifi
if (initializer->getAsConstantUnion()) {
variable->shareConstPointer(initializer->getAsConstantUnion()->getUnionArrayPointer());
} else if (initializer->getAsSymbolNode()) {
- const TSymbol* symbol = symbolTable.find(initializer->getAsSymbolNode()->getSymbol());
+ const TSymbol* symbol = symbolTable.find(initializer->getAsSymbolNode()->getSymbol(), 0);
const TVariable* tVar = static_cast<const TVariable*>(symbol);
ConstantUnion* constArray = tVar->getConstPointer();
@@ -1044,6 +1151,381 @@ bool TParseContext::areAllChildConst(TIntermAggregate* aggrNode)
return allConstant;
}
+TPublicType TParseContext::addFullySpecifiedType(TQualifier qualifier, TLayoutQualifier layoutQualifier, const TPublicType& typeSpecifier)
+{
+ TPublicType returnType = typeSpecifier;
+ returnType.qualifier = qualifier;
+ returnType.layoutQualifier = layoutQualifier;
+
+ if (typeSpecifier.array)
+ {
+ error(typeSpecifier.line, "not supported", "first-class array");
+ recover();
+ returnType.setArray(false);
+ }
+
+ if (shaderVersion < 300)
+ {
+ if (qualifier == EvqAttribute && (typeSpecifier.type == EbtBool || typeSpecifier.type == EbtInt))
+ {
+ error(typeSpecifier.line, "cannot be bool or int", getQualifierString(qualifier));
+ recover();
+ }
+
+ if ((qualifier == EvqVaryingIn || qualifier == EvqVaryingOut) &&
+ (typeSpecifier.type == EbtBool || typeSpecifier.type == EbtInt))
+ {
+ error(typeSpecifier.line, "cannot be bool or int", getQualifierString(qualifier));
+ recover();
+ }
+ }
+ else
+ {
+ switch (qualifier)
+ {
+ case EvqSmoothIn:
+ case EvqSmoothOut:
+ case EvqVertexOut:
+ case EvqFragmentIn:
+ case EvqCentroidOut:
+ case EvqCentroidIn:
+ if (typeSpecifier.type == EbtBool)
+ {
+ error(typeSpecifier.line, "cannot be bool", getQualifierString(qualifier));
+ recover();
+ }
+ if (typeSpecifier.type == EbtInt || typeSpecifier.type == EbtUInt)
+ {
+ error(typeSpecifier.line, "must use 'flat' interpolation here", getQualifierString(qualifier));
+ recover();
+ }
+ break;
+
+ case EvqVertexIn:
+ case EvqFragmentOut:
+ case EvqFlatIn:
+ case EvqFlatOut:
+ if (typeSpecifier.type == EbtBool)
+ {
+ error(typeSpecifier.line, "cannot be bool", getQualifierString(qualifier));
+ recover();
+ }
+ break;
+
+ default: break;
+ }
+ }
+
+ return returnType;
+}
+
+TIntermAggregate* TParseContext::parseSingleDeclaration(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier)
+{
+ TIntermSymbol* symbol = intermediate.addSymbol(0, identifier, TType(publicType), identifierLocation);
+ TIntermAggregate* aggregate = intermediate.makeAggregate(symbol, identifierLocation);
+
+ if (identifier != "")
+ {
+ if (singleDeclarationErrorCheck(publicType, identifierLocation, identifier))
+ recover();
+
+ // this error check can mutate the type
+ if (nonInitConstErrorCheck(identifierLocation, identifier, publicType, false))
+ recover();
+
+ TVariable* variable = 0;
+
+ if (nonInitErrorCheck(identifierLocation, identifier, publicType, variable))
+ recover();
+
+ if (variable && symbol)
+ {
+ symbol->setId(variable->getUniqueId());
+ }
+ }
+
+ return aggregate;
+}
+
+TIntermAggregate* TParseContext::parseSingleArrayDeclaration(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& indexLocation, TIntermTyped *indexExpression)
+{
+ if (singleDeclarationErrorCheck(publicType, identifierLocation, identifier))
+ recover();
+
+ // this error check can mutate the type
+ if (nonInitConstErrorCheck(identifierLocation, identifier, publicType, true))
+ recover();
+
+ if (arrayTypeErrorCheck(indexLocation, publicType) || arrayQualifierErrorCheck(indexLocation, publicType))
+ {
+ recover();
+ }
+
+ TPublicType arrayType = publicType;
+
+ int size;
+ if (arraySizeErrorCheck(identifierLocation, indexExpression, size))
+ {
+ recover();
+ }
+ else
+ {
+ arrayType.setArray(true, size);
+ }
+
+ TIntermSymbol* symbol = intermediate.addSymbol(0, identifier, TType(arrayType), identifierLocation);
+ TIntermAggregate* aggregate = intermediate.makeAggregate(symbol, identifierLocation);
+ TVariable* variable = 0;
+
+ if (arrayErrorCheck(identifierLocation, identifier, arrayType, variable))
+ recover();
+
+ if (variable && symbol)
+ {
+ symbol->setId(variable->getUniqueId());
+ }
+
+ return aggregate;
+}
+
+TIntermAggregate* TParseContext::parseSingleInitDeclaration(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& initLocation, TIntermTyped *initializer)
+{
+ if (singleDeclarationErrorCheck(publicType, identifierLocation, identifier))
+ recover();
+
+ TIntermNode* intermNode;
+ if (!executeInitializer(identifierLocation, identifier, publicType, initializer, intermNode))
+ {
+ //
+ // Build intermediate representation
+ //
+ return intermNode ? intermediate.makeAggregate(intermNode, initLocation) : NULL;
+ }
+ else
+ {
+ recover();
+ return NULL;
+ }
+}
+
+TIntermAggregate* TParseContext::parseDeclarator(TPublicType &publicType, TIntermAggregate *aggregateDeclaration, TSymbol *identifierSymbol, const TSourceLoc& identifierLocation, const TString &identifier)
+{
+ if (publicType.type == EbtInvariant && !identifierSymbol)
+ {
+ error(identifierLocation, "undeclared identifier declared as invariant", identifier.c_str());
+ recover();
+ }
+
+ TIntermSymbol* symbol = intermediate.addSymbol(0, identifier, TType(publicType), identifierLocation);
+ TIntermAggregate* intermAggregate = intermediate.growAggregate(aggregateDeclaration, symbol, identifierLocation);
+
+ if (structQualifierErrorCheck(identifierLocation, publicType))
+ recover();
+
+ if (locationDeclaratorListCheck(identifierLocation, publicType))
+ recover();
+
+ if (nonInitConstErrorCheck(identifierLocation, identifier, publicType, false))
+ recover();
+
+ TVariable* variable = 0;
+ if (nonInitErrorCheck(identifierLocation, identifier, publicType, variable))
+ recover();
+ if (symbol && variable)
+ symbol->setId(variable->getUniqueId());
+
+ return intermAggregate;
+}
+
+TIntermAggregate* TParseContext::parseArrayDeclarator(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& arrayLocation, TIntermNode *declaratorList, TIntermTyped *indexExpression)
+{
+ if (structQualifierErrorCheck(identifierLocation, publicType))
+ recover();
+
+ if (locationDeclaratorListCheck(identifierLocation, publicType))
+ recover();
+
+ if (nonInitConstErrorCheck(identifierLocation, identifier, publicType, true))
+ recover();
+
+ if (arrayTypeErrorCheck(arrayLocation, publicType) || arrayQualifierErrorCheck(arrayLocation, publicType))
+ {
+ recover();
+ }
+ else if (indexExpression)
+ {
+ int size;
+ if (arraySizeErrorCheck(arrayLocation, indexExpression, size))
+ recover();
+ TPublicType arrayType(publicType);
+ arrayType.setArray(true, size);
+ TVariable* variable = NULL;
+ if (arrayErrorCheck(arrayLocation, identifier, arrayType, variable))
+ recover();
+ TType type = TType(arrayType);
+ type.setArraySize(size);
+
+ return intermediate.growAggregate(declaratorList, intermediate.addSymbol(variable ? variable->getUniqueId() : 0, identifier, type, identifierLocation), identifierLocation);
+ }
+ else
+ {
+ TPublicType arrayType(publicType);
+ arrayType.setArray(true);
+ TVariable* variable = NULL;
+ if (arrayErrorCheck(arrayLocation, identifier, arrayType, variable))
+ recover();
+ }
+
+ return NULL;
+}
+
+TIntermAggregate* TParseContext::parseInitDeclarator(TPublicType &publicType, TIntermAggregate *declaratorList, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& initLocation, TIntermTyped *initializer)
+{
+ if (structQualifierErrorCheck(identifierLocation, publicType))
+ recover();
+
+ if (locationDeclaratorListCheck(identifierLocation, publicType))
+ recover();
+
+ TIntermNode* intermNode;
+ if (!executeInitializer(identifierLocation, identifier, publicType, initializer, intermNode))
+ {
+ //
+ // build the intermediate representation
+ //
+ if (intermNode)
+ {
+ return intermediate.growAggregate(declaratorList, intermNode, initLocation);
+ }
+ else
+ {
+ return declaratorList;
+ }
+ }
+ else
+ {
+ recover();
+ return NULL;
+ }
+}
+
+void TParseContext::parseGlobalLayoutQualifier(const TPublicType &typeQualifier)
+{
+ if (typeQualifier.qualifier != EvqUniform)
+ {
+ error(typeQualifier.line, "invalid qualifier:", getQualifierString(typeQualifier.qualifier), "global layout must be uniform");
+ recover();
+ return;
+ }
+
+ const TLayoutQualifier layoutQualifier = typeQualifier.layoutQualifier;
+ ASSERT(!layoutQualifier.isEmpty());
+
+ if (shaderVersion < 300)
+ {
+ error(typeQualifier.line, "layout qualifiers supported in GLSL ES 3.00 only", "layout");
+ recover();
+ return;
+ }
+
+ if (layoutLocationErrorCheck(typeQualifier.line, typeQualifier.layoutQualifier))
+ {
+ recover();
+ return;
+ }
+
+ if (layoutQualifier.matrixPacking != EmpUnspecified)
+ {
+ defaultMatrixPacking = layoutQualifier.matrixPacking;
+ }
+
+ if (layoutQualifier.blockStorage != EbsUnspecified)
+ {
+ defaultBlockStorage = layoutQualifier.blockStorage;
+ }
+}
+
+TFunction *TParseContext::addConstructorFunc(TPublicType publicType)
+{
+ TOperator op = EOpNull;
+ if (publicType.userDef)
+ {
+ op = EOpConstructStruct;
+ }
+ else
+ {
+ switch (publicType.type)
+ {
+ case EbtFloat:
+ if (publicType.isMatrix())
+ {
+ // TODO: non-square matrices
+ switch(publicType.getCols())
+ {
+ case 2: op = EOpConstructMat2; break;
+ case 3: op = EOpConstructMat3; break;
+ case 4: op = EOpConstructMat4; break;
+ }
+ }
+ else
+ {
+ switch(publicType.getNominalSize())
+ {
+ case 1: op = EOpConstructFloat; break;
+ case 2: op = EOpConstructVec2; break;
+ case 3: op = EOpConstructVec3; break;
+ case 4: op = EOpConstructVec4; break;
+ }
+ }
+ break;
+
+ case EbtInt:
+ switch(publicType.getNominalSize())
+ {
+ case 1: op = EOpConstructInt; break;
+ case 2: op = EOpConstructIVec2; break;
+ case 3: op = EOpConstructIVec3; break;
+ case 4: op = EOpConstructIVec4; break;
+ }
+ break;
+
+ case EbtUInt:
+ switch(publicType.getNominalSize())
+ {
+ case 1: op = EOpConstructUInt; break;
+ case 2: op = EOpConstructUVec2; break;
+ case 3: op = EOpConstructUVec3; break;
+ case 4: op = EOpConstructUVec4; break;
+ }
+ break;
+
+ case EbtBool:
+ switch(publicType.getNominalSize())
+ {
+ case 1: op = EOpConstructBool; break;
+ case 2: op = EOpConstructBVec2; break;
+ case 3: op = EOpConstructBVec3; break;
+ case 4: op = EOpConstructBVec4; break;
+ }
+ break;
+
+ default: break;
+ }
+
+ if (op == EOpNull)
+ {
+ error(publicType.line, "cannot construct this type", getBasicString(publicType.type));
+ recover();
+ publicType.type = EbtFloat;
+ op = EOpConstructFloat;
+ }
+ }
+
+ TString tempString;
+ TType type(publicType);
+ return new TFunction(&tempString, type, op);
+}
+
// This function is used to test for the correctness of the parameters passed to various constructor functions
// and also convert them to the right datatype if it is allowed and required.
//
@@ -1056,9 +1538,9 @@ TIntermTyped* TParseContext::addConstructor(TIntermNode* node, const TType* type
TIntermAggregate* aggrNode = node->getAsAggregate();
- TFieldList::const_iterator memberFields;
+ TFieldList::const_iterator memberTypes;
if (op == EOpConstructStruct)
- memberFields = type->getStruct()->fields().begin();
+ memberTypes = type->getStruct()->fields().begin();
TType elementType = *type;
if (type->isArray())
@@ -1080,7 +1562,7 @@ TIntermTyped* TParseContext::addConstructor(TIntermNode* node, const TType* type
if (type->isArray())
newNode = constructStruct(node, &elementType, 1, node->getLine(), false);
else if (op == EOpConstructStruct)
- newNode = constructStruct(node, (*memberFields)->type(), 1, node->getLine(), false);
+ newNode = constructStruct(node, (*memberTypes)->type(), 1, node->getLine(), false);
else
newNode = constructBuiltIn(type, op, node, node->getLine(), false);
@@ -1111,7 +1593,7 @@ TIntermTyped* TParseContext::addConstructor(TIntermNode* node, const TType* type
if (type->isArray())
newNode = constructStruct(*p, &elementType, paramCount+1, node->getLine(), true);
else if (op == EOpConstructStruct)
- newNode = constructStruct(*p, memberFields[paramCount]->type(), paramCount+1, node->getLine(), true);
+ newNode = constructStruct(*p, (memberTypes[paramCount])->type(), paramCount+1, node->getLine(), true);
else
newNode = constructBuiltIn(type, op, *p, node->getLine(), true);
@@ -1136,10 +1618,10 @@ TIntermTyped* TParseContext::foldConstConstructor(TIntermAggregate* aggrNode, co
bool returnVal = false;
ConstantUnion* unionArray = new ConstantUnion[type.getObjectSize()];
if (aggrNode->getSequence().size() == 1) {
- returnVal = intermediate.parseConstTree(aggrNode->getLine(), aggrNode, unionArray, aggrNode->getOp(), symbolTable, type, true);
+ returnVal = intermediate.parseConstTree(aggrNode->getLine(), aggrNode, unionArray, aggrNode->getOp(), type, true);
}
else {
- returnVal = intermediate.parseConstTree(aggrNode->getLine(), aggrNode, unionArray, aggrNode->getOp(), symbolTable, type);
+ returnVal = intermediate.parseConstTree(aggrNode->getLine(), aggrNode, unionArray, aggrNode->getOp(), type);
}
if (returnVal)
return 0;
@@ -1183,6 +1665,13 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType* type, TOperator op, T
basicOp = EOpConstructInt;
break;
+ case EOpConstructUVec2:
+ case EOpConstructUVec3:
+ case EOpConstructUVec4:
+ case EOpConstructUInt:
+ basicOp = EOpConstructUInt;
+ break;
+
case EOpConstructBVec2:
case EOpConstructBVec3:
case EOpConstructBVec4:
@@ -1196,7 +1685,7 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType* type, TOperator op, T
return 0;
}
- newNode = intermediate.addUnaryMath(basicOp, node, node->getLine(), symbolTable);
+ newNode = intermediate.addUnaryMath(basicOp, node, node->getLine());
if (newNode == 0) {
error(line, "can't convert", "constructor");
return 0;
@@ -1295,7 +1784,7 @@ TIntermTyped* TParseContext::addConstMatrixNode(int index, TIntermTyped* node, c
TIntermTyped* typedNode;
TIntermConstantUnion* tempConstantNode = node->getAsConstantUnion();
- if (index >= node->getType().getNominalSize()) {
+ if (index >= node->getType().getCols()) {
std::stringstream extraInfoStream;
extraInfoStream << "matrix field selection out of range '" << index << "'";
std::string extraInfo = extraInfoStream.str();
@@ -1306,7 +1795,7 @@ TIntermTyped* TParseContext::addConstMatrixNode(int index, TIntermTyped* node, c
if (tempConstantNode) {
ConstantUnion* unionArray = tempConstantNode->getUnionArrayPointer();
- int size = tempConstantNode->getType().getNominalSize();
+ int size = tempConstantNode->getType().getCols();
typedNode = intermediate.addConstantUnion(&unionArray[size*index], tempConstantNode->getType(), line);
} else {
error(line, "Cannot offset into the matrix", "Error");
@@ -1342,9 +1831,9 @@ TIntermTyped* TParseContext::addConstArrayNode(int index, TIntermTyped* node, co
}
if (tempConstantNode) {
- size_t arrayElementSize = arrayElementType.getObjectSize();
- ConstantUnion* unionArray = tempConstantNode->getUnionArrayPointer();
- typedNode = intermediate.addConstantUnion(&unionArray[arrayElementSize * index], tempConstantNode->getType(), line);
+ size_t arrayElementSize = arrayElementType.getObjectSize();
+ ConstantUnion* unionArray = tempConstantNode->getUnionArrayPointer();
+ typedNode = intermediate.addConstantUnion(&unionArray[arrayElementSize * index], tempConstantNode->getType(), line);
} else {
error(line, "Cannot offset into the array", "Error");
recover();
@@ -1361,11 +1850,11 @@ TIntermTyped* TParseContext::addConstArrayNode(int index, TIntermTyped* node, co
// If there is an embedded/nested struct, it appropriately calls addConstStructNested or addConstStructFromAggr
// function and returns the parse-tree with the values of the embedded/nested struct.
//
-TIntermTyped* TParseContext::addConstStruct(TString& identifier, TIntermTyped* node, const TSourceLoc& line)
+TIntermTyped* TParseContext::addConstStruct(const TString &identifier, TIntermTyped *node, const TSourceLoc& line)
{
const TFieldList& fields = node->getType().getStruct()->fields();
-
size_t instanceSize = 0;
+
for (size_t index = 0; index < fields.size(); ++index) {
if (fields[index]->name() == identifier) {
break;
@@ -1374,8 +1863,8 @@ TIntermTyped* TParseContext::addConstStruct(TString& identifier, TIntermTyped* n
}
}
- TIntermTyped* typedNode = 0;
- TIntermConstantUnion* tempConstantNode = node->getAsConstantUnion();
+ TIntermTyped *typedNode;
+ TIntermConstantUnion *tempConstantNode = node->getAsConstantUnion();
if (tempConstantNode) {
ConstantUnion* constArray = tempConstantNode->getUnionArrayPointer();
@@ -1390,6 +1879,146 @@ TIntermTyped* TParseContext::addConstStruct(TString& identifier, TIntermTyped* n
return typedNode;
}
+//
+// Interface/uniform blocks
+//
+TIntermAggregate* TParseContext::addInterfaceBlock(const TPublicType& typeQualifier, const TSourceLoc& nameLine, const TString& blockName, TFieldList* fieldList,
+ const TString* instanceName, const TSourceLoc& instanceLine, TIntermTyped* arrayIndex, const TSourceLoc& arrayIndexLine)
+{
+ if (reservedErrorCheck(nameLine, blockName))
+ recover();
+
+ if (typeQualifier.qualifier != EvqUniform)
+ {
+ error(typeQualifier.line, "invalid qualifier:", getQualifierString(typeQualifier.qualifier), "interface blocks must be uniform");
+ recover();
+ }
+
+ TLayoutQualifier blockLayoutQualifier = typeQualifier.layoutQualifier;
+ if (layoutLocationErrorCheck(typeQualifier.line, blockLayoutQualifier))
+ {
+ recover();
+ }
+
+ if (blockLayoutQualifier.matrixPacking == EmpUnspecified)
+ {
+ blockLayoutQualifier.matrixPacking = defaultMatrixPacking;
+ }
+
+ if (blockLayoutQualifier.blockStorage == EbsUnspecified)
+ {
+ blockLayoutQualifier.blockStorage = defaultBlockStorage;
+ }
+
+ TSymbol* blockNameSymbol = new TInterfaceBlockName(&blockName);
+ if (!symbolTable.declare(*blockNameSymbol)) {
+ error(nameLine, "redefinition", blockName.c_str(), "interface block name");
+ recover();
+ }
+
+ // check for sampler types and apply layout qualifiers
+ for (size_t memberIndex = 0; memberIndex < fieldList->size(); ++memberIndex) {
+ TField* field = (*fieldList)[memberIndex];
+ TType* fieldType = field->type();
+ if (IsSampler(fieldType->getBasicType())) {
+ error(field->line(), "unsupported type", fieldType->getBasicString(), "sampler types are not allowed in interface blocks");
+ recover();
+ }
+
+ const TQualifier qualifier = fieldType->getQualifier();
+ switch (qualifier)
+ {
+ case EvqGlobal:
+ case EvqUniform:
+ break;
+ default:
+ error(field->line(), "invalid qualifier on interface block member", getQualifierString(qualifier));
+ recover();
+ break;
+ }
+
+ // check layout qualifiers
+ TLayoutQualifier fieldLayoutQualifier = fieldType->getLayoutQualifier();
+ if (layoutLocationErrorCheck(field->line(), fieldLayoutQualifier))
+ {
+ recover();
+ }
+
+ if (fieldLayoutQualifier.blockStorage != EbsUnspecified)
+ {
+ error(field->line(), "invalid layout qualifier:", getBlockStorageString(fieldLayoutQualifier.blockStorage), "cannot be used here");
+ recover();
+ }
+
+ if (fieldLayoutQualifier.matrixPacking == EmpUnspecified)
+ {
+ fieldLayoutQualifier.matrixPacking = blockLayoutQualifier.matrixPacking;
+ }
+ else if (!fieldType->isMatrix())
+ {
+ error(field->line(), "invalid layout qualifier:", getMatrixPackingString(fieldLayoutQualifier.matrixPacking), "can only be used on matrix types");
+ recover();
+ }
+
+ fieldType->setLayoutQualifier(fieldLayoutQualifier);
+ }
+
+ // add array index
+ int arraySize = 0;
+ if (arrayIndex != NULL)
+ {
+ if (arraySizeErrorCheck(arrayIndexLine, arrayIndex, arraySize))
+ recover();
+ }
+
+ TInterfaceBlock* interfaceBlock = new TInterfaceBlock(&blockName, fieldList, instanceName, arraySize, blockLayoutQualifier);
+ TType interfaceBlockType(interfaceBlock, typeQualifier.qualifier, blockLayoutQualifier, arraySize);
+
+ TString symbolName = "";
+ int symbolId = 0;
+
+ if (!instanceName)
+ {
+ // define symbols for the members of the interface block
+ for (size_t memberIndex = 0; memberIndex < fieldList->size(); ++memberIndex)
+ {
+ TField* field = (*fieldList)[memberIndex];
+ TType* fieldType = field->type();
+
+ // set parent pointer of the field variable
+ fieldType->setInterfaceBlock(interfaceBlock);
+
+ TVariable* fieldVariable = new TVariable(&field->name(), *fieldType);
+ fieldVariable->setQualifier(typeQualifier.qualifier);
+
+ if (!symbolTable.declare(*fieldVariable)) {
+ error(field->line(), "redefinition", field->name().c_str(), "interface block member name");
+ recover();
+ }
+ }
+ }
+ else
+ {
+ // add a symbol for this interface block
+ TVariable* instanceTypeDef = new TVariable(instanceName, interfaceBlockType, false);
+ instanceTypeDef->setQualifier(typeQualifier.qualifier);
+
+ if (!symbolTable.declare(*instanceTypeDef)) {
+ error(instanceLine, "redefinition", instanceName->c_str(), "interface block instance name");
+ recover();
+ }
+
+ symbolId = instanceTypeDef->getUniqueId();
+ symbolName = instanceTypeDef->getName();
+ }
+
+ TIntermAggregate *aggregate = intermediate.makeAggregate(intermediate.addSymbol(symbolId, symbolName, interfaceBlockType, typeQualifier.line), nameLine);
+ aggregate->setOp(EOpDeclaration);
+
+ exitStructDeclaration();
+ return aggregate;
+}
+
bool TParseContext::enterStructDeclaration(const TSourceLoc& line, const TString& identifier)
{
++structNestingLevel;
@@ -1418,7 +2047,7 @@ const int kWebGLMaxStructNesting = 4;
bool TParseContext::structNestingErrorCheck(const TSourceLoc& line, const TField& field)
{
- if (!isWebGLBasedSpec(shaderSpec)) {
+ if (!IsWebGLBasedSpec(shaderSpec)) {
return false;
}
@@ -1531,6 +2160,17 @@ TIntermTyped* TParseContext::addIndexExpression(TIntermTyped *baseExpression, co
}
else
{
+ if (baseExpression->isInterfaceBlock())
+ {
+ error(location, "", "[", "array indexes for interface blocks arrays must be constant integral expressions");
+ recover();
+ }
+ else if (baseExpression->getQualifier() == EvqFragmentOut)
+ {
+ error(location, "", "[", "array indexes for fragment outputs must be constant integral expressions");
+ recover();
+ }
+
indexedExpression = intermediate.addIndex(EOpIndexIndirect, baseExpression, indexExpression, location);
}
@@ -1548,9 +2188,14 @@ TIntermTyped* TParseContext::addIndexExpression(TIntermTyped *baseExpression, co
TType copyOfType(baseType.getStruct());
indexedExpression->setType(copyOfType);
}
+ else if (baseType.isInterfaceBlock())
+ {
+ TType copyOfType(baseType.getInterfaceBlock(), baseType.getQualifier(), baseType.getLayoutQualifier(), 0);
+ indexedExpression->setType(copyOfType);
+ }
else
{
- indexedExpression->setType(TType(baseExpression->getBasicType(), baseExpression->getPrecision(), EvqTemporary, baseExpression->getNominalSize(), baseExpression->isMatrix()));
+ indexedExpression->setType(TType(baseExpression->getBasicType(), baseExpression->getPrecision(), EvqTemporary, baseExpression->getNominalSize(), baseExpression->getSecondarySize()));
}
if (baseExpression->getType().getQualifier() == EvqConst)
@@ -1561,7 +2206,7 @@ TIntermTyped* TParseContext::addIndexExpression(TIntermTyped *baseExpression, co
else if (baseExpression->isMatrix())
{
TQualifier qualifier = baseExpression->getType().getQualifier() == EvqConst ? EvqConst : EvqTemporary;
- indexedExpression->setType(TType(baseExpression->getBasicType(), baseExpression->getPrecision(), qualifier, baseExpression->getNominalSize()));
+ indexedExpression->setType(TType(baseExpression->getBasicType(), baseExpression->getPrecision(), qualifier, baseExpression->getRows()));
}
else if (baseExpression->isVector())
{
@@ -1576,6 +2221,408 @@ TIntermTyped* TParseContext::addIndexExpression(TIntermTyped *baseExpression, co
return indexedExpression;
}
+TIntermTyped* TParseContext::addFieldSelectionExpression(TIntermTyped *baseExpression, const TSourceLoc& dotLocation, const TString &fieldString, const TSourceLoc& fieldLocation)
+{
+ TIntermTyped *indexedExpression = NULL;
+
+ if (baseExpression->isArray())
+ {
+ error(fieldLocation, "cannot apply dot operator to an array", ".");
+ recover();
+ }
+
+ if (baseExpression->isVector())
+ {
+ TVectorFields fields;
+ if (!parseVectorFields(fieldString, baseExpression->getNominalSize(), fields, fieldLocation))
+ {
+ fields.num = 1;
+ fields.offsets[0] = 0;
+ recover();
+ }
+
+ if (baseExpression->getType().getQualifier() == EvqConst)
+ {
+ // constant folding for vector fields
+ indexedExpression = addConstVectorNode(fields, baseExpression, fieldLocation);
+ if (indexedExpression == 0)
+ {
+ recover();
+ indexedExpression = baseExpression;
+ }
+ else
+ {
+ indexedExpression->setType(TType(baseExpression->getBasicType(), baseExpression->getPrecision(), EvqConst, (int) (fieldString).size()));
+ }
+ }
+ else
+ {
+ TString vectorString = fieldString;
+ TIntermTyped* index = intermediate.addSwizzle(fields, fieldLocation);
+ indexedExpression = intermediate.addIndex(EOpVectorSwizzle, baseExpression, index, dotLocation);
+ indexedExpression->setType(TType(baseExpression->getBasicType(), baseExpression->getPrecision(), EvqTemporary, (int) vectorString.size()));
+ }
+ }
+ else if (baseExpression->isMatrix())
+ {
+ TMatrixFields fields;
+ if (!parseMatrixFields(fieldString, baseExpression->getCols(), baseExpression->getRows(), fields, fieldLocation))
+ {
+ fields.wholeRow = false;
+ fields.wholeCol = false;
+ fields.row = 0;
+ fields.col = 0;
+ recover();
+ }
+
+ if (fields.wholeRow || fields.wholeCol)
+ {
+ error(dotLocation, " non-scalar fields not implemented yet", ".");
+ recover();
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setIConst(0);
+ TIntermTyped* index = intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), fieldLocation);
+ indexedExpression = intermediate.addIndex(EOpIndexDirect, baseExpression, index, dotLocation);
+ indexedExpression->setType(TType(baseExpression->getBasicType(), baseExpression->getPrecision(),EvqTemporary, baseExpression->getCols(), baseExpression->getRows()));
+ }
+ else
+ {
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setIConst(fields.col * baseExpression->getRows() + fields.row);
+ TIntermTyped* index = intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), fieldLocation);
+ indexedExpression = intermediate.addIndex(EOpIndexDirect, baseExpression, index, dotLocation);
+ indexedExpression->setType(TType(baseExpression->getBasicType(), baseExpression->getPrecision()));
+ }
+ }
+ else if (baseExpression->getBasicType() == EbtStruct)
+ {
+ bool fieldFound = false;
+ const TFieldList& fields = baseExpression->getType().getStruct()->fields();
+ if (fields.empty())
+ {
+ error(dotLocation, "structure has no fields", "Internal Error");
+ recover();
+ indexedExpression = baseExpression;
+ }
+ else
+ {
+ unsigned int i;
+ for (i = 0; i < fields.size(); ++i)
+ {
+ if (fields[i]->name() == fieldString)
+ {
+ fieldFound = true;
+ break;
+ }
+ }
+ if (fieldFound)
+ {
+ if (baseExpression->getType().getQualifier() == EvqConst)
+ {
+ indexedExpression = addConstStruct(fieldString, baseExpression, dotLocation);
+ if (indexedExpression == 0)
+ {
+ recover();
+ indexedExpression = baseExpression;
+ }
+ else
+ {
+ indexedExpression->setType(*fields[i]->type());
+ // change the qualifier of the return type, not of the structure field
+ // as the structure definition is shared between various structures.
+ indexedExpression->getTypePointer()->setQualifier(EvqConst);
+ }
+ }
+ else
+ {
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setIConst(i);
+ TIntermTyped* index = intermediate.addConstantUnion(unionArray, *fields[i]->type(), fieldLocation);
+ indexedExpression = intermediate.addIndex(EOpIndexDirectStruct, baseExpression, index, dotLocation);
+ indexedExpression->setType(*fields[i]->type());
+ }
+ }
+ else
+ {
+ error(dotLocation, " no such field in structure", fieldString.c_str());
+ recover();
+ indexedExpression = baseExpression;
+ }
+ }
+ }
+ else if (baseExpression->isInterfaceBlock())
+ {
+ bool fieldFound = false;
+ const TFieldList& fields = baseExpression->getType().getInterfaceBlock()->fields();
+ if (fields.empty())
+ {
+ error(dotLocation, "interface block has no fields", "Internal Error");
+ recover();
+ indexedExpression = baseExpression;
+ }
+ else
+ {
+ unsigned int i;
+ for (i = 0; i < fields.size(); ++i)
+ {
+ if (fields[i]->name() == fieldString)
+ {
+ fieldFound = true;
+ break;
+ }
+ }
+ if (fieldFound)
+ {
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setIConst(i);
+ TIntermTyped* index = intermediate.addConstantUnion(unionArray, *fields[i]->type(), fieldLocation);
+ indexedExpression = intermediate.addIndex(EOpIndexDirectInterfaceBlock, baseExpression, index, dotLocation);
+ indexedExpression->setType(*fields[i]->type());
+ }
+ else
+ {
+ error(dotLocation, " no such field in interface block", fieldString.c_str());
+ recover();
+ indexedExpression = baseExpression;
+ }
+ }
+ }
+ else
+ {
+ if (shaderVersion < 300)
+ {
+ error(dotLocation, " field selection requires structure, vector, or matrix on left hand side", fieldString.c_str());
+ }
+ else
+ {
+ error(dotLocation, " field selection requires structure, vector, matrix, or interface block on left hand side", fieldString.c_str());
+ }
+ recover();
+ indexedExpression = baseExpression;
+ }
+
+ return indexedExpression;
+}
+
+TLayoutQualifier TParseContext::parseLayoutQualifier(const TString &qualifierType, const TSourceLoc& qualifierTypeLine)
+{
+ TLayoutQualifier qualifier;
+
+ qualifier.location = -1;
+ qualifier.matrixPacking = EmpUnspecified;
+ qualifier.blockStorage = EbsUnspecified;
+
+ if (qualifierType == "shared")
+ {
+ qualifier.blockStorage = EbsShared;
+ }
+ else if (qualifierType == "packed")
+ {
+ qualifier.blockStorage = EbsPacked;
+ }
+ else if (qualifierType == "std140")
+ {
+ qualifier.blockStorage = EbsStd140;
+ }
+ else if (qualifierType == "row_major")
+ {
+ qualifier.matrixPacking = EmpRowMajor;
+ }
+ else if (qualifierType == "column_major")
+ {
+ qualifier.matrixPacking = EmpColumnMajor;
+ }
+ else if (qualifierType == "location")
+ {
+ error(qualifierTypeLine, "invalid layout qualifier", qualifierType.c_str(), "location requires an argument");
+ recover();
+ }
+ else
+ {
+ error(qualifierTypeLine, "invalid layout qualifier", qualifierType.c_str());
+ recover();
+ }
+
+ return qualifier;
+}
+
+TLayoutQualifier TParseContext::parseLayoutQualifier(const TString &qualifierType, const TSourceLoc& qualifierTypeLine, const TString &intValueString, int intValue, const TSourceLoc& intValueLine)
+{
+ TLayoutQualifier qualifier;
+
+ qualifier.location = -1;
+ qualifier.matrixPacking = EmpUnspecified;
+ qualifier.blockStorage = EbsUnspecified;
+
+ if (qualifierType != "location")
+ {
+ error(qualifierTypeLine, "invalid layout qualifier", qualifierType.c_str(), "only location may have arguments");
+ recover();
+ }
+ else
+ {
+ // must check that location is non-negative
+ if (intValue < 0)
+ {
+ error(intValueLine, "out of range:", intValueString.c_str(), "location must be non-negative");
+ recover();
+ }
+ else
+ {
+ qualifier.location = intValue;
+ }
+ }
+
+ return qualifier;
+}
+
+TLayoutQualifier TParseContext::joinLayoutQualifiers(TLayoutQualifier leftQualifier, TLayoutQualifier rightQualifier)
+{
+ TLayoutQualifier joinedQualifier = leftQualifier;
+
+ if (rightQualifier.location != -1)
+ {
+ joinedQualifier.location = rightQualifier.location;
+ }
+ if (rightQualifier.matrixPacking != EmpUnspecified)
+ {
+ joinedQualifier.matrixPacking = rightQualifier.matrixPacking;
+ }
+ if (rightQualifier.blockStorage != EbsUnspecified)
+ {
+ joinedQualifier.blockStorage = rightQualifier.blockStorage;
+ }
+
+ return joinedQualifier;
+}
+
+TPublicType TParseContext::joinInterpolationQualifiers(const TSourceLoc &interpolationLoc, TQualifier interpolationQualifier,
+ const TSourceLoc &storageLoc, TQualifier storageQualifier)
+{
+ TQualifier mergedQualifier = EvqSmoothIn;
+
+ if (storageQualifier == EvqFragmentIn) {
+ if (interpolationQualifier == EvqSmooth)
+ mergedQualifier = EvqSmoothIn;
+ else if (interpolationQualifier == EvqFlat)
+ mergedQualifier = EvqFlatIn;
+ else UNREACHABLE();
+ }
+ else if (storageQualifier == EvqCentroidIn) {
+ if (interpolationQualifier == EvqSmooth)
+ mergedQualifier = EvqCentroidIn;
+ else if (interpolationQualifier == EvqFlat)
+ mergedQualifier = EvqFlatIn;
+ else UNREACHABLE();
+ }
+ else if (storageQualifier == EvqVertexOut) {
+ if (interpolationQualifier == EvqSmooth)
+ mergedQualifier = EvqSmoothOut;
+ else if (interpolationQualifier == EvqFlat)
+ mergedQualifier = EvqFlatOut;
+ else UNREACHABLE();
+ }
+ else if (storageQualifier == EvqCentroidOut) {
+ if (interpolationQualifier == EvqSmooth)
+ mergedQualifier = EvqCentroidOut;
+ else if (interpolationQualifier == EvqFlat)
+ mergedQualifier = EvqFlatOut;
+ else UNREACHABLE();
+ }
+ else {
+ error(interpolationLoc, "interpolation qualifier requires a fragment 'in' or vertex 'out' storage qualifier", getInterpolationString(interpolationQualifier));
+ recover();
+
+ mergedQualifier = storageQualifier;
+ }
+
+ TPublicType type;
+ type.setBasic(EbtVoid, mergedQualifier, storageLoc);
+ return type;
+}
+
+TFieldList *TParseContext::addStructDeclaratorList(const TPublicType& typeSpecifier, TFieldList *fieldList)
+{
+ if (voidErrorCheck(typeSpecifier.line, (*fieldList)[0]->name(), typeSpecifier)) {
+ recover();
+ }
+
+ for (unsigned int i = 0; i < fieldList->size(); ++i) {
+ //
+ // Careful not to replace already known aspects of type, like array-ness
+ //
+ TType* type = (*fieldList)[i]->type();
+ type->setBasicType(typeSpecifier.type);
+ type->setPrimarySize(typeSpecifier.primarySize);
+ type->setSecondarySize(typeSpecifier.secondarySize);
+ type->setPrecision(typeSpecifier.precision);
+ type->setQualifier(typeSpecifier.qualifier);
+ type->setLayoutQualifier(typeSpecifier.layoutQualifier);
+
+ // don't allow arrays of arrays
+ if (type->isArray()) {
+ if (arrayTypeErrorCheck(typeSpecifier.line, typeSpecifier))
+ recover();
+ }
+ if (typeSpecifier.array)
+ type->setArraySize(typeSpecifier.arraySize);
+ if (typeSpecifier.userDef) {
+ type->setStruct(typeSpecifier.userDef->getStruct());
+ }
+
+ if (structNestingErrorCheck(typeSpecifier.line, *(*fieldList)[i])) {
+ recover();
+ }
+ }
+
+ return fieldList;
+}
+
+TPublicType TParseContext::addStructure(const TSourceLoc& structLine, const TSourceLoc& nameLine, const TString *structName, TFieldList* fieldList)
+{
+ TStructure* structure = new TStructure(structName, fieldList);
+ TType* structureType = new TType(structure);
+
+ structure->setUniqueId(TSymbolTable::nextUniqueId());
+
+ if (!structName->empty())
+ {
+ if (reservedErrorCheck(nameLine, *structName))
+ {
+ recover();
+ }
+ TVariable* userTypeDef = new TVariable(structName, *structureType, true);
+ if (!symbolTable.declare(*userTypeDef)) {
+ error(nameLine, "redefinition", structName->c_str(), "struct");
+ recover();
+ }
+ }
+
+ // ensure we do not specify any storage qualifiers on the struct members
+ for (unsigned int typeListIndex = 0; typeListIndex < fieldList->size(); typeListIndex++)
+ {
+ const TField &field = *(*fieldList)[typeListIndex];
+ const TQualifier qualifier = field.type()->getQualifier();
+ switch (qualifier)
+ {
+ case EvqGlobal:
+ case EvqTemporary:
+ break;
+ default:
+ error(field.line(), "invalid qualifier on struct member", getQualifierString(qualifier));
+ recover();
+ break;
+ }
+ }
+
+ TPublicType publicType;
+ publicType.setBasic(EbtStruct, EvqTemporary, structLine);
+ publicType.userDef = structureType;
+ exitStructDeclaration();
+
+ return publicType;
+}
+
//
// Parse an array of strings using yyparse.
//
diff --git a/chromium/third_party/angle/src/compiler/ParseContext.h b/chromium/third_party/angle/src/compiler/translator/ParseContext.h
index c2b3c3f7ec8..3cd4b915e3c 100644
--- a/chromium/third_party/angle/src/compiler/ParseContext.h
+++ b/chromium/third_party/angle/src/compiler/translator/ParseContext.h
@@ -6,12 +6,12 @@
#ifndef _PARSER_HELPER_INCLUDED_
#define _PARSER_HELPER_INCLUDED_
-#include "compiler/Diagnostics.h"
-#include "compiler/DirectiveHandler.h"
-#include "compiler/localintermediate.h"
+#include "compiler/translator/Diagnostics.h"
+#include "compiler/translator/DirectiveHandler.h"
+#include "compiler/translator/localintermediate.h"
+#include "compiler/translator/ShHandle.h"
+#include "compiler/translator/SymbolTable.h"
#include "compiler/preprocessor/Preprocessor.h"
-#include "compiler/ShHandle.h"
-#include "compiler/SymbolTable.h"
struct TMatrixFields {
bool wholeRow;
@@ -38,14 +38,18 @@ struct TParseContext {
currentFunctionType(NULL),
functionReturnsValue(false),
checksPrecisionErrors(checksPrecErrors),
+ defaultMatrixPacking(EmpColumnMajor),
+ defaultBlockStorage(EbsShared),
diagnostics(is),
- directiveHandler(ext, diagnostics),
+ shaderVersion(100),
+ directiveHandler(ext, diagnostics, shaderVersion),
preprocessor(&diagnostics, &directiveHandler),
scanner(NULL) { }
TIntermediate& intermediate; // to hold and build a parse tree
TSymbolTable& symbolTable; // symbol table that goes with the language currently being parsed
ShShaderType shaderType; // vertex or fragment language (future: pack or unpack)
ShShaderSpec shaderSpec; // The language specification compiler conforms to - GLES2 or WebGL.
+ int shaderVersion;
int compileOptions;
const char* sourcePath; // Path of source file or NULL.
TIntermNode* treeRoot; // root of parse tree being created
@@ -55,12 +59,15 @@ struct TParseContext {
bool functionReturnsValue; // true if a non-void function has a return
bool checksPrecisionErrors; // true if an error will be generated when a variable is declared without precision, explicit or implicit.
bool fragmentPrecisionHigh; // true if highp precision is supported in the fragment language.
+ TLayoutMatrixPacking defaultMatrixPacking;
+ TLayoutBlockStorage defaultBlockStorage;
TString HashErrMsg;
TDiagnostics diagnostics;
TDirectiveHandler directiveHandler;
pp::Preprocessor preprocessor;
void* scanner;
+ int getShaderVersion() const { return shaderVersion; }
int numErrors() const { return diagnostics.numErrors(); }
TInfoSink& infoSink() { return diagnostics.infoSink(); }
void error(const TSourceLoc& loc, const char *reason, const char* token,
@@ -71,7 +78,7 @@ struct TParseContext {
void recover();
bool parseVectorFields(const TString&, int vecSize, TVectorFields&, const TSourceLoc& line);
- bool parseMatrixFields(const TString&, int matSize, TMatrixFields&, const TSourceLoc& line);
+ bool parseMatrixFields(const TString&, int matCols, int matRows, TMatrixFields&, const TSourceLoc& line);
bool reservedErrorCheck(const TSourceLoc& line, const TString& identifier);
void assignError(const TSourceLoc& line, const char* op, TString left, TString right);
@@ -86,29 +93,44 @@ struct TParseContext {
bool arraySizeErrorCheck(const TSourceLoc& line, TIntermTyped* expr, int& size);
bool arrayQualifierErrorCheck(const TSourceLoc& line, TPublicType type);
bool arrayTypeErrorCheck(const TSourceLoc& line, TPublicType type);
- bool arrayErrorCheck(const TSourceLoc& line, TString& identifier, TPublicType type, TVariable*& variable);
+ bool arrayErrorCheck(const TSourceLoc& line, const TString& identifier, const TPublicType &type, TVariable*& variable);
bool voidErrorCheck(const TSourceLoc&, const TString&, const TPublicType&);
bool boolErrorCheck(const TSourceLoc&, const TIntermTyped*);
bool boolErrorCheck(const TSourceLoc&, const TPublicType&);
bool samplerErrorCheck(const TSourceLoc& line, const TPublicType& pType, const char* reason);
bool structQualifierErrorCheck(const TSourceLoc& line, const TPublicType& pType);
+ bool locationDeclaratorListCheck(const TSourceLoc& line, const TPublicType &pType);
bool parameterSamplerErrorCheck(const TSourceLoc& line, TQualifier qualifier, const TType& type);
- bool nonInitConstErrorCheck(const TSourceLoc& line, TString& identifier, TPublicType& type, bool array);
- bool nonInitErrorCheck(const TSourceLoc& line, TString& identifier, TPublicType& type, TVariable*& variable);
+ bool nonInitConstErrorCheck(const TSourceLoc& line, const TString& identifier, TPublicType& type, bool array);
+ bool nonInitErrorCheck(const TSourceLoc& line, const TString& identifier, const TPublicType& type, TVariable*& variable);
bool paramErrorCheck(const TSourceLoc& line, TQualifier qualifier, TQualifier paramQualifier, TType* type);
bool extensionErrorCheck(const TSourceLoc& line, const TString&);
+ bool singleDeclarationErrorCheck(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier);
+ bool layoutLocationErrorCheck(const TSourceLoc& location, const TLayoutQualifier &layoutQualifier);
const TPragma& pragma() const { return directiveHandler.pragma(); }
const TExtensionBehavior& extensionBehavior() const { return directiveHandler.extensionBehavior(); }
bool supportsExtension(const char* extension);
bool isExtensionEnabled(const char* extension) const;
+ void handleExtensionDirective(const TSourceLoc& loc, const char* extName, const char* behavior);
+ void handlePragmaDirective(const TSourceLoc& loc, const char* name, const char* value);
bool containsSampler(TType& type);
bool areAllChildConst(TIntermAggregate* aggrNode);
- const TFunction* findFunction(const TSourceLoc& line, TFunction* pfnCall, bool *builtIn = 0);
- bool executeInitializer(const TSourceLoc& line, TString& identifier, TPublicType& pType,
+ const TFunction* findFunction(const TSourceLoc& line, TFunction* pfnCall, int shaderVersion, bool *builtIn = 0);
+ bool executeInitializer(const TSourceLoc& line, const TString& identifier, TPublicType& pType,
TIntermTyped* initializer, TIntermNode*& intermNode, TVariable* variable = 0);
+ TPublicType addFullySpecifiedType(TQualifier qualifier, const TPublicType& typeSpecifier);
+ TPublicType addFullySpecifiedType(TQualifier qualifier, TLayoutQualifier layoutQualifier, const TPublicType& typeSpecifier);
+ TIntermAggregate* parseSingleDeclaration(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier);
+ TIntermAggregate* parseSingleArrayDeclaration(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& indexLocation, TIntermTyped *indexExpression);
+ TIntermAggregate* parseSingleInitDeclaration(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& initLocation, TIntermTyped *initializer);
+ TIntermAggregate* parseDeclarator(TPublicType &publicType, TIntermAggregate *aggregateDeclaration, TSymbol *identifierSymbol, const TSourceLoc& identifierLocation, const TString &identifier);
+ TIntermAggregate* parseArrayDeclarator(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& arrayLocation, TIntermNode *declaratorList, TIntermTyped *indexExpression);
+ TIntermAggregate* parseInitDeclarator(TPublicType &publicType, TIntermAggregate *declaratorList, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& initLocation, TIntermTyped *initializer);
+ void parseGlobalLayoutQualifier(const TPublicType &typeQualifier);
+ TFunction *addConstructorFunc(TPublicType publicType);
TIntermTyped* addConstructor(TIntermNode*, const TType*, TOperator, TFunction*, const TSourceLoc&);
TIntermTyped* foldConstConstructor(TIntermAggregate* aggrNode, const TType& type);
TIntermTyped* constructStruct(TIntermNode*, TType*, int, const TSourceLoc&, bool subset);
@@ -116,8 +138,21 @@ struct TParseContext {
TIntermTyped* addConstVectorNode(TVectorFields&, TIntermTyped*, const TSourceLoc&);
TIntermTyped* addConstMatrixNode(int , TIntermTyped*, const TSourceLoc&);
TIntermTyped* addConstArrayNode(int index, TIntermTyped* node, const TSourceLoc& line);
- TIntermTyped* addConstStruct(TString& , TIntermTyped*, const TSourceLoc&);
+ TIntermTyped* addConstStruct(const TString &identifier, TIntermTyped *node, const TSourceLoc& line);
TIntermTyped* addIndexExpression(TIntermTyped *baseExpression, const TSourceLoc& location, TIntermTyped *indexExpression);
+ TIntermTyped* addFieldSelectionExpression(TIntermTyped *baseExpression, const TSourceLoc& dotLocation, const TString &fieldString, const TSourceLoc& fieldLocation);
+
+ TFieldList *addStructDeclaratorList(const TPublicType& typeSpecifier, TFieldList *fieldList);
+ TPublicType addStructure(const TSourceLoc& structLine, const TSourceLoc& nameLine, const TString *structName, TFieldList* fieldList);
+
+ TIntermAggregate* addInterfaceBlock(const TPublicType& typeQualifier, const TSourceLoc& nameLine, const TString& blockName, TFieldList* fieldList,
+ const TString* instanceName, const TSourceLoc& instanceLine, TIntermTyped* arrayIndex, const TSourceLoc& arrayIndexLine);
+
+ TLayoutQualifier parseLayoutQualifier(const TString &qualifierType, const TSourceLoc& qualifierTypeLine);
+ TLayoutQualifier parseLayoutQualifier(const TString &qualifierType, const TSourceLoc& qualifierTypeLine, const TString &intValueString, int intValue, const TSourceLoc& intValueLine);
+ TLayoutQualifier joinLayoutQualifiers(TLayoutQualifier leftQualifier, TLayoutQualifier rightQualifier);
+ TPublicType joinInterpolationQualifiers(const TSourceLoc &interpolationLoc, TQualifier interpolationQualifier,
+ const TSourceLoc &storageLoc, TQualifier storageQualifier);
// Performs an error check for embedded struct declarations.
// Returns true if an error was raised due to the declaration of
diff --git a/chromium/third_party/angle/src/compiler/PoolAlloc.cpp b/chromium/third_party/angle/src/compiler/translator/PoolAlloc.cpp
index eb993567b35..abe70262f2d 100644
--- a/chromium/third_party/angle/src/compiler/PoolAlloc.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/PoolAlloc.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/PoolAlloc.h"
+#include "compiler/translator/PoolAlloc.h"
#ifndef _MSC_VER
#include <stdint.h>
@@ -12,8 +12,8 @@
#include <stdio.h>
#include "common/angleutils.h"
-#include "compiler/InitializeGlobals.h"
-#include "compiler/osinclude.h"
+#include "compiler/translator/InitializeGlobals.h"
+#include "compiler/translator/osinclude.h"
OS_TLSIndex PoolIndex = OS_INVALID_TLS_INDEX;
diff --git a/chromium/third_party/angle/src/compiler/PoolAlloc.h b/chromium/third_party/angle/src/compiler/translator/PoolAlloc.h
index edd249c4d3a..edd249c4d3a 100644
--- a/chromium/third_party/angle/src/compiler/PoolAlloc.h
+++ b/chromium/third_party/angle/src/compiler/translator/PoolAlloc.h
diff --git a/chromium/third_party/angle/src/compiler/Pragma.h b/chromium/third_party/angle/src/compiler/translator/Pragma.h
index 2f744123b82..2f744123b82 100644
--- a/chromium/third_party/angle/src/compiler/Pragma.h
+++ b/chromium/third_party/angle/src/compiler/translator/Pragma.h
diff --git a/chromium/third_party/angle/src/compiler/QualifierAlive.cpp b/chromium/third_party/angle/src/compiler/translator/QualifierAlive.cpp
index 92a6874eb7b..1ba087e1765 100644
--- a/chromium/third_party/angle/src/compiler/QualifierAlive.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/QualifierAlive.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/intermediate.h"
+#include "compiler/translator/intermediate.h"
class TAliveTraverser : public TIntermTraverser {
public:
diff --git a/chromium/third_party/angle/src/compiler/QualifierAlive.h b/chromium/third_party/angle/src/compiler/translator/QualifierAlive.h
index 872a06f7219..872a06f7219 100644
--- a/chromium/third_party/angle/src/compiler/QualifierAlive.h
+++ b/chromium/third_party/angle/src/compiler/translator/QualifierAlive.h
diff --git a/chromium/third_party/angle/src/compiler/translator/RemoveTree.cpp b/chromium/third_party/angle/src/compiler/translator/RemoveTree.cpp
new file mode 100644
index 00000000000..e381c326900
--- /dev/null
+++ b/chromium/third_party/angle/src/compiler/translator/RemoveTree.cpp
@@ -0,0 +1,29 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/translator/intermediate.h"
+#include "compiler/translator/RemoveTree.h"
+
+//
+// Code to delete the intermediate tree.
+//
+void RemoveAllTreeNodes(TIntermNode* root)
+{
+ std::queue<TIntermNode*> nodeQueue;
+
+ nodeQueue.push(root);
+
+ while (!nodeQueue.empty())
+ {
+ TIntermNode *node = nodeQueue.front();
+ nodeQueue.pop();
+
+ node->enqueueChildren(&nodeQueue);
+
+ delete node;
+ }
+}
+
diff --git a/chromium/third_party/angle/src/compiler/RemoveTree.h b/chromium/third_party/angle/src/compiler/translator/RemoveTree.h
index 97a821679c2..97a821679c2 100644
--- a/chromium/third_party/angle/src/compiler/RemoveTree.h
+++ b/chromium/third_party/angle/src/compiler/translator/RemoveTree.h
diff --git a/chromium/third_party/angle/src/compiler/RenameFunction.h b/chromium/third_party/angle/src/compiler/translator/RenameFunction.h
index 3908bfddb82..1f7fb16c459 100644
--- a/chromium/third_party/angle/src/compiler/RenameFunction.h
+++ b/chromium/third_party/angle/src/compiler/translator/RenameFunction.h
@@ -7,7 +7,7 @@
#ifndef COMPILER_RENAME_FUNCTION
#define COMPILER_RENAME_FUNCTION
-#include "compiler/intermediate.h"
+#include "compiler/translator/intermediate.h"
//
// Renames a function, including its declaration and any calls to it.
diff --git a/chromium/third_party/angle/src/compiler/translator/RewriteElseBlocks.cpp b/chromium/third_party/angle/src/compiler/translator/RewriteElseBlocks.cpp
new file mode 100644
index 00000000000..46e510c31b9
--- /dev/null
+++ b/chromium/third_party/angle/src/compiler/translator/RewriteElseBlocks.cpp
@@ -0,0 +1,132 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// RewriteElseBlocks.cpp: Implementation for tree transform to change
+// all if-else blocks to if-if blocks.
+//
+
+#include "compiler/translator/RewriteElseBlocks.h"
+#include "compiler/translator/NodeSearch.h"
+#include "compiler/translator/SymbolTable.h"
+
+namespace sh
+{
+
+TIntermSymbol *MakeNewTemporary(const TString &name, TBasicType type)
+{
+ TType variableType(type, EbpHigh, EvqInternal);
+ return new TIntermSymbol(-1, name, variableType);
+}
+
+TIntermBinary *MakeNewBinary(TOperator op, TIntermTyped *left, TIntermTyped *right, const TType &resultType)
+{
+ TIntermBinary *binary = new TIntermBinary(op);
+ binary->setLeft(left);
+ binary->setRight(right);
+ binary->setType(resultType);
+ return binary;
+}
+
+TIntermUnary *MakeNewUnary(TOperator op, TIntermTyped *operand)
+{
+ TIntermUnary *unary = new TIntermUnary(op, operand->getType());
+ unary->setOperand(operand);
+ return unary;
+}
+
+ElseBlockRewriter::ElseBlockRewriter()
+ : TIntermTraverser(true, false, true, false),
+ mTemporaryIndex(0),
+ mFunctionType(NULL)
+{}
+
+bool ElseBlockRewriter::visitAggregate(Visit visit, TIntermAggregate *node)
+{
+ switch (node->getOp())
+ {
+ case EOpSequence:
+ if (visit == PostVisit)
+ {
+ for (size_t statementIndex = 0; statementIndex != node->getSequence().size(); statementIndex++)
+ {
+ TIntermNode *statement = node->getSequence()[statementIndex];
+ TIntermSelection *selection = statement->getAsSelectionNode();
+ if (selection && selection->getFalseBlock() != NULL)
+ {
+ // Check for if / else if
+ TIntermSelection *elseIfBranch = selection->getFalseBlock()->getAsSelectionNode();
+ if (elseIfBranch)
+ {
+ selection->replaceChildNode(elseIfBranch, rewriteSelection(elseIfBranch));
+ delete elseIfBranch;
+ }
+
+ node->getSequence()[statementIndex] = rewriteSelection(selection);
+ delete selection;
+ }
+ }
+ }
+ break;
+
+ case EOpFunction:
+ // Store the current function context (see comment below)
+ mFunctionType = ((visit == PreVisit) ? &node->getType() : NULL);
+ break;
+
+ default: break;
+ }
+
+ return true;
+}
+
+TIntermNode *ElseBlockRewriter::rewriteSelection(TIntermSelection *selection)
+{
+ ASSERT(selection->getFalseBlock() != NULL);
+
+ TString temporaryName = "cond_" + str(mTemporaryIndex++);
+ TIntermTyped *typedCondition = selection->getCondition()->getAsTyped();
+ TType resultType(EbtBool, EbpUndefined);
+ TIntermSymbol *conditionSymbolA = MakeNewTemporary(temporaryName, EbtBool);
+ TIntermSymbol *conditionSymbolB = MakeNewTemporary(temporaryName, EbtBool);
+ TIntermSymbol *conditionSymbolC = MakeNewTemporary(temporaryName, EbtBool);
+ TIntermBinary *storeCondition = MakeNewBinary(EOpInitialize, conditionSymbolA,
+ typedCondition, resultType);
+ TIntermUnary *negatedCondition = MakeNewUnary(EOpLogicalNot, conditionSymbolB);
+ TIntermNode *negatedElse = NULL;
+
+ // crbug.com/346463
+ // D3D generates error messages claiming a function has no return value, when rewriting
+ // an if-else clause that returns something non-void in a function. By appending dummy
+ // returns (that are unreachable) we can silence this compile error.
+ if (mFunctionType && mFunctionType->getBasicType() != EbtVoid)
+ {
+ TString typeString = mFunctionType->getStruct() ? mFunctionType->getStruct()->name() :
+ mFunctionType->getBasicString();
+ TString rawText = "return (" + typeString + ")0";
+ negatedElse = new TIntermRaw(*mFunctionType, rawText);
+ }
+
+ TIntermSelection *falseBlock = new TIntermSelection(negatedCondition,
+ selection->getFalseBlock(), negatedElse);
+ TIntermSelection *newIfElse = new TIntermSelection(conditionSymbolC,
+ selection->getTrueBlock(), falseBlock);
+
+ TIntermAggregate *declaration = new TIntermAggregate(EOpDeclaration);
+ declaration->getSequence().push_back(storeCondition);
+
+ TIntermAggregate *block = new TIntermAggregate(EOpSequence);
+ block->getSequence().push_back(declaration);
+ block->getSequence().push_back(newIfElse);
+
+ return block;
+}
+
+void RewriteElseBlocks(TIntermNode *node)
+{
+ ElseBlockRewriter rewriter;
+ node->traverse(&rewriter);
+}
+
+}
diff --git a/chromium/third_party/angle/src/compiler/translator/RewriteElseBlocks.h b/chromium/third_party/angle/src/compiler/translator/RewriteElseBlocks.h
new file mode 100644
index 00000000000..172928f7254
--- /dev/null
+++ b/chromium/third_party/angle/src/compiler/translator/RewriteElseBlocks.h
@@ -0,0 +1,37 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// RewriteElseBlocks.h: Prototype for tree transform to change
+// all if-else blocks to if-if blocks.
+//
+
+#ifndef COMPILER_REWRITE_ELSE_BLOCKS_H_
+#define COMPILER_REWRITE_ELSE_BLOCKS_H_
+
+#include "compiler/translator/intermediate.h"
+
+namespace sh
+{
+
+class ElseBlockRewriter : public TIntermTraverser
+{
+ public:
+ ElseBlockRewriter();
+
+ protected:
+ bool visitAggregate(Visit visit, TIntermAggregate *aggregate);
+
+ private:
+ int mTemporaryIndex;
+ const TType *mFunctionType;
+
+ TIntermNode *rewriteSelection(TIntermSelection *selection);
+};
+
+void RewriteElseBlocks(TIntermNode *node);
+
+}
+
+#endif // COMPILER_REWRITE_ELSE_BLOCKS_H_
diff --git a/chromium/third_party/angle/src/compiler/SearchSymbol.cpp b/chromium/third_party/angle/src/compiler/translator/SearchSymbol.cpp
index 9368f1a4faf..f78c84e370d 100644
--- a/chromium/third_party/angle/src/compiler/SearchSymbol.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/SearchSymbol.cpp
@@ -6,10 +6,10 @@
// SearchSymbol is an AST traverser to detect the use of a given symbol name
//
-#include "compiler/SearchSymbol.h"
+#include "compiler/translator/SearchSymbol.h"
-#include "compiler/InfoSink.h"
-#include "compiler/OutputHLSL.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/OutputHLSL.h"
namespace sh
{
diff --git a/chromium/third_party/angle/src/compiler/SearchSymbol.h b/chromium/third_party/angle/src/compiler/translator/SearchSymbol.h
index 224bc77c6f2..8ddd3cb1ac3 100644
--- a/chromium/third_party/angle/src/compiler/SearchSymbol.h
+++ b/chromium/third_party/angle/src/compiler/translator/SearchSymbol.h
@@ -9,8 +9,8 @@
#ifndef COMPILER_SEARCHSYMBOL_H_
#define COMPILER_SEARCHSYMBOL_H_
-#include "compiler/intermediate.h"
-#include "compiler/ParseContext.h"
+#include "compiler/translator/intermediate.h"
+#include "compiler/translator/ParseContext.h"
namespace sh
{
diff --git a/chromium/third_party/angle/src/compiler/ShHandle.h b/chromium/third_party/angle/src/compiler/translator/ShHandle.h
index 873580a99c6..bb6a60c519f 100644
--- a/chromium/third_party/angle/src/compiler/ShHandle.h
+++ b/chromium/third_party/angle/src/compiler/translator/ShHandle.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -14,17 +14,14 @@
// This should not be included by driver code.
//
-#include "GLSLANG/ShaderLang.h"
-
-#include "compiler/BuiltInFunctionEmulator.h"
-#include "compiler/ExtensionBehavior.h"
-#include "compiler/HashNames.h"
-#include "compiler/InfoSink.h"
-#include "compiler/SymbolTable.h"
-#include "compiler/VariableInfo.h"
+#include "compiler/translator/BuiltInFunctionEmulator.h"
+#include "compiler/translator/ExtensionBehavior.h"
+#include "compiler/translator/HashNames.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/VariableInfo.h"
#include "third_party/compiler/ArrayBoundsClamper.h"
-class LongNameMap;
class TCompiler;
class TDependencyGraph;
class TranslatorHLSL;
@@ -33,7 +30,7 @@ class TranslatorHLSL;
// Helper function to identify specs that are based on the WebGL spec,
// like the CSS Shaders spec.
//
-bool isWebGLBasedSpec(ShShaderSpec spec);
+bool IsWebGLBasedSpec(ShShaderSpec spec);
//
// The base class used to back handles returned to the driver.
@@ -57,7 +54,7 @@ protected:
//
class TCompiler : public TShHandleBase {
public:
- TCompiler(ShShaderType type, ShShaderSpec spec);
+ TCompiler(ShShaderType type, ShShaderSpec spec, ShShaderOutput output);
virtual ~TCompiler();
virtual TCompiler* getAsCompiler() { return this; }
@@ -67,25 +64,31 @@ public:
int compileOptions);
// Get results of the last compilation.
+ int getShaderVersion() const { return shaderVersion; }
TInfoSink& getInfoSink() { return infoSink; }
const TVariableInfoList& getAttribs() const { return attribs; }
const TVariableInfoList& getUniforms() const { return uniforms; }
const TVariableInfoList& getVaryings() const { return varyings; }
- int getMappedNameMaxLength() const;
ShHashFunction64 getHashFunction() const { return hashFunction; }
NameMap& getNameMap() { return nameMap; }
TSymbolTable& getSymbolTable() { return symbolTable; }
+ ShShaderSpec getShaderSpec() const { return shaderSpec; }
+ ShShaderOutput getOutputType() const { return outputType; }
+ std::string getBuiltInResourcesString() const { return builtInResourcesString; }
protected:
ShShaderType getShaderType() const { return shaderType; }
- ShShaderSpec getShaderSpec() const { return shaderSpec; }
// Initialize symbol-table with built-in symbols.
bool InitBuiltInSymbolTable(const ShBuiltInResources& resources);
+ // Compute the string representation of the built-in resources
+ void setResourceString();
// Clears the results from the previous compilation.
void clearResults();
// Return true if function recursion is detected or call depth exceeded.
bool detectCallDepth(TIntermNode* root, TInfoSink& infoSink, bool limitCallStackDepth);
+ // Returns true if a program has no conflicting or missing fragment outputs
+ bool validateOutputs(TIntermNode* root);
// Rewrites a shader's intermediate tree according to the CSS Shaders spec.
void rewriteCSSShader(TIntermNode* root);
// Returns true if the given shader does not exceed the minimum
@@ -93,13 +96,21 @@ protected:
bool validateLimitations(TIntermNode* root);
// Collect info for all attribs, uniforms, varyings.
void collectVariables(TIntermNode* root);
- // Map long variable names into shorter ones.
- void mapLongVariableNames(TIntermNode* root);
// Translate to object code.
virtual void translate(TIntermNode* root) = 0;
// Returns true if, after applying the packing rules in the GLSL 1.017 spec
// Appendix A, section 7, the shader does not use too many uniforms.
bool enforcePackingRestrictions();
+ // Insert statements to initialize varyings without static use in the beginning
+ // of main(). It is to work around a Mac driver where such varyings in a vertex
+ // shader may be optimized out incorrectly at compile time, causing a link failure.
+ // This function should only be applied to vertex shaders.
+ void initializeVaryingsWithoutStaticUse(TIntermNode* root);
+ // Insert gl_Position = vec4(0,0,0,0) to the beginning of main().
+ // It is to work around a Linux driver bug where missing this causes compile failure
+ // while spec says it is allowed.
+ // This function should only be applied to vertex shaders.
+ void initializeGLPosition(TIntermNode* root);
// Returns true if the shader passes the restrictions that aim to prevent timing attacks.
bool enforceTimingRestrictions(TIntermNode* root, bool outputGraph);
// Returns true if the shader does not use samplers.
@@ -107,7 +118,7 @@ protected:
// Returns true if the shader does not use sampler dependent values to affect control
// flow or in operations whose time can depend on the input values.
bool enforceFragmentShaderTimingRestrictions(const TDependencyGraph& graph);
- // Return true if the maximum expression complexity below the limit.
+ // Return true if the maximum expression complexity is below the limit.
bool limitExpressionComplexity(TIntermNode* root);
// Get built-in extensions with default behavior.
const TExtensionBehavior& getExtensionBehavior() const;
@@ -121,12 +132,14 @@ protected:
private:
ShShaderType shaderType;
ShShaderSpec shaderSpec;
+ ShShaderOutput outputType;
int maxUniformVectors;
int maxExpressionComplexity;
int maxCallStackDepth;
ShBuiltInResources compileResources;
+ std::string builtInResourcesString;
// Built-in symbol table for the given language, spec, and resources.
// It is preserved from compile-to-compile.
@@ -140,14 +153,12 @@ private:
BuiltInFunctionEmulator builtInFunctionEmulator;
// Results of compilation.
+ int shaderVersion;
TInfoSink infoSink; // Output sink.
TVariableInfoList attribs; // Active attributes in the compiled shader.
TVariableInfoList uniforms; // Active uniforms in the compiled shader.
TVariableInfoList varyings; // Varyings in the compiled shader.
- // Cached copy of the ref-counted singleton.
- LongNameMap* longNameMap;
-
// name hashing.
ShHashFunction64 hashFunction;
NameMap nameMap;
diff --git a/chromium/third_party/angle/src/compiler/ShaderLang.cpp b/chromium/third_party/angle/src/compiler/translator/ShaderLang.cpp
index 42cd5cc5c15..bf0587a34ce 100644
--- a/chromium/third_party/angle/src/compiler/ShaderLang.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/ShaderLang.cpp
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -11,11 +11,13 @@
#include "GLSLANG/ShaderLang.h"
-#include "compiler/InitializeDll.h"
-#include "compiler/preprocessor/length_limits.h"
-#include "compiler/ShHandle.h"
-#include "compiler/TranslatorHLSL.h"
-#include "compiler/VariablePacker.h"
+#include "compiler/translator/InitializeDll.h"
+#include "compiler/translator/length_limits.h"
+#include "compiler/translator/ShHandle.h"
+#include "compiler/translator/TranslatorHLSL.h"
+#include "compiler/translator/VariablePacker.h"
+
+static bool isInitialized = false;
//
// This is the platform independent interface between an OGL driver
@@ -49,8 +51,11 @@ static bool checkMappedNameMaxLength(const ShHandle handle, size_t expectedValue
//
int ShInitialize()
{
- static const bool kInitialized = InitProcess();
- return kInitialized ? 1 : 0;
+ if (!isInitialized)
+ {
+ isInitialized = InitProcess();
+ }
+ return isInitialized ? 1 : 0;
}
//
@@ -58,7 +63,11 @@ int ShInitialize()
//
int ShFinalize()
{
- DetachProcess();
+ if (isInitialized)
+ {
+ DetachProcess();
+ isInitialized = false;
+ }
return 1;
}
@@ -83,14 +92,24 @@ void ShInitBuiltInResources(ShBuiltInResources* resources)
resources->ARB_texture_rectangle = 0;
resources->EXT_draw_buffers = 0;
resources->EXT_frag_depth = 0;
+ resources->EXT_shader_texture_lod = 0;
// Disable highp precision in fragment shader by default.
resources->FragmentPrecisionHigh = 0;
+ // GLSL ES 3.0 constants.
+ resources->MaxVertexOutputVectors = 16;
+ resources->MaxFragmentInputVectors = 15;
+ resources->MinProgramTexelOffset = -8;
+ resources->MaxProgramTexelOffset = 7;
+
// Disable name hashing by default.
resources->HashFunction = NULL;
resources->ArrayIndexClampingStrategy = SH_CLAMP_WITH_CLAMP_INTRINSIC;
+
+ resources->MaxExpressionComplexity = 256;
+ resources->MaxCallStackDepth = 256;
}
//
@@ -125,8 +144,25 @@ void ShDestruct(ShHandle handle)
DeleteCompiler(base->getAsCompiler());
}
+void ShGetBuiltInResourcesString(const ShHandle handle, size_t outStringLen, char *outString)
+{
+ if (!handle || !outString)
+ {
+ return;
+ }
+
+ TShHandleBase *base = static_cast<TShHandleBase*>(handle);
+ TCompiler *compiler = base->getAsCompiler();
+ if (!compiler)
+ {
+ return;
+ }
+
+ strncpy(outString, compiler->getBuiltInResourcesString().c_str(), outStringLen);
+ outString[outStringLen - 1] = '\0';
+}
//
-// Do an actual compile on the given strings. The result is left
+// Do an actual compile on the given strings. The result is left
// in the given compile object.
//
// Return: The return value of ShCompile is really boolean, indicating
@@ -171,27 +207,27 @@ void ShGetInfo(const ShHandle handle, ShShaderInfo pname, size_t* params)
*params = compiler->getUniforms().size();
break;
case SH_ACTIVE_UNIFORM_MAX_LENGTH:
- *params = 1 + MAX_SYMBOL_NAME_LEN;
+ *params = 1 + GetGlobalMaxTokenSize(compiler->getShaderSpec());
break;
case SH_ACTIVE_ATTRIBUTES:
*params = compiler->getAttribs().size();
break;
case SH_ACTIVE_ATTRIBUTE_MAX_LENGTH:
- *params = 1 + MAX_SYMBOL_NAME_LEN;
+ *params = 1 + GetGlobalMaxTokenSize(compiler->getShaderSpec());
break;
case SH_VARYINGS:
*params = compiler->getVaryings().size();
break;
case SH_VARYING_MAX_LENGTH:
- *params = 1 + MAX_SYMBOL_NAME_LEN;
+ *params = 1 + GetGlobalMaxTokenSize(compiler->getShaderSpec());
break;
case SH_MAPPED_NAME_MAX_LENGTH:
// Use longer length than MAX_SHORTENED_IDENTIFIER_SIZE to
// handle array and struct dereferences.
- *params = 1 + MAX_SYMBOL_NAME_LEN;
+ *params = 1 + GetGlobalMaxTokenSize(compiler->getShaderSpec());
break;
case SH_NAME_MAX_LENGTH:
- *params = 1 + MAX_SYMBOL_NAME_LEN;
+ *params = 1 + GetGlobalMaxTokenSize(compiler->getShaderSpec());
break;
case SH_HASHED_NAME_MAX_LENGTH:
if (compiler->getHashFunction() == NULL) {
@@ -200,12 +236,22 @@ void ShGetInfo(const ShHandle handle, ShShaderInfo pname, size_t* params)
// 64 bits hashing output requires 16 bytes for hex
// representation.
const char HashedNamePrefix[] = HASHED_NAME_PREFIX;
+ (void)HashedNamePrefix;
*params = 16 + sizeof(HashedNamePrefix);
}
break;
case SH_HASHED_NAMES_COUNT:
*params = compiler->getNameMap().size();
break;
+ case SH_SHADER_VERSION:
+ *params = compiler->getShaderVersion();
+ break;
+ case SH_RESOURCES_STRING_LENGTH:
+ *params = compiler->getBuiltInResourcesString().length() + 1;
+ break;
+ case SH_OUTPUT_TYPE:
+ *params = compiler->getOutputType();
+ break;
default: UNREACHABLE();
}
}
@@ -295,14 +341,14 @@ void ShGetVariableInfo(const ShHandle handle,
// This size must match that queried by
// SH_ACTIVE_UNIFORM_MAX_LENGTH, SH_ACTIVE_ATTRIBUTE_MAX_LENGTH, SH_VARYING_MAX_LENGTH
// in ShGetInfo, below.
- size_t variableLength = 1 + MAX_SYMBOL_NAME_LEN;
+ size_t variableLength = 1 + GetGlobalMaxTokenSize(compiler->getShaderSpec());
ASSERT(checkVariableMaxLengths(handle, variableLength));
strncpy(name, varInfo.name.c_str(), variableLength);
name[variableLength - 1] = 0;
if (mappedName) {
// This size must match that queried by
// SH_MAPPED_NAME_MAX_LENGTH in ShGetInfo, below.
- size_t maxMappedNameLength = 1 + MAX_SYMBOL_NAME_LEN;
+ size_t maxMappedNameLength = 1 + GetGlobalMaxTokenSize(compiler->getShaderSpec());
ASSERT(checkMappedNameMaxLength(handle, maxMappedNameLength));
strncpy(mappedName, varInfo.mappedName.c_str(), maxMappedNameLength);
mappedName[maxMappedNameLength - 1] = 0;
@@ -366,6 +412,18 @@ void ShGetInfoPointer(const ShHandle handle, ShShaderInfo pname, void** params)
case SH_ACTIVE_UNIFORMS_ARRAY:
*params = (void*)&translator->getUniforms();
break;
+ case SH_ACTIVE_INTERFACE_BLOCKS_ARRAY:
+ *params = (void*)&translator->getInterfaceBlocks();
+ break;
+ case SH_ACTIVE_OUTPUT_VARIABLES_ARRAY:
+ *params = (void*)&translator->getOutputVariables();
+ break;
+ case SH_ACTIVE_ATTRIBUTES_ARRAY:
+ *params = (void*)&translator->getAttributes();
+ break;
+ case SH_ACTIVE_VARYINGS_ARRAY:
+ *params = (void*)&translator->getVaryings();
+ break;
default: UNREACHABLE();
}
}
diff --git a/chromium/third_party/angle/src/compiler/translator/SymbolTable.cpp b/chromium/third_party/angle/src/compiler/translator/SymbolTable.cpp
new file mode 100644
index 00000000000..aa5933d3e9a
--- /dev/null
+++ b/chromium/third_party/angle/src/compiler/translator/SymbolTable.cpp
@@ -0,0 +1,241 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+//
+// Symbol table for parsing. Most functionaliy and main ideas
+// are documented in the header file.
+//
+
+#if defined(_MSC_VER)
+#pragma warning(disable: 4718)
+#endif
+
+#include "compiler/translator/SymbolTable.h"
+
+#include <stdio.h>
+#include <algorithm>
+
+int TSymbolTable::uniqueIdCounter = 0;
+
+//
+// Functions have buried pointers to delete.
+//
+TFunction::~TFunction()
+{
+ for (TParamList::iterator i = parameters.begin(); i != parameters.end(); ++i)
+ delete (*i).type;
+}
+
+//
+// Symbol table levels are a map of pointers to symbols that have to be deleted.
+//
+TSymbolTableLevel::~TSymbolTableLevel()
+{
+ for (tLevel::iterator it = level.begin(); it != level.end(); ++it)
+ delete (*it).second;
+}
+
+bool TSymbolTableLevel::insert(const TString &name, TSymbol &symbol)
+{
+ symbol.setUniqueId(TSymbolTable::nextUniqueId());
+
+ // returning true means symbol was added to the table
+ tInsertResult result = level.insert(tLevelPair(name, &symbol));
+
+ return result.second;
+}
+
+bool TSymbolTableLevel::insert(TSymbol &symbol)
+{
+ return insert(symbol.getMangledName(), symbol);
+}
+
+TSymbol *TSymbolTableLevel::find(const TString &name) const
+{
+ tLevel::const_iterator it = level.find(name);
+ if (it == level.end())
+ return 0;
+ else
+ return (*it).second;
+}
+
+//
+// Change all function entries in the table with the non-mangled name
+// to be related to the provided built-in operation. This is a low
+// performance operation, and only intended for symbol tables that
+// live across a large number of compiles.
+//
+void TSymbolTableLevel::relateToOperator(const char *name, TOperator op)
+{
+ for (tLevel::iterator it = level.begin(); it != level.end(); ++it)
+ {
+ if ((*it).second->isFunction())
+ {
+ TFunction *function = static_cast<TFunction*>((*it).second);
+ if (function->getName() == name)
+ function->relateToOperator(op);
+ }
+ }
+}
+
+//
+// Change all function entries in the table with the non-mangled name
+// to be related to the provided built-in extension. This is a low
+// performance operation, and only intended for symbol tables that
+// live across a large number of compiles.
+//
+void TSymbolTableLevel::relateToExtension(const char *name, const TString &ext)
+{
+ for (tLevel::iterator it = level.begin(); it != level.end(); ++it)
+ {
+ TSymbol *symbol = it->second;
+ if (symbol->getName() == name)
+ symbol->relateToExtension(ext);
+ }
+}
+
+TSymbol::TSymbol(const TSymbol &copyOf)
+{
+ name = NewPoolTString(copyOf.name->c_str());
+ uniqueId = copyOf.uniqueId;
+}
+
+TSymbol *TSymbolTable::find(const TString &name, int shaderVersion, bool *builtIn, bool *sameScope)
+{
+ int level = currentLevel();
+ TSymbol *symbol;
+
+ do
+ {
+ if (level == ESSL3_BUILTINS && shaderVersion != 300)
+ level--;
+ if (level == ESSL1_BUILTINS && shaderVersion != 100)
+ level--;
+
+ symbol = table[level]->find(name);
+ }
+ while (symbol == 0 && --level >= 0);
+
+ if (builtIn)
+ *builtIn = (level <= LAST_BUILTIN_LEVEL);
+ if (sameScope)
+ *sameScope = (level == currentLevel());
+
+ return symbol;
+}
+
+TSymbol *TSymbolTable::findBuiltIn(const TString &name, int shaderVersion)
+{
+ for (int level = LAST_BUILTIN_LEVEL; level >= 0; level--)
+ {
+ if (level == ESSL3_BUILTINS && shaderVersion != 300)
+ level--;
+ if (level == ESSL1_BUILTINS && shaderVersion != 100)
+ level--;
+
+ TSymbol *symbol = table[level]->find(name);
+
+ if (symbol)
+ return symbol;
+ }
+
+ return 0;
+}
+
+TSymbolTable::~TSymbolTable()
+{
+ while (table.size() > 0)
+ pop();
+}
+
+void TSymbolTable::insertBuiltIn(
+ ESymbolLevel level, TType *rvalue, const char *name,
+ TType *ptype1, TType *ptype2, TType *ptype3, TType *ptype4, TType *ptype5)
+{
+ if (ptype1->getBasicType() == EbtGSampler2D)
+ {
+ bool gvec4 = (rvalue->getBasicType() == EbtGVec4);
+ insertBuiltIn(level, gvec4 ? new TType(EbtFloat, 4) : rvalue, name,
+ new TType(EbtSampler2D), ptype2, ptype3, ptype4, ptype5);
+ insertBuiltIn(level, gvec4 ? new TType(EbtInt, 4) : rvalue, name,
+ new TType(EbtISampler2D), ptype2, ptype3, ptype4, ptype5);
+ insertBuiltIn(level, gvec4 ? new TType(EbtUInt, 4) : rvalue, name,
+ new TType(EbtUSampler2D), ptype2, ptype3, ptype4, ptype5);
+ return;
+ }
+ if (ptype1->getBasicType() == EbtGSampler3D)
+ {
+ bool gvec4 = (rvalue->getBasicType() == EbtGVec4);
+ insertBuiltIn(level, gvec4 ? new TType(EbtFloat, 4) : rvalue, name,
+ new TType(EbtSampler3D), ptype2, ptype3, ptype4, ptype5);
+ insertBuiltIn(level, gvec4 ? new TType(EbtInt, 4) : rvalue, name,
+ new TType(EbtISampler3D), ptype2, ptype3, ptype4, ptype5);
+ insertBuiltIn(level, gvec4 ? new TType(EbtUInt, 4) : rvalue, name,
+ new TType(EbtUSampler3D), ptype2, ptype3, ptype4, ptype5);
+ return;
+ }
+ if (ptype1->getBasicType() == EbtGSamplerCube)
+ {
+ bool gvec4 = (rvalue->getBasicType() == EbtGVec4);
+ insertBuiltIn(level, gvec4 ? new TType(EbtFloat, 4) : rvalue, name,
+ new TType(EbtSamplerCube), ptype2, ptype3, ptype4, ptype5);
+ insertBuiltIn(level, gvec4 ? new TType(EbtInt, 4) : rvalue, name,
+ new TType(EbtISamplerCube), ptype2, ptype3, ptype4, ptype5);
+ insertBuiltIn(level, gvec4 ? new TType(EbtUInt, 4) : rvalue, name,
+ new TType(EbtUSamplerCube), ptype2, ptype3, ptype4, ptype5);
+ return;
+ }
+ if (ptype1->getBasicType() == EbtGSampler2DArray)
+ {
+ bool gvec4 = (rvalue->getBasicType() == EbtGVec4);
+ insertBuiltIn(level, gvec4 ? new TType(EbtFloat, 4) : rvalue, name,
+ new TType(EbtSampler2DArray), ptype2, ptype3, ptype4, ptype5);
+ insertBuiltIn(level, gvec4 ? new TType(EbtInt, 4) : rvalue, name,
+ new TType(EbtISampler2DArray), ptype2, ptype3, ptype4, ptype5);
+ insertBuiltIn(level, gvec4 ? new TType(EbtUInt, 4) : rvalue, name,
+ new TType(EbtUSampler2DArray), ptype2, ptype3, ptype4, ptype5);
+ return;
+ }
+
+ TFunction *function = new TFunction(NewPoolTString(name), *rvalue);
+
+ TType *types[] = {ptype1, ptype2, ptype3, ptype4, ptype5};
+ for (size_t ii = 0; ii < sizeof(types) / sizeof(types[0]); ++ii)
+ {
+ if (types[ii])
+ {
+ TParameter param = {NULL, types[ii]};
+ function->addParameter(param);
+ }
+ }
+
+ insert(level, *function);
+}
+
+TPrecision TSymbolTable::getDefaultPrecision(TBasicType type)
+{
+ if (!SupportsPrecision(type))
+ return EbpUndefined;
+
+ // unsigned integers use the same precision as signed
+ TBasicType baseType = (type == EbtUInt) ? EbtInt : type;
+
+ int level = static_cast<int>(precisionStack.size()) - 1;
+ assert(level >= 0); // Just to be safe. Should not happen.
+ // If we dont find anything we return this. Should we error check this?
+ TPrecision prec = EbpUndefined;
+ while (level >= 0)
+ {
+ PrecisionStackLevel::iterator it = precisionStack[level]->find(baseType);
+ if (it != precisionStack[level]->end())
+ {
+ prec = (*it).second;
+ break;
+ }
+ level--;
+ }
+ return prec;
+}
diff --git a/chromium/third_party/angle/src/compiler/translator/SymbolTable.h b/chromium/third_party/angle/src/compiler/translator/SymbolTable.h
new file mode 100644
index 00000000000..3f932a45432
--- /dev/null
+++ b/chromium/third_party/angle/src/compiler/translator/SymbolTable.h
@@ -0,0 +1,431 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef _SYMBOL_TABLE_INCLUDED_
+#define _SYMBOL_TABLE_INCLUDED_
+
+//
+// Symbol table for parsing. Has these design characteristics:
+//
+// * Same symbol table can be used to compile many shaders, to preserve
+// effort of creating and loading with the large numbers of built-in
+// symbols.
+//
+// * Name mangling will be used to give each function a unique name
+// so that symbol table lookups are never ambiguous. This allows
+// a simpler symbol table structure.
+//
+// * Pushing and popping of scope, so symbol table will really be a stack
+// of symbol tables. Searched from the top, with new inserts going into
+// the top.
+//
+// * Constants: Compile time constant symbols will keep their values
+// in the symbol table. The parser can substitute constants at parse
+// time, including doing constant folding and constant propagation.
+//
+// * No temporaries: Temporaries made from operations (+, --, .xy, etc.)
+// are tracked in the intermediate representation, not the symbol table.
+//
+
+#include <assert.h>
+
+#include "common/angleutils.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/intermediate.h"
+
+// Symbol base class. (Can build functions or variables out of these...)
+class TSymbol
+{
+ public:
+ POOL_ALLOCATOR_NEW_DELETE();
+ TSymbol(const TString *n)
+ : uniqueId(0),
+ name(n)
+ {
+ }
+ virtual ~TSymbol()
+ {
+ // don't delete name, it's from the pool
+ }
+
+ const TString &getName() const
+ {
+ return *name;
+ }
+ virtual const TString &getMangledName() const
+ {
+ return getName();
+ }
+ virtual bool isFunction() const
+ {
+ return false;
+ }
+ virtual bool isVariable() const
+ {
+ return false;
+ }
+ void setUniqueId(int id)
+ {
+ uniqueId = id;
+ }
+ int getUniqueId() const
+ {
+ return uniqueId;
+ }
+ void relateToExtension(const TString &ext)
+ {
+ extension = ext;
+ }
+ const TString &getExtension() const
+ {
+ return extension;
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TSymbol);
+
+ int uniqueId; // For real comparing during code generation
+ const TString *name;
+ TString extension;
+};
+
+// Variable class, meaning a symbol that's not a function.
+//
+// There could be a separate class heirarchy for Constant variables;
+// Only one of int, bool, or float, (or none) is correct for
+// any particular use, but it's easy to do this way, and doesn't
+// seem worth having separate classes, and "getConst" can't simply return
+// different values for different types polymorphically, so this is
+// just simple and pragmatic.
+class TVariable : public TSymbol
+{
+ public:
+ TVariable(const TString *name, const TType &t, bool uT = false)
+ : TSymbol(name),
+ type(t),
+ userType(uT),
+ unionArray(0)
+ {
+ }
+ virtual ~TVariable()
+ {
+ }
+ virtual bool isVariable() const
+ {
+ return true;
+ }
+ TType &getType()
+ {
+ return type;
+ }
+ const TType &getType() const
+ {
+ return type;
+ }
+ bool isUserType() const
+ {
+ return userType;
+ }
+ void setQualifier(TQualifier qualifier)
+ {
+ type.setQualifier(qualifier);
+ }
+
+ ConstantUnion *getConstPointer()
+ {
+ if (!unionArray)
+ unionArray = new ConstantUnion[type.getObjectSize()];
+
+ return unionArray;
+ }
+
+ ConstantUnion *getConstPointer() const
+ {
+ return unionArray;
+ }
+
+ void shareConstPointer(ConstantUnion *constArray)
+ {
+ if (unionArray == constArray)
+ return;
+
+ delete[] unionArray;
+ unionArray = constArray;
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TVariable);
+
+ TType type;
+ bool userType;
+ // we are assuming that Pool Allocator will free the memory
+ // allocated to unionArray when this object is destroyed.
+ ConstantUnion *unionArray;
+};
+
+// The function sub-class of symbols and the parser will need to
+// share this definition of a function parameter.
+struct TParameter
+{
+ TString *name;
+ TType *type;
+};
+
+// The function sub-class of a symbol.
+class TFunction : public TSymbol
+{
+ public:
+ TFunction(TOperator o)
+ : TSymbol(0),
+ returnType(TType(EbtVoid, EbpUndefined)),
+ op(o),
+ defined(false)
+ {
+ }
+ TFunction(const TString *name, TType &retType, TOperator tOp = EOpNull)
+ : TSymbol(name),
+ returnType(retType),
+ mangledName(TFunction::mangleName(*name)),
+ op(tOp),
+ defined(false)
+ {
+ }
+ virtual ~TFunction();
+ virtual bool isFunction() const
+ {
+ return true;
+ }
+
+ static TString mangleName(const TString &name)
+ {
+ return name + '(';
+ }
+ static TString unmangleName(const TString &mangledName)
+ {
+ return TString(mangledName.c_str(), mangledName.find_first_of('('));
+ }
+
+ void addParameter(TParameter &p)
+ {
+ parameters.push_back(p);
+ mangledName = mangledName + p.type->getMangledName();
+ }
+
+ const TString &getMangledName() const
+ {
+ return mangledName;
+ }
+ const TType &getReturnType() const
+ {
+ return returnType;
+ }
+
+ void relateToOperator(TOperator o)
+ {
+ op = o;
+ }
+ TOperator getBuiltInOp() const
+ {
+ return op;
+ }
+
+ void setDefined()
+ {
+ defined = true;
+ }
+ bool isDefined()
+ {
+ return defined;
+ }
+
+ size_t getParamCount() const
+ {
+ return parameters.size();
+ }
+ const TParameter &getParam(size_t i) const
+ {
+ return parameters[i];
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TFunction);
+
+ typedef TVector<TParameter> TParamList;
+ TParamList parameters;
+ TType returnType;
+ TString mangledName;
+ TOperator op;
+ bool defined;
+};
+
+// Interface block name sub-symbol
+class TInterfaceBlockName : public TSymbol
+{
+ public:
+ TInterfaceBlockName(const TString *name)
+ : TSymbol(name)
+ {
+ }
+
+ virtual ~TInterfaceBlockName()
+ {
+ }
+};
+
+class TSymbolTableLevel
+{
+ public:
+ typedef TMap<TString, TSymbol *> tLevel;
+ typedef tLevel::const_iterator const_iterator;
+ typedef const tLevel::value_type tLevelPair;
+ typedef std::pair<tLevel::iterator, bool> tInsertResult;
+
+ TSymbolTableLevel()
+ {
+ }
+ ~TSymbolTableLevel();
+
+ bool insert(const TString &name, TSymbol &symbol);
+ bool insert(TSymbol &symbol);
+
+ TSymbol *find(const TString &name) const;
+
+ void relateToOperator(const char *name, TOperator op);
+ void relateToExtension(const char *name, const TString &ext);
+
+ protected:
+ tLevel level;
+ static int uniqueId; // for unique identification in code generation
+};
+
+enum ESymbolLevel
+{
+ COMMON_BUILTINS = 0,
+ ESSL1_BUILTINS = 1,
+ ESSL3_BUILTINS = 2,
+ LAST_BUILTIN_LEVEL = ESSL3_BUILTINS,
+ GLOBAL_LEVEL = 3
+};
+
+class TSymbolTable
+{
+ public:
+ TSymbolTable()
+ {
+ // The symbol table cannot be used until push() is called, but
+ // the lack of an initial call to push() can be used to detect
+ // that the symbol table has not been preloaded with built-ins.
+ }
+
+ ~TSymbolTable();
+
+ // When the symbol table is initialized with the built-ins, there should
+ // 'push' calls, so that built-ins are at level 0 and the shader
+ // globals are at level 1.
+ bool isEmpty()
+ {
+ return table.empty();
+ }
+ bool atBuiltInLevel()
+ {
+ return currentLevel() <= LAST_BUILTIN_LEVEL;
+ }
+ bool atGlobalLevel()
+ {
+ return currentLevel() <= GLOBAL_LEVEL;
+ }
+ void push()
+ {
+ table.push_back(new TSymbolTableLevel);
+ precisionStack.push_back(new PrecisionStackLevel);
+ }
+
+ void pop()
+ {
+ delete table.back();
+ table.pop_back();
+
+ delete precisionStack.back();
+ precisionStack.pop_back();
+ }
+
+ bool declare(TSymbol &symbol)
+ {
+ return insert(currentLevel(), symbol);
+ }
+
+ bool insert(ESymbolLevel level, TSymbol &symbol)
+ {
+ return table[level]->insert(symbol);
+ }
+
+ bool insertConstInt(ESymbolLevel level, const char *name, int value)
+ {
+ TVariable *constant = new TVariable(
+ NewPoolTString(name), TType(EbtInt, EbpUndefined, EvqConst, 1));
+ constant->getConstPointer()->setIConst(value);
+ return insert(level, *constant);
+ }
+
+ void insertBuiltIn(ESymbolLevel level, TType *rvalue, const char *name,
+ TType *ptype1, TType *ptype2 = 0, TType *ptype3 = 0,
+ TType *ptype4 = 0, TType *ptype5 = 0);
+
+ TSymbol *find(const TString &name, int shaderVersion,
+ bool *builtIn = NULL, bool *sameScope = NULL);
+ TSymbol *findBuiltIn(const TString &name, int shaderVersion);
+
+ TSymbolTableLevel *getOuterLevel()
+ {
+ assert(currentLevel() >= 1);
+ return table[currentLevel() - 1];
+ }
+
+ void relateToOperator(ESymbolLevel level, const char *name, TOperator op)
+ {
+ table[level]->relateToOperator(name, op);
+ }
+ void relateToExtension(ESymbolLevel level, const char *name, const TString &ext)
+ {
+ table[level]->relateToExtension(name, ext);
+ }
+ void dump(TInfoSink &infoSink) const;
+
+ bool setDefaultPrecision(const TPublicType &type, TPrecision prec)
+ {
+ if (!SupportsPrecision(type.type))
+ return false;
+ if (type.isAggregate())
+ return false; // Not allowed to set for aggregate types
+ int indexOfLastElement = static_cast<int>(precisionStack.size()) - 1;
+ // Uses map operator [], overwrites the current value
+ (*precisionStack[indexOfLastElement])[type.type] = prec;
+ return true;
+ }
+
+ // Searches down the precisionStack for a precision qualifier
+ // for the specified TBasicType
+ TPrecision getDefaultPrecision(TBasicType type);
+
+ static int nextUniqueId()
+ {
+ return ++uniqueIdCounter;
+ }
+
+ private:
+ ESymbolLevel currentLevel() const
+ {
+ return static_cast<ESymbolLevel>(table.size() - 1);
+ }
+
+ std::vector<TSymbolTableLevel *> table;
+ typedef TMap<TBasicType, TPrecision> PrecisionStackLevel;
+ std::vector< PrecisionStackLevel *> precisionStack;
+
+ static int uniqueIdCounter;
+};
+
+#endif // _SYMBOL_TABLE_INCLUDED_
diff --git a/chromium/third_party/angle/src/compiler/TranslatorESSL.cpp b/chromium/third_party/angle/src/compiler/translator/TranslatorESSL.cpp
index 2900f8a8ede..c956e29c5be 100644
--- a/chromium/third_party/angle/src/compiler/TranslatorESSL.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/TranslatorESSL.cpp
@@ -1,15 +1,15 @@
//
-// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-#include "compiler/TranslatorESSL.h"
+#include "compiler/translator/TranslatorESSL.h"
-#include "compiler/OutputESSL.h"
+#include "compiler/translator/OutputESSL.h"
TranslatorESSL::TranslatorESSL(ShShaderType type, ShShaderSpec spec)
- : TCompiler(type, spec) {
+ : TCompiler(type, spec, SH_ESSL_OUTPUT) {
}
void TranslatorESSL::translate(TIntermNode* root) {
@@ -26,7 +26,7 @@ void TranslatorESSL::translate(TIntermNode* root) {
getArrayBoundsClamper().OutputClampingFunctionDefinition(sink);
// Write translated shader.
- TOutputESSL outputESSL(sink, getArrayIndexClampingStrategy(), getHashFunction(), getNameMap(), getSymbolTable());
+ TOutputESSL outputESSL(sink, getArrayIndexClampingStrategy(), getHashFunction(), getNameMap(), getSymbolTable(), getShaderVersion());
root->traverse(&outputESSL);
}
diff --git a/chromium/third_party/angle/src/compiler/TranslatorESSL.h b/chromium/third_party/angle/src/compiler/translator/TranslatorESSL.h
index a1196bd0013..e18f3c25ec8 100644
--- a/chromium/third_party/angle/src/compiler/TranslatorESSL.h
+++ b/chromium/third_party/angle/src/compiler/translator/TranslatorESSL.h
@@ -7,7 +7,7 @@
#ifndef COMPILER_TRANSLATORESSL_H_
#define COMPILER_TRANSLATORESSL_H_
-#include "compiler/ShHandle.h"
+#include "compiler/translator/ShHandle.h"
class TranslatorESSL : public TCompiler {
public:
diff --git a/chromium/third_party/angle/src/compiler/TranslatorGLSL.cpp b/chromium/third_party/angle/src/compiler/translator/TranslatorGLSL.cpp
index 7ca4341dcde..749d8377f0c 100644
--- a/chromium/third_party/angle/src/compiler/TranslatorGLSL.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/TranslatorGLSL.cpp
@@ -1,13 +1,13 @@
//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-#include "compiler/TranslatorGLSL.h"
+#include "compiler/translator/TranslatorGLSL.h"
-#include "compiler/OutputGLSL.h"
-#include "compiler/VersionGLSL.h"
+#include "compiler/translator/OutputGLSL.h"
+#include "compiler/translator/VersionGLSL.h"
static void writeVersion(ShShaderType type, TIntermNode* root,
TInfoSinkBase& sink) {
@@ -22,7 +22,7 @@ static void writeVersion(ShShaderType type, TIntermNode* root,
}
TranslatorGLSL::TranslatorGLSL(ShShaderType type, ShShaderSpec spec)
- : TCompiler(type, spec) {
+ : TCompiler(type, spec, SH_GLSL_OUTPUT) {
}
void TranslatorGLSL::translate(TIntermNode* root) {
@@ -31,6 +31,9 @@ void TranslatorGLSL::translate(TIntermNode* root) {
// Write GLSL version.
writeVersion(getShaderType(), root, sink);
+ // Write extension behaviour as needed
+ writeExtensionBehavior();
+
// Write emulated built-in functions if needed.
getBuiltInFunctionEmulator().OutputEmulatedFunctionDefinition(
sink, false);
@@ -39,6 +42,23 @@ void TranslatorGLSL::translate(TIntermNode* root) {
getArrayBoundsClamper().OutputClampingFunctionDefinition(sink);
// Write translated shader.
- TOutputGLSL outputGLSL(sink, getArrayIndexClampingStrategy(), getHashFunction(), getNameMap(), getSymbolTable());
+ TOutputGLSL outputGLSL(sink, getArrayIndexClampingStrategy(), getHashFunction(), getNameMap(), getSymbolTable(), getShaderVersion());
root->traverse(&outputGLSL);
}
+
+void TranslatorGLSL::writeExtensionBehavior() {
+ TInfoSinkBase& sink = getInfoSink().obj;
+ const TExtensionBehavior& extensionBehavior = getExtensionBehavior();
+ for (TExtensionBehavior::const_iterator iter = extensionBehavior.begin();
+ iter != extensionBehavior.end(); ++iter) {
+ if (iter->second == EBhUndefined)
+ continue;
+
+ // For GLSL output, we don't need to emit most extensions explicitly,
+ // but some we need to translate.
+ if (iter->first == "GL_EXT_shader_texture_lod") {
+ sink << "#extension GL_ARB_shader_texture_lod : "
+ << getBehaviorString(iter->second) << "\n";
+ }
+ }
+}
diff --git a/chromium/third_party/angle/src/compiler/TranslatorGLSL.h b/chromium/third_party/angle/src/compiler/translator/TranslatorGLSL.h
index c2ce06d192f..1e16b2605e4 100644
--- a/chromium/third_party/angle/src/compiler/TranslatorGLSL.h
+++ b/chromium/third_party/angle/src/compiler/translator/TranslatorGLSL.h
@@ -7,7 +7,7 @@
#ifndef COMPILER_TRANSLATORGLSL_H_
#define COMPILER_TRANSLATORGLSL_H_
-#include "compiler/ShHandle.h"
+#include "compiler/translator/ShHandle.h"
class TranslatorGLSL : public TCompiler {
public:
@@ -15,6 +15,9 @@ public:
protected:
virtual void translate(TIntermNode* root);
+
+private:
+ void writeExtensionBehavior();
};
#endif // COMPILER_TRANSLATORGLSL_H_
diff --git a/chromium/third_party/angle/src/compiler/translator/TranslatorHLSL.cpp b/chromium/third_party/angle/src/compiler/translator/TranslatorHLSL.cpp
new file mode 100644
index 00000000000..da6f9801ad0
--- /dev/null
+++ b/chromium/third_party/angle/src/compiler/translator/TranslatorHLSL.cpp
@@ -0,0 +1,29 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/translator/TranslatorHLSL.h"
+
+#include "compiler/translator/InitializeParseContext.h"
+#include "compiler/translator/OutputHLSL.h"
+
+TranslatorHLSL::TranslatorHLSL(ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
+ : TCompiler(type, spec, output)
+{
+}
+
+void TranslatorHLSL::translate(TIntermNode *root)
+{
+ TParseContext& parseContext = *GetGlobalParseContext();
+ sh::OutputHLSL outputHLSL(parseContext, getResources(), getOutputType());
+
+ outputHLSL.output();
+
+ mActiveUniforms = outputHLSL.getUniforms();
+ mActiveInterfaceBlocks = outputHLSL.getInterfaceBlocks();
+ mActiveOutputVariables = outputHLSL.getOutputVariables();
+ mActiveAttributes = outputHLSL.getAttributes();
+ mActiveVaryings = outputHLSL.getVaryings();
+}
diff --git a/chromium/third_party/angle/src/compiler/translator/TranslatorHLSL.h b/chromium/third_party/angle/src/compiler/translator/TranslatorHLSL.h
new file mode 100644
index 00000000000..8b16587b6b1
--- /dev/null
+++ b/chromium/third_party/angle/src/compiler/translator/TranslatorHLSL.h
@@ -0,0 +1,34 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATORHLSL_H_
+#define COMPILER_TRANSLATORHLSL_H_
+
+#include "compiler/translator/ShHandle.h"
+#include "common/shadervars.h"
+
+class TranslatorHLSL : public TCompiler {
+public:
+ TranslatorHLSL(ShShaderType type, ShShaderSpec spec, ShShaderOutput output);
+
+ virtual TranslatorHLSL *getAsTranslatorHLSL() { return this; }
+ const std::vector<gl::Uniform> &getUniforms() { return mActiveUniforms; }
+ const std::vector<gl::InterfaceBlock> &getInterfaceBlocks() const { return mActiveInterfaceBlocks; }
+ const std::vector<gl::Attribute> &getOutputVariables() { return mActiveOutputVariables; }
+ const std::vector<gl::Attribute> &getAttributes() { return mActiveAttributes; }
+ const std::vector<gl::Varying> &getVaryings() { return mActiveVaryings; }
+
+protected:
+ virtual void translate(TIntermNode* root);
+
+ std::vector<gl::Uniform> mActiveUniforms;
+ std::vector<gl::InterfaceBlock> mActiveInterfaceBlocks;
+ std::vector<gl::Attribute> mActiveOutputVariables;
+ std::vector<gl::Attribute> mActiveAttributes;
+ std::vector<gl::Varying> mActiveVaryings;
+};
+
+#endif // COMPILER_TRANSLATORHLSL_H_
diff --git a/chromium/third_party/angle/src/compiler/translator/Types.cpp b/chromium/third_party/angle/src/compiler/translator/Types.cpp
new file mode 100644
index 00000000000..4763920f86e
--- /dev/null
+++ b/chromium/third_party/angle/src/compiler/translator/Types.cpp
@@ -0,0 +1,250 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#if defined(_MSC_VER)
+#pragma warning(disable: 4718)
+#endif
+
+#include "compiler/translator/Types.h"
+
+#include <algorithm>
+#include <climits>
+
+TType::TType(const TPublicType &p)
+ : type(p.type), precision(p.precision), qualifier(p.qualifier), layoutQualifier(p.layoutQualifier),
+ primarySize(p.primarySize), secondarySize(p.secondarySize), array(p.array), arraySize(p.arraySize),
+ interfaceBlock(0), structure(0)
+{
+ if (p.userDef)
+ structure = p.userDef->getStruct();
+}
+
+bool TType::equals(const TType &other) const
+{
+ if (type != other.type || precision != other.precision ||
+ primarySize != other.primarySize || secondarySize != other.secondarySize ||
+ array != other.array || (array && arraySize != other.arraySize) ||
+ interfaceBlock != other.interfaceBlock || structure != other.structure)
+ {
+ return false;
+ }
+ if (interfaceBlock && !interfaceBlock->equals(*(other.interfaceBlock)))
+ return false;
+ if (structure && !structure->equals(*(other.structure)))
+ return false;
+ return true;
+}
+
+bool TField::equals(const TField &other) const
+{
+ ASSERT(mType && mName);
+ ASSERT(other.mType && other.mName);
+ return mType->equals(*(other.mType)) && *mName == *(other.mName);
+}
+
+bool TFieldListCollection::equals(const TFieldListCollection &other) const
+{
+ ASSERT(mName && mFields);
+ ASSERT(other.mName && other.mFields);
+ if (*mName != *(other.mName))
+ return false;
+ if (mFields->size() != other.mFields->size())
+ return false;
+ for (size_t ii = 0; ii < mFields->size(); ++ii)
+ {
+ ASSERT((*mFields)[ii] && (*(other.mFields))[ii]);
+ if (!(*mFields)[ii]->equals(*((*(other.mFields))[ii])))
+ return false;
+ }
+ return true;
+}
+
+bool TStructure::equals(const TStructure &other) const
+{
+ return TFieldListCollection::equals(other);
+}
+
+bool TInterfaceBlock::equals(const TInterfaceBlock &other) const
+{
+ if (!TFieldListCollection::equals(other))
+ return false;
+ // TODO(zmo): do we need to consider mBlockStorage and mMatrixPacking?
+ return mArraySize == other.mArraySize;
+}
+
+//
+// Recursively generate mangled names.
+//
+TString TType::buildMangledName() const
+{
+ TString mangledName;
+ if (isMatrix())
+ mangledName += 'm';
+ else if (isVector())
+ mangledName += 'v';
+
+ switch (type)
+ {
+ case EbtFloat:
+ mangledName += 'f';
+ break;
+ case EbtInt:
+ mangledName += 'i';
+ break;
+ case EbtUInt:
+ mangledName += 'u';
+ break;
+ case EbtBool:
+ mangledName += 'b';
+ break;
+ case EbtSampler2D:
+ mangledName += "s2";
+ break;
+ case EbtSampler3D:
+ mangledName += "s3";
+ break;
+ case EbtSamplerCube:
+ mangledName += "sC";
+ break;
+ case EbtSampler2DArray:
+ mangledName += "s2a";
+ break;
+ case EbtSamplerExternalOES:
+ mangledName += "sext";
+ break;
+ case EbtSampler2DRect:
+ mangledName += "s2r";
+ break;
+ case EbtISampler2D:
+ mangledName += "is2";
+ break;
+ case EbtISampler3D:
+ mangledName += "is3";
+ break;
+ case EbtISamplerCube:
+ mangledName += "isC";
+ break;
+ case EbtISampler2DArray:
+ mangledName += "is2a";
+ break;
+ case EbtUSampler2D:
+ mangledName += "us2";
+ break;
+ case EbtUSampler3D:
+ mangledName += "us3";
+ break;
+ case EbtUSamplerCube:
+ mangledName += "usC";
+ break;
+ case EbtUSampler2DArray:
+ mangledName += "us2a";
+ break;
+ case EbtSampler2DShadow:
+ mangledName += "s2s";
+ break;
+ case EbtSamplerCubeShadow:
+ mangledName += "sCs";
+ break;
+ case EbtSampler2DArrayShadow:
+ mangledName += "s2as";
+ break;
+ case EbtStruct:
+ mangledName += structure->mangledName();
+ break;
+ case EbtInterfaceBlock:
+ mangledName += interfaceBlock->mangledName();
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ if (isMatrix())
+ {
+ mangledName += static_cast<char>('0' + getCols());
+ mangledName += static_cast<char>('x');
+ mangledName += static_cast<char>('0' + getRows());
+ }
+ else
+ {
+ mangledName += static_cast<char>('0' + getNominalSize());
+ }
+
+ if (isArray())
+ {
+ char buf[20];
+ snprintf(buf, sizeof(buf), "%d", arraySize);
+ mangledName += '[';
+ mangledName += buf;
+ mangledName += ']';
+ }
+ return mangledName;
+}
+
+size_t TType::getObjectSize() const
+{
+ size_t totalSize;
+
+ if (getBasicType() == EbtStruct)
+ totalSize = structure->objectSize();
+ else
+ totalSize = primarySize * secondarySize;
+
+ if (isArray())
+ {
+ size_t arraySize = getArraySize();
+ if (arraySize > INT_MAX / totalSize)
+ totalSize = INT_MAX;
+ else
+ totalSize *= arraySize;
+ }
+
+ return totalSize;
+}
+
+bool TStructure::containsArrays() const
+{
+ for (size_t i = 0; i < mFields->size(); ++i)
+ {
+ const TType *fieldType = (*mFields)[i]->type();
+ if (fieldType->isArray() || fieldType->isStructureContainingArrays())
+ return true;
+ }
+ return false;
+}
+
+TString TFieldListCollection::buildMangledName() const
+{
+ TString mangledName(mangledNamePrefix());
+ mangledName += *mName;
+ for (size_t i = 0; i < mFields->size(); ++i)
+ {
+ mangledName += '-';
+ mangledName += (*mFields)[i]->type()->getMangledName();
+ }
+ return mangledName;
+}
+
+size_t TFieldListCollection::calculateObjectSize() const
+{
+ size_t size = 0;
+ for (size_t i = 0; i < mFields->size(); ++i)
+ {
+ size_t fieldSize = (*mFields)[i]->type()->getObjectSize();
+ if (fieldSize > INT_MAX - size)
+ size = INT_MAX;
+ else
+ size += fieldSize;
+ }
+ return size;
+}
+
+int TStructure::calculateDeepestNesting() const
+{
+ int maxNesting = 0;
+ for (size_t i = 0; i < mFields->size(); ++i)
+ maxNesting = std::max(maxNesting, (*mFields)[i]->type()->getDeepestStructNesting());
+ return 1 + maxNesting;
+}
diff --git a/chromium/third_party/angle/src/compiler/translator/Types.h b/chromium/third_party/angle/src/compiler/translator/Types.h
new file mode 100644
index 00000000000..76297202a56
--- /dev/null
+++ b/chromium/third_party/angle/src/compiler/translator/Types.h
@@ -0,0 +1,586 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef _TYPES_INCLUDED
+#define _TYPES_INCLUDED
+
+#include "common/angleutils.h"
+
+#include "compiler/translator/BaseTypes.h"
+#include "compiler/translator/Common.h"
+#include "compiler/translator/compilerdebug.h"
+
+struct TPublicType;
+class TType;
+class TSymbol;
+
+class TField
+{
+ public:
+ POOL_ALLOCATOR_NEW_DELETE();
+ TField(TType *type, TString *name, const TSourceLoc &line)
+ : mType(type),
+ mName(name),
+ mLine(line)
+ {
+ }
+
+ // TODO(alokp): We should only return const type.
+ // Fix it by tweaking grammar.
+ TType *type()
+ {
+ return mType;
+ }
+ const TType *type() const
+ {
+ return mType;
+ }
+
+ const TString &name() const
+ {
+ return *mName;
+ }
+ const TSourceLoc &line() const
+ {
+ return mLine;
+ }
+
+ bool equals(const TField &other) const;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TField);
+ TType *mType;
+ TString *mName;
+ TSourceLoc mLine;
+};
+
+typedef TVector<TField *> TFieldList;
+inline TFieldList *NewPoolTFieldList()
+{
+ void *memory = GetGlobalPoolAllocator()->allocate(sizeof(TFieldList));
+ return new(memory) TFieldList;
+}
+
+class TFieldListCollection
+{
+ public:
+ const TString &name() const
+ {
+ return *mName;
+ }
+ const TFieldList &fields() const
+ {
+ return *mFields;
+ }
+
+ const TString &mangledName() const
+ {
+ if (mMangledName.empty())
+ mMangledName = buildMangledName();
+ return mMangledName;
+ }
+ size_t objectSize() const
+ {
+ if (mObjectSize == 0)
+ mObjectSize = calculateObjectSize();
+ return mObjectSize;
+ };
+
+ protected:
+ TFieldListCollection(const TString *name, TFieldList *fields)
+ : mName(name),
+ mFields(fields),
+ mObjectSize(0)
+ {
+ }
+ TString buildMangledName() const;
+ size_t calculateObjectSize() const;
+ virtual TString mangledNamePrefix() const = 0;
+
+ bool equals(const TFieldListCollection &other) const;
+
+ const TString *mName;
+ TFieldList *mFields;
+
+ mutable TString mMangledName;
+ mutable size_t mObjectSize;
+};
+
+// May also represent interface blocks
+class TStructure : public TFieldListCollection
+{
+ public:
+ POOL_ALLOCATOR_NEW_DELETE();
+ TStructure(const TString *name, TFieldList *fields)
+ : TFieldListCollection(name, fields),
+ mDeepestNesting(0),
+ mUniqueId(0)
+ {
+ }
+
+ int deepestNesting() const
+ {
+ if (mDeepestNesting == 0)
+ mDeepestNesting = calculateDeepestNesting();
+ return mDeepestNesting;
+ }
+ bool containsArrays() const;
+
+ bool equals(const TStructure &other) const;
+
+ void setUniqueId(int uniqueId)
+ {
+ mUniqueId = uniqueId;
+ }
+
+ int uniqueId() const
+ {
+ ASSERT(mUniqueId != 0);
+ return mUniqueId;
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TStructure);
+ virtual TString mangledNamePrefix() const
+ {
+ return "struct-";
+ }
+ int calculateDeepestNesting() const;
+
+ mutable int mDeepestNesting;
+ int mUniqueId;
+};
+
+class TInterfaceBlock : public TFieldListCollection
+{
+ public:
+ POOL_ALLOCATOR_NEW_DELETE();
+ TInterfaceBlock(const TString *name, TFieldList *fields, const TString *instanceName,
+ int arraySize, const TLayoutQualifier &layoutQualifier)
+ : TFieldListCollection(name, fields),
+ mInstanceName(instanceName),
+ mArraySize(arraySize),
+ mBlockStorage(layoutQualifier.blockStorage),
+ mMatrixPacking(layoutQualifier.matrixPacking)
+ {
+ }
+
+ const TString &instanceName() const
+ {
+ return *mInstanceName;
+ }
+ bool hasInstanceName() const
+ {
+ return mInstanceName != NULL;
+ }
+ bool isArray() const
+ {
+ return mArraySize > 0;
+ }
+ int arraySize() const
+ {
+ return mArraySize;
+ }
+ TLayoutBlockStorage blockStorage() const
+ {
+ return mBlockStorage;
+ }
+ TLayoutMatrixPacking matrixPacking() const
+ {
+ return mMatrixPacking;
+ }
+
+ bool equals(const TInterfaceBlock &other) const;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TInterfaceBlock);
+ virtual TString mangledNamePrefix() const
+ {
+ return "iblock-";
+ }
+
+ const TString *mInstanceName; // for interface block instance names
+ int mArraySize; // 0 if not an array
+ TLayoutBlockStorage mBlockStorage;
+ TLayoutMatrixPacking mMatrixPacking;
+};
+
+//
+// Base class for things that have a type.
+//
+class TType
+{
+ public:
+ POOL_ALLOCATOR_NEW_DELETE();
+ TType()
+ {
+ }
+ TType(TBasicType t, unsigned char ps = 1, unsigned char ss = 1)
+ : type(t), precision(EbpUndefined), qualifier(EvqGlobal),
+ layoutQualifier(TLayoutQualifier::create()),
+ primarySize(ps), secondarySize(ss), array(false), arraySize(0),
+ interfaceBlock(0), structure(0)
+ {
+ }
+ TType(TBasicType t, TPrecision p, TQualifier q = EvqTemporary,
+ unsigned char ps = 1, unsigned char ss = 1, bool a = false)
+ : type(t), precision(p), qualifier(q),
+ layoutQualifier(TLayoutQualifier::create()),
+ primarySize(ps), secondarySize(ss), array(a), arraySize(0),
+ interfaceBlock(0), structure(0)
+ {
+ }
+ explicit TType(const TPublicType &p);
+ TType(TStructure *userDef, TPrecision p = EbpUndefined)
+ : type(EbtStruct), precision(p), qualifier(EvqTemporary),
+ layoutQualifier(TLayoutQualifier::create()),
+ primarySize(1), secondarySize(1), array(false), arraySize(0),
+ interfaceBlock(0), structure(userDef)
+ {
+ }
+ TType(TInterfaceBlock *interfaceBlockIn, TQualifier qualifierIn,
+ TLayoutQualifier layoutQualifierIn, int arraySizeIn)
+ : type(EbtInterfaceBlock), precision(EbpUndefined), qualifier(qualifierIn),
+ layoutQualifier(layoutQualifierIn),
+ primarySize(1), secondarySize(1), array(arraySizeIn > 0), arraySize(arraySizeIn),
+ interfaceBlock(interfaceBlockIn), structure(0)
+ {
+ }
+
+ TBasicType getBasicType() const
+ {
+ return type;
+ }
+ void setBasicType(TBasicType t)
+ {
+ type = t;
+ }
+
+ TPrecision getPrecision() const
+ {
+ return precision;
+ }
+ void setPrecision(TPrecision p)
+ {
+ precision = p;
+ }
+
+ TQualifier getQualifier() const
+ {
+ return qualifier;
+ }
+ void setQualifier(TQualifier q)
+ {
+ qualifier = q;
+ }
+
+ TLayoutQualifier getLayoutQualifier() const
+ {
+ return layoutQualifier;
+ }
+ void setLayoutQualifier(TLayoutQualifier lq)
+ {
+ layoutQualifier = lq;
+ }
+
+ int getNominalSize() const
+ {
+ return primarySize;
+ }
+ int getSecondarySize() const
+ {
+ return secondarySize;
+ }
+ int getCols() const
+ {
+ ASSERT(isMatrix());
+ return primarySize;
+ }
+ int getRows() const
+ {
+ ASSERT(isMatrix());
+ return secondarySize;
+ }
+ void setPrimarySize(unsigned char ps)
+ {
+ primarySize = ps;
+ }
+ void setSecondarySize(unsigned char ss)
+ {
+ secondarySize = ss;
+ }
+
+ // Full size of single instance of type
+ size_t getObjectSize() const;
+
+ bool isMatrix() const
+ {
+ return primarySize > 1 && secondarySize > 1;
+ }
+ bool isArray() const
+ {
+ return array ? true : false;
+ }
+ int getArraySize() const
+ {
+ return arraySize;
+ }
+ void setArraySize(int s)
+ {
+ array = true;
+ arraySize = s;
+ }
+ void clearArrayness()
+ {
+ array = false;
+ arraySize = 0;
+ }
+
+ TInterfaceBlock *getInterfaceBlock() const
+ {
+ return interfaceBlock;
+ }
+ void setInterfaceBlock(TInterfaceBlock *interfaceBlockIn)
+ {
+ interfaceBlock = interfaceBlockIn;
+ }
+ bool isInterfaceBlock() const
+ {
+ return type == EbtInterfaceBlock;
+ }
+
+ bool isVector() const
+ {
+ return primarySize > 1 && secondarySize == 1;
+ }
+ bool isScalar() const
+ {
+ return primarySize == 1 && secondarySize == 1 && !structure;
+ }
+ bool isScalarInt() const
+ {
+ return isScalar() && (type == EbtInt || type == EbtUInt);
+ }
+
+ TStructure *getStruct() const
+ {
+ return structure;
+ }
+ void setStruct(TStructure *s)
+ {
+ structure = s;
+ }
+
+ const TString &getMangledName()
+ {
+ if (mangled.empty())
+ {
+ mangled = buildMangledName();
+ mangled += ';';
+ }
+
+ return mangled;
+ }
+
+ // This is different from operator== as we also compare
+ // precision here.
+ bool equals(const TType &other) const;
+
+ bool sameElementType(const TType &right) const
+ {
+ return type == right.type &&
+ primarySize == right.primarySize &&
+ secondarySize == right.secondarySize &&
+ structure == right.structure;
+ }
+ bool operator==(const TType &right) const
+ {
+ return type == right.type &&
+ primarySize == right.primarySize &&
+ secondarySize == right.secondarySize &&
+ array == right.array && (!array || arraySize == right.arraySize) &&
+ structure == right.structure;
+ // don't check the qualifier, it's not ever what's being sought after
+ }
+ bool operator!=(const TType &right) const
+ {
+ return !operator==(right);
+ }
+ bool operator<(const TType &right) const
+ {
+ if (type != right.type)
+ return type < right.type;
+ if (primarySize != right.primarySize)
+ return primarySize < right.primarySize;
+ if (secondarySize != right.secondarySize)
+ return secondarySize < right.secondarySize;
+ if (array != right.array)
+ return array < right.array;
+ if (arraySize != right.arraySize)
+ return arraySize < right.arraySize;
+ if (structure != right.structure)
+ return structure < right.structure;
+
+ return false;
+ }
+
+ const char *getBasicString() const
+ {
+ return ::getBasicString(type);
+ }
+ const char *getPrecisionString() const
+ {
+ return ::getPrecisionString(precision);
+ }
+ const char *getQualifierString() const
+ {
+ return ::getQualifierString(qualifier);
+ }
+ TString getCompleteString() const;
+
+ // If this type is a struct, returns the deepest struct nesting of
+ // any field in the struct. For example:
+ // struct nesting1 {
+ // vec4 position;
+ // };
+ // struct nesting2 {
+ // nesting1 field1;
+ // vec4 field2;
+ // };
+ // For type "nesting2", this method would return 2 -- the number
+ // of structures through which indirection must occur to reach the
+ // deepest field (nesting2.field1.position).
+ int getDeepestStructNesting() const
+ {
+ return structure ? structure->deepestNesting() : 0;
+ }
+
+ bool isStructureContainingArrays() const
+ {
+ return structure ? structure->containsArrays() : false;
+ }
+
+ protected:
+ TString buildMangledName() const;
+ size_t getStructSize() const;
+ void computeDeepestStructNesting();
+
+ TBasicType type;
+ TPrecision precision;
+ TQualifier qualifier;
+ TLayoutQualifier layoutQualifier;
+ unsigned char primarySize; // size of vector or cols matrix
+ unsigned char secondarySize; // rows of a matrix
+ bool array;
+ int arraySize;
+
+ // 0 unless this is an interface block, or interface block member variable
+ TInterfaceBlock *interfaceBlock;
+
+ // 0 unless this is a struct
+ TStructure *structure;
+
+ mutable TString mangled;
+};
+
+//
+// This is a workaround for a problem with the yacc stack, It can't have
+// types that it thinks have non-trivial constructors. It should
+// just be used while recognizing the grammar, not anything else. Pointers
+// could be used, but also trying to avoid lots of memory management overhead.
+//
+// Not as bad as it looks, there is no actual assumption that the fields
+// match up or are name the same or anything like that.
+//
+struct TPublicType
+{
+ TBasicType type;
+ TLayoutQualifier layoutQualifier;
+ TQualifier qualifier;
+ TPrecision precision;
+ unsigned char primarySize; // size of vector or cols of matrix
+ unsigned char secondarySize; // rows of matrix
+ bool array;
+ int arraySize;
+ TType *userDef;
+ TSourceLoc line;
+
+ void setBasic(TBasicType bt, TQualifier q, const TSourceLoc &ln)
+ {
+ type = bt;
+ layoutQualifier = TLayoutQualifier::create();
+ qualifier = q;
+ precision = EbpUndefined;
+ primarySize = 1;
+ secondarySize = 1;
+ array = false;
+ arraySize = 0;
+ userDef = 0;
+ line = ln;
+ }
+
+ void setAggregate(unsigned char size)
+ {
+ primarySize = size;
+ }
+
+ void setMatrix(unsigned char c, unsigned char r)
+ {
+ ASSERT(c > 1 && r > 1 && c <= 4 && r <= 4);
+ primarySize = c;
+ secondarySize = r;
+ }
+
+ void setArray(bool a, int s = 0)
+ {
+ array = a;
+ arraySize = s;
+ }
+
+ bool isStructureContainingArrays() const
+ {
+ if (!userDef)
+ {
+ return false;
+ }
+
+ return userDef->isStructureContainingArrays();
+ }
+
+ bool isMatrix() const
+ {
+ return primarySize > 1 && secondarySize > 1;
+ }
+
+ bool isVector() const
+ {
+ return primarySize > 1 && secondarySize == 1;
+ }
+
+ int getCols() const
+ {
+ ASSERT(isMatrix());
+ return primarySize;
+ }
+
+ int getRows() const
+ {
+ ASSERT(isMatrix());
+ return secondarySize;
+ }
+
+ int getNominalSize() const
+ {
+ return primarySize;
+ }
+
+ bool isAggregate() const
+ {
+ return array || isMatrix() || isVector();
+ }
+};
+
+#endif // _TYPES_INCLUDED_
diff --git a/chromium/third_party/angle/src/compiler/UnfoldShortCircuit.cpp b/chromium/third_party/angle/src/compiler/translator/UnfoldShortCircuit.cpp
index 5cfdd3230e4..b7826119aea 100644
--- a/chromium/third_party/angle/src/compiler/UnfoldShortCircuit.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/UnfoldShortCircuit.cpp
@@ -8,10 +8,10 @@
// the original expression.
//
-#include "compiler/UnfoldShortCircuit.h"
+#include "compiler/translator/UnfoldShortCircuit.h"
-#include "compiler/InfoSink.h"
-#include "compiler/OutputHLSL.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/OutputHLSL.h"
namespace sh
{
diff --git a/chromium/third_party/angle/src/compiler/UnfoldShortCircuit.h b/chromium/third_party/angle/src/compiler/translator/UnfoldShortCircuit.h
index ae2989fa4ab..1e416bc04c1 100644
--- a/chromium/third_party/angle/src/compiler/UnfoldShortCircuit.h
+++ b/chromium/third_party/angle/src/compiler/translator/UnfoldShortCircuit.h
@@ -9,8 +9,8 @@
#ifndef COMPILER_UNFOLDSHORTCIRCUIT_H_
#define COMPILER_UNFOLDSHORTCIRCUIT_H_
-#include "compiler/intermediate.h"
-#include "compiler/ParseContext.h"
+#include "compiler/translator/intermediate.h"
+#include "compiler/translator/ParseContext.h"
namespace sh
{
diff --git a/chromium/third_party/angle/src/compiler/UnfoldShortCircuitAST.cpp b/chromium/third_party/angle/src/compiler/translator/UnfoldShortCircuitAST.cpp
index a19bceaeb43..29c4397d561 100644
--- a/chromium/third_party/angle/src/compiler/UnfoldShortCircuitAST.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/UnfoldShortCircuitAST.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/UnfoldShortCircuitAST.h"
+#include "compiler/translator/UnfoldShortCircuitAST.h"
namespace
{
diff --git a/chromium/third_party/angle/src/compiler/UnfoldShortCircuitAST.h b/chromium/third_party/angle/src/compiler/translator/UnfoldShortCircuitAST.h
index cfc50066485..24c14a60e37 100644
--- a/chromium/third_party/angle/src/compiler/UnfoldShortCircuitAST.h
+++ b/chromium/third_party/angle/src/compiler/translator/UnfoldShortCircuitAST.h
@@ -11,7 +11,7 @@
#define COMPILER_UNFOLD_SHORT_CIRCUIT_AST_H_
#include "common/angleutils.h"
-#include "compiler/intermediate.h"
+#include "compiler/translator/intermediate.h"
// This traverser identifies all the short circuit binary nodes that need to
// be replaced, and creates the corresponding replacement nodes. However,
diff --git a/chromium/third_party/angle/src/compiler/ValidateLimitations.cpp b/chromium/third_party/angle/src/compiler/translator/ValidateLimitations.cpp
index 64969c489fa..e96a777cee3 100644
--- a/chromium/third_party/angle/src/compiler/ValidateLimitations.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/ValidateLimitations.cpp
@@ -1,33 +1,16 @@
//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-#include "compiler/ValidateLimitations.h"
-#include "compiler/InfoSink.h"
-#include "compiler/InitializeParseContext.h"
-#include "compiler/ParseContext.h"
+#include "compiler/translator/ValidateLimitations.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/InitializeParseContext.h"
+#include "compiler/translator/ParseContext.h"
-namespace {
-bool IsLoopIndex(const TIntermSymbol* symbol, const TLoopStack& stack) {
- for (TLoopStack::const_iterator i = stack.begin(); i != stack.end(); ++i) {
- if (i->index.id == symbol->getId())
- return true;
- }
- return false;
-}
-
-void MarkLoopForUnroll(const TIntermSymbol* symbol, TLoopStack& stack) {
- for (TLoopStack::iterator i = stack.begin(); i != stack.end(); ++i) {
- if (i->index.id == symbol->getId()) {
- ASSERT(i->loop != NULL);
- i->loop->setUnrollFlag(true);
- return;
- }
- }
- UNREACHABLE();
-}
+namespace
+{
// Traverses a node to check if it represents a constant index expression.
// Definition:
@@ -38,110 +21,60 @@ void MarkLoopForUnroll(const TIntermSymbol* symbol, TLoopStack& stack) {
// - Constant expressions
// - Loop indices as defined in section 4
// - Expressions composed of both of the above
-class ValidateConstIndexExpr : public TIntermTraverser {
-public:
- ValidateConstIndexExpr(const TLoopStack& stack)
+class ValidateConstIndexExpr : public TIntermTraverser
+{
+ public:
+ ValidateConstIndexExpr(TLoopStack& stack)
: mValid(true), mLoopStack(stack) {}
// Returns true if the parsed node represents a constant index expression.
bool isValid() const { return mValid; }
- virtual void visitSymbol(TIntermSymbol* symbol) {
+ virtual void visitSymbol(TIntermSymbol *symbol)
+ {
// Only constants and loop indices are allowed in a
// constant index expression.
- if (mValid) {
+ if (mValid)
+ {
mValid = (symbol->getQualifier() == EvqConst) ||
- IsLoopIndex(symbol, mLoopStack);
+ (mLoopStack.findLoop(symbol));
}
}
-private:
+ private:
bool mValid;
- const TLoopStack& mLoopStack;
-};
-
-// Traverses a node to check if it uses a loop index.
-// If an int loop index is used in its body as a sampler array index,
-// mark the loop for unroll.
-class ValidateLoopIndexExpr : public TIntermTraverser {
-public:
- ValidateLoopIndexExpr(TLoopStack& stack)
- : mUsesFloatLoopIndex(false),
- mUsesIntLoopIndex(false),
- mLoopStack(stack) {}
-
- bool usesFloatLoopIndex() const { return mUsesFloatLoopIndex; }
- bool usesIntLoopIndex() const { return mUsesIntLoopIndex; }
-
- virtual void visitSymbol(TIntermSymbol* symbol) {
- if (IsLoopIndex(symbol, mLoopStack)) {
- switch (symbol->getBasicType()) {
- case EbtFloat:
- mUsesFloatLoopIndex = true;
- break;
- case EbtInt:
- mUsesIntLoopIndex = true;
- MarkLoopForUnroll(symbol, mLoopStack);
- break;
- default:
- UNREACHABLE();
- }
- }
- }
-
-private:
- bool mUsesFloatLoopIndex;
- bool mUsesIntLoopIndex;
TLoopStack& mLoopStack;
};
-} // namespace
+
+} // namespace anonymous
ValidateLimitations::ValidateLimitations(ShShaderType shaderType,
- TInfoSinkBase& sink)
+ TInfoSinkBase &sink)
: mShaderType(shaderType),
mSink(sink),
mNumErrors(0)
{
}
-bool ValidateLimitations::visitBinary(Visit, TIntermBinary* node)
+bool ValidateLimitations::visitBinary(Visit, TIntermBinary *node)
{
// Check if loop index is modified in the loop body.
validateOperation(node, node->getLeft());
// Check indexing.
- switch (node->getOp()) {
+ switch (node->getOp())
+ {
case EOpIndexDirect:
- validateIndexing(node);
- break;
case EOpIndexIndirect:
-#if defined(__APPLE__)
- // Loop unrolling is a work-around for a Mac Cg compiler bug where it
- // crashes when a sampler array's index is also the loop index.
- // Once Apple fixes this bug, we should remove the code in this CL.
- // See http://codereview.appspot.com/4331048/.
- if ((node->getLeft() != NULL) && (node->getRight() != NULL) &&
- (node->getLeft()->getAsSymbolNode())) {
- TIntermSymbol* symbol = node->getLeft()->getAsSymbolNode();
- if (IsSampler(symbol->getBasicType()) && symbol->isArray()) {
- ValidateLoopIndexExpr validate(mLoopStack);
- node->getRight()->traverse(&validate);
- if (validate.usesFloatLoopIndex()) {
- error(node->getLine(),
- "sampler array index is float loop index",
- "for");
- }
- }
- }
-#endif
validateIndexing(node);
break;
- default: break;
+ default:
+ break;
}
return true;
}
-bool ValidateLimitations::visitUnary(Visit, TIntermUnary* node)
+bool ValidateLimitations::visitUnary(Visit, TIntermUnary *node)
{
// Check if loop index is modified in the loop body.
validateOperation(node, node->getOperand());
@@ -149,7 +82,7 @@ bool ValidateLimitations::visitUnary(Visit, TIntermUnary* node)
return true;
}
-bool ValidateLimitations::visitAggregate(Visit, TIntermAggregate* node)
+bool ValidateLimitations::visitAggregate(Visit, TIntermAggregate *node)
{
switch (node->getOp()) {
case EOpFunctionCall:
@@ -161,22 +94,20 @@ bool ValidateLimitations::visitAggregate(Visit, TIntermAggregate* node)
return true;
}
-bool ValidateLimitations::visitLoop(Visit, TIntermLoop* node)
+bool ValidateLimitations::visitLoop(Visit, TIntermLoop *node)
{
if (!validateLoopType(node))
return false;
- TLoopInfo info;
- memset(&info, 0, sizeof(TLoopInfo));
- info.loop = node;
- if (!validateForLoopHeader(node, &info))
+ if (!validateForLoopHeader(node))
return false;
- TIntermNode* body = node->getBody();
- if (body != NULL) {
- mLoopStack.push_back(info);
+ TIntermNode *body = node->getBody();
+ if (body != NULL)
+ {
+ mLoopStack.push(node);
body->traverse(this);
- mLoopStack.pop_back();
+ mLoopStack.pop();
}
// The loop is fully processed - no need to visit children.
@@ -184,7 +115,7 @@ bool ValidateLimitations::visitLoop(Visit, TIntermLoop* node)
}
void ValidateLimitations::error(TSourceLoc loc,
- const char *reason, const char* token)
+ const char *reason, const char *token)
{
mSink.prefix(EPrefixError);
mSink.location(loc);
@@ -197,12 +128,13 @@ bool ValidateLimitations::withinLoopBody() const
return !mLoopStack.empty();
}
-bool ValidateLimitations::isLoopIndex(const TIntermSymbol* symbol) const
+bool ValidateLimitations::isLoopIndex(TIntermSymbol *symbol)
{
- return IsLoopIndex(symbol, mLoopStack);
+ return mLoopStack.findLoop(symbol) != NULL;
}
-bool ValidateLimitations::validateLoopType(TIntermLoop* node) {
+bool ValidateLimitations::validateLoopType(TIntermLoop *node)
+{
TLoopType type = node->getType();
if (type == ELoopFor)
return true;
@@ -214,8 +146,7 @@ bool ValidateLimitations::validateLoopType(TIntermLoop* node) {
return false;
}
-bool ValidateLimitations::validateForLoopHeader(TIntermLoop* node,
- TLoopInfo* info)
+bool ValidateLimitations::validateForLoopHeader(TIntermLoop *node)
{
ASSERT(node->getType() == ELoopFor);
@@ -223,74 +154,80 @@ bool ValidateLimitations::validateForLoopHeader(TIntermLoop* node,
// The for statement has the form:
// for ( init-declaration ; condition ; expression ) statement
//
- if (!validateForLoopInit(node, info))
+ int indexSymbolId = validateForLoopInit(node);
+ if (indexSymbolId < 0)
return false;
- if (!validateForLoopCond(node, info))
+ if (!validateForLoopCond(node, indexSymbolId))
return false;
- if (!validateForLoopExpr(node, info))
+ if (!validateForLoopExpr(node, indexSymbolId))
return false;
return true;
}
-bool ValidateLimitations::validateForLoopInit(TIntermLoop* node,
- TLoopInfo* info)
+int ValidateLimitations::validateForLoopInit(TIntermLoop *node)
{
- TIntermNode* init = node->getInit();
- if (init == NULL) {
+ TIntermNode *init = node->getInit();
+ if (init == NULL)
+ {
error(node->getLine(), "Missing init declaration", "for");
- return false;
+ return -1;
}
//
// init-declaration has the form:
// type-specifier identifier = constant-expression
//
- TIntermAggregate* decl = init->getAsAggregate();
- if ((decl == NULL) || (decl->getOp() != EOpDeclaration)) {
+ TIntermAggregate *decl = init->getAsAggregate();
+ if ((decl == NULL) || (decl->getOp() != EOpDeclaration))
+ {
error(init->getLine(), "Invalid init declaration", "for");
- return false;
+ return -1;
}
// To keep things simple do not allow declaration list.
- TIntermSequence& declSeq = decl->getSequence();
- if (declSeq.size() != 1) {
+ TIntermSequence &declSeq = decl->getSequence();
+ if (declSeq.size() != 1)
+ {
error(decl->getLine(), "Invalid init declaration", "for");
- return false;
+ return -1;
}
- TIntermBinary* declInit = declSeq[0]->getAsBinaryNode();
- if ((declInit == NULL) || (declInit->getOp() != EOpInitialize)) {
+ TIntermBinary *declInit = declSeq[0]->getAsBinaryNode();
+ if ((declInit == NULL) || (declInit->getOp() != EOpInitialize))
+ {
error(decl->getLine(), "Invalid init declaration", "for");
- return false;
+ return -1;
}
- TIntermSymbol* symbol = declInit->getLeft()->getAsSymbolNode();
- if (symbol == NULL) {
+ TIntermSymbol *symbol = declInit->getLeft()->getAsSymbolNode();
+ if (symbol == NULL)
+ {
error(declInit->getLine(), "Invalid init declaration", "for");
- return false;
+ return -1;
}
// The loop index has type int or float.
TBasicType type = symbol->getBasicType();
- if ((type != EbtInt) && (type != EbtFloat)) {
+ if ((type != EbtInt) && (type != EbtUInt) && (type != EbtFloat)) {
error(symbol->getLine(),
"Invalid type for loop index", getBasicString(type));
- return false;
+ return -1;
}
// The loop index is initialized with constant expression.
- if (!isConstExpr(declInit->getRight())) {
+ if (!isConstExpr(declInit->getRight()))
+ {
error(declInit->getLine(),
"Loop index cannot be initialized with non-constant expression",
symbol->getSymbol().c_str());
- return false;
+ return -1;
}
- info->index.id = symbol->getId();
- return true;
+ return symbol->getId();
}
-bool ValidateLimitations::validateForLoopCond(TIntermLoop* node,
- TLoopInfo* info)
+bool ValidateLimitations::validateForLoopCond(TIntermLoop *node,
+ int indexSymbolId)
{
- TIntermNode* cond = node->getCondition();
- if (cond == NULL) {
+ TIntermNode *cond = node->getCondition();
+ if (cond == NULL)
+ {
error(node->getLine(), "Missing condition", "for");
return false;
}
@@ -298,24 +235,28 @@ bool ValidateLimitations::validateForLoopCond(TIntermLoop* node,
// condition has the form:
// loop_index relational_operator constant_expression
//
- TIntermBinary* binOp = cond->getAsBinaryNode();
- if (binOp == NULL) {
+ TIntermBinary *binOp = cond->getAsBinaryNode();
+ if (binOp == NULL)
+ {
error(node->getLine(), "Invalid condition", "for");
return false;
}
// Loop index should be to the left of relational operator.
- TIntermSymbol* symbol = binOp->getLeft()->getAsSymbolNode();
- if (symbol == NULL) {
+ TIntermSymbol *symbol = binOp->getLeft()->getAsSymbolNode();
+ if (symbol == NULL)
+ {
error(binOp->getLine(), "Invalid condition", "for");
return false;
}
- if (symbol->getId() != info->index.id) {
+ if (symbol->getId() != indexSymbolId)
+ {
error(symbol->getLine(),
"Expected loop index", symbol->getSymbol().c_str());
return false;
}
// Relational operator is one of: > >= < <= == or !=.
- switch (binOp->getOp()) {
+ switch (binOp->getOp())
+ {
case EOpEqual:
case EOpNotEqual:
case EOpLessThan:
@@ -330,7 +271,8 @@ bool ValidateLimitations::validateForLoopCond(TIntermLoop* node,
break;
}
// Loop index must be compared with a constant.
- if (!isConstExpr(binOp->getRight())) {
+ if (!isConstExpr(binOp->getRight()))
+ {
error(binOp->getLine(),
"Loop index cannot be compared with non-constant expression",
symbol->getSymbol().c_str());
@@ -340,11 +282,12 @@ bool ValidateLimitations::validateForLoopCond(TIntermLoop* node,
return true;
}
-bool ValidateLimitations::validateForLoopExpr(TIntermLoop* node,
- TLoopInfo* info)
+bool ValidateLimitations::validateForLoopExpr(TIntermLoop *node,
+ int indexSymbolId)
{
- TIntermNode* expr = node->getExpression();
- if (expr == NULL) {
+ TIntermNode *expr = node->getExpression();
+ if (expr == NULL)
+ {
error(node->getLine(), "Missing expression", "for");
return false;
}
@@ -358,50 +301,58 @@ bool ValidateLimitations::validateForLoopExpr(TIntermLoop* node,
// --loop_index
// The last two forms are not specified in the spec, but I am assuming
// its an oversight.
- TIntermUnary* unOp = expr->getAsUnaryNode();
- TIntermBinary* binOp = unOp ? NULL : expr->getAsBinaryNode();
+ TIntermUnary *unOp = expr->getAsUnaryNode();
+ TIntermBinary *binOp = unOp ? NULL : expr->getAsBinaryNode();
TOperator op = EOpNull;
- TIntermSymbol* symbol = NULL;
- if (unOp != NULL) {
+ TIntermSymbol *symbol = NULL;
+ if (unOp != NULL)
+ {
op = unOp->getOp();
symbol = unOp->getOperand()->getAsSymbolNode();
- } else if (binOp != NULL) {
+ }
+ else if (binOp != NULL)
+ {
op = binOp->getOp();
symbol = binOp->getLeft()->getAsSymbolNode();
}
// The operand must be loop index.
- if (symbol == NULL) {
+ if (symbol == NULL)
+ {
error(expr->getLine(), "Invalid expression", "for");
return false;
}
- if (symbol->getId() != info->index.id) {
+ if (symbol->getId() != indexSymbolId)
+ {
error(symbol->getLine(),
"Expected loop index", symbol->getSymbol().c_str());
return false;
}
// The operator is one of: ++ -- += -=.
- switch (op) {
- case EOpPostIncrement:
- case EOpPostDecrement:
- case EOpPreIncrement:
- case EOpPreDecrement:
- ASSERT((unOp != NULL) && (binOp == NULL));
- break;
- case EOpAddAssign:
- case EOpSubAssign:
- ASSERT((unOp == NULL) && (binOp != NULL));
- break;
- default:
- error(expr->getLine(), "Invalid operator", getOperatorString(op));
- return false;
+ switch (op)
+ {
+ case EOpPostIncrement:
+ case EOpPostDecrement:
+ case EOpPreIncrement:
+ case EOpPreDecrement:
+ ASSERT((unOp != NULL) && (binOp == NULL));
+ break;
+ case EOpAddAssign:
+ case EOpSubAssign:
+ ASSERT((unOp == NULL) && (binOp != NULL));
+ break;
+ default:
+ error(expr->getLine(), "Invalid operator", getOperatorString(op));
+ return false;
}
// Loop index must be incremented/decremented with a constant.
- if (binOp != NULL) {
- if (!isConstExpr(binOp->getRight())) {
+ if (binOp != NULL)
+ {
+ if (!isConstExpr(binOp->getRight()))
+ {
error(binOp->getLine(),
"Loop index cannot be modified by non-constant expression",
symbol->getSymbol().c_str());
@@ -412,7 +363,7 @@ bool ValidateLimitations::validateForLoopExpr(TIntermLoop* node,
return true;
}
-bool ValidateLimitations::validateFunctionCall(TIntermAggregate* node)
+bool ValidateLimitations::validateFunctionCall(TIntermAggregate *node)
{
ASSERT(node->getOp() == EOpFunctionCall);
@@ -424,8 +375,9 @@ bool ValidateLimitations::validateFunctionCall(TIntermAggregate* node)
typedef std::vector<size_t> ParamIndex;
ParamIndex pIndex;
TIntermSequence& params = node->getSequence();
- for (TIntermSequence::size_type i = 0; i < params.size(); ++i) {
- TIntermSymbol* symbol = params[i]->getAsSymbolNode();
+ for (TIntermSequence::size_type i = 0; i < params.size(); ++i)
+ {
+ TIntermSymbol *symbol = params[i]->getAsSymbolNode();
if (symbol && isLoopIndex(symbol))
pIndex.push_back(i);
}
@@ -436,14 +388,16 @@ bool ValidateLimitations::validateFunctionCall(TIntermAggregate* node)
bool valid = true;
TSymbolTable& symbolTable = GetGlobalParseContext()->symbolTable;
- TSymbol* symbol = symbolTable.find(node->getName());
+ TSymbol* symbol = symbolTable.find(node->getName(), GetGlobalParseContext()->shaderVersion);
ASSERT(symbol && symbol->isFunction());
- TFunction* function = static_cast<TFunction*>(symbol);
+ TFunction *function = static_cast<TFunction *>(symbol);
for (ParamIndex::const_iterator i = pIndex.begin();
- i != pIndex.end(); ++i) {
- const TParameter& param = function->getParam(*i);
+ i != pIndex.end(); ++i)
+ {
+ const TParameter &param = function->getParam(*i);
TQualifier qual = param.type->getQualifier();
- if ((qual == EvqOut) || (qual == EvqInOut)) {
+ if ((qual == EvqOut) || (qual == EvqInOut))
+ {
error(params[*i]->getLine(),
"Loop index cannot be used as argument to a function out or inout parameter",
params[*i]->getAsSymbolNode()->getSymbol().c_str());
@@ -454,14 +408,16 @@ bool ValidateLimitations::validateFunctionCall(TIntermAggregate* node)
return valid;
}
-bool ValidateLimitations::validateOperation(TIntermOperator* node,
- TIntermNode* operand) {
+bool ValidateLimitations::validateOperation(TIntermOperator *node,
+ TIntermNode* operand)
+{
// Check if loop index is modified in the loop body.
if (!withinLoopBody() || !node->isAssignment())
return true;
- const TIntermSymbol* symbol = operand->getAsSymbolNode();
- if (symbol && isLoopIndex(symbol)) {
+ TIntermSymbol *symbol = operand->getAsSymbolNode();
+ if (symbol && isLoopIndex(symbol))
+ {
error(node->getLine(),
"Loop index cannot be statically assigned to within the body of the loop",
symbol->getSymbol().c_str());
@@ -469,13 +425,13 @@ bool ValidateLimitations::validateOperation(TIntermOperator* node,
return true;
}
-bool ValidateLimitations::isConstExpr(TIntermNode* node)
+bool ValidateLimitations::isConstExpr(TIntermNode *node)
{
ASSERT(node != NULL);
return node->getAsConstantUnion() != NULL;
}
-bool ValidateLimitations::isConstIndexExpr(TIntermNode* node)
+bool ValidateLimitations::isConstIndexExpr(TIntermNode *node)
{
ASSERT(node != NULL);
@@ -484,15 +440,15 @@ bool ValidateLimitations::isConstIndexExpr(TIntermNode* node)
return validate.isValid();
}
-bool ValidateLimitations::validateIndexing(TIntermBinary* node)
+bool ValidateLimitations::validateIndexing(TIntermBinary *node)
{
ASSERT((node->getOp() == EOpIndexDirect) ||
(node->getOp() == EOpIndexIndirect));
bool valid = true;
- TIntermTyped* index = node->getRight();
+ TIntermTyped *index = node->getRight();
// The index expression must have integral type.
- if (!index->isScalar() || (index->getBasicType() != EbtInt)) {
+ if (!index->isScalarInt()) {
error(index->getLine(),
"Index expression must have integral type",
index->getCompleteString().c_str());
@@ -500,10 +456,11 @@ bool ValidateLimitations::validateIndexing(TIntermBinary* node)
}
// The index expession must be a constant-index-expression unless
// the operand is a uniform in a vertex shader.
- TIntermTyped* operand = node->getLeft();
+ TIntermTyped *operand = node->getLeft();
bool skip = (mShaderType == SH_VERTEX_SHADER) &&
(operand->getQualifier() == EvqUniform);
- if (!skip && !isConstIndexExpr(index)) {
+ if (!skip && !isConstIndexExpr(index))
+ {
error(index->getLine(), "Index expression must be constant", "[]");
valid = false;
}
diff --git a/chromium/third_party/angle/src/compiler/translator/ValidateLimitations.h b/chromium/third_party/angle/src/compiler/translator/ValidateLimitations.h
new file mode 100644
index 00000000000..f28995c640b
--- /dev/null
+++ b/chromium/third_party/angle/src/compiler/translator/ValidateLimitations.h
@@ -0,0 +1,55 @@
+//
+// Copyright (c) 2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/translator/intermediate.h"
+#include "compiler/translator/LoopInfo.h"
+
+class TInfoSinkBase;
+
+// Traverses intermediate tree to ensure that the shader does not exceed the
+// minimum functionality mandated in GLSL 1.0 spec, Appendix A.
+class ValidateLimitations : public TIntermTraverser
+{
+ public:
+ ValidateLimitations(ShShaderType shaderType, TInfoSinkBase &sink);
+
+ int numErrors() const { return mNumErrors; }
+
+ virtual bool visitBinary(Visit, TIntermBinary *);
+ virtual bool visitUnary(Visit, TIntermUnary *);
+ virtual bool visitAggregate(Visit, TIntermAggregate *);
+ virtual bool visitLoop(Visit, TIntermLoop *);
+
+ private:
+ void error(TSourceLoc loc, const char *reason, const char *token);
+
+ bool withinLoopBody() const;
+ bool isLoopIndex(TIntermSymbol *symbol);
+ bool validateLoopType(TIntermLoop *node);
+
+ bool validateForLoopHeader(TIntermLoop *node);
+ // If valid, return the index symbol id; Otherwise, return -1.
+ int validateForLoopInit(TIntermLoop *node);
+ bool validateForLoopCond(TIntermLoop *node, int indexSymbolId);
+ bool validateForLoopExpr(TIntermLoop *node, int indexSymbolId);
+
+ // Returns true if none of the loop indices is used as the argument to
+ // the given function out or inout parameter.
+ bool validateFunctionCall(TIntermAggregate *node);
+ bool validateOperation(TIntermOperator *node, TIntermNode *operand);
+
+ // Returns true if indexing does not exceed the minimum functionality
+ // mandated in GLSL 1.0 spec, Appendix A, Section 5.
+ bool isConstExpr(TIntermNode *node);
+ bool isConstIndexExpr(TIntermNode *node);
+ bool validateIndexing(TIntermBinary *node);
+
+ ShShaderType mShaderType;
+ TInfoSinkBase &mSink;
+ int mNumErrors;
+ TLoopStack mLoopStack;
+};
+
diff --git a/chromium/third_party/angle/src/compiler/translator/ValidateOutputs.cpp b/chromium/third_party/angle/src/compiler/translator/ValidateOutputs.cpp
new file mode 100644
index 00000000000..ac1c10d6b03
--- /dev/null
+++ b/chromium/third_party/angle/src/compiler/translator/ValidateOutputs.cpp
@@ -0,0 +1,78 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/translator/ValidateOutputs.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/InitializeParseContext.h"
+#include "compiler/translator/ParseContext.h"
+
+ValidateOutputs::ValidateOutputs(TInfoSinkBase& sink, int maxDrawBuffers)
+ : mSink(sink),
+ mMaxDrawBuffers(maxDrawBuffers),
+ mNumErrors(0),
+ mHasUnspecifiedOutputLocation(false)
+{
+}
+
+void ValidateOutputs::visitSymbol(TIntermSymbol *symbol)
+{
+ TString name = symbol->getSymbol();
+ TQualifier qualifier = symbol->getQualifier();
+
+ if (mVisitedSymbols.count(name) == 1)
+ return;
+
+ mVisitedSymbols.insert(name);
+
+ if (qualifier == EvqFragmentOut)
+ {
+ const TType &type = symbol->getType();
+ const int location = type.getLayoutQualifier().location;
+
+ if (mHasUnspecifiedOutputLocation)
+ {
+ error(symbol->getLine(), "must explicitly specify all locations when using multiple fragment outputs", name.c_str());
+ }
+ else if (location == -1)
+ {
+ mHasUnspecifiedOutputLocation = true;
+ }
+ else
+ {
+ OutputMap::iterator mapEntry = mOutputMap.find(location);
+ if (mapEntry == mOutputMap.end())
+ {
+ const int elementCount = type.isArray() ? type.getArraySize() : 1;
+ if (location + elementCount > mMaxDrawBuffers)
+ {
+ error(symbol->getLine(), "output location must be < MAX_DRAW_BUFFERS", name.c_str());
+ }
+
+ for (int elementIndex = 0; elementIndex < elementCount; elementIndex++)
+ {
+ const int offsetLocation = location + elementIndex;
+ mOutputMap[offsetLocation] = symbol;
+ }
+ }
+ else
+ {
+ std::stringstream strstr;
+ strstr << "conflicting output locations with previously defined output '"
+ << mapEntry->second->getSymbol() << "'";
+
+ error(symbol->getLine(), strstr.str().c_str(), name.c_str());
+ }
+ }
+ }
+}
+
+void ValidateOutputs::error(TSourceLoc loc, const char *reason, const char* token)
+{
+ mSink.prefix(EPrefixError);
+ mSink.location(loc);
+ mSink << "'" << token << "' : " << reason << "\n";
+ mNumErrors++;
+}
diff --git a/chromium/third_party/angle/src/compiler/translator/ValidateOutputs.h b/chromium/third_party/angle/src/compiler/translator/ValidateOutputs.h
new file mode 100644
index 00000000000..e391ad94860
--- /dev/null
+++ b/chromium/third_party/angle/src/compiler/translator/ValidateOutputs.h
@@ -0,0 +1,33 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/translator/intermediate.h"
+
+#include <set>
+
+class TInfoSinkBase;
+
+class ValidateOutputs : public TIntermTraverser
+{
+ public:
+ ValidateOutputs(TInfoSinkBase& sink, int maxDrawBuffers);
+
+ int numErrors() const { return mNumErrors; }
+
+ virtual void visitSymbol(TIntermSymbol*);
+
+ private:
+ TInfoSinkBase& mSink;
+ int mMaxDrawBuffers;
+ int mNumErrors;
+ bool mHasUnspecifiedOutputLocation;
+
+ typedef std::map<int, TIntermSymbol*> OutputMap;
+ OutputMap mOutputMap;
+ std::set<TString> mVisitedSymbols;
+
+ void error(TSourceLoc loc, const char *reason, const char* token);
+};
diff --git a/chromium/third_party/angle/src/compiler/VariableInfo.cpp b/chromium/third_party/angle/src/compiler/translator/VariableInfo.cpp
index f3f7b1ef35a..d0b19907f4c 100644
--- a/chromium/third_party/angle/src/compiler/VariableInfo.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/VariableInfo.cpp
@@ -1,10 +1,10 @@
//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-#include "compiler/VariableInfo.h"
+#include "compiler/translator/VariableInfo.h"
namespace {
@@ -21,11 +21,32 @@ ShDataType getVariableDataType(const TType& type)
switch (type.getBasicType()) {
case EbtFloat:
if (type.isMatrix()) {
- switch (type.getNominalSize()) {
- case 2: return SH_FLOAT_MAT2;
- case 3: return SH_FLOAT_MAT3;
- case 4: return SH_FLOAT_MAT4;
- default: UNREACHABLE();
+ switch (type.getCols())
+ {
+ case 2:
+ switch (type.getRows())
+ {
+ case 2: return SH_FLOAT_MAT2;
+ case 3: return SH_FLOAT_MAT2x3;
+ case 4: return SH_FLOAT_MAT2x4;
+ default: UNREACHABLE();
+ }
+ case 3:
+ switch (type.getRows())
+ {
+ case 2: return SH_FLOAT_MAT3x2;
+ case 3: return SH_FLOAT_MAT3;
+ case 4: return SH_FLOAT_MAT3x4;
+ default: UNREACHABLE();
+ }
+ case 4:
+ switch (type.getRows())
+ {
+ case 2: return SH_FLOAT_MAT4x2;
+ case 3: return SH_FLOAT_MAT4x3;
+ case 4: return SH_FLOAT_MAT4;
+ default: UNREACHABLE();
+ }
}
} else if (type.isVector()) {
switch (type.getNominalSize()) {
@@ -50,6 +71,19 @@ ShDataType getVariableDataType(const TType& type)
} else {
return SH_INT;
}
+ case EbtUInt:
+ if (type.isMatrix()) {
+ UNREACHABLE();
+ } else if (type.isVector()) {
+ switch (type.getNominalSize()) {
+ case 2: return SH_UNSIGNED_INT_VEC2;
+ case 3: return SH_UNSIGNED_INT_VEC3;
+ case 4: return SH_UNSIGNED_INT_VEC4;
+ default: UNREACHABLE();
+ }
+ } else {
+ return SH_UNSIGNED_INT;
+ }
case EbtBool:
if (type.isMatrix()) {
UNREACHABLE();
@@ -64,9 +98,22 @@ ShDataType getVariableDataType(const TType& type)
return SH_BOOL;
}
case EbtSampler2D: return SH_SAMPLER_2D;
+ case EbtSampler3D: return SH_SAMPLER_3D;
case EbtSamplerCube: return SH_SAMPLER_CUBE;
case EbtSamplerExternalOES: return SH_SAMPLER_EXTERNAL_OES;
case EbtSampler2DRect: return SH_SAMPLER_2D_RECT_ARB;
+ case EbtSampler2DArray: return SH_SAMPLER_2D_ARRAY;
+ case EbtISampler2D: return SH_INT_SAMPLER_2D;
+ case EbtISampler3D: return SH_INT_SAMPLER_3D;
+ case EbtISamplerCube: return SH_INT_SAMPLER_CUBE;
+ case EbtISampler2DArray: return SH_INT_SAMPLER_2D_ARRAY;
+ case EbtUSampler2D: return SH_UNSIGNED_INT_SAMPLER_2D;
+ case EbtUSampler3D: return SH_UNSIGNED_INT_SAMPLER_3D;
+ case EbtUSamplerCube: return SH_UNSIGNED_INT_SAMPLER_CUBE;
+ case EbtUSampler2DArray: return SH_UNSIGNED_INT_SAMPLER_2D_ARRAY;
+ case EbtSampler2DShadow: return SH_SAMPLER_2D_SHADOW;
+ case EbtSamplerCubeShadow: return SH_SAMPLER_CUBE_SHADOW;
+ case EbtSampler2DArrayShadow: return SH_SAMPLER_2D_ARRAY_SHADOW;
default: UNREACHABLE();
}
return SH_NONE;
@@ -89,7 +136,7 @@ void getVariableInfo(const TType& type,
TVariableInfoList& infoList,
ShHashFunction64 hashFunction)
{
- if (type.getBasicType() == EbtStruct) {
+ if (type.getBasicType() == EbtStruct || type.isInterfaceBlock()) {
if (type.isArray()) {
for (int i = 0; i < type.getArraySize(); ++i) {
TString lname = name + arrayBrackets(i);
@@ -116,10 +163,12 @@ void getBuiltInVariableInfo(const TType& type,
varInfo.name = (name + "[0]").c_str();
varInfo.mappedName = (mappedName + "[0]").c_str();
varInfo.size = type.getArraySize();
+ varInfo.isArray = true;
} else {
varInfo.name = name.c_str();
varInfo.mappedName = mappedName.c_str();
varInfo.size = 1;
+ varInfo.isArray = false;
}
varInfo.precision = type.getPrecision();
varInfo.type = getVariableDataType(type);
@@ -132,9 +181,11 @@ void getUserDefinedVariableInfo(const TType& type,
TVariableInfoList& infoList,
ShHashFunction64 hashFunction)
{
- ASSERT(type.getBasicType() == EbtStruct);
+ ASSERT(type.getBasicType() == EbtStruct || type.isInterfaceBlock());
- const TFieldList& fields = type.getStruct()->fields();
+ const TFieldList& fields = type.isInterfaceBlock() ?
+ type.getInterfaceBlock()->fields() :
+ type.getStruct()->fields();
for (size_t i = 0; i < fields.size(); ++i) {
const TType& fieldType = *(fields[i]->type());
const TString& fieldName = fields[i]->name();
@@ -167,6 +218,7 @@ TVariableInfo* findVariable(const TType& type,
TVariableInfo::TVariableInfo()
: type(SH_NONE),
size(0),
+ isArray(false),
precision(EbpUndefined),
staticUse(false)
{
@@ -175,6 +227,7 @@ TVariableInfo::TVariableInfo()
TVariableInfo::TVariableInfo(ShDataType type, int size)
: type(type),
size(size),
+ isArray(false),
precision(EbpUndefined),
staticUse(false)
{
@@ -269,12 +322,26 @@ bool CollectVariables::visitAggregate(Visit, TIntermAggregate* node)
case EOpDeclaration: {
const TIntermSequence& sequence = node->getSequence();
TQualifier qualifier = sequence.front()->getAsTyped()->getQualifier();
- if (qualifier == EvqAttribute || qualifier == EvqUniform ||
+ if (qualifier == EvqAttribute || qualifier == EvqVertexIn || qualifier == EvqUniform ||
qualifier == EvqVaryingIn || qualifier == EvqVaryingOut ||
qualifier == EvqInvariantVaryingIn || qualifier == EvqInvariantVaryingOut)
{
- TVariableInfoList& infoList = qualifier == EvqAttribute ? mAttribs :
- (qualifier == EvqUniform ? mUniforms : mVaryings);
+ TVariableInfoList *infoList = NULL;
+
+ switch (qualifier)
+ {
+ case EvqAttribute:
+ case EvqVertexIn:
+ infoList = &mAttribs;
+ break;
+ case EvqUniform:
+ infoList = &mUniforms;
+ break;
+ default:
+ infoList = &mVaryings;
+ break;
+ }
+
for (TIntermSequence::const_iterator i = sequence.begin();
i != sequence.end(); ++i)
{
@@ -289,11 +356,11 @@ bool CollectVariables::visitAggregate(Visit, TIntermAggregate* node)
if (mHashFunction == NULL)
processedSymbol = variable->getSymbol();
else
- processedSymbol = TIntermTraverser::hash(variable->getOriginalSymbol(), mHashFunction);
+ processedSymbol = TIntermTraverser::hash(variable->getSymbol(), mHashFunction);
getVariableInfo(variable->getType(),
- variable->getOriginalSymbol(),
+ variable->getSymbol(),
processedSymbol,
- infoList,
+ *infoList,
mHashFunction);
visitChildren = false;
}
@@ -305,4 +372,3 @@ bool CollectVariables::visitAggregate(Visit, TIntermAggregate* node)
return visitChildren;
}
-
diff --git a/chromium/third_party/angle/src/compiler/VariableInfo.h b/chromium/third_party/angle/src/compiler/translator/VariableInfo.h
index 3c7f2a5f84f..fc9e15301bc 100644
--- a/chromium/third_party/angle/src/compiler/VariableInfo.h
+++ b/chromium/third_party/angle/src/compiler/translator/VariableInfo.h
@@ -7,8 +7,7 @@
#ifndef COMPILER_VARIABLE_INFO_H_
#define COMPILER_VARIABLE_INFO_H_
-#include "GLSLANG/ShaderLang.h"
-#include "compiler/intermediate.h"
+#include "compiler/translator/intermediate.h"
// Provides information about a variable.
// It is currently being used to store info about active attribs and uniforms.
@@ -20,6 +19,7 @@ struct TVariableInfo {
TPersistString mappedName;
ShDataType type;
int size;
+ bool isArray;
TPrecision precision;
bool staticUse;
};
diff --git a/chromium/third_party/angle/src/compiler/VariablePacker.cpp b/chromium/third_party/angle/src/compiler/translator/VariablePacker.cpp
index 89572877635..6390e303941 100644
--- a/chromium/third_party/angle/src/compiler/VariablePacker.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/VariablePacker.cpp
@@ -3,16 +3,20 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-#include "compiler/VariablePacker.h"
+#include "compiler/translator/VariablePacker.h"
#include <algorithm>
-#include "compiler/ShHandle.h"
+#include "compiler/translator/ShHandle.h"
namespace {
int GetSortOrder(ShDataType type)
{
switch (type) {
case SH_FLOAT_MAT4:
+ case SH_FLOAT_MAT2x4:
+ case SH_FLOAT_MAT3x4:
+ case SH_FLOAT_MAT4x2:
+ case SH_FLOAT_MAT4x3:
return 0;
case SH_FLOAT_MAT2:
return 1;
@@ -21,6 +25,8 @@ int GetSortOrder(ShDataType type)
case SH_BOOL_VEC4:
return 2;
case SH_FLOAT_MAT3:
+ case SH_FLOAT_MAT2x3:
+ case SH_FLOAT_MAT3x2:
return 3;
case SH_FLOAT_VEC3:
case SH_INT_VEC3:
@@ -50,11 +56,17 @@ int VariablePacker::GetNumComponentsPerRow(ShDataType type)
switch (type) {
case SH_FLOAT_MAT4:
case SH_FLOAT_MAT2:
+ case SH_FLOAT_MAT2x4:
+ case SH_FLOAT_MAT3x4:
+ case SH_FLOAT_MAT4x2:
+ case SH_FLOAT_MAT4x3:
case SH_FLOAT_VEC4:
case SH_INT_VEC4:
case SH_BOOL_VEC4:
return 4;
case SH_FLOAT_MAT3:
+ case SH_FLOAT_MAT2x3:
+ case SH_FLOAT_MAT3x2:
case SH_FLOAT_VEC3:
case SH_INT_VEC3:
case SH_BOOL_VEC3:
@@ -81,8 +93,14 @@ int VariablePacker::GetNumRows(ShDataType type)
{
switch (type) {
case SH_FLOAT_MAT4:
+ case SH_FLOAT_MAT2x4:
+ case SH_FLOAT_MAT3x4:
+ case SH_FLOAT_MAT4x3:
+ case SH_FLOAT_MAT4x2:
return 4;
case SH_FLOAT_MAT3:
+ case SH_FLOAT_MAT2x3:
+ case SH_FLOAT_MAT3x2:
return 3;
case SH_FLOAT_MAT2:
return 2;
@@ -197,6 +215,14 @@ bool VariablePacker::CheckVariablesWithinPackingLimits(int maxVectors, const TVa
bottomNonFullRow_ = maxRows_ - 1;
TVariableInfoList variables(in_variables);
+ // Check whether each variable fits in the available vectors.
+ for (size_t i = 0; i < variables.size(); i++) {
+ const TVariableInfo& variable = variables[i];
+ if (variable.size > maxVectors / GetNumRows(variable.type)) {
+ return false;
+ }
+ }
+
// As per GLSL 1.017 Appendix A, Section 7 variables are packed in specific
// order by type, then by size of array, largest first.
std::sort(variables.begin(), variables.end(), TVariableInfoComparer());
diff --git a/chromium/third_party/angle/src/compiler/VariablePacker.h b/chromium/third_party/angle/src/compiler/translator/VariablePacker.h
index 8987066cc37..fd6090827cd 100644
--- a/chromium/third_party/angle/src/compiler/VariablePacker.h
+++ b/chromium/third_party/angle/src/compiler/translator/VariablePacker.h
@@ -8,7 +8,7 @@
#define _VARIABLEPACKER_INCLUDED_
#include <vector>
-#include "compiler/ShHandle.h"
+#include "compiler/translator/ShHandle.h"
class VariablePacker {
public:
diff --git a/chromium/third_party/angle/src/compiler/VersionGLSL.cpp b/chromium/third_party/angle/src/compiler/translator/VersionGLSL.cpp
index 7a82bb4dc17..dd11f99eb89 100644
--- a/chromium/third_party/angle/src/compiler/VersionGLSL.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/VersionGLSL.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/VersionGLSL.h"
+#include "compiler/translator/VersionGLSL.h"
static const int GLSL_VERSION_110 = 110;
static const int GLSL_VERSION_120 = 120;
diff --git a/chromium/third_party/angle/src/compiler/VersionGLSL.h b/chromium/third_party/angle/src/compiler/translator/VersionGLSL.h
index 1c1cb1ab97b..8a401c4e92b 100644
--- a/chromium/third_party/angle/src/compiler/VersionGLSL.h
+++ b/chromium/third_party/angle/src/compiler/translator/VersionGLSL.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -7,8 +7,7 @@
#ifndef COMPILER_VERSIONGLSL_H_
#define COMPILER_VERSIONGLSL_H_
-#include "GLSLANG/ShaderLang.h"
-#include "compiler/intermediate.h"
+#include "compiler/translator/intermediate.h"
// Traverses the intermediate tree to return the minimum GLSL version
// required to legally access all built-in features used in the shader.
@@ -24,6 +23,7 @@
// - matrix constructors taking matrix as argument.
// - array as "out" function parameters
//
+// TODO: ES3 equivalent versions of GLSL
class TVersionGLSL : public TIntermTraverser {
public:
TVersionGLSL(ShShaderType type);
diff --git a/chromium/third_party/angle/src/compiler/debug.cpp b/chromium/third_party/angle/src/compiler/translator/compilerdebug.cpp
index 6a7b0425127..10cbe43b8d5 100644
--- a/chromium/third_party/angle/src/compiler/debug.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/compilerdebug.cpp
@@ -6,17 +6,17 @@
// debug.cpp: Debugging utilities.
-#include "compiler/debug.h"
+#include "compiler/translator/compilerdebug.h"
#include <stdarg.h>
#include <stdio.h>
-#include "compiler/InitializeParseContext.h"
-#include "compiler/ParseContext.h"
+#include "compiler/translator/InitializeParseContext.h"
+#include "compiler/translator/ParseContext.h"
+#ifdef TRACE_ENABLED
static const int kTraceBufferLen = 1024;
-#ifdef TRACE_ENABLED
extern "C" {
void Trace(const char *format, ...) {
if (!format) return;
diff --git a/chromium/third_party/angle/src/compiler/debug.h b/chromium/third_party/angle/src/compiler/translator/compilerdebug.h
index 7a371516af0..7a371516af0 100644
--- a/chromium/third_party/angle/src/compiler/debug.h
+++ b/chromium/third_party/angle/src/compiler/translator/compilerdebug.h
diff --git a/chromium/third_party/angle/src/compiler/depgraph/DependencyGraph.cpp b/chromium/third_party/angle/src/compiler/translator/depgraph/DependencyGraph.cpp
index ca661d67678..19ddf5c4392 100644
--- a/chromium/third_party/angle/src/compiler/depgraph/DependencyGraph.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/depgraph/DependencyGraph.cpp
@@ -6,8 +6,8 @@
#pragma warning(disable: 4718)
-#include "compiler/depgraph/DependencyGraph.h"
-#include "compiler/depgraph/DependencyGraphBuilder.h"
+#include "compiler/translator/depgraph/DependencyGraph.h"
+#include "compiler/translator/depgraph/DependencyGraphBuilder.h"
TDependencyGraph::TDependencyGraph(TIntermNode* intermNode)
{
diff --git a/chromium/third_party/angle/src/compiler/depgraph/DependencyGraph.h b/chromium/third_party/angle/src/compiler/translator/depgraph/DependencyGraph.h
index 5a9c35d00b7..5ea1cbb837d 100644
--- a/chromium/third_party/angle/src/compiler/depgraph/DependencyGraph.h
+++ b/chromium/third_party/angle/src/compiler/translator/depgraph/DependencyGraph.h
@@ -7,7 +7,7 @@
#ifndef COMPILER_DEPGRAPH_DEPENDENCY_GRAPH_H
#define COMPILER_DEPGRAPH_DEPENDENCY_GRAPH_H
-#include "compiler/intermediate.h"
+#include "compiler/translator/intermediate.h"
#include <set>
#include <stack>
diff --git a/chromium/third_party/angle/src/compiler/depgraph/DependencyGraphBuilder.cpp b/chromium/third_party/angle/src/compiler/translator/depgraph/DependencyGraphBuilder.cpp
index 026e6d57a4f..d5f2cba5fc0 100644
--- a/chromium/third_party/angle/src/compiler/depgraph/DependencyGraphBuilder.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/depgraph/DependencyGraphBuilder.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/depgraph/DependencyGraphBuilder.h"
+#include "compiler/translator/depgraph/DependencyGraphBuilder.h"
void TDependencyGraphBuilder::build(TIntermNode* node, TDependencyGraph* graph)
{
diff --git a/chromium/third_party/angle/src/compiler/depgraph/DependencyGraphBuilder.h b/chromium/third_party/angle/src/compiler/translator/depgraph/DependencyGraphBuilder.h
index c5f232cb21e..3e928fb77eb 100644
--- a/chromium/third_party/angle/src/compiler/depgraph/DependencyGraphBuilder.h
+++ b/chromium/third_party/angle/src/compiler/translator/depgraph/DependencyGraphBuilder.h
@@ -7,7 +7,7 @@
#ifndef COMPILER_DEPGRAPH_DEPENDENCY_GRAPH_BUILDER_H
#define COMPILER_DEPGRAPH_DEPENDENCY_GRAPH_BUILDER_H
-#include "compiler/depgraph/DependencyGraph.h"
+#include "compiler/translator/depgraph/DependencyGraph.h"
//
// Creates a dependency graph of symbols, function calls, conditions etc. by traversing a
diff --git a/chromium/third_party/angle/src/compiler/depgraph/DependencyGraphOutput.cpp b/chromium/third_party/angle/src/compiler/translator/depgraph/DependencyGraphOutput.cpp
index 6fc489e7b6f..e226333545f 100644
--- a/chromium/third_party/angle/src/compiler/depgraph/DependencyGraphOutput.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/depgraph/DependencyGraphOutput.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/depgraph/DependencyGraphOutput.h"
+#include "compiler/translator/depgraph/DependencyGraphOutput.h"
void TDependencyGraphOutput::outputIndentation()
{
diff --git a/chromium/third_party/angle/src/compiler/depgraph/DependencyGraphOutput.h b/chromium/third_party/angle/src/compiler/translator/depgraph/DependencyGraphOutput.h
index 01447da987d..c3a4112278f 100644
--- a/chromium/third_party/angle/src/compiler/depgraph/DependencyGraphOutput.h
+++ b/chromium/third_party/angle/src/compiler/translator/depgraph/DependencyGraphOutput.h
@@ -7,8 +7,8 @@
#ifndef COMPILER_DEPGRAPH_DEPENDENCY_GRAPH_OUTPUT_H
#define COMPILER_DEPGRAPH_DEPENDENCY_GRAPH_OUTPUT_H
-#include "compiler/depgraph/DependencyGraph.h"
-#include "compiler/InfoSink.h"
+#include "compiler/translator/depgraph/DependencyGraph.h"
+#include "compiler/translator/InfoSink.h"
class TDependencyGraphOutput : public TDependencyGraphTraverser {
public:
diff --git a/chromium/third_party/angle/src/compiler/depgraph/DependencyGraphTraverse.cpp b/chromium/third_party/angle/src/compiler/translator/depgraph/DependencyGraphTraverse.cpp
index b158575cec3..197fde97e26 100644
--- a/chromium/third_party/angle/src/compiler/depgraph/DependencyGraphTraverse.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/depgraph/DependencyGraphTraverse.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/depgraph/DependencyGraph.h"
+#include "compiler/translator/depgraph/DependencyGraph.h"
// These methods do a breadth-first traversal through the graph and mark visited nodes.
diff --git a/chromium/third_party/angle/src/compiler/generate_parser.sh b/chromium/third_party/angle/src/compiler/translator/generate_parser.sh
index e4d88b2e84c..e4d88b2e84c 100755..100644
--- a/chromium/third_party/angle/src/compiler/generate_parser.sh
+++ b/chromium/third_party/angle/src/compiler/translator/generate_parser.sh
diff --git a/chromium/third_party/angle/src/compiler/glslang.h b/chromium/third_party/angle/src/compiler/translator/glslang.h
index f221199093c..f221199093c 100644
--- a/chromium/third_party/angle/src/compiler/glslang.h
+++ b/chromium/third_party/angle/src/compiler/translator/glslang.h
diff --git a/chromium/third_party/angle/src/compiler/translator/glslang.l b/chromium/third_party/angle/src/compiler/translator/glslang.l
new file mode 100644
index 00000000000..518b78df11e
--- /dev/null
+++ b/chromium/third_party/angle/src/compiler/translator/glslang.l
@@ -0,0 +1,558 @@
+/*
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+This file contains the Lex specification for GLSL ES.
+Based on ANSI C grammar, Lex specification:
+http://www.lysator.liu.se/c/ANSI-C-grammar-l.html
+
+IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh,
+WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp).
+*/
+
+%top{
+//
+// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
+
+// Ignore errors in auto-generated code.
+#if defined(__GNUC__)
+#pragma GCC diagnostic ignored "-Wunused-function"
+#pragma GCC diagnostic ignored "-Wunused-variable"
+#pragma GCC diagnostic ignored "-Wswitch-enum"
+#elif defined(_MSC_VER)
+#pragma warning(disable: 4065)
+#pragma warning(disable: 4189)
+#pragma warning(disable: 4505)
+#pragma warning(disable: 4701)
+#endif
+}
+
+%{
+#include "compiler/translator/glslang.h"
+#include "compiler/translator/ParseContext.h"
+#include "compiler/preprocessor/Token.h"
+#include "compiler/translator/util.h"
+#include "compiler/translator/length_limits.h"
+#include "glslang_tab.h"
+
+/* windows only pragma */
+#ifdef _MSC_VER
+#pragma warning(disable : 4102)
+#endif
+
+#define YY_USER_ACTION \
+ yylloc->first_file = yylloc->last_file = yycolumn; \
+ yylloc->first_line = yylloc->last_line = yylineno;
+
+#define YY_INPUT(buf, result, max_size) \
+ result = string_input(buf, max_size, yyscanner);
+
+static yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner);
+static int check_type(yyscan_t yyscanner);
+static int reserved_word(yyscan_t yyscanner);
+static int ES2_reserved_ES3_keyword(TParseContext *context, int token);
+static int ES2_keyword_ES3_reserved(TParseContext *context, int token);
+static int ES2_ident_ES3_keyword(TParseContext *context, int token);
+static int uint_constant(TParseContext *context);
+static int int_constant(yyscan_t yyscanner);
+static int float_constant(yyscan_t yyscanner);
+static int floatsuffix_check(TParseContext* context);
+%}
+
+%option noyywrap nounput never-interactive
+%option yylineno reentrant bison-bridge bison-locations
+%option extra-type="TParseContext*"
+
+D [0-9]
+L [a-zA-Z_]
+H [a-fA-F0-9]
+E [Ee][+-]?{D}+
+O [0-7]
+
+%%
+
+%{
+ TParseContext* context = yyextra;
+%}
+
+"invariant" { return INVARIANT; }
+"highp" { return HIGH_PRECISION; }
+"mediump" { return MEDIUM_PRECISION; }
+"lowp" { return LOW_PRECISION; }
+"precision" { return PRECISION; }
+
+"attribute" { return ES2_keyword_ES3_reserved(context, ATTRIBUTE); }
+"const" { return CONST_QUAL; }
+"uniform" { return UNIFORM; }
+"varying" { return ES2_keyword_ES3_reserved(context, VARYING); }
+
+"break" { return BREAK; }
+"continue" { return CONTINUE; }
+"do" { return DO; }
+"for" { return FOR; }
+"while" { return WHILE; }
+
+"if" { return IF; }
+"else" { return ELSE; }
+"switch" { return ES2_reserved_ES3_keyword(context, SWITCH); }
+"case" { return ES2_ident_ES3_keyword(context, CASE); }
+"default" { return ES2_reserved_ES3_keyword(context, DEFAULT); }
+
+"centroid" { return ES2_ident_ES3_keyword(context, CENTROID); }
+"flat" { return ES2_reserved_ES3_keyword(context, FLAT); }
+"smooth" { return ES2_ident_ES3_keyword(context, SMOOTH); }
+
+"in" { return IN_QUAL; }
+"out" { return OUT_QUAL; }
+"inout" { return INOUT_QUAL; }
+
+"float" { return FLOAT_TYPE; }
+"int" { return INT_TYPE; }
+"uint" { return ES2_ident_ES3_keyword(context, UINT_TYPE); }
+"void" { return VOID_TYPE; }
+"bool" { return BOOL_TYPE; }
+"true" { yylval->lex.b = true; return BOOLCONSTANT; }
+"false" { yylval->lex.b = false; return BOOLCONSTANT; }
+
+"discard" { return DISCARD; }
+"return" { return RETURN; }
+
+"mat2" { return MATRIX2; }
+"mat3" { return MATRIX3; }
+"mat4" { return MATRIX4; }
+
+"mat2x2" { return ES2_ident_ES3_keyword(context, MATRIX2); }
+"mat3x3" { return ES2_ident_ES3_keyword(context, MATRIX3); }
+"mat4x4" { return ES2_ident_ES3_keyword(context, MATRIX4); }
+
+"mat2x3" { return ES2_ident_ES3_keyword(context, MATRIX2x3); }
+"mat3x2" { return ES2_ident_ES3_keyword(context, MATRIX3x2); }
+"mat2x4" { return ES2_ident_ES3_keyword(context, MATRIX2x4); }
+"mat4x2" { return ES2_ident_ES3_keyword(context, MATRIX4x2); }
+"mat3x4" { return ES2_ident_ES3_keyword(context, MATRIX3x4); }
+"mat4x3" { return ES2_ident_ES3_keyword(context, MATRIX4x3); }
+
+"vec2" { return VEC2; }
+"vec3" { return VEC3; }
+"vec4" { return VEC4; }
+"ivec2" { return IVEC2; }
+"ivec3" { return IVEC3; }
+"ivec4" { return IVEC4; }
+"bvec2" { return BVEC2; }
+"bvec3" { return BVEC3; }
+"bvec4" { return BVEC4; }
+"uvec2" { return ES2_ident_ES3_keyword(context, UVEC2); }
+"uvec3" { return ES2_ident_ES3_keyword(context, UVEC3); }
+"uvec4" { return ES2_ident_ES3_keyword(context, UVEC4); }
+
+"sampler2D" { return SAMPLER2D; }
+"samplerCube" { return SAMPLERCUBE; }
+"samplerExternalOES" { return SAMPLER_EXTERNAL_OES; }
+"sampler3D" { return ES2_reserved_ES3_keyword(context, SAMPLER3D); }
+"sampler3DRect" { return ES2_reserved_ES3_keyword(context, SAMPLER3DRECT); }
+"sampler2DRect" { return SAMPLER2DRECT; }
+"sampler2DArray" { return ES2_ident_ES3_keyword(context, SAMPLER2DARRAY); }
+"isampler2D" { return ES2_ident_ES3_keyword(context, ISAMPLER2D); }
+"isampler3D" { return ES2_ident_ES3_keyword(context, ISAMPLER3D); }
+"isamplerCube" { return ES2_ident_ES3_keyword(context, ISAMPLERCUBE); }
+"isampler2DArray" { return ES2_ident_ES3_keyword(context, ISAMPLER2DARRAY); }
+"usampler2D" { return ES2_ident_ES3_keyword(context, USAMPLER2D); }
+"usampler3D" { return ES2_ident_ES3_keyword(context, USAMPLER3D); }
+"usamplerCube" { return ES2_ident_ES3_keyword(context, USAMPLERCUBE); }
+"usampler2DArray" { return ES2_ident_ES3_keyword(context, USAMPLER2DARRAY); }
+"sampler2DShadow" { return ES2_reserved_ES3_keyword(context, SAMPLER2DSHADOW); }
+"samplerCubeShadow" { return ES2_ident_ES3_keyword(context, SAMPLERCUBESHADOW); }
+"sampler2DArrayShadow" { return ES2_ident_ES3_keyword(context, SAMPLER2DARRAYSHADOW); }
+
+"struct" { return STRUCT; }
+
+"layout" { return ES2_ident_ES3_keyword(context, LAYOUT); }
+
+ /* Reserved keywords for GLSL ES 3.00 that are not reserved for GLSL ES 1.00 */
+"coherent" |
+"restrict" |
+"readonly" |
+"writeonly" |
+"resource" |
+"atomic_uint" |
+"noperspective" |
+"patch" |
+"sample" |
+"subroutine" |
+"common" |
+"partition" |
+"active" |
+
+"filter" |
+"image1D" |
+"image2D" |
+"image3D" |
+"imageCube" |
+"iimage1D" |
+"iimage2D" |
+"iimage3D" |
+"iimageCube" |
+"uimage1D" |
+"uimage2D" |
+"uimage3D" |
+"uimageCube" |
+"image1DArray" |
+"image2DArray" |
+"iimage1DArray" |
+"iimage2DArray" |
+"uimage1DArray" |
+"uimage2DArray" |
+"image1DShadow" |
+"image2DShadow" |
+"image1DArrayShadow" |
+"image2DArrayShadow" |
+"imageBuffer" |
+"iimageBuffer" |
+"uimageBuffer" |
+
+"sampler1DArray" |
+"sampler1DArrayShadow" |
+"isampler1D" |
+"isampler1DArray" |
+"usampler1D" |
+"usampler1DArray" |
+"isampler2DRect" |
+"usampler2DRect" |
+"samplerBuffer" |
+"isamplerBuffer" |
+"usamplerBuffer" |
+"sampler2DMS" |
+"isampler2DMS" |
+"usampler2DMS" |
+"sampler2DMSArray" |
+"isampler2DMSArray" |
+"usampler2DMSArray" {
+ if (context->shaderVersion < 300) {
+ yylval->lex.string = NewPoolTString(yytext);
+ return check_type(yyscanner);
+ }
+ return reserved_word(yyscanner);
+}
+
+ /* Reserved keywords in GLSL ES 1.00 that are not reserved in GLSL ES 3.00 */
+"packed" {
+ if (context->shaderVersion >= 300)
+ {
+ yylval->lex.string = NewPoolTString(yytext);
+ return check_type(yyscanner);
+ }
+
+ return reserved_word(yyscanner);
+}
+
+ /* Reserved keywords */
+"asm" |
+
+"class" |
+"union" |
+"enum" |
+"typedef" |
+"template" |
+"this" |
+
+"goto" |
+
+"inline" |
+"noinline" |
+"volatile" |
+"public" |
+"static" |
+"extern" |
+"external" |
+"interface" |
+
+"long" |
+"short" |
+"double" |
+"half" |
+"fixed" |
+"unsigned" |
+"superp" |
+
+"input" |
+"output" |
+
+"hvec2" |
+"hvec3" |
+"hvec4" |
+"dvec2" |
+"dvec3" |
+"dvec4" |
+"fvec2" |
+"fvec3" |
+"fvec4" |
+
+"sampler1D" |
+"sampler1DShadow" |
+"sampler2DRectShadow" |
+
+"sizeof" |
+"cast" |
+
+"namespace" |
+"using" { return reserved_word(yyscanner); }
+
+{L}({L}|{D})* {
+ yylval->lex.string = NewPoolTString(yytext);
+ return check_type(yyscanner);
+}
+
+0[xX]{H}+ { return int_constant(yyscanner); }
+0{O}+ { return int_constant(yyscanner); }
+{D}+ { return int_constant(yyscanner); }
+
+0[xX]{H}+[uU] { return uint_constant(context); }
+0{O}+[uU] { return uint_constant(context); }
+{D}+[uU] { return uint_constant(context); }
+
+{D}+{E} { return float_constant(yyscanner); }
+{D}+"."{D}*({E})? { return float_constant(yyscanner); }
+"."{D}+({E})? { return float_constant(yyscanner); }
+
+{D}+{E}[fF] { return floatsuffix_check(context); }
+{D}+"."{D}*({E})?[fF] { return floatsuffix_check(context); }
+"."{D}+({E})?[fF] { return floatsuffix_check(context); }
+
+"+=" { return ADD_ASSIGN; }
+"-=" { return SUB_ASSIGN; }
+"*=" { return MUL_ASSIGN; }
+"/=" { return DIV_ASSIGN; }
+"%=" { return MOD_ASSIGN; }
+"<<=" { return LEFT_ASSIGN; }
+">>=" { return RIGHT_ASSIGN; }
+"&=" { return AND_ASSIGN; }
+"^=" { return XOR_ASSIGN; }
+"|=" { return OR_ASSIGN; }
+
+"++" { return INC_OP; }
+"--" { return DEC_OP; }
+"&&" { return AND_OP; }
+"||" { return OR_OP; }
+"^^" { return XOR_OP; }
+"<=" { return LE_OP; }
+">=" { return GE_OP; }
+"==" { return EQ_OP; }
+"!=" { return NE_OP; }
+"<<" { return LEFT_OP; }
+">>" { return RIGHT_OP; }
+";" { return SEMICOLON; }
+("{"|"<%") { return LEFT_BRACE; }
+("}"|"%>") { return RIGHT_BRACE; }
+"," { return COMMA; }
+":" { return COLON; }
+"=" { return EQUAL; }
+"(" { return LEFT_PAREN; }
+")" { return RIGHT_PAREN; }
+("["|"<:") { return LEFT_BRACKET; }
+("]"|":>") { return RIGHT_BRACKET; }
+"." { return DOT; }
+"!" { return BANG; }
+"-" { return DASH; }
+"~" { return TILDE; }
+"+" { return PLUS; }
+"*" { return STAR; }
+"/" { return SLASH; }
+"%" { return PERCENT; }
+"<" { return LEFT_ANGLE; }
+">" { return RIGHT_ANGLE; }
+"|" { return VERTICAL_BAR; }
+"^" { return CARET; }
+"&" { return AMPERSAND; }
+"?" { return QUESTION; }
+
+[ \t\v\n\f\r] { }
+<<EOF>> { yyterminate(); }
+. { assert(false); return 0; }
+
+%%
+
+yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner) {
+ pp::Token token;
+ yyget_extra(yyscanner)->preprocessor.lex(&token);
+ yy_size_t len = token.type == pp::Token::LAST ? 0 : token.text.size();
+ if (len < max_size)
+ memcpy(buf, token.text.c_str(), len);
+ yyset_column(token.location.file, yyscanner);
+ yyset_lineno(token.location.line, yyscanner);
+
+ if (len >= max_size)
+ YY_FATAL_ERROR("Input buffer overflow");
+ else if (len > 0)
+ buf[len++] = ' ';
+ return len;
+}
+
+int check_type(yyscan_t yyscanner) {
+ struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
+
+ int token = IDENTIFIER;
+ TSymbol* symbol = yyextra->symbolTable.find(yytext, yyextra->shaderVersion);
+ if (symbol && symbol->isVariable()) {
+ TVariable* variable = static_cast<TVariable*>(symbol);
+ if (variable->isUserType()) {
+ token = TYPE_NAME;
+ }
+ }
+ yylval->lex.symbol = symbol;
+ return token;
+}
+
+int reserved_word(yyscan_t yyscanner) {
+ struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
+
+ yyextra->error(*yylloc, "Illegal use of reserved word", yytext, "");
+ yyextra->recover();
+ return 0;
+}
+
+int ES2_reserved_ES3_keyword(TParseContext *context, int token)
+{
+ yyscan_t yyscanner = (yyscan_t) context->scanner;
+
+ if (context->shaderVersion < 300)
+ {
+ return reserved_word(yyscanner);
+ }
+
+ return token;
+}
+
+int ES2_keyword_ES3_reserved(TParseContext *context, int token)
+{
+ yyscan_t yyscanner = (yyscan_t) context->scanner;
+
+ if (context->shaderVersion >= 300)
+ {
+ return reserved_word(yyscanner);
+ }
+
+ return token;
+}
+
+int ES2_ident_ES3_keyword(TParseContext *context, int token)
+{
+ struct yyguts_t* yyg = (struct yyguts_t*) context->scanner;
+ yyscan_t yyscanner = (yyscan_t) context->scanner;
+
+ // not a reserved word in GLSL ES 1.00, so could be used as an identifier/type name
+ if (context->shaderVersion < 300)
+ {
+ yylval->lex.string = NewPoolTString(yytext);
+ return check_type(yyscanner);
+ }
+
+ return token;
+}
+
+int uint_constant(TParseContext *context)
+{
+ struct yyguts_t* yyg = (struct yyguts_t*) context->scanner;
+ yyscan_t yyscanner = (yyscan_t) context->scanner;
+
+ if (context->shaderVersion < 300)
+ {
+ context->error(*yylloc, "Unsigned integers are unsupported prior to GLSL ES 3.00", yytext, "");
+ context->recover();
+ return 0;
+ }
+
+ if (!atoi_clamp(yytext, &(yylval->lex.i)))
+ yyextra->warning(*yylloc, "Integer overflow", yytext, "");
+
+ return UINTCONSTANT;
+}
+
+int floatsuffix_check(TParseContext* context)
+{
+ struct yyguts_t* yyg = (struct yyguts_t*) context->scanner;
+
+ if (context->shaderVersion < 300)
+ {
+ context->error(*yylloc, "Floating-point suffix unsupported prior to GLSL ES 3.00", yytext);
+ context->recover();
+ return 0;
+ }
+
+ if (!atof_clamp(yytext, &(yylval->lex.f)))
+ yyextra->warning(*yylloc, "Float overflow", yytext, "");
+
+ return(FLOATCONSTANT);
+}
+
+void yyerror(YYLTYPE* lloc, TParseContext* context, const char* reason) {
+ context->error(*lloc, reason, yyget_text(context->scanner));
+ context->recover();
+}
+
+int int_constant(yyscan_t yyscanner) {
+ struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
+
+ if (!atoi_clamp(yytext, &(yylval->lex.i)))
+ yyextra->warning(*yylloc, "Integer overflow", yytext, "");
+ return INTCONSTANT;
+}
+
+int float_constant(yyscan_t yyscanner) {
+ struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
+
+ if (!atof_clamp(yytext, &(yylval->lex.f)))
+ yyextra->warning(*yylloc, "Float overflow", yytext, "");
+ return FLOATCONSTANT;
+}
+
+int glslang_initialize(TParseContext* context) {
+ yyscan_t scanner = NULL;
+ if (yylex_init_extra(context, &scanner))
+ return 1;
+
+ context->scanner = scanner;
+ return 0;
+}
+
+int glslang_finalize(TParseContext* context) {
+ yyscan_t scanner = context->scanner;
+ if (scanner == NULL) return 0;
+
+ context->scanner = NULL;
+ yylex_destroy(scanner);
+
+ return 0;
+}
+
+int glslang_scan(size_t count, const char* const string[], const int length[],
+ TParseContext* context) {
+ yyrestart(NULL, context->scanner);
+ yyset_column(0, context->scanner);
+ yyset_lineno(1, context->scanner);
+
+ // Initialize preprocessor.
+ if (!context->preprocessor.init(count, string, length))
+ return 1;
+
+ // Define extension macros.
+ const TExtensionBehavior& extBehavior = context->extensionBehavior();
+ for (TExtensionBehavior::const_iterator iter = extBehavior.begin();
+ iter != extBehavior.end(); ++iter) {
+ context->preprocessor.predefineMacro(iter->first.c_str(), 1);
+ }
+ if (context->fragmentPrecisionHigh)
+ context->preprocessor.predefineMacro("GL_FRAGMENT_PRECISION_HIGH", 1);
+
+ context->preprocessor.setMaxTokenSize(GetGlobalMaxTokenSize(context->shaderSpec));
+
+ return 0;
+}
+
diff --git a/chromium/third_party/angle/src/compiler/glslang.y b/chromium/third_party/angle/src/compiler/translator/glslang.y
index a8dceb40acb..8ebf2d1f641 100644
--- a/chromium/third_party/angle/src/compiler/glslang.y
+++ b/chromium/third_party/angle/src/compiler/translator/glslang.y
@@ -1,6 +1,6 @@
/*
//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -15,7 +15,7 @@ WHICH GENERATES THE GLSL ES PARSER (glslang_tab.cpp AND glslang_tab.h).
%{
//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -34,15 +34,15 @@ WHICH GENERATES THE GLSL ES PARSER (glslang_tab.cpp AND glslang_tab.h).
#pragma warning(disable: 4701)
#endif
-#include "compiler/SymbolTable.h"
-#include "compiler/ParseContext.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/ParseContext.h"
#include "GLSLANG/ShaderLang.h"
#define YYENABLE_NLS 0
#define YYLEX_PARAM context->scanner
-%}
+%}
%expect 1 /* One shift reduce conflict because of if | else */
%pure-parser
%parse-param {TParseContext* context}
@@ -51,7 +51,6 @@ WHICH GENERATES THE GLSL ES PARSER (glslang_tab.cpp AND glslang_tab.h).
%code requires {
#define YYLTYPE TSourceLoc
#define YYLTYPE_IS_DECLARED 1
-#define SH_MAX_TOKEN_LENGTH 256 // WebGL spec.
}
%union {
@@ -60,6 +59,7 @@ WHICH GENERATES THE GLSL ES PARSER (glslang_tab.cpp AND glslang_tab.h).
TString *string;
float f;
int i;
+ unsigned int u;
bool b;
};
TSymbol* symbol;
@@ -75,6 +75,7 @@ WHICH GENERATES THE GLSL ES PARSER (glslang_tab.cpp AND glslang_tab.h).
union {
TPublicType type;
TPrecision precision;
+ TLayoutQualifier layoutQualifier;
TQualifier qualifier;
TFunction* function;
TParameter param;
@@ -117,17 +118,38 @@ extern void yyerror(YYLTYPE* yylloc, TParseContext* context, const char* reason)
context->recover(); \
} \
}
+
+#define ES2_ONLY(S, L) { \
+ if (context->shaderVersion != 100) { \
+ context->error(L, " supported in GLSL ES 1.00 only ", S); \
+ context->recover(); \
+ } \
+}
+
+#define ES3_ONLY(TOKEN, LINE, REASON) { \
+ if (context->shaderVersion != 300) { \
+ context->error(LINE, REASON " supported in GLSL ES 3.00 only ", TOKEN); \
+ context->recover(); \
+ } \
+}
%}
%token <lex> INVARIANT HIGH_PRECISION MEDIUM_PRECISION LOW_PRECISION PRECISION
-%token <lex> ATTRIBUTE CONST_QUAL BOOL_TYPE FLOAT_TYPE INT_TYPE
-%token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN
-%token <lex> BVEC2 BVEC3 BVEC4 IVEC2 IVEC3 IVEC4 VEC2 VEC3 VEC4
+%token <lex> ATTRIBUTE CONST_QUAL BOOL_TYPE FLOAT_TYPE INT_TYPE UINT_TYPE
+%token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT
+%token <lex> BVEC2 BVEC3 BVEC4 IVEC2 IVEC3 IVEC4 VEC2 VEC3 VEC4 UVEC2 UVEC3 UVEC4
%token <lex> MATRIX2 MATRIX3 MATRIX4 IN_QUAL OUT_QUAL INOUT_QUAL UNIFORM VARYING
+%token <lex> MATRIX2x3 MATRIX3x2 MATRIX2x4 MATRIX4x2 MATRIX3x4 MATRIX4x3
+%token <lex> CENTROID FLAT SMOOTH
%token <lex> STRUCT VOID_TYPE WHILE
-%token <lex> SAMPLER2D SAMPLERCUBE SAMPLER_EXTERNAL_OES SAMPLER2DRECT
-
-%token <lex> IDENTIFIER TYPE_NAME FLOATCONSTANT INTCONSTANT BOOLCONSTANT
+%token <lex> SAMPLER2D SAMPLERCUBE SAMPLER_EXTERNAL_OES SAMPLER2DRECT SAMPLER2DARRAY
+%token <lex> ISAMPLER2D ISAMPLER3D ISAMPLERCUBE ISAMPLER2DARRAY
+%token <lex> USAMPLER2D USAMPLER3D USAMPLERCUBE USAMPLER2DARRAY
+%token <lex> SAMPLER3D SAMPLER3DRECT SAMPLER2DSHADOW SAMPLERCUBESHADOW SAMPLER2DARRAYSHADOW
+%token <lex> LAYOUT
+
+%token <lex> IDENTIFIER TYPE_NAME FLOATCONSTANT INTCONSTANT UINTCONSTANT BOOLCONSTANT
+%token <lex> FIELD_SELECTION
%token <lex> LEFT_OP RIGHT_OP
%token <lex> INC_OP DEC_OP LE_OP GE_OP EQ_OP NE_OP
%token <lex> AND_OP OR_OP XOR_OP MUL_ASSIGN DIV_ASSIGN ADD_ASSIGN
@@ -160,10 +182,11 @@ extern void yyerror(YYLTYPE* yylloc, TParseContext* context, const char* reason)
%type <interm> single_declaration init_declarator_list
%type <interm> parameter_declaration parameter_declarator parameter_type_specifier
-%type <interm.qualifier> parameter_qualifier
+%type <interm.qualifier> parameter_qualifier parameter_type_qualifier
+%type <interm.layoutQualifier> layout_qualifier layout_qualifier_id_list layout_qualifier_id
%type <interm.precision> precision_qualifier
-%type <interm.type> type_qualifier fully_specified_type type_specifier
+%type <interm.type> type_qualifier fully_specified_type type_specifier storage_qualifier interpolation_qualifier
%type <interm.type> type_specifier_no_prec type_specifier_nonarray
%type <interm.type> struct_specifier
%type <interm.field> struct_declarator
@@ -173,6 +196,8 @@ extern void yyerror(YYLTYPE* yylloc, TParseContext* context, const char* reason)
%type <interm> function_call_header_with_parameters function_call_header_no_parameters function_call_generic function_prototype
%type <interm> function_call_or_method
+%type <lex> enter_struct
+
%start translation_unit
%%
@@ -183,43 +208,55 @@ identifier
variable_identifier
: IDENTIFIER {
// The symbol table search was done in the lexical phase
- const TSymbol* symbol = $1.symbol;
- const TVariable* variable;
- if (symbol == 0) {
+ const TSymbol *symbol = $1.symbol;
+ const TVariable *variable = 0;
+
+ if (!symbol)
+ {
context->error(@1, "undeclared identifier", $1.string->c_str());
context->recover();
- TType type(EbtFloat, EbpUndefined);
- TVariable* fakeVariable = new TVariable($1.string, type);
- context->symbolTable.insert(*fakeVariable);
- variable = fakeVariable;
- } else {
- // This identifier can only be a variable type symbol
- if (! symbol->isVariable()) {
- context->error(@1, "variable expected", $1.string->c_str());
- context->recover();
- }
-
+ }
+ else if (!symbol->isVariable())
+ {
+ context->error(@1, "variable expected", $1.string->c_str());
+ context->recover();
+ }
+ else
+ {
variable = static_cast<const TVariable*>(symbol);
- if (context->symbolTable.findBuiltIn(variable->getName()) &&
+ if (context->symbolTable.findBuiltIn(variable->getName(), context->shaderVersion) &&
!variable->getExtension().empty() &&
- context->extensionErrorCheck(@1, variable->getExtension())) {
+ context->extensionErrorCheck(@1, variable->getExtension()))
+ {
context->recover();
}
}
- // don't delete $1.string, it's used by error recovery, and the pool
- // pop will reclaim the memory
+ if (!variable)
+ {
+ TType type(EbtFloat, EbpUndefined);
+ TVariable *fakeVariable = new TVariable($1.string, type);
+ context->symbolTable.declare(*fakeVariable);
+ variable = fakeVariable;
+ }
- if (variable->getType().getQualifier() == EvqConst ) {
+ if (variable->getType().getQualifier() == EvqConst)
+ {
ConstantUnion* constArray = variable->getConstPointer();
TType t(variable->getType());
$$ = context->intermediate.addConstantUnion(constArray, t, @1);
- } else
+ }
+ else
+ {
$$ = context->intermediate.addSymbol(variable->getUniqueId(),
variable->getName(),
variable->getType(),
@1);
+ }
+
+ // don't delete $1.string, it's used by error recovery, and the pool
+ // pop will reclaim the memory
}
;
@@ -232,6 +269,11 @@ primary_expression
unionArray->setIConst($1.i);
$$ = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), @1);
}
+ | UINTCONSTANT {
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setUConst($1.u);
+ $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtUInt, EbpUndefined, EvqConst), @1);
+ }
| FLOATCONSTANT {
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setFConst($1.f);
@@ -258,104 +300,12 @@ postfix_expression
$$ = $1;
}
| postfix_expression DOT identifier {
- if ($1->isArray()) {
- context->error(@3, "cannot apply dot operator to an array", ".");
- context->recover();
- }
-
- if ($1->isVector()) {
- TVectorFields fields;
- if (! context->parseVectorFields(*$3.string, $1->getNominalSize(), fields, @3)) {
- fields.num = 1;
- fields.offsets[0] = 0;
- context->recover();
- }
-
- if ($1->getType().getQualifier() == EvqConst) { // constant folding for vector fields
- $$ = context->addConstVectorNode(fields, $1, @3);
- if ($$ == 0) {
- context->recover();
- $$ = $1;
- }
- else
- $$->setType(TType($1->getBasicType(), $1->getPrecision(), EvqConst, (int) (*$3.string).size()));
- } else {
- TString vectorString = *$3.string;
- TIntermTyped* index = context->intermediate.addSwizzle(fields, @3);
- $$ = context->intermediate.addIndex(EOpVectorSwizzle, $1, index, @2);
- $$->setType(TType($1->getBasicType(), $1->getPrecision(), EvqTemporary, (int) vectorString.size()));
- }
- } else if ($1->isMatrix()) {
- TMatrixFields fields;
- if (! context->parseMatrixFields(*$3.string, $1->getNominalSize(), fields, @3)) {
- fields.wholeRow = false;
- fields.wholeCol = false;
- fields.row = 0;
- fields.col = 0;
- context->recover();
- }
-
- if (fields.wholeRow || fields.wholeCol) {
- context->error(@2, " non-scalar fields not implemented yet", ".");
- context->recover();
- ConstantUnion *unionArray = new ConstantUnion[1];
- unionArray->setIConst(0);
- TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), @3);
- $$ = context->intermediate.addIndex(EOpIndexDirect, $1, index, @2);
- $$->setType(TType($1->getBasicType(), $1->getPrecision(),EvqTemporary, $1->getNominalSize()));
- } else {
- ConstantUnion *unionArray = new ConstantUnion[1];
- unionArray->setIConst(fields.col * $1->getNominalSize() + fields.row);
- TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), @3);
- $$ = context->intermediate.addIndex(EOpIndexDirect, $1, index, @2);
- $$->setType(TType($1->getBasicType(), $1->getPrecision()));
- }
- } else if ($1->getBasicType() == EbtStruct) {
- bool fieldFound = false;
- const TFieldList& fields = $1->getType().getStruct()->fields();
- unsigned int i;
- for (i = 0; i < fields.size(); ++i) {
- if (fields[i]->name() == *$3.string) {
- fieldFound = true;
- break;
- }
- }
- if (fieldFound) {
- if ($1->getType().getQualifier() == EvqConst) {
- $$ = context->addConstStruct(*$3.string, $1, @2);
- if ($$ == 0) {
- context->recover();
- $$ = $1;
- }
- else {
- $$->setType(*fields[i]->type());
- // change the qualifier of the return type, not of the structure field
- // as the structure definition is shared between various structures.
- $$->getTypePointer()->setQualifier(EvqConst);
- }
- } else {
- ConstantUnion *unionArray = new ConstantUnion[1];
- unionArray->setIConst(i);
- TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *fields[i]->type(), @3);
- $$ = context->intermediate.addIndex(EOpIndexDirectStruct, $1, index, @2);
- $$->setType(*fields[i]->type());
- }
- } else {
- context->error(@2, " no such field in structure", $3.string->c_str());
- context->recover();
- $$ = $1;
- }
- } else {
- context->error(@2, " field selection requires structure, vector, or matrix on left hand side", $3.string->c_str());
- context->recover();
- $$ = $1;
- }
- // don't delete $3.string, it's from the pool
+ $$ = context->addFieldSelectionExpression($1, @2, *$3.string, @3);
}
| postfix_expression INC_OP {
if (context->lValueErrorCheck(@2, "++", $1))
context->recover();
- $$ = context->intermediate.addUnaryMath(EOpPostIncrement, $1, @2, context->symbolTable);
+ $$ = context->intermediate.addUnaryMath(EOpPostIncrement, $1, @2);
if ($$ == 0) {
context->unaryOpError(@2, "++", $1->getCompleteString());
context->recover();
@@ -365,7 +315,7 @@ postfix_expression
| postfix_expression DEC_OP {
if (context->lValueErrorCheck(@2, "--", $1))
context->recover();
- $$ = context->intermediate.addUnaryMath(EOpPostDecrement, $1, @2, context->symbolTable);
+ $$ = context->intermediate.addUnaryMath(EOpPostDecrement, $1, @2);
if ($$ == 0) {
context->unaryOpError(@2, "--", $1->getCompleteString());
context->recover();
@@ -415,7 +365,7 @@ function_call
//
const TFunction* fnCandidate;
bool builtIn;
- fnCandidate = context->findFunction(@1, fnCall, &builtIn);
+ fnCandidate = context->findFunction(@1, fnCall, context->shaderVersion, &builtIn);
if (fnCandidate) {
//
// A declared function.
@@ -433,7 +383,7 @@ function_call
//
// Treat it like a built-in unary operator.
//
- $$ = context->intermediate.addUnaryMath(op, $1.intermNode, @1, context->symbolTable);
+ $$ = context->intermediate.addUnaryMath(op, $1.intermNode, @1);
if ($$ == 0) {
std::stringstream extraInfoStream;
extraInfoStream << "built in unary operator function. Type: " << static_cast<TIntermTyped*>($1.intermNode)->getCompleteString();
@@ -538,59 +488,7 @@ function_call_header
function_identifier
: type_specifier_nonarray {
- //
- // Constructor
- //
- TOperator op = EOpNull;
- if ($1.userDef) {
- op = EOpConstructStruct;
- } else {
- switch ($1.type) {
- case EbtFloat:
- if ($1.matrix) {
- switch($1.size) {
- case 2: op = EOpConstructMat2; break;
- case 3: op = EOpConstructMat3; break;
- case 4: op = EOpConstructMat4; break;
- }
- } else {
- switch($1.size) {
- case 1: op = EOpConstructFloat; break;
- case 2: op = EOpConstructVec2; break;
- case 3: op = EOpConstructVec3; break;
- case 4: op = EOpConstructVec4; break;
- }
- }
- break;
- case EbtInt:
- switch($1.size) {
- case 1: op = EOpConstructInt; break;
- case 2: op = EOpConstructIVec2; break;
- case 3: op = EOpConstructIVec3; break;
- case 4: op = EOpConstructIVec4; break;
- }
- break;
- case EbtBool:
- switch($1.size) {
- case 1: op = EOpConstructBool; break;
- case 2: op = EOpConstructBVec2; break;
- case 3: op = EOpConstructBVec3; break;
- case 4: op = EOpConstructBVec4; break;
- }
- break;
- default: break;
- }
- if (op == EOpNull) {
- context->error(@1, "cannot construct this type", getBasicString($1.type));
- context->recover();
- $1.type = EbtFloat;
- op = EOpConstructFloat;
- }
- }
- TString tempString;
- TType type($1);
- TFunction *function = new TFunction(&tempString, type, op);
- $$ = function;
+ $$ = context->addConstructorFunc($1);
}
| IDENTIFIER {
if (context->reservedErrorCheck(@1, *$1.string))
@@ -608,7 +506,7 @@ unary_expression
| INC_OP unary_expression {
if (context->lValueErrorCheck(@1, "++", $2))
context->recover();
- $$ = context->intermediate.addUnaryMath(EOpPreIncrement, $2, @1, context->symbolTable);
+ $$ = context->intermediate.addUnaryMath(EOpPreIncrement, $2, @1);
if ($$ == 0) {
context->unaryOpError(@1, "++", $2->getCompleteString());
context->recover();
@@ -618,7 +516,7 @@ unary_expression
| DEC_OP unary_expression {
if (context->lValueErrorCheck(@1, "--", $2))
context->recover();
- $$ = context->intermediate.addUnaryMath(EOpPreDecrement, $2, @1, context->symbolTable);
+ $$ = context->intermediate.addUnaryMath(EOpPreDecrement, $2, @1);
if ($$ == 0) {
context->unaryOpError(@1, "--", $2->getCompleteString());
context->recover();
@@ -627,7 +525,7 @@ unary_expression
}
| unary_operator unary_expression {
if ($1.op != EOpNull) {
- $$ = context->intermediate.addUnaryMath($1.op, $2, @1, context->symbolTable);
+ $$ = context->intermediate.addUnaryMath($1.op, $2, @1);
if ($$ == 0) {
const char* errorOp = "";
switch($1.op) {
@@ -655,7 +553,7 @@ unary_operator
multiplicative_expression
: unary_expression { $$ = $1; }
| multiplicative_expression STAR unary_expression {
- $$ = context->intermediate.addBinaryMath(EOpMul, $1, $3, @2, context->symbolTable);
+ $$ = context->intermediate.addBinaryMath(EOpMul, $1, $3, @2);
if ($$ == 0) {
context->binaryOpError(@2, "*", $1->getCompleteString(), $3->getCompleteString());
context->recover();
@@ -663,7 +561,7 @@ multiplicative_expression
}
}
| multiplicative_expression SLASH unary_expression {
- $$ = context->intermediate.addBinaryMath(EOpDiv, $1, $3, @2, context->symbolTable);
+ $$ = context->intermediate.addBinaryMath(EOpDiv, $1, $3, @2);
if ($$ == 0) {
context->binaryOpError(@2, "/", $1->getCompleteString(), $3->getCompleteString());
context->recover();
@@ -675,7 +573,7 @@ multiplicative_expression
additive_expression
: multiplicative_expression { $$ = $1; }
| additive_expression PLUS multiplicative_expression {
- $$ = context->intermediate.addBinaryMath(EOpAdd, $1, $3, @2, context->symbolTable);
+ $$ = context->intermediate.addBinaryMath(EOpAdd, $1, $3, @2);
if ($$ == 0) {
context->binaryOpError(@2, "+", $1->getCompleteString(), $3->getCompleteString());
context->recover();
@@ -683,7 +581,7 @@ additive_expression
}
}
| additive_expression DASH multiplicative_expression {
- $$ = context->intermediate.addBinaryMath(EOpSub, $1, $3, @2, context->symbolTable);
+ $$ = context->intermediate.addBinaryMath(EOpSub, $1, $3, @2);
if ($$ == 0) {
context->binaryOpError(@2, "-", $1->getCompleteString(), $3->getCompleteString());
context->recover();
@@ -699,7 +597,7 @@ shift_expression
relational_expression
: shift_expression { $$ = $1; }
| relational_expression LEFT_ANGLE shift_expression {
- $$ = context->intermediate.addBinaryMath(EOpLessThan, $1, $3, @2, context->symbolTable);
+ $$ = context->intermediate.addBinaryMath(EOpLessThan, $1, $3, @2);
if ($$ == 0) {
context->binaryOpError(@2, "<", $1->getCompleteString(), $3->getCompleteString());
context->recover();
@@ -709,7 +607,7 @@ relational_expression
}
}
| relational_expression RIGHT_ANGLE shift_expression {
- $$ = context->intermediate.addBinaryMath(EOpGreaterThan, $1, $3, @2, context->symbolTable);
+ $$ = context->intermediate.addBinaryMath(EOpGreaterThan, $1, $3, @2);
if ($$ == 0) {
context->binaryOpError(@2, ">", $1->getCompleteString(), $3->getCompleteString());
context->recover();
@@ -719,7 +617,7 @@ relational_expression
}
}
| relational_expression LE_OP shift_expression {
- $$ = context->intermediate.addBinaryMath(EOpLessThanEqual, $1, $3, @2, context->symbolTable);
+ $$ = context->intermediate.addBinaryMath(EOpLessThanEqual, $1, $3, @2);
if ($$ == 0) {
context->binaryOpError(@2, "<=", $1->getCompleteString(), $3->getCompleteString());
context->recover();
@@ -729,7 +627,7 @@ relational_expression
}
}
| relational_expression GE_OP shift_expression {
- $$ = context->intermediate.addBinaryMath(EOpGreaterThanEqual, $1, $3, @2, context->symbolTable);
+ $$ = context->intermediate.addBinaryMath(EOpGreaterThanEqual, $1, $3, @2);
if ($$ == 0) {
context->binaryOpError(@2, ">=", $1->getCompleteString(), $3->getCompleteString());
context->recover();
@@ -743,7 +641,7 @@ relational_expression
equality_expression
: relational_expression { $$ = $1; }
| equality_expression EQ_OP relational_expression {
- $$ = context->intermediate.addBinaryMath(EOpEqual, $1, $3, @2, context->symbolTable);
+ $$ = context->intermediate.addBinaryMath(EOpEqual, $1, $3, @2);
if ($$ == 0) {
context->binaryOpError(@2, "==", $1->getCompleteString(), $3->getCompleteString());
context->recover();
@@ -753,7 +651,7 @@ equality_expression
}
}
| equality_expression NE_OP relational_expression {
- $$ = context->intermediate.addBinaryMath(EOpNotEqual, $1, $3, @2, context->symbolTable);
+ $$ = context->intermediate.addBinaryMath(EOpNotEqual, $1, $3, @2);
if ($$ == 0) {
context->binaryOpError(@2, "!=", $1->getCompleteString(), $3->getCompleteString());
context->recover();
@@ -779,7 +677,7 @@ inclusive_or_expression
logical_and_expression
: inclusive_or_expression { $$ = $1; }
| logical_and_expression AND_OP inclusive_or_expression {
- $$ = context->intermediate.addBinaryMath(EOpLogicalAnd, $1, $3, @2, context->symbolTable);
+ $$ = context->intermediate.addBinaryMath(EOpLogicalAnd, $1, $3, @2);
if ($$ == 0) {
context->binaryOpError(@2, "&&", $1->getCompleteString(), $3->getCompleteString());
context->recover();
@@ -793,7 +691,7 @@ logical_and_expression
logical_xor_expression
: logical_and_expression { $$ = $1; }
| logical_xor_expression XOR_OP logical_and_expression {
- $$ = context->intermediate.addBinaryMath(EOpLogicalXor, $1, $3, @2, context->symbolTable);
+ $$ = context->intermediate.addBinaryMath(EOpLogicalXor, $1, $3, @2);
if ($$ == 0) {
context->binaryOpError(@2, "^^", $1->getCompleteString(), $3->getCompleteString());
context->recover();
@@ -807,7 +705,7 @@ logical_xor_expression
logical_or_expression
: logical_xor_expression { $$ = $1; }
| logical_or_expression OR_OP logical_xor_expression {
- $$ = context->intermediate.addBinaryMath(EOpLogicalOr, $1, $3, @2, context->symbolTable);
+ $$ = context->intermediate.addBinaryMath(EOpLogicalOr, $1, $3, @2);
if ($$ == 0) {
context->binaryOpError(@2, "||", $1->getCompleteString(), $3->getCompleteString());
context->recover();
@@ -880,6 +778,14 @@ constant_expression
}
;
+enter_struct
+ : IDENTIFIER LEFT_BRACE {
+ if (context->enterStructDeclaration(@1, *$1.string))
+ context->recover();
+ $$ = $1;
+ }
+ ;
+
declaration
: function_prototype SEMICOLON {
TFunction &function = *($1.function);
@@ -924,6 +830,22 @@ declaration
}
$$ = 0;
}
+ | type_qualifier enter_struct struct_declaration_list RIGHT_BRACE SEMICOLON {
+ ES3_ONLY(getQualifierString($1.qualifier), @1, "interface blocks");
+ $$ = context->addInterfaceBlock($1, @2, *$2.string, $3, NULL, @$, NULL, @$);
+ }
+ | type_qualifier enter_struct struct_declaration_list RIGHT_BRACE IDENTIFIER SEMICOLON {
+ ES3_ONLY(getQualifierString($1.qualifier), @1, "interface blocks");
+ $$ = context->addInterfaceBlock($1, @2, *$2.string, $3, $5.string, @5, NULL, @$);
+ }
+ | type_qualifier enter_struct struct_declaration_list RIGHT_BRACE IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET SEMICOLON {
+ ES3_ONLY(getQualifierString($1.qualifier), @1, "interface blocks");
+ $$ = context->addInterfaceBlock($1, @2, *$2.string, $3, $5.string, @5, $7, @6);
+ }
+ | type_qualifier SEMICOLON {
+ context->parseGlobalLayoutQualifier($1);
+ $$ = 0;
+ }
;
function_prototype
@@ -936,7 +858,7 @@ function_prototype
//
// Redeclarations are allowed. But, return types and parameter qualifiers must match.
//
- TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find($1->getMangledName()));
+ TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find($1->getMangledName(), context->shaderVersion));
if (prevDec) {
if (prevDec->getReturnType() != $1->getReturnType()) {
context->error(@2, "overloaded functions must have the same return type", $1->getReturnType().getBasicString());
@@ -953,7 +875,7 @@ function_prototype
//
// Check for previously declared variables using the same name.
//
- TSymbol *prevSym = context->symbolTable.find($1->getName());
+ TSymbol *prevSym = context->symbolTable.find($1->getName(), context->shaderVersion);
if (prevSym)
{
if (!prevSym->isFunction())
@@ -1080,9 +1002,9 @@ parameter_declaration
//
// Type + name
//
- : type_qualifier parameter_qualifier parameter_declarator {
+ : parameter_type_qualifier parameter_qualifier parameter_declarator {
$$ = $3;
- if (context->paramErrorCheck(@3, $1.qualifier, $2, $$.param.type))
+ if (context->paramErrorCheck(@3, $1, $2, $$.param.type))
context->recover();
}
| parameter_qualifier parameter_declarator {
@@ -1095,9 +1017,9 @@ parameter_declaration
//
// Only type
//
- | type_qualifier parameter_qualifier parameter_type_specifier {
+ | parameter_type_qualifier parameter_qualifier parameter_type_specifier {
$$ = $3;
- if (context->paramErrorCheck(@3, $1.qualifier, $2, $$.param.type))
+ if (context->paramErrorCheck(@3, $1, $2, $$.param.type))
context->recover();
}
| parameter_qualifier parameter_type_specifier {
@@ -1136,173 +1058,46 @@ init_declarator_list
$$ = $1;
}
| init_declarator_list COMMA identifier {
- if ($1.type.type == EbtInvariant && !$3.symbol)
- {
- context->error(@3, "undeclared identifier declared as invariant", $3.string->c_str());
- context->recover();
- }
-
- TIntermSymbol* symbol = context->intermediate.addSymbol(0, *$3.string, TType($1.type), @3);
- $$.intermAggregate = context->intermediate.growAggregate($1.intermNode, symbol, @3);
-
- if (context->structQualifierErrorCheck(@3, $$.type))
- context->recover();
-
- if (context->nonInitConstErrorCheck(@3, *$3.string, $$.type, false))
- context->recover();
-
- TVariable* variable = 0;
- if (context->nonInitErrorCheck(@3, *$3.string, $$.type, variable))
- context->recover();
- if (symbol && variable)
- symbol->setId(variable->getUniqueId());
+ $$ = $1;
+ $$.intermAggregate = context->parseDeclarator($$.type, $1.intermAggregate, $3.symbol, @3, *$3.string);
}
| init_declarator_list COMMA identifier LEFT_BRACKET RIGHT_BRACKET {
- if (context->structQualifierErrorCheck(@3, $1.type))
- context->recover();
-
- if (context->nonInitConstErrorCheck(@3, *$3.string, $1.type, true))
- context->recover();
-
$$ = $1;
-
- if (context->arrayTypeErrorCheck(@4, $1.type) || context->arrayQualifierErrorCheck(@4, $1.type))
- context->recover();
- else {
- $1.type.setArray(true);
- TVariable* variable;
- if (context->arrayErrorCheck(@4, *$3.string, $1.type, variable))
- context->recover();
- }
+ context->parseArrayDeclarator($$.type, @3, *$3.string, @4, NULL, NULL);
}
| init_declarator_list COMMA identifier LEFT_BRACKET constant_expression RIGHT_BRACKET {
- if (context->structQualifierErrorCheck(@3, $1.type))
- context->recover();
-
- if (context->nonInitConstErrorCheck(@3, *$3.string, $1.type, true))
- context->recover();
-
$$ = $1;
-
- if (context->arrayTypeErrorCheck(@4, $1.type) || context->arrayQualifierErrorCheck(@4, $1.type))
- context->recover();
- else {
- int size;
- if (context->arraySizeErrorCheck(@4, $5, size))
- context->recover();
- $1.type.setArray(true, size);
- TVariable* variable = 0;
- if (context->arrayErrorCheck(@4, *$3.string, $1.type, variable))
- context->recover();
- TType type = TType($1.type);
- type.setArraySize(size);
- $$.intermAggregate = context->intermediate.growAggregate($1.intermNode, context->intermediate.addSymbol(variable ? variable->getUniqueId() : 0, *$3.string, type, @3), @3);
- }
+ $$.intermAggregate = context->parseArrayDeclarator($$.type, @3, *$3.string, @4, $1.intermNode, $5);
}
| init_declarator_list COMMA identifier EQUAL initializer {
- if (context->structQualifierErrorCheck(@3, $1.type))
- context->recover();
-
$$ = $1;
-
- TIntermNode* intermNode;
- if (!context->executeInitializer(@3, *$3.string, $1.type, $5, intermNode)) {
- //
- // build the intermediate representation
- //
- if (intermNode)
- $$.intermAggregate = context->intermediate.growAggregate($1.intermNode, intermNode, @4);
- else
- $$.intermAggregate = $1.intermAggregate;
- } else {
- context->recover();
- $$.intermAggregate = 0;
- }
+ $$.intermAggregate = context->parseInitDeclarator($$.type, $1.intermAggregate, @3, *$3.string, @4, $5);
}
;
single_declaration
: fully_specified_type {
$$.type = $1;
- $$.intermAggregate = context->intermediate.makeAggregate(context->intermediate.addSymbol(0, "", TType($1), @1), @1);
+ $$.intermAggregate = context->parseSingleDeclaration($$.type, @1, "");
}
| fully_specified_type identifier {
- TIntermSymbol* symbol = context->intermediate.addSymbol(0, *$2.string, TType($1), @2);
- $$.intermAggregate = context->intermediate.makeAggregate(symbol, @2);
-
- if (context->structQualifierErrorCheck(@2, $$.type))
- context->recover();
-
- if (context->nonInitConstErrorCheck(@2, *$2.string, $$.type, false))
- context->recover();
-
- $$.type = $1;
-
- TVariable* variable = 0;
- if (context->nonInitErrorCheck(@2, *$2.string, $$.type, variable))
- context->recover();
- if (variable && symbol)
- symbol->setId(variable->getUniqueId());
+ $$.type = $1;
+ $$.intermAggregate = context->parseSingleDeclaration($$.type, @2, *$2.string);
}
| fully_specified_type identifier LEFT_BRACKET RIGHT_BRACKET {
context->error(@2, "unsized array declarations not supported", $2.string->c_str());
context->recover();
- TIntermSymbol* symbol = context->intermediate.addSymbol(0, *$2.string, TType($1), @2);
- $$.intermAggregate = context->intermediate.makeAggregate(symbol, @2);
$$.type = $1;
+ $$.intermAggregate = context->parseSingleDeclaration($$.type, @2, *$2.string);
}
| fully_specified_type identifier LEFT_BRACKET constant_expression RIGHT_BRACKET {
- TType type = TType($1);
- int size;
- if (context->arraySizeErrorCheck(@2, $4, size))
- context->recover();
- type.setArraySize(size);
- TIntermSymbol* symbol = context->intermediate.addSymbol(0, *$2.string, type, @2);
- $$.intermAggregate = context->intermediate.makeAggregate(symbol, @2);
-
- if (context->structQualifierErrorCheck(@2, $1))
- context->recover();
-
- if (context->nonInitConstErrorCheck(@2, *$2.string, $1, true))
- context->recover();
-
$$.type = $1;
-
- if (context->arrayTypeErrorCheck(@3, $1) || context->arrayQualifierErrorCheck(@3, $1))
- context->recover();
- else {
- int size;
- if (context->arraySizeErrorCheck(@3, $4, size))
- context->recover();
-
- $1.setArray(true, size);
- TVariable* variable = 0;
- if (context->arrayErrorCheck(@3, *$2.string, $1, variable))
- context->recover();
- if (variable && symbol)
- symbol->setId(variable->getUniqueId());
- }
+ $$.intermAggregate = context->parseSingleArrayDeclaration($$.type, @2, *$2.string, @3, $4);
}
| fully_specified_type identifier EQUAL initializer {
- if (context->structQualifierErrorCheck(@2, $1))
- context->recover();
-
$$.type = $1;
-
- TIntermNode* intermNode;
- if (!context->executeInitializer(@2, *$2.string, $1, $4, intermNode)) {
- //
- // Build intermediate representation
- //
- if(intermNode)
- $$.intermAggregate = context->intermediate.makeAggregate(intermNode, @3);
- else
- $$.intermAggregate = 0;
- } else {
- context->recover();
- $$.intermAggregate = 0;
- }
+ $$.intermAggregate = context->parseSingleInitDeclaration($$.type, @2, *$2.string, @3, $4);
}
| INVARIANT IDENTIFIER {
VERTEX_ONLY("invariant declaration", @1);
@@ -1335,38 +1130,35 @@ fully_specified_type
}
}
| type_qualifier type_specifier {
- if ($2.array) {
- context->error(@2, "not supported", "first-class array");
- context->recover();
- $2.setArray(false);
- }
+ $$ = context->addFullySpecifiedType($1.qualifier, $1.layoutQualifier, $2);
+ }
+ ;
- if ($1.qualifier == EvqAttribute &&
- ($2.type == EbtBool || $2.type == EbtInt)) {
- context->error(@2, "cannot be bool or int", getQualifierString($1.qualifier));
- context->recover();
- }
- if (($1.qualifier == EvqVaryingIn || $1.qualifier == EvqVaryingOut) &&
- ($2.type == EbtBool || $2.type == EbtInt)) {
- context->error(@2, "cannot be bool or int", getQualifierString($1.qualifier));
- context->recover();
- }
- $$ = $2;
- $$.qualifier = $1.qualifier;
+interpolation_qualifier
+ : SMOOTH {
+ $$.qualifier = EvqSmooth;
+ }
+ | FLAT {
+ $$.qualifier = EvqFlat;
}
;
-type_qualifier
+parameter_type_qualifier
: CONST_QUAL {
- $$.setBasic(EbtVoid, EvqConst, @1);
+ $$ = EvqConst;
}
- | ATTRIBUTE {
+ ;
+
+type_qualifier
+ : ATTRIBUTE {
VERTEX_ONLY("attribute", @1);
+ ES2_ONLY("attribute", @1);
if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "attribute"))
context->recover();
$$.setBasic(EbtVoid, EvqAttribute, @1);
}
| VARYING {
+ ES2_ONLY("varying", @1);
if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "varying"))
context->recover();
if (context->shaderType == SH_VERTEX_SHADER)
@@ -1375,6 +1167,7 @@ type_qualifier
$$.setBasic(EbtVoid, EvqVaryingIn, @1);
}
| INVARIANT VARYING {
+ ES2_ONLY("varying", @1);
if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "invariant varying"))
context->recover();
if (context->shaderType == SH_VERTEX_SHADER)
@@ -1382,10 +1175,68 @@ type_qualifier
else
$$.setBasic(EbtVoid, EvqInvariantVaryingIn, @1);
}
+ | storage_qualifier {
+ if ($1.qualifier != EvqConst && !context->symbolTable.atGlobalLevel()) {
+ context->error(@1, "Local variables can only use the const storage qualifier.", getQualifierString($1.qualifier));
+ context->recover();
+ } else {
+ $$.setBasic(EbtVoid, $1.qualifier, @1);
+ }
+ }
+ | interpolation_qualifier storage_qualifier {
+ $$ = context->joinInterpolationQualifiers(@1, $1.qualifier, @2, $2.qualifier);
+ }
+ | interpolation_qualifier {
+ context->error(@1, "interpolation qualifier requires a fragment 'in' or vertex 'out' storage qualifier", getInterpolationString($1.qualifier));
+ context->recover();
+
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtVoid, qual, @1);
+ }
+ | layout_qualifier {
+ $$.qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.layoutQualifier = $1;
+ }
+ | layout_qualifier storage_qualifier {
+ $$.setBasic(EbtVoid, $2.qualifier, @2);
+ $$.layoutQualifier = $1;
+ }
+ ;
+
+storage_qualifier
+ : CONST_QUAL {
+ $$.qualifier = EvqConst;
+ }
+ | IN_QUAL {
+ ES3_ONLY("in", @1, "storage qualifier");
+ $$.qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentIn : EvqVertexIn;
+ }
+ | OUT_QUAL {
+ ES3_ONLY("out", @1, "storage qualifier");
+ $$.qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentOut : EvqVertexOut;
+ }
+ | CENTROID IN_QUAL {
+ ES3_ONLY("centroid in", @1, "storage qualifier");
+ if (context->shaderType == SH_VERTEX_SHADER)
+ {
+ context->error(@1, "invalid storage qualifier", "it is an error to use 'centroid in' in the vertex shader");
+ context->recover();
+ }
+ $$.qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqCentroidIn : EvqVertexIn;
+ }
+ | CENTROID OUT_QUAL {
+ ES3_ONLY("centroid out", @1, "storage qualifier");
+ if (context->shaderType == SH_FRAGMENT_SHADER)
+ {
+ context->error(@1, "invalid storage qualifier", "it is an error to use 'centroid out' in the fragment shader");
+ context->recover();
+ }
+ $$.qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentOut : EvqCentroidOut;
+ }
| UNIFORM {
if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "uniform"))
context->recover();
- $$.setBasic(EbtVoid, EvqUniform, @1);
+ $$.qualifier = EvqUniform;
}
;
@@ -1403,6 +1254,11 @@ type_specifier
| precision_qualifier type_specifier_no_prec {
$$ = $2;
$$.precision = $1;
+
+ if (!SupportsPrecision($2.type)) {
+ context->error(@1, "illegal type for precision qualifier", getBasicString($2.type));
+ context->recover();
+ }
}
;
@@ -1418,6 +1274,34 @@ precision_qualifier
}
;
+layout_qualifier
+ : LAYOUT LEFT_PAREN layout_qualifier_id_list RIGHT_PAREN {
+ ES3_ONLY("layout", @1, "qualifier");
+ $$ = $3;
+ }
+ ;
+
+layout_qualifier_id_list
+ : layout_qualifier_id {
+ $$ = $1;
+ }
+ | layout_qualifier_id_list COMMA layout_qualifier_id {
+ $$ = context->joinLayoutQualifiers($1, $3);
+ }
+ ;
+
+layout_qualifier_id
+ : IDENTIFIER {
+ $$ = context->parseLayoutQualifier(*$1.string, @1);
+ }
+ | IDENTIFIER EQUAL INTCONSTANT {
+ $$ = context->parseLayoutQualifier(*$1.string, @1, *$3.string, $3.i, @3);
+ }
+ | IDENTIFIER EQUAL UINTCONSTANT {
+ $$ = context->parseLayoutQualifier(*$1.string, @1, *$3.string, $3.i, @3);
+ }
+ ;
+
type_specifier_no_prec
: type_specifier_nonarray {
$$ = $1;
@@ -1449,6 +1333,10 @@ type_specifier_nonarray
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
$$.setBasic(EbtInt, qual, @1);
}
+ | UINT_TYPE {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtUInt, qual, @1);
+ }
| BOOL_TYPE {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
$$.setBasic(EbtBool, qual, @1);
@@ -1498,29 +1386,126 @@ type_specifier_nonarray
$$.setBasic(EbtInt, qual, @1);
$$.setAggregate(4);
}
+ | UVEC2 {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtUInt, qual, @1);
+ $$.setAggregate(2);
+ }
+ | UVEC3 {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtUInt, qual, @1);
+ $$.setAggregate(3);
+ }
+ | UVEC4 {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtUInt, qual, @1);
+ $$.setAggregate(4);
+ }
| MATRIX2 {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
$$.setBasic(EbtFloat, qual, @1);
- $$.setAggregate(2, true);
+ $$.setMatrix(2, 2);
}
| MATRIX3 {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
$$.setBasic(EbtFloat, qual, @1);
- $$.setAggregate(3, true);
+ $$.setMatrix(3, 3);
}
| MATRIX4 {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
$$.setBasic(EbtFloat, qual, @1);
- $$.setAggregate(4, true);
+ $$.setMatrix(4, 4);
+ }
+ | MATRIX2x3 {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtFloat, qual, @1);
+ $$.setMatrix(2, 3);
+ }
+ | MATRIX3x2 {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtFloat, qual, @1);
+ $$.setMatrix(3, 2);
+ }
+ | MATRIX2x4 {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtFloat, qual, @1);
+ $$.setMatrix(2, 4);
+ }
+ | MATRIX4x2 {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtFloat, qual, @1);
+ $$.setMatrix(4, 2);
+ }
+ | MATRIX3x4 {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtFloat, qual, @1);
+ $$.setMatrix(3, 4);
+ }
+ | MATRIX4x3 {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtFloat, qual, @1);
+ $$.setMatrix(4, 3);
}
| SAMPLER2D {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
$$.setBasic(EbtSampler2D, qual, @1);
}
+ | SAMPLER3D {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtSampler3D, qual, @1);
+ }
| SAMPLERCUBE {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
$$.setBasic(EbtSamplerCube, qual, @1);
}
+ | SAMPLER2DARRAY {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtSampler2DArray, qual, @1);
+ }
+ | ISAMPLER2D {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtISampler2D, qual, @1);
+ }
+ | ISAMPLER3D {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtISampler3D, qual, @1);
+ }
+ | ISAMPLERCUBE {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtISamplerCube, qual, @1);
+ }
+ | ISAMPLER2DARRAY {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtISampler2DArray, qual, @1);
+ }
+ | USAMPLER2D {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtUSampler2D, qual, @1);
+ }
+ | USAMPLER3D {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtUSampler3D, qual, @1);
+ }
+ | USAMPLERCUBE {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtUSamplerCube, qual, @1);
+ }
+ | USAMPLER2DARRAY {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtUSampler2DArray, qual, @1);
+ }
+ | SAMPLER2DSHADOW {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtSampler2DShadow, qual, @1);
+ }
+ | SAMPLERCUBESHADOW {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtSamplerCubeShadow, qual, @1);
+ }
+ | SAMPLER2DARRAYSHADOW {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtSampler2DArrayShadow, qual, @1);
+ }
| SAMPLER_EXTERNAL_OES {
if (!context->supportsExtension("GL_OES_EGL_image_external")) {
context->error(@1, "unsupported type", "samplerExternalOES");
@@ -1555,24 +1540,10 @@ type_specifier_nonarray
struct_specifier
: STRUCT identifier LEFT_BRACE { if (context->enterStructDeclaration(@2, *$2.string)) context->recover(); } struct_declaration_list RIGHT_BRACE {
- if (context->reservedErrorCheck(@2, *$2.string))
- context->recover();
-
- TType* structure = new TType(new TStructure($2.string, $5));
- TVariable* userTypeDef = new TVariable($2.string, *structure, true);
- if (! context->symbolTable.insert(*userTypeDef)) {
- context->error(@2, "redefinition", $2.string->c_str(), "struct");
- context->recover();
- }
- $$.setBasic(EbtStruct, EvqTemporary, @1);
- $$.userDef = structure;
- context->exitStructDeclaration();
+ $$ = context->addStructure(@1, @2, $2.string, $5);
}
| STRUCT LEFT_BRACE { if (context->enterStructDeclaration(@2, *$2.string)) context->recover(); } struct_declaration_list RIGHT_BRACE {
- TType* structure = new TType(new TStructure(NewPoolTString(""), $4));
- $$.setBasic(EbtStruct, EvqTemporary, @1);
- $$.userDef = structure;
- context->exitStructDeclaration();
+ $$ = context->addStructure(@1, @$, NewPoolTString(""), $4);
}
;
@@ -1597,34 +1568,13 @@ struct_declaration_list
struct_declaration
: type_specifier struct_declarator_list SEMICOLON {
- $$ = $2;
-
- if (context->voidErrorCheck(@1, (*$2)[0]->name(), $1)) {
- context->recover();
- }
- for (unsigned int i = 0; i < $$->size(); ++i) {
- //
- // Careful not to replace already known aspects of type, like array-ness
- //
- TType* type = (*$$)[i]->type();
- type->setBasicType($1.type);
- type->setNominalSize($1.size);
- type->setMatrix($1.matrix);
- type->setPrecision($1.precision);
-
- // don't allow arrays of arrays
- if (type->isArray()) {
- if (context->arrayTypeErrorCheck(@1, $1))
- context->recover();
- }
- if ($1.array)
- type->setArraySize($1.arraySize);
- if ($1.userDef)
- type->setStruct($1.userDef->getStruct());
-
- if (context->structNestingErrorCheck(@1, *(*$$)[i]))
- context->recover();
- }
+ $$ = context->addStructDeclaratorList($1, $2);
+ }
+ | type_qualifier type_specifier struct_declarator_list SEMICOLON {
+ // ES3 Only, but errors should be handled elsewhere
+ $2.qualifier = $1.qualifier;
+ $2.layoutQualifier = $1.layoutQualifier;
+ $$ = context->addStructDeclaratorList($2, $3);
}
;
@@ -1644,19 +1594,19 @@ struct_declarator
context->recover();
TType* type = new TType(EbtVoid, EbpUndefined);
- $$ = new TField(type, $1.string);
+ $$ = new TField(type, $1.string, @1);
}
| identifier LEFT_BRACKET constant_expression RIGHT_BRACKET {
if (context->reservedErrorCheck(@1, *$1.string))
context->recover();
TType* type = new TType(EbtVoid, EbpUndefined);
- int size = 0;
+ int size;
if (context->arraySizeErrorCheck(@3, $3, size))
context->recover();
type->setArraySize(size);
- $$ = new TField(type, $1.string);
+ $$ = new TField(type, $1.string, @1);
}
;
@@ -1890,7 +1840,7 @@ function_definition
: function_prototype {
TFunction* function = $1.function;
- const TSymbol *builtIn = context->symbolTable.findBuiltIn(function->getMangledName());
+ const TSymbol *builtIn = context->symbolTable.findBuiltIn(function->getMangledName(), context->shaderVersion);
if (builtIn)
{
@@ -1898,7 +1848,7 @@ function_definition
context->recover();
}
- TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
+ TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName(), context->shaderVersion));
//
// Note: 'prevDec' could be 'function' if this is the first time we've seen function
// as it would have just been put in the symbol table. Otherwise, we're looking up
@@ -1949,7 +1899,7 @@ function_definition
//
// Insert the parameters with name in the symbol table.
//
- if (! context->symbolTable.insert(*variable)) {
+ if (! context->symbolTable.declare(*variable)) {
context->error(@1, "redefinition", variable->getName().c_str());
context->recover();
delete variable;
@@ -1961,9 +1911,8 @@ function_definition
paramNodes = context->intermediate.growAggregate(
paramNodes,
context->intermediate.addSymbol(variable->getUniqueId(),
- variable->getName(),
- variable->getType(),
- @1),
+ variable->getName(),
+ variable->getType(), @1),
@1);
} else {
paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, @1), @1);
diff --git a/chromium/third_party/angle/src/compiler/glslang_lex.cpp b/chromium/third_party/angle/src/compiler/translator/glslang_lex.cpp
index de3d82bcd80..5cfbba63eb3 100644
--- a/chromium/third_party/angle/src/compiler/glslang_lex.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/glslang_lex.cpp
@@ -1,6 +1,6 @@
#line 17 "./glslang.l"
//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -30,7 +30,7 @@
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 35
+#define YY_FLEX_SUBMINOR_VERSION 37
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
@@ -76,7 +76,6 @@ typedef int flex_int32_t;
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
-#endif /* ! C99 */
/* Limits of integral types. */
#ifndef INT8_MIN
@@ -107,6 +106,8 @@ typedef unsigned int flex_uint32_t;
#define UINT32_MAX (4294967295U)
#endif
+#endif /* ! C99 */
+
#endif /* ! FLEXINT_H */
#ifdef __cplusplus
@@ -197,6 +198,11 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
typedef size_t yy_size_t;
#endif
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
#define EOB_ACT_CONTINUE_SCAN 0
#define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2
@@ -360,7 +366,7 @@ void yyfree (void * ,yyscan_t yyscanner );
/* Begin user sect3 */
-#define yywrap(n) 1
+#define yywrap(yyscanner) 1
#define YY_SKIP_YYWRAP
typedef unsigned char YY_CHAR;
@@ -384,8 +390,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
*yy_cp = '\0'; \
yyg->yy_c_buf_p = yy_cp;
-#define YY_NUM_RULES 147
-#define YY_END_OF_BUFFER 148
+#define YY_NUM_RULES 237
+#define YY_END_OF_BUFFER 238
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -393,57 +399,98 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[443] =
+static yyconst flex_int16_t yy_accept[813] =
{ 0,
- 0, 0, 148, 146, 145, 145, 132, 138, 143, 127,
- 128, 136, 135, 124, 133, 131, 137, 96, 96, 125,
- 121, 139, 126, 140, 144, 93, 129, 130, 142, 93,
- 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
- 93, 93, 93, 93, 93, 93, 93, 93, 93, 122,
- 141, 123, 134, 118, 104, 123, 112, 107, 102, 110,
- 100, 111, 101, 99, 103, 98, 95, 96, 0, 0,
- 130, 122, 129, 119, 115, 117, 116, 120, 93, 108,
- 114, 93, 93, 93, 93, 93, 93, 93, 93, 93,
- 93, 12, 93, 93, 93, 93, 93, 93, 93, 93,
-
- 93, 93, 93, 93, 93, 15, 17, 93, 93, 93,
- 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
- 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
- 93, 93, 93, 93, 109, 113, 0, 98, 0, 0,
- 97, 94, 105, 106, 45, 93, 93, 93, 93, 93,
- 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
- 93, 93, 93, 13, 93, 93, 93, 93, 93, 93,
- 93, 93, 21, 93, 93, 93, 93, 93, 93, 93,
- 93, 18, 93, 93, 93, 93, 93, 93, 93, 93,
- 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
-
- 93, 93, 93, 93, 93, 0, 99, 0, 98, 93,
- 23, 93, 93, 90, 93, 93, 93, 93, 93, 93,
- 93, 16, 48, 93, 93, 93, 64, 93, 93, 53,
- 68, 93, 93, 93, 93, 93, 93, 93, 93, 65,
- 4, 28, 29, 30, 93, 93, 93, 93, 93, 93,
- 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
- 51, 24, 93, 93, 93, 93, 93, 93, 31, 32,
- 33, 22, 93, 93, 93, 10, 37, 38, 39, 46,
- 7, 93, 93, 93, 93, 77, 78, 79, 93, 25,
- 69, 20, 80, 81, 82, 2, 74, 75, 76, 93,
-
- 19, 72, 93, 93, 34, 35, 36, 93, 93, 93,
- 93, 93, 93, 93, 93, 93, 66, 93, 93, 93,
- 93, 93, 93, 93, 93, 47, 93, 92, 93, 93,
- 14, 93, 93, 93, 93, 67, 61, 56, 93, 93,
- 93, 93, 93, 73, 52, 93, 59, 27, 93, 89,
- 60, 44, 71, 54, 93, 93, 93, 93, 93, 93,
- 93, 93, 55, 26, 93, 93, 93, 3, 93, 93,
- 93, 93, 93, 49, 8, 93, 9, 93, 93, 11,
- 62, 93, 93, 93, 57, 93, 93, 93, 93, 93,
- 93, 50, 70, 58, 6, 63, 1, 91, 5, 83,
-
- 40, 84, 93, 93, 93, 93, 93, 93, 93, 93,
- 93, 93, 93, 93, 41, 93, 93, 93, 93, 93,
- 93, 93, 43, 93, 87, 93, 93, 93, 93, 93,
- 85, 93, 86, 93, 93, 93, 93, 93, 93, 42,
- 88, 0
+ 0, 0, 238, 236, 235, 235, 222, 228, 233, 217,
+ 218, 226, 225, 214, 223, 221, 227, 180, 180, 215,
+ 211, 229, 216, 230, 234, 177, 219, 220, 232, 177,
+ 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
+ 177, 177, 177, 177, 177, 177, 177, 177, 177, 212,
+ 231, 213, 224, 208, 194, 213, 202, 197, 192, 200,
+ 190, 201, 191, 186, 193, 185, 179, 180, 0, 183,
+ 0, 220, 212, 219, 209, 205, 207, 206, 210, 177,
+ 198, 204, 177, 177, 177, 177, 177, 177, 177, 177,
+ 177, 177, 177, 177, 12, 177, 177, 177, 177, 177,
+
+ 177, 177, 177, 177, 177, 177, 177, 177, 15, 177,
+ 177, 23, 177, 177, 177, 177, 177, 177, 177, 177,
+ 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
+ 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
+ 177, 177, 177, 177, 177, 199, 203, 0, 189, 185,
+ 0, 188, 182, 0, 184, 178, 195, 196, 177, 136,
+ 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
+ 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
+ 177, 177, 177, 13, 177, 177, 177, 177, 177, 177,
+ 177, 177, 177, 177, 27, 177, 177, 177, 177, 177,
+
+ 177, 177, 177, 177, 177, 177, 24, 177, 177, 177,
+ 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
+ 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
+ 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
+ 177, 0, 186, 0, 185, 187, 181, 177, 177, 177,
+ 30, 177, 177, 18, 174, 177, 177, 177, 177, 177,
+ 177, 177, 177, 177, 177, 16, 139, 177, 177, 177,
+ 177, 21, 177, 177, 143, 155, 177, 177, 177, 177,
+ 177, 177, 177, 177, 177, 177, 177, 177, 152, 4,
+ 35, 36, 37, 177, 177, 177, 177, 177, 177, 177,
+
+ 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
+ 177, 177, 177, 177, 177, 177, 177, 142, 31, 177,
+ 177, 28, 177, 177, 177, 177, 177, 177, 177, 47,
+ 48, 49, 29, 177, 177, 177, 177, 177, 177, 10,
+ 53, 54, 55, 177, 137, 177, 177, 7, 177, 177,
+ 177, 177, 164, 165, 166, 177, 32, 177, 156, 26,
+ 167, 168, 169, 2, 161, 162, 163, 177, 177, 177,
+ 25, 159, 177, 177, 177, 50, 51, 52, 177, 177,
+ 177, 177, 177, 177, 177, 177, 177, 177, 177, 86,
+ 177, 177, 177, 177, 177, 177, 177, 153, 177, 177,
+
+ 177, 177, 177, 177, 177, 177, 177, 177, 177, 138,
+ 177, 177, 176, 56, 57, 58, 177, 177, 14, 177,
+ 91, 177, 177, 177, 177, 89, 177, 177, 177, 154,
+ 149, 92, 177, 177, 177, 177, 177, 177, 144, 177,
+ 177, 177, 78, 38, 41, 43, 42, 39, 45, 44,
+ 46, 40, 177, 177, 177, 177, 160, 135, 177, 177,
+ 147, 177, 177, 177, 34, 87, 173, 22, 148, 77,
+ 177, 158, 17, 177, 177, 177, 177, 177, 177, 177,
+ 177, 177, 177, 177, 177, 177, 177, 19, 33, 177,
+ 177, 177, 177, 177, 177, 93, 94, 95, 177, 177,
+
+ 177, 177, 177, 3, 177, 177, 177, 177, 177, 177,
+ 177, 177, 177, 177, 177, 140, 177, 177, 177, 177,
+ 177, 8, 177, 177, 9, 177, 177, 177, 177, 20,
+ 79, 11, 150, 97, 98, 99, 177, 177, 177, 177,
+ 177, 177, 177, 177, 177, 177, 177, 177, 145, 177,
+ 177, 177, 81, 83, 80, 177, 177, 177, 177, 177,
+ 177, 177, 141, 101, 102, 103, 177, 177, 157, 177,
+ 146, 177, 177, 6, 177, 177, 177, 177, 177, 177,
+ 177, 177, 177, 96, 151, 1, 177, 177, 177, 177,
+ 177, 175, 177, 90, 5, 170, 59, 62, 177, 177,
+
+ 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
+ 177, 82, 177, 177, 177, 177, 100, 177, 177, 177,
+ 177, 177, 120, 66, 67, 177, 177, 177, 177, 177,
+ 177, 177, 177, 177, 177, 177, 177, 177, 88, 177,
+ 177, 177, 104, 122, 70, 71, 177, 177, 84, 177,
+ 177, 177, 177, 177, 177, 177, 115, 177, 177, 177,
+ 177, 177, 177, 177, 177, 177, 177, 129, 177, 177,
+ 177, 177, 60, 177, 177, 177, 177, 177, 177, 177,
+ 177, 177, 177, 177, 177, 116, 105, 177, 106, 177,
+ 177, 177, 130, 177, 177, 68, 177, 177, 177, 177,
+
+ 177, 177, 177, 177, 177, 177, 177, 177, 177, 117,
+ 177, 177, 131, 177, 177, 72, 107, 108, 177, 111,
+ 177, 112, 177, 177, 177, 177, 177, 85, 177, 177,
+ 177, 177, 64, 177, 63, 126, 177, 177, 109, 110,
+ 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
+ 124, 127, 118, 177, 65, 177, 177, 177, 177, 177,
+ 177, 177, 177, 125, 128, 177, 177, 121, 69, 177,
+ 177, 171, 177, 177, 177, 74, 177, 177, 123, 73,
+ 177, 177, 177, 177, 177, 177, 132, 177, 177, 177,
+ 177, 177, 177, 133, 177, 177, 177, 75, 177, 134,
+
+ 113, 114, 177, 177, 177, 61, 177, 177, 172, 119,
+ 76, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -454,14 +501,14 @@ static yyconst flex_int32_t yy_ec[256] =
1, 2, 4, 1, 1, 1, 5, 6, 1, 7,
8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
18, 19, 20, 20, 20, 21, 21, 22, 23, 24,
- 25, 26, 27, 1, 28, 28, 29, 30, 31, 28,
- 32, 32, 32, 32, 32, 32, 32, 32, 33, 32,
- 32, 34, 35, 32, 32, 32, 32, 36, 32, 32,
- 37, 1, 38, 39, 32, 1, 40, 41, 42, 43,
-
- 44, 45, 46, 47, 48, 32, 49, 50, 51, 52,
- 53, 54, 32, 55, 56, 57, 58, 59, 60, 61,
- 62, 63, 64, 65, 66, 67, 1, 1, 1, 1,
+ 25, 26, 27, 1, 28, 29, 30, 31, 32, 33,
+ 34, 34, 34, 34, 34, 34, 35, 34, 36, 34,
+ 34, 37, 38, 34, 39, 34, 34, 40, 34, 34,
+ 41, 1, 42, 43, 44, 1, 45, 46, 47, 48,
+
+ 49, 50, 51, 52, 53, 34, 54, 55, 56, 57,
+ 58, 59, 34, 60, 61, 62, 63, 64, 65, 66,
+ 67, 68, 69, 70, 71, 72, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -478,200 +525,323 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static yyconst flex_int32_t yy_meta[68] =
+static yyconst flex_int32_t yy_meta[73] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 2, 2, 2, 2, 2, 2,
- 2, 1, 1, 1, 1, 1, 1, 2, 2, 2,
- 2, 3, 3, 3, 3, 3, 1, 1, 1, 2,
- 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 1, 1, 1, 1
+ 2, 1, 1, 1, 1, 1, 1, 3, 3, 3,
+ 3, 2, 2, 4, 4, 4, 4, 4, 4, 4,
+ 1, 1, 1, 4, 3, 3, 3, 3, 2, 2,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 1, 1,
+ 1, 1
} ;
-static yyconst flex_int16_t yy_base[445] =
+static yyconst flex_int16_t yy_base[817] =
{ 0,
- 0, 0, 587, 588, 588, 588, 561, 43, 64, 588,
- 588, 560, 61, 588, 60, 58, 559, 77, 86, 557,
- 588, 104, 557, 55, 588, 0, 588, 588, 75, 26,
- 57, 82, 83, 73, 93, 528, 97, 95, 527, 44,
- 71, 521, 104, 534, 110, 116, 35, 111, 530, 588,
- 114, 588, 588, 588, 588, 588, 588, 588, 588, 588,
- 588, 588, 588, 165, 588, 172, 202, 211, 233, 0,
- 588, 588, 588, 551, 588, 588, 588, 550, 0, 588,
- 588, 523, 516, 519, 527, 526, 513, 528, 515, 521,
- 509, 506, 519, 506, 503, 503, 509, 497, 108, 502,
-
- 512, 498, 504, 507, 508, 0, 145, 507, 113, 493,
- 506, 497, 499, 489, 503, 500, 502, 485, 490, 487,
- 476, 157, 484, 489, 485, 487, 476, 479, 118, 484,
- 476, 488, 70, 481, 588, 588, 246, 253, 270, 219,
- 283, 0, 588, 588, 0, 473, 477, 486, 483, 467,
- 467, 119, 482, 479, 479, 477, 474, 466, 472, 459,
- 470, 456, 472, 0, 469, 457, 464, 461, 465, 458,
- 447, 446, 459, 462, 459, 454, 445, 188, 450, 453,
- 444, 441, 445, 451, 442, 433, 436, 434, 444, 430,
- 428, 441, 427, 429, 426, 437, 436, 124, 431, 426,
-
- 415, 258, 433, 435, 424, 290, 297, 304, 311, 425,
- 0, 423, 275, 0, 415, 413, 421, 410, 427, 416,
- 316, 0, 0, 410, 420, 420, 0, 405, 319, 0,
- 0, 407, 322, 408, 402, 401, 402, 401, 325, 0,
- 0, 0, 0, 0, 397, 398, 403, 394, 407, 402,
- 401, 393, 397, 389, 392, 396, 401, 387, 399, 390,
- 0, 0, 396, 385, 385, 390, 389, 386, 0, 0,
- 0, 0, 376, 388, 390, 0, 0, 0, 0, 0,
- 0, 378, 379, 373, 383, 0, 0, 0, 374, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 381,
-
- 0, 0, 379, 375, 0, 0, 0, 371, 367, 372,
- 362, 375, 361, 374, 363, 370, 0, 368, 370, 354,
- 356, 362, 368, 363, 351, 0, 353, 0, 352, 355,
- 0, 344, 343, 343, 356, 0, 358, 0, 357, 356,
- 341, 354, 341, 0, 0, 344, 0, 0, 336, 0,
- 0, 0, 0, 0, 333, 344, 337, 343, 340, 335,
- 327, 339, 0, 0, 332, 339, 328, 0, 337, 334,
- 324, 329, 332, 0, 0, 332, 0, 330, 329, 0,
- 0, 328, 314, 326, 0, 317, 338, 337, 336, 307,
- 303, 0, 0, 0, 0, 0, 0, 0, 0, 328,
-
- 166, 325, 316, 299, 308, 310, 306, 308, 307, 306,
- 309, 306, 256, 253, 0, 228, 238, 222, 235, 203,
- 207, 204, 212, 191, 0, 201, 165, 167, 153, 161,
- 0, 170, 0, 175, 151, 141, 100, 114, 59, 0,
- 0, 588, 359, 113
+ 0, 0, 941, 942, 942, 942, 915, 48, 69, 942,
+ 942, 914, 66, 942, 65, 63, 913, 82, 136, 911,
+ 942, 82, 911, 60, 942, 0, 942, 942, 67, 58,
+ 51, 68, 75, 61, 105, 877, 114, 79, 67, 44,
+ 89, 871, 101, 884, 121, 127, 136, 143, 36, 942,
+ 112, 942, 942, 942, 942, 942, 942, 942, 942, 942,
+ 942, 942, 942, 158, 942, 163, 163, 0, 199, 942,
+ 0, 942, 942, 942, 907, 942, 942, 942, 906, 0,
+ 942, 942, 868, 873, 80, 870, 878, 877, 864, 867,
+ 878, 171, 872, 860, 857, 870, 857, 854, 854, 860,
+
+ 75, 176, 854, 864, 850, 856, 859, 860, 0, 852,
+ 862, 177, 861, 856, 837, 105, 841, 854, 845, 112,
+ 838, 178, 850, 852, 185, 841, 838, 827, 836, 177,
+ 185, 840, 836, 838, 827, 830, 124, 145, 197, 839,
+ 827, 839, 190, 832, 831, 942, 942, 239, 942, 220,
+ 256, 942, 942, 263, 270, 185, 942, 942, 830, 0,
+ 826, 821, 825, 834, 831, 243, 815, 815, 826, 818,
+ 143, 828, 825, 825, 823, 820, 812, 818, 805, 803,
+ 815, 801, 817, 0, 814, 802, 809, 806, 810, 811,
+ 804, 801, 790, 789, 802, 805, 793, 801, 789, 795,
+
+ 786, 244, 791, 794, 785, 792, 781, 785, 776, 790,
+ 789, 780, 786, 235, 770, 773, 771, 781, 771, 766,
+ 764, 766, 776, 762, 764, 761, 772, 771, 774, 756,
+ 244, 764, 760, 758, 767, 746, 281, 764, 766, 755,
+ 747, 291, 298, 306, 317, 942, 942, 744, 754, 753,
+ 0, 751, 311, 0, 0, 744, 742, 742, 743, 738,
+ 746, 735, 752, 741, 322, 0, 0, 735, 745, 744,
+ 744, 0, 729, 325, 0, 0, 731, 328, 738, 739,
+ 730, 724, 723, 724, 723, 723, 334, 718, 0, 0,
+ 714, 713, 712, 714, 715, 720, 714, 710, 723, 718,
+
+ 718, 716, 715, 709, 703, 705, 704, 708, 700, 703,
+ 698, 706, 711, 699, 696, 708, 699, 0, 0, 705,
+ 701, 0, 693, 693, 698, 689, 696, 337, 693, 0,
+ 0, 0, 0, 683, 695, 694, 693, 694, 694, 0,
+ 0, 0, 0, 681, 0, 689, 680, 0, 679, 680,
+ 674, 684, 0, 0, 0, 675, 0, 671, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 681, 341, 680,
+ 0, 0, 678, 674, 671, 0, 0, 0, 663, 343,
+ 346, 355, 668, 664, 669, 660, 658, 671, 656, 0,
+ 656, 669, 658, 654, 660, 655, 662, 0, 660, 657,
+
+ 661, 645, 643, 646, 652, 658, 653, 652, 640, 0,
+ 642, 643, 0, 0, 0, 0, 640, 643, 0, 637,
+ 0, 650, 630, 639, 634, 0, 627, 627, 640, 0,
+ 642, 0, 359, 655, 654, 653, 620, 619, 0, 636,
+ 635, 630, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 619, 632, 619, 616, 0, 0, 621, 620,
+ 0, 617, 624, 623, 0, 609, 0, 0, 0, 0,
+ 606, 0, 0, 605, 616, 362, 609, 615, 614, 611,
+ 606, 603, 596, 596, 609, 594, 606, 0, 0, 599,
+ 622, 621, 620, 587, 586, 355, 356, 0, 598, 601,
+
+ 599, 588, 584, 0, 596, 593, 592, 582, 581, 571,
+ 588, 574, 369, 582, 585, 0, 602, 601, 600, 567,
+ 566, 0, 580, 567, 0, 577, 570, 571, 574, 0,
+ 0, 0, 0, 594, 593, 0, 570, 573, 558, 565,
+ 556, 563, 564, 564, 563, 549, 379, 561, 0, 562,
+ 551, 550, 0, 0, 0, 575, 574, 573, 540, 539,
+ 535, 543, 0, 571, 570, 0, 547, 550, 0, 386,
+ 0, 528, 537, 0, 533, 532, 541, 541, 529, 543,
+ 527, 541, 536, 0, 0, 0, 553, 552, 551, 518,
+ 517, 0, 517, 0, 0, 362, 382, 541, 527, 530,
+
+ 513, 525, 513, 512, 521, 521, 538, 537, 536, 503,
+ 502, 0, 502, 503, 502, 512, 0, 515, 511, 513,
+ 509, 496, 527, 377, 0, 504, 507, 499, 491, 498,
+ 489, 510, 498, 494, 496, 494, 494, 493, 0, 481,
+ 480, 490, 0, 510, 390, 0, 487, 490, 0, 490,
+ 489, 473, 465, 473, 463, 471, 0, 468, 467, 488,
+ 476, 474, 474, 458, 461, 475, 459, 490, 470, 471,
+ 468, 465, 475, 452, 466, 465, 449, 448, 447, 468,
+ 456, 454, 454, 435, 434, 0, 462, 434, 460, 432,
+ 436, 435, 466, 446, 443, 0, 442, 445, 441, 443,
+
+ 427, 424, 437, 422, 423, 430, 424, 413, 412, 0,
+ 418, 417, 448, 428, 425, 0, 0, 0, 421, 0,
+ 420, 0, 426, 425, 409, 406, 407, 0, 399, 407,
+ 397, 403, 424, 403, 0, 0, 415, 414, 0, 0,
+ 413, 412, 396, 393, 394, 408, 407, 384, 383, 389,
+ 0, 0, 410, 382, 408, 400, 392, 378, 60, 89,
+ 105, 143, 173, 0, 0, 216, 217, 0, 0, 222,
+ 243, 0, 244, 234, 259, 0, 291, 330, 0, 0,
+ 323, 311, 323, 315, 361, 362, 0, 363, 348, 389,
+ 355, 358, 359, 0, 378, 380, 371, 0, 392, 0,
+
+ 0, 0, 373, 374, 368, 0, 369, 370, 0, 0,
+ 0, 942, 434, 437, 438, 439
} ;
-static yyconst flex_int16_t yy_def[445] =
+static yyconst flex_int16_t yy_def[817] =
{ 0,
- 442, 1, 442, 442, 442, 442, 442, 442, 442, 442,
- 442, 442, 442, 442, 442, 442, 442, 442, 442, 442,
- 442, 442, 442, 442, 442, 443, 442, 442, 442, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 442,
- 442, 442, 442, 442, 442, 442, 442, 442, 442, 442,
- 442, 442, 442, 442, 442, 442, 442, 442, 442, 444,
- 442, 442, 442, 442, 442, 442, 442, 442, 443, 442,
- 442, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
-
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 442, 442, 442, 442, 442, 442,
- 442, 444, 442, 442, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
-
- 443, 443, 443, 443, 443, 442, 442, 442, 442, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
-
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
-
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 0, 442, 442
+ 812, 1, 812, 812, 812, 812, 812, 812, 812, 812,
+ 812, 812, 812, 812, 812, 812, 812, 812, 812, 812,
+ 812, 812, 812, 812, 812, 813, 812, 812, 812, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 812,
+ 812, 812, 812, 812, 812, 812, 812, 812, 812, 812,
+ 812, 812, 812, 814, 812, 815, 18, 19, 812, 812,
+ 816, 812, 812, 812, 812, 812, 812, 812, 812, 813,
+ 812, 812, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 812, 812, 812, 812, 815,
+ 812, 812, 812, 812, 812, 816, 812, 812, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 812, 812, 812, 812, 812, 812, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 0, 812, 812, 812, 812
} ;
-static yyconst flex_int16_t yy_nxt[656] =
+static yyconst flex_int16_t yy_nxt[1015] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16, 17, 18, 19, 19, 19, 19, 19,
19, 20, 21, 22, 23, 24, 25, 26, 26, 26,
- 26, 26, 26, 26, 26, 26, 27, 28, 29, 30,
- 31, 32, 33, 34, 35, 36, 37, 38, 26, 39,
- 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
- 26, 26, 26, 50, 51, 52, 53, 55, 56, 57,
- 60, 62, 64, 64, 64, 64, 64, 64, 64, 77,
- 78, 82, 83, 110, 63, 61, 129, 111, 58, 66,
- 130, 67, 67, 67, 67, 67, 67, 68, 66, 80,
-
- 68, 68, 68, 68, 68, 68, 68, 69, 72, 84,
- 112, 85, 70, 81, 142, 86, 69, 203, 441, 204,
- 69, 87, 94, 113, 95, 73, 90, 74, 75, 69,
- 91, 88, 97, 96, 89, 92, 103, 70, 135, 106,
- 98, 93, 99, 115, 104, 100, 107, 162, 440, 119,
- 131, 101, 439, 108, 132, 105, 120, 121, 116, 125,
- 163, 117, 126, 133, 176, 198, 122, 123, 264, 124,
- 127, 438, 177, 199, 216, 217, 265, 128, 136, 64,
- 64, 64, 64, 64, 64, 64, 138, 138, 138, 138,
- 138, 138, 138, 437, 170, 137, 190, 171, 172, 406,
-
- 407, 173, 139, 174, 242, 243, 244, 436, 137, 435,
- 434, 191, 433, 432, 66, 139, 67, 67, 67, 67,
- 67, 67, 68, 66, 431, 68, 68, 68, 68, 68,
- 68, 68, 69, 141, 141, 141, 141, 141, 141, 141,
- 430, 69, 140, 429, 140, 69, 428, 141, 141, 141,
- 141, 141, 141, 141, 69, 206, 427, 206, 426, 425,
- 207, 207, 207, 207, 207, 207, 207, 138, 138, 138,
- 138, 138, 138, 138, 269, 270, 271, 424, 423, 208,
- 422, 208, 421, 139, 209, 209, 209, 209, 209, 209,
- 209, 277, 278, 279, 420, 419, 139, 141, 141, 141,
-
- 141, 141, 141, 141, 207, 207, 207, 207, 207, 207,
- 207, 207, 207, 207, 207, 207, 207, 207, 209, 209,
- 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
- 209, 209, 286, 287, 288, 293, 294, 295, 297, 298,
- 299, 305, 306, 307, 387, 388, 389, 418, 417, 416,
- 415, 414, 413, 412, 411, 410, 409, 390, 408, 391,
- 79, 79, 405, 404, 403, 402, 401, 400, 399, 398,
- 397, 396, 395, 394, 393, 392, 386, 385, 384, 383,
- 382, 381, 380, 379, 378, 377, 376, 375, 374, 373,
- 372, 371, 370, 369, 368, 367, 366, 365, 364, 363,
-
- 362, 361, 360, 359, 358, 357, 356, 355, 354, 353,
- 352, 351, 350, 349, 348, 347, 346, 345, 344, 343,
- 342, 341, 340, 339, 338, 337, 336, 335, 334, 333,
- 332, 331, 330, 329, 328, 327, 326, 325, 324, 323,
- 322, 321, 320, 319, 318, 317, 316, 315, 314, 313,
- 312, 311, 310, 309, 308, 304, 303, 302, 301, 300,
- 296, 292, 291, 290, 289, 285, 284, 283, 282, 281,
- 280, 276, 275, 274, 273, 272, 268, 267, 266, 263,
- 262, 261, 260, 259, 258, 257, 256, 255, 254, 253,
- 252, 251, 250, 249, 248, 247, 246, 245, 241, 240,
-
- 239, 238, 237, 236, 235, 234, 233, 232, 231, 230,
- 229, 228, 227, 226, 225, 224, 223, 222, 221, 220,
- 219, 218, 215, 214, 213, 212, 211, 210, 205, 202,
- 201, 200, 197, 196, 195, 194, 193, 192, 189, 188,
- 187, 186, 185, 184, 183, 182, 181, 180, 179, 178,
- 175, 169, 168, 167, 166, 165, 164, 161, 160, 159,
- 158, 157, 156, 155, 154, 153, 152, 151, 150, 149,
- 148, 147, 146, 145, 144, 143, 134, 118, 114, 109,
- 102, 76, 71, 65, 59, 54, 442, 3, 442, 442,
- 442, 442, 442, 442, 442, 442, 442, 442, 442, 442,
-
- 442, 442, 442, 442, 442, 442, 442, 442, 442, 442,
- 442, 442, 442, 442, 442, 442, 442, 442, 442, 442,
- 442, 442, 442, 442, 442, 442, 442, 442, 442, 442,
- 442, 442, 442, 442, 442, 442, 442, 442, 442, 442,
- 442, 442, 442, 442, 442, 442, 442, 442, 442, 442,
- 442, 442, 442, 442, 442
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 27, 28, 29, 26, 30, 31, 32, 33, 34, 35,
+ 36, 37, 38, 26, 39, 40, 41, 42, 43, 44,
+ 45, 46, 47, 48, 49, 26, 26, 26, 50, 51,
+ 52, 53, 55, 56, 57, 60, 62, 64, 64, 64,
+ 64, 64, 64, 64, 78, 79, 73, 144, 117, 63,
+ 61, 81, 118, 58, 66, 145, 67, 67, 67, 67,
+
+ 67, 67, 68, 74, 83, 75, 76, 777, 86, 82,
+ 87, 115, 89, 69, 88, 97, 90, 98, 84, 85,
+ 70, 71, 91, 93, 116, 92, 99, 94, 109, 180,
+ 69, 110, 95, 119, 111, 112, 146, 161, 96, 113,
+ 181, 162, 114, 778, 70, 122, 120, 71, 66, 100,
+ 68, 68, 68, 68, 68, 68, 68, 101, 106, 102,
+ 123, 200, 103, 124, 205, 126, 107, 69, 104, 201,
+ 206, 779, 127, 128, 70, 133, 129, 108, 134, 229,
+ 230, 147, 130, 131, 69, 132, 135, 141, 137, 148,
+ 149, 142, 138, 136, 151, 152, 139, 231, 70, 140,
+
+ 143, 153, 812, 260, 261, 232, 148, 149, 154, 780,
+ 154, 151, 152, 155, 155, 155, 155, 155, 155, 155,
+ 182, 220, 169, 247, 208, 153, 170, 171, 812, 213,
+ 222, 192, 781, 183, 193, 194, 221, 209, 195, 210,
+ 196, 233, 238, 223, 239, 214, 215, 247, 242, 234,
+ 242, 151, 152, 243, 243, 243, 243, 243, 243, 243,
+ 291, 292, 293, 782, 783, 244, 784, 244, 151, 152,
+ 245, 245, 245, 245, 245, 245, 245, 155, 155, 155,
+ 155, 155, 155, 155, 155, 155, 155, 155, 155, 155,
+ 155, 254, 305, 323, 785, 786, 306, 330, 331, 332,
+
+ 787, 324, 246, 788, 255, 243, 243, 243, 243, 243,
+ 243, 243, 243, 243, 243, 243, 243, 243, 243, 246,
+ 245, 245, 245, 245, 245, 245, 245, 341, 342, 343,
+ 149, 245, 245, 245, 245, 245, 245, 245, 353, 354,
+ 355, 361, 362, 363, 365, 366, 367, 149, 789, 152,
+ 376, 377, 378, 414, 415, 416, 434, 435, 436, 444,
+ 445, 446, 447, 448, 449, 790, 152, 791, 792, 437,
+ 438, 450, 451, 452, 491, 492, 493, 517, 518, 519,
+ 793, 794, 539, 541, 556, 557, 558, 494, 495, 629,
+ 520, 521, 540, 542, 587, 588, 589, 559, 560, 630,
+
+ 561, 607, 608, 609, 659, 795, 796, 590, 591, 631,
+ 797, 660, 798, 661, 610, 611, 632, 679, 633, 634,
+ 799, 800, 801, 802, 680, 803, 681, 804, 805, 806,
+ 807, 808, 809, 810, 811, 80, 80, 80, 64, 150,
+ 156, 156, 776, 775, 774, 773, 772, 771, 770, 769,
+ 768, 767, 766, 765, 764, 763, 762, 761, 760, 759,
+ 758, 757, 756, 755, 754, 753, 752, 751, 750, 749,
+ 748, 747, 746, 745, 744, 743, 742, 741, 740, 739,
+ 738, 737, 736, 735, 734, 733, 732, 731, 730, 729,
+ 728, 727, 726, 725, 724, 723, 722, 721, 720, 719,
+
+ 718, 717, 716, 715, 714, 713, 712, 711, 710, 709,
+ 708, 707, 706, 705, 704, 703, 702, 701, 700, 699,
+ 698, 697, 696, 695, 694, 693, 692, 691, 690, 689,
+ 688, 687, 686, 685, 684, 683, 682, 678, 677, 676,
+ 675, 674, 673, 672, 671, 670, 669, 668, 667, 666,
+ 665, 664, 663, 662, 658, 657, 656, 655, 654, 653,
+ 652, 651, 650, 649, 648, 647, 646, 645, 644, 643,
+ 642, 641, 640, 639, 638, 637, 636, 635, 628, 627,
+ 626, 625, 624, 623, 622, 621, 620, 619, 618, 617,
+ 616, 615, 614, 613, 612, 606, 605, 604, 603, 602,
+
+ 601, 600, 599, 598, 597, 596, 595, 594, 593, 592,
+ 586, 585, 584, 583, 582, 581, 580, 579, 578, 577,
+ 576, 575, 574, 573, 572, 571, 570, 569, 568, 567,
+ 566, 565, 564, 563, 562, 555, 554, 553, 552, 551,
+ 550, 549, 548, 547, 546, 545, 544, 543, 538, 537,
+ 536, 535, 534, 533, 532, 531, 530, 529, 528, 527,
+ 526, 525, 524, 523, 522, 516, 515, 514, 513, 512,
+ 511, 510, 509, 508, 507, 506, 505, 504, 503, 502,
+ 501, 500, 499, 498, 497, 496, 490, 489, 488, 487,
+ 486, 485, 484, 483, 482, 481, 480, 479, 478, 477,
+
+ 476, 475, 474, 473, 472, 471, 470, 469, 468, 467,
+ 466, 465, 464, 463, 462, 461, 460, 459, 458, 457,
+ 456, 455, 454, 453, 443, 442, 441, 440, 439, 433,
+ 432, 431, 430, 429, 428, 427, 426, 425, 424, 423,
+ 422, 421, 420, 419, 418, 417, 413, 412, 411, 410,
+ 409, 408, 407, 406, 405, 404, 403, 402, 401, 400,
+ 399, 398, 397, 396, 395, 394, 393, 392, 391, 390,
+ 389, 388, 387, 386, 385, 384, 383, 382, 381, 380,
+ 379, 375, 374, 373, 372, 371, 370, 369, 368, 364,
+ 360, 359, 358, 357, 356, 352, 351, 350, 349, 348,
+
+ 347, 346, 345, 344, 340, 339, 338, 337, 336, 335,
+ 334, 333, 329, 328, 327, 326, 325, 322, 321, 320,
+ 319, 318, 317, 316, 315, 314, 313, 312, 311, 310,
+ 309, 308, 307, 304, 303, 302, 301, 300, 299, 298,
+ 297, 296, 295, 294, 290, 289, 288, 287, 286, 285,
+ 284, 283, 282, 281, 280, 279, 278, 277, 276, 275,
+ 274, 273, 272, 271, 270, 269, 268, 267, 266, 265,
+ 264, 263, 262, 259, 258, 257, 256, 253, 252, 251,
+ 250, 249, 248, 241, 240, 237, 236, 235, 228, 227,
+ 226, 225, 224, 219, 218, 217, 216, 212, 211, 207,
+
+ 204, 203, 202, 199, 198, 197, 191, 190, 189, 188,
+ 187, 186, 185, 184, 179, 178, 177, 176, 175, 174,
+ 173, 172, 168, 167, 166, 165, 164, 163, 160, 159,
+ 158, 157, 125, 121, 105, 77, 72, 65, 59, 54,
+ 812, 3, 812, 812, 812, 812, 812, 812, 812, 812,
+ 812, 812, 812, 812, 812, 812, 812, 812, 812, 812,
+ 812, 812, 812, 812, 812, 812, 812, 812, 812, 812,
+ 812, 812, 812, 812, 812, 812, 812, 812, 812, 812,
+ 812, 812, 812, 812, 812, 812, 812, 812, 812, 812,
+ 812, 812, 812, 812, 812, 812, 812, 812, 812, 812,
+
+ 812, 812, 812, 812, 812, 812, 812, 812, 812, 812,
+ 812, 812, 812, 812
} ;
-static yyconst flex_int16_t yy_chk[656] =
+static yyconst flex_int16_t yy_chk[1015] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -679,76 +849,116 @@ static yyconst flex_int16_t yy_chk[656] =
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 8, 8, 9,
- 13, 15, 16, 16, 16, 16, 16, 16, 16, 24,
- 24, 30, 30, 40, 15, 13, 47, 40, 9, 18,
- 47, 18, 18, 18, 18, 18, 18, 18, 19, 29,
-
- 19, 19, 19, 19, 19, 19, 19, 18, 22, 31,
- 41, 31, 18, 29, 444, 31, 19, 133, 439, 133,
- 18, 32, 34, 41, 34, 22, 33, 22, 22, 19,
- 33, 32, 35, 34, 32, 33, 37, 18, 51, 38,
- 35, 33, 35, 43, 37, 35, 38, 99, 438, 45,
- 48, 35, 437, 38, 48, 37, 45, 45, 43, 46,
- 99, 43, 46, 48, 109, 129, 45, 45, 198, 45,
- 46, 436, 109, 129, 152, 152, 198, 46, 51, 64,
- 64, 64, 64, 64, 64, 64, 66, 66, 66, 66,
- 66, 66, 66, 435, 107, 64, 122, 107, 107, 401,
-
- 401, 107, 66, 107, 178, 178, 178, 434, 64, 432,
- 430, 122, 429, 428, 67, 66, 67, 67, 67, 67,
- 67, 67, 67, 68, 427, 68, 68, 68, 68, 68,
- 68, 68, 67, 140, 140, 140, 140, 140, 140, 140,
- 426, 68, 69, 424, 69, 67, 423, 69, 69, 69,
- 69, 69, 69, 69, 68, 137, 422, 137, 421, 420,
- 137, 137, 137, 137, 137, 137, 137, 138, 138, 138,
- 138, 138, 138, 138, 202, 202, 202, 419, 418, 139,
- 417, 139, 416, 138, 139, 139, 139, 139, 139, 139,
- 139, 213, 213, 213, 414, 413, 138, 141, 141, 141,
-
- 141, 141, 141, 141, 206, 206, 206, 206, 206, 206,
- 206, 207, 207, 207, 207, 207, 207, 207, 208, 208,
- 208, 208, 208, 208, 208, 209, 209, 209, 209, 209,
- 209, 209, 221, 221, 221, 229, 229, 229, 233, 233,
- 233, 239, 239, 239, 372, 372, 372, 412, 411, 410,
- 409, 408, 407, 406, 405, 404, 403, 372, 402, 372,
- 443, 443, 400, 391, 390, 389, 388, 387, 386, 384,
- 383, 382, 379, 378, 376, 373, 371, 370, 369, 367,
- 366, 365, 362, 361, 360, 359, 358, 357, 356, 355,
- 349, 346, 343, 342, 341, 340, 339, 337, 335, 334,
-
- 333, 332, 330, 329, 327, 325, 324, 323, 322, 321,
- 320, 319, 318, 316, 315, 314, 313, 312, 311, 310,
- 309, 308, 304, 303, 300, 289, 285, 284, 283, 282,
- 275, 274, 273, 268, 267, 266, 265, 264, 263, 260,
- 259, 258, 257, 256, 255, 254, 253, 252, 251, 250,
- 249, 248, 247, 246, 245, 238, 237, 236, 235, 234,
- 232, 228, 226, 225, 224, 220, 219, 218, 217, 216,
- 215, 212, 210, 205, 204, 203, 201, 200, 199, 197,
- 196, 195, 194, 193, 192, 191, 190, 189, 188, 187,
- 186, 185, 184, 183, 182, 181, 180, 179, 177, 176,
-
- 175, 174, 173, 172, 171, 170, 169, 168, 167, 166,
- 165, 163, 162, 161, 160, 159, 158, 157, 156, 155,
- 154, 153, 151, 150, 149, 148, 147, 146, 134, 132,
- 131, 130, 128, 127, 126, 125, 124, 123, 121, 120,
- 119, 118, 117, 116, 115, 114, 113, 112, 111, 110,
- 108, 105, 104, 103, 102, 101, 100, 98, 97, 96,
- 95, 94, 93, 92, 91, 90, 89, 88, 87, 86,
- 85, 84, 83, 82, 78, 74, 49, 44, 42, 39,
- 36, 23, 20, 17, 12, 7, 3, 442, 442, 442,
- 442, 442, 442, 442, 442, 442, 442, 442, 442, 442,
-
- 442, 442, 442, 442, 442, 442, 442, 442, 442, 442,
- 442, 442, 442, 442, 442, 442, 442, 442, 442, 442,
- 442, 442, 442, 442, 442, 442, 442, 442, 442, 442,
- 442, 442, 442, 442, 442, 442, 442, 442, 442, 442,
- 442, 442, 442, 442, 442, 442, 442, 442, 442, 442,
- 442, 442, 442, 442, 442
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 8, 8, 9, 13, 15, 16, 16, 16,
+ 16, 16, 16, 16, 24, 24, 22, 49, 40, 15,
+ 13, 29, 40, 9, 18, 49, 18, 18, 18, 18,
+
+ 18, 18, 18, 22, 30, 22, 22, 759, 31, 29,
+ 31, 39, 32, 18, 31, 34, 32, 34, 30, 30,
+ 18, 18, 32, 33, 39, 32, 34, 33, 38, 101,
+ 18, 38, 33, 41, 38, 38, 51, 85, 33, 38,
+ 101, 85, 38, 760, 18, 43, 41, 18, 19, 35,
+ 19, 19, 19, 19, 19, 19, 19, 35, 37, 35,
+ 43, 116, 35, 43, 120, 45, 37, 19, 35, 116,
+ 120, 761, 45, 45, 19, 46, 45, 37, 46, 137,
+ 137, 51, 45, 45, 19, 45, 46, 48, 47, 64,
+ 64, 48, 47, 46, 66, 66, 47, 138, 19, 47,
+
+ 48, 67, 67, 171, 171, 138, 64, 64, 69, 762,
+ 69, 66, 66, 69, 69, 69, 69, 69, 69, 69,
+ 102, 130, 92, 156, 122, 67, 92, 92, 67, 125,
+ 131, 112, 763, 102, 112, 112, 130, 122, 112, 122,
+ 112, 139, 143, 131, 143, 125, 125, 156, 148, 139,
+ 148, 150, 150, 148, 148, 148, 148, 148, 148, 148,
+ 202, 202, 202, 766, 767, 151, 770, 151, 150, 150,
+ 151, 151, 151, 151, 151, 151, 151, 154, 154, 154,
+ 154, 154, 154, 154, 155, 155, 155, 155, 155, 155,
+ 155, 166, 214, 231, 771, 773, 214, 237, 237, 237,
+
+ 774, 231, 155, 775, 166, 242, 242, 242, 242, 242,
+ 242, 242, 243, 243, 243, 243, 243, 243, 243, 155,
+ 244, 244, 244, 244, 244, 244, 244, 253, 253, 253,
+ 243, 245, 245, 245, 245, 245, 245, 245, 265, 265,
+ 265, 274, 274, 274, 278, 278, 278, 243, 777, 245,
+ 287, 287, 287, 328, 328, 328, 369, 369, 369, 380,
+ 380, 380, 381, 381, 381, 778, 245, 781, 782, 369,
+ 369, 382, 382, 382, 433, 433, 433, 476, 476, 476,
+ 783, 784, 496, 497, 513, 513, 513, 433, 433, 596,
+ 476, 476, 496, 497, 547, 547, 547, 513, 513, 596,
+
+ 513, 570, 570, 570, 624, 785, 786, 547, 547, 597,
+ 788, 624, 789, 624, 570, 570, 597, 645, 597, 597,
+ 790, 791, 792, 793, 645, 795, 645, 796, 797, 799,
+ 803, 804, 805, 807, 808, 813, 813, 813, 814, 815,
+ 816, 816, 758, 757, 756, 755, 754, 753, 750, 749,
+ 748, 747, 746, 745, 744, 743, 742, 741, 738, 737,
+ 734, 733, 732, 731, 730, 729, 727, 726, 725, 724,
+ 723, 721, 719, 715, 714, 713, 712, 711, 709, 708,
+ 707, 706, 705, 704, 703, 702, 701, 700, 699, 698,
+ 697, 695, 694, 693, 692, 691, 690, 689, 688, 687,
+
+ 685, 684, 683, 682, 681, 680, 679, 678, 677, 676,
+ 675, 674, 673, 672, 671, 670, 669, 668, 667, 666,
+ 665, 664, 663, 662, 661, 660, 659, 658, 656, 655,
+ 654, 653, 652, 651, 650, 648, 647, 644, 642, 641,
+ 640, 638, 637, 636, 635, 634, 633, 632, 631, 630,
+ 629, 628, 627, 626, 623, 622, 621, 620, 619, 618,
+ 616, 615, 614, 613, 611, 610, 609, 608, 607, 606,
+ 605, 604, 603, 602, 601, 600, 599, 598, 593, 591,
+ 590, 589, 588, 587, 583, 582, 581, 580, 579, 578,
+ 577, 576, 575, 573, 572, 568, 567, 565, 564, 562,
+
+ 561, 560, 559, 558, 557, 556, 552, 551, 550, 548,
+ 546, 545, 544, 543, 542, 541, 540, 539, 538, 537,
+ 535, 534, 529, 528, 527, 526, 524, 523, 521, 520,
+ 519, 518, 517, 515, 514, 512, 511, 510, 509, 508,
+ 507, 506, 505, 503, 502, 501, 500, 499, 495, 494,
+ 493, 492, 491, 490, 487, 486, 485, 484, 483, 482,
+ 481, 480, 479, 478, 477, 475, 474, 471, 466, 464,
+ 463, 462, 460, 459, 456, 455, 454, 453, 442, 441,
+ 440, 438, 437, 436, 435, 434, 431, 429, 428, 427,
+ 425, 424, 423, 422, 420, 418, 417, 412, 411, 409,
+
+ 408, 407, 406, 405, 404, 403, 402, 401, 400, 399,
+ 397, 396, 395, 394, 393, 392, 391, 389, 388, 387,
+ 386, 385, 384, 383, 379, 375, 374, 373, 370, 368,
+ 358, 356, 352, 351, 350, 349, 347, 346, 344, 339,
+ 338, 337, 336, 335, 334, 329, 327, 326, 325, 324,
+ 323, 321, 320, 317, 316, 315, 314, 313, 312, 311,
+ 310, 309, 308, 307, 306, 305, 304, 303, 302, 301,
+ 300, 299, 298, 297, 296, 295, 294, 293, 292, 291,
+ 288, 286, 285, 284, 283, 282, 281, 280, 279, 277,
+ 273, 271, 270, 269, 268, 264, 263, 262, 261, 260,
+
+ 259, 258, 257, 256, 252, 250, 249, 248, 241, 240,
+ 239, 238, 236, 235, 234, 233, 232, 230, 229, 228,
+ 227, 226, 225, 224, 223, 222, 221, 220, 219, 218,
+ 217, 216, 215, 213, 212, 211, 210, 209, 208, 207,
+ 206, 205, 204, 203, 201, 200, 199, 198, 197, 196,
+ 195, 194, 193, 192, 191, 190, 189, 188, 187, 186,
+ 185, 183, 182, 181, 180, 179, 178, 177, 176, 175,
+ 174, 173, 172, 170, 169, 168, 167, 165, 164, 163,
+ 162, 161, 159, 145, 144, 142, 141, 140, 136, 135,
+ 134, 133, 132, 129, 128, 127, 126, 124, 123, 121,
+
+ 119, 118, 117, 115, 114, 113, 111, 110, 108, 107,
+ 106, 105, 104, 103, 100, 99, 98, 97, 96, 95,
+ 94, 93, 91, 90, 89, 88, 87, 86, 84, 83,
+ 79, 75, 44, 42, 36, 23, 20, 17, 12, 7,
+ 3, 812, 812, 812, 812, 812, 812, 812, 812, 812,
+ 812, 812, 812, 812, 812, 812, 812, 812, 812, 812,
+ 812, 812, 812, 812, 812, 812, 812, 812, 812, 812,
+ 812, 812, 812, 812, 812, 812, 812, 812, 812, 812,
+ 812, 812, 812, 812, 812, 812, 812, 812, 812, 812,
+ 812, 812, 812, 812, 812, 812, 812, 812, 812, 812,
+
+ 812, 812, 812, 812, 812, 812, 812, 812, 812, 812,
+ 812, 812, 812, 812
} ;
/* Table of booleans, true if rule could match eol. */
-static yyconst flex_int32_t yy_rule_can_match_eol[148] =
+static yyconst flex_int32_t yy_rule_can_match_eol[238] =
{ 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -757,7 +967,11 @@ static yyconst flex_int32_t yy_rule_can_match_eol[148] =
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0, };
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, };
/* The intent behind this definition is that it'll catch
* any uses of REJECT which flex missed.
@@ -768,7 +982,7 @@ static yyconst flex_int32_t yy_rule_can_match_eol[148] =
#define YY_RESTORE_YY_MORE_OFFSET
/*
//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -781,10 +995,11 @@ IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh,
WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp).
*/
-#include "compiler/glslang.h"
-#include "compiler/ParseContext.h"
+#include "compiler/translator/glslang.h"
+#include "compiler/translator/ParseContext.h"
#include "compiler/preprocessor/Token.h"
-#include "compiler/util.h"
+#include "compiler/translator/util.h"
+#include "compiler/translator/length_limits.h"
#include "glslang_tab.h"
/* windows only pragma */
@@ -802,8 +1017,13 @@ WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp).
static yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner);
static int check_type(yyscan_t yyscanner);
static int reserved_word(yyscan_t yyscanner);
+static int ES2_reserved_ES3_keyword(TParseContext *context, int token);
+static int ES2_keyword_ES3_reserved(TParseContext *context, int token);
+static int ES2_ident_ES3_keyword(TParseContext *context, int token);
+static int uint_constant(TParseContext *context);
static int int_constant(yyscan_t yyscanner);
static int float_constant(yyscan_t yyscanner);
+static int floatsuffix_check(TParseContext* context);
#define INITIAL 0
@@ -888,6 +1108,10 @@ int yyget_lineno (yyscan_t yyscanner );
void yyset_lineno (int line_number ,yyscan_t yyscanner );
+int yyget_column (yyscan_t yyscanner );
+
+void yyset_column (int column_no ,yyscan_t yyscanner );
+
YYSTYPE * yyget_lval (yyscan_t yyscanner );
void yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
@@ -936,7 +1160,7 @@ static int input (yyscan_t yyscanner );
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
-#define ECHO fwrite( yytext, yyleng, 1, yyout )
+#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
@@ -947,7 +1171,7 @@ static int input (yyscan_t yyscanner );
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
{ \
int c = '*'; \
- yy_size_t n; \
+ size_t n; \
for ( n = 0; n < max_size && \
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \
@@ -1032,6 +1256,8 @@ YY_DECL
register int yy_act;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ TParseContext* context = yyextra;
+
yylval = yylval_param;
yylloc = yylloc_param;
@@ -1087,13 +1313,13 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 443 )
+ if ( yy_current_state >= 813 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
- while ( yy_current_state != 442 );
+ while ( yy_current_state != 812 );
yy_cp = yyg->yy_last_accepting_cpos;
yy_current_state = yyg->yy_last_accepting_state;
@@ -1147,7 +1373,7 @@ YY_RULE_SETUP
YY_BREAK
case 6:
YY_RULE_SETUP
-{ return ATTRIBUTE; }
+{ return ES2_keyword_ES3_reserved(context, ATTRIBUTE); }
YY_BREAK
case 7:
YY_RULE_SETUP
@@ -1159,7 +1385,7 @@ YY_RULE_SETUP
YY_BREAK
case 9:
YY_RULE_SETUP
-{ return VARYING; }
+{ return ES2_keyword_ES3_reserved(context, VARYING); }
YY_BREAK
case 10:
YY_RULE_SETUP
@@ -1191,532 +1417,624 @@ YY_RULE_SETUP
YY_BREAK
case 17:
YY_RULE_SETUP
-{ return IN_QUAL; }
+{ return ES2_reserved_ES3_keyword(context, SWITCH); }
YY_BREAK
case 18:
YY_RULE_SETUP
-{ return OUT_QUAL; }
+{ return ES2_ident_ES3_keyword(context, CASE); }
YY_BREAK
case 19:
YY_RULE_SETUP
-{ return INOUT_QUAL; }
+{ return ES2_reserved_ES3_keyword(context, DEFAULT); }
YY_BREAK
case 20:
YY_RULE_SETUP
-{ return FLOAT_TYPE; }
+{ return ES2_ident_ES3_keyword(context, CENTROID); }
YY_BREAK
case 21:
YY_RULE_SETUP
-{ return INT_TYPE; }
+{ return ES2_reserved_ES3_keyword(context, FLAT); }
YY_BREAK
case 22:
YY_RULE_SETUP
-{ return VOID_TYPE; }
+{ return ES2_ident_ES3_keyword(context, SMOOTH); }
YY_BREAK
case 23:
YY_RULE_SETUP
-{ return BOOL_TYPE; }
+{ return IN_QUAL; }
YY_BREAK
case 24:
YY_RULE_SETUP
-{ yylval->lex.b = true; return BOOLCONSTANT; }
+{ return OUT_QUAL; }
YY_BREAK
case 25:
YY_RULE_SETUP
-{ yylval->lex.b = false; return BOOLCONSTANT; }
+{ return INOUT_QUAL; }
YY_BREAK
case 26:
YY_RULE_SETUP
-{ return DISCARD; }
+{ return FLOAT_TYPE; }
YY_BREAK
case 27:
YY_RULE_SETUP
-{ return RETURN; }
+{ return INT_TYPE; }
YY_BREAK
case 28:
YY_RULE_SETUP
-{ return MATRIX2; }
+{ return ES2_ident_ES3_keyword(context, UINT_TYPE); }
YY_BREAK
case 29:
YY_RULE_SETUP
-{ return MATRIX3; }
+{ return VOID_TYPE; }
YY_BREAK
case 30:
YY_RULE_SETUP
-{ return MATRIX4; }
+{ return BOOL_TYPE; }
YY_BREAK
case 31:
YY_RULE_SETUP
-{ return VEC2; }
+{ yylval->lex.b = true; return BOOLCONSTANT; }
YY_BREAK
case 32:
YY_RULE_SETUP
-{ return VEC3; }
+{ yylval->lex.b = false; return BOOLCONSTANT; }
YY_BREAK
case 33:
YY_RULE_SETUP
-{ return VEC4; }
+{ return DISCARD; }
YY_BREAK
case 34:
YY_RULE_SETUP
-{ return IVEC2; }
+{ return RETURN; }
YY_BREAK
case 35:
YY_RULE_SETUP
-{ return IVEC3; }
+{ return MATRIX2; }
YY_BREAK
case 36:
YY_RULE_SETUP
-{ return IVEC4; }
+{ return MATRIX3; }
YY_BREAK
case 37:
YY_RULE_SETUP
-{ return BVEC2; }
+{ return MATRIX4; }
YY_BREAK
case 38:
YY_RULE_SETUP
-{ return BVEC3; }
+{ return ES2_ident_ES3_keyword(context, MATRIX2); }
YY_BREAK
case 39:
YY_RULE_SETUP
-{ return BVEC4; }
+{ return ES2_ident_ES3_keyword(context, MATRIX3); }
YY_BREAK
case 40:
YY_RULE_SETUP
-{ return SAMPLER2D; }
+{ return ES2_ident_ES3_keyword(context, MATRIX4); }
YY_BREAK
case 41:
YY_RULE_SETUP
-{ return SAMPLERCUBE; }
+{ return ES2_ident_ES3_keyword(context, MATRIX2x3); }
YY_BREAK
case 42:
YY_RULE_SETUP
-{ return SAMPLER_EXTERNAL_OES; }
+{ return ES2_ident_ES3_keyword(context, MATRIX3x2); }
YY_BREAK
case 43:
YY_RULE_SETUP
-{ return SAMPLER2DRECT; }
+{ return ES2_ident_ES3_keyword(context, MATRIX2x4); }
YY_BREAK
case 44:
YY_RULE_SETUP
-{ return STRUCT; }
+{ return ES2_ident_ES3_keyword(context, MATRIX4x2); }
YY_BREAK
case 45:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return ES2_ident_ES3_keyword(context, MATRIX3x4); }
YY_BREAK
case 46:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return ES2_ident_ES3_keyword(context, MATRIX4x3); }
YY_BREAK
case 47:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return VEC2; }
YY_BREAK
case 48:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return VEC3; }
YY_BREAK
case 49:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return VEC4; }
YY_BREAK
case 50:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return IVEC2; }
YY_BREAK
case 51:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return IVEC3; }
YY_BREAK
case 52:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return IVEC4; }
YY_BREAK
case 53:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return BVEC2; }
YY_BREAK
case 54:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return BVEC3; }
YY_BREAK
case 55:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return BVEC4; }
YY_BREAK
case 56:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return ES2_ident_ES3_keyword(context, UVEC2); }
YY_BREAK
case 57:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return ES2_ident_ES3_keyword(context, UVEC3); }
YY_BREAK
case 58:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return ES2_ident_ES3_keyword(context, UVEC4); }
YY_BREAK
case 59:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return SAMPLER2D; }
YY_BREAK
case 60:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return SAMPLERCUBE; }
YY_BREAK
case 61:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return SAMPLER_EXTERNAL_OES; }
YY_BREAK
case 62:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return ES2_reserved_ES3_keyword(context, SAMPLER3D); }
YY_BREAK
case 63:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return ES2_reserved_ES3_keyword(context, SAMPLER3DRECT); }
YY_BREAK
case 64:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return SAMPLER2DRECT; }
YY_BREAK
case 65:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return ES2_ident_ES3_keyword(context, SAMPLER2DARRAY); }
YY_BREAK
case 66:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return ES2_ident_ES3_keyword(context, ISAMPLER2D); }
YY_BREAK
case 67:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return ES2_ident_ES3_keyword(context, ISAMPLER3D); }
YY_BREAK
case 68:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return ES2_ident_ES3_keyword(context, ISAMPLERCUBE); }
YY_BREAK
case 69:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return ES2_ident_ES3_keyword(context, ISAMPLER2DARRAY); }
YY_BREAK
case 70:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return ES2_ident_ES3_keyword(context, USAMPLER2D); }
YY_BREAK
case 71:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return ES2_ident_ES3_keyword(context, USAMPLER3D); }
YY_BREAK
case 72:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return ES2_ident_ES3_keyword(context, USAMPLERCUBE); }
YY_BREAK
case 73:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return ES2_ident_ES3_keyword(context, USAMPLER2DARRAY); }
YY_BREAK
case 74:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return ES2_reserved_ES3_keyword(context, SAMPLER2DSHADOW); }
YY_BREAK
case 75:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return ES2_ident_ES3_keyword(context, SAMPLERCUBESHADOW); }
YY_BREAK
case 76:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return ES2_ident_ES3_keyword(context, SAMPLER2DARRAYSHADOW); }
YY_BREAK
case 77:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return STRUCT; }
YY_BREAK
case 78:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{ return ES2_ident_ES3_keyword(context, LAYOUT); }
YY_BREAK
+/* Reserved keywords for GLSL ES 3.00 that are not reserved for GLSL ES 1.00 */
case 79:
-YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
- YY_BREAK
case 80:
-YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
- YY_BREAK
case 81:
-YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
- YY_BREAK
case 82:
-YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
- YY_BREAK
case 83:
-YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
- YY_BREAK
case 84:
-YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
- YY_BREAK
case 85:
-YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
- YY_BREAK
case 86:
-YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
- YY_BREAK
case 87:
-YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
- YY_BREAK
case 88:
-YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
- YY_BREAK
case 89:
-YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
- YY_BREAK
case 90:
+case 91:
+case 92:
+case 93:
+case 94:
+case 95:
+case 96:
+case 97:
+case 98:
+case 99:
+case 100:
+case 101:
+case 102:
+case 103:
+case 104:
+case 105:
+case 106:
+case 107:
+case 108:
+case 109:
+case 110:
+case 111:
+case 112:
+case 113:
+case 114:
+case 115:
+case 116:
+case 117:
+case 118:
+case 119:
+case 120:
+case 121:
+case 122:
+case 123:
+case 124:
+case 125:
+case 126:
+case 127:
+case 128:
+case 129:
+case 130:
+case 131:
+case 132:
+case 133:
+case 134:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{
+ if (context->shaderVersion < 300) {
+ yylval->lex.string = NewPoolTString(yytext);
+ return check_type(yyscanner);
+ }
+ return reserved_word(yyscanner);
+}
YY_BREAK
-case 91:
+/* Reserved keywords in GLSL ES 1.00 that are not reserved in GLSL ES 3.00 */
+case 135:
YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
+{
+ if (context->shaderVersion >= 300)
+ {
+ yylval->lex.string = NewPoolTString(yytext);
+ return check_type(yyscanner);
+ }
+
+ return reserved_word(yyscanner);
+}
YY_BREAK
-case 92:
+/* Reserved keywords */
+case 136:
+case 137:
+case 138:
+case 139:
+case 140:
+case 141:
+case 142:
+case 143:
+case 144:
+case 145:
+case 146:
+case 147:
+case 148:
+case 149:
+case 150:
+case 151:
+case 152:
+case 153:
+case 154:
+case 155:
+case 156:
+case 157:
+case 158:
+case 159:
+case 160:
+case 161:
+case 162:
+case 163:
+case 164:
+case 165:
+case 166:
+case 167:
+case 168:
+case 169:
+case 170:
+case 171:
+case 172:
+case 173:
+case 174:
+case 175:
+case 176:
YY_RULE_SETUP
{ return reserved_word(yyscanner); }
YY_BREAK
-case 93:
+case 177:
YY_RULE_SETUP
{
yylval->lex.string = NewPoolTString(yytext);
return check_type(yyscanner);
}
YY_BREAK
-case 94:
+case 178:
YY_RULE_SETUP
{ return int_constant(yyscanner); }
YY_BREAK
-case 95:
+case 179:
YY_RULE_SETUP
{ return int_constant(yyscanner); }
YY_BREAK
-case 96:
+case 180:
YY_RULE_SETUP
{ return int_constant(yyscanner); }
YY_BREAK
-case 97:
+case 181:
+YY_RULE_SETUP
+{ return uint_constant(context); }
+ YY_BREAK
+case 182:
+YY_RULE_SETUP
+{ return uint_constant(context); }
+ YY_BREAK
+case 183:
+YY_RULE_SETUP
+{ return uint_constant(context); }
+ YY_BREAK
+case 184:
YY_RULE_SETUP
{ return float_constant(yyscanner); }
YY_BREAK
-case 98:
+case 185:
YY_RULE_SETUP
{ return float_constant(yyscanner); }
YY_BREAK
-case 99:
+case 186:
YY_RULE_SETUP
{ return float_constant(yyscanner); }
YY_BREAK
-case 100:
+case 187:
+YY_RULE_SETUP
+{ return floatsuffix_check(context); }
+ YY_BREAK
+case 188:
+YY_RULE_SETUP
+{ return floatsuffix_check(context); }
+ YY_BREAK
+case 189:
+YY_RULE_SETUP
+{ return floatsuffix_check(context); }
+ YY_BREAK
+case 190:
YY_RULE_SETUP
{ return ADD_ASSIGN; }
YY_BREAK
-case 101:
+case 191:
YY_RULE_SETUP
{ return SUB_ASSIGN; }
YY_BREAK
-case 102:
+case 192:
YY_RULE_SETUP
{ return MUL_ASSIGN; }
YY_BREAK
-case 103:
+case 193:
YY_RULE_SETUP
{ return DIV_ASSIGN; }
YY_BREAK
-case 104:
+case 194:
YY_RULE_SETUP
{ return MOD_ASSIGN; }
YY_BREAK
-case 105:
+case 195:
YY_RULE_SETUP
{ return LEFT_ASSIGN; }
YY_BREAK
-case 106:
+case 196:
YY_RULE_SETUP
{ return RIGHT_ASSIGN; }
YY_BREAK
-case 107:
+case 197:
YY_RULE_SETUP
{ return AND_ASSIGN; }
YY_BREAK
-case 108:
+case 198:
YY_RULE_SETUP
{ return XOR_ASSIGN; }
YY_BREAK
-case 109:
+case 199:
YY_RULE_SETUP
{ return OR_ASSIGN; }
YY_BREAK
-case 110:
+case 200:
YY_RULE_SETUP
{ return INC_OP; }
YY_BREAK
-case 111:
+case 201:
YY_RULE_SETUP
{ return DEC_OP; }
YY_BREAK
-case 112:
+case 202:
YY_RULE_SETUP
{ return AND_OP; }
YY_BREAK
-case 113:
+case 203:
YY_RULE_SETUP
{ return OR_OP; }
YY_BREAK
-case 114:
+case 204:
YY_RULE_SETUP
{ return XOR_OP; }
YY_BREAK
-case 115:
+case 205:
YY_RULE_SETUP
{ return LE_OP; }
YY_BREAK
-case 116:
+case 206:
YY_RULE_SETUP
{ return GE_OP; }
YY_BREAK
-case 117:
+case 207:
YY_RULE_SETUP
{ return EQ_OP; }
YY_BREAK
-case 118:
+case 208:
YY_RULE_SETUP
{ return NE_OP; }
YY_BREAK
-case 119:
+case 209:
YY_RULE_SETUP
{ return LEFT_OP; }
YY_BREAK
-case 120:
+case 210:
YY_RULE_SETUP
{ return RIGHT_OP; }
YY_BREAK
-case 121:
+case 211:
YY_RULE_SETUP
{ return SEMICOLON; }
YY_BREAK
-case 122:
+case 212:
YY_RULE_SETUP
{ return LEFT_BRACE; }
YY_BREAK
-case 123:
+case 213:
YY_RULE_SETUP
{ return RIGHT_BRACE; }
YY_BREAK
-case 124:
+case 214:
YY_RULE_SETUP
{ return COMMA; }
YY_BREAK
-case 125:
+case 215:
YY_RULE_SETUP
{ return COLON; }
YY_BREAK
-case 126:
+case 216:
YY_RULE_SETUP
{ return EQUAL; }
YY_BREAK
-case 127:
+case 217:
YY_RULE_SETUP
{ return LEFT_PAREN; }
YY_BREAK
-case 128:
+case 218:
YY_RULE_SETUP
{ return RIGHT_PAREN; }
YY_BREAK
-case 129:
+case 219:
YY_RULE_SETUP
{ return LEFT_BRACKET; }
YY_BREAK
-case 130:
+case 220:
YY_RULE_SETUP
{ return RIGHT_BRACKET; }
YY_BREAK
-case 131:
+case 221:
YY_RULE_SETUP
{ return DOT; }
YY_BREAK
-case 132:
+case 222:
YY_RULE_SETUP
{ return BANG; }
YY_BREAK
-case 133:
+case 223:
YY_RULE_SETUP
{ return DASH; }
YY_BREAK
-case 134:
+case 224:
YY_RULE_SETUP
{ return TILDE; }
YY_BREAK
-case 135:
+case 225:
YY_RULE_SETUP
{ return PLUS; }
YY_BREAK
-case 136:
+case 226:
YY_RULE_SETUP
{ return STAR; }
YY_BREAK
-case 137:
+case 227:
YY_RULE_SETUP
{ return SLASH; }
YY_BREAK
-case 138:
+case 228:
YY_RULE_SETUP
{ return PERCENT; }
YY_BREAK
-case 139:
+case 229:
YY_RULE_SETUP
{ return LEFT_ANGLE; }
YY_BREAK
-case 140:
+case 230:
YY_RULE_SETUP
{ return RIGHT_ANGLE; }
YY_BREAK
-case 141:
+case 231:
YY_RULE_SETUP
{ return VERTICAL_BAR; }
YY_BREAK
-case 142:
+case 232:
YY_RULE_SETUP
{ return CARET; }
YY_BREAK
-case 143:
+case 233:
YY_RULE_SETUP
{ return AMPERSAND; }
YY_BREAK
-case 144:
+case 234:
YY_RULE_SETUP
{ return QUESTION; }
YY_BREAK
-case 145:
-/* rule 145 can match eol */
+case 235:
+/* rule 235 can match eol */
YY_RULE_SETUP
{ }
YY_BREAK
case YY_STATE_EOF(INITIAL):
{ yyterminate(); }
YY_BREAK
-case 146:
+case 236:
YY_RULE_SETUP
{ assert(false); return 0; }
YY_BREAK
-case 147:
+case 237:
YY_RULE_SETUP
ECHO;
YY_BREAK
@@ -1912,7 +2230,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
{ /* Not enough room in the buffer - grow it. */
/* just a shorter name for the current buffer */
- YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
+ YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
int yy_c_buf_p_offset =
(int) (yyg->yy_c_buf_p - b->yy_ch_buf);
@@ -2012,7 +2330,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 443 )
+ if ( yy_current_state >= 813 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -2041,12 +2359,13 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 443 )
+ if ( yy_current_state >= 813 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 442);
+ yy_is_jam = (yy_current_state == 812);
+ (void)yyg;
return yy_is_jam ? 0 : yy_current_state;
}
@@ -2455,8 +2774,8 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
* scan from a @e copy of @a bytes.
- * @param bytes the byte buffer to scan
- * @param len the number of bytes in the buffer pointed to by @a bytes.
+ * @param yybytes the byte buffer to scan
+ * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
* @param yyscanner The scanner object.
* @return the newly allocated buffer state object.
*/
@@ -2464,7 +2783,8 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len
{
YY_BUFFER_STATE b;
char *buf;
- yy_size_t n, i;
+ yy_size_t n;
+ yy_size_t i;
/* Get memory for full buffer, including space for trailing EOB's. */
n = _yybytes_len + 2;
@@ -2610,7 +2930,7 @@ void yyset_lineno (int line_number , yyscan_t yyscanner)
/* lineno is only valid if an input buffer exists. */
if (! YY_CURRENT_BUFFER )
- yy_fatal_error( "yyset_lineno called with no buffer" , yyscanner);
+ YY_FATAL_ERROR( "yyset_lineno called with no buffer" );
yylineno = line_number;
}
@@ -2625,7 +2945,7 @@ void yyset_column (int column_no , yyscan_t yyscanner)
/* column is only valid if an input buffer exists. */
if (! YY_CURRENT_BUFFER )
- yy_fatal_error( "yyset_column called with no buffer" , yyscanner);
+ YY_FATAL_ERROR( "yyset_column called with no buffer" );
yycolumn = column_no;
}
@@ -2881,11 +3201,12 @@ int check_type(yyscan_t yyscanner) {
struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
int token = IDENTIFIER;
- TSymbol* symbol = yyextra->symbolTable.find(yytext);
+ TSymbol* symbol = yyextra->symbolTable.find(yytext, yyextra->shaderVersion);
if (symbol && symbol->isVariable()) {
TVariable* variable = static_cast<TVariable*>(symbol);
- if (variable->isUserType())
+ if (variable->isUserType()) {
token = TYPE_NAME;
+ }
}
yylval->lex.symbol = symbol;
return token;
@@ -2899,6 +3220,80 @@ int reserved_word(yyscan_t yyscanner) {
return 0;
}
+int ES2_reserved_ES3_keyword(TParseContext *context, int token)
+{
+ yyscan_t yyscanner = (yyscan_t) context->scanner;
+
+ if (context->shaderVersion < 300)
+ {
+ return reserved_word(yyscanner);
+ }
+
+ return token;
+}
+
+int ES2_keyword_ES3_reserved(TParseContext *context, int token)
+{
+ yyscan_t yyscanner = (yyscan_t) context->scanner;
+
+ if (context->shaderVersion >= 300)
+ {
+ return reserved_word(yyscanner);
+ }
+
+ return token;
+}
+
+int ES2_ident_ES3_keyword(TParseContext *context, int token)
+{
+ struct yyguts_t* yyg = (struct yyguts_t*) context->scanner;
+ yyscan_t yyscanner = (yyscan_t) context->scanner;
+
+ // not a reserved word in GLSL ES 1.00, so could be used as an identifier/type name
+ if (context->shaderVersion < 300)
+ {
+ yylval->lex.string = NewPoolTString(yytext);
+ return check_type(yyscanner);
+ }
+
+ return token;
+}
+
+int uint_constant(TParseContext *context)
+{
+ struct yyguts_t* yyg = (struct yyguts_t*) context->scanner;
+ yyscan_t yyscanner = (yyscan_t) context->scanner;
+
+ if (context->shaderVersion < 300)
+ {
+ context->error(*yylloc, "Unsigned integers are unsupported prior to GLSL ES 3.00", yytext, "");
+ context->recover();
+ return 0;
+ }
+
+ if (!atoi_clamp(yytext, &(yylval->lex.i)))
+ yyextra->warning(*yylloc, "Integer overflow", yytext, "");
+
+ return UINTCONSTANT;
+}
+
+int floatsuffix_check(TParseContext* context)
+{
+ struct yyguts_t* yyg = (struct yyguts_t*) context->scanner;
+
+ if (context->shaderVersion < 300)
+ {
+ context->error(*yylloc, "Floating-point suffix unsupported prior to GLSL ES 3.00", yytext);
+ context->recover();
+ return 0;
+ }
+
+ if (!atof_clamp(yytext, &(yylval->lex.f)))
+ yyextra->warning(*yylloc, "Float overflow", yytext, "");
+
+ return(FLOATCONSTANT);
+}
+
void yyerror(YYLTYPE* lloc, TParseContext* context, const char* reason) {
context->error(*lloc, reason, yyget_text(context->scanner));
context->recover();
@@ -2948,7 +3343,6 @@ int glslang_scan(size_t count, const char* const string[], const int length[],
// Initialize preprocessor.
if (!context->preprocessor.init(count, string, length))
return 1;
- context->preprocessor.setMaxTokenLength(SH_MAX_TOKEN_LENGTH);
// Define extension macros.
const TExtensionBehavior& extBehavior = context->extensionBehavior();
@@ -2959,6 +3353,8 @@ int glslang_scan(size_t count, const char* const string[], const int length[],
if (context->fragmentPrecisionHigh)
context->preprocessor.predefineMacro("GL_FRAGMENT_PRECISION_HIGH", 1);
+ context->preprocessor.setMaxTokenSize(GetGlobalMaxTokenSize(context->shaderSpec));
+
return 0;
}
diff --git a/chromium/third_party/angle/src/compiler/glslang_tab.cpp b/chromium/third_party/angle/src/compiler/translator/glslang_tab.cpp
index 1f2e89039ba..63ec8c7534f 100644
--- a/chromium/third_party/angle/src/compiler/glslang_tab.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/glslang_tab.cpp
@@ -1,8 +1,8 @@
-/* A Bison parser, made by GNU Bison 2.7. */
+/* A Bison parser, made by GNU Bison 2.7.1. */
/* Bison implementation for Yacc-like parsers in C
- Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -44,7 +44,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "2.7"
+#define YYBISON_VERSION "2.7.1"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -65,7 +65,7 @@
//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -84,8 +84,8 @@
#pragma warning(disable: 4701)
#endif
-#include "compiler/SymbolTable.h"
-#include "compiler/ParseContext.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/ParseContext.h"
#include "GLSLANG/ShaderLang.h"
#define YYENABLE_NLS 0
@@ -94,6 +94,7 @@
+
# ifndef YY_NULL
# if defined __cplusplus && 201103L <= __cplusplus
# define YY_NULL nullptr
@@ -126,7 +127,6 @@ extern int yydebug;
#define YYLTYPE TSourceLoc
#define YYLTYPE_IS_DECLARED 1
-#define SH_MAX_TOKEN_LENGTH 256 // WebGL spec.
@@ -147,88 +147,121 @@ extern int yydebug;
BOOL_TYPE = 265,
FLOAT_TYPE = 266,
INT_TYPE = 267,
- BREAK = 268,
- CONTINUE = 269,
- DO = 270,
- ELSE = 271,
- FOR = 272,
- IF = 273,
- DISCARD = 274,
- RETURN = 275,
- BVEC2 = 276,
- BVEC3 = 277,
- BVEC4 = 278,
- IVEC2 = 279,
- IVEC3 = 280,
- IVEC4 = 281,
- VEC2 = 282,
- VEC3 = 283,
- VEC4 = 284,
- MATRIX2 = 285,
- MATRIX3 = 286,
- MATRIX4 = 287,
- IN_QUAL = 288,
- OUT_QUAL = 289,
- INOUT_QUAL = 290,
- UNIFORM = 291,
- VARYING = 292,
- STRUCT = 293,
- VOID_TYPE = 294,
- WHILE = 295,
- SAMPLER2D = 296,
- SAMPLERCUBE = 297,
- SAMPLER_EXTERNAL_OES = 298,
- SAMPLER2DRECT = 299,
- IDENTIFIER = 300,
- TYPE_NAME = 301,
- FLOATCONSTANT = 302,
- INTCONSTANT = 303,
- BOOLCONSTANT = 304,
- LEFT_OP = 305,
- RIGHT_OP = 306,
- INC_OP = 307,
- DEC_OP = 308,
- LE_OP = 309,
- GE_OP = 310,
- EQ_OP = 311,
- NE_OP = 312,
- AND_OP = 313,
- OR_OP = 314,
- XOR_OP = 315,
- MUL_ASSIGN = 316,
- DIV_ASSIGN = 317,
- ADD_ASSIGN = 318,
- MOD_ASSIGN = 319,
- LEFT_ASSIGN = 320,
- RIGHT_ASSIGN = 321,
- AND_ASSIGN = 322,
- XOR_ASSIGN = 323,
- OR_ASSIGN = 324,
- SUB_ASSIGN = 325,
- LEFT_PAREN = 326,
- RIGHT_PAREN = 327,
- LEFT_BRACKET = 328,
- RIGHT_BRACKET = 329,
- LEFT_BRACE = 330,
- RIGHT_BRACE = 331,
- DOT = 332,
- COMMA = 333,
- COLON = 334,
- EQUAL = 335,
- SEMICOLON = 336,
- BANG = 337,
- DASH = 338,
- TILDE = 339,
- PLUS = 340,
- STAR = 341,
- SLASH = 342,
- PERCENT = 343,
- LEFT_ANGLE = 344,
- RIGHT_ANGLE = 345,
- VERTICAL_BAR = 346,
- CARET = 347,
- AMPERSAND = 348,
- QUESTION = 349
+ UINT_TYPE = 268,
+ BREAK = 269,
+ CONTINUE = 270,
+ DO = 271,
+ ELSE = 272,
+ FOR = 273,
+ IF = 274,
+ DISCARD = 275,
+ RETURN = 276,
+ SWITCH = 277,
+ CASE = 278,
+ DEFAULT = 279,
+ BVEC2 = 280,
+ BVEC3 = 281,
+ BVEC4 = 282,
+ IVEC2 = 283,
+ IVEC3 = 284,
+ IVEC4 = 285,
+ VEC2 = 286,
+ VEC3 = 287,
+ VEC4 = 288,
+ UVEC2 = 289,
+ UVEC3 = 290,
+ UVEC4 = 291,
+ MATRIX2 = 292,
+ MATRIX3 = 293,
+ MATRIX4 = 294,
+ IN_QUAL = 295,
+ OUT_QUAL = 296,
+ INOUT_QUAL = 297,
+ UNIFORM = 298,
+ VARYING = 299,
+ MATRIX2x3 = 300,
+ MATRIX3x2 = 301,
+ MATRIX2x4 = 302,
+ MATRIX4x2 = 303,
+ MATRIX3x4 = 304,
+ MATRIX4x3 = 305,
+ CENTROID = 306,
+ FLAT = 307,
+ SMOOTH = 308,
+ STRUCT = 309,
+ VOID_TYPE = 310,
+ WHILE = 311,
+ SAMPLER2D = 312,
+ SAMPLERCUBE = 313,
+ SAMPLER_EXTERNAL_OES = 314,
+ SAMPLER2DRECT = 315,
+ SAMPLER2DARRAY = 316,
+ ISAMPLER2D = 317,
+ ISAMPLER3D = 318,
+ ISAMPLERCUBE = 319,
+ ISAMPLER2DARRAY = 320,
+ USAMPLER2D = 321,
+ USAMPLER3D = 322,
+ USAMPLERCUBE = 323,
+ USAMPLER2DARRAY = 324,
+ SAMPLER3D = 325,
+ SAMPLER3DRECT = 326,
+ SAMPLER2DSHADOW = 327,
+ SAMPLERCUBESHADOW = 328,
+ SAMPLER2DARRAYSHADOW = 329,
+ LAYOUT = 330,
+ IDENTIFIER = 331,
+ TYPE_NAME = 332,
+ FLOATCONSTANT = 333,
+ INTCONSTANT = 334,
+ UINTCONSTANT = 335,
+ BOOLCONSTANT = 336,
+ FIELD_SELECTION = 337,
+ LEFT_OP = 338,
+ RIGHT_OP = 339,
+ INC_OP = 340,
+ DEC_OP = 341,
+ LE_OP = 342,
+ GE_OP = 343,
+ EQ_OP = 344,
+ NE_OP = 345,
+ AND_OP = 346,
+ OR_OP = 347,
+ XOR_OP = 348,
+ MUL_ASSIGN = 349,
+ DIV_ASSIGN = 350,
+ ADD_ASSIGN = 351,
+ MOD_ASSIGN = 352,
+ LEFT_ASSIGN = 353,
+ RIGHT_ASSIGN = 354,
+ AND_ASSIGN = 355,
+ XOR_ASSIGN = 356,
+ OR_ASSIGN = 357,
+ SUB_ASSIGN = 358,
+ LEFT_PAREN = 359,
+ RIGHT_PAREN = 360,
+ LEFT_BRACKET = 361,
+ RIGHT_BRACKET = 362,
+ LEFT_BRACE = 363,
+ RIGHT_BRACE = 364,
+ DOT = 365,
+ COMMA = 366,
+ COLON = 367,
+ EQUAL = 368,
+ SEMICOLON = 369,
+ BANG = 370,
+ DASH = 371,
+ TILDE = 372,
+ PLUS = 373,
+ STAR = 374,
+ SLASH = 375,
+ PERCENT = 376,
+ LEFT_ANGLE = 377,
+ RIGHT_ANGLE = 378,
+ VERTICAL_BAR = 379,
+ CARET = 380,
+ AMPERSAND = 381,
+ QUESTION = 382
};
#endif
@@ -243,6 +276,7 @@ typedef union YYSTYPE
TString *string;
float f;
int i;
+ unsigned int u;
bool b;
};
TSymbol* symbol;
@@ -258,6 +292,7 @@ typedef union YYSTYPE
union {
TPublicType type;
TPrecision precision;
+ TLayoutQualifier layoutQualifier;
TQualifier qualifier;
TFunction* function;
TParameter param;
@@ -340,6 +375,20 @@ extern void yyerror(YYLTYPE* yylloc, TParseContext* context, const char* reason)
} \
}
+#define ES2_ONLY(S, L) { \
+ if (context->shaderVersion != 100) { \
+ context->error(L, " supported in GLSL ES 1.00 only ", S); \
+ context->recover(); \
+ } \
+}
+
+#define ES3_ONLY(TOKEN, LINE, REASON) { \
+ if (context->shaderVersion != 300) { \
+ context->error(LINE, REASON " supported in GLSL ES 3.00 only ", TOKEN); \
+ context->recover(); \
+ } \
+}
+
#ifdef short
@@ -401,6 +450,14 @@ typedef short int yytype_int16;
# endif
#endif
+#ifndef __attribute__
+/* This feature is available in gcc versions 2.5 and later. */
+# if (! defined __GNUC__ || __GNUC__ < 2 \
+ || (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
+# define __attribute__(Spec) /* empty */
+# endif
+#endif
+
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
# define YYUSE(E) ((void) (E))
@@ -408,6 +465,7 @@ typedef short int yytype_int16;
# define YYUSE(E) /* empty */
#endif
+
/* Identity function, used to suppress warnings about constant conditions. */
#ifndef lint
# define YYID(N) (N)
@@ -560,22 +618,22 @@ union yyalloc
#endif /* !YYCOPY_NEEDED */
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 74
+#define YYFINAL 114
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 1490
+#define YYLAST 2375
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 95
+#define YYNTOKENS 128
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 84
+#define YYNNTS 91
/* YYNRULES -- Number of rules. */
-#define YYNRULES 202
+#define YYNRULES 250
/* YYNRULES -- Number of states. */
-#define YYNSTATES 307
+#define YYNSTATES 373
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 349
+#define YYMAXUTOK 382
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -617,7 +675,11 @@ static const yytype_uint8 yytranslate[] =
55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
- 85, 86, 87, 88, 89, 90, 91, 92, 93, 94
+ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
+ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
+ 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
+ 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
+ 125, 126, 127
};
#if YYDEBUG
@@ -626,115 +688,138 @@ static const yytype_uint8 yytranslate[] =
static const yytype_uint16 yyprhs[] =
{
0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
- 21, 23, 28, 30, 34, 37, 40, 42, 44, 46,
- 50, 53, 56, 59, 61, 64, 68, 71, 73, 75,
- 77, 80, 83, 86, 88, 90, 92, 94, 98, 102,
- 104, 108, 112, 114, 116, 120, 124, 128, 132, 134,
- 138, 142, 144, 146, 148, 150, 154, 156, 160, 162,
- 166, 168, 174, 176, 180, 182, 184, 186, 188, 190,
- 192, 196, 198, 201, 204, 209, 212, 214, 216, 219,
- 223, 227, 230, 236, 240, 243, 247, 250, 251, 253,
- 255, 257, 259, 261, 265, 271, 278, 284, 286, 289,
- 294, 300, 305, 308, 310, 313, 315, 317, 319, 322,
- 324, 326, 329, 331, 333, 335, 337, 342, 344, 346,
- 348, 350, 352, 354, 356, 358, 360, 362, 364, 366,
- 368, 370, 372, 374, 376, 378, 380, 382, 384, 386,
- 387, 394, 395, 401, 403, 406, 410, 412, 416, 418,
- 423, 425, 427, 429, 431, 433, 435, 437, 439, 441,
- 444, 445, 446, 452, 454, 456, 457, 460, 461, 464,
- 467, 471, 473, 476, 478, 481, 487, 491, 493, 495,
- 500, 501, 508, 509, 518, 519, 527, 529, 531, 533,
- 534, 537, 541, 544, 547, 550, 554, 557, 559, 562,
- 564, 566, 567
+ 19, 23, 25, 30, 32, 36, 39, 42, 44, 46,
+ 48, 52, 55, 58, 61, 63, 66, 70, 73, 75,
+ 77, 79, 82, 85, 88, 90, 92, 94, 96, 100,
+ 104, 106, 110, 114, 116, 118, 122, 126, 130, 134,
+ 136, 140, 144, 146, 148, 150, 152, 156, 158, 162,
+ 164, 168, 170, 176, 178, 182, 184, 186, 188, 190,
+ 192, 194, 198, 200, 203, 206, 209, 214, 220, 227,
+ 237, 240, 243, 245, 247, 250, 254, 258, 261, 267,
+ 271, 274, 278, 281, 282, 284, 286, 288, 290, 292,
+ 296, 302, 309, 315, 317, 320, 325, 331, 336, 339,
+ 341, 344, 346, 348, 350, 352, 354, 357, 359, 362,
+ 364, 366, 369, 371, 373, 375, 378, 381, 383, 385,
+ 388, 390, 392, 394, 399, 401, 405, 407, 411, 415,
+ 417, 422, 424, 426, 428, 430, 432, 434, 436, 438,
+ 440, 442, 444, 446, 448, 450, 452, 454, 456, 458,
+ 460, 462, 464, 466, 468, 470, 472, 474, 476, 478,
+ 480, 482, 484, 486, 488, 490, 492, 494, 496, 498,
+ 500, 502, 504, 506, 508, 510, 512, 513, 520, 521,
+ 527, 529, 532, 536, 541, 543, 547, 549, 554, 556,
+ 558, 560, 562, 564, 566, 568, 570, 572, 575, 576,
+ 577, 583, 585, 587, 588, 591, 592, 595, 598, 602,
+ 604, 607, 609, 612, 618, 622, 624, 626, 631, 632,
+ 639, 640, 649, 650, 658, 660, 662, 664, 665, 668,
+ 672, 675, 678, 681, 685, 688, 690, 693, 695, 697,
+ 698
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int16 yyrhs[] =
{
- 175, 0, -1, 45, -1, 46, -1, 45, -1, 97,
- -1, 48, -1, 47, -1, 49, -1, 71, 124, 72,
- -1, 98, -1, 99, 73, 100, 74, -1, 101, -1,
- 99, 77, 96, -1, 99, 52, -1, 99, 53, -1,
- 124, -1, 102, -1, 103, -1, 99, 77, 103, -1,
- 105, 72, -1, 104, 72, -1, 106, 39, -1, 106,
- -1, 106, 122, -1, 105, 78, 122, -1, 107, 71,
- -1, 142, -1, 45, -1, 99, -1, 52, 108, -1,
- 53, 108, -1, 109, 108, -1, 85, -1, 83, -1,
- 82, -1, 108, -1, 110, 86, 108, -1, 110, 87,
- 108, -1, 110, -1, 111, 85, 110, -1, 111, 83,
- 110, -1, 111, -1, 112, -1, 113, 89, 112, -1,
- 113, 90, 112, -1, 113, 54, 112, -1, 113, 55,
- 112, -1, 113, -1, 114, 56, 113, -1, 114, 57,
- 113, -1, 114, -1, 115, -1, 116, -1, 117, -1,
- 118, 58, 117, -1, 118, -1, 119, 60, 118, -1,
- 119, -1, 120, 59, 119, -1, 120, -1, 120, 94,
- 124, 79, 122, -1, 121, -1, 108, 123, 122, -1,
- 80, -1, 61, -1, 62, -1, 63, -1, 70, -1,
- 122, -1, 124, 78, 122, -1, 121, -1, 127, 81,
- -1, 135, 81, -1, 7, 140, 141, 81, -1, 128,
- 72, -1, 130, -1, 129, -1, 130, 132, -1, 129,
- 78, 132, -1, 137, 45, 71, -1, 139, 96, -1,
- 139, 96, 73, 125, 74, -1, 138, 133, 131, -1,
- 133, 131, -1, 138, 133, 134, -1, 133, 134, -1,
- -1, 33, -1, 34, -1, 35, -1, 139, -1, 136,
- -1, 135, 78, 96, -1, 135, 78, 96, 73, 74,
- -1, 135, 78, 96, 73, 125, 74, -1, 135, 78,
- 96, 80, 150, -1, 137, -1, 137, 96, -1, 137,
- 96, 73, 74, -1, 137, 96, 73, 125, 74, -1,
- 137, 96, 80, 150, -1, 3, 45, -1, 139, -1,
- 138, 139, -1, 9, -1, 8, -1, 37, -1, 3,
- 37, -1, 36, -1, 141, -1, 140, 141, -1, 4,
- -1, 5, -1, 6, -1, 142, -1, 142, 73, 125,
- 74, -1, 39, -1, 11, -1, 12, -1, 10, -1,
- 27, -1, 28, -1, 29, -1, 21, -1, 22, -1,
- 23, -1, 24, -1, 25, -1, 26, -1, 30, -1,
- 31, -1, 32, -1, 41, -1, 42, -1, 43, -1,
- 44, -1, 143, -1, 46, -1, -1, 38, 96, 75,
- 144, 146, 76, -1, -1, 38, 75, 145, 146, 76,
- -1, 147, -1, 146, 147, -1, 139, 148, 81, -1,
- 149, -1, 148, 78, 149, -1, 96, -1, 96, 73,
- 125, 74, -1, 122, -1, 126, -1, 154, -1, 153,
- -1, 151, -1, 163, -1, 164, -1, 167, -1, 174,
- -1, 75, 76, -1, -1, -1, 75, 155, 162, 156,
- 76, -1, 161, -1, 153, -1, -1, 159, 161, -1,
- -1, 160, 153, -1, 75, 76, -1, 75, 162, 76,
- -1, 152, -1, 162, 152, -1, 81, -1, 124, 81,
- -1, 18, 71, 124, 72, 165, -1, 158, 16, 158,
- -1, 158, -1, 124, -1, 137, 96, 80, 150, -1,
- -1, 40, 71, 168, 166, 72, 157, -1, -1, 15,
- 169, 158, 40, 71, 124, 72, 81, -1, -1, 17,
- 71, 170, 171, 173, 72, 157, -1, 163, -1, 151,
- -1, 166, -1, -1, 172, 81, -1, 172, 81, 124,
- -1, 14, 81, -1, 13, 81, -1, 20, 81, -1,
- 20, 124, 81, -1, 19, 81, -1, 176, -1, 175,
- 176, -1, 177, -1, 126, -1, -1, 127, 178, 161,
- -1
+ 215, 0, -1, 76, -1, 77, -1, 76, -1, 130,
+ -1, 79, -1, 80, -1, 78, -1, 81, -1, 104,
+ 157, 105, -1, 131, -1, 132, 106, 133, 107, -1,
+ 134, -1, 132, 110, 129, -1, 132, 85, -1, 132,
+ 86, -1, 157, -1, 135, -1, 136, -1, 132, 110,
+ 136, -1, 138, 105, -1, 137, 105, -1, 139, 55,
+ -1, 139, -1, 139, 155, -1, 138, 111, 155, -1,
+ 140, 104, -1, 182, -1, 76, -1, 132, -1, 85,
+ 141, -1, 86, 141, -1, 142, 141, -1, 118, -1,
+ 116, -1, 115, -1, 141, -1, 143, 119, 141, -1,
+ 143, 120, 141, -1, 143, -1, 144, 118, 143, -1,
+ 144, 116, 143, -1, 144, -1, 145, -1, 146, 122,
+ 145, -1, 146, 123, 145, -1, 146, 87, 145, -1,
+ 146, 88, 145, -1, 146, -1, 147, 89, 146, -1,
+ 147, 90, 146, -1, 147, -1, 148, -1, 149, -1,
+ 150, -1, 151, 91, 150, -1, 151, -1, 152, 93,
+ 151, -1, 152, -1, 153, 92, 152, -1, 153, -1,
+ 153, 127, 157, 112, 155, -1, 154, -1, 141, 156,
+ 155, -1, 113, -1, 94, -1, 95, -1, 96, -1,
+ 103, -1, 155, -1, 157, 111, 155, -1, 154, -1,
+ 76, 108, -1, 161, 114, -1, 169, 114, -1, 7,
+ 177, 181, 114, -1, 174, 159, 186, 109, 114, -1,
+ 174, 159, 186, 109, 76, 114, -1, 174, 159, 186,
+ 109, 76, 106, 158, 107, 114, -1, 174, 114, -1,
+ 162, 105, -1, 164, -1, 163, -1, 164, 166, -1,
+ 163, 111, 166, -1, 171, 76, 104, -1, 176, 129,
+ -1, 176, 129, 106, 158, 107, -1, 173, 167, 165,
+ -1, 167, 165, -1, 173, 167, 168, -1, 167, 168,
+ -1, -1, 40, -1, 41, -1, 42, -1, 176, -1,
+ 170, -1, 169, 111, 129, -1, 169, 111, 129, 106,
+ 107, -1, 169, 111, 129, 106, 158, 107, -1, 169,
+ 111, 129, 113, 190, -1, 171, -1, 171, 129, -1,
+ 171, 129, 106, 107, -1, 171, 129, 106, 158, 107,
+ -1, 171, 129, 113, 190, -1, 3, 76, -1, 176,
+ -1, 174, 176, -1, 53, -1, 52, -1, 9, -1,
+ 8, -1, 44, -1, 3, 44, -1, 175, -1, 172,
+ 175, -1, 172, -1, 178, -1, 178, 175, -1, 9,
+ -1, 40, -1, 41, -1, 51, 40, -1, 51, 41,
+ -1, 43, -1, 181, -1, 177, 181, -1, 4, -1,
+ 5, -1, 6, -1, 75, 104, 179, 105, -1, 180,
+ -1, 179, 111, 180, -1, 76, -1, 76, 113, 79,
+ -1, 76, 113, 80, -1, 182, -1, 182, 106, 158,
+ 107, -1, 55, -1, 11, -1, 12, -1, 13, -1,
+ 10, -1, 31, -1, 32, -1, 33, -1, 25, -1,
+ 26, -1, 27, -1, 28, -1, 29, -1, 30, -1,
+ 34, -1, 35, -1, 36, -1, 37, -1, 38, -1,
+ 39, -1, 45, -1, 46, -1, 47, -1, 48, -1,
+ 49, -1, 50, -1, 57, -1, 70, -1, 58, -1,
+ 61, -1, 62, -1, 63, -1, 64, -1, 65, -1,
+ 66, -1, 67, -1, 68, -1, 69, -1, 72, -1,
+ 73, -1, 74, -1, 59, -1, 60, -1, 183, -1,
+ 77, -1, -1, 54, 129, 108, 184, 186, 109, -1,
+ -1, 54, 108, 185, 186, 109, -1, 187, -1, 186,
+ 187, -1, 176, 188, 114, -1, 174, 176, 188, 114,
+ -1, 189, -1, 188, 111, 189, -1, 129, -1, 129,
+ 106, 158, 107, -1, 155, -1, 160, -1, 194, -1,
+ 193, -1, 191, -1, 203, -1, 204, -1, 207, -1,
+ 214, -1, 108, 109, -1, -1, -1, 108, 195, 202,
+ 196, 109, -1, 201, -1, 193, -1, -1, 199, 201,
+ -1, -1, 200, 193, -1, 108, 109, -1, 108, 202,
+ 109, -1, 192, -1, 202, 192, -1, 114, -1, 157,
+ 114, -1, 19, 104, 157, 105, 205, -1, 198, 17,
+ 198, -1, 198, -1, 157, -1, 171, 129, 113, 190,
+ -1, -1, 56, 104, 208, 206, 105, 197, -1, -1,
+ 16, 209, 198, 56, 104, 157, 105, 114, -1, -1,
+ 18, 104, 210, 211, 213, 105, 197, -1, 203, -1,
+ 191, -1, 206, -1, -1, 212, 114, -1, 212, 114,
+ 157, -1, 15, 114, -1, 14, 114, -1, 21, 114,
+ -1, 21, 157, 114, -1, 20, 114, -1, 216, -1,
+ 215, 216, -1, 217, -1, 160, -1, -1, 161, 218,
+ 201, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 180, 180, 181, 184, 227, 230, 243, 248, 253,
- 259, 262, 265, 268, 363, 373, 386, 394, 494, 497,
- 505, 508, 514, 518, 525, 531, 540, 548, 603, 613,
- 616, 626, 636, 657, 658, 659, 664, 665, 673, 684,
- 685, 693, 704, 708, 709, 719, 729, 739, 752, 753,
- 763, 776, 780, 784, 788, 789, 802, 803, 816, 817,
- 830, 831, 848, 849, 862, 863, 864, 865, 866, 870,
- 873, 884, 892, 919, 924, 938, 993, 996, 1003, 1011,
- 1032, 1053, 1063, 1091, 1096, 1106, 1111, 1121, 1124, 1127,
- 1130, 1136, 1143, 1146, 1168, 1186, 1210, 1233, 1237, 1255,
- 1263, 1295, 1315, 1336, 1345, 1368, 1371, 1377, 1385, 1393,
- 1401, 1411, 1418, 1421, 1424, 1430, 1433, 1448, 1452, 1456,
- 1460, 1464, 1469, 1474, 1479, 1484, 1489, 1494, 1499, 1504,
- 1509, 1514, 1519, 1524, 1528, 1532, 1540, 1548, 1552, 1565,
- 1565, 1579, 1579, 1588, 1591, 1607, 1640, 1644, 1650, 1657,
- 1672, 1676, 1680, 1681, 1687, 1688, 1689, 1690, 1691, 1695,
- 1696, 1696, 1696, 1706, 1707, 1711, 1711, 1712, 1712, 1717,
- 1720, 1730, 1733, 1739, 1740, 1744, 1752, 1756, 1766, 1771,
- 1788, 1788, 1793, 1793, 1800, 1800, 1808, 1811, 1817, 1820,
- 1826, 1830, 1837, 1844, 1851, 1858, 1869, 1878, 1882, 1889,
- 1892, 1898, 1898
+ 0, 205, 205, 206, 209, 264, 267, 272, 277, 282,
+ 287, 293, 296, 299, 302, 305, 315, 328, 336, 436,
+ 439, 447, 450, 456, 460, 467, 473, 482, 490, 493,
+ 503, 506, 516, 526, 547, 548, 549, 554, 555, 563,
+ 574, 575, 583, 594, 598, 599, 609, 619, 629, 642,
+ 643, 653, 666, 670, 674, 678, 679, 692, 693, 706,
+ 707, 720, 721, 738, 739, 752, 753, 754, 755, 756,
+ 760, 763, 774, 782, 790, 817, 822, 833, 837, 841,
+ 845, 852, 907, 910, 917, 925, 946, 967, 977, 1005,
+ 1010, 1020, 1025, 1035, 1038, 1041, 1044, 1050, 1057, 1060,
+ 1064, 1068, 1072, 1079, 1083, 1087, 1094, 1098, 1102, 1123,
+ 1132, 1138, 1141, 1147, 1153, 1160, 1169, 1178, 1186, 1189,
+ 1196, 1200, 1207, 1210, 1214, 1218, 1227, 1236, 1244, 1254,
+ 1266, 1269, 1272, 1278, 1285, 1288, 1294, 1297, 1300, 1306,
+ 1309, 1324, 1328, 1332, 1336, 1340, 1344, 1349, 1354, 1359,
+ 1364, 1369, 1374, 1379, 1384, 1389, 1394, 1399, 1404, 1409,
+ 1414, 1419, 1424, 1429, 1434, 1439, 1444, 1449, 1453, 1457,
+ 1461, 1465, 1469, 1473, 1477, 1481, 1485, 1489, 1493, 1497,
+ 1501, 1505, 1509, 1517, 1525, 1529, 1542, 1542, 1545, 1545,
+ 1551, 1554, 1570, 1573, 1582, 1586, 1592, 1599, 1614, 1618,
+ 1622, 1623, 1629, 1630, 1631, 1632, 1633, 1637, 1638, 1638,
+ 1638, 1648, 1649, 1653, 1653, 1654, 1654, 1659, 1662, 1672,
+ 1675, 1681, 1682, 1686, 1694, 1698, 1708, 1713, 1730, 1730,
+ 1735, 1735, 1742, 1742, 1750, 1753, 1759, 1762, 1768, 1772,
+ 1779, 1786, 1793, 1800, 1811, 1820, 1824, 1831, 1834, 1840,
+ 1840
};
#endif
@@ -745,13 +830,20 @@ static const char *const yytname[] =
{
"$end", "error", "$undefined", "INVARIANT", "HIGH_PRECISION",
"MEDIUM_PRECISION", "LOW_PRECISION", "PRECISION", "ATTRIBUTE",
- "CONST_QUAL", "BOOL_TYPE", "FLOAT_TYPE", "INT_TYPE", "BREAK", "CONTINUE",
- "DO", "ELSE", "FOR", "IF", "DISCARD", "RETURN", "BVEC2", "BVEC3",
- "BVEC4", "IVEC2", "IVEC3", "IVEC4", "VEC2", "VEC3", "VEC4", "MATRIX2",
+ "CONST_QUAL", "BOOL_TYPE", "FLOAT_TYPE", "INT_TYPE", "UINT_TYPE",
+ "BREAK", "CONTINUE", "DO", "ELSE", "FOR", "IF", "DISCARD", "RETURN",
+ "SWITCH", "CASE", "DEFAULT", "BVEC2", "BVEC3", "BVEC4", "IVEC2", "IVEC3",
+ "IVEC4", "VEC2", "VEC3", "VEC4", "UVEC2", "UVEC3", "UVEC4", "MATRIX2",
"MATRIX3", "MATRIX4", "IN_QUAL", "OUT_QUAL", "INOUT_QUAL", "UNIFORM",
- "VARYING", "STRUCT", "VOID_TYPE", "WHILE", "SAMPLER2D", "SAMPLERCUBE",
- "SAMPLER_EXTERNAL_OES", "SAMPLER2DRECT", "IDENTIFIER", "TYPE_NAME",
- "FLOATCONSTANT", "INTCONSTANT", "BOOLCONSTANT", "LEFT_OP", "RIGHT_OP",
+ "VARYING", "MATRIX2x3", "MATRIX3x2", "MATRIX2x4", "MATRIX4x2",
+ "MATRIX3x4", "MATRIX4x3", "CENTROID", "FLAT", "SMOOTH", "STRUCT",
+ "VOID_TYPE", "WHILE", "SAMPLER2D", "SAMPLERCUBE", "SAMPLER_EXTERNAL_OES",
+ "SAMPLER2DRECT", "SAMPLER2DARRAY", "ISAMPLER2D", "ISAMPLER3D",
+ "ISAMPLERCUBE", "ISAMPLER2DARRAY", "USAMPLER2D", "USAMPLER3D",
+ "USAMPLERCUBE", "USAMPLER2DARRAY", "SAMPLER3D", "SAMPLER3DRECT",
+ "SAMPLER2DSHADOW", "SAMPLERCUBESHADOW", "SAMPLER2DARRAYSHADOW", "LAYOUT",
+ "IDENTIFIER", "TYPE_NAME", "FLOATCONSTANT", "INTCONSTANT",
+ "UINTCONSTANT", "BOOLCONSTANT", "FIELD_SELECTION", "LEFT_OP", "RIGHT_OP",
"INC_OP", "DEC_OP", "LE_OP", "GE_OP", "EQ_OP", "NE_OP", "AND_OP",
"OR_OP", "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN", "ADD_ASSIGN",
"MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN", "XOR_ASSIGN",
@@ -771,12 +863,15 @@ static const char *const yytname[] =
"logical_and_expression", "logical_xor_expression",
"logical_or_expression", "conditional_expression",
"assignment_expression", "assignment_operator", "expression",
- "constant_expression", "declaration", "function_prototype",
- "function_declarator", "function_header_with_parameters",
- "function_header", "parameter_declarator", "parameter_declaration",
- "parameter_qualifier", "parameter_type_specifier",
- "init_declarator_list", "single_declaration", "fully_specified_type",
- "type_qualifier", "type_specifier", "precision_qualifier",
+ "constant_expression", "enter_struct", "declaration",
+ "function_prototype", "function_declarator",
+ "function_header_with_parameters", "function_header",
+ "parameter_declarator", "parameter_declaration", "parameter_qualifier",
+ "parameter_type_specifier", "init_declarator_list", "single_declaration",
+ "fully_specified_type", "interpolation_qualifier",
+ "parameter_type_qualifier", "type_qualifier", "storage_qualifier",
+ "type_specifier", "precision_qualifier", "layout_qualifier",
+ "layout_qualifier_id_list", "layout_qualifier_id",
"type_specifier_no_prec", "type_specifier_nonarray", "struct_specifier",
"$@1", "$@2", "struct_declaration_list", "struct_declaration",
"struct_declarator_list", "struct_declarator", "initializer",
@@ -805,60 +900,73 @@ static const yytype_uint16 yytoknum[] =
315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
- 345, 346, 347, 348, 349
+ 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
+ 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
+ 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
+ 375, 376, 377, 378, 379, 380, 381, 382
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 95, 96, 96, 97, 98, 98, 98, 98, 98,
- 99, 99, 99, 99, 99, 99, 100, 101, 102, 102,
- 103, 103, 104, 104, 105, 105, 106, 107, 107, 108,
- 108, 108, 108, 109, 109, 109, 110, 110, 110, 111,
- 111, 111, 112, 113, 113, 113, 113, 113, 114, 114,
- 114, 115, 116, 117, 118, 118, 119, 119, 120, 120,
- 121, 121, 122, 122, 123, 123, 123, 123, 123, 124,
- 124, 125, 126, 126, 126, 127, 128, 128, 129, 129,
- 130, 131, 131, 132, 132, 132, 132, 133, 133, 133,
- 133, 134, 135, 135, 135, 135, 135, 136, 136, 136,
- 136, 136, 136, 137, 137, 138, 138, 138, 138, 138,
- 139, 139, 140, 140, 140, 141, 141, 142, 142, 142,
- 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
- 142, 142, 142, 142, 142, 142, 142, 142, 142, 144,
- 143, 145, 143, 146, 146, 147, 148, 148, 149, 149,
- 150, 151, 152, 152, 153, 153, 153, 153, 153, 154,
- 155, 156, 154, 157, 157, 159, 158, 160, 158, 161,
- 161, 162, 162, 163, 163, 164, 165, 165, 166, 166,
- 168, 167, 169, 167, 170, 167, 171, 171, 172, 172,
- 173, 173, 174, 174, 174, 174, 174, 175, 175, 176,
- 176, 178, 177
+ 0, 128, 129, 129, 130, 131, 131, 131, 131, 131,
+ 131, 132, 132, 132, 132, 132, 132, 133, 134, 135,
+ 135, 136, 136, 137, 137, 138, 138, 139, 140, 140,
+ 141, 141, 141, 141, 142, 142, 142, 143, 143, 143,
+ 144, 144, 144, 145, 146, 146, 146, 146, 146, 147,
+ 147, 147, 148, 149, 150, 151, 151, 152, 152, 153,
+ 153, 154, 154, 155, 155, 156, 156, 156, 156, 156,
+ 157, 157, 158, 159, 160, 160, 160, 160, 160, 160,
+ 160, 161, 162, 162, 163, 163, 164, 165, 165, 166,
+ 166, 166, 166, 167, 167, 167, 167, 168, 169, 169,
+ 169, 169, 169, 170, 170, 170, 170, 170, 170, 171,
+ 171, 172, 172, 173, 174, 174, 174, 174, 174, 174,
+ 174, 174, 175, 175, 175, 175, 175, 175, 176, 176,
+ 177, 177, 177, 178, 179, 179, 180, 180, 180, 181,
+ 181, 182, 182, 182, 182, 182, 182, 182, 182, 182,
+ 182, 182, 182, 182, 182, 182, 182, 182, 182, 182,
+ 182, 182, 182, 182, 182, 182, 182, 182, 182, 182,
+ 182, 182, 182, 182, 182, 182, 182, 182, 182, 182,
+ 182, 182, 182, 182, 182, 182, 184, 183, 185, 183,
+ 186, 186, 187, 187, 188, 188, 189, 189, 190, 191,
+ 192, 192, 193, 193, 193, 193, 193, 194, 195, 196,
+ 194, 197, 197, 199, 198, 200, 198, 201, 201, 202,
+ 202, 203, 203, 204, 205, 205, 206, 206, 208, 207,
+ 209, 207, 210, 207, 211, 211, 212, 212, 213, 213,
+ 214, 214, 214, 214, 214, 215, 215, 216, 216, 218,
+ 217
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
- 0, 2, 1, 1, 1, 1, 1, 1, 1, 3,
- 1, 4, 1, 3, 2, 2, 1, 1, 1, 3,
- 2, 2, 2, 1, 2, 3, 2, 1, 1, 1,
- 2, 2, 2, 1, 1, 1, 1, 3, 3, 1,
- 3, 3, 1, 1, 3, 3, 3, 3, 1, 3,
- 3, 1, 1, 1, 1, 3, 1, 3, 1, 3,
- 1, 5, 1, 3, 1, 1, 1, 1, 1, 1,
- 3, 1, 2, 2, 4, 2, 1, 1, 2, 3,
- 3, 2, 5, 3, 2, 3, 2, 0, 1, 1,
- 1, 1, 1, 3, 5, 6, 5, 1, 2, 4,
- 5, 4, 2, 1, 2, 1, 1, 1, 2, 1,
- 1, 2, 1, 1, 1, 1, 4, 1, 1, 1,
+ 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
+ 3, 1, 4, 1, 3, 2, 2, 1, 1, 1,
+ 3, 2, 2, 2, 1, 2, 3, 2, 1, 1,
+ 1, 2, 2, 2, 1, 1, 1, 1, 3, 3,
+ 1, 3, 3, 1, 1, 3, 3, 3, 3, 1,
+ 3, 3, 1, 1, 1, 1, 3, 1, 3, 1,
+ 3, 1, 5, 1, 3, 1, 1, 1, 1, 1,
+ 1, 3, 1, 2, 2, 2, 4, 5, 6, 9,
+ 2, 2, 1, 1, 2, 3, 3, 2, 5, 3,
+ 2, 3, 2, 0, 1, 1, 1, 1, 1, 3,
+ 5, 6, 5, 1, 2, 4, 5, 4, 2, 1,
+ 2, 1, 1, 1, 1, 1, 2, 1, 2, 1,
+ 1, 2, 1, 1, 1, 2, 2, 1, 1, 2,
+ 1, 1, 1, 4, 1, 3, 1, 3, 3, 1,
+ 4, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 6, 0, 5, 1, 2, 3, 1, 3, 1, 4,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
- 0, 0, 5, 1, 1, 0, 2, 0, 2, 2,
- 3, 1, 2, 1, 2, 5, 3, 1, 1, 4,
- 0, 6, 0, 8, 0, 7, 1, 1, 1, 0,
- 2, 3, 2, 2, 2, 3, 2, 1, 2, 1,
- 1, 0, 3
+ 1, 1, 1, 1, 1, 1, 0, 6, 0, 5,
+ 1, 2, 3, 4, 1, 3, 1, 4, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 2, 0, 0,
+ 5, 1, 1, 0, 2, 0, 2, 2, 3, 1,
+ 2, 1, 2, 5, 3, 1, 1, 4, 0, 6,
+ 0, 8, 0, 7, 1, 1, 1, 0, 2, 3,
+ 2, 2, 2, 3, 2, 1, 2, 1, 1, 0,
+ 3
};
/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
@@ -866,421 +974,613 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 0, 112, 113, 114, 0, 106, 105, 120, 118,
- 119, 124, 125, 126, 127, 128, 129, 121, 122, 123,
- 130, 131, 132, 109, 107, 0, 117, 133, 134, 135,
- 136, 138, 200, 201, 0, 77, 87, 0, 92, 97,
- 0, 103, 0, 110, 115, 137, 0, 197, 199, 108,
- 102, 0, 2, 3, 141, 0, 72, 0, 75, 87,
- 0, 88, 89, 90, 78, 0, 87, 0, 73, 2,
- 98, 104, 111, 0, 1, 198, 0, 0, 139, 0,
- 202, 79, 84, 86, 91, 0, 93, 80, 0, 0,
- 4, 7, 6, 8, 0, 0, 0, 35, 34, 33,
- 5, 10, 29, 12, 17, 18, 0, 0, 23, 0,
- 36, 0, 39, 42, 43, 48, 51, 52, 53, 54,
- 56, 58, 60, 71, 0, 27, 74, 0, 0, 143,
- 0, 0, 0, 182, 0, 0, 0, 0, 0, 160,
- 169, 173, 36, 62, 69, 0, 151, 0, 115, 154,
- 171, 153, 152, 0, 155, 156, 157, 158, 81, 83,
- 85, 0, 0, 99, 0, 150, 101, 30, 31, 0,
- 14, 15, 0, 0, 21, 20, 0, 22, 24, 26,
- 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 116, 148, 0, 146, 142,
- 144, 0, 193, 192, 167, 184, 0, 196, 194, 0,
- 180, 159, 0, 65, 66, 67, 68, 64, 0, 0,
- 174, 170, 172, 0, 94, 0, 96, 100, 9, 0,
- 16, 2, 3, 13, 19, 25, 37, 38, 41, 40,
- 46, 47, 44, 45, 49, 50, 55, 57, 59, 0,
- 0, 0, 145, 140, 0, 0, 0, 0, 0, 195,
- 0, 161, 63, 70, 0, 95, 11, 0, 0, 147,
- 0, 166, 168, 187, 186, 189, 167, 178, 0, 0,
- 0, 82, 61, 149, 0, 188, 0, 0, 177, 175,
- 0, 0, 162, 0, 190, 0, 167, 0, 164, 181,
- 163, 0, 191, 185, 176, 179, 183
+ 0, 0, 130, 131, 132, 0, 114, 122, 145, 142,
+ 143, 144, 149, 150, 151, 152, 153, 154, 146, 147,
+ 148, 155, 156, 157, 158, 159, 160, 123, 124, 127,
+ 115, 161, 162, 163, 164, 165, 166, 0, 112, 111,
+ 0, 141, 167, 169, 182, 183, 170, 171, 172, 173,
+ 174, 175, 176, 177, 178, 168, 179, 180, 181, 0,
+ 185, 248, 249, 0, 83, 93, 0, 98, 103, 119,
+ 0, 117, 109, 0, 120, 128, 139, 184, 0, 245,
+ 247, 116, 108, 0, 125, 126, 2, 3, 188, 0,
+ 0, 74, 0, 81, 93, 113, 94, 95, 96, 84,
+ 0, 93, 0, 75, 2, 104, 118, 0, 80, 0,
+ 110, 129, 121, 0, 1, 246, 0, 0, 186, 136,
+ 0, 134, 0, 250, 85, 90, 92, 97, 0, 99,
+ 86, 0, 0, 73, 0, 0, 0, 0, 190, 4,
+ 8, 6, 7, 9, 0, 0, 0, 36, 35, 34,
+ 5, 11, 30, 13, 18, 19, 0, 0, 24, 0,
+ 37, 0, 40, 43, 44, 49, 52, 53, 54, 55,
+ 57, 59, 61, 72, 0, 28, 76, 0, 0, 0,
+ 133, 0, 0, 0, 230, 0, 0, 0, 0, 0,
+ 208, 217, 221, 37, 63, 70, 0, 199, 0, 139,
+ 202, 219, 201, 200, 0, 203, 204, 205, 206, 87,
+ 89, 91, 0, 0, 105, 0, 198, 107, 0, 196,
+ 0, 194, 0, 191, 31, 32, 0, 15, 16, 0,
+ 0, 22, 21, 0, 23, 25, 27, 33, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 140, 189, 0, 137, 138, 135, 241, 240,
+ 215, 232, 0, 244, 242, 0, 228, 207, 0, 66,
+ 67, 68, 69, 65, 0, 0, 222, 218, 220, 0,
+ 100, 0, 102, 106, 0, 0, 0, 192, 0, 77,
+ 10, 0, 17, 2, 3, 14, 20, 26, 38, 39,
+ 42, 41, 47, 48, 45, 46, 50, 51, 56, 58,
+ 60, 0, 187, 0, 0, 0, 0, 0, 243, 0,
+ 209, 64, 71, 0, 101, 193, 0, 195, 0, 78,
+ 12, 0, 0, 214, 216, 235, 234, 237, 215, 226,
+ 0, 0, 0, 0, 88, 197, 0, 62, 0, 236,
+ 0, 0, 225, 223, 0, 0, 210, 0, 0, 238,
+ 0, 215, 0, 212, 229, 211, 79, 0, 239, 233,
+ 224, 227, 231
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 196, 100, 101, 102, 229, 103, 104, 105, 106,
- 107, 108, 109, 142, 111, 112, 113, 114, 115, 116,
- 117, 118, 119, 120, 121, 122, 143, 144, 218, 145,
- 124, 146, 147, 34, 35, 36, 82, 64, 65, 83,
- 37, 38, 39, 40, 41, 42, 43, 125, 45, 130,
- 77, 128, 129, 197, 198, 166, 149, 150, 151, 152,
- 212, 280, 299, 254, 255, 256, 300, 153, 154, 155,
- 289, 279, 156, 260, 204, 257, 275, 286, 287, 157,
- 46, 47, 48, 57
+ -1, 219, 150, 151, 152, 291, 153, 154, 155, 156,
+ 157, 158, 159, 193, 161, 162, 163, 164, 165, 166,
+ 167, 168, 169, 170, 171, 172, 194, 195, 274, 196,
+ 174, 109, 197, 198, 63, 64, 65, 125, 99, 100,
+ 126, 66, 67, 68, 69, 101, 70, 71, 72, 73,
+ 74, 120, 121, 75, 175, 77, 178, 117, 137, 138,
+ 220, 221, 217, 200, 201, 202, 203, 268, 343, 364,
+ 313, 314, 315, 365, 204, 205, 206, 353, 342, 207,
+ 319, 260, 316, 337, 350, 351, 208, 78, 79, 80,
+ 92
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -261
+#define YYPACT_NINF -309
static const yytype_int16 yypact[] =
{
- 1327, -20, -261, -261, -261, 113, -261, -261, -261, -261,
- -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,
- -261, -261, -261, -261, -261, -19, -261, -261, -261, -261,
- -261, -261, -261, -61, -40, -28, 75, -7, -261, 24,
- 1370, -261, 1444, -261, -11, -261, 1283, -261, -261, -261,
- -261, 1444, -261, -261, -261, 6, -261, 54, -261, 88,
- 62, -261, -261, -261, -261, 1370, 59, 91, -261, 36,
- -50, -261, -261, 1051, -261, -261, 63, 1370, -261, 293,
- -261, -261, -261, -261, 91, 1370, -12, -261, 856, 1051,
- 77, -261, -261, -261, 1051, 1051, 1051, -261, -261, -261,
- -261, -261, -14, -261, -261, -261, 84, -44, 1116, 95,
- -261, 1051, 53, 3, -261, -36, 89, -261, -261, -261,
- 104, 107, -45, -261, 96, -261, -261, 91, 1184, -261,
- 1370, 92, 93, -261, 98, 101, 94, 921, 105, 102,
- -261, -261, 72, -261, -261, 9, -261, -61, 42, -261,
- -261, -261, -261, 376, -261, -261, -261, -261, 106, -261,
- -261, 986, 1051, -261, 103, -261, -261, -261, -261, -41,
- -261, -261, 1051, 1407, -261, -261, 1051, 110, -261, -261,
- -261, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051,
- 1051, 1051, 1051, 1051, 1051, -261, 109, 23, -261, -261,
- -261, 1227, -261, -261, 111, -261, 1051, -261, -261, 25,
- -261, -261, 459, -261, -261, -261, -261, -261, 1051, 1051,
- -261, -261, -261, 1051, -261, 114, -261, -261, -261, 115,
- 112, 77, 116, -261, -261, -261, -261, -261, 53, 53,
- -261, -261, -261, -261, -36, -36, -261, 104, 107, 76,
- 1051, 91, -261, -261, 145, 54, 625, 708, -6, -261,
- 791, 459, -261, -261, 117, -261, -261, 1051, 120, -261,
- 124, -261, -261, -261, -261, 791, 111, 112, 91, 125,
- 122, -261, -261, -261, 1051, -261, 118, 128, 180, -261,
- 126, 542, -261, -5, 1051, 542, 111, 1051, -261, -261,
- -261, 123, 112, -261, -261, -261, -261
+ 2013, -27, -309, -309, -309, 154, -309, -309, -309, -309,
+ -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,
+ -309, -309, -309, -309, -309, -309, -309, -309, -309, -309,
+ -309, -309, -309, -309, -309, -309, -309, 98, -309, -309,
+ -40, -309, -309, -309, -309, -309, -309, -309, -309, -309,
+ -309, -309, -309, -309, -309, -309, -309, -309, -309, -46,
+ -309, -309, -42, -23, 8, 5, -87, -309, 91, 14,
+ 1130, -309, -309, 2298, 14, -309, -1, -309, 1938, -309,
+ -309, -309, -309, 2298, -309, -309, -309, -309, -309, 13,
+ 47, -309, 43, -309, 39, -309, -309, -309, -309, -309,
+ 2162, 124, 94, -309, 51, -14, -309, 66, -309, 2088,
+ -309, -309, -309, 1491, -309, -309, 62, 2088, -309, 48,
+ -83, -309, 358, -309, -309, -309, -309, 94, 2162, -9,
+ -309, 1200, 1491, -309, 148, 2162, 94, 1683, -309, 89,
+ -309, -309, -309, -309, 1491, 1491, 1491, -309, -309, -309,
+ -309, -309, 10, -309, -309, -309, 92, 20, 1586, 96,
+ -309, 1491, 53, -76, -309, -62, 90, -309, -309, -309,
+ 104, 101, -61, -309, 95, -309, -309, 1768, 2088, 103,
+ -309, 47, 82, 84, -309, 97, 99, 93, 1298, 105,
+ 102, -309, -309, -10, -309, -309, -13, -309, -42, 2,
+ -309, -309, -309, -309, 474, -309, -309, -309, -309, 106,
+ -309, -309, 1393, 1491, -309, 107, -309, -309, 94, 109,
+ 4, -309, -58, -309, -309, -309, 22, -309, -309, 1491,
+ 2230, -309, -309, 1491, 112, -309, -309, -309, 1491, 1491,
+ 1491, 1491, 1491, 1491, 1491, 1491, 1491, 1491, 1491, 1491,
+ 1491, 1491, -309, -309, 1853, -309, -309, -309, -309, -309,
+ 100, -309, 1491, -309, -309, 36, -309, -309, 590, -309,
+ -309, -309, -309, -309, 1491, 1491, -309, -309, -309, 1491,
+ -309, 113, -309, -309, 42, 1491, 94, -309, -73, -309,
+ -309, 115, 108, 89, 119, -309, -309, -309, -309, -309,
+ 53, 53, -309, -309, -309, -309, -62, -62, -309, 104,
+ 101, 73, -309, 169, 43, 822, 938, 25, -309, 1035,
+ 590, -309, -309, 120, -309, -309, 121, -309, 1491, -309,
+ -309, 1491, 122, -309, -309, -309, -309, 1035, 100, 108,
+ 94, 2162, 125, 123, -309, -309, 126, -309, 1491, -309,
+ 117, 129, 212, -309, 139, 706, -309, 141, 29, 1491,
+ 706, 100, 1491, -309, -309, -309, -309, 142, 108, -309,
+ -309, -309, -309
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -261, -24, -261, -261, -261, -261, -261, -261, 34, -261,
- -261, -261, -261, 32, -261, -33, -261, -27, -26, -261,
- -261, -261, 14, 16, 18, -261, -66, -87, -261, -92,
- -85, 11, 12, -261, -261, -261, 141, 150, 161, 143,
- -261, -261, -231, 5, -30, 224, -18, 0, -261, -261,
- -261, 100, -119, -261, -17, -156, -25, -145, -243, -261,
- -261, -261, -64, -260, -261, -261, -52, 21, -22, -261,
- -261, -39, -261, -261, -261, -261, -261, -261, -261, -261,
- -261, 191, -261, -261
+ -309, -39, -309, -309, -309, -309, -309, -309, 7, -309,
+ -309, -309, -309, 1, -309, -54, -309, -101, -57, -309,
+ -309, -309, 9, -11, 3, -309, -110, -126, -309, -138,
+ -122, -309, 11, 16, -309, -309, -309, 130, 165, 159,
+ 133, -309, -309, -299, -309, -309, -102, -30, -66, 257,
+ -309, -309, 83, -6, 0, -309, -309, -309, -104, -125,
+ 45, -21, -208, -50, -194, -296, -309, -309, -309, -93,
+ -308, -309, -309, -90, 6, -47, -309, -309, -67, -309,
+ -309, -309, -309, -309, -309, -309, -309, -309, 193, -309,
+ -309
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which
number is the opposite. If YYTABLE_NINF, syntax error. */
-#define YYTABLE_NINF -166
+#define YYTABLE_NINF -214
static const yytype_int16 yytable[] =
{
- 44, 55, 165, 164, 169, 80, 226, 123, 222, 200,
- 71, 32, 33, 272, 193, 70, 288, 49, 185, 186,
- 56, 178, 123, 88, 72, 50, 52, 53, 175, 278,
- 89, 228, 58, 76, 176, 84, 304, 219, 170, 171,
- 44, 66, 44, 86, 278, 209, 44, 127, 298, 194,
- 59, 44, 298, 187, 188, 84, 54, 32, 33, 172,
- 158, 161, 73, 173, 66, 44, 276, 301, 162, 69,
- 53, 67, 219, 219, 68, 165, 225, 44, 60, 148,
- 230, 78, 200, 6, 7, 44, 183, 219, 184, 235,
- 220, 60, 61, 62, 63, 123, 6, 7, 127, 49,
- 127, 251, 249, 219, 252, 110, 259, 87, 61, 62,
- 63, 23, 24, -27, 258, 73, 222, 2, 3, 4,
- 110, 61, 62, 63, 23, 24, 167, 168, 44, 79,
- 44, 262, 263, 213, 214, 215, 52, 53, 264, 181,
- 182, 305, 216, 180, 126, 189, 190, -76, -28, 233,
- 238, 239, 217, 148, 219, 267, 174, 123, 240, 241,
- 242, 243, 191, 244, 245, 268, 179, 192, 277, 205,
- 195, 127, 206, 202, 203, 207, 210, 227, 211, 223,
- 282, -117, 250, 277, 123, 270, -165, -138, 265, 266,
- 219, 281, 293, 110, 283, 284, 296, 291, 292, 294,
- 295, 44, 302, 271, 306, 246, 297, 234, 247, 81,
- 165, 248, 148, 236, 237, 110, 110, 110, 110, 110,
- 110, 110, 110, 110, 110, 110, 159, 85, 160, 51,
- 201, 303, 273, 261, 269, 274, 285, 75, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 290, 110, 148, 148, 0, 0,
- 148, 148, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 148, 0, 0, 0, 0,
- 0, 0, 110, 0, 0, 0, 0, 0, 0, 0,
- 0, 148, 0, 0, 0, 148, 1, 2, 3, 4,
- 5, 6, 7, 8, 9, 10, 131, 132, 133, 0,
- 134, 135, 136, 137, 11, 12, 13, 14, 15, 16,
- 17, 18, 19, 20, 21, 22, 0, 0, 0, 23,
- 24, 25, 26, 138, 27, 28, 29, 30, 90, 31,
- 91, 92, 93, 0, 0, 94, 95, 0, 0, 0,
+ 76, 89, 123, 173, 110, 282, 216, 135, 226, 215,
+ 278, 61, 223, 177, 95, 135, 62, 81, 288, 334,
+ 340, 173, 180, 7, 102, 242, 243, 103, 181, 105,
+ 352, 250, 235, 328, 127, 135, 86, 87, 340, 106,
+ 240, 329, 241, 136, 112, 96, 97, 98, 95, 82,
+ 265, 136, 223, 370, 27, 28, 289, 29, 90, 363,
+ 244, 245, 127, 129, 363, 37, 251, 111, 88, 218,
+ 76, 136, 91, 76, 254, 135, 135, 116, 76, 96,
+ 97, 98, 93, 76, 269, 270, 271, 216, 209, 61,
+ 281, 292, 131, 272, 62, 227, 228, 212, 275, 132,
+ 76, 276, 173, 273, 213, 113, -28, 297, 113, 76,
+ -82, 136, 136, 311, 160, 286, 229, 76, 287, 94,
+ 230, 118, 199, 119, 317, 232, 278, 290, 76, 223,
+ 338, 233, 160, 275, 367, 76, 275, 76, 84, 85,
+ 275, 302, 303, 304, 305, 224, 225, 275, 321, 322,
+ 318, 122, 135, 286, 371, 130, 325, 323, 2, 3,
+ 4, 179, 237, 326, 96, 97, 98, 104, 87, 173,
+ 86, 87, 238, 239, 133, 173, 176, 76, 76, 246,
+ 247, 339, 255, 256, 275, 331, 300, 301, 136, 306,
+ 307, 295, 81, -29, 249, 248, 258, 231, 259, 339,
+ 236, 261, 252, 262, 199, 347, 346, 263, -213, 266,
+ 358, 267, 279, 160, 283, 285, -141, 341, 173, 275,
+ 324, 368, 330, -185, 333, 332, 348, 344, 345, 361,
+ 355, 359, 356, 357, 360, 341, 216, 296, 309, 298,
+ 299, 160, 160, 160, 160, 160, 160, 160, 160, 160,
+ 160, 160, 362, 310, 76, 366, 372, 308, 210, 124,
+ 128, 211, 83, 284, 257, 327, 335, 369, 199, 336,
+ 349, 115, 0, 0, 320, 110, 0, 0, 0, 0,
+ 160, 0, 0, 0, 0, 0, 160, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 96, 0, 0, 0, 139, 140,
- 0, 0, 0, 0, 141, 97, 98, 0, 99, 1,
- 2, 3, 4, 5, 6, 7, 8, 9, 10, 131,
- 132, 133, 0, 134, 135, 136, 137, 11, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
- 0, 0, 23, 24, 25, 26, 138, 27, 28, 29,
- 30, 90, 31, 91, 92, 93, 0, 0, 94, 95,
+ 0, 354, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 199, 199, 0, 0, 199,
+ 199, 0, 0, 0, 0, 0, 0, 0, 0, 160,
+ 0, 0, 0, 0, 0, 0, 0, 199, 0, 0,
+ 0, 76, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 199, 0, 0, 0, 0,
+ 199, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 182, 183, 184, 0, 185, 186, 187, 188,
+ 0, 0, 0, 12, 13, 14, 15, 16, 17, 18,
+ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
+ 0, 29, 30, 31, 32, 33, 34, 35, 36, 37,
+ 38, 39, 40, 41, 189, 42, 43, 44, 45, 46,
+ 47, 48, 49, 50, 51, 52, 53, 54, 55, 0,
+ 56, 57, 58, 59, 139, 60, 140, 141, 142, 143,
+ 0, 0, 0, 144, 145, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 96, 0, 0,
- 0, 139, 221, 0, 0, 0, 0, 141, 97, 98,
- 0, 99, 1, 2, 3, 4, 5, 6, 7, 8,
- 9, 10, 131, 132, 133, 0, 134, 135, 136, 137,
- 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
- 21, 22, 0, 0, 0, 23, 24, 25, 26, 138,
- 27, 28, 29, 30, 90, 31, 91, 92, 93, 0,
- 0, 94, 95, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 146, 0, 0, 0, 190, 191, 0, 0,
+ 0, 0, 192, 147, 148, 0, 149, 1, 2, 3,
+ 4, 5, 6, 7, 8, 9, 10, 11, 182, 183,
+ 184, 0, 185, 186, 187, 188, 0, 0, 0, 12,
+ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
+ 23, 24, 25, 26, 27, 28, 0, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
+ 189, 42, 43, 44, 45, 46, 47, 48, 49, 50,
+ 51, 52, 53, 54, 55, 0, 56, 57, 58, 59,
+ 139, 60, 140, 141, 142, 143, 0, 0, 0, 144,
+ 145, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 146, 0,
+ 0, 0, 190, 277, 0, 0, 0, 0, 192, 147,
+ 148, 0, 149, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 182, 183, 184, 0, 185, 186,
+ 187, 188, 0, 0, 0, 12, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
+ 27, 28, 0, 29, 30, 31, 32, 33, 34, 35,
+ 36, 37, 38, 39, 40, 41, 189, 42, 43, 44,
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
+ 55, 0, 56, 57, 58, 59, 139, 60, 140, 141,
+ 142, 143, 0, 0, 0, 144, 145, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 96, 0, 0, 0, 139, 0, 0, 0, 0, 0,
- 141, 97, 98, 0, 99, 1, 2, 3, 4, 5,
- 6, 7, 8, 9, 10, 131, 132, 133, 0, 134,
- 135, 136, 137, 11, 12, 13, 14, 15, 16, 17,
- 18, 19, 20, 21, 22, 0, 0, 0, 23, 24,
- 25, 26, 138, 27, 28, 29, 30, 90, 31, 91,
- 92, 93, 0, 0, 94, 95, 0, 0, 0, 0,
+ 0, 0, 0, 0, 146, 0, 0, 0, 190, 0,
+ 0, 0, 0, 0, 192, 147, 148, 0, 149, 1,
+ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ 182, 183, 184, 0, 185, 186, 187, 188, 0, 0,
+ 0, 12, 13, 14, 15, 16, 17, 18, 19, 20,
+ 21, 22, 23, 24, 25, 26, 27, 28, 0, 29,
+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 189, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, 52, 53, 54, 55, 0, 56, 57,
+ 58, 59, 139, 60, 140, 141, 142, 143, 0, 0,
+ 0, 144, 145, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 96, 0, 0, 0, 79, 0, 0,
- 0, 0, 0, 141, 97, 98, 0, 99, 1, 2,
- 3, 4, 5, 6, 7, 8, 9, 10, 131, 132,
- 133, 0, 134, 135, 136, 137, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 0, 0,
- 0, 23, 24, 25, 26, 138, 27, 28, 29, 30,
- 90, 31, 91, 92, 93, 0, 0, 94, 95, 0,
+ 146, 0, 0, 0, 122, 0, 0, 0, 0, 0,
+ 192, 147, 148, 0, 149, 1, 2, 3, 4, 5,
+ 6, 7, 8, 9, 10, 11, 182, 183, 184, 0,
+ 185, 186, 187, 188, 0, 0, 0, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 0, 29, 30, 31, 32, 33,
+ 34, 35, 36, 37, 38, 39, 40, 41, 189, 42,
+ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
+ 53, 54, 55, 0, 56, 57, 58, 59, 139, 60,
+ 140, 141, 142, 143, 0, 0, 0, 144, 145, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 96, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 141, 97, 98, 0,
- 99, 1, 2, 3, 4, 5, 6, 7, 8, 9,
- 10, 0, 0, 0, 0, 0, 0, 0, 0, 11,
+ 0, 0, 0, 0, 0, 0, 146, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 192, 147, 148, 0,
+ 149, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 12, 13, 14, 15, 16, 17, 18,
+ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
+ 0, 29, 30, 31, 32, 33, 34, 35, 36, 37,
+ 38, 39, 40, 41, 0, 42, 43, 44, 45, 46,
+ 47, 48, 49, 50, 51, 52, 53, 54, 55, 0,
+ 56, 57, 58, 59, 139, 60, 140, 141, 142, 143,
+ 0, 0, 0, 144, 145, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 134, 2,
+ 3, 4, 146, 6, 7, 8, 9, 10, 11, 0,
+ 0, 0, 192, 147, 148, 0, 149, 0, 0, 0,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
- 22, 0, 0, 0, 23, 24, 25, 26, 0, 27,
- 28, 29, 30, 90, 31, 91, 92, 93, 0, 0,
- 94, 95, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 96,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 141,
- 97, 98, 0, 99, 60, 2, 3, 4, 0, 6,
- 7, 8, 9, 10, 0, 0, 0, 0, 0, 0,
- 0, 0, 11, 12, 13, 14, 15, 16, 17, 18,
- 19, 20, 21, 22, 0, 0, 0, 23, 24, 25,
- 26, 0, 27, 28, 29, 30, 90, 31, 91, 92,
- 93, 0, 0, 94, 95, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 96, 0, 0, 0, 8, 9, 10, 0,
- 0, 0, 0, 97, 98, 0, 99, 11, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
- 0, 0, 0, 0, 25, 26, 0, 27, 28, 29,
- 30, 90, 31, 91, 92, 93, 0, 0, 94, 95,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 96, 0, 0,
- 163, 8, 9, 10, 0, 0, 0, 0, 97, 98,
- 0, 99, 11, 12, 13, 14, 15, 16, 17, 18,
- 19, 20, 21, 22, 0, 0, 0, 0, 0, 25,
- 26, 0, 27, 28, 29, 30, 90, 31, 91, 92,
- 93, 0, 0, 94, 95, 0, 0, 0, 0, 0,
+ 22, 23, 24, 25, 26, 27, 28, 0, 29, 30,
+ 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
+ 41, 0, 42, 43, 44, 45, 46, 47, 48, 49,
+ 50, 51, 52, 53, 54, 55, 0, 56, 57, 58,
+ 59, 139, 60, 140, 141, 142, 143, 0, 0, 0,
+ 144, 145, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 2, 3, 4, 0, 0, 146,
+ 8, 9, 10, 11, 0, 0, 0, 0, 0, 0,
+ 147, 148, 0, 149, 0, 12, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
+ 0, 0, 0, 0, 0, 31, 32, 33, 34, 35,
+ 36, 0, 0, 0, 40, 41, 0, 42, 43, 44,
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
+ 55, 0, 56, 57, 58, 0, 107, 60, 0, 0,
+ 8, 9, 10, 11, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 12, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
+ 0, 0, 0, 0, 108, 31, 32, 33, 34, 35,
+ 36, 0, 0, 0, 40, 41, 0, 42, 43, 44,
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
+ 55, 0, 56, 57, 58, 0, 139, 60, 140, 141,
+ 142, 143, 0, 0, 0, 144, 145, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 96, 0, 0, 0, 8, 9, 10, 0,
- 0, 0, 208, 97, 98, 0, 99, 11, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
- 0, 0, 0, 0, 25, 26, 0, 27, 28, 29,
- 30, 90, 31, 91, 92, 93, 0, 0, 94, 95,
+ 0, 0, 0, 0, 146, 0, 0, 214, 8, 9,
+ 10, 11, 0, 0, 0, 147, 148, 0, 149, 0,
+ 0, 0, 0, 12, 13, 14, 15, 16, 17, 18,
+ 19, 20, 21, 22, 23, 24, 25, 26, 0, 0,
+ 0, 0, 0, 31, 32, 33, 34, 35, 36, 0,
+ 0, 0, 40, 41, 0, 42, 43, 44, 45, 46,
+ 47, 48, 49, 50, 51, 52, 53, 54, 55, 0,
+ 56, 57, 58, 0, 139, 60, 140, 141, 142, 143,
+ 0, 0, 0, 144, 145, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 96, 0, 0,
- 224, 8, 9, 10, 0, 0, 0, 0, 97, 98,
- 0, 99, 11, 12, 13, 14, 15, 16, 17, 18,
- 19, 20, 21, 22, 0, 0, 0, 0, 0, 25,
- 26, 0, 27, 28, 29, 30, 90, 31, 91, 92,
- 93, 0, 0, 94, 95, 0, 0, 0, 0, 0,
+ 0, 0, 146, 8, 9, 10, 11, 0, 0, 0,
+ 0, 0, 264, 147, 148, 0, 149, 0, 12, 13,
+ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 0, 0, 0, 0, 0, 31, 32,
+ 33, 34, 35, 36, 0, 0, 0, 40, 41, 0,
+ 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
+ 52, 53, 54, 55, 0, 56, 57, 58, 0, 139,
+ 60, 140, 141, 142, 143, 0, 0, 0, 144, 145,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 96, 0, 0, 0, 8, 9, 10, 0,
- 0, 0, 0, 97, 98, 0, 99, 11, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
- 0, 0, 0, 0, 25, 177, 0, 27, 28, 29,
- 30, 90, 31, 91, 92, 93, 0, 0, 94, 95,
+ 0, 0, 0, 0, 0, 0, 0, 146, 0, 0,
+ 280, 8, 9, 10, 11, 0, 0, 0, 147, 148,
+ 0, 149, 0, 0, 0, 0, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
+ 26, 0, 0, 0, 0, 0, 31, 32, 33, 34,
+ 35, 36, 0, 0, 0, 40, 41, 0, 42, 43,
+ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
+ 54, 55, 0, 56, 57, 58, 0, 139, 60, 140,
+ 141, 142, 143, 0, 0, 0, 144, 145, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 96, 2, 3,
- 4, 0, 0, 0, 8, 9, 10, 0, 97, 98,
- 0, 99, 0, 0, 0, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 0, 0, 0,
- 0, 0, 25, 26, 0, 27, 28, 29, 30, 0,
- 31, 2, 3, 4, 0, 0, 0, 8, 9, 10,
- 0, 0, 0, 0, 0, 0, 0, 0, 11, 12,
- 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
- 199, 0, 0, 0, 0, 25, 26, 0, 27, 28,
- 29, 30, 0, 31, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 74, 0, 0, 1, 2, 3, 4,
- 5, 6, 7, 8, 9, 10, 0, 0, 0, 0,
- 0, 0, 0, 253, 11, 12, 13, 14, 15, 16,
- 17, 18, 19, 20, 21, 22, 0, 0, 0, 23,
- 24, 25, 26, 0, 27, 28, 29, 30, 0, 31,
- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
- 0, 0, 0, 0, 0, 0, 0, 0, 11, 12,
- 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
- 0, 0, 0, 23, 24, 25, 26, 0, 27, 28,
- 29, 30, 0, 31, 2, 3, 4, 0, 0, 0,
- 8, 9, 10, 0, 0, 0, 0, 0, 0, 0,
- 0, 11, 12, 13, 14, 15, 16, 17, 18, 19,
- 20, 21, 22, 0, 0, 0, 0, 0, 25, 26,
- 0, 27, 28, 29, 30, 0, 31, 8, 9, 10,
- 0, 0, 0, 0, 0, 0, 0, 0, 11, 12,
- 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
- 0, 0, 0, 0, 0, 25, 26, 0, 27, 28,
- 29, 30, 231, 232, 8, 9, 10, 0, 0, 0,
- 0, 0, 0, 0, 0, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 0, 0, 0,
- 0, 0, 25, 26, 0, 27, 28, 29, 30, 0,
- 31
+ 0, 0, 0, 0, 0, 146, 8, 9, 10, 11,
+ 0, 0, 0, 0, 0, 0, 147, 148, 0, 149,
+ 0, 12, 13, 14, 15, 16, 17, 18, 19, 20,
+ 21, 22, 23, 24, 25, 26, 0, 0, 0, 0,
+ 0, 31, 32, 33, 34, 35, 36, 0, 0, 0,
+ 40, 234, 0, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, 52, 53, 54, 55, 0, 56, 57,
+ 58, 0, 139, 60, 140, 141, 142, 143, 0, 0,
+ 0, 144, 145, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 134, 2, 3, 4,
+ 146, 6, 7, 8, 9, 10, 11, 0, 0, 0,
+ 0, 147, 148, 0, 149, 0, 0, 0, 12, 13,
+ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 0, 29, 30, 31, 32,
+ 33, 34, 35, 36, 37, 38, 39, 40, 41, 0,
+ 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
+ 52, 53, 54, 55, 0, 56, 57, 58, 59, 0,
+ 60, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 134, 2, 3, 4, 0, 6, 7, 8, 9,
+ 10, 11, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 222, 12, 13, 14, 15, 16, 17, 18,
+ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
+ 0, 29, 30, 31, 32, 33, 34, 35, 36, 37,
+ 38, 39, 40, 41, 0, 42, 43, 44, 45, 46,
+ 47, 48, 49, 50, 51, 52, 53, 54, 55, 0,
+ 56, 57, 58, 59, 0, 60, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 134, 2, 3, 4,
+ 0, 6, 7, 8, 9, 10, 11, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 253, 12, 13,
+ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 0, 29, 30, 31, 32,
+ 33, 34, 35, 36, 37, 38, 39, 40, 41, 0,
+ 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
+ 52, 53, 54, 55, 0, 56, 57, 58, 59, 0,
+ 60, 0, 0, 0, 0, 0, 0, 0, 114, 0,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 312, 12, 13, 14, 15, 16, 17, 18,
+ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
+ 0, 29, 30, 31, 32, 33, 34, 35, 36, 37,
+ 38, 39, 40, 41, 0, 42, 43, 44, 45, 46,
+ 47, 48, 49, 50, 51, 52, 53, 54, 55, 0,
+ 56, 57, 58, 59, 0, 60, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 12, 13,
+ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 0, 29, 30, 31, 32,
+ 33, 34, 35, 36, 37, 38, 39, 40, 41, 0,
+ 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
+ 52, 53, 54, 55, 0, 56, 57, 58, 59, 0,
+ 60, 134, 2, 3, 4, 0, 6, 7, 8, 9,
+ 10, 11, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 12, 13, 14, 15, 16, 17, 18,
+ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
+ 0, 29, 30, 31, 32, 33, 34, 35, 36, 37,
+ 38, 39, 40, 41, 0, 42, 43, 44, 45, 46,
+ 47, 48, 49, 50, 51, 52, 53, 54, 55, 0,
+ 56, 57, 58, 59, 0, 60, 2, 3, 4, 0,
+ 0, 0, 8, 9, 10, 11, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 0, 0, 0, 0, 0, 31, 32, 33,
+ 34, 35, 36, 0, 0, 0, 40, 41, 0, 42,
+ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
+ 53, 54, 55, 0, 56, 57, 58, 0, 0, 60,
+ 8, 9, 10, 11, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 12, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
+ 0, 0, 0, 0, 0, 31, 32, 33, 34, 35,
+ 36, 0, 0, 0, 40, 41, 0, 42, 43, 44,
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
+ 55, 0, 56, 57, 58, 0, 293, 294, 8, 9,
+ 10, 11, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 12, 13, 14, 15, 16, 17, 18,
+ 19, 20, 21, 22, 23, 24, 25, 26, 0, 0,
+ 0, 0, 0, 31, 32, 33, 34, 35, 36, 0,
+ 0, 0, 40, 41, 0, 42, 43, 44, 45, 46,
+ 47, 48, 49, 50, 51, 52, 53, 54, 55, 0,
+ 56, 57, 58, 0, 0, 60
};
#define yypact_value_is_default(Yystate) \
- (!!((Yystate) == (-261)))
+ (!!((Yystate) == (-309)))
#define yytable_value_is_error(Yytable_value) \
YYID (0)
static const yytype_int16 yycheck[] =
{
- 0, 25, 89, 88, 96, 57, 162, 73, 153, 128,
- 40, 0, 0, 256, 59, 39, 276, 37, 54, 55,
- 81, 108, 88, 73, 42, 45, 45, 46, 72, 260,
- 80, 72, 72, 51, 78, 65, 296, 78, 52, 53,
- 40, 36, 42, 67, 275, 137, 46, 77, 291, 94,
- 78, 51, 295, 89, 90, 85, 75, 46, 46, 73,
- 84, 73, 73, 77, 59, 65, 72, 72, 80, 45,
- 46, 78, 78, 78, 81, 162, 161, 77, 3, 79,
- 172, 75, 201, 8, 9, 85, 83, 78, 85, 176,
- 81, 3, 33, 34, 35, 161, 8, 9, 128, 37,
- 130, 78, 194, 78, 81, 73, 81, 71, 33, 34,
- 35, 36, 37, 71, 206, 73, 261, 4, 5, 6,
- 88, 33, 34, 35, 36, 37, 94, 95, 128, 75,
- 130, 218, 219, 61, 62, 63, 45, 46, 223, 86,
- 87, 297, 70, 111, 81, 56, 57, 72, 71, 173,
- 183, 184, 80, 153, 78, 79, 72, 223, 185, 186,
- 187, 188, 58, 189, 190, 250, 71, 60, 260, 71,
- 74, 201, 71, 81, 81, 81, 71, 74, 76, 73,
- 267, 71, 73, 275, 250, 40, 75, 71, 74, 74,
- 78, 74, 284, 161, 74, 71, 16, 72, 76, 81,
- 72, 201, 294, 255, 81, 191, 80, 173, 192, 59,
- 297, 193, 212, 181, 182, 183, 184, 185, 186, 187,
- 188, 189, 190, 191, 192, 193, 85, 66, 85, 5,
- 130, 295, 257, 212, 251, 257, 275, 46, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 278, 223, 256, 257, -1, -1,
- 260, 261, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 275, -1, -1, -1, -1,
- -1, -1, 250, -1, -1, -1, -1, -1, -1, -1,
- -1, 291, -1, -1, -1, 295, 3, 4, 5, 6,
- 7, 8, 9, 10, 11, 12, 13, 14, 15, -1,
- 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
- 27, 28, 29, 30, 31, 32, -1, -1, -1, 36,
- 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
- 47, 48, 49, -1, -1, 52, 53, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 71, -1, -1, -1, 75, 76,
- -1, -1, -1, -1, 81, 82, 83, -1, 85, 3,
- 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
- 14, 15, -1, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
- -1, -1, 36, 37, 38, 39, 40, 41, 42, 43,
- 44, 45, 46, 47, 48, 49, -1, -1, 52, 53,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 71, -1, -1,
- -1, 75, 76, -1, -1, -1, -1, 81, 82, 83,
- -1, 85, 3, 4, 5, 6, 7, 8, 9, 10,
- 11, 12, 13, 14, 15, -1, 17, 18, 19, 20,
- 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
- 31, 32, -1, -1, -1, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, -1,
- -1, 52, 53, -1, -1, -1, -1, -1, -1, -1,
+ 0, 40, 92, 113, 70, 213, 132, 109, 146, 131,
+ 204, 0, 137, 117, 9, 117, 0, 44, 76, 315,
+ 319, 131, 105, 9, 111, 87, 88, 114, 111, 68,
+ 338, 92, 158, 106, 100, 137, 76, 77, 337, 69,
+ 116, 114, 118, 109, 74, 40, 41, 42, 9, 76,
+ 188, 117, 177, 361, 40, 41, 114, 43, 104, 355,
+ 122, 123, 128, 102, 360, 51, 127, 73, 108, 135,
+ 70, 137, 114, 73, 178, 177, 178, 83, 78, 40,
+ 41, 42, 105, 83, 94, 95, 96, 213, 127, 78,
+ 212, 229, 106, 103, 78, 85, 86, 106, 111, 113,
+ 100, 114, 212, 113, 113, 106, 104, 233, 106, 109,
+ 105, 177, 178, 251, 113, 111, 106, 117, 114, 111,
+ 110, 108, 122, 76, 262, 105, 320, 105, 128, 254,
+ 105, 111, 131, 111, 105, 135, 111, 137, 40, 41,
+ 111, 242, 243, 244, 245, 144, 145, 111, 274, 275,
+ 114, 108, 254, 111, 362, 104, 114, 279, 4, 5,
+ 6, 113, 161, 285, 40, 41, 42, 76, 77, 279,
+ 76, 77, 119, 120, 108, 285, 114, 177, 178, 89,
+ 90, 319, 79, 80, 111, 112, 240, 241, 254, 246,
+ 247, 230, 44, 104, 93, 91, 114, 105, 114, 337,
+ 104, 104, 107, 104, 204, 331, 328, 114, 108, 104,
+ 348, 109, 106, 212, 107, 106, 104, 319, 328, 111,
+ 107, 359, 107, 104, 314, 56, 104, 107, 107, 17,
+ 105, 114, 109, 107, 105, 337, 362, 230, 249, 238,
+ 239, 240, 241, 242, 243, 244, 245, 246, 247, 248,
+ 249, 250, 113, 250, 254, 114, 114, 248, 128, 94,
+ 101, 128, 5, 218, 181, 286, 316, 360, 268, 316,
+ 337, 78, -1, -1, 268, 341, -1, -1, -1, -1,
+ 279, -1, -1, -1, -1, -1, 285, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 71, -1, -1, -1, 75, -1, -1, -1, -1, -1,
- 81, 82, 83, -1, 85, 3, 4, 5, 6, 7,
- 8, 9, 10, 11, 12, 13, 14, 15, -1, 17,
- 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
- 28, 29, 30, 31, 32, -1, -1, -1, 36, 37,
- 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, -1, -1, 52, 53, -1, -1, -1, -1,
+ -1, 340, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 315, 316, -1, -1, 319,
+ 320, -1, -1, -1, -1, -1, -1, -1, -1, 328,
+ -1, -1, -1, -1, -1, -1, -1, 337, -1, -1,
+ -1, 341, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 355, -1, -1, -1, -1,
+ 360, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ 12, 13, 14, 15, 16, -1, 18, 19, 20, 21,
+ -1, -1, -1, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
+ -1, 43, 44, 45, 46, 47, 48, 49, 50, 51,
+ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
+ 62, 63, 64, 65, 66, 67, 68, 69, 70, -1,
+ 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
+ -1, -1, -1, 85, 86, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 71, -1, -1, -1, 75, -1, -1,
- -1, -1, -1, 81, 82, 83, -1, 85, 3, 4,
- 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, -1, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 31, 32, -1, -1,
- -1, 36, 37, 38, 39, 40, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, -1, -1, 52, 53, -1,
+ -1, -1, 104, -1, -1, -1, 108, 109, -1, -1,
+ -1, -1, 114, 115, 116, -1, 118, 3, 4, 5,
+ 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, -1, 18, 19, 20, 21, -1, -1, -1, 25,
+ 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+ 36, 37, 38, 39, 40, 41, -1, 43, 44, 45,
+ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
+ 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
+ 66, 67, 68, 69, 70, -1, 72, 73, 74, 75,
+ 76, 77, 78, 79, 80, 81, -1, -1, -1, 85,
+ 86, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 104, -1,
+ -1, -1, 108, 109, -1, -1, -1, -1, 114, 115,
+ 116, -1, 118, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 15, 16, -1, 18, 19,
+ 20, 21, -1, -1, -1, 25, 26, 27, 28, 29,
+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, -1, 43, 44, 45, 46, 47, 48, 49,
+ 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
+ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
+ 70, -1, 72, 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, -1, -1, -1, 85, 86, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 71, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 81, 82, 83, -1,
- 85, 3, 4, 5, 6, 7, 8, 9, 10, 11,
- 12, -1, -1, -1, -1, -1, -1, -1, -1, 21,
- 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, -1, -1, -1, 36, 37, 38, 39, -1, 41,
- 42, 43, 44, 45, 46, 47, 48, 49, -1, -1,
- 52, 53, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 71,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 81,
- 82, 83, -1, 85, 3, 4, 5, 6, -1, 8,
- 9, 10, 11, 12, -1, -1, -1, -1, -1, -1,
- -1, -1, 21, 22, 23, 24, 25, 26, 27, 28,
- 29, 30, 31, 32, -1, -1, -1, 36, 37, 38,
- 39, -1, 41, 42, 43, 44, 45, 46, 47, 48,
- 49, -1, -1, 52, 53, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 104, -1, -1, -1, 108, -1,
+ -1, -1, -1, -1, 114, 115, 116, -1, 118, 3,
+ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
+ 14, 15, 16, -1, 18, 19, 20, 21, -1, -1,
+ -1, 25, 26, 27, 28, 29, 30, 31, 32, 33,
+ 34, 35, 36, 37, 38, 39, 40, 41, -1, 43,
+ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
+ 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+ 64, 65, 66, 67, 68, 69, 70, -1, 72, 73,
+ 74, 75, 76, 77, 78, 79, 80, 81, -1, -1,
+ -1, 85, 86, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 71, -1, -1, -1, 10, 11, 12, -1,
- -1, -1, -1, 82, 83, -1, 85, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
- -1, -1, -1, -1, 38, 39, -1, 41, 42, 43,
- 44, 45, 46, 47, 48, 49, -1, -1, 52, 53,
+ 104, -1, -1, -1, 108, -1, -1, -1, -1, -1,
+ 114, 115, 116, -1, 118, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15, 16, -1,
+ 18, 19, 20, 21, -1, -1, -1, 25, 26, 27,
+ 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
+ 38, 39, 40, 41, -1, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
+ 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
+ 68, 69, 70, -1, 72, 73, 74, 75, 76, 77,
+ 78, 79, 80, 81, -1, -1, -1, 85, 86, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 71, -1, -1,
- 74, 10, 11, 12, -1, -1, -1, -1, 82, 83,
- -1, 85, 21, 22, 23, 24, 25, 26, 27, 28,
- 29, 30, 31, 32, -1, -1, -1, -1, -1, 38,
- 39, -1, 41, 42, 43, 44, 45, 46, 47, 48,
- 49, -1, -1, 52, 53, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 104, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 114, 115, 116, -1,
+ 118, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ 12, 13, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
+ -1, 43, 44, 45, 46, 47, 48, 49, 50, 51,
+ 52, 53, 54, 55, -1, 57, 58, 59, 60, 61,
+ 62, 63, 64, 65, 66, 67, 68, 69, 70, -1,
+ 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
+ -1, -1, -1, 85, 86, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 3, 4,
+ 5, 6, 104, 8, 9, 10, 11, 12, 13, -1,
+ -1, -1, 114, 115, 116, -1, 118, -1, -1, -1,
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
+ 35, 36, 37, 38, 39, 40, 41, -1, 43, 44,
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
+ 55, -1, 57, 58, 59, 60, 61, 62, 63, 64,
+ 65, 66, 67, 68, 69, 70, -1, 72, 73, 74,
+ 75, 76, 77, 78, 79, 80, 81, -1, -1, -1,
+ 85, 86, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 4, 5, 6, -1, -1, 104,
+ 10, 11, 12, 13, -1, -1, -1, -1, -1, -1,
+ 115, 116, -1, 118, -1, 25, 26, 27, 28, 29,
+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+ -1, -1, -1, -1, -1, 45, 46, 47, 48, 49,
+ 50, -1, -1, -1, 54, 55, -1, 57, 58, 59,
+ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
+ 70, -1, 72, 73, 74, -1, 76, 77, -1, -1,
+ 10, 11, 12, 13, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 25, 26, 27, 28, 29,
+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+ -1, -1, -1, -1, 114, 45, 46, 47, 48, 49,
+ 50, -1, -1, -1, 54, 55, -1, 57, 58, 59,
+ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
+ 70, -1, 72, 73, 74, -1, 76, 77, 78, 79,
+ 80, 81, -1, -1, -1, 85, 86, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 71, -1, -1, -1, 10, 11, 12, -1,
- -1, -1, 81, 82, 83, -1, 85, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
- -1, -1, -1, -1, 38, 39, -1, 41, 42, 43,
- 44, 45, 46, 47, 48, 49, -1, -1, 52, 53,
+ -1, -1, -1, -1, 104, -1, -1, 107, 10, 11,
+ 12, 13, -1, -1, -1, 115, 116, -1, 118, -1,
+ -1, -1, -1, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, -1, -1,
+ -1, -1, -1, 45, 46, 47, 48, 49, 50, -1,
+ -1, -1, 54, 55, -1, 57, 58, 59, 60, 61,
+ 62, 63, 64, 65, 66, 67, 68, 69, 70, -1,
+ 72, 73, 74, -1, 76, 77, 78, 79, 80, 81,
+ -1, -1, -1, 85, 86, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 71, -1, -1,
- 74, 10, 11, 12, -1, -1, -1, -1, 82, 83,
- -1, 85, 21, 22, 23, 24, 25, 26, 27, 28,
- 29, 30, 31, 32, -1, -1, -1, -1, -1, 38,
- 39, -1, 41, 42, 43, 44, 45, 46, 47, 48,
- 49, -1, -1, 52, 53, -1, -1, -1, -1, -1,
+ -1, -1, 104, 10, 11, 12, 13, -1, -1, -1,
+ -1, -1, 114, 115, 116, -1, 118, -1, 25, 26,
+ 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
+ 37, 38, 39, -1, -1, -1, -1, -1, 45, 46,
+ 47, 48, 49, 50, -1, -1, -1, 54, 55, -1,
+ 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
+ 67, 68, 69, 70, -1, 72, 73, 74, -1, 76,
+ 77, 78, 79, 80, 81, -1, -1, -1, 85, 86,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 71, -1, -1, -1, 10, 11, 12, -1,
- -1, -1, -1, 82, 83, -1, 85, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
- -1, -1, -1, -1, 38, 39, -1, 41, 42, 43,
- 44, 45, 46, 47, 48, 49, -1, -1, 52, 53,
+ -1, -1, -1, -1, -1, -1, -1, 104, -1, -1,
+ 107, 10, 11, 12, 13, -1, -1, -1, 115, 116,
+ -1, 118, -1, -1, -1, -1, 25, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, -1, -1, -1, -1, -1, 45, 46, 47, 48,
+ 49, 50, -1, -1, -1, 54, 55, -1, 57, 58,
+ 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
+ 69, 70, -1, 72, 73, 74, -1, 76, 77, 78,
+ 79, 80, 81, -1, -1, -1, 85, 86, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 71, 4, 5,
- 6, -1, -1, -1, 10, 11, 12, -1, 82, 83,
- -1, 85, -1, -1, -1, 21, 22, 23, 24, 25,
- 26, 27, 28, 29, 30, 31, 32, -1, -1, -1,
- -1, -1, 38, 39, -1, 41, 42, 43, 44, -1,
- 46, 4, 5, 6, -1, -1, -1, 10, 11, 12,
- -1, -1, -1, -1, -1, -1, -1, -1, 21, 22,
- 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
- 76, -1, -1, -1, -1, 38, 39, -1, 41, 42,
- 43, 44, -1, 46, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 0, -1, -1, 3, 4, 5, 6,
- 7, 8, 9, 10, 11, 12, -1, -1, -1, -1,
- -1, -1, -1, 76, 21, 22, 23, 24, 25, 26,
- 27, 28, 29, 30, 31, 32, -1, -1, -1, 36,
- 37, 38, 39, -1, 41, 42, 43, 44, -1, 46,
- 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
- -1, -1, -1, -1, -1, -1, -1, -1, 21, 22,
- 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
- -1, -1, -1, 36, 37, 38, 39, -1, 41, 42,
- 43, 44, -1, 46, 4, 5, 6, -1, -1, -1,
- 10, 11, 12, -1, -1, -1, -1, -1, -1, -1,
- -1, 21, 22, 23, 24, 25, 26, 27, 28, 29,
- 30, 31, 32, -1, -1, -1, -1, -1, 38, 39,
- -1, 41, 42, 43, 44, -1, 46, 10, 11, 12,
- -1, -1, -1, -1, -1, -1, -1, -1, 21, 22,
- 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
- -1, -1, -1, -1, -1, 38, 39, -1, 41, 42,
- 43, 44, 45, 46, 10, 11, 12, -1, -1, -1,
- -1, -1, -1, -1, -1, 21, 22, 23, 24, 25,
- 26, 27, 28, 29, 30, 31, 32, -1, -1, -1,
- -1, -1, 38, 39, -1, 41, 42, 43, 44, -1,
- 46
+ -1, -1, -1, -1, -1, 104, 10, 11, 12, 13,
+ -1, -1, -1, -1, -1, -1, 115, 116, -1, 118,
+ -1, 25, 26, 27, 28, 29, 30, 31, 32, 33,
+ 34, 35, 36, 37, 38, 39, -1, -1, -1, -1,
+ -1, 45, 46, 47, 48, 49, 50, -1, -1, -1,
+ 54, 55, -1, 57, 58, 59, 60, 61, 62, 63,
+ 64, 65, 66, 67, 68, 69, 70, -1, 72, 73,
+ 74, -1, 76, 77, 78, 79, 80, 81, -1, -1,
+ -1, 85, 86, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 3, 4, 5, 6,
+ 104, 8, 9, 10, 11, 12, 13, -1, -1, -1,
+ -1, 115, 116, -1, 118, -1, -1, -1, 25, 26,
+ 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
+ 37, 38, 39, 40, 41, -1, 43, 44, 45, 46,
+ 47, 48, 49, 50, 51, 52, 53, 54, 55, -1,
+ 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
+ 67, 68, 69, 70, -1, 72, 73, 74, 75, -1,
+ 77, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 3, 4, 5, 6, -1, 8, 9, 10, 11,
+ 12, 13, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 109, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
+ -1, 43, 44, 45, 46, 47, 48, 49, 50, 51,
+ 52, 53, 54, 55, -1, 57, 58, 59, 60, 61,
+ 62, 63, 64, 65, 66, 67, 68, 69, 70, -1,
+ 72, 73, 74, 75, -1, 77, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 3, 4, 5, 6,
+ -1, 8, 9, 10, 11, 12, 13, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 109, 25, 26,
+ 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
+ 37, 38, 39, 40, 41, -1, 43, 44, 45, 46,
+ 47, 48, 49, 50, 51, 52, 53, 54, 55, -1,
+ 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
+ 67, 68, 69, 70, -1, 72, 73, 74, 75, -1,
+ 77, -1, -1, -1, -1, -1, -1, -1, 0, -1,
+ -1, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ 12, 13, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 109, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
+ -1, 43, 44, 45, 46, 47, 48, 49, 50, 51,
+ 52, 53, 54, 55, -1, 57, 58, 59, 60, 61,
+ 62, 63, 64, 65, 66, 67, 68, 69, 70, -1,
+ 72, 73, 74, 75, -1, 77, 3, 4, 5, 6,
+ 7, 8, 9, 10, 11, 12, 13, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 25, 26,
+ 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
+ 37, 38, 39, 40, 41, -1, 43, 44, 45, 46,
+ 47, 48, 49, 50, 51, 52, 53, 54, 55, -1,
+ 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
+ 67, 68, 69, 70, -1, 72, 73, 74, 75, -1,
+ 77, 3, 4, 5, 6, -1, 8, 9, 10, 11,
+ 12, 13, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
+ -1, 43, 44, 45, 46, 47, 48, 49, 50, 51,
+ 52, 53, 54, 55, -1, 57, 58, 59, 60, 61,
+ 62, 63, 64, 65, 66, 67, 68, 69, 70, -1,
+ 72, 73, 74, 75, -1, 77, 4, 5, 6, -1,
+ -1, -1, 10, 11, 12, 13, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 25, 26, 27,
+ 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
+ 38, 39, -1, -1, -1, -1, -1, 45, 46, 47,
+ 48, 49, 50, -1, -1, -1, 54, 55, -1, 57,
+ 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
+ 68, 69, 70, -1, 72, 73, 74, -1, -1, 77,
+ 10, 11, 12, 13, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 25, 26, 27, 28, 29,
+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+ -1, -1, -1, -1, -1, 45, 46, 47, 48, 49,
+ 50, -1, -1, -1, 54, 55, -1, 57, 58, 59,
+ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
+ 70, -1, 72, 73, 74, -1, 76, 77, 10, 11,
+ 12, 13, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, -1, -1,
+ -1, -1, -1, 45, 46, 47, 48, 49, 50, -1,
+ -1, -1, 54, 55, -1, 57, 58, 59, 60, 61,
+ 62, 63, 64, 65, 66, 67, 68, 69, 70, -1,
+ 72, 73, 74, -1, -1, 77
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -1288,36 +1588,43 @@ static const yytype_int16 yycheck[] =
static const yytype_uint8 yystos[] =
{
0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
- 12, 21, 22, 23, 24, 25, 26, 27, 28, 29,
- 30, 31, 32, 36, 37, 38, 39, 41, 42, 43,
- 44, 46, 126, 127, 128, 129, 130, 135, 136, 137,
- 138, 139, 140, 141, 142, 143, 175, 176, 177, 37,
- 45, 140, 45, 46, 75, 96, 81, 178, 72, 78,
- 3, 33, 34, 35, 132, 133, 138, 78, 81, 45,
- 96, 139, 141, 73, 0, 176, 141, 145, 75, 75,
- 161, 132, 131, 134, 139, 133, 96, 71, 73, 80,
- 45, 47, 48, 49, 52, 53, 71, 82, 83, 85,
- 97, 98, 99, 101, 102, 103, 104, 105, 106, 107,
- 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
- 118, 119, 120, 121, 125, 142, 81, 139, 146, 147,
- 144, 13, 14, 15, 17, 18, 19, 20, 40, 75,
- 76, 81, 108, 121, 122, 124, 126, 127, 142, 151,
- 152, 153, 154, 162, 163, 164, 167, 174, 96, 131,
- 134, 73, 80, 74, 125, 122, 150, 108, 108, 124,
- 52, 53, 73, 77, 72, 72, 78, 39, 122, 71,
- 108, 86, 87, 83, 85, 54, 55, 89, 90, 56,
- 57, 58, 60, 59, 94, 74, 96, 148, 149, 76,
- 147, 146, 81, 81, 169, 71, 71, 81, 81, 124,
- 71, 76, 155, 61, 62, 63, 70, 80, 123, 78,
- 81, 76, 152, 73, 74, 125, 150, 74, 72, 100,
- 124, 45, 46, 96, 103, 122, 108, 108, 110, 110,
- 112, 112, 112, 112, 113, 113, 117, 118, 119, 124,
- 73, 78, 81, 76, 158, 159, 160, 170, 124, 81,
- 168, 162, 122, 122, 125, 74, 74, 79, 125, 149,
- 40, 161, 153, 151, 163, 171, 72, 124, 137, 166,
- 156, 74, 122, 74, 71, 166, 172, 173, 158, 165,
- 96, 72, 76, 124, 81, 72, 16, 80, 153, 157,
- 161, 72, 124, 157, 158, 150, 81
+ 12, 13, 25, 26, 27, 28, 29, 30, 31, 32,
+ 33, 34, 35, 36, 37, 38, 39, 40, 41, 43,
+ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
+ 54, 55, 57, 58, 59, 60, 61, 62, 63, 64,
+ 65, 66, 67, 68, 69, 70, 72, 73, 74, 75,
+ 77, 160, 161, 162, 163, 164, 169, 170, 171, 172,
+ 174, 175, 176, 177, 178, 181, 182, 183, 215, 216,
+ 217, 44, 76, 177, 40, 41, 76, 77, 108, 129,
+ 104, 114, 218, 105, 111, 9, 40, 41, 42, 166,
+ 167, 173, 111, 114, 76, 129, 175, 76, 114, 159,
+ 176, 181, 175, 106, 0, 216, 181, 185, 108, 76,
+ 179, 180, 108, 201, 166, 165, 168, 176, 167, 129,
+ 104, 106, 113, 108, 3, 174, 176, 186, 187, 76,
+ 78, 79, 80, 81, 85, 86, 104, 115, 116, 118,
+ 130, 131, 132, 134, 135, 136, 137, 138, 139, 140,
+ 141, 142, 143, 144, 145, 146, 147, 148, 149, 150,
+ 151, 152, 153, 154, 158, 182, 114, 186, 184, 113,
+ 105, 111, 14, 15, 16, 18, 19, 20, 21, 56,
+ 108, 109, 114, 141, 154, 155, 157, 160, 161, 182,
+ 191, 192, 193, 194, 202, 203, 204, 207, 214, 129,
+ 165, 168, 106, 113, 107, 158, 155, 190, 176, 129,
+ 188, 189, 109, 187, 141, 141, 157, 85, 86, 106,
+ 110, 105, 105, 111, 55, 155, 104, 141, 119, 120,
+ 116, 118, 87, 88, 122, 123, 89, 90, 91, 93,
+ 92, 127, 107, 109, 186, 79, 80, 180, 114, 114,
+ 209, 104, 104, 114, 114, 157, 104, 109, 195, 94,
+ 95, 96, 103, 113, 156, 111, 114, 109, 192, 106,
+ 107, 158, 190, 107, 188, 106, 111, 114, 76, 114,
+ 105, 133, 157, 76, 77, 129, 136, 155, 141, 141,
+ 143, 143, 145, 145, 145, 145, 146, 146, 150, 151,
+ 152, 157, 109, 198, 199, 200, 210, 157, 114, 208,
+ 202, 155, 155, 158, 107, 114, 158, 189, 106, 114,
+ 107, 112, 56, 201, 193, 191, 203, 211, 105, 157,
+ 171, 174, 206, 196, 107, 107, 158, 155, 104, 206,
+ 212, 213, 198, 205, 129, 105, 109, 107, 157, 114,
+ 105, 17, 113, 193, 197, 201, 114, 105, 157, 197,
+ 198, 190, 114
};
#define yyerrok (yyerrstatus = 0)
@@ -1512,11 +1819,7 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, context)
# else
YYUSE (yyoutput);
# endif
- switch (yytype)
- {
- default:
- break;
- }
+ YYUSE (yytype);
}
@@ -1916,12 +2219,7 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, context)
yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
- switch (yytype)
- {
-
- default:
- break;
- }
+ YYUSE (yytype);
}
@@ -2248,43 +2546,55 @@ yyreduce:
{
// The symbol table search was done in the lexical phase
- const TSymbol* symbol = (yyvsp[(1) - (1)].lex).symbol;
- const TVariable* variable;
- if (symbol == 0) {
+ const TSymbol *symbol = (yyvsp[(1) - (1)].lex).symbol;
+ const TVariable *variable = 0;
+
+ if (!symbol)
+ {
context->error((yylsp[(1) - (1)]), "undeclared identifier", (yyvsp[(1) - (1)].lex).string->c_str());
context->recover();
- TType type(EbtFloat, EbpUndefined);
- TVariable* fakeVariable = new TVariable((yyvsp[(1) - (1)].lex).string, type);
- context->symbolTable.insert(*fakeVariable);
- variable = fakeVariable;
- } else {
- // This identifier can only be a variable type symbol
- if (! symbol->isVariable()) {
- context->error((yylsp[(1) - (1)]), "variable expected", (yyvsp[(1) - (1)].lex).string->c_str());
- context->recover();
- }
-
+ }
+ else if (!symbol->isVariable())
+ {
+ context->error((yylsp[(1) - (1)]), "variable expected", (yyvsp[(1) - (1)].lex).string->c_str());
+ context->recover();
+ }
+ else
+ {
variable = static_cast<const TVariable*>(symbol);
- if (context->symbolTable.findBuiltIn(variable->getName()) &&
+ if (context->symbolTable.findBuiltIn(variable->getName(), context->shaderVersion) &&
!variable->getExtension().empty() &&
- context->extensionErrorCheck((yylsp[(1) - (1)]), variable->getExtension())) {
+ context->extensionErrorCheck((yylsp[(1) - (1)]), variable->getExtension()))
+ {
context->recover();
}
}
- // don't delete $1.string, it's used by error recovery, and the pool
- // pop will reclaim the memory
+ if (!variable)
+ {
+ TType type(EbtFloat, EbpUndefined);
+ TVariable *fakeVariable = new TVariable((yyvsp[(1) - (1)].lex).string, type);
+ context->symbolTable.declare(*fakeVariable);
+ variable = fakeVariable;
+ }
- if (variable->getType().getQualifier() == EvqConst ) {
+ if (variable->getType().getQualifier() == EvqConst)
+ {
ConstantUnion* constArray = variable->getConstPointer();
TType t(variable->getType());
(yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yylsp[(1) - (1)]));
- } else
+ }
+ else
+ {
(yyval.interm.intermTypedNode) = context->intermediate.addSymbol(variable->getUniqueId(),
variable->getName(),
variable->getType(),
(yylsp[(1) - (1)]));
+ }
+
+ // don't delete $1.string, it's used by error recovery, and the pool
+ // pop will reclaim the memory
}
break;
@@ -2308,8 +2618,8 @@ yyreduce:
{
ConstantUnion *unionArray = new ConstantUnion[1];
- unionArray->setFConst((yyvsp[(1) - (1)].lex).f);
- (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yylsp[(1) - (1)]));
+ unionArray->setUConst((yyvsp[(1) - (1)].lex).u);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtUInt, EbpUndefined, EvqConst), (yylsp[(1) - (1)]));
}
break;
@@ -2317,144 +2627,61 @@ yyreduce:
{
ConstantUnion *unionArray = new ConstantUnion[1];
- unionArray->setBConst((yyvsp[(1) - (1)].lex).b);
- (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(1) - (1)]));
+ unionArray->setFConst((yyvsp[(1) - (1)].lex).f);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yylsp[(1) - (1)]));
}
break;
case 9:
{
- (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode);
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setBConst((yyvsp[(1) - (1)].lex).b);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(1) - (1)]));
}
break;
case 10:
{
- (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
+ (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode);
}
break;
case 11:
{
- (yyval.interm.intermTypedNode) = context->addIndexExpression((yyvsp[(1) - (4)].interm.intermTypedNode), (yylsp[(2) - (4)]), (yyvsp[(3) - (4)].interm.intermTypedNode));
+ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
}
break;
case 12:
{
- (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
+ (yyval.interm.intermTypedNode) = context->addIndexExpression((yyvsp[(1) - (4)].interm.intermTypedNode), (yylsp[(2) - (4)]), (yyvsp[(3) - (4)].interm.intermTypedNode));
}
break;
case 13:
{
- if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isArray()) {
- context->error((yylsp[(3) - (3)]), "cannot apply dot operator to an array", ".");
- context->recover();
- }
-
- if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isVector()) {
- TVectorFields fields;
- if (! context->parseVectorFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yylsp[(3) - (3)]))) {
- fields.num = 1;
- fields.offsets[0] = 0;
- context->recover();
- }
+ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
+ }
+ break;
- if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { // constant folding for vector fields
- (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (3)].interm.intermTypedNode), (yylsp[(3) - (3)]));
- if ((yyval.interm.intermTypedNode) == 0) {
- context->recover();
- (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
- }
- else
- (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqConst, (int) (*(yyvsp[(3) - (3)].lex).string).size()));
- } else {
- TString vectorString = *(yyvsp[(3) - (3)].lex).string;
- TIntermTyped* index = context->intermediate.addSwizzle(fields, (yylsp[(3) - (3)]));
- (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yylsp[(2) - (3)]));
- (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size()));
- }
- } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isMatrix()) {
- TMatrixFields fields;
- if (! context->parseMatrixFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yylsp[(3) - (3)]))) {
- fields.wholeRow = false;
- fields.wholeCol = false;
- fields.row = 0;
- fields.col = 0;
- context->recover();
- }
+ case 14:
- if (fields.wholeRow || fields.wholeCol) {
- context->error((yylsp[(2) - (3)]), " non-scalar fields not implemented yet", ".");
- context->recover();
- ConstantUnion *unionArray = new ConstantUnion[1];
- unionArray->setIConst(0);
- TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yylsp[(3) - (3)]));
- (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yylsp[(2) - (3)]));
- (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(),EvqTemporary, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize()));
- } else {
- ConstantUnion *unionArray = new ConstantUnion[1];
- unionArray->setIConst(fields.col * (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize() + fields.row);
- TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yylsp[(3) - (3)]));
- (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yylsp[(2) - (3)]));
- (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
- }
- } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType() == EbtStruct) {
- bool fieldFound = false;
- const TFieldList& fields = (yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getStruct()->fields();
- unsigned int i;
- for (i = 0; i < fields.size(); ++i) {
- if (fields[i]->name() == *(yyvsp[(3) - (3)].lex).string) {
- fieldFound = true;
- break;
- }
- }
- if (fieldFound) {
- if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) {
- (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
- if ((yyval.interm.intermTypedNode) == 0) {
- context->recover();
- (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
- }
- else {
- (yyval.interm.intermTypedNode)->setType(*fields[i]->type());
- // change the qualifier of the return type, not of the structure field
- // as the structure definition is shared between various structures.
- (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
- }
- } else {
- ConstantUnion *unionArray = new ConstantUnion[1];
- unionArray->setIConst(i);
- TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *fields[i]->type(), (yylsp[(3) - (3)]));
- (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yylsp[(2) - (3)]));
- (yyval.interm.intermTypedNode)->setType(*fields[i]->type());
- }
- } else {
- context->error((yylsp[(2) - (3)]), " no such field in structure", (yyvsp[(3) - (3)].lex).string->c_str());
- context->recover();
- (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
- }
- } else {
- context->error((yylsp[(2) - (3)]), " field selection requires structure, vector, or matrix on left hand side", (yyvsp[(3) - (3)].lex).string->c_str());
- context->recover();
- (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
- }
- // don't delete $3.string, it's from the pool
+ {
+ (yyval.interm.intermTypedNode) = context->addFieldSelectionExpression((yyvsp[(1) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), *(yyvsp[(3) - (3)].lex).string, (yylsp[(3) - (3)]));
}
break;
- case 14:
+ case 15:
{
if (context->lValueErrorCheck((yylsp[(2) - (2)]), "++", (yyvsp[(1) - (2)].interm.intermTypedNode)))
context->recover();
- (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yylsp[(2) - (2)]), context->symbolTable);
+ (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yylsp[(2) - (2)]));
if ((yyval.interm.intermTypedNode) == 0) {
context->unaryOpError((yylsp[(2) - (2)]), "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
context->recover();
@@ -2463,12 +2690,12 @@ yyreduce:
}
break;
- case 15:
+ case 16:
{
if (context->lValueErrorCheck((yylsp[(2) - (2)]), "--", (yyvsp[(1) - (2)].interm.intermTypedNode)))
context->recover();
- (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yylsp[(2) - (2)]), context->symbolTable);
+ (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yylsp[(2) - (2)]));
if ((yyval.interm.intermTypedNode) == 0) {
context->unaryOpError((yylsp[(2) - (2)]), "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
context->recover();
@@ -2477,7 +2704,7 @@ yyreduce:
}
break;
- case 16:
+ case 17:
{
if (context->integerErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]"))
@@ -2486,7 +2713,7 @@ yyreduce:
}
break;
- case 17:
+ case 18:
{
TFunction* fnCall = (yyvsp[(1) - (1)].interm).function;
@@ -2520,7 +2747,7 @@ yyreduce:
//
const TFunction* fnCandidate;
bool builtIn;
- fnCandidate = context->findFunction((yylsp[(1) - (1)]), fnCall, &builtIn);
+ fnCandidate = context->findFunction((yylsp[(1) - (1)]), fnCall, context->shaderVersion, &builtIn);
if (fnCandidate) {
//
// A declared function.
@@ -2538,7 +2765,7 @@ yyreduce:
//
// Treat it like a built-in unary operator.
//
- (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, (yylsp[(1) - (1)]), context->symbolTable);
+ (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, (yylsp[(1) - (1)]));
if ((yyval.interm.intermTypedNode) == 0) {
std::stringstream extraInfoStream;
extraInfoStream << "built in unary operator function. Type: " << static_cast<TIntermTyped*>((yyvsp[(1) - (1)].interm).intermNode)->getCompleteString();
@@ -2587,14 +2814,14 @@ yyreduce:
}
break;
- case 18:
+ case 19:
{
(yyval.interm) = (yyvsp[(1) - (1)].interm);
}
break;
- case 19:
+ case 20:
{
context->error((yylsp[(3) - (3)]), "methods are not supported", "");
@@ -2603,21 +2830,21 @@ yyreduce:
}
break;
- case 20:
+ case 21:
{
(yyval.interm) = (yyvsp[(1) - (2)].interm);
}
break;
- case 21:
+ case 22:
{
(yyval.interm) = (yyvsp[(1) - (2)].interm);
}
break;
- case 22:
+ case 23:
{
(yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
@@ -2625,7 +2852,7 @@ yyreduce:
}
break;
- case 23:
+ case 24:
{
(yyval.interm).function = (yyvsp[(1) - (1)].interm.function);
@@ -2633,7 +2860,7 @@ yyreduce:
}
break;
- case 24:
+ case 25:
{
TParameter param = { 0, new TType((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()) };
@@ -2643,7 +2870,7 @@ yyreduce:
}
break;
- case 25:
+ case 26:
{
TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()) };
@@ -2653,73 +2880,21 @@ yyreduce:
}
break;
- case 26:
+ case 27:
{
(yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
}
break;
- case 27:
+ case 28:
{
- //
- // Constructor
- //
- TOperator op = EOpNull;
- if ((yyvsp[(1) - (1)].interm.type).userDef) {
- op = EOpConstructStruct;
- } else {
- switch ((yyvsp[(1) - (1)].interm.type).type) {
- case EbtFloat:
- if ((yyvsp[(1) - (1)].interm.type).matrix) {
- switch((yyvsp[(1) - (1)].interm.type).size) {
- case 2: op = EOpConstructMat2; break;
- case 3: op = EOpConstructMat3; break;
- case 4: op = EOpConstructMat4; break;
- }
- } else {
- switch((yyvsp[(1) - (1)].interm.type).size) {
- case 1: op = EOpConstructFloat; break;
- case 2: op = EOpConstructVec2; break;
- case 3: op = EOpConstructVec3; break;
- case 4: op = EOpConstructVec4; break;
- }
- }
- break;
- case EbtInt:
- switch((yyvsp[(1) - (1)].interm.type).size) {
- case 1: op = EOpConstructInt; break;
- case 2: op = EOpConstructIVec2; break;
- case 3: op = EOpConstructIVec3; break;
- case 4: op = EOpConstructIVec4; break;
- }
- break;
- case EbtBool:
- switch((yyvsp[(1) - (1)].interm.type).size) {
- case 1: op = EOpConstructBool; break;
- case 2: op = EOpConstructBVec2; break;
- case 3: op = EOpConstructBVec3; break;
- case 4: op = EOpConstructBVec4; break;
- }
- break;
- default: break;
- }
- if (op == EOpNull) {
- context->error((yylsp[(1) - (1)]), "cannot construct this type", getBasicString((yyvsp[(1) - (1)].interm.type).type));
- context->recover();
- (yyvsp[(1) - (1)].interm.type).type = EbtFloat;
- op = EOpConstructFloat;
- }
- }
- TString tempString;
- TType type((yyvsp[(1) - (1)].interm.type));
- TFunction *function = new TFunction(&tempString, type, op);
- (yyval.interm.function) = function;
+ (yyval.interm.function) = context->addConstructorFunc((yyvsp[(1) - (1)].interm.type));
}
break;
- case 28:
+ case 29:
{
if (context->reservedErrorCheck((yylsp[(1) - (1)]), *(yyvsp[(1) - (1)].lex).string))
@@ -2730,19 +2905,19 @@ yyreduce:
}
break;
- case 29:
+ case 30:
{
(yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
}
break;
- case 30:
+ case 31:
{
if (context->lValueErrorCheck((yylsp[(1) - (2)]), "++", (yyvsp[(2) - (2)].interm.intermTypedNode)))
context->recover();
- (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yylsp[(1) - (2)]), context->symbolTable);
+ (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yylsp[(1) - (2)]));
if ((yyval.interm.intermTypedNode) == 0) {
context->unaryOpError((yylsp[(1) - (2)]), "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
context->recover();
@@ -2751,12 +2926,12 @@ yyreduce:
}
break;
- case 31:
+ case 32:
{
if (context->lValueErrorCheck((yylsp[(1) - (2)]), "--", (yyvsp[(2) - (2)].interm.intermTypedNode)))
context->recover();
- (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yylsp[(1) - (2)]), context->symbolTable);
+ (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yylsp[(1) - (2)]));
if ((yyval.interm.intermTypedNode) == 0) {
context->unaryOpError((yylsp[(1) - (2)]), "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
context->recover();
@@ -2765,11 +2940,11 @@ yyreduce:
}
break;
- case 32:
+ case 33:
{
if ((yyvsp[(1) - (2)].interm).op != EOpNull) {
- (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath((yyvsp[(1) - (2)].interm).op, (yyvsp[(2) - (2)].interm.intermTypedNode), (yylsp[(1) - (2)]), context->symbolTable);
+ (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath((yyvsp[(1) - (2)].interm).op, (yyvsp[(2) - (2)].interm.intermTypedNode), (yylsp[(1) - (2)]));
if ((yyval.interm.intermTypedNode) == 0) {
const char* errorOp = "";
switch((yyvsp[(1) - (2)].interm).op) {
@@ -2786,30 +2961,30 @@ yyreduce:
}
break;
- case 33:
+ case 34:
{ (yyval.interm).op = EOpNull; }
break;
- case 34:
+ case 35:
{ (yyval.interm).op = EOpNegative; }
break;
- case 35:
+ case 36:
{ (yyval.interm).op = EOpLogicalNot; }
break;
- case 36:
+ case 37:
{ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
break;
- case 37:
+ case 38:
{
- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
if ((yyval.interm.intermTypedNode) == 0) {
context->binaryOpError((yylsp[(2) - (3)]), "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
context->recover();
@@ -2818,10 +2993,10 @@ yyreduce:
}
break;
- case 38:
+ case 39:
{
- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
if ((yyval.interm.intermTypedNode) == 0) {
context->binaryOpError((yylsp[(2) - (3)]), "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
context->recover();
@@ -2830,15 +3005,15 @@ yyreduce:
}
break;
- case 39:
+ case 40:
{ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
break;
- case 40:
+ case 41:
{
- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpAdd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpAdd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
if ((yyval.interm.intermTypedNode) == 0) {
context->binaryOpError((yylsp[(2) - (3)]), "+", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
context->recover();
@@ -2847,10 +3022,10 @@ yyreduce:
}
break;
- case 41:
+ case 42:
{
- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpSub, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpSub, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
if ((yyval.interm.intermTypedNode) == 0) {
context->binaryOpError((yylsp[(2) - (3)]), "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
context->recover();
@@ -2859,20 +3034,20 @@ yyreduce:
}
break;
- case 42:
+ case 43:
{ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
break;
- case 43:
+ case 44:
{ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
break;
- case 44:
+ case 45:
{
- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
if ((yyval.interm.intermTypedNode) == 0) {
context->binaryOpError((yylsp[(2) - (3)]), "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
context->recover();
@@ -2883,10 +3058,10 @@ yyreduce:
}
break;
- case 45:
+ case 46:
{
- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
if ((yyval.interm.intermTypedNode) == 0) {
context->binaryOpError((yylsp[(2) - (3)]), ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
context->recover();
@@ -2897,10 +3072,10 @@ yyreduce:
}
break;
- case 46:
+ case 47:
{
- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
if ((yyval.interm.intermTypedNode) == 0) {
context->binaryOpError((yylsp[(2) - (3)]), "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
context->recover();
@@ -2911,10 +3086,10 @@ yyreduce:
}
break;
- case 47:
+ case 48:
{
- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
if ((yyval.interm.intermTypedNode) == 0) {
context->binaryOpError((yylsp[(2) - (3)]), ">=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
context->recover();
@@ -2925,15 +3100,15 @@ yyreduce:
}
break;
- case 48:
+ case 49:
{ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
break;
- case 49:
+ case 50:
{
- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
if ((yyval.interm.intermTypedNode) == 0) {
context->binaryOpError((yylsp[(2) - (3)]), "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
context->recover();
@@ -2944,10 +3119,10 @@ yyreduce:
}
break;
- case 50:
+ case 51:
{
- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpNotEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpNotEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
if ((yyval.interm.intermTypedNode) == 0) {
context->binaryOpError((yylsp[(2) - (3)]), "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
context->recover();
@@ -2958,11 +3133,6 @@ yyreduce:
}
break;
- case 51:
-
- { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
- break;
-
case 52:
{ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
@@ -2980,8 +3150,13 @@ yyreduce:
case 55:
+ { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
+ break;
+
+ case 56:
+
{
- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
if ((yyval.interm.intermTypedNode) == 0) {
context->binaryOpError((yylsp[(2) - (3)]), "&&", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
context->recover();
@@ -2992,15 +3167,15 @@ yyreduce:
}
break;
- case 56:
+ case 57:
{ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
break;
- case 57:
+ case 58:
{
- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
if ((yyval.interm.intermTypedNode) == 0) {
context->binaryOpError((yylsp[(2) - (3)]), "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
context->recover();
@@ -3011,15 +3186,15 @@ yyreduce:
}
break;
- case 58:
+ case 59:
{ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
break;
- case 59:
+ case 60:
{
- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
if ((yyval.interm.intermTypedNode) == 0) {
context->binaryOpError((yylsp[(2) - (3)]), "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
context->recover();
@@ -3030,12 +3205,12 @@ yyreduce:
}
break;
- case 60:
+ case 61:
{ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
break;
- case 61:
+ case 62:
{
if (context->boolErrorCheck((yylsp[(2) - (5)]), (yyvsp[(1) - (5)].interm.intermTypedNode)))
@@ -3053,12 +3228,12 @@ yyreduce:
}
break;
- case 62:
+ case 63:
{ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
break;
- case 63:
+ case 64:
{
if (context->lValueErrorCheck((yylsp[(2) - (3)]), "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)))
@@ -3072,39 +3247,39 @@ yyreduce:
}
break;
- case 64:
+ case 65:
{ (yyval.interm).op = EOpAssign; }
break;
- case 65:
+ case 66:
{ (yyval.interm).op = EOpMulAssign; }
break;
- case 66:
+ case 67:
{ (yyval.interm).op = EOpDivAssign; }
break;
- case 67:
+ case 68:
{ (yyval.interm).op = EOpAddAssign; }
break;
- case 68:
+ case 69:
{ (yyval.interm).op = EOpSubAssign; }
break;
- case 69:
+ case 70:
{
(yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
}
break;
- case 70:
+ case 71:
{
(yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
@@ -3116,7 +3291,7 @@ yyreduce:
}
break;
- case 71:
+ case 72:
{
if (context->constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)))
@@ -3125,7 +3300,16 @@ yyreduce:
}
break;
- case 72:
+ case 73:
+
+ {
+ if (context->enterStructDeclaration((yylsp[(1) - (2)]), *(yyvsp[(1) - (2)].lex).string))
+ context->recover();
+ (yyval.lex) = (yyvsp[(1) - (2)].lex);
+ }
+ break;
+
+ case 74:
{
TFunction &function = *((yyvsp[(1) - (2)].interm).function);
@@ -3156,7 +3340,7 @@ yyreduce:
}
break;
- case 73:
+ case 75:
{
if ((yyvsp[(1) - (2)].interm).intermAggregate)
@@ -3165,7 +3349,7 @@ yyreduce:
}
break;
- case 74:
+ case 76:
{
if (((yyvsp[(2) - (4)].interm.precision) == EbpHigh) && (context->shaderType == SH_FRAGMENT_SHADER) && !context->fragmentPrecisionHigh) {
@@ -3180,7 +3364,39 @@ yyreduce:
}
break;
- case 75:
+ case 77:
+
+ {
+ ES3_ONLY(getQualifierString((yyvsp[(1) - (5)].interm.type).qualifier), (yylsp[(1) - (5)]), "interface blocks");
+ (yyval.interm.intermNode) = context->addInterfaceBlock((yyvsp[(1) - (5)].interm.type), (yylsp[(2) - (5)]), *(yyvsp[(2) - (5)].lex).string, (yyvsp[(3) - (5)].interm.fieldList), NULL, (yyloc), NULL, (yyloc));
+ }
+ break;
+
+ case 78:
+
+ {
+ ES3_ONLY(getQualifierString((yyvsp[(1) - (6)].interm.type).qualifier), (yylsp[(1) - (6)]), "interface blocks");
+ (yyval.interm.intermNode) = context->addInterfaceBlock((yyvsp[(1) - (6)].interm.type), (yylsp[(2) - (6)]), *(yyvsp[(2) - (6)].lex).string, (yyvsp[(3) - (6)].interm.fieldList), (yyvsp[(5) - (6)].lex).string, (yylsp[(5) - (6)]), NULL, (yyloc));
+ }
+ break;
+
+ case 79:
+
+ {
+ ES3_ONLY(getQualifierString((yyvsp[(1) - (9)].interm.type).qualifier), (yylsp[(1) - (9)]), "interface blocks");
+ (yyval.interm.intermNode) = context->addInterfaceBlock((yyvsp[(1) - (9)].interm.type), (yylsp[(2) - (9)]), *(yyvsp[(2) - (9)].lex).string, (yyvsp[(3) - (9)].interm.fieldList), (yyvsp[(5) - (9)].lex).string, (yylsp[(5) - (9)]), (yyvsp[(7) - (9)].interm.intermTypedNode), (yylsp[(6) - (9)]));
+ }
+ break;
+
+ case 80:
+
+ {
+ context->parseGlobalLayoutQualifier((yyvsp[(1) - (2)].interm.type));
+ (yyval.interm.intermNode) = 0;
+ }
+ break;
+
+ case 81:
{
//
@@ -3191,7 +3407,7 @@ yyreduce:
//
// Redeclarations are allowed. But, return types and parameter qualifiers must match.
//
- TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName()));
+ TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName(), context->shaderVersion));
if (prevDec) {
if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) {
context->error((yylsp[(2) - (2)]), "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString());
@@ -3208,7 +3424,7 @@ yyreduce:
//
// Check for previously declared variables using the same name.
//
- TSymbol *prevSym = context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getName());
+ TSymbol *prevSym = context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getName(), context->shaderVersion);
if (prevSym)
{
if (!prevSym->isFunction())
@@ -3236,21 +3452,21 @@ yyreduce:
}
break;
- case 76:
+ case 82:
{
(yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
}
break;
- case 77:
+ case 83:
{
(yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
}
break;
- case 78:
+ case 84:
{
// Add the parameter
@@ -3262,7 +3478,7 @@ yyreduce:
}
break;
- case 79:
+ case 85:
{
//
@@ -3284,7 +3500,7 @@ yyreduce:
}
break;
- case 80:
+ case 86:
{
if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
@@ -3305,7 +3521,7 @@ yyreduce:
}
break;
- case 81:
+ case 87:
{
if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
@@ -3319,7 +3535,7 @@ yyreduce:
}
break;
- case 82:
+ case 88:
{
// Check that we can make an array out of this type
@@ -3340,16 +3556,16 @@ yyreduce:
}
break;
- case 83:
+ case 89:
{
(yyval.interm) = (yyvsp[(3) - (3)].interm);
- if (context->paramErrorCheck((yylsp[(3) - (3)]), (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
+ if (context->paramErrorCheck((yylsp[(3) - (3)]), (yyvsp[(1) - (3)].interm.qualifier), (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
context->recover();
}
break;
- case 84:
+ case 90:
{
(yyval.interm) = (yyvsp[(2) - (2)].interm);
@@ -3360,16 +3576,16 @@ yyreduce:
}
break;
- case 85:
+ case 91:
{
(yyval.interm) = (yyvsp[(3) - (3)].interm);
- if (context->paramErrorCheck((yylsp[(3) - (3)]), (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
+ if (context->paramErrorCheck((yylsp[(3) - (3)]), (yyvsp[(1) - (3)].interm.qualifier), (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
context->recover();
}
break;
- case 86:
+ case 92:
{
(yyval.interm) = (yyvsp[(2) - (2)].interm);
@@ -3380,35 +3596,35 @@ yyreduce:
}
break;
- case 87:
+ case 93:
{
(yyval.interm.qualifier) = EvqIn;
}
break;
- case 88:
+ case 94:
{
(yyval.interm.qualifier) = EvqIn;
}
break;
- case 89:
+ case 95:
{
(yyval.interm.qualifier) = EvqOut;
}
break;
- case 90:
+ case 96:
{
(yyval.interm.qualifier) = EvqInOut;
}
break;
- case 91:
+ case 97:
{
TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) };
@@ -3416,216 +3632,89 @@ yyreduce:
}
break;
- case 92:
+ case 98:
{
(yyval.interm) = (yyvsp[(1) - (1)].interm);
}
break;
- case 93:
+ case 99:
{
- if ((yyvsp[(1) - (3)].interm).type.type == EbtInvariant && !(yyvsp[(3) - (3)].lex).symbol)
- {
- context->error((yylsp[(3) - (3)]), "undeclared identifier declared as invariant", (yyvsp[(3) - (3)].lex).string->c_str());
- context->recover();
- }
-
- TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yylsp[(3) - (3)]));
- (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, symbol, (yylsp[(3) - (3)]));
-
- if (context->structQualifierErrorCheck((yylsp[(3) - (3)]), (yyval.interm).type))
- context->recover();
-
- if (context->nonInitConstErrorCheck((yylsp[(3) - (3)]), *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, false))
- context->recover();
-
- TVariable* variable = 0;
- if (context->nonInitErrorCheck((yylsp[(3) - (3)]), *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, variable))
- context->recover();
- if (symbol && variable)
- symbol->setId(variable->getUniqueId());
+ (yyval.interm) = (yyvsp[(1) - (3)].interm);
+ (yyval.interm).intermAggregate = context->parseDeclarator((yyval.interm).type, (yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].lex).symbol, (yylsp[(3) - (3)]), *(yyvsp[(3) - (3)].lex).string);
}
break;
- case 94:
+ case 100:
{
- if (context->structQualifierErrorCheck((yylsp[(3) - (5)]), (yyvsp[(1) - (5)].interm).type))
- context->recover();
-
- if (context->nonInitConstErrorCheck((yylsp[(3) - (5)]), *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, true))
- context->recover();
-
(yyval.interm) = (yyvsp[(1) - (5)].interm);
-
- if (context->arrayTypeErrorCheck((yylsp[(4) - (5)]), (yyvsp[(1) - (5)].interm).type) || context->arrayQualifierErrorCheck((yylsp[(4) - (5)]), (yyvsp[(1) - (5)].interm).type))
- context->recover();
- else {
- (yyvsp[(1) - (5)].interm).type.setArray(true);
- TVariable* variable;
- if (context->arrayErrorCheck((yylsp[(4) - (5)]), *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable))
- context->recover();
- }
+ context->parseArrayDeclarator((yyval.interm).type, (yylsp[(3) - (5)]), *(yyvsp[(3) - (5)].lex).string, (yylsp[(4) - (5)]), NULL, NULL);
}
break;
- case 95:
+ case 101:
{
- if (context->structQualifierErrorCheck((yylsp[(3) - (6)]), (yyvsp[(1) - (6)].interm).type))
- context->recover();
-
- if (context->nonInitConstErrorCheck((yylsp[(3) - (6)]), *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, true))
- context->recover();
-
(yyval.interm) = (yyvsp[(1) - (6)].interm);
-
- if (context->arrayTypeErrorCheck((yylsp[(4) - (6)]), (yyvsp[(1) - (6)].interm).type) || context->arrayQualifierErrorCheck((yylsp[(4) - (6)]), (yyvsp[(1) - (6)].interm).type))
- context->recover();
- else {
- int size;
- if (context->arraySizeErrorCheck((yylsp[(4) - (6)]), (yyvsp[(5) - (6)].interm.intermTypedNode), size))
- context->recover();
- (yyvsp[(1) - (6)].interm).type.setArray(true, size);
- TVariable* variable = 0;
- if (context->arrayErrorCheck((yylsp[(4) - (6)]), *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable))
- context->recover();
- TType type = TType((yyvsp[(1) - (6)].interm).type);
- type.setArraySize(size);
- (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (6)].interm).intermNode, context->intermediate.addSymbol(variable ? variable->getUniqueId() : 0, *(yyvsp[(3) - (6)].lex).string, type, (yylsp[(3) - (6)])), (yylsp[(3) - (6)]));
- }
+ (yyval.interm).intermAggregate = context->parseArrayDeclarator((yyval.interm).type, (yylsp[(3) - (6)]), *(yyvsp[(3) - (6)].lex).string, (yylsp[(4) - (6)]), (yyvsp[(1) - (6)].interm).intermNode, (yyvsp[(5) - (6)].interm.intermTypedNode));
}
break;
- case 96:
+ case 102:
{
- if (context->structQualifierErrorCheck((yylsp[(3) - (5)]), (yyvsp[(1) - (5)].interm).type))
- context->recover();
-
(yyval.interm) = (yyvsp[(1) - (5)].interm);
-
- TIntermNode* intermNode;
- if (!context->executeInitializer((yylsp[(3) - (5)]), *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) {
- //
- // build the intermediate representation
- //
- if (intermNode)
- (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yylsp[(4) - (5)]));
- else
- (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate;
- } else {
- context->recover();
- (yyval.interm).intermAggregate = 0;
- }
+ (yyval.interm).intermAggregate = context->parseInitDeclarator((yyval.interm).type, (yyvsp[(1) - (5)].interm).intermAggregate, (yylsp[(3) - (5)]), *(yyvsp[(3) - (5)].lex).string, (yylsp[(4) - (5)]), (yyvsp[(5) - (5)].interm.intermTypedNode));
}
break;
- case 97:
+ case 103:
{
(yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
- (yyval.interm).intermAggregate = context->intermediate.makeAggregate(context->intermediate.addSymbol(0, "", TType((yyvsp[(1) - (1)].interm.type)), (yylsp[(1) - (1)])), (yylsp[(1) - (1)]));
+ (yyval.interm).intermAggregate = context->parseSingleDeclaration((yyval.interm).type, (yylsp[(1) - (1)]), "");
}
break;
- case 98:
+ case 104:
{
- TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yylsp[(2) - (2)]));
- (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yylsp[(2) - (2)]));
-
- if (context->structQualifierErrorCheck((yylsp[(2) - (2)]), (yyval.interm).type))
- context->recover();
-
- if (context->nonInitConstErrorCheck((yylsp[(2) - (2)]), *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, false))
- context->recover();
-
- (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
-
- TVariable* variable = 0;
- if (context->nonInitErrorCheck((yylsp[(2) - (2)]), *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, variable))
- context->recover();
- if (variable && symbol)
- symbol->setId(variable->getUniqueId());
+ (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
+ (yyval.interm).intermAggregate = context->parseSingleDeclaration((yyval.interm).type, (yylsp[(2) - (2)]), *(yyvsp[(2) - (2)].lex).string);
}
break;
- case 99:
+ case 105:
{
context->error((yylsp[(2) - (4)]), "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str());
context->recover();
- TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yylsp[(2) - (4)]));
- (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yylsp[(2) - (4)]));
(yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
+ (yyval.interm).intermAggregate = context->parseSingleDeclaration((yyval.interm).type, (yylsp[(2) - (4)]), *(yyvsp[(2) - (4)].lex).string);
}
break;
- case 100:
+ case 106:
{
- TType type = TType((yyvsp[(1) - (5)].interm.type));
- int size;
- if (context->arraySizeErrorCheck((yylsp[(2) - (5)]), (yyvsp[(4) - (5)].interm.intermTypedNode), size))
- context->recover();
- type.setArraySize(size);
- TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yylsp[(2) - (5)]));
- (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yylsp[(2) - (5)]));
-
- if (context->structQualifierErrorCheck((yylsp[(2) - (5)]), (yyvsp[(1) - (5)].interm.type)))
- context->recover();
-
- if (context->nonInitConstErrorCheck((yylsp[(2) - (5)]), *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), true))
- context->recover();
-
(yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
-
- if (context->arrayTypeErrorCheck((yylsp[(3) - (5)]), (yyvsp[(1) - (5)].interm.type)) || context->arrayQualifierErrorCheck((yylsp[(3) - (5)]), (yyvsp[(1) - (5)].interm.type)))
- context->recover();
- else {
- int size;
- if (context->arraySizeErrorCheck((yylsp[(3) - (5)]), (yyvsp[(4) - (5)].interm.intermTypedNode), size))
- context->recover();
-
- (yyvsp[(1) - (5)].interm.type).setArray(true, size);
- TVariable* variable = 0;
- if (context->arrayErrorCheck((yylsp[(3) - (5)]), *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable))
- context->recover();
- if (variable && symbol)
- symbol->setId(variable->getUniqueId());
- }
+ (yyval.interm).intermAggregate = context->parseSingleArrayDeclaration((yyval.interm).type, (yylsp[(2) - (5)]), *(yyvsp[(2) - (5)].lex).string, (yylsp[(3) - (5)]), (yyvsp[(4) - (5)].interm.intermTypedNode));
}
break;
- case 101:
+ case 107:
{
- if (context->structQualifierErrorCheck((yylsp[(2) - (4)]), (yyvsp[(1) - (4)].interm.type)))
- context->recover();
-
(yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
-
- TIntermNode* intermNode;
- if (!context->executeInitializer((yylsp[(2) - (4)]), *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) {
- //
- // Build intermediate representation
- //
- if(intermNode)
- (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yylsp[(3) - (4)]));
- else
- (yyval.interm).intermAggregate = 0;
- } else {
- context->recover();
- (yyval.interm).intermAggregate = 0;
- }
+ (yyval.interm).intermAggregate = context->parseSingleInitDeclaration((yyval.interm).type, (yylsp[(2) - (4)]), *(yyvsp[(2) - (4)].lex).string, (yylsp[(3) - (4)]), (yyvsp[(4) - (4)].interm.intermTypedNode));
}
break;
- case 102:
+ case 108:
{
VERTEX_ONLY("invariant declaration", (yylsp[(1) - (2)]));
@@ -3647,7 +3736,7 @@ yyreduce:
}
break;
- case 103:
+ case 109:
{
(yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
@@ -3660,50 +3749,49 @@ yyreduce:
}
break;
- case 104:
+ case 110:
{
- if ((yyvsp[(2) - (2)].interm.type).array) {
- context->error((yylsp[(2) - (2)]), "not supported", "first-class array");
- context->recover();
- (yyvsp[(2) - (2)].interm.type).setArray(false);
- }
+ (yyval.interm.type) = context->addFullySpecifiedType((yyvsp[(1) - (2)].interm.type).qualifier, (yyvsp[(1) - (2)].interm.type).layoutQualifier, (yyvsp[(2) - (2)].interm.type));
+ }
+ break;
- if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute &&
- ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
- context->error((yylsp[(2) - (2)]), "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier));
- context->recover();
- }
- if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) &&
- ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
- context->error((yylsp[(2) - (2)]), "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier));
- context->recover();
- }
- (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
- (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier;
+ case 111:
+
+ {
+ (yyval.interm.type).qualifier = EvqSmooth;
}
break;
- case 105:
+ case 112:
{
- (yyval.interm.type).setBasic(EbtVoid, EvqConst, (yylsp[(1) - (1)]));
+ (yyval.interm.type).qualifier = EvqFlat;
}
break;
- case 106:
+ case 113:
+
+ {
+ (yyval.interm.qualifier) = EvqConst;
+ }
+ break;
+
+ case 114:
{
VERTEX_ONLY("attribute", (yylsp[(1) - (1)]));
+ ES2_ONLY("attribute", (yylsp[(1) - (1)]));
if (context->globalErrorCheck((yylsp[(1) - (1)]), context->symbolTable.atGlobalLevel(), "attribute"))
context->recover();
(yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yylsp[(1) - (1)]));
}
break;
- case 107:
+ case 115:
{
+ ES2_ONLY("varying", (yylsp[(1) - (1)]));
if (context->globalErrorCheck((yylsp[(1) - (1)]), context->symbolTable.atGlobalLevel(), "varying"))
context->recover();
if (context->shaderType == SH_VERTEX_SHADER)
@@ -3713,9 +3801,10 @@ yyreduce:
}
break;
- case 108:
+ case 116:
{
+ ES2_ONLY("varying", (yylsp[(1) - (2)]));
if (context->globalErrorCheck((yylsp[(1) - (2)]), context->symbolTable.atGlobalLevel(), "invariant varying"))
context->recover();
if (context->shaderType == SH_VERTEX_SHADER)
@@ -3725,16 +3814,111 @@ yyreduce:
}
break;
- case 109:
+ case 117:
+
+ {
+ if ((yyvsp[(1) - (1)].interm.type).qualifier != EvqConst && !context->symbolTable.atGlobalLevel()) {
+ context->error((yylsp[(1) - (1)]), "Local variables can only use the const storage qualifier.", getQualifierString((yyvsp[(1) - (1)].interm.type).qualifier));
+ context->recover();
+ } else {
+ (yyval.interm.type).setBasic(EbtVoid, (yyvsp[(1) - (1)].interm.type).qualifier, (yylsp[(1) - (1)]));
+ }
+ }
+ break;
+
+ case 118:
+
+ {
+ (yyval.interm.type) = context->joinInterpolationQualifiers((yylsp[(1) - (2)]), (yyvsp[(1) - (2)].interm.type).qualifier, (yylsp[(2) - (2)]), (yyvsp[(2) - (2)].interm.type).qualifier);
+ }
+ break;
+
+ case 119:
+
+ {
+ context->error((yylsp[(1) - (1)]), "interpolation qualifier requires a fragment 'in' or vertex 'out' storage qualifier", getInterpolationString((yyvsp[(1) - (1)].interm.type).qualifier));
+ context->recover();
+
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtVoid, qual, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 120:
+
+ {
+ (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).layoutQualifier = (yyvsp[(1) - (1)].interm.layoutQualifier);
+ }
+ break;
+
+ case 121:
+
+ {
+ (yyval.interm.type).setBasic(EbtVoid, (yyvsp[(2) - (2)].interm.type).qualifier, (yylsp[(2) - (2)]));
+ (yyval.interm.type).layoutQualifier = (yyvsp[(1) - (2)].interm.layoutQualifier);
+ }
+ break;
+
+ case 122:
+
+ {
+ (yyval.interm.type).qualifier = EvqConst;
+ }
+ break;
+
+ case 123:
+
+ {
+ ES3_ONLY("in", (yylsp[(1) - (1)]), "storage qualifier");
+ (yyval.interm.type).qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentIn : EvqVertexIn;
+ }
+ break;
+
+ case 124:
+
+ {
+ ES3_ONLY("out", (yylsp[(1) - (1)]), "storage qualifier");
+ (yyval.interm.type).qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentOut : EvqVertexOut;
+ }
+ break;
+
+ case 125:
+
+ {
+ ES3_ONLY("centroid in", (yylsp[(1) - (2)]), "storage qualifier");
+ if (context->shaderType == SH_VERTEX_SHADER)
+ {
+ context->error((yylsp[(1) - (2)]), "invalid storage qualifier", "it is an error to use 'centroid in' in the vertex shader");
+ context->recover();
+ }
+ (yyval.interm.type).qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqCentroidIn : EvqVertexIn;
+ }
+ break;
+
+ case 126:
+
+ {
+ ES3_ONLY("centroid out", (yylsp[(1) - (2)]), "storage qualifier");
+ if (context->shaderType == SH_FRAGMENT_SHADER)
+ {
+ context->error((yylsp[(1) - (2)]), "invalid storage qualifier", "it is an error to use 'centroid out' in the fragment shader");
+ context->recover();
+ }
+ (yyval.interm.type).qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentOut : EvqCentroidOut;
+ }
+ break;
+
+ case 127:
{
if (context->globalErrorCheck((yylsp[(1) - (1)]), context->symbolTable.atGlobalLevel(), "uniform"))
context->recover();
- (yyval.interm.type).setBasic(EbtVoid, EvqUniform, (yylsp[(1) - (1)]));
+ (yyval.interm.type).qualifier = EvqUniform;
}
break;
- case 110:
+ case 128:
{
(yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
@@ -3748,43 +3932,91 @@ yyreduce:
}
break;
- case 111:
+ case 129:
{
(yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
(yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision);
+
+ if (!SupportsPrecision((yyvsp[(2) - (2)].interm.type).type)) {
+ context->error((yylsp[(1) - (2)]), "illegal type for precision qualifier", getBasicString((yyvsp[(2) - (2)].interm.type).type));
+ context->recover();
+ }
}
break;
- case 112:
+ case 130:
{
(yyval.interm.precision) = EbpHigh;
}
break;
- case 113:
+ case 131:
{
(yyval.interm.precision) = EbpMedium;
}
break;
- case 114:
+ case 132:
{
(yyval.interm.precision) = EbpLow;
}
break;
- case 115:
+ case 133:
+
+ {
+ ES3_ONLY("layout", (yylsp[(1) - (4)]), "qualifier");
+ (yyval.interm.layoutQualifier) = (yyvsp[(3) - (4)].interm.layoutQualifier);
+ }
+ break;
+
+ case 134:
+
+ {
+ (yyval.interm.layoutQualifier) = (yyvsp[(1) - (1)].interm.layoutQualifier);
+ }
+ break;
+
+ case 135:
+
+ {
+ (yyval.interm.layoutQualifier) = context->joinLayoutQualifiers((yyvsp[(1) - (3)].interm.layoutQualifier), (yyvsp[(3) - (3)].interm.layoutQualifier));
+ }
+ break;
+
+ case 136:
+
+ {
+ (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(*(yyvsp[(1) - (1)].lex).string, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 137:
+
+ {
+ (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(*(yyvsp[(1) - (3)].lex).string, (yylsp[(1) - (3)]), *(yyvsp[(3) - (3)].lex).string, (yyvsp[(3) - (3)].lex).i, (yylsp[(3) - (3)]));
+ }
+ break;
+
+ case 138:
+
+ {
+ (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(*(yyvsp[(1) - (3)].lex).string, (yylsp[(1) - (3)]), *(yyvsp[(3) - (3)].lex).string, (yyvsp[(3) - (3)].lex).i, (yylsp[(3) - (3)]));
+ }
+ break;
+
+ case 139:
{
(yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
}
break;
- case 116:
+ case 140:
{
(yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
@@ -3800,7 +4032,7 @@ yyreduce:
}
break;
- case 117:
+ case 141:
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
@@ -3808,7 +4040,7 @@ yyreduce:
}
break;
- case 118:
+ case 142:
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
@@ -3816,7 +4048,7 @@ yyreduce:
}
break;
- case 119:
+ case 143:
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
@@ -3824,7 +4056,15 @@ yyreduce:
}
break;
- case 120:
+ case 144:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtUInt, qual, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 145:
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
@@ -3832,7 +4072,7 @@ yyreduce:
}
break;
- case 121:
+ case 146:
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
@@ -3841,7 +4081,7 @@ yyreduce:
}
break;
- case 122:
+ case 147:
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
@@ -3850,7 +4090,7 @@ yyreduce:
}
break;
- case 123:
+ case 148:
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
@@ -3859,7 +4099,7 @@ yyreduce:
}
break;
- case 124:
+ case 149:
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
@@ -3868,7 +4108,7 @@ yyreduce:
}
break;
- case 125:
+ case 150:
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
@@ -3877,7 +4117,7 @@ yyreduce:
}
break;
- case 126:
+ case 151:
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
@@ -3886,7 +4126,7 @@ yyreduce:
}
break;
- case 127:
+ case 152:
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
@@ -3895,7 +4135,7 @@ yyreduce:
}
break;
- case 128:
+ case 153:
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
@@ -3904,7 +4144,7 @@ yyreduce:
}
break;
- case 129:
+ case 154:
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
@@ -3913,34 +4153,115 @@ yyreduce:
}
break;
- case 130:
+ case 155:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtUInt, qual, (yylsp[(1) - (1)]));
+ (yyval.interm.type).setAggregate(2);
+ }
+ break;
+
+ case 156:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtUInt, qual, (yylsp[(1) - (1)]));
+ (yyval.interm.type).setAggregate(3);
+ }
+ break;
+
+ case 157:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtUInt, qual, (yylsp[(1) - (1)]));
+ (yyval.interm.type).setAggregate(4);
+ }
+ break;
+
+ case 158:
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
(yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
- (yyval.interm.type).setAggregate(2, true);
+ (yyval.interm.type).setMatrix(2, 2);
}
break;
- case 131:
+ case 159:
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
(yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
- (yyval.interm.type).setAggregate(3, true);
+ (yyval.interm.type).setMatrix(3, 3);
}
break;
- case 132:
+ case 160:
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
(yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
- (yyval.interm.type).setAggregate(4, true);
+ (yyval.interm.type).setMatrix(4, 4);
}
break;
- case 133:
+ case 161:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
+ (yyval.interm.type).setMatrix(2, 3);
+ }
+ break;
+
+ case 162:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
+ (yyval.interm.type).setMatrix(3, 2);
+ }
+ break;
+
+ case 163:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
+ (yyval.interm.type).setMatrix(2, 4);
+ }
+ break;
+
+ case 164:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
+ (yyval.interm.type).setMatrix(4, 2);
+ }
+ break;
+
+ case 165:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
+ (yyval.interm.type).setMatrix(3, 4);
+ }
+ break;
+
+ case 166:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
+ (yyval.interm.type).setMatrix(4, 3);
+ }
+ break;
+
+ case 167:
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
@@ -3948,7 +4269,15 @@ yyreduce:
}
break;
- case 134:
+ case 168:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtSampler3D, qual, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 169:
{
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
@@ -3956,7 +4285,103 @@ yyreduce:
}
break;
- case 135:
+ case 170:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtSampler2DArray, qual, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 171:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtISampler2D, qual, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 172:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtISampler3D, qual, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 173:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtISamplerCube, qual, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 174:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtISampler2DArray, qual, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 175:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtUSampler2D, qual, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 176:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtUSampler3D, qual, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 177:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtUSamplerCube, qual, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 178:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtUSampler2DArray, qual, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 179:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtSampler2DShadow, qual, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 180:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtSamplerCubeShadow, qual, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 181:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtSampler2DArrayShadow, qual, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 182:
{
if (!context->supportsExtension("GL_OES_EGL_image_external")) {
@@ -3968,7 +4393,7 @@ yyreduce:
}
break;
- case 136:
+ case 183:
{
if (!context->supportsExtension("GL_ARB_texture_rectangle")) {
@@ -3980,7 +4405,7 @@ yyreduce:
}
break;
- case 137:
+ case 184:
{
(yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
@@ -3988,7 +4413,7 @@ yyreduce:
}
break;
- case 138:
+ case 185:
{
//
@@ -4002,52 +4427,38 @@ yyreduce:
}
break;
- case 139:
+ case 186:
{ if (context->enterStructDeclaration((yylsp[(2) - (3)]), *(yyvsp[(2) - (3)].lex).string)) context->recover(); }
break;
- case 140:
+ case 187:
{
- if (context->reservedErrorCheck((yylsp[(2) - (6)]), *(yyvsp[(2) - (6)].lex).string))
- context->recover();
-
- TType* structure = new TType(new TStructure((yyvsp[(2) - (6)].lex).string, (yyvsp[(5) - (6)].interm.fieldList)));
- TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true);
- if (! context->symbolTable.insert(*userTypeDef)) {
- context->error((yylsp[(2) - (6)]), "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct");
- context->recover();
- }
- (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yylsp[(1) - (6)]));
- (yyval.interm.type).userDef = structure;
- context->exitStructDeclaration();
+ (yyval.interm.type) = context->addStructure((yylsp[(1) - (6)]), (yylsp[(2) - (6)]), (yyvsp[(2) - (6)].lex).string, (yyvsp[(5) - (6)].interm.fieldList));
}
break;
- case 141:
+ case 188:
{ if (context->enterStructDeclaration((yylsp[(2) - (2)]), *(yyvsp[(2) - (2)].lex).string)) context->recover(); }
break;
- case 142:
+ case 189:
{
- TType* structure = new TType(new TStructure(NewPoolTString(""), (yyvsp[(4) - (5)].interm.fieldList)));
- (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yylsp[(1) - (5)]));
- (yyval.interm.type).userDef = structure;
- context->exitStructDeclaration();
+ (yyval.interm.type) = context->addStructure((yylsp[(1) - (5)]), (yyloc), NewPoolTString(""), (yyvsp[(4) - (5)].interm.fieldList));
}
break;
- case 143:
+ case 190:
{
(yyval.interm.fieldList) = (yyvsp[(1) - (1)].interm.fieldList);
}
break;
- case 144:
+ case 191:
{
(yyval.interm.fieldList) = (yyvsp[(1) - (2)].interm.fieldList);
@@ -4064,41 +4475,24 @@ yyreduce:
}
break;
- case 145:
+ case 192:
{
- (yyval.interm.fieldList) = (yyvsp[(2) - (3)].interm.fieldList);
+ (yyval.interm.fieldList) = context->addStructDeclaratorList((yyvsp[(1) - (3)].interm.type), (yyvsp[(2) - (3)].interm.fieldList));
+ }
+ break;
- if (context->voidErrorCheck((yylsp[(1) - (3)]), (*(yyvsp[(2) - (3)].interm.fieldList))[0]->name(), (yyvsp[(1) - (3)].interm.type))) {
- context->recover();
- }
- for (unsigned int i = 0; i < (yyval.interm.fieldList)->size(); ++i) {
- //
- // Careful not to replace already known aspects of type, like array-ness
- //
- TType* type = (*(yyval.interm.fieldList))[i]->type();
- type->setBasicType((yyvsp[(1) - (3)].interm.type).type);
- type->setNominalSize((yyvsp[(1) - (3)].interm.type).size);
- type->setMatrix((yyvsp[(1) - (3)].interm.type).matrix);
- type->setPrecision((yyvsp[(1) - (3)].interm.type).precision);
-
- // don't allow arrays of arrays
- if (type->isArray()) {
- if (context->arrayTypeErrorCheck((yylsp[(1) - (3)]), (yyvsp[(1) - (3)].interm.type)))
- context->recover();
- }
- if ((yyvsp[(1) - (3)].interm.type).array)
- type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize);
- if ((yyvsp[(1) - (3)].interm.type).userDef)
- type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct());
+ case 193:
- if (context->structNestingErrorCheck((yylsp[(1) - (3)]), *(*(yyval.interm.fieldList))[i]))
- context->recover();
- }
+ {
+ // ES3 Only, but errors should be handled elsewhere
+ (yyvsp[(2) - (4)].interm.type).qualifier = (yyvsp[(1) - (4)].interm.type).qualifier;
+ (yyvsp[(2) - (4)].interm.type).layoutQualifier = (yyvsp[(1) - (4)].interm.type).layoutQualifier;
+ (yyval.interm.fieldList) = context->addStructDeclaratorList((yyvsp[(2) - (4)].interm.type), (yyvsp[(3) - (4)].interm.fieldList));
}
break;
- case 146:
+ case 194:
{
(yyval.interm.fieldList) = NewPoolTFieldList();
@@ -4106,101 +4500,101 @@ yyreduce:
}
break;
- case 147:
+ case 195:
{
(yyval.interm.fieldList)->push_back((yyvsp[(3) - (3)].interm.field));
}
break;
- case 148:
+ case 196:
{
if (context->reservedErrorCheck((yylsp[(1) - (1)]), *(yyvsp[(1) - (1)].lex).string))
context->recover();
TType* type = new TType(EbtVoid, EbpUndefined);
- (yyval.interm.field) = new TField(type, (yyvsp[(1) - (1)].lex).string);
+ (yyval.interm.field) = new TField(type, (yyvsp[(1) - (1)].lex).string, (yylsp[(1) - (1)]));
}
break;
- case 149:
+ case 197:
{
if (context->reservedErrorCheck((yylsp[(1) - (4)]), *(yyvsp[(1) - (4)].lex).string))
context->recover();
TType* type = new TType(EbtVoid, EbpUndefined);
- int size = 0;
+ int size;
if (context->arraySizeErrorCheck((yylsp[(3) - (4)]), (yyvsp[(3) - (4)].interm.intermTypedNode), size))
context->recover();
type->setArraySize(size);
- (yyval.interm.field) = new TField(type, (yyvsp[(1) - (4)].lex).string);
+ (yyval.interm.field) = new TField(type, (yyvsp[(1) - (4)].lex).string, (yylsp[(1) - (4)]));
}
break;
- case 150:
+ case 198:
{ (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
break;
- case 151:
+ case 199:
{ (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
break;
- case 152:
+ case 200:
{ (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); }
break;
- case 153:
+ case 201:
{ (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
break;
- case 154:
+ case 202:
{ (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
break;
- case 155:
+ case 203:
{ (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
break;
- case 156:
+ case 204:
{ (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
break;
- case 157:
+ case 205:
{ (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
break;
- case 158:
+ case 206:
{ (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
break;
- case 159:
+ case 207:
{ (yyval.interm.intermAggregate) = 0; }
break;
- case 160:
+ case 208:
{ context->symbolTable.push(); }
break;
- case 161:
+ case 209:
{ context->symbolTable.pop(); }
break;
- case 162:
+ case 210:
{
if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
@@ -4211,44 +4605,44 @@ yyreduce:
}
break;
- case 163:
+ case 211:
{ (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
break;
- case 164:
+ case 212:
{ (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
break;
- case 165:
+ case 213:
{ context->symbolTable.push(); }
break;
- case 166:
+ case 214:
{ context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
break;
- case 167:
+ case 215:
{ context->symbolTable.push(); }
break;
- case 168:
+ case 216:
{ context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
break;
- case 169:
+ case 217:
{
(yyval.interm.intermNode) = 0;
}
break;
- case 170:
+ case 218:
{
if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
@@ -4259,31 +4653,31 @@ yyreduce:
}
break;
- case 171:
+ case 219:
{
(yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), (yyloc));
}
break;
- case 172:
+ case 220:
{
(yyval.interm.intermAggregate) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermAggregate), (yyvsp[(2) - (2)].interm.intermNode), (yyloc));
}
break;
- case 173:
+ case 221:
{ (yyval.interm.intermNode) = 0; }
break;
- case 174:
+ case 222:
{ (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); }
break;
- case 175:
+ case 223:
{
if (context->boolErrorCheck((yylsp[(1) - (5)]), (yyvsp[(3) - (5)].interm.intermTypedNode)))
@@ -4292,7 +4686,7 @@ yyreduce:
}
break;
- case 176:
+ case 224:
{
(yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode);
@@ -4300,7 +4694,7 @@ yyreduce:
}
break;
- case 177:
+ case 225:
{
(yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
@@ -4308,7 +4702,7 @@ yyreduce:
}
break;
- case 178:
+ case 226:
{
(yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
@@ -4317,7 +4711,7 @@ yyreduce:
}
break;
- case 179:
+ case 227:
{
TIntermNode* intermNode;
@@ -4335,12 +4729,12 @@ yyreduce:
}
break;
- case 180:
+ case 228:
{ context->symbolTable.push(); ++context->loopNestingLevel; }
break;
- case 181:
+ case 229:
{
context->symbolTable.pop();
@@ -4349,12 +4743,12 @@ yyreduce:
}
break;
- case 182:
+ case 230:
{ ++context->loopNestingLevel; }
break;
- case 183:
+ case 231:
{
if (context->boolErrorCheck((yylsp[(8) - (8)]), (yyvsp[(6) - (8)].interm.intermTypedNode)))
@@ -4365,12 +4759,12 @@ yyreduce:
}
break;
- case 184:
+ case 232:
{ context->symbolTable.push(); ++context->loopNestingLevel; }
break;
- case 185:
+ case 233:
{
context->symbolTable.pop();
@@ -4379,35 +4773,35 @@ yyreduce:
}
break;
- case 186:
+ case 234:
{
(yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
}
break;
- case 187:
+ case 235:
{
(yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
}
break;
- case 188:
+ case 236:
{
(yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
}
break;
- case 189:
+ case 237:
{
(yyval.interm.intermTypedNode) = 0;
}
break;
- case 190:
+ case 238:
{
(yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode);
@@ -4415,7 +4809,7 @@ yyreduce:
}
break;
- case 191:
+ case 239:
{
(yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
@@ -4423,7 +4817,7 @@ yyreduce:
}
break;
- case 192:
+ case 240:
{
if (context->loopNestingLevel <= 0) {
@@ -4434,7 +4828,7 @@ yyreduce:
}
break;
- case 193:
+ case 241:
{
if (context->loopNestingLevel <= 0) {
@@ -4445,7 +4839,7 @@ yyreduce:
}
break;
- case 194:
+ case 242:
{
(yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yylsp[(1) - (2)]));
@@ -4456,7 +4850,7 @@ yyreduce:
}
break;
- case 195:
+ case 243:
{
(yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yylsp[(1) - (3)]));
@@ -4471,7 +4865,7 @@ yyreduce:
}
break;
- case 196:
+ case 244:
{
FRAG_ONLY("discard", (yylsp[(1) - (2)]));
@@ -4479,7 +4873,7 @@ yyreduce:
}
break;
- case 197:
+ case 245:
{
(yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
@@ -4487,7 +4881,7 @@ yyreduce:
}
break;
- case 198:
+ case 246:
{
(yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), (yyloc));
@@ -4495,26 +4889,26 @@ yyreduce:
}
break;
- case 199:
+ case 247:
{
(yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
}
break;
- case 200:
+ case 248:
{
(yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
}
break;
- case 201:
+ case 249:
{
TFunction* function = (yyvsp[(1) - (1)].interm).function;
- const TSymbol *builtIn = context->symbolTable.findBuiltIn(function->getMangledName());
+ const TSymbol *builtIn = context->symbolTable.findBuiltIn(function->getMangledName(), context->shaderVersion);
if (builtIn)
{
@@ -4522,7 +4916,7 @@ yyreduce:
context->recover();
}
- TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
+ TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName(), context->shaderVersion));
//
// Note: 'prevDec' could be 'function' if this is the first time we've seen function
// as it would have just been put in the symbol table. Otherwise, we're looking up
@@ -4573,7 +4967,7 @@ yyreduce:
//
// Insert the parameters with name in the symbol table.
//
- if (! context->symbolTable.insert(*variable)) {
+ if (! context->symbolTable.declare(*variable)) {
context->error((yylsp[(1) - (1)]), "redefinition", variable->getName().c_str());
context->recover();
delete variable;
@@ -4585,9 +4979,8 @@ yyreduce:
paramNodes = context->intermediate.growAggregate(
paramNodes,
context->intermediate.addSymbol(variable->getUniqueId(),
- variable->getName(),
- variable->getType(),
- (yylsp[(1) - (1)])),
+ variable->getName(),
+ variable->getType(), (yylsp[(1) - (1)])),
(yylsp[(1) - (1)]));
} else {
paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yylsp[(1) - (1)])), (yylsp[(1) - (1)]));
@@ -4599,7 +4992,7 @@ yyreduce:
}
break;
- case 202:
+ case 250:
{
//?? Check that all paths return a value if return type != void ?
diff --git a/chromium/third_party/angle/src/compiler/glslang_tab.h b/chromium/third_party/angle/src/compiler/translator/glslang_tab.h
index 07d0b15f4ae..c6a61dcd85f 100644
--- a/chromium/third_party/angle/src/compiler/glslang_tab.h
+++ b/chromium/third_party/angle/src/compiler/translator/glslang_tab.h
@@ -1,8 +1,8 @@
-/* A Bison parser, made by GNU Bison 2.7. */
+/* A Bison parser, made by GNU Bison 2.7.1. */
/* Bison interface for Yacc-like parsers in C
- Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -44,7 +44,6 @@ extern int yydebug;
#define YYLTYPE TSourceLoc
#define YYLTYPE_IS_DECLARED 1
-#define SH_MAX_TOKEN_LENGTH 256 // WebGL spec.
@@ -65,88 +64,121 @@ extern int yydebug;
BOOL_TYPE = 265,
FLOAT_TYPE = 266,
INT_TYPE = 267,
- BREAK = 268,
- CONTINUE = 269,
- DO = 270,
- ELSE = 271,
- FOR = 272,
- IF = 273,
- DISCARD = 274,
- RETURN = 275,
- BVEC2 = 276,
- BVEC3 = 277,
- BVEC4 = 278,
- IVEC2 = 279,
- IVEC3 = 280,
- IVEC4 = 281,
- VEC2 = 282,
- VEC3 = 283,
- VEC4 = 284,
- MATRIX2 = 285,
- MATRIX3 = 286,
- MATRIX4 = 287,
- IN_QUAL = 288,
- OUT_QUAL = 289,
- INOUT_QUAL = 290,
- UNIFORM = 291,
- VARYING = 292,
- STRUCT = 293,
- VOID_TYPE = 294,
- WHILE = 295,
- SAMPLER2D = 296,
- SAMPLERCUBE = 297,
- SAMPLER_EXTERNAL_OES = 298,
- SAMPLER2DRECT = 299,
- IDENTIFIER = 300,
- TYPE_NAME = 301,
- FLOATCONSTANT = 302,
- INTCONSTANT = 303,
- BOOLCONSTANT = 304,
- LEFT_OP = 305,
- RIGHT_OP = 306,
- INC_OP = 307,
- DEC_OP = 308,
- LE_OP = 309,
- GE_OP = 310,
- EQ_OP = 311,
- NE_OP = 312,
- AND_OP = 313,
- OR_OP = 314,
- XOR_OP = 315,
- MUL_ASSIGN = 316,
- DIV_ASSIGN = 317,
- ADD_ASSIGN = 318,
- MOD_ASSIGN = 319,
- LEFT_ASSIGN = 320,
- RIGHT_ASSIGN = 321,
- AND_ASSIGN = 322,
- XOR_ASSIGN = 323,
- OR_ASSIGN = 324,
- SUB_ASSIGN = 325,
- LEFT_PAREN = 326,
- RIGHT_PAREN = 327,
- LEFT_BRACKET = 328,
- RIGHT_BRACKET = 329,
- LEFT_BRACE = 330,
- RIGHT_BRACE = 331,
- DOT = 332,
- COMMA = 333,
- COLON = 334,
- EQUAL = 335,
- SEMICOLON = 336,
- BANG = 337,
- DASH = 338,
- TILDE = 339,
- PLUS = 340,
- STAR = 341,
- SLASH = 342,
- PERCENT = 343,
- LEFT_ANGLE = 344,
- RIGHT_ANGLE = 345,
- VERTICAL_BAR = 346,
- CARET = 347,
- AMPERSAND = 348,
- QUESTION = 349
+ UINT_TYPE = 268,
+ BREAK = 269,
+ CONTINUE = 270,
+ DO = 271,
+ ELSE = 272,
+ FOR = 273,
+ IF = 274,
+ DISCARD = 275,
+ RETURN = 276,
+ SWITCH = 277,
+ CASE = 278,
+ DEFAULT = 279,
+ BVEC2 = 280,
+ BVEC3 = 281,
+ BVEC4 = 282,
+ IVEC2 = 283,
+ IVEC3 = 284,
+ IVEC4 = 285,
+ VEC2 = 286,
+ VEC3 = 287,
+ VEC4 = 288,
+ UVEC2 = 289,
+ UVEC3 = 290,
+ UVEC4 = 291,
+ MATRIX2 = 292,
+ MATRIX3 = 293,
+ MATRIX4 = 294,
+ IN_QUAL = 295,
+ OUT_QUAL = 296,
+ INOUT_QUAL = 297,
+ UNIFORM = 298,
+ VARYING = 299,
+ MATRIX2x3 = 300,
+ MATRIX3x2 = 301,
+ MATRIX2x4 = 302,
+ MATRIX4x2 = 303,
+ MATRIX3x4 = 304,
+ MATRIX4x3 = 305,
+ CENTROID = 306,
+ FLAT = 307,
+ SMOOTH = 308,
+ STRUCT = 309,
+ VOID_TYPE = 310,
+ WHILE = 311,
+ SAMPLER2D = 312,
+ SAMPLERCUBE = 313,
+ SAMPLER_EXTERNAL_OES = 314,
+ SAMPLER2DRECT = 315,
+ SAMPLER2DARRAY = 316,
+ ISAMPLER2D = 317,
+ ISAMPLER3D = 318,
+ ISAMPLERCUBE = 319,
+ ISAMPLER2DARRAY = 320,
+ USAMPLER2D = 321,
+ USAMPLER3D = 322,
+ USAMPLERCUBE = 323,
+ USAMPLER2DARRAY = 324,
+ SAMPLER3D = 325,
+ SAMPLER3DRECT = 326,
+ SAMPLER2DSHADOW = 327,
+ SAMPLERCUBESHADOW = 328,
+ SAMPLER2DARRAYSHADOW = 329,
+ LAYOUT = 330,
+ IDENTIFIER = 331,
+ TYPE_NAME = 332,
+ FLOATCONSTANT = 333,
+ INTCONSTANT = 334,
+ UINTCONSTANT = 335,
+ BOOLCONSTANT = 336,
+ FIELD_SELECTION = 337,
+ LEFT_OP = 338,
+ RIGHT_OP = 339,
+ INC_OP = 340,
+ DEC_OP = 341,
+ LE_OP = 342,
+ GE_OP = 343,
+ EQ_OP = 344,
+ NE_OP = 345,
+ AND_OP = 346,
+ OR_OP = 347,
+ XOR_OP = 348,
+ MUL_ASSIGN = 349,
+ DIV_ASSIGN = 350,
+ ADD_ASSIGN = 351,
+ MOD_ASSIGN = 352,
+ LEFT_ASSIGN = 353,
+ RIGHT_ASSIGN = 354,
+ AND_ASSIGN = 355,
+ XOR_ASSIGN = 356,
+ OR_ASSIGN = 357,
+ SUB_ASSIGN = 358,
+ LEFT_PAREN = 359,
+ RIGHT_PAREN = 360,
+ LEFT_BRACKET = 361,
+ RIGHT_BRACKET = 362,
+ LEFT_BRACE = 363,
+ RIGHT_BRACE = 364,
+ DOT = 365,
+ COMMA = 366,
+ COLON = 367,
+ EQUAL = 368,
+ SEMICOLON = 369,
+ BANG = 370,
+ DASH = 371,
+ TILDE = 372,
+ PLUS = 373,
+ STAR = 374,
+ SLASH = 375,
+ PERCENT = 376,
+ LEFT_ANGLE = 377,
+ RIGHT_ANGLE = 378,
+ VERTICAL_BAR = 379,
+ CARET = 380,
+ AMPERSAND = 381,
+ QUESTION = 382
};
#endif
@@ -161,6 +193,7 @@ typedef union YYSTYPE
TString *string;
float f;
int i;
+ unsigned int u;
bool b;
};
TSymbol* symbol;
@@ -176,6 +209,7 @@ typedef union YYSTYPE
union {
TPublicType type;
TPrecision precision;
+ TLayoutQualifier layoutQualifier;
TQualifier qualifier;
TFunction* function;
TParameter param;
diff --git a/chromium/third_party/angle/src/compiler/intermOut.cpp b/chromium/third_party/angle/src/compiler/translator/intermOut.cpp
index 13aa96af6d6..7f94ac31416 100644
--- a/chromium/third_party/angle/src/compiler/intermOut.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/intermOut.cpp
@@ -1,10 +1,11 @@
//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-#include "compiler/localintermediate.h"
+#include "compiler/translator/localintermediate.h"
+#include "compiler/translator/SymbolTable.h"
//
// Two purposes:
@@ -43,10 +44,10 @@ TString TType::getCompleteString() const
stream << getQualifierString() << " " << getPrecisionString() << " ";
if (array)
stream << "array[" << getArraySize() << "] of ";
- if (matrix)
- stream << size << "X" << size << " matrix of ";
- else if (size > 1)
- stream << size << "-component vector of ";
+ if (isMatrix())
+ stream << getCols() << "X" << getRows() << " matrix of ";
+ else if (isVector())
+ stream << getNominalSize() << "-component vector of ";
stream << getBasicString();
return stream.str();
@@ -103,6 +104,7 @@ bool TOutputTraverser::visitBinary(Visit visit, TIntermBinary* node)
case EOpIndexDirect: out << "direct index"; break;
case EOpIndexIndirect: out << "indirect index"; break;
case EOpIndexDirectStruct: out << "direct index for structure"; break;
+ case EOpIndexDirectInterfaceBlock: out << "direct index for interface block"; break;
case EOpVectorSwizzle: out << "vector swizzle"; break;
case EOpAdd: out << "add"; break;
@@ -152,11 +154,16 @@ bool TOutputTraverser::visitUnary(Visit visit, TIntermUnary* node)
case EOpPreDecrement: out << "Pre-Decrement"; break;
case EOpConvIntToBool: out << "Convert int to bool"; break;
+ case EOpConvUIntToBool: out << "Convert uint to bool"; break;
case EOpConvFloatToBool:out << "Convert float to bool";break;
case EOpConvBoolToFloat:out << "Convert bool to float";break;
case EOpConvIntToFloat: out << "Convert int to float"; break;
+ case EOpConvUIntToFloat:out << "Convert uint to float";break;
case EOpConvFloatToInt: out << "Convert float to int"; break;
case EOpConvBoolToInt: out << "Convert bool to int"; break;
+ case EOpConvIntToUInt: out << "Convert int to uint"; break;
+ case EOpConvFloatToUInt:out << "Convert float to uint";break;
+ case EOpConvBoolToUInt: out << "Convert bool to uint"; break;
case EOpRadians: out << "radians"; break;
case EOpDegrees: out << "degrees"; break;
@@ -232,6 +239,10 @@ bool TOutputTraverser::visitAggregate(Visit visit, TIntermAggregate* node)
case EOpConstructIVec2: out << "Construct ivec2"; break;
case EOpConstructIVec3: out << "Construct ivec3"; break;
case EOpConstructIVec4: out << "Construct ivec4"; break;
+ case EOpConstructUInt: out << "Construct uint"; break;
+ case EOpConstructUVec2: out << "Construct uvec2"; break;
+ case EOpConstructUVec3: out << "Construct uvec3"; break;
+ case EOpConstructUVec4: out << "Construct uvec4"; break;
case EOpConstructMat2: out << "Construct mat2"; break;
case EOpConstructMat3: out << "Construct mat3"; break;
case EOpConstructMat4: out << "Construct mat4"; break;
@@ -338,6 +349,10 @@ void TOutputTraverser::visitConstantUnion(TIntermConstantUnion* node)
out << node->getUnionArrayPointer()[i].getIConst();
out << " (const int)\n";
break;
+ case EbtUInt:
+ out << node->getUnionArrayPointer()[i].getUConst();
+ out << " (const uint)\n";
+ break;
default:
out.message(EPrefixInternalError, node->getLine(), "Unknown constant");
break;
diff --git a/chromium/third_party/angle/src/compiler/intermediate.h b/chromium/third_party/angle/src/compiler/translator/intermediate.h
index 3f2ea14542f..2fdde02e0f6 100644
--- a/chromium/third_party/angle/src/compiler/intermediate.h
+++ b/chromium/third_party/angle/src/compiler/translator/intermediate.h
@@ -19,9 +19,10 @@
#include "GLSLANG/ShaderLang.h"
#include <algorithm>
-#include "compiler/Common.h"
-#include "compiler/Types.h"
-#include "compiler/ConstantUnion.h"
+#include <queue>
+#include "compiler/translator/Common.h"
+#include "compiler/translator/Types.h"
+#include "compiler/translator/ConstantUnion.h"
//
// Operators used by the high-level (parse tree) representation.
@@ -50,11 +51,17 @@ enum TOperator {
EOpPreDecrement,
EOpConvIntToBool,
+ EOpConvUIntToBool,
EOpConvFloatToBool,
EOpConvBoolToFloat,
EOpConvIntToFloat,
+ EOpConvUIntToFloat,
EOpConvFloatToInt,
EOpConvBoolToInt,
+ EOpConvUIntToInt,
+ EOpConvIntToUInt,
+ EOpConvFloatToUInt,
+ EOpConvBoolToUInt,
//
// binary operations
@@ -86,6 +93,7 @@ enum TOperator {
EOpIndexDirect,
EOpIndexIndirect,
EOpIndexDirectStruct,
+ EOpIndexDirectInterfaceBlock,
EOpVectorSwizzle,
@@ -155,6 +163,7 @@ enum TOperator {
//
EOpConstructInt,
+ EOpConstructUInt,
EOpConstructBool,
EOpConstructFloat,
EOpConstructVec2,
@@ -166,6 +175,9 @@ enum TOperator {
EOpConstructIVec2,
EOpConstructIVec3,
EOpConstructIVec4,
+ EOpConstructUVec2,
+ EOpConstructUVec3,
+ EOpConstructUVec4,
EOpConstructMat2,
EOpConstructMat3,
EOpConstructMat4,
@@ -199,6 +211,7 @@ class TIntermTyped;
class TIntermSymbol;
class TIntermLoop;
class TInfoSink;
+class TIntermRaw;
//
// Base class for the tree nodes
@@ -226,12 +239,17 @@ public:
virtual TIntermSelection* getAsSelectionNode() { return 0; }
virtual TIntermSymbol* getAsSymbolNode() { return 0; }
virtual TIntermLoop* getAsLoopNode() { return 0; }
+ virtual TIntermRaw* getAsRawNode() { return 0; }
// Replace a child node. Return true if |original| is a child
// node and it is replaced; otherwise, return false.
virtual bool replaceChildNode(
TIntermNode *original, TIntermNode *replacement) = 0;
+ // For traversing a tree in no particular order, but using
+ // heap memory.
+ virtual void enqueueChildren(std::queue<TIntermNode*> *nodeQueue) const = 0;
+
protected:
TSourceLoc line;
};
@@ -261,18 +279,21 @@ public:
TBasicType getBasicType() const { return type.getBasicType(); }
TQualifier getQualifier() const { return type.getQualifier(); }
TPrecision getPrecision() const { return type.getPrecision(); }
+ int getCols() const { return type.getCols(); }
+ int getRows() const { return type.getRows(); }
int getNominalSize() const { return type.getNominalSize(); }
+ int getSecondarySize() const { return type.getSecondarySize(); }
+ bool isInterfaceBlock() const { return type.isInterfaceBlock(); }
bool isMatrix() const { return type.isMatrix(); }
bool isArray() const { return type.isArray(); }
bool isVector() const { return type.isVector(); }
bool isScalar() const { return type.isScalar(); }
+ bool isScalarInt() const { return type.isScalarInt(); }
const char* getBasicString() const { return type.getBasicString(); }
const char* getQualifierString() const { return type.getQualifierString(); }
TString getCompleteString() const { return type.getCompleteString(); }
- int totalRegisterCount() const { return type.totalRegisterCount(); }
- int elementRegisterCount() const { return type.elementRegisterCount(); }
int getArraySize() const { return type.getArraySize(); }
protected:
@@ -314,6 +335,8 @@ public:
void setUnrollFlag(bool flag) { unrollFlag = flag; }
bool getUnrollFlag() { return unrollFlag; }
+ virtual void enqueueChildren(std::queue<TIntermNode*> *nodeQueue) const;
+
protected:
TLoopType type;
TIntermNode* init; // for-loop initialization
@@ -340,6 +363,8 @@ public:
TOperator getFlowOp() { return flowOp; }
TIntermTyped* getExpression() { return expression; }
+ virtual void enqueueChildren(std::queue<TIntermNode*> *nodeQueue) const;
+
protected:
TOperator flowOp;
TIntermTyped* expression; // non-zero except for "return exp;" statements
@@ -354,7 +379,7 @@ public:
// per process globalpoolallocator, then it causes increased memory usage per compile
// it is essential to use "symbol = sym" to assign to symbol
TIntermSymbol(int i, const TString& sym, const TType& t) :
- TIntermTyped(t), id(i) { symbol = sym; originalSymbol = sym; }
+ TIntermTyped(t), id(i) { symbol = sym; }
virtual bool hasSideEffects() const { return false; }
@@ -362,18 +387,39 @@ public:
const TString& getSymbol() const { return symbol; }
void setId(int newId) { id = newId; }
- void setSymbol(const TString& sym) { symbol = sym; }
-
- const TString& getOriginalSymbol() const { return originalSymbol; }
virtual void traverse(TIntermTraverser*);
virtual TIntermSymbol* getAsSymbolNode() { return this; }
virtual bool replaceChildNode(TIntermNode *, TIntermNode *) { return false; }
+ virtual void enqueueChildren(std::queue<TIntermNode*> *nodeQueue) const {}
+
protected:
int id;
TString symbol;
- TString originalSymbol;
+};
+
+// A Raw node stores raw code, that the translator will insert verbatim
+// into the output stream. Useful for transformation operations that make
+// complex code that might not fit naturally into the GLSL model.
+class TIntermRaw : public TIntermTyped {
+public:
+ TIntermRaw(const TType &t, const TString &rawTextIn)
+ : TIntermTyped(t), rawText(rawTextIn)
+ {}
+
+ virtual bool hasSideEffects() const { return false; }
+
+ TString getRawText() const { return rawText; }
+
+ virtual void traverse(TIntermTraverser*);
+
+ virtual TIntermRaw* getAsRawNode() { return this; }
+ virtual bool replaceChildNode(TIntermNode *, TIntermNode *) { return false; }
+ virtual void enqueueChildren(std::queue<TIntermNode*> *nodeQueue) const {}
+
+protected:
+ TString rawText;
};
class TIntermConstantUnion : public TIntermTyped {
@@ -385,6 +431,7 @@ public:
ConstantUnion* getUnionArrayPointer() const { return unionArrayPointer; }
int getIConst(size_t index) const { return unionArrayPointer ? unionArrayPointer[index].getIConst() : 0; }
+ unsigned int getUConst(size_t index) const { return unionArrayPointer ? unionArrayPointer[index].getUConst() : 0; }
float getFConst(size_t index) const { return unionArrayPointer ? unionArrayPointer[index].getFConst() : 0.0f; }
bool getBConst(size_t index) const { return unionArrayPointer ? unionArrayPointer[index].getBConst() : false; }
@@ -394,6 +441,8 @@ public:
TIntermTyped* fold(TOperator, TIntermTyped*, TInfoSink&);
+ virtual void enqueueChildren(std::queue<TIntermNode*> *nodeQueue) const {}
+
protected:
ConstantUnion *unionArrayPointer;
};
@@ -413,7 +462,7 @@ public:
protected:
TIntermOperator(TOperator o) : TIntermTyped(TType(EbtFloat, EbpUndefined)), op(o) {}
- TIntermOperator(TOperator o, TType& t) : TIntermTyped(t), op(o) {}
+ TIntermOperator(TOperator o, const TType& t) : TIntermTyped(t), op(o) {}
TOperator op;
};
@@ -440,6 +489,8 @@ public:
void setAddIndexClamp() { addIndexClamp = true; }
bool getAddIndexClamp() { return addIndexClamp; }
+ virtual void enqueueChildren(std::queue<TIntermNode*> *nodeQueue) const;
+
protected:
TIntermTyped* left;
TIntermTyped* right;
@@ -453,7 +504,7 @@ protected:
//
class TIntermUnary : public TIntermOperator {
public:
- TIntermUnary(TOperator o, TType& t) : TIntermOperator(o, t), operand(0), useEmulatedFunction(false) {}
+ TIntermUnary(TOperator o, const TType& t) : TIntermOperator(o, t), operand(0), useEmulatedFunction(false) {}
TIntermUnary(TOperator o) : TIntermOperator(o), operand(0), useEmulatedFunction(false) {}
virtual void traverse(TIntermTraverser*);
@@ -470,6 +521,8 @@ public:
void setUseEmulatedFunction() { useEmulatedFunction = true; }
bool getUseEmulatedFunction() { return useEmulatedFunction; }
+ virtual void enqueueChildren(std::queue<TIntermNode*> *nodeQueue) const;
+
protected:
TIntermTyped* operand;
@@ -514,6 +567,8 @@ public:
void setUseEmulatedFunction() { useEmulatedFunction = true; }
bool getUseEmulatedFunction() { return useEmulatedFunction; }
+ virtual void enqueueChildren(std::queue<TIntermNode*> *nodeQueue) const;
+
protected:
TIntermAggregate(const TIntermAggregate&); // disallow copy constructor
TIntermAggregate& operator=(const TIntermAggregate&); // disallow assignment operator
@@ -552,6 +607,8 @@ public:
TIntermNode* getFalseBlock() const { return falseBlock; }
TIntermSelection* getAsSelectionNode() { return this; }
+ virtual void enqueueChildren(std::queue<TIntermNode*> *nodeQueue) const;
+
protected:
TIntermTyped* condition;
TIntermNode* trueBlock;
@@ -587,6 +644,7 @@ public:
virtual ~TIntermTraverser() {}
virtual void visitSymbol(TIntermSymbol*) {}
+ virtual void visitRaw(TIntermRaw*) {}
virtual void visitConstantUnion(TIntermConstantUnion*) {}
virtual bool visitBinary(Visit visit, TIntermBinary*) {return true;}
virtual bool visitUnary(Visit visit, TIntermUnary*) {return true;}
@@ -632,4 +690,30 @@ protected:
TVector<TIntermNode *> path;
};
+//
+// For traversing the tree, and computing max depth.
+// Takes a maximum depth limit to prevent stack overflow.
+//
+class TMaxDepthTraverser : public TIntermTraverser
+{
+public:
+ POOL_ALLOCATOR_NEW_DELETE();
+ TMaxDepthTraverser(int depthLimit)
+ : TIntermTraverser(true, true, false, false),
+ depthLimit(depthLimit)
+ {}
+
+ virtual bool visitBinary(Visit visit, TIntermBinary*) { return depthCheck(); }
+ virtual bool visitUnary(Visit visit, TIntermUnary*) { return depthCheck(); }
+ virtual bool visitSelection(Visit visit, TIntermSelection*) { return depthCheck(); }
+ virtual bool visitAggregate(Visit visit, TIntermAggregate*) { return depthCheck(); }
+ virtual bool visitLoop(Visit visit, TIntermLoop*) { return depthCheck(); }
+ virtual bool visitBranch(Visit visit, TIntermBranch*) { return depthCheck(); }
+
+protected:
+ int depthLimit;
+
+ bool depthCheck() const { return maxDepth < depthLimit; }
+};
+
#endif // __INTERMEDIATE_H
diff --git a/chromium/third_party/angle/src/compiler/preprocessor/length_limits.h b/chromium/third_party/angle/src/compiler/translator/length_limits.h
index 4f1f71319fc..df70ee5d84a 100644
--- a/chromium/third_party/angle/src/compiler/preprocessor/length_limits.h
+++ b/chromium/third_party/angle/src/compiler/translator/length_limits.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2011 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2011-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -11,11 +11,11 @@
#if !defined(__LENGTH_LIMITS_H)
#define __LENGTH_LIMITS_H 1
+#include "GLSLANG/ShaderLang.h"
+
// These constants are factored out from the rest of the headers to
// make it easier to reference them from the compiler sources.
-// These lengths do not include the NULL terminator.
-#define MAX_SYMBOL_NAME_LEN 256
-#define MAX_STRING_LEN 511
+size_t GetGlobalMaxTokenSize(ShShaderSpec spec);
#endif // !(defined(__LENGTH_LIMITS_H)
diff --git a/chromium/third_party/angle/src/compiler/localintermediate.h b/chromium/third_party/angle/src/compiler/translator/localintermediate.h
index ccbc40178ac..125dcd989a2 100644
--- a/chromium/third_party/angle/src/compiler/localintermediate.h
+++ b/chromium/third_party/angle/src/compiler/translator/localintermediate.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -7,9 +7,7 @@
#ifndef _LOCAL_INTERMEDIATE_INCLUDED_
#define _LOCAL_INTERMEDIATE_INCLUDED_
-#include "GLSLANG/ShaderLang.h"
-#include "compiler/intermediate.h"
-#include "compiler/SymbolTable.h"
+#include "compiler/translator/intermediate.h"
struct TVectorFields {
int offsets[4];
@@ -27,10 +25,10 @@ public:
TIntermSymbol* addSymbol(int Id, const TString&, const TType&, const TSourceLoc&);
TIntermTyped* addConversion(TOperator, const TType&, TIntermTyped*);
- TIntermTyped* addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc&, TSymbolTable&);
+ TIntermTyped* addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc&);
TIntermTyped* addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc&);
TIntermTyped* addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index, const TSourceLoc&);
- TIntermTyped* addUnaryMath(TOperator op, TIntermNode* child, const TSourceLoc&, TSymbolTable&);
+ TIntermTyped* addUnaryMath(TOperator op, TIntermNode* child, const TSourceLoc&);
TIntermAggregate* growAggregate(TIntermNode* left, TIntermNode* right, const TSourceLoc&);
TIntermAggregate* makeAggregate(TIntermNode* node, const TSourceLoc&);
TIntermAggregate* setAggregateOperator(TIntermNode*, TOperator, const TSourceLoc&);
@@ -39,13 +37,13 @@ public:
TIntermTyped* addComma(TIntermTyped* left, TIntermTyped* right, const TSourceLoc&);
TIntermConstantUnion* addConstantUnion(ConstantUnion*, const TType&, const TSourceLoc&);
TIntermTyped* promoteConstantUnion(TBasicType, TIntermConstantUnion*) ;
- bool parseConstTree(const TSourceLoc&, TIntermNode*, ConstantUnion*, TOperator, TSymbolTable&, TType, bool singleConstantParam = false);
+ bool parseConstTree(const TSourceLoc&, TIntermNode*, ConstantUnion*, TOperator, TType, bool singleConstantParam = false);
TIntermNode* addLoop(TLoopType, TIntermNode*, TIntermTyped*, TIntermTyped*, TIntermNode*, const TSourceLoc&);
TIntermBranch* addBranch(TOperator, const TSourceLoc&);
TIntermBranch* addBranch(TOperator, TIntermTyped*, const TSourceLoc&);
TIntermTyped* addSwizzle(TVectorFields&, const TSourceLoc&);
bool postProcess(TIntermNode*);
- void remove(TIntermNode*);
+ void remove(TIntermNode*);
void outputTree(TIntermNode*);
private:
diff --git a/chromium/third_party/angle/src/compiler/osinclude.h b/chromium/third_party/angle/src/compiler/translator/osinclude.h
index d8bb1a797c4..c3063d624a8 100644
--- a/chromium/third_party/angle/src/compiler/osinclude.h
+++ b/chromium/third_party/angle/src/compiler/translator/osinclude.h
@@ -16,6 +16,7 @@
#define ANGLE_OS_WIN
#elif defined(__APPLE__) || defined(__linux__) || \
defined(__FreeBSD__) || defined(__OpenBSD__) || \
+ defined(__NetBSD__) || defined(__DragonFly__) || \
defined(__sun) || defined(ANDROID) || \
defined(__GLIBC__) || defined(__GNU__) || \
defined(__QNX__)
@@ -35,7 +36,7 @@
#endif // ANGLE_OS_WIN
-#include "compiler/debug.h"
+#include "compiler/translator/compilerdebug.h"
//
// Thread Local Storage Operations
diff --git a/chromium/third_party/angle/src/compiler/ossource_posix.cpp b/chromium/third_party/angle/src/compiler/translator/ossource_posix.cpp
index 1e1e699aebc..90a37574441 100644
--- a/chromium/third_party/angle/src/compiler/ossource_posix.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/ossource_posix.cpp
@@ -7,7 +7,7 @@
//
// This file contains the posix specific functions
//
-#include "compiler/osinclude.h"
+#include "compiler/translator/osinclude.h"
#if !defined(ANGLE_OS_POSIX)
#error Trying to build a posix specific file in a non-posix build.
diff --git a/chromium/third_party/angle/src/compiler/ossource_win.cpp b/chromium/third_party/angle/src/compiler/translator/ossource_win.cpp
index 89922fef3f4..2cc5871b71d 100644
--- a/chromium/third_party/angle/src/compiler/ossource_win.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/ossource_win.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/osinclude.h"
+#include "compiler/translator/osinclude.h"
//
// This file contains contains the window's specific functions
//
diff --git a/chromium/third_party/angle/src/compiler/parseConst.cpp b/chromium/third_party/angle/src/compiler/translator/parseConst.cpp
index 65ed115cbcb..33617e53d9a 100644
--- a/chromium/third_party/angle/src/compiler/parseConst.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/parseConst.cpp
@@ -1,10 +1,10 @@
//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-#include "compiler/ParseContext.h"
+#include "compiler/translator/ParseContext.h"
//
// Use this class to carry along data from node to node in
@@ -12,7 +12,7 @@
//
class TConstTraverser : public TIntermTraverser {
public:
- TConstTraverser(ConstantUnion* cUnion, bool singleConstParam, TOperator constructType, TInfoSink& sink, TSymbolTable& symTable, TType& t)
+ TConstTraverser(ConstantUnion* cUnion, bool singleConstParam, TOperator constructType, TInfoSink& sink, TType& t)
: error(false),
index(0),
unionArray(cUnion),
@@ -20,10 +20,10 @@ public:
constructorType(constructType),
singleConstantParam(singleConstParam),
infoSink(sink),
- symbolTable(symTable),
size(0),
- isMatrix(false),
- matrixSize(0) {
+ isDiagonalMatrixInit(false),
+ matrixCols(0),
+ matrixRows(0) {
}
bool error;
@@ -44,10 +44,10 @@ protected:
TOperator constructorType;
bool singleConstantParam;
TInfoSink& infoSink;
- TSymbolTable& symbolTable;
size_t size; // size of the constructor ( 4 for vec4)
- bool isMatrix;
- size_t matrixSize; // dimension of the matrix (nominal size and not the instance size)
+ bool isDiagonalMatrixInit;
+ int matrixCols; // columns of the matrix
+ int matrixRows; // rows of the matrix
};
//
@@ -118,8 +118,9 @@ bool TConstTraverser::visitAggregate(Visit visit, TIntermAggregate* node)
size = node->getType().getObjectSize();
if (node->getType().isMatrix()) {
- isMatrix = true;
- matrixSize = node->getType().getNominalSize();
+ isDiagonalMatrixInit = true;
+ matrixCols = node->getType().getCols();
+ matrixRows = node->getType().getRows();
}
}
@@ -136,8 +137,9 @@ bool TConstTraverser::visitAggregate(Visit visit, TIntermAggregate* node)
singleConstantParam = false;
constructorType = EOpNull;
size = 0;
- isMatrix = false;
- matrixSize = 0;
+ isDiagonalMatrixInit = false;
+ matrixCols = 0;
+ matrixRows = 0;
}
return false;
}
@@ -165,10 +167,10 @@ void TConstTraverser::visitConstantUnion(TIntermConstantUnion* node)
return;
if (!singleConstantParam) {
- size_t size = node->getType().getObjectSize();
+ size_t objectSize = node->getType().getObjectSize();
ConstantUnion *rightUnionArray = node->getUnionArrayPointer();
- for (size_t i = 0; i < size; i++) {
+ for (size_t i=0; i < objectSize; i++) {
if (index >= instanceSize)
return;
leftUnionArray[index] = rightUnionArray[i];
@@ -178,8 +180,8 @@ void TConstTraverser::visitConstantUnion(TIntermConstantUnion* node)
} else {
size_t totalSize = index + size;
ConstantUnion *rightUnionArray = node->getUnionArrayPointer();
- if (!isMatrix) {
- size_t count = 0;
+ if (!isDiagonalMatrixInit) {
+ int count = 0;
for (size_t i = index; i < totalSize; i++) {
if (i >= instanceSize)
return;
@@ -191,21 +193,25 @@ void TConstTraverser::visitConstantUnion(TIntermConstantUnion* node)
if (node->getType().getObjectSize() > 1)
count++;
}
- } else { // for matrix constructors
- size_t count = 0;
- size_t element = index;
- for (size_t i = index; i < totalSize; i++) {
- if (i >= instanceSize)
- return;
- if (element - i == 0 || (i - element) % (matrixSize + 1) == 0 )
- leftUnionArray[i] = rightUnionArray[count];
- else
- leftUnionArray[i].setFConst(0.0f);
-
- (index)++;
-
- if (node->getType().getObjectSize() > 1)
- count++;
+ }
+ else
+ {
+ // for matrix diagonal constructors from a single scalar
+ for (int i = 0, col = 0; col < matrixCols; col++)
+ {
+ for (int row = 0; row < matrixRows; row++, i++)
+ {
+ if (col == row)
+ {
+ leftUnionArray[i] = rightUnionArray[0];
+ }
+ else
+ {
+ leftUnionArray[i].setFConst(0.0f);
+ }
+
+ (index)++;
+ }
}
}
}
@@ -230,12 +236,12 @@ bool TConstTraverser::visitBranch(Visit visit, TIntermBranch* node)
// Individual functions can be initialized to 0 to skip processing of that
// type of node. It's children will still be processed.
//
-bool TIntermediate::parseConstTree(const TSourceLoc& line, TIntermNode* root, ConstantUnion* unionArray, TOperator constructorType, TSymbolTable& symbolTable, TType t, bool singleConstantParam)
+bool TIntermediate::parseConstTree(const TSourceLoc& line, TIntermNode* root, ConstantUnion* unionArray, TOperator constructorType, TType t, bool singleConstantParam)
{
if (root == 0)
return false;
- TConstTraverser it(unionArray, singleConstantParam, constructorType, infoSink, symbolTable, t);
+ TConstTraverser it(unionArray, singleConstantParam, constructorType, infoSink, t);
root->traverse(&it);
if (it.error)
diff --git a/chromium/third_party/angle/src/compiler/timing/RestrictFragmentShaderTiming.cpp b/chromium/third_party/angle/src/compiler/translator/timing/RestrictFragmentShaderTiming.cpp
index b9d2bab17f8..48d44c72d17 100644
--- a/chromium/third_party/angle/src/compiler/timing/RestrictFragmentShaderTiming.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/timing/RestrictFragmentShaderTiming.cpp
@@ -4,10 +4,10 @@
// found in the LICENSE file.
//
-#include "compiler/InfoSink.h"
-#include "compiler/ParseContext.h"
-#include "compiler/depgraph/DependencyGraphOutput.h"
-#include "compiler/timing/RestrictFragmentShaderTiming.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/ParseContext.h"
+#include "compiler/translator/depgraph/DependencyGraphOutput.h"
+#include "compiler/translator/timing/RestrictFragmentShaderTiming.h"
RestrictFragmentShaderTiming::RestrictFragmentShaderTiming(TInfoSinkBase& sink)
: mSink(sink)
@@ -31,6 +31,15 @@ RestrictFragmentShaderTiming::RestrictFragmentShaderTiming(TInfoSinkBase& sink)
mSamplingOps.insert("texture2DRect(1;vf2;");
mSamplingOps.insert("texture2DRectProj(1;vf3;");
mSamplingOps.insert("texture2DRectProj(1;vf4;");
+ // Sampling ops provided by EXT_shader_texture_lod.
+ mSamplingOps.insert("texture2DLodEXT(1;vf2;f1;");
+ mSamplingOps.insert("texture2DProjLodEXT(1;vf3;f1;");
+ mSamplingOps.insert("texture2DProjLodEXT(1;vf4;f1;");
+ mSamplingOps.insert("textureCubeLodEXT(1;vf4;f1;");
+ mSamplingOps.insert("texture2DGradEXT(1;vf2;vf2;vf2;");
+ mSamplingOps.insert("texture2DProjGradEXT(1;vf3;vf2;vf2;");
+ mSamplingOps.insert("texture2DProjGradEXT(1;vf4;vf2;vf2;");
+ mSamplingOps.insert("textureCubeGradEXT(1;vf3;vf3;vf3;");
}
// FIXME(mvujovic): We do not know if the execution time of built-in operations like sin, pow, etc.
diff --git a/chromium/third_party/angle/src/compiler/timing/RestrictFragmentShaderTiming.h b/chromium/third_party/angle/src/compiler/translator/timing/RestrictFragmentShaderTiming.h
index 899165ca287..e77d8c21cbc 100644
--- a/chromium/third_party/angle/src/compiler/timing/RestrictFragmentShaderTiming.h
+++ b/chromium/third_party/angle/src/compiler/translator/timing/RestrictFragmentShaderTiming.h
@@ -7,10 +7,8 @@
#ifndef COMPILER_TIMING_RESTRICT_FRAGMENT_SHADER_TIMING_H_
#define COMPILER_TIMING_RESTRICT_FRAGMENT_SHADER_TIMING_H_
-#include "GLSLANG/ShaderLang.h"
-
-#include "compiler/intermediate.h"
-#include "compiler/depgraph/DependencyGraph.h"
+#include "compiler/translator/intermediate.h"
+#include "compiler/translator/depgraph/DependencyGraph.h"
class TInfoSinkBase;
diff --git a/chromium/third_party/angle/src/compiler/timing/RestrictVertexShaderTiming.cpp b/chromium/third_party/angle/src/compiler/translator/timing/RestrictVertexShaderTiming.cpp
index 355eb62d650..7c1208a2986 100644
--- a/chromium/third_party/angle/src/compiler/timing/RestrictVertexShaderTiming.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/timing/RestrictVertexShaderTiming.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/timing/RestrictVertexShaderTiming.h"
+#include "compiler/translator/timing/RestrictVertexShaderTiming.h"
void RestrictVertexShaderTiming::visitSymbol(TIntermSymbol* node)
{
@@ -12,6 +12,6 @@ void RestrictVertexShaderTiming::visitSymbol(TIntermSymbol* node)
++mNumErrors;
mSink.message(EPrefixError,
node->getLine(),
- "Samplers are not permitted in vertex shaders");
+ "Samplers are not permitted in vertex shaders.\n");
}
}
diff --git a/chromium/third_party/angle/src/compiler/timing/RestrictVertexShaderTiming.h b/chromium/third_party/angle/src/compiler/translator/timing/RestrictVertexShaderTiming.h
index 19a05fa68bc..d461fbdbfea 100644
--- a/chromium/third_party/angle/src/compiler/timing/RestrictVertexShaderTiming.h
+++ b/chromium/third_party/angle/src/compiler/translator/timing/RestrictVertexShaderTiming.h
@@ -7,10 +7,8 @@
#ifndef COMPILER_TIMING_RESTRICT_VERTEX_SHADER_TIMING_H_
#define COMPILER_TIMING_RESTRICT_VERTEX_SHADER_TIMING_H_
-#include "GLSLANG/ShaderLang.h"
-
-#include "compiler/intermediate.h"
-#include "compiler/InfoSink.h"
+#include "compiler/translator/intermediate.h"
+#include "compiler/translator/InfoSink.h"
class TInfoSinkBase;
diff --git a/chromium/third_party/angle/src/compiler/util.cpp b/chromium/third_party/angle/src/compiler/translator/util.cpp
index d6e5eeed91f..077bdcc48b8 100644
--- a/chromium/third_party/angle/src/compiler/util.cpp
+++ b/chromium/third_party/angle/src/compiler/translator/util.cpp
@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
-#include "compiler/util.h"
+#include "compiler/translator/util.h"
#include <limits>
diff --git a/chromium/third_party/angle/src/compiler/util.h b/chromium/third_party/angle/src/compiler/translator/util.h
index dc69f39060d..dc69f39060d 100644
--- a/chromium/third_party/angle/src/compiler/util.h
+++ b/chromium/third_party/angle/src/compiler/translator/util.h
diff --git a/chromium/third_party/angle/src/copy_compiler_dll.bat b/chromium/third_party/angle/src/copy_compiler_dll.bat
new file mode 100644
index 00000000000..72aeffcb96a
--- /dev/null
+++ b/chromium/third_party/angle/src/copy_compiler_dll.bat
@@ -0,0 +1,4 @@
+@echo off
+set _arch=%1
+set _arch=%_arch:Win32=x86%
+copy %2"\Redist\D3D\"%_arch%"\d3dcompiler_46.dll" %3 > NUL
diff --git a/chromium/third_party/angle/src/libEGL.gypi b/chromium/third_party/angle/src/libEGL.gypi
new file mode 100644
index 00000000000..f5def3ff08d
--- /dev/null
+++ b/chromium/third_party/angle/src/libEGL.gypi
@@ -0,0 +1,60 @@
+# Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'conditions':
+ [
+ ['OS=="win"',
+ {
+ 'targets':
+ [
+ {
+ 'target_name': 'libEGL',
+ 'type': 'shared_library',
+ 'dependencies': [ 'libGLESv2', 'commit_id' ],
+ 'include_dirs':
+ [
+ '.',
+ '../include',
+ 'libGLESv2',
+ ],
+ 'sources':
+ [
+ '<!@(python <(angle_path)/enumerate_files.py \
+ -dirs common libEGL ../include \
+ -types *.cpp *.h *.def *.rc)',
+ ],
+ 'defines':
+ [
+ 'GL_APICALL=',
+ 'GL_GLEXT_PROTOTYPES=',
+ 'EGLAPI=',
+ ],
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'msvs_settings':
+ {
+ 'VCLinkerTool':
+ {
+ 'AdditionalDependencies':
+ [
+ 'd3d9.lib',
+ ],
+ },
+ },
+ 'configurations':
+ {
+ 'Debug':
+ {
+ 'defines':
+ [
+ 'ANGLE_ENABLE_PERF',
+ ],
+ },
+ },
+ },
+ ],
+ },
+ ],
+ ],
+}
diff --git a/chromium/third_party/angle/src/libEGL/Config.cpp b/chromium/third_party/angle/src/libEGL/Config.cpp
index 5488cb6f4f1..0b47d55e2cf 100644
--- a/chromium/third_party/angle/src/libEGL/Config.cpp
+++ b/chromium/third_party/angle/src/libEGL/Config.cpp
@@ -13,8 +13,11 @@
#include <algorithm>
#include <vector>
+#include <GLES3/gl3.h>
+#include <GLES3/gl3ext.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
+#include <EGL/eglext.h>
#include "common/debug.h"
@@ -36,6 +39,13 @@ Config::Config(rx::ConfigDesc desc, EGLint minInterval, EGLint maxInterval, EGLi
mBlueSize = 5;
mAlphaSize = 1;
break;
+ case GL_BGR5_A1_ANGLEX:
+ mBufferSize = 16;
+ mRedSize = 5;
+ mGreenSize = 5;
+ mBlueSize = 5;
+ mAlphaSize = 1;
+ break;
case GL_RGBA8_OES:
mBufferSize = 32;
mRedSize = 8;
@@ -122,6 +132,12 @@ Config::Config(rx::ConfigDesc desc, EGLint minInterval, EGLint maxInterval, EGLi
mTransparentRedValue = 0;
mTransparentGreenValue = 0;
mTransparentBlueValue = 0;
+
+ if (desc.es3Capable)
+ {
+ mRenderableType |= EGL_OPENGL_ES3_BIT_KHR;
+ mConformant |= EGL_OPENGL_ES3_BIT_KHR;
+ }
}
EGLConfig Config::getHandle() const
diff --git a/chromium/third_party/angle/src/libEGL/Display.cpp b/chromium/third_party/angle/src/libEGL/Display.cpp
index 8f2af794643..07b2daca849 100644
--- a/chromium/third_party/angle/src/libEGL/Display.cpp
+++ b/chromium/third_party/angle/src/libEGL/Display.cpp
@@ -15,7 +15,7 @@
#include <vector>
#include "common/debug.h"
-#include "libGLESv2/mathutil.h"
+#include "common/mathutil.h"
#include "libGLESv2/main.h"
#include "libGLESv2/Context.h"
#include "libGLESv2/renderer/SwapChain.h"
@@ -191,6 +191,10 @@ EGLSurface Display::createWindowSurface(HWND window, EGLConfig config, const EGL
const Config *configuration = mConfigSet.get(config);
EGLint postSubBufferSupported = EGL_FALSE;
+ EGLint width = 0;
+ EGLint height = 0;
+ EGLint fixedSize = EGL_FALSE;
+
if (attribList)
{
while (*attribList != EGL_NONE)
@@ -211,6 +215,15 @@ EGLSurface Display::createWindowSurface(HWND window, EGLConfig config, const EGL
case EGL_POST_SUB_BUFFER_SUPPORTED_NV:
postSubBufferSupported = attribList[1];
break;
+ case EGL_WIDTH:
+ width = attribList[1];
+ break;
+ case EGL_HEIGHT:
+ height = attribList[1];
+ break;
+ case EGL_FIXED_SIZE_ANGLE:
+ fixedSize = attribList[1];
+ break;
case EGL_VG_COLORSPACE:
return error(EGL_BAD_MATCH, EGL_NO_SURFACE);
case EGL_VG_ALPHA_FORMAT:
@@ -223,6 +236,17 @@ EGLSurface Display::createWindowSurface(HWND window, EGLConfig config, const EGL
}
}
+ if (width < 0 || height < 0)
+ {
+ return error(EGL_BAD_PARAMETER, EGL_NO_SURFACE);
+ }
+
+ if (!fixedSize)
+ {
+ width = -1;
+ height = -1;
+ }
+
if (hasExistingWindowSurface(window))
{
return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
@@ -234,7 +258,7 @@ EGLSurface Display::createWindowSurface(HWND window, EGLConfig config, const EGL
return EGL_NO_SURFACE;
}
- Surface *surface = new Surface(this, configuration, window, postSubBufferSupported);
+ Surface *surface = new Surface(this, configuration, window, fixedSize, width, height, postSubBufferSupported);
if (!surface->initialize())
{
@@ -360,22 +384,29 @@ EGLSurface Display::createOffscreenSurface(EGLConfig config, HANDLE shareHandle,
return success(surface);
}
-EGLContext Display::createContext(EGLConfig configHandle, const gl::Context *shareContext, bool notifyResets, bool robustAccess)
+EGLContext Display::createContext(EGLConfig configHandle, EGLint clientVersion, const gl::Context *shareContext, bool notifyResets, bool robustAccess)
{
if (!mRenderer)
{
- return NULL;
+ return EGL_NO_CONTEXT;
}
else if (mRenderer->testDeviceLost(false)) // Lost device
{
if (!restoreLostDevice())
- return NULL;
+ {
+ return error(EGL_CONTEXT_LOST, EGL_NO_CONTEXT);
+ }
}
- gl::Context *context = glCreateContext(shareContext, mRenderer, notifyResets, robustAccess);
+ if (clientVersion > 2 && mRenderer->getMajorShaderModel() < 4)
+ {
+ return error(EGL_BAD_CONFIG, EGL_NO_CONTEXT);
+ }
+
+ gl::Context *context = glCreateContext(clientVersion, shareContext, mRenderer, notifyResets, robustAccess);
mContextSet.insert(context);
- return context;
+ return success(context);
}
bool Display::restoreLostDevice()
@@ -471,7 +502,6 @@ bool Display::hasExistingWindowSurface(HWND window)
void Display::initExtensionString()
{
- HMODULE swiftShader = GetModuleHandle(TEXT("swiftshader_d3d9.dll"));
bool shareHandleSupported = mRenderer->getShareHandleSupport();
mExtensionString = "";
@@ -487,10 +517,7 @@ void Display::initExtensionString()
mExtensionString += "EGL_ANGLE_query_surface_pointer ";
- if (swiftShader)
- {
- mExtensionString += "EGL_ANGLE_software_display ";
- }
+ mExtensionString += "EGL_ANGLE_window_fixed_size ";
if (shareHandleSupported)
{
@@ -499,9 +526,12 @@ void Display::initExtensionString()
if (mRenderer->getPostSubBufferSupport())
{
- mExtensionString += "EGL_NV_post_sub_buffer";
+ mExtensionString += "EGL_NV_post_sub_buffer ";
}
+ // TODO: complete support for the EGL_KHR_create_context extension
+ mExtensionString += "EGL_KHR_create_context ";
+
std::string::size_type end = mExtensionString.find_last_not_of(' ');
if (end != std::string::npos)
{
diff --git a/chromium/third_party/angle/src/libEGL/Display.h b/chromium/third_party/angle/src/libEGL/Display.h
index 58c3940331b..e394260e318 100644
--- a/chromium/third_party/angle/src/libEGL/Display.h
+++ b/chromium/third_party/angle/src/libEGL/Display.h
@@ -11,8 +11,6 @@
#ifndef LIBEGL_DISPLAY_H_
#define LIBEGL_DISPLAY_H_
-#include "common/system.h"
-
#include <set>
#include <vector>
@@ -42,7 +40,7 @@ class Display
EGLSurface createWindowSurface(HWND window, EGLConfig config, const EGLint *attribList);
EGLSurface createOffscreenSurface(EGLConfig config, HANDLE shareHandle, const EGLint *attribList);
- EGLContext createContext(EGLConfig configHandle, const gl::Context *shareContext, bool notifyResets, bool robustAccess);
+ EGLContext createContext(EGLConfig configHandle, EGLint clientVersion, const gl::Context *shareContext, bool notifyResets, bool robustAccess);
void destroySurface(egl::Surface *surface);
void destroyContext(gl::Context *context);
diff --git a/chromium/third_party/angle/src/libEGL/Surface.cpp b/chromium/third_party/angle/src/libEGL/Surface.cpp
index 01b40171791..13b0f208a31 100644
--- a/chromium/third_party/angle/src/libEGL/Surface.cpp
+++ b/chromium/third_party/angle/src/libEGL/Surface.cpp
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -25,7 +25,7 @@
namespace egl
{
-Surface::Surface(Display *display, const Config *config, HWND window, EGLint postSubBufferSupported)
+Surface::Surface(Display *display, const Config *config, HWND window, EGLint fixedSize, EGLint width, EGLint height, EGLint postSubBufferSupported)
: mDisplay(display), mConfig(config), mWindow(window), mPostSubBufferSupported(postSubBufferSupported)
{
mRenderer = mDisplay->getRenderer();
@@ -39,9 +39,10 @@ Surface::Surface(Display *display, const Config *config, HWND window, EGLint pos
mRenderBuffer = EGL_BACK_BUFFER;
mSwapBehavior = EGL_BUFFER_PRESERVED;
mSwapInterval = -1;
- mWidth = -1;
- mHeight = -1;
+ mWidth = width;
+ mHeight = height;
setSwapInterval(1);
+ mFixedSize = fixedSize;
subclassWindow();
}
@@ -61,6 +62,8 @@ Surface::Surface(Display *display, const Config *config, HANDLE shareHandle, EGL
mSwapBehavior = EGL_BUFFER_PRESERVED;
mSwapInterval = -1;
setSwapInterval(1);
+ // This constructor is for offscreen surfaces, which are always fixed-size.
+ mFixedSize = EGL_TRUE;
}
Surface::~Surface()
@@ -96,7 +99,7 @@ bool Surface::resetSwapChain()
int width;
int height;
- if (mWindow)
+ if (!mFixedSize)
{
RECT windowRect;
if (!GetClientRect(getWindowHandle(), &windowRect))
@@ -140,7 +143,7 @@ bool Surface::resizeSwapChain(int backbufferWidth, int backbufferHeight)
ASSERT(backbufferWidth >= 0 && backbufferHeight >= 0);
ASSERT(mSwapChain);
- EGLint status = mSwapChain->resize(backbufferWidth, backbufferHeight);
+ EGLint status = mSwapChain->resize(std::max(1, backbufferWidth), std::max(1, backbufferHeight));
if (status == EGL_CONTEXT_LOST)
{
@@ -163,7 +166,7 @@ bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
ASSERT(backbufferWidth >= 0 && backbufferHeight >= 0);
ASSERT(mSwapChain);
- EGLint status = mSwapChain->reset(backbufferWidth, backbufferHeight, mSwapInterval);
+ EGLint status = mSwapChain->reset(std::max(1, backbufferWidth), std::max(1, backbufferHeight), mSwapInterval);
if (status == EGL_CONTEXT_LOST)
{
@@ -289,6 +292,7 @@ void Surface::unsubclassWindow()
if(parentWndFunc)
{
LONG_PTR prevWndFunc = SetWindowLongPtr(mWindow, GWLP_WNDPROC, parentWndFunc);
+ UNUSED_ASSERTION_VARIABLE(prevWndFunc);
ASSERT(prevWndFunc == reinterpret_cast<LONG_PTR>(SurfaceWindowProc));
}
@@ -300,24 +304,27 @@ void Surface::unsubclassWindow()
bool Surface::checkForOutOfDateSwapChain()
{
RECT client;
- if (!GetClientRect(getWindowHandle(), &client))
- {
- ASSERT(false);
- return false;
- }
-
- // Grow the buffer now, if the window has grown. We need to grow now to avoid losing information.
- int clientWidth = client.right - client.left;
- int clientHeight = client.bottom - client.top;
- bool sizeDirty = clientWidth != getWidth() || clientHeight != getHeight();
-
- if (IsIconic(getWindowHandle()))
+ int clientWidth = getWidth();
+ int clientHeight = getHeight();
+ bool sizeDirty = false;
+ if (!mFixedSize && !IsIconic(getWindowHandle()))
{
// The window is automatically resized to 150x22 when it's minimized, but the swapchain shouldn't be resized
// because that's not a useful size to render to.
- sizeDirty = false;
+ if (!GetClientRect(getWindowHandle(), &client))
+ {
+ ASSERT(false);
+ return false;
+ }
+
+ // Grow the buffer now, if the window has grown. We need to grow now to avoid losing information.
+ clientWidth = client.right - client.left;
+ clientHeight = client.bottom - client.top;
+ sizeDirty = clientWidth != getWidth() || clientHeight != getHeight();
}
+ bool wasDirty = (mSwapIntervalDirty || sizeDirty);
+
if (mSwapIntervalDirty)
{
resetSwapChain(clientWidth, clientHeight);
@@ -327,7 +334,7 @@ bool Surface::checkForOutOfDateSwapChain()
resizeSwapChain(clientWidth, clientHeight);
}
- if (mSwapIntervalDirty || sizeDirty)
+ if (wasDirty)
{
if (static_cast<egl::Surface*>(getCurrentDrawSurface()) == this)
{
@@ -352,18 +359,8 @@ bool Surface::postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height)
// Spec is not clear about how this should be handled.
return true;
}
-
- return swapRect(x, y, width, height);
-}
-EGLint Surface::getWidth() const
-{
- return mWidth;
-}
-
-EGLint Surface::getHeight() const
-{
- return mHeight;
+ return swapRect(x, y, width, height);
}
EGLint Surface::isPostSubBufferSupported() const
@@ -382,7 +379,7 @@ void Surface::setSwapInterval(EGLint interval)
{
return;
}
-
+
mSwapInterval = interval;
mSwapInterval = std::max(mSwapInterval, mRenderer->getMinSwapInterval());
mSwapInterval = std::min(mSwapInterval, mRenderer->getMaxSwapInterval());
@@ -390,6 +387,36 @@ void Surface::setSwapInterval(EGLint interval)
mSwapIntervalDirty = true;
}
+EGLint Surface::getConfigID() const
+{
+ return mConfig->mConfigID;
+}
+
+EGLint Surface::getWidth() const
+{
+ return mWidth;
+}
+
+EGLint Surface::getHeight() const
+{
+ return mHeight;
+}
+
+EGLint Surface::getPixelAspectRatio() const
+{
+ return mPixelAspectRatio;
+}
+
+EGLenum Surface::getRenderBuffer() const
+{
+ return mRenderBuffer;
+}
+
+EGLenum Surface::getSwapBehavior() const
+{
+ return mSwapBehavior;
+}
+
EGLenum Surface::getTextureFormat() const
{
return mTextureFormat;
@@ -410,6 +437,11 @@ gl::Texture2D *Surface::getBoundTexture() const
return mTexture;
}
+EGLint Surface::isFixedSize() const
+{
+ return mFixedSize;
+}
+
EGLenum Surface::getFormat() const
{
return mConfig->mRenderTargetFormat;
diff --git a/chromium/third_party/angle/src/libEGL/Surface.h b/chromium/third_party/angle/src/libEGL/Surface.h
index 938b800cdde..2361fcd1b51 100644
--- a/chromium/third_party/angle/src/libEGL/Surface.h
+++ b/chromium/third_party/angle/src/libEGL/Surface.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -34,10 +34,10 @@ class Config;
class Surface
{
public:
- Surface(Display *display, const egl::Config *config, HWND window, EGLint postSubBufferSupported);
+ Surface(Display *display, const egl::Config *config, HWND window, EGLint fixedSize, EGLint width, EGLint height, EGLint postSubBufferSupported);
Surface(Display *display, const egl::Config *config, HANDLE shareHandle, EGLint width, EGLint height, EGLenum textureFormat, EGLenum textureTarget);
- ~Surface();
+ virtual ~Surface();
bool initialize();
void release();
@@ -47,9 +47,6 @@ class Surface
bool swap();
bool postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height);
- virtual EGLint getWidth() const;
- virtual EGLint getHeight() const;
-
virtual EGLint isPostSubBufferSupported() const;
virtual rx::SwapChain *getSwapChain() const;
@@ -57,6 +54,12 @@ class Surface
void setSwapInterval(EGLint interval);
bool checkForOutOfDateSwapChain(); // Returns true if swapchain changed due to resize or interval update
+ virtual EGLint getConfigID() const;
+ virtual EGLint getWidth() const;
+ virtual EGLint getHeight() const;
+ virtual EGLint getPixelAspectRatio() const;
+ virtual EGLenum getRenderBuffer() const;
+ virtual EGLenum getSwapBehavior() const;
virtual EGLenum getTextureFormat() const;
virtual EGLenum getTextureTarget() const;
virtual EGLenum getFormat() const;
@@ -64,6 +67,8 @@ class Surface
virtual void setBoundTexture(gl::Texture2D *texture);
virtual gl::Texture2D *getBoundTexture() const;
+ EGLint isFixedSize() const;
+
private:
DISALLOW_COPY_AND_ASSIGN(Surface);
@@ -99,6 +104,7 @@ private:
// EGLenum vgColorSpace; // Color space for OpenVG
EGLint mSwapInterval;
EGLint mPostSubBufferSupported;
+ EGLint mFixedSize;
bool mSwapIntervalDirty;
gl::Texture2D *mTexture;
diff --git a/chromium/third_party/angle/src/libEGL/libEGL.cpp b/chromium/third_party/angle/src/libEGL/libEGL.cpp
index 320670da0c9..09e1452f8ff 100644
--- a/chromium/third_party/angle/src/libEGL/libEGL.cpp
+++ b/chromium/third_party/angle/src/libEGL/libEGL.cpp
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -103,7 +103,7 @@ EGLDisplay __stdcall eglGetDisplay(EGLNativeDisplayType display_id)
{
return egl::Display::getDisplay(display_id);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_NO_DISPLAY);
}
@@ -133,7 +133,7 @@ EGLBoolean __stdcall eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
return egl::success(EGL_TRUE);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
@@ -156,7 +156,7 @@ EGLBoolean __stdcall eglTerminate(EGLDisplay dpy)
return egl::success(EGL_TRUE);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
@@ -184,12 +184,12 @@ const char *__stdcall eglQueryString(EGLDisplay dpy, EGLint name)
case EGL_VENDOR:
return egl::success(display->getVendorString());
case EGL_VERSION:
- return egl::success("1.4 (ANGLE " VERSION_STRING ")");
+ return egl::success("1.4 (ANGLE " ANGLE_VERSION_STRING ")");
}
return egl::error(EGL_BAD_PARAMETER, (const char*)NULL);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, (const char*)NULL);
}
@@ -224,7 +224,7 @@ EGLBoolean __stdcall eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint co
return egl::success(EGL_TRUE);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
@@ -261,7 +261,7 @@ EGLBoolean __stdcall eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list,
return egl::success(EGL_TRUE);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
@@ -288,7 +288,7 @@ EGLBoolean __stdcall eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint
return egl::success(EGL_TRUE);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
@@ -317,7 +317,7 @@ EGLSurface __stdcall eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EG
return display->createWindowSurface(window, config, attrib_list);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
}
@@ -339,7 +339,7 @@ EGLSurface __stdcall eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, c
return display->createOffscreenSurface(config, NULL, attrib_list);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
}
@@ -363,7 +363,7 @@ EGLSurface __stdcall eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EG
return egl::success(EGL_NO_SURFACE);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
}
@@ -392,7 +392,7 @@ EGLBoolean __stdcall eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
return egl::success(EGL_TRUE);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
@@ -427,7 +427,7 @@ EGLBoolean __stdcall eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint
UNIMPLEMENTED(); // FIXME
break;
case EGL_CONFIG_ID:
- UNIMPLEMENTED(); // FIXME
+ *value = eglSurface->getConfigID();
break;
case EGL_HEIGHT:
*value = eglSurface->getHeight();
@@ -448,19 +448,19 @@ EGLBoolean __stdcall eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint
UNIMPLEMENTED(); // FIXME
break;
case EGL_PIXEL_ASPECT_RATIO:
- UNIMPLEMENTED(); // FIXME
+ *value = eglSurface->getPixelAspectRatio();
break;
case EGL_RENDER_BUFFER:
- UNIMPLEMENTED(); // FIXME
+ *value = eglSurface->getRenderBuffer();
break;
case EGL_SWAP_BEHAVIOR:
- UNIMPLEMENTED(); // FIXME
+ *value = eglSurface->getSwapBehavior();
break;
case EGL_TEXTURE_FORMAT:
- UNIMPLEMENTED(); // FIXME
+ *value = eglSurface->getTextureFormat();
break;
case EGL_TEXTURE_TARGET:
- UNIMPLEMENTED(); // FIXME
+ *value = eglSurface->getTextureTarget();
break;
case EGL_VERTICAL_RESOLUTION:
UNIMPLEMENTED(); // FIXME
@@ -471,13 +471,16 @@ EGLBoolean __stdcall eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint
case EGL_POST_SUB_BUFFER_SUPPORTED_NV:
*value = eglSurface->isPostSubBufferSupported();
break;
+ case EGL_FIXED_SIZE_ANGLE:
+ *value = eglSurface->isFixedSize();
+ break;
default:
return egl::error(EGL_BAD_ATTRIBUTE, EGL_FALSE);
}
return egl::success(EGL_TRUE);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
@@ -517,7 +520,7 @@ EGLBoolean __stdcall eglQuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surf
return egl::success(EGL_TRUE);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
@@ -544,7 +547,7 @@ EGLBoolean __stdcall eglBindAPI(EGLenum api)
return egl::success(EGL_TRUE);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
@@ -560,7 +563,7 @@ EGLenum __stdcall eglQueryAPI(void)
return egl::success(API);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
@@ -576,7 +579,7 @@ EGLBoolean __stdcall eglWaitClient(void)
return egl::success(0);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
@@ -592,7 +595,7 @@ EGLBoolean __stdcall eglReleaseThread(void)
return egl::success(EGL_TRUE);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
@@ -620,7 +623,7 @@ EGLSurface __stdcall eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum bu
return display->createOffscreenSurface(config, (HANDLE)buffer, attrib_list);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
}
@@ -645,7 +648,7 @@ EGLBoolean __stdcall eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint
return egl::success(EGL_TRUE);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
@@ -692,7 +695,7 @@ EGLBoolean __stdcall eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint
return egl::success(EGL_TRUE);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
@@ -736,7 +739,7 @@ EGLBoolean __stdcall eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLi
return egl::success(EGL_TRUE);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
@@ -766,7 +769,7 @@ EGLBoolean __stdcall eglSwapInterval(EGLDisplay dpy, EGLint interval)
return egl::success(EGL_TRUE);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
@@ -779,7 +782,7 @@ EGLContext __stdcall eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLConte
try
{
- // Get the requested client version (default is 1) and check it is two.
+ // Get the requested client version (default is 1) and check it is 2 or 3.
EGLint client_version = 1;
bool reset_notification = false;
bool robust_access = false;
@@ -814,24 +817,32 @@ EGLContext __stdcall eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLConte
}
}
- if (client_version != 2)
+ if (client_version != 2 && client_version != 3)
{
return egl::error(EGL_BAD_CONFIG, EGL_NO_CONTEXT);
}
- gl::Context *sharedContextPtr = (share_context != EGL_NO_CONTEXT ? static_cast<gl::Context*>(share_context) : NULL);
+ egl::Display *display = static_cast<egl::Display*>(dpy);
- if (sharedContextPtr != NULL && sharedContextPtr->isResetNotificationEnabled() != reset_notification)
+ if (share_context)
{
- return egl::error(EGL_BAD_MATCH, EGL_NO_CONTEXT);
- }
+ gl::Context* sharedGLContext = static_cast<gl::Context*>(share_context);
- egl::Display *display = static_cast<egl::Display*>(dpy);
+ if (sharedGLContext->isResetNotificationEnabled() != reset_notification)
+ {
+ return egl::error(EGL_BAD_MATCH, EGL_NO_CONTEXT);
+ }
- // Can not share contexts between displays
- if (sharedContextPtr != NULL && sharedContextPtr->getRenderer() != display->getRenderer())
- {
- return egl::error(EGL_BAD_MATCH, EGL_NO_CONTEXT);
+ if (sharedGLContext->getClientVersion() != client_version)
+ {
+ return egl::error(EGL_BAD_CONTEXT, EGL_NO_CONTEXT);
+ }
+
+ // Can not share contexts between displays
+ if (sharedGLContext->getRenderer() != display->getRenderer())
+ {
+ return egl::error(EGL_BAD_MATCH, EGL_NO_CONTEXT);
+ }
}
if (!validateConfig(display, config))
@@ -839,14 +850,9 @@ EGLContext __stdcall eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLConte
return EGL_NO_CONTEXT;
}
- EGLContext context = display->createContext(config, static_cast<gl::Context*>(share_context), reset_notification, robust_access);
-
- if (context)
- return egl::success(context);
- else
- return egl::error(EGL_CONTEXT_LOST, EGL_NO_CONTEXT);
+ return display->createContext(config, client_version, static_cast<gl::Context*>(share_context), reset_notification, robust_access);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_NO_CONTEXT);
}
@@ -875,7 +881,7 @@ EGLBoolean __stdcall eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
return egl::success(EGL_TRUE);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
@@ -929,7 +935,7 @@ EGLBoolean __stdcall eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface
return egl::success(EGL_TRUE);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
@@ -945,7 +951,7 @@ EGLContext __stdcall eglGetCurrentContext(void)
return egl::success(context);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_NO_CONTEXT);
}
@@ -972,7 +978,7 @@ EGLSurface __stdcall eglGetCurrentSurface(EGLint readdraw)
return egl::error(EGL_BAD_PARAMETER, EGL_NO_SURFACE);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
}
@@ -988,7 +994,7 @@ EGLDisplay __stdcall eglGetCurrentDisplay(void)
return egl::success(dpy);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_NO_DISPLAY);
}
@@ -1013,7 +1019,7 @@ EGLBoolean __stdcall eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attr
return egl::success(0);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
@@ -1029,7 +1035,7 @@ EGLBoolean __stdcall eglWaitGL(void)
return egl::success(0);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
@@ -1045,7 +1051,7 @@ EGLBoolean __stdcall eglWaitNative(EGLint engine)
return egl::success(0);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
@@ -1080,7 +1086,7 @@ EGLBoolean __stdcall eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
return egl::success(EGL_TRUE);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
@@ -1111,7 +1117,7 @@ EGLBoolean __stdcall eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativ
return egl::success(0);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
@@ -1151,7 +1157,7 @@ EGLBoolean __stdcall eglPostSubBufferNV(EGLDisplay dpy, EGLSurface surface, EGLi
return egl::success(EGL_TRUE);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
}
@@ -1188,7 +1194,7 @@ __eglMustCastToProperFunctionPointerType __stdcall eglGetProcAddress(const char
return glGetProcAddress(procname);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return egl::error(EGL_BAD_ALLOC, (__eglMustCastToProperFunctionPointerType)NULL);
}
diff --git a/chromium/third_party/angle/src/libEGL/libEGL.rc b/chromium/third_party/angle/src/libEGL/libEGL.rc
index 5d1f32f1c94..65e0aa50c8f 100644
--- a/chromium/third_party/angle/src/libEGL/libEGL.rc
+++ b/chromium/third_party/angle/src/libEGL/libEGL.rc
@@ -54,8 +54,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION,BUILD_REVISION
- PRODUCTVERSION MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION,BUILD_REVISION
+ FILEVERSION ANGLE_MAJOR_VERSION,ANGLE_MINOR_VERSION,0,0
+ PRODUCTVERSION ANGLE_MAJOR_VERSION,ANGLE_MINOR_VERSION,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -71,13 +71,14 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "ANGLE libEGL Dynamic Link Library"
- VALUE "FileVersion", VERSION_STRING
+ VALUE "FileVersion", ANGLE_VERSION_STRING
VALUE "InternalName", "libEGL"
VALUE "LegalCopyright", "Copyright (C) 2011 Google Inc."
VALUE "OriginalFilename", "libEGL.dll"
- VALUE "PrivateBuild", VERSION_STRING
+ VALUE "PrivateBuild", ANGLE_VERSION_STRING
VALUE "ProductName", "ANGLE libEGL Dynamic Link Library"
- VALUE "ProductVersion", VERSION_STRING
+ VALUE "ProductVersion", ANGLE_VERSION_STRING
+ VALUE "Comments", "Build Date: " ANGLE_COMMIT_DATE
END
END
BLOCK "VarFileInfo"
diff --git a/chromium/third_party/angle/src/libEGL/libEGL.vcxproj b/chromium/third_party/angle/src/libEGL/libEGL.vcxproj
deleted file mode 100644
index 2406d12e04a..00000000000
--- a/chromium/third_party/angle/src/libEGL/libEGL.vcxproj
+++ /dev/null
@@ -1,258 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{E746FCA9-64C3-433E-85E8-9A5A67AB7ED6}</ProjectGuid>
- <RootNamespace>libEGL</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
- <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LibraryPath)</LibraryPath>
- <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(DXSDK_DIR)\lib\x86;$(LibraryPath)</LibraryPath>
- <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LibraryPath)</LibraryPath>
- <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LibraryPath)</LibraryPath>
- <IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(DXSDK_DIR)\include;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;</IncludePath>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>$(ProjectDir)/..; $(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBEGL_EXPORTS;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level4</WarningLevel>
- <TreatWarningAsError>true</TreatWarningAsError>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- <DisableSpecificWarnings>4100;4127;4189;4239;4244;4245;4512;4702;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <Link>
- <AdditionalDependencies>d3d9.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <ModuleDefinitionFile>libEGL.def</ModuleDefinitionFile>
- <DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Windows</SubSystem>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- <PostBuildEvent>
- <Command>%40echo on
-mkdir "$(ProjectDir)..\..\lib\$(Configuration)\"
-copy "$(OutDir)libEGL.dll" "$(ProjectDir)..\..\lib\$(Configuration)\"
-copy "$(OutDir)libEGL.lib" "$(ProjectDir)..\..\lib\$(Configuration)\"
-%40echo off
-</Command>
- </PostBuildEvent>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <Optimization>MaxSpeed</Optimization>
- <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
- <AdditionalIncludeDirectories>$(ProjectDir)/..; $(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>ANGLE_DISABLE_TRACE;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBEGL_EXPORTS;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;_SECURE_SCL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level4</WarningLevel>
- <TreatWarningAsError>true</TreatWarningAsError>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <DisableSpecificWarnings>4100;4127;4189;4239;4244;4245;4512;4702;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- <Link>
- <AdditionalDependencies>d3d9.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <ModuleDefinitionFile>libEGL.def</ModuleDefinitionFile>
- <DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Windows</SubSystem>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- <PostBuildEvent>
- <Command>%40echo on
-mkdir "$(ProjectDir)..\..\lib\$(Configuration)\"
-copy "$(OutDir)libEGL.dll" "$(ProjectDir)..\..\lib\$(Configuration)\"
-copy "$(OutDir)libEGL.lib" "$(ProjectDir)..\..\lib\$(Configuration)\"
-%40echo off
-</Command>
- </PostBuildEvent>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>$(ProjectDir)/..; $(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBEGL_EXPORTS;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>4100;4127;4189;4239;4244;4245;4512;4702;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <TreatWarningAsError>true</TreatWarningAsError>
- </ClCompile>
- <Link>
- <AdditionalDependencies>d3d9.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <ModuleDefinitionFile>libEGL.def</ModuleDefinitionFile>
- <DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Windows</SubSystem>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX64</TargetMachine>
- </Link>
- <PostBuildEvent>
- <Command>%40echo on
-mkdir "$(ProjectDir)..\..\lib\$(Configuration)\"
-copy "$(OutDir)libEGL.dll" "$(ProjectDir)..\..\lib\$(Configuration)\"
-copy "$(OutDir)libEGL.lib" "$(ProjectDir)..\..\lib\$(Configuration)\"
-%40echo off
-</Command>
- </PostBuildEvent>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <Optimization>MaxSpeed</Optimization>
- <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
- <AdditionalIncludeDirectories>$(ProjectDir)/..; $(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBEGL_EXPORTS;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;_SECURE_SCL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>4100;4127;4189;4239;4244;4245;4512;4702;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <TreatWarningAsError>true</TreatWarningAsError>
- </ClCompile>
- <Link>
- <AdditionalDependencies>d3d9.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <ModuleDefinitionFile>libEGL.def</ModuleDefinitionFile>
- <DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Windows</SubSystem>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX64</TargetMachine>
- </Link>
- <PostBuildEvent>
- <Command>%40echo on
-mkdir "$(ProjectDir)..\..\lib\$(Configuration)\"
-copy "$(OutDir)libEGL.dll" "$(ProjectDir)..\..\lib\$(Configuration)\"
-copy "$(OutDir)libEGL.lib" "$(ProjectDir)..\..\lib\$(Configuration)\"
-%40echo off
-</Command>
- </PostBuildEvent>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="Config.cpp" />
- <ClCompile Include="..\Common\debug.cpp" />
- <ClCompile Include="Display.cpp" />
- <ClCompile Include="libEGL.cpp" />
- <ClCompile Include="main.cpp" />
- <ClCompile Include="Surface.cpp" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="Config.h" />
- <ClInclude Include="Display.h" />
- <ClInclude Include="..\..\include\EGL\egl.h" />
- <ClInclude Include="..\..\include\EGL\eglext.h" />
- <ClInclude Include="..\..\include\EGL\eglplatform.h" />
- <ClInclude Include="main.h" />
- <ClInclude Include="resource.h" />
- <ClInclude Include="Surface.h" />
- <ClInclude Include="..\common\version.h" />
- </ItemGroup>
- <ItemGroup>
- <None Include="libEGL.def" />
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="libEGL.rc" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\libGLESv2\libGLESv2.vcxproj">
- <Project>{b5871a7a-968c-42e3-a33b-981e6f448e78}</Project>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/chromium/third_party/angle/src/libEGL/libEGL.vcxproj.filters b/chromium/third_party/angle/src/libEGL/libEGL.vcxproj.filters
deleted file mode 100644
index e78b94fc475..00000000000
--- a/chromium/third_party/angle/src/libEGL/libEGL.vcxproj.filters
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="Header Files">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="Config.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\Common\debug.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Display.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="libEGL.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="main.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Surface.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="Config.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="Display.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\EGL\egl.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\EGL\eglext.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\EGL\eglplatform.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="main.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="resource.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="Surface.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\common\version.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="libEGL.rc" />
- </ItemGroup>
- <ItemGroup>
- <None Include="libEGL.def" />
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/chromium/third_party/angle/src/libEGL/main.cpp b/chromium/third_party/angle/src/libEGL/main.cpp
index 424ec3fcd1d..80dcc345807 100644
--- a/chromium/third_party/angle/src/libEGL/main.cpp
+++ b/chromium/third_party/angle/src/libEGL/main.cpp
@@ -12,13 +12,50 @@
static DWORD currentTLS = TLS_OUT_OF_INDEXES;
+namespace egl
+{
+
+Current *AllocateCurrent()
+{
+ Current *current = (egl::Current*)LocalAlloc(LPTR, sizeof(egl::Current));
+
+ if (!current)
+ {
+ ERR("Could not allocate thread local storage.");
+ return NULL;
+ }
+
+ ASSERT(currentTLS != TLS_OUT_OF_INDEXES);
+ TlsSetValue(currentTLS, current);
+
+ current->error = EGL_SUCCESS;
+ current->API = EGL_OPENGL_ES_API;
+ current->display = EGL_NO_DISPLAY;
+ current->drawSurface = EGL_NO_SURFACE;
+ current->readSurface = EGL_NO_SURFACE;
+
+ return current;
+}
+
+void DeallocateCurrent()
+{
+ void *current = TlsGetValue(currentTLS);
+
+ if (current)
+ {
+ LocalFree((HLOCAL)current);
+ }
+}
+
+}
+
extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
{
switch (reason)
{
case DLL_PROCESS_ATTACH:
{
-#if !defined(ANGLE_DISABLE_TRACE)
+#if defined(ANGLE_ENABLE_TRACE)
FILE *debug = fopen(TRACE_OUTPUT_FILE, "rt");
if (debug)
@@ -43,39 +80,17 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
// Fall throught to initialize index
case DLL_THREAD_ATTACH:
{
- egl::Current *current = (egl::Current*)LocalAlloc(LPTR, sizeof(egl::Current));
-
- if (current)
- {
- TlsSetValue(currentTLS, current);
-
- current->error = EGL_SUCCESS;
- current->API = EGL_OPENGL_ES_API;
- current->display = EGL_NO_DISPLAY;
- current->drawSurface = EGL_NO_SURFACE;
- current->readSurface = EGL_NO_SURFACE;
- }
+ egl::AllocateCurrent();
}
break;
case DLL_THREAD_DETACH:
{
- void *current = TlsGetValue(currentTLS);
-
- if (current)
- {
- LocalFree((HLOCAL)current);
- }
+ egl::DeallocateCurrent();
}
break;
case DLL_PROCESS_DETACH:
{
- void *current = TlsGetValue(currentTLS);
-
- if (current)
- {
- LocalFree((HLOCAL)current);
- }
-
+ egl::DeallocateCurrent();
TlsFree(currentTLS);
}
break;
@@ -88,72 +103,82 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
namespace egl
{
-void setCurrentError(EGLint error)
+
+Current *GetCurrentData()
{
Current *current = (Current*)TlsGetValue(currentTLS);
+ // ANGLE issue 488: when the dll is loaded after thread initialization,
+ // thread local storage (current) might not exist yet.
+ return (current ? current : AllocateCurrent());
+}
+
+void setCurrentError(EGLint error)
+{
+ Current *current = GetCurrentData();
+
current->error = error;
}
EGLint getCurrentError()
{
- Current *current = (Current*)TlsGetValue(currentTLS);
+ Current *current = GetCurrentData();
return current->error;
}
void setCurrentAPI(EGLenum API)
{
- Current *current = (Current*)TlsGetValue(currentTLS);
+ Current *current = GetCurrentData();
current->API = API;
}
EGLenum getCurrentAPI()
{
- Current *current = (Current*)TlsGetValue(currentTLS);
+ Current *current = GetCurrentData();
return current->API;
}
void setCurrentDisplay(EGLDisplay dpy)
{
- Current *current = (Current*)TlsGetValue(currentTLS);
+ Current *current = GetCurrentData();
current->display = dpy;
}
EGLDisplay getCurrentDisplay()
{
- Current *current = (Current*)TlsGetValue(currentTLS);
+ Current *current = GetCurrentData();
return current->display;
}
void setCurrentDrawSurface(EGLSurface surface)
{
- Current *current = (Current*)TlsGetValue(currentTLS);
+ Current *current = GetCurrentData();
current->drawSurface = surface;
}
EGLSurface getCurrentDrawSurface()
{
- Current *current = (Current*)TlsGetValue(currentTLS);
+ Current *current = GetCurrentData();
return current->drawSurface;
}
void setCurrentReadSurface(EGLSurface surface)
{
- Current *current = (Current*)TlsGetValue(currentTLS);
+ Current *current = GetCurrentData();
current->readSurface = surface;
}
EGLSurface getCurrentReadSurface()
{
- Current *current = (Current*)TlsGetValue(currentTLS);
+ Current *current = GetCurrentData();
return current->readSurface;
}
diff --git a/chromium/third_party/angle/src/libGLESv2.gypi b/chromium/third_party/angle/src/libGLESv2.gypi
new file mode 100644
index 00000000000..b2dce1224da
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2.gypi
@@ -0,0 +1,124 @@
+# Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'variables':
+ {
+ 'angle_enable_d3d9%': 1,
+ 'angle_enable_d3d11%': 1,
+ },
+ 'target_defaults':
+ {
+ 'defines':
+ [
+ 'ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT("d3dcompiler_46.dll"), TEXT("d3dcompiler_43.dll") }',
+ ],
+ },
+
+ 'conditions':
+ [
+ ['OS=="win"',
+ {
+ 'targets':
+ [
+ {
+ 'target_name': 'libGLESv2',
+ 'type': 'shared_library',
+ 'dependencies': [ 'translator', 'commit_id', 'copy_compiler_dll' ],
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'include_dirs':
+ [
+ '.',
+ '../include',
+ 'libGLESv2',
+ ],
+ 'sources':
+ [
+ '<!@(python <(angle_path)/enumerate_files.py \
+ -dirs common libGLESv2 third_party/murmurhash ../include third_party/systeminfo \
+ -types *.cpp *.h *.hlsl *.vs *.ps *.bat *.def *.rc \
+ -excludes */d3d/* */d3d9/* */d3d11/*)',
+ ],
+ 'defines':
+ [
+ 'GL_APICALL=',
+ 'GL_GLEXT_PROTOTYPES=',
+ 'EGLAPI=',
+ ],
+ 'conditions':
+ [
+ ['angle_enable_d3d9==1',
+ {
+ 'sources':
+ [
+ '<!@(python <(angle_path)/enumerate_files.py \
+ -dirs libGLESv2/renderer/d3d libGLESv2/renderer/d3d9 \
+ -types *.cpp *.h *.vs *.ps *.bat)',
+ ],
+ 'defines':
+ [
+ 'ANGLE_ENABLE_D3D9',
+ ],
+ 'msvs_settings':
+ {
+ 'VCLinkerTool':
+ {
+ 'AdditionalDependencies':
+ [
+ 'd3d9.lib',
+ ]
+ }
+ },
+ }],
+ ['angle_enable_d3d11==1',
+ {
+ 'sources':
+ [
+ '<!@(python <(angle_path)/enumerate_files.py \
+ -dirs libGLESv2/renderer/d3d libGLESv2/renderer/d3d11 \
+ -types *.cpp *.h *.hlsl *.bat)',
+ ],
+ 'defines':
+ [
+ 'ANGLE_ENABLE_D3D11',
+ ],
+ 'msvs_settings':
+ {
+ 'VCLinkerTool':
+ {
+ 'AdditionalDependencies':
+ [
+ 'dxguid.lib',
+ ],
+ },
+ },
+ }],
+ ],
+
+ 'configurations':
+ {
+ 'Debug':
+ {
+ 'defines':
+ [
+ 'ANGLE_ENABLE_PERF',
+ ],
+ 'msvs_settings':
+ {
+ 'VCLinkerTool':
+ {
+ 'AdditionalDependencies':
+ [
+ 'd3d9.lib',
+ ]
+ }
+ },
+ },
+ },
+ },
+ ],
+ },
+ ],
+ ],
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/BinaryStream.h b/chromium/third_party/angle/src/libGLESv2/BinaryStream.h
index 21c2f86ce82..253c1ebc5aa 100644
--- a/chromium/third_party/angle/src/libGLESv2/BinaryStream.h
+++ b/chromium/third_party/angle/src/libGLESv2/BinaryStream.h
@@ -10,6 +10,7 @@
#define LIBGLESV2_BINARYSTREAM_H_
#include "common/angleutils.h"
+#include "common/mathutil.h"
namespace gl
{
@@ -25,42 +26,49 @@ class BinaryInputStream
mLength = length;
}
- template <typename T>
- void read(T *v, size_t num)
+ // readInt will generate an error for bool types
+ template <class IntT>
+ IntT readInt()
{
- union
- {
- T dummy; // Compilation error for non-trivial types
- } dummy;
- (void) dummy;
+ int value;
+ read(&value);
+ return static_cast<IntT>(value);
+ }
- if (mError)
- {
- return;
- }
+ template <class IntT>
+ void readInt(IntT *outValue)
+ {
+ *outValue = readInt<IntT>();
+ }
- size_t length = num * sizeof(T);
+ bool readBool()
+ {
+ int value;
+ read(&value);
+ return (value > 0);
+ }
- if (mOffset + length > mLength)
- {
- mError = true;
- return;
- }
+ void readBool(bool *outValue)
+ {
+ *outValue = readBool();
+ }
- memcpy(v, mData + mOffset, length);
- mOffset += length;
+ void readBytes(unsigned char outArray[], size_t count)
+ {
+ read<unsigned char>(outArray, count);
}
- template <typename T>
- void read(T * v)
+ std::string readString()
{
- read(v, 1);
+ std::string outString;
+ readString(&outString);
+ return outString;
}
- void read(std::string *v)
+ void readString(std::string *v)
{
size_t length;
- read(&length);
+ readInt(&length);
if (mError)
{
@@ -109,6 +117,30 @@ class BinaryInputStream
size_t mOffset;
const char *mData;
size_t mLength;
+
+ template <typename T>
+ void read(T *v, size_t num)
+ {
+ META_ASSERT(std::is_fundamental<T>::value);
+
+ size_t length = num * sizeof(T);
+
+ if (mOffset + length > mLength)
+ {
+ mError = true;
+ return;
+ }
+
+ memcpy(v, mData + mOffset, length);
+ mOffset += length;
+ }
+
+ template <typename T>
+ void read(T *v)
+ {
+ read(v, 1);
+ }
+
};
class BinaryOutputStream
@@ -118,31 +150,24 @@ class BinaryOutputStream
{
}
- template <typename T>
- void write(const T *v, size_t num)
+ // writeInt also handles bool types
+ template <class IntT>
+ void writeInt(IntT param)
{
- union
- {
- T dummy; // Compilation error for non-trivial types
- } dummy;
- (void) dummy;
-
- const char *asBytes = reinterpret_cast<const char*>(v);
- mData.insert(mData.end(), asBytes, asBytes + num * sizeof(T));
+ ASSERT(rx::IsIntegerCastSafe<int>(param));
+ int intValue = static_cast<int>(param);
+ write(&intValue, 1);
}
- template <typename T>
- void write(const T &v)
+ void writeString(const std::string &v)
{
- write(&v, 1);
+ writeInt(v.length());
+ write(v.c_str(), v.length());
}
- void write(const std::string &v)
+ void writeBytes(unsigned char *bytes, size_t count)
{
- size_t length = v.length();
- write(length);
-
- write(v.c_str(), length);
+ write(bytes, count);
}
size_t length() const
@@ -158,6 +183,15 @@ class BinaryOutputStream
private:
DISALLOW_COPY_AND_ASSIGN(BinaryOutputStream);
std::vector<char> mData;
+
+ template <typename T>
+ void write(const T *v, size_t num)
+ {
+ META_ASSERT(std::is_fundamental<T>::value);
+ const char *asBytes = reinterpret_cast<const char*>(v);
+ mData.insert(mData.end(), asBytes, asBytes + num * sizeof(T));
+ }
+
};
}
diff --git a/chromium/third_party/angle/src/libGLESv2/Buffer.cpp b/chromium/third_party/angle/src/libGLESv2/Buffer.cpp
index c007d5d9e90..e7d2c00f005 100644
--- a/chromium/third_party/angle/src/libGLESv2/Buffer.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/Buffer.cpp
@@ -1,6 +1,6 @@
#include "precompiled.h"
//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -19,15 +19,21 @@
namespace gl
{
-Buffer::Buffer(rx::Renderer *renderer, GLuint id) : RefCountObject(id)
+Buffer::Buffer(rx::Renderer *renderer, GLuint id)
+ : RefCountObject(id),
+ mRenderer(renderer),
+ mUsage(GL_DYNAMIC_DRAW),
+ mAccessFlags(0),
+ mMapped(GL_FALSE),
+ mMapPointer(NULL),
+ mMapOffset(0),
+ mMapLength(0),
+ mBufferStorage(NULL),
+ mStaticVertexBuffer(NULL),
+ mStaticIndexBuffer(NULL),
+ mUnmodifiedDataUse(0)
{
- mRenderer = renderer;
- mUsage = GL_DYNAMIC_DRAW;
-
mBufferStorage = renderer->createBufferStorage();
- mStaticVertexBuffer = NULL;
- mStaticIndexBuffer = NULL;
- mUnmodifiedDataUse = 0;
}
Buffer::~Buffer()
@@ -58,13 +64,41 @@ void Buffer::bufferSubData(const void *data, GLsizeiptr size, GLintptr offset)
{
mBufferStorage->setData(data, size, offset);
mIndexRangeCache.invalidateRange(offset, size);
+ invalidateStaticData();
+}
- if ((mStaticVertexBuffer && mStaticVertexBuffer->getBufferSize() != 0) || (mStaticIndexBuffer && mStaticIndexBuffer->getBufferSize() != 0))
- {
- invalidateStaticData();
- }
+void Buffer::copyBufferSubData(Buffer* source, GLintptr sourceOffset, GLintptr destOffset, GLsizeiptr size)
+{
+ mBufferStorage->copyData(source->mBufferStorage, size, sourceOffset, destOffset);
+ invalidateStaticData();
+}
- mUnmodifiedDataUse = 0;
+GLvoid *Buffer::mapRange(GLintptr offset, GLsizeiptr length, GLbitfield access)
+{
+ ASSERT(!mMapped);
+
+ void *dataPointer = mBufferStorage->map(access);
+
+ mMapped = GL_TRUE;
+ mMapPointer = static_cast<GLvoid*>(static_cast<GLubyte*>(dataPointer) + offset);
+ mMapOffset = static_cast<GLint64>(offset);
+ mMapLength = static_cast<GLint64>(length);
+ mAccessFlags = static_cast<GLint>(access);
+
+ return mMapPointer;
+}
+
+void Buffer::unmap()
+{
+ ASSERT(mMapped);
+
+ mBufferStorage->unmap();
+
+ mMapped = GL_FALSE;
+ mMapPointer = NULL;
+ mMapOffset = 0;
+ mMapLength = 0;
+ mAccessFlags = 0;
}
rx::BufferStorage *Buffer::getStorage() const
@@ -72,9 +106,9 @@ rx::BufferStorage *Buffer::getStorage() const
return mBufferStorage;
}
-unsigned int Buffer::size() const
+GLint64 Buffer::size() const
{
- return mBufferStorage->getSize();
+ return static_cast<GLint64>(mBufferStorage->getSize());
}
GLenum Buffer::usage() const
@@ -82,6 +116,37 @@ GLenum Buffer::usage() const
return mUsage;
}
+GLint Buffer::accessFlags() const
+{
+ return mAccessFlags;
+}
+
+GLboolean Buffer::mapped() const
+{
+ return mMapped;
+}
+
+GLvoid *Buffer::mapPointer() const
+{
+ return mMapPointer;
+}
+
+GLint64 Buffer::mapOffset() const
+{
+ return mMapOffset;
+}
+
+GLint64 Buffer::mapLength() const
+{
+ return mMapLength;
+}
+
+void Buffer::markTransformFeedbackUsage()
+{
+ mBufferStorage->markTransformFeedbackUsage();
+ invalidateStaticData();
+}
+
rx::StaticVertexBufferInterface *Buffer::getStaticVertexBuffer()
{
return mStaticVertexBuffer;
@@ -94,11 +159,14 @@ rx::StaticIndexBufferInterface *Buffer::getStaticIndexBuffer()
void Buffer::invalidateStaticData()
{
- delete mStaticVertexBuffer;
- mStaticVertexBuffer = NULL;
+ if ((mStaticVertexBuffer && mStaticVertexBuffer->getBufferSize() != 0) || (mStaticIndexBuffer && mStaticIndexBuffer->getBufferSize() != 0))
+ {
+ delete mStaticVertexBuffer;
+ mStaticVertexBuffer = NULL;
- delete mStaticIndexBuffer;
- mStaticIndexBuffer = NULL;
+ delete mStaticIndexBuffer;
+ mStaticIndexBuffer = NULL;
+ }
mUnmodifiedDataUse = 0;
}
diff --git a/chromium/third_party/angle/src/libGLESv2/Buffer.h b/chromium/third_party/angle/src/libGLESv2/Buffer.h
index 4048f4b9064..55fbdeb1c9b 100644
--- a/chromium/third_party/angle/src/libGLESv2/Buffer.h
+++ b/chromium/third_party/angle/src/libGLESv2/Buffer.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -35,11 +35,21 @@ class Buffer : public RefCountObject
void bufferData(const void *data, GLsizeiptr size, GLenum usage);
void bufferSubData(const void *data, GLsizeiptr size, GLintptr offset);
+ void copyBufferSubData(Buffer* source, GLintptr sourceOffset, GLintptr destOffset, GLsizeiptr size);
+ GLvoid *mapRange(GLintptr offset, GLsizeiptr length, GLbitfield access);
+ void unmap();
GLenum usage() const;
+ GLint accessFlags() const;
+ GLboolean mapped() const;
+ GLvoid *mapPointer() const;
+ GLint64 mapOffset() const;
+ GLint64 mapLength() const;
rx::BufferStorage *getStorage() const;
- unsigned int size() const;
+ GLint64 size() const;
+
+ void markTransformFeedbackUsage();
rx::StaticVertexBufferInterface *getStaticVertexBuffer();
rx::StaticIndexBufferInterface *getStaticIndexBuffer();
@@ -53,6 +63,11 @@ class Buffer : public RefCountObject
rx::Renderer *mRenderer;
GLenum mUsage;
+ GLint mAccessFlags;
+ GLboolean mMapped;
+ GLvoid *mMapPointer;
+ GLint64 mMapOffset;
+ GLint64 mMapLength;
rx::BufferStorage *mBufferStorage;
diff --git a/chromium/third_party/angle/src/libGLESv2/Context.cpp b/chromium/third_party/angle/src/libGLESv2/Context.cpp
index fba4104d1e1..879a560045c 100644
--- a/chromium/third_party/angle/src/libGLESv2/Context.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/Context.cpp
@@ -1,6 +1,6 @@
#include "precompiled.h"
//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -11,7 +11,8 @@
#include "libGLESv2/Context.h"
#include "libGLESv2/main.h"
-#include "libGLESv2/utilities.h"
+#include "common/utilities.h"
+#include "libGLESv2/formatutils.h"
#include "libGLESv2/Buffer.h"
#include "libGLESv2/Fence.h"
#include "libGLESv2/Framebuffer.h"
@@ -24,6 +25,10 @@
#include "libGLESv2/renderer/IndexDataManager.h"
#include "libGLESv2/renderer/RenderTarget.h"
#include "libGLESv2/renderer/Renderer.h"
+#include "libGLESv2/VertexArray.h"
+#include "libGLESv2/Sampler.h"
+#include "libGLESv2/validationES.h"
+#include "libGLESv2/TransformFeedback.h"
#include "libEGL/Surface.h"
@@ -42,17 +47,20 @@ static const char* makeStaticString(const std::string& str)
return strings.insert(str).first->c_str();
}
-Context::Context(const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess) : mRenderer(renderer)
+Context::Context(int clientVersion, const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess) : mRenderer(renderer)
{
ASSERT(robustAccess == false); // Unimplemented
- mFenceHandleAllocator.setBaseHandle(0);
+ mFenceNVHandleAllocator.setBaseHandle(0);
setClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ mClientVersion = clientVersion;
+
mState.depthClearValue = 1.0f;
mState.stencilClearValue = 0;
+ mState.rasterizer.rasterizerDiscard = false;
mState.rasterizer.cullFace = false;
mState.rasterizer.cullMode = GL_BACK;
mState.rasterizer.frontFace = GL_CCW;
@@ -122,6 +130,12 @@ Context::Context(const gl::Context *shareContext, rx::Renderer *renderer, bool n
mState.blend.colorMaskBlue = true;
mState.blend.colorMaskAlpha = true;
+ const GLfloat defaultFloatValues[] = { 0.0f, 0.0f, 0.0f, 1.0f };
+ for (int attribIndex = 0; attribIndex < MAX_VERTEX_ATTRIBS; attribIndex++)
+ {
+ mState.vertexAttribCurrentValues[attribIndex].setFloatValues(defaultFloatValues);
+ }
+
if (shareContext != NULL)
{
mResourceManager = shareContext->mResourceManager;
@@ -140,8 +154,16 @@ Context::Context(const gl::Context *shareContext, rx::Renderer *renderer, bool n
mTexture2DZero.set(new Texture2D(mRenderer, 0));
mTextureCubeMapZero.set(new TextureCubeMap(mRenderer, 0));
+ mTexture3DZero.set(new Texture3D(mRenderer, 0));
+ mTexture2DArrayZero.set(new Texture2DArray(mRenderer, 0));
+
+ for (unsigned int textureUnit = 0; textureUnit < ArraySize(mState.samplers); textureUnit++)
+ {
+ mState.samplers[textureUnit] = 0;
+ }
mState.activeSampler = 0;
+ bindVertexArray(0);
bindArrayBuffer(0);
bindElementArrayBuffer(0);
bindTextureCubeMap(0);
@@ -150,14 +172,38 @@ Context::Context(const gl::Context *shareContext, rx::Renderer *renderer, bool n
bindDrawFramebuffer(0);
bindRenderbuffer(0);
+ mState.activeQueries[GL_ANY_SAMPLES_PASSED].set(NULL);
+ mState.activeQueries[GL_ANY_SAMPLES_PASSED_CONSERVATIVE].set(NULL);
+ mState.activeQueries[GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN].set(NULL);
+
+ bindGenericUniformBuffer(0);
+ for (int i = 0; i < IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS; i++)
+ {
+ bindIndexedUniformBuffer(0, i, 0, -1);
+ }
+
+ bindGenericTransformFeedbackBuffer(0);
+ for (int i = 0; i < IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS; i++)
+ {
+ bindIndexedTransformFeedbackBuffer(0, i, 0, -1);
+ }
+
+ bindCopyReadBuffer(0);
+ bindCopyWriteBuffer(0);
+ bindPixelPackBuffer(0);
+ bindPixelUnpackBuffer(0);
+
+ // [OpenGL ES 3.0.2] section 2.14.1 pg 85:
+ // In the initial state, a default transform feedback object is bound and treated as
+ // a transform feedback object with a name of zero. That object is bound any time
+ // BindTransformFeedback is called with id of zero
+ mTransformFeedbackZero.set(new TransformFeedback(0));
+ bindTransformFeedback(0);
+
mState.currentProgram = 0;
mCurrentProgramBinary.set(NULL);
- mState.packAlignment = 4;
- mState.unpackAlignment = 4;
- mState.packReverseRowOrder = false;
-
- mExtensionString = NULL;
+ mCombinedExtensionsString = NULL;
mRendererString = NULL;
mInvalidEnum = false;
@@ -199,9 +245,9 @@ Context::~Context()
deleteFramebuffer(mFramebufferMap.begin()->first);
}
- while (!mFenceMap.empty())
+ while (!mFenceNVMap.empty())
{
- deleteFence(mFenceMap.begin()->first);
+ deleteFenceNV(mFenceNVMap.begin()->first);
}
while (!mQueryMap.empty())
@@ -209,6 +255,17 @@ Context::~Context()
deleteQuery(mQueryMap.begin()->first);
}
+ while (!mVertexArrayMap.empty())
+ {
+ deleteVertexArray(mVertexArrayMap.begin()->first);
+ }
+
+ mTransformFeedbackZero.set(NULL);
+ while (!mTransformFeedbackMap.empty())
+ {
+ deleteTransformFeedback(mTransformFeedbackMap.begin()->first);
+ }
+
for (int type = 0; type < TEXTURE_TYPE_COUNT; type++)
{
for (int sampler = 0; sampler < IMPLEMENTATION_MAX_COMBINED_TEXTURE_IMAGE_UNITS; sampler++)
@@ -222,22 +279,44 @@ Context::~Context()
mIncompleteTextures[type].set(NULL);
}
- for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
- {
- mState.vertexAttribute[i].mBoundBuffer.set(NULL);
- }
-
- for (int i = 0; i < QUERY_TYPE_COUNT; i++)
+ const GLfloat defaultFloatValues[] = { 0.0f, 0.0f, 0.0f, 1.0f };
+ for (int attribIndex = 0; attribIndex < MAX_VERTEX_ATTRIBS; attribIndex++)
{
- mState.activeQuery[i].set(NULL);
+ mState.vertexAttribCurrentValues[attribIndex].setFloatValues(defaultFloatValues);
}
mState.arrayBuffer.set(NULL);
- mState.elementArrayBuffer.set(NULL);
mState.renderbuffer.set(NULL);
+ mState.transformFeedback.set(NULL);
+
mTexture2DZero.set(NULL);
mTextureCubeMapZero.set(NULL);
+ mTexture3DZero.set(NULL);
+ mTexture2DArrayZero.set(NULL);
+
+ for (State::ActiveQueryMap::iterator i = mState.activeQueries.begin(); i != mState.activeQueries.end(); i++)
+ {
+ i->second.set(NULL);
+ }
+
+ mState.genericUniformBuffer.set(NULL);
+ for (int i = 0; i < IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS; i++)
+ {
+ mState.uniformBuffers[i].set(NULL);
+ }
+
+ mState.genericTransformFeedbackBuffer.set(NULL);
+ for (int i = 0; i < IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS; i++)
+ {
+ mState.transformFeedbackBuffers[i].set(NULL);
+ }
+
+ mState.copyReadBuffer.set(NULL);
+ mState.copyWriteBuffer.set(NULL);
+
+ mState.pack.pixelBuffer.set(NULL);
+ mState.unpack.pixelBuffer.set(NULL);
mResourceManager->release();
}
@@ -253,14 +332,24 @@ void Context::makeCurrent(egl::Surface *surface)
mSupportsInstancing = mRenderer->getInstancingSupport();
mMaxViewportDimension = mRenderer->getMaxViewportDimension();
- mMaxTextureDimension = std::min(std::min(mRenderer->getMaxTextureWidth(), mRenderer->getMaxTextureHeight()),
- (int)gl::IMPLEMENTATION_MAX_TEXTURE_SIZE);
- mMaxCubeTextureDimension = std::min(mMaxTextureDimension, (int)gl::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE);
- mMaxRenderbufferDimension = mMaxTextureDimension;
- mMaxTextureLevel = log2(mMaxTextureDimension) + 1;
+ mMax2DTextureDimension = std::min(std::min(mRenderer->getMaxTextureWidth(), mRenderer->getMaxTextureHeight()),
+ (int)gl::IMPLEMENTATION_MAX_2D_TEXTURE_SIZE);
+ mMaxCubeTextureDimension = std::min(mMax2DTextureDimension, (int)gl::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE);
+ mMax3DTextureDimension = std::min(std::min(mMax2DTextureDimension, mRenderer->getMaxTextureDepth()),
+ (int)gl::IMPLEMENTATION_MAX_3D_TEXTURE_SIZE);
+ mMax2DArrayTextureLayers = mRenderer->getMaxTextureArrayLayers();
+ mMaxRenderbufferDimension = mMax2DTextureDimension;
+ mMax2DTextureLevel = log2(mMax2DTextureDimension) + 1;
+ mMaxCubeTextureLevel = log2(mMaxCubeTextureDimension) + 1;
+ mMax3DTextureLevel = log2(mMax3DTextureDimension) + 1;
+ mMax2DArrayTextureLevel = log2(mMax2DTextureDimension) + 1;
mMaxTextureAnisotropy = mRenderer->getTextureMaxAnisotropy();
- TRACE("MaxTextureDimension=%d, MaxCubeTextureDimension=%d, MaxRenderbufferDimension=%d, MaxTextureLevel=%d, MaxTextureAnisotropy=%f",
- mMaxTextureDimension, mMaxCubeTextureDimension, mMaxRenderbufferDimension, mMaxTextureLevel, mMaxTextureAnisotropy);
+ TRACE("Max2DTextureDimension=%d, MaxCubeTextureDimension=%d, Max3DTextureDimension=%d, Max2DArrayTextureLayers = %d, "
+ "Max2DTextureLevel=%d, MaxCubeTextureLevel=%d, Max3DTextureLevel=%d, Max2DArrayTextureLevel=%d, "
+ "MaxRenderbufferDimension=%d, MaxTextureAnisotropy=%f",
+ mMax2DTextureDimension, mMaxCubeTextureDimension, mMax3DTextureDimension, mMax2DArrayTextureLayers,
+ mMax2DTextureLevel, mMaxCubeTextureLevel, mMax3DTextureLevel, mMax2DArrayTextureLevel,
+ mMaxRenderbufferDimension, mMaxTextureAnisotropy);
mSupportsEventQueries = mRenderer->getEventQuerySupport();
mSupportsOcclusionQueries = mRenderer->getOcclusionQuerySupport();
@@ -268,13 +357,19 @@ void Context::makeCurrent(egl::Surface *surface)
mSupportsDXT1Textures = mRenderer->getDXT1TextureSupport();
mSupportsDXT3Textures = mRenderer->getDXT3TextureSupport();
mSupportsDXT5Textures = mRenderer->getDXT5TextureSupport();
- mSupportsFloat32Textures = mRenderer->getFloat32TextureSupport(&mSupportsFloat32LinearFilter, &mSupportsFloat32RenderableTextures);
- mSupportsFloat16Textures = mRenderer->getFloat16TextureSupport(&mSupportsFloat16LinearFilter, &mSupportsFloat16RenderableTextures);
+ mSupportsFloat32Textures = mRenderer->getFloat32TextureSupport();
+ mSupportsFloat32LinearFilter = mRenderer->getFloat32TextureFilteringSupport();
+ mSupportsFloat32RenderableTextures = mRenderer->getFloat32TextureRenderingSupport();
+ mSupportsFloat16Textures = mRenderer->getFloat16TextureSupport();
+ mSupportsFloat16LinearFilter = mRenderer->getFloat16TextureFilteringSupport();
+ mSupportsFloat16RenderableTextures = mRenderer->getFloat16TextureRenderingSupport();
mSupportsLuminanceTextures = mRenderer->getLuminanceTextureSupport();
mSupportsLuminanceAlphaTextures = mRenderer->getLuminanceAlphaTextureSupport();
+ mSupportsRGTextures = mRenderer->getRGTextureSupport();
mSupportsDepthTextures = mRenderer->getDepthTextureSupport();
mSupportsTextureFilterAnisotropy = mRenderer->getTextureFilterAnisotropySupport();
mSupports32bitIndices = mRenderer->get32BitIndexSupport();
+ mSupportsPBOs = mRenderer->getPBOSupport();
mNumCompressedTextureFormats = 0;
if (supportsDXT1Textures())
@@ -314,6 +409,9 @@ void Context::makeCurrent(egl::Surface *surface)
Framebuffer *framebufferZero = new DefaultFramebuffer(mRenderer, colorbufferZero, depthStencilbufferZero);
setFramebufferZero(framebufferZero);
+
+ // Store the current client version in the renderer
+ mRenderer->setCurrentClientVersion(mClientVersion);
}
// NOTE: this function should not assume that this context is current!
@@ -329,6 +427,44 @@ bool Context::isContextLost()
return mContextLost;
}
+void Context::setCap(GLenum cap, bool enabled)
+{
+ switch (cap)
+ {
+ case GL_CULL_FACE: setCullFace(enabled); break;
+ case GL_POLYGON_OFFSET_FILL: setPolygonOffsetFill(enabled); break;
+ case GL_SAMPLE_ALPHA_TO_COVERAGE: setSampleAlphaToCoverage(enabled); break;
+ case GL_SAMPLE_COVERAGE: setSampleCoverage(enabled); break;
+ case GL_SCISSOR_TEST: setScissorTest(enabled); break;
+ case GL_STENCIL_TEST: setStencilTest(enabled); break;
+ case GL_DEPTH_TEST: setDepthTest(enabled); break;
+ case GL_BLEND: setBlend(enabled); break;
+ case GL_DITHER: setDither(enabled); break;
+ case GL_PRIMITIVE_RESTART_FIXED_INDEX: UNIMPLEMENTED(); break;
+ case GL_RASTERIZER_DISCARD: setRasterizerDiscard(enabled); break;
+ default: UNREACHABLE();
+ }
+}
+
+bool Context::getCap(GLenum cap)
+{
+ switch (cap)
+ {
+ case GL_CULL_FACE: return isCullFaceEnabled();
+ case GL_POLYGON_OFFSET_FILL: return isPolygonOffsetFillEnabled();
+ case GL_SAMPLE_ALPHA_TO_COVERAGE: return isSampleAlphaToCoverageEnabled();
+ case GL_SAMPLE_COVERAGE: return isSampleCoverageEnabled();
+ case GL_SCISSOR_TEST: return isScissorTestEnabled();
+ case GL_STENCIL_TEST: return isStencilTestEnabled();
+ case GL_DEPTH_TEST: return isDepthTestEnabled();
+ case GL_BLEND: return isBlendEnabled();
+ case GL_DITHER: return isDitherEnabled();
+ case GL_PRIMITIVE_RESTART_FIXED_INDEX: UNIMPLEMENTED(); return false;
+ case GL_RASTERIZER_DISCARD: return isRasterizerDiscardEnabled();
+ default: UNREACHABLE(); return false;
+ }
+}
+
void Context::setClearColor(float red, float green, float blue, float alpha)
{
mState.colorClearValue.red = red;
@@ -347,6 +483,16 @@ void Context::setClearStencil(int stencil)
mState.stencilClearValue = stencil;
}
+void Context::setRasterizerDiscard(bool enabled)
+{
+ mState.rasterizer.rasterizerDiscard = enabled;
+}
+
+bool Context::isRasterizerDiscardEnabled() const
+{
+ return mState.rasterizer.rasterizerDiscard;
+}
+
void Context::setCullFace(bool enabled)
{
mState.rasterizer.cullFace = enabled;
@@ -565,6 +711,14 @@ void Context::setScissorParams(GLint x, GLint y, GLsizei width, GLsizei height)
mState.scissor.height = height;
}
+void Context::getScissorParams(GLint *x, GLint *y, GLsizei *width, GLsizei *height)
+{
+ *x = mState.scissor.x;
+ *y = mState.scissor.y;
+ *width = mState.scissor.width;
+ *height = mState.scissor.height;
+}
+
void Context::setColorMask(bool red, bool green, bool blue, bool alpha)
{
mState.blend.colorMaskRed = red;
@@ -598,91 +752,120 @@ GLuint Context::getRenderbufferHandle() const
return mState.renderbuffer.id();
}
+GLuint Context::getVertexArrayHandle() const
+{
+ return mState.vertexArray;
+}
+
+GLuint Context::getSamplerHandle(GLuint textureUnit) const
+{
+ ASSERT(textureUnit < ArraySize(mState.samplers));
+ return mState.samplers[textureUnit];
+}
+
+unsigned int Context::getActiveSampler() const
+{
+ return mState.activeSampler;
+}
+
GLuint Context::getArrayBufferHandle() const
{
return mState.arrayBuffer.id();
}
-GLuint Context::getActiveQuery(GLenum target) const
+bool Context::isQueryActive() const
{
- Query *queryObject = NULL;
-
- switch (target)
+ for (State::ActiveQueryMap::const_iterator i = mState.activeQueries.begin();
+ i != mState.activeQueries.end(); i++)
{
- case GL_ANY_SAMPLES_PASSED_EXT:
- queryObject = mState.activeQuery[QUERY_ANY_SAMPLES_PASSED].get();
- break;
- case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
- queryObject = mState.activeQuery[QUERY_ANY_SAMPLES_PASSED_CONSERVATIVE].get();
- break;
- default:
- ASSERT(false);
+ if (i->second.get() != NULL)
+ {
+ return true;
+ }
}
- if (queryObject)
- {
- return queryObject->id();
- }
- else
- {
- return 0;
- }
+ return false;
+}
+
+const Query *Context::getActiveQuery(GLenum target) const
+{
+ // All query types should already exist in the activeQueries map
+ ASSERT(mState.activeQueries.find(target) != mState.activeQueries.end());
+
+ return mState.activeQueries.at(target).get();
+}
+
+GLuint Context::getActiveQueryId(GLenum target) const
+{
+ const Query *query = getActiveQuery(target);
+ return (query ? query->id() : 0u);
}
void Context::setEnableVertexAttribArray(unsigned int attribNum, bool enabled)
{
- mState.vertexAttribute[attribNum].mArrayEnabled = enabled;
+ getCurrentVertexArray()->enableAttribute(attribNum, enabled);
+}
+
+const VertexAttribute &Context::getVertexAttribState(unsigned int attribNum) const
+{
+ return getCurrentVertexArray()->getVertexAttribute(attribNum);
}
-const VertexAttribute &Context::getVertexAttribState(unsigned int attribNum)
+const VertexAttribCurrentValueData &Context::getVertexAttribCurrentValue(unsigned int attribNum) const
{
- return mState.vertexAttribute[attribNum];
+ ASSERT(attribNum < MAX_VERTEX_ATTRIBS);
+ return mState.vertexAttribCurrentValues[attribNum];
}
void Context::setVertexAttribState(unsigned int attribNum, Buffer *boundBuffer, GLint size, GLenum type, bool normalized,
- GLsizei stride, const void *pointer)
+ bool pureInteger, GLsizei stride, const void *pointer)
{
- mState.vertexAttribute[attribNum].mBoundBuffer.set(boundBuffer);
- mState.vertexAttribute[attribNum].mSize = size;
- mState.vertexAttribute[attribNum].mType = type;
- mState.vertexAttribute[attribNum].mNormalized = normalized;
- mState.vertexAttribute[attribNum].mStride = stride;
- mState.vertexAttribute[attribNum].mPointer = pointer;
+ getCurrentVertexArray()->setAttributeState(attribNum, boundBuffer, size, type, normalized, pureInteger, stride, pointer);
}
const void *Context::getVertexAttribPointer(unsigned int attribNum) const
{
- return mState.vertexAttribute[attribNum].mPointer;
+ return getCurrentVertexArray()->getVertexAttribute(attribNum).mPointer;
}
void Context::setPackAlignment(GLint alignment)
{
- mState.packAlignment = alignment;
+ mState.pack.alignment = alignment;
}
GLint Context::getPackAlignment() const
{
- return mState.packAlignment;
+ return mState.pack.alignment;
}
void Context::setUnpackAlignment(GLint alignment)
{
- mState.unpackAlignment = alignment;
+ mState.unpack.alignment = alignment;
}
GLint Context::getUnpackAlignment() const
{
- return mState.unpackAlignment;
+ return mState.unpack.alignment;
}
void Context::setPackReverseRowOrder(bool reverseRowOrder)
{
- mState.packReverseRowOrder = reverseRowOrder;
+ mState.pack.reverseRowOrder = reverseRowOrder;
}
bool Context::getPackReverseRowOrder() const
{
- return mState.packReverseRowOrder;
+ return mState.pack.reverseRowOrder;
+}
+
+const PixelUnpackState &Context::getUnpackState() const
+{
+ return mState.unpack;
+}
+
+const PixelPackState &Context::getPackState() const
+{
+ return mState.pack;
}
GLuint Context::createBuffer()
@@ -710,6 +893,44 @@ GLuint Context::createRenderbuffer()
return mResourceManager->createRenderbuffer();
}
+GLsync Context::createFenceSync(GLenum condition)
+{
+ GLuint handle = mResourceManager->createFenceSync();
+
+ gl::FenceSync *fenceSync = mResourceManager->getFenceSync(handle);
+ ASSERT(fenceSync);
+
+ fenceSync->set(condition);
+
+ return reinterpret_cast<GLsync>(handle);
+}
+
+GLuint Context::createVertexArray()
+{
+ GLuint handle = mVertexArrayHandleAllocator.allocate();
+
+ // Although the spec states VAO state is not initialized until the object is bound,
+ // we create it immediately. The resulting behaviour is transparent to the application,
+ // since it's not currently possible to access the state until the object is bound.
+ mVertexArrayMap[handle] = new VertexArray(mRenderer, handle);
+
+ return handle;
+}
+
+GLuint Context::createSampler()
+{
+ return mResourceManager->createSampler();
+}
+
+GLuint Context::createTransformFeedback()
+{
+ GLuint handle = mTransformFeedbackAllocator.allocate();
+ TransformFeedback *transformFeedback = new TransformFeedback(handle);
+ transformFeedback->addRef();
+ mTransformFeedbackMap[handle] = transformFeedback;
+ return handle;
+}
+
// Returns an unused framebuffer name
GLuint Context::createFramebuffer()
{
@@ -720,11 +941,11 @@ GLuint Context::createFramebuffer()
return handle;
}
-GLuint Context::createFence()
+GLuint Context::createFenceNV()
{
- GLuint handle = mFenceHandleAllocator.allocate();
+ GLuint handle = mFenceNVHandleAllocator.allocate();
- mFenceMap[handle] = new Fence(mRenderer);
+ mFenceNVMap[handle] = new FenceNV(mRenderer);
return handle;
}
@@ -745,7 +966,7 @@ void Context::deleteBuffer(GLuint buffer)
{
detachBuffer(buffer);
}
-
+
mResourceManager->deleteBuffer(buffer);
}
@@ -775,10 +996,55 @@ void Context::deleteRenderbuffer(GLuint renderbuffer)
{
detachRenderbuffer(renderbuffer);
}
-
+
mResourceManager->deleteRenderbuffer(renderbuffer);
}
+void Context::deleteFenceSync(GLsync fenceSync)
+{
+ // The spec specifies the underlying Fence object is not deleted until all current
+ // wait commands finish. However, since the name becomes invalid, we cannot query the fence,
+ // and since our API is currently designed for being called from a single thread, we can delete
+ // the fence immediately.
+ mResourceManager->deleteFenceSync(reinterpret_cast<GLuint>(fenceSync));
+}
+
+void Context::deleteVertexArray(GLuint vertexArray)
+{
+ auto vertexArrayObject = mVertexArrayMap.find(vertexArray);
+
+ if (vertexArrayObject != mVertexArrayMap.end())
+ {
+ detachVertexArray(vertexArray);
+
+ mVertexArrayHandleAllocator.release(vertexArrayObject->first);
+ delete vertexArrayObject->second;
+ mVertexArrayMap.erase(vertexArrayObject);
+ }
+}
+
+void Context::deleteSampler(GLuint sampler)
+{
+ if (mResourceManager->getSampler(sampler))
+ {
+ detachSampler(sampler);
+ }
+
+ mResourceManager->deleteSampler(sampler);
+}
+
+void Context::deleteTransformFeedback(GLuint transformFeedback)
+{
+ TransformFeedbackMap::const_iterator iter = mTransformFeedbackMap.find(transformFeedback);
+ if (iter != mTransformFeedbackMap.end())
+ {
+ detachTransformFeedback(transformFeedback);
+ mTransformFeedbackAllocator.release(transformFeedback);
+ iter->second->release();
+ mTransformFeedbackMap.erase(iter);
+ }
+}
+
void Context::deleteFramebuffer(GLuint framebuffer)
{
FramebufferMap::iterator framebufferObject = mFramebufferMap.find(framebuffer);
@@ -793,15 +1059,15 @@ void Context::deleteFramebuffer(GLuint framebuffer)
}
}
-void Context::deleteFence(GLuint fence)
+void Context::deleteFenceNV(GLuint fence)
{
- FenceMap::iterator fenceObject = mFenceMap.find(fence);
+ FenceNVMap::iterator fenceObject = mFenceNVMap.find(fence);
- if (fenceObject != mFenceMap.end())
+ if (fenceObject != mFenceNVMap.end())
{
- mFenceHandleAllocator.release(fenceObject->first);
+ mFenceNVHandleAllocator.release(fenceObject->first);
delete fenceObject->second;
- mFenceMap.erase(fenceObject);
+ mFenceNVMap.erase(fenceObject);
}
}
@@ -824,12 +1090,12 @@ Buffer *Context::getBuffer(GLuint handle)
return mResourceManager->getBuffer(handle);
}
-Shader *Context::getShader(GLuint handle)
+Shader *Context::getShader(GLuint handle) const
{
return mResourceManager->getShader(handle);
}
-Program *Context::getProgram(GLuint handle)
+Program *Context::getProgram(GLuint handle) const
{
return mResourceManager->getProgram(handle);
}
@@ -839,11 +1105,48 @@ Texture *Context::getTexture(GLuint handle)
return mResourceManager->getTexture(handle);
}
-Renderbuffer *Context::getRenderbuffer(GLuint handle)
+FramebufferAttachment *Context::getRenderbuffer(GLuint handle)
{
return mResourceManager->getRenderbuffer(handle);
}
+FenceSync *Context::getFenceSync(GLsync handle) const
+{
+ return mResourceManager->getFenceSync(reinterpret_cast<GLuint>(handle));
+}
+
+VertexArray *Context::getVertexArray(GLuint handle) const
+{
+ auto vertexArray = mVertexArrayMap.find(handle);
+
+ if (vertexArray == mVertexArrayMap.end())
+ {
+ return NULL;
+ }
+ else
+ {
+ return vertexArray->second;
+ }
+}
+
+Sampler *Context::getSampler(GLuint handle) const
+{
+ return mResourceManager->getSampler(handle);
+}
+
+TransformFeedback *Context::getTransformFeedback(GLuint handle) const
+{
+ if (handle == 0)
+ {
+ return mTransformFeedbackZero.get();
+ }
+ else
+ {
+ TransformFeedbackMap::const_iterator iter = mTransformFeedbackMap.find(handle);
+ return (iter != mTransformFeedbackMap.end()) ? iter->second : NULL;
+ }
+}
+
Framebuffer *Context::getReadFramebuffer()
{
return getFramebuffer(mState.readFramebuffer);
@@ -854,6 +1157,23 @@ Framebuffer *Context::getDrawFramebuffer()
return mBoundDrawFramebuffer;
}
+VertexArray *Context::getCurrentVertexArray() const
+{
+ VertexArray *vao = getVertexArray(mState.vertexArray);
+ ASSERT(vao != NULL);
+ return vao;
+}
+
+TransformFeedback *Context::getCurrentTransformFeedback() const
+{
+ return mState.transformFeedback.get();
+}
+
+bool Context::isSampler(GLuint samplerName) const
+{
+ return mResourceManager->isSampler(samplerName);
+}
+
void Context::bindArrayBuffer(unsigned int buffer)
{
mResourceManager->checkBufferAllocation(buffer);
@@ -865,7 +1185,7 @@ void Context::bindElementArrayBuffer(unsigned int buffer)
{
mResourceManager->checkBufferAllocation(buffer);
- mState.elementArrayBuffer.set(getBuffer(buffer));
+ getCurrentVertexArray()->setElementArrayBuffer(getBuffer(buffer));
}
void Context::bindTexture2D(GLuint texture)
@@ -882,6 +1202,20 @@ void Context::bindTextureCubeMap(GLuint texture)
mState.samplerTexture[TEXTURE_CUBE][mState.activeSampler].set(getTexture(texture));
}
+void Context::bindTexture3D(GLuint texture)
+{
+ mResourceManager->checkTextureAllocation(texture, TEXTURE_3D);
+
+ mState.samplerTexture[TEXTURE_3D][mState.activeSampler].set(getTexture(texture));
+}
+
+void Context::bindTexture2DArray(GLuint texture)
+{
+ mResourceManager->checkTextureAllocation(texture, TEXTURE_2D_ARRAY);
+
+ mState.samplerTexture[TEXTURE_2D_ARRAY][mState.activeSampler].set(getTexture(texture));
+}
+
void Context::bindReadFramebuffer(GLuint framebuffer)
{
if (!getFramebuffer(framebuffer))
@@ -911,6 +1245,80 @@ void Context::bindRenderbuffer(GLuint renderbuffer)
mState.renderbuffer.set(getRenderbuffer(renderbuffer));
}
+void Context::bindVertexArray(GLuint vertexArray)
+{
+ if (!getVertexArray(vertexArray))
+ {
+ mVertexArrayMap[vertexArray] = new VertexArray(mRenderer, vertexArray);
+ }
+
+ mState.vertexArray = vertexArray;
+}
+
+void Context::bindSampler(GLuint textureUnit, GLuint sampler)
+{
+ ASSERT(textureUnit < ArraySize(mState.samplers));
+ mResourceManager->checkSamplerAllocation(sampler);
+
+ mState.samplers[textureUnit] = sampler;
+}
+
+void Context::bindGenericUniformBuffer(GLuint buffer)
+{
+ mResourceManager->checkBufferAllocation(buffer);
+
+ mState.genericUniformBuffer.set(getBuffer(buffer));
+}
+
+void Context::bindIndexedUniformBuffer(GLuint buffer, GLuint index, GLintptr offset, GLsizeiptr size)
+{
+ mResourceManager->checkBufferAllocation(buffer);
+
+ mState.uniformBuffers[index].set(getBuffer(buffer), offset, size);
+}
+
+void Context::bindGenericTransformFeedbackBuffer(GLuint buffer)
+{
+ mResourceManager->checkBufferAllocation(buffer);
+
+ mState.genericTransformFeedbackBuffer.set(getBuffer(buffer));
+}
+
+void Context::bindIndexedTransformFeedbackBuffer(GLuint buffer, GLuint index, GLintptr offset, GLsizeiptr size)
+{
+ mResourceManager->checkBufferAllocation(buffer);
+
+ mState.transformFeedbackBuffers[index].set(getBuffer(buffer), offset, size);
+}
+
+void Context::bindCopyReadBuffer(GLuint buffer)
+{
+ mResourceManager->checkBufferAllocation(buffer);
+
+ mState.copyReadBuffer.set(getBuffer(buffer));
+}
+
+void Context::bindCopyWriteBuffer(GLuint buffer)
+{
+ mResourceManager->checkBufferAllocation(buffer);
+
+ mState.copyWriteBuffer.set(getBuffer(buffer));
+}
+
+void Context::bindPixelPackBuffer(GLuint buffer)
+{
+ mResourceManager->checkBufferAllocation(buffer);
+
+ mState.pack.pixelBuffer.set(getBuffer(buffer));
+}
+
+void Context::bindPixelUnpackBuffer(GLuint buffer)
+{
+ mResourceManager->checkBufferAllocation(buffer);
+
+ mState.unpack.pixelBuffer.set(getBuffer(buffer));
+}
+
void Context::useProgram(GLuint program)
{
GLuint priorProgram = mState.currentProgram;
@@ -927,7 +1335,7 @@ void Context::useProgram(GLuint program)
newProgram->addRef();
mCurrentProgramBinary.set(newProgram->getProgramBinary());
}
-
+
if (oldProgram)
{
oldProgram->release();
@@ -964,61 +1372,19 @@ void Context::setProgramBinary(GLuint program, const void *binary, GLint length)
}
-void Context::beginQuery(GLenum target, GLuint query)
+void Context::bindTransformFeedback(GLuint transformFeedback)
{
- // From EXT_occlusion_query_boolean: If BeginQueryEXT is called with an <id>
- // of zero, if the active query object name for <target> is non-zero (for the
- // targets ANY_SAMPLES_PASSED_EXT and ANY_SAMPLES_PASSED_CONSERVATIVE_EXT, if
- // the active query for either target is non-zero), if <id> is the name of an
- // existing query object whose type does not match <target>, or if <id> is the
- // active query object name for any query type, the error INVALID_OPERATION is
- // generated.
-
- // Ensure no other queries are active
- // NOTE: If other queries than occlusion are supported, we will need to check
- // separately that:
- // a) The query ID passed is not the current active query for any target/type
- // b) There are no active queries for the requested target (and in the case
- // of GL_ANY_SAMPLES_PASSED_EXT and GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT,
- // no query may be active for either if glBeginQuery targets either.
- for (int i = 0; i < QUERY_TYPE_COUNT; i++)
- {
- if (mState.activeQuery[i].get() != NULL)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- }
-
- QueryType qType;
- switch (target)
- {
- case GL_ANY_SAMPLES_PASSED_EXT:
- qType = QUERY_ANY_SAMPLES_PASSED;
- break;
- case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
- qType = QUERY_ANY_SAMPLES_PASSED_CONSERVATIVE;
- break;
- default:
- ASSERT(false);
- return;
- }
+ TransformFeedback *transformFeedbackObject = getTransformFeedback(transformFeedback);
+ mState.transformFeedback.set(transformFeedbackObject);
+}
+void Context::beginQuery(GLenum target, GLuint query)
+{
Query *queryObject = getQuery(query, true, target);
-
- // check that name was obtained with glGenQueries
- if (!queryObject)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- // check for type mismatch
- if (queryObject->getType() != target)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
+ ASSERT(queryObject);
// set query as active for specified target
- mState.activeQuery[qType].set(queryObject);
+ mState.activeQueries[target].set(queryObject);
// begin query
queryObject->begin();
@@ -1026,31 +1392,12 @@ void Context::beginQuery(GLenum target, GLuint query)
void Context::endQuery(GLenum target)
{
- QueryType qType;
-
- switch (target)
- {
- case GL_ANY_SAMPLES_PASSED_EXT:
- qType = QUERY_ANY_SAMPLES_PASSED;
- break;
- case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
- qType = QUERY_ANY_SAMPLES_PASSED_CONSERVATIVE;
- break;
- default:
- ASSERT(false);
- return;
- }
-
- Query *queryObject = mState.activeQuery[qType].get();
-
- if (queryObject == NULL)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
+ Query *queryObject = mState.activeQueries[target].get();
+ ASSERT(queryObject);
queryObject->end();
- mState.activeQuery[qType].set(NULL);
+ mState.activeQueries[target].set(NULL);
}
void Context::setFramebufferZero(Framebuffer *buffer)
@@ -1065,36 +1412,41 @@ void Context::setFramebufferZero(Framebuffer *buffer)
void Context::setRenderbufferStorage(GLsizei width, GLsizei height, GLenum internalformat, GLsizei samples)
{
+ const bool color = gl::IsColorRenderingSupported(internalformat, this);
+ const bool depth = gl::IsDepthRenderingSupported(internalformat, this);
+ const bool stencil = gl::IsStencilRenderingSupported(internalformat, this);
+
RenderbufferStorage *renderbuffer = NULL;
- switch (internalformat)
+
+ if (color)
{
- case GL_DEPTH_COMPONENT16:
- renderbuffer = new gl::Depthbuffer(mRenderer, width, height, samples);
- break;
- case GL_RGBA4:
- case GL_RGB5_A1:
- case GL_RGB565:
- case GL_RGB8_OES:
- case GL_RGBA8_OES:
renderbuffer = new gl::Colorbuffer(mRenderer,width, height, internalformat, samples);
- break;
- case GL_STENCIL_INDEX8:
- renderbuffer = new gl::Stencilbuffer(mRenderer, width, height, samples);
- break;
- case GL_DEPTH24_STENCIL8_OES:
+ }
+ else if (depth && stencil)
+ {
renderbuffer = new gl::DepthStencilbuffer(mRenderer, width, height, samples);
- break;
- default:
- UNREACHABLE(); return;
+ }
+ else if (depth)
+ {
+ renderbuffer = new gl::Depthbuffer(mRenderer, width, height, samples);
+ }
+ else if (stencil)
+ {
+ renderbuffer = new gl::Stencilbuffer(mRenderer, width, height, samples);
+ }
+ else
+ {
+ UNREACHABLE();
+ return;
}
- Renderbuffer *renderbufferObject = mState.renderbuffer.get();
+ FramebufferAttachment *renderbufferObject = mState.renderbuffer.get();
renderbufferObject->setStorage(renderbuffer);
}
-Framebuffer *Context::getFramebuffer(unsigned int handle)
+Framebuffer *Context::getFramebuffer(unsigned int handle) const
{
- FramebufferMap::iterator framebuffer = mFramebufferMap.find(handle);
+ FramebufferMap::const_iterator framebuffer = mFramebufferMap.find(handle);
if (framebuffer == mFramebufferMap.end())
{
@@ -1106,11 +1458,11 @@ Framebuffer *Context::getFramebuffer(unsigned int handle)
}
}
-Fence *Context::getFence(unsigned int handle)
+FenceNV *Context::getFenceNV(unsigned int handle)
{
- FenceMap::iterator fence = mFenceMap.find(handle);
+ FenceNVMap::iterator fence = mFenceNVMap.find(handle);
- if (fence == mFenceMap.end())
+ if (fence == mFenceNVMap.end())
{
return NULL;
}
@@ -1139,14 +1491,30 @@ Query *Context::getQuery(unsigned int handle, bool create, GLenum type)
}
}
+Buffer *Context::getTargetBuffer(GLenum target) const
+{
+ switch (target)
+ {
+ case GL_ARRAY_BUFFER: return mState.arrayBuffer.get();
+ case GL_COPY_READ_BUFFER: return mState.copyReadBuffer.get();
+ case GL_COPY_WRITE_BUFFER: return mState.copyWriteBuffer.get();
+ case GL_ELEMENT_ARRAY_BUFFER: return getCurrentVertexArray()->getElementArrayBuffer();
+ case GL_PIXEL_PACK_BUFFER: return mState.pack.pixelBuffer.get();
+ case GL_PIXEL_UNPACK_BUFFER: return mState.unpack.pixelBuffer.get();
+ case GL_TRANSFORM_FEEDBACK_BUFFER: return mState.genericTransformFeedbackBuffer.get();
+ case GL_UNIFORM_BUFFER: return mState.genericUniformBuffer.get();
+ default: UNREACHABLE(); return NULL;
+ }
+}
+
Buffer *Context::getArrayBuffer()
{
return mState.arrayBuffer.get();
}
-Buffer *Context::getElementArrayBuffer()
+Buffer *Context::getElementArrayBuffer() const
{
- return mState.elementArrayBuffer.get();
+ return getCurrentVertexArray()->getElementArrayBuffer();
}
ProgramBinary *Context::getCurrentProgramBinary()
@@ -1154,17 +1522,97 @@ ProgramBinary *Context::getCurrentProgramBinary()
return mCurrentProgramBinary.get();
}
-Texture2D *Context::getTexture2D()
+Texture *Context::getTargetTexture(GLenum target) const
+{
+ if (!ValidTextureTarget(this, target))
+ {
+ return NULL;
+ }
+
+ switch (target)
+ {
+ case GL_TEXTURE_2D: return getTexture2D();
+ case GL_TEXTURE_CUBE_MAP: return getTextureCubeMap();
+ case GL_TEXTURE_3D: return getTexture3D();
+ case GL_TEXTURE_2D_ARRAY: return getTexture2DArray();
+ default: return NULL;
+ }
+}
+
+GLuint Context::getTargetFramebufferHandle(GLenum target) const
+{
+ if (!ValidFramebufferTarget(target))
+ {
+ return GL_INVALID_INDEX;
+ }
+
+ if (target == GL_READ_FRAMEBUFFER_ANGLE)
+ {
+ return mState.readFramebuffer;
+ }
+ else
+ {
+ return mState.drawFramebuffer;
+ }
+}
+
+Framebuffer *Context::getTargetFramebuffer(GLenum target) const
+{
+ GLuint framebufferHandle = getTargetFramebufferHandle(target);
+ return (framebufferHandle == GL_INVALID_INDEX ? NULL : getFramebuffer(framebufferHandle));
+}
+
+Texture2D *Context::getTexture2D() const
{
return static_cast<Texture2D*>(getSamplerTexture(mState.activeSampler, TEXTURE_2D));
}
-TextureCubeMap *Context::getTextureCubeMap()
+TextureCubeMap *Context::getTextureCubeMap() const
{
return static_cast<TextureCubeMap*>(getSamplerTexture(mState.activeSampler, TEXTURE_CUBE));
}
-Texture *Context::getSamplerTexture(unsigned int sampler, TextureType type)
+Texture3D *Context::getTexture3D() const
+{
+ return static_cast<Texture3D*>(getSamplerTexture(mState.activeSampler, TEXTURE_3D));
+}
+
+Texture2DArray *Context::getTexture2DArray() const
+{
+ return static_cast<Texture2DArray*>(getSamplerTexture(mState.activeSampler, TEXTURE_2D_ARRAY));
+}
+
+Buffer *Context::getGenericUniformBuffer()
+{
+ return mState.genericUniformBuffer.get();
+}
+
+Buffer *Context::getGenericTransformFeedbackBuffer()
+{
+ return mState.genericTransformFeedbackBuffer.get();
+}
+
+Buffer *Context::getCopyReadBuffer()
+{
+ return mState.copyReadBuffer.get();
+}
+
+Buffer *Context::getCopyWriteBuffer()
+{
+ return mState.copyWriteBuffer.get();
+}
+
+Buffer *Context::getPixelPackBuffer()
+{
+ return mState.pack.pixelBuffer.get();
+}
+
+Buffer *Context::getPixelUnpackBuffer()
+{
+ return mState.unpack.pixelBuffer.get();
+}
+
+Texture *Context::getSamplerTexture(unsigned int sampler, TextureType type) const
{
GLuint texid = mState.samplerTexture[type][sampler].id();
@@ -1173,15 +1621,17 @@ Texture *Context::getSamplerTexture(unsigned int sampler, TextureType type)
switch (type)
{
default: UNREACHABLE();
- case TEXTURE_2D: return mTexture2DZero.get();
- case TEXTURE_CUBE: return mTextureCubeMapZero.get();
+ case TEXTURE_2D: return mTexture2DZero.get();
+ case TEXTURE_CUBE: return mTextureCubeMapZero.get();
+ case TEXTURE_3D: return mTexture3DZero.get();
+ case TEXTURE_2D_ARRAY: return mTexture2DArrayZero.get();
}
}
return mState.samplerTexture[type][sampler].get();
}
-bool Context::getBooleanv(GLenum pname, GLboolean *params)
+void Context::getBooleanv(GLenum pname, GLboolean *params)
{
switch (pname)
{
@@ -1204,14 +1654,15 @@ bool Context::getBooleanv(GLenum pname, GLboolean *params)
case GL_BLEND: *params = mState.blend.blend; break;
case GL_DITHER: *params = mState.blend.dither; break;
case GL_CONTEXT_ROBUST_ACCESS_EXT: *params = mRobustAccess ? GL_TRUE : GL_FALSE; break;
+ case GL_TRANSFORM_FEEDBACK_ACTIVE: *params = getCurrentTransformFeedback()->isStarted(); break;
+ case GL_TRANSFORM_FEEDBACK_PAUSED: *params = getCurrentTransformFeedback()->isPaused(); break;
default:
- return false;
+ UNREACHABLE();
+ break;
}
-
- return true;
}
-bool Context::getFloatv(GLenum pname, GLfloat *params)
+void Context::getFloatv(GLenum pname, GLfloat *params)
{
// Please note: DEPTH_CLEAR_VALUE is included in our internal getFloatv implementation
// because it is stored as a float, despite the fact that the GL ES 2.0 spec names
@@ -1249,112 +1700,108 @@ bool Context::getFloatv(GLenum pname, GLfloat *params)
params[3] = mState.blendColor.alpha;
break;
case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:
- if (!supportsTextureFilterAnisotropy())
- {
- return false;
- }
+ ASSERT(supportsTextureFilterAnisotropy());
*params = mMaxTextureAnisotropy;
break;
default:
- return false;
+ UNREACHABLE();
+ break;
}
-
- return true;
}
-bool Context::getIntegerv(GLenum pname, GLint *params)
+void Context::getIntegerv(GLenum pname, GLint *params)
{
if (pname >= GL_DRAW_BUFFER0_EXT && pname <= GL_DRAW_BUFFER15_EXT)
{
unsigned int colorAttachment = (pname - GL_DRAW_BUFFER0_EXT);
-
- if (colorAttachment >= mRenderer->getMaxRenderTargets())
- {
- // return true to stop further operation in the parent call
- return gl::error(GL_INVALID_OPERATION, true);
- }
-
+ ASSERT(colorAttachment < mRenderer->getMaxRenderTargets());
Framebuffer *framebuffer = getDrawFramebuffer();
-
*params = framebuffer->getDrawBufferState(colorAttachment);
- return true;
+ return;
}
// Please note: DEPTH_CLEAR_VALUE is not included in our internal getIntegerv implementation
// because it is stored as a float, despite the fact that the GL ES 2.0 spec names
// GetIntegerv as its native query function. As it would require conversion in any
- // case, this should make no difference to the calling application. You may find it in
+ // case, this should make no difference to the calling application. You may find it in
// Context::getFloatv.
switch (pname)
{
- case GL_MAX_VERTEX_ATTRIBS: *params = gl::MAX_VERTEX_ATTRIBS; break;
- case GL_MAX_VERTEX_UNIFORM_VECTORS: *params = mRenderer->getMaxVertexUniformVectors(); break;
- case GL_MAX_VARYING_VECTORS: *params = mRenderer->getMaxVaryingVectors(); break;
- case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: *params = mRenderer->getMaxCombinedTextureImageUnits(); break;
- case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS: *params = mRenderer->getMaxVertexTextureImageUnits(); break;
- case GL_MAX_TEXTURE_IMAGE_UNITS: *params = gl::MAX_TEXTURE_IMAGE_UNITS; break;
- case GL_MAX_FRAGMENT_UNIFORM_VECTORS: *params = mRenderer->getMaxFragmentUniformVectors(); break;
- case GL_MAX_RENDERBUFFER_SIZE: *params = getMaximumRenderbufferDimension(); break;
- case GL_MAX_COLOR_ATTACHMENTS_EXT: *params = mRenderer->getMaxRenderTargets(); break;
- case GL_MAX_DRAW_BUFFERS_EXT: *params = mRenderer->getMaxRenderTargets(); break;
- case GL_NUM_SHADER_BINARY_FORMATS: *params = 0; break;
- case GL_SHADER_BINARY_FORMATS: /* no shader binary formats are supported */ break;
- case GL_ARRAY_BUFFER_BINDING: *params = mState.arrayBuffer.id(); break;
- case GL_ELEMENT_ARRAY_BUFFER_BINDING: *params = mState.elementArrayBuffer.id(); break;
- //case GL_FRAMEBUFFER_BINDING: // now equivalent to GL_DRAW_FRAMEBUFFER_BINDING_ANGLE
- case GL_DRAW_FRAMEBUFFER_BINDING_ANGLE: *params = mState.drawFramebuffer; break;
- case GL_READ_FRAMEBUFFER_BINDING_ANGLE: *params = mState.readFramebuffer; break;
- case GL_RENDERBUFFER_BINDING: *params = mState.renderbuffer.id(); break;
- case GL_CURRENT_PROGRAM: *params = mState.currentProgram; break;
- case GL_PACK_ALIGNMENT: *params = mState.packAlignment; break;
- case GL_PACK_REVERSE_ROW_ORDER_ANGLE: *params = mState.packReverseRowOrder; break;
- case GL_UNPACK_ALIGNMENT: *params = mState.unpackAlignment; break;
- case GL_GENERATE_MIPMAP_HINT: *params = mState.generateMipmapHint; break;
- case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES: *params = mState.fragmentShaderDerivativeHint; break;
- case GL_ACTIVE_TEXTURE: *params = (mState.activeSampler + GL_TEXTURE0); break;
- case GL_STENCIL_FUNC: *params = mState.depthStencil.stencilFunc; break;
- case GL_STENCIL_REF: *params = mState.stencilRef; break;
- case GL_STENCIL_VALUE_MASK: *params = mState.depthStencil.stencilMask; break;
- case GL_STENCIL_BACK_FUNC: *params = mState.depthStencil.stencilBackFunc; break;
- case GL_STENCIL_BACK_REF: *params = mState.stencilBackRef; break;
- case GL_STENCIL_BACK_VALUE_MASK: *params = mState.depthStencil.stencilBackMask; break;
- case GL_STENCIL_FAIL: *params = mState.depthStencil.stencilFail; break;
- case GL_STENCIL_PASS_DEPTH_FAIL: *params = mState.depthStencil.stencilPassDepthFail; break;
- case GL_STENCIL_PASS_DEPTH_PASS: *params = mState.depthStencil.stencilPassDepthPass; break;
- case GL_STENCIL_BACK_FAIL: *params = mState.depthStencil.stencilBackFail; break;
- case GL_STENCIL_BACK_PASS_DEPTH_FAIL: *params = mState.depthStencil.stencilBackPassDepthFail; break;
- case GL_STENCIL_BACK_PASS_DEPTH_PASS: *params = mState.depthStencil.stencilBackPassDepthPass; break;
- case GL_DEPTH_FUNC: *params = mState.depthStencil.depthFunc; break;
- case GL_BLEND_SRC_RGB: *params = mState.blend.sourceBlendRGB; break;
- case GL_BLEND_SRC_ALPHA: *params = mState.blend.sourceBlendAlpha; break;
- case GL_BLEND_DST_RGB: *params = mState.blend.destBlendRGB; break;
- case GL_BLEND_DST_ALPHA: *params = mState.blend.destBlendAlpha; break;
- case GL_BLEND_EQUATION_RGB: *params = mState.blend.blendEquationRGB; break;
- case GL_BLEND_EQUATION_ALPHA: *params = mState.blend.blendEquationAlpha; break;
- case GL_STENCIL_WRITEMASK: *params = mState.depthStencil.stencilWritemask; break;
- case GL_STENCIL_BACK_WRITEMASK: *params = mState.depthStencil.stencilBackWritemask; break;
- case GL_STENCIL_CLEAR_VALUE: *params = mState.stencilClearValue; break;
- case GL_SUBPIXEL_BITS: *params = 4; break;
- case GL_MAX_TEXTURE_SIZE: *params = getMaximumTextureDimension(); break;
- case GL_MAX_CUBE_MAP_TEXTURE_SIZE: *params = getMaximumCubeTextureDimension(); break;
- case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
+ case GL_MAX_VERTEX_ATTRIBS: *params = gl::MAX_VERTEX_ATTRIBS; break;
+ case GL_MAX_VERTEX_UNIFORM_VECTORS: *params = mRenderer->getMaxVertexUniformVectors(); break;
+ case GL_MAX_VERTEX_UNIFORM_COMPONENTS: *params = mRenderer->getMaxVertexUniformVectors() * 4; break;
+ case GL_MAX_VARYING_VECTORS: *params = mRenderer->getMaxVaryingVectors(); break;
+ case GL_MAX_VARYING_COMPONENTS: *params = mRenderer->getMaxVaryingVectors() * 4; break;
+ case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: *params = mRenderer->getMaxCombinedTextureImageUnits(); break;
+ case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS: *params = mRenderer->getMaxVertexTextureImageUnits(); break;
+ case GL_MAX_TEXTURE_IMAGE_UNITS: *params = gl::MAX_TEXTURE_IMAGE_UNITS; break;
+ case GL_MAX_FRAGMENT_UNIFORM_VECTORS: *params = mRenderer->getMaxFragmentUniformVectors(); break;
+ case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS: *params = mRenderer->getMaxFragmentUniformVectors() * 4; break;
+ case GL_MAX_RENDERBUFFER_SIZE: *params = getMaximumRenderbufferDimension(); break;
+ case GL_MAX_COLOR_ATTACHMENTS_EXT: *params = mRenderer->getMaxRenderTargets(); break;
+ case GL_MAX_DRAW_BUFFERS_EXT: *params = mRenderer->getMaxRenderTargets(); break;
+ case GL_NUM_SHADER_BINARY_FORMATS: *params = 0; break;
+ case GL_SHADER_BINARY_FORMATS: /* no shader binary formats are supported */ break;
+ case GL_ARRAY_BUFFER_BINDING: *params = mState.arrayBuffer.id(); break;
+ case GL_ELEMENT_ARRAY_BUFFER_BINDING: *params = getCurrentVertexArray()->getElementArrayBufferId(); break;
+ //case GL_FRAMEBUFFER_BINDING: // now equivalent to GL_DRAW_FRAMEBUFFER_BINDING_ANGLE
+ case GL_DRAW_FRAMEBUFFER_BINDING_ANGLE: *params = mState.drawFramebuffer; break;
+ case GL_READ_FRAMEBUFFER_BINDING_ANGLE: *params = mState.readFramebuffer; break;
+ case GL_RENDERBUFFER_BINDING: *params = mState.renderbuffer.id(); break;
+ case GL_VERTEX_ARRAY_BINDING: *params = mState.vertexArray; break;
+ case GL_CURRENT_PROGRAM: *params = mState.currentProgram; break;
+ case GL_PACK_ALIGNMENT: *params = mState.pack.alignment; break;
+ case GL_PACK_REVERSE_ROW_ORDER_ANGLE: *params = mState.pack.reverseRowOrder; break;
+ case GL_UNPACK_ALIGNMENT: *params = mState.unpack.alignment; break;
+ case GL_GENERATE_MIPMAP_HINT: *params = mState.generateMipmapHint; break;
+ case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES: *params = mState.fragmentShaderDerivativeHint; break;
+ case GL_ACTIVE_TEXTURE: *params = (mState.activeSampler + GL_TEXTURE0); break;
+ case GL_STENCIL_FUNC: *params = mState.depthStencil.stencilFunc; break;
+ case GL_STENCIL_REF: *params = mState.stencilRef; break;
+ case GL_STENCIL_VALUE_MASK: *params = clampToInt(mState.depthStencil.stencilMask); break;
+ case GL_STENCIL_BACK_FUNC: *params = mState.depthStencil.stencilBackFunc; break;
+ case GL_STENCIL_BACK_REF: *params = mState.stencilBackRef; break;
+ case GL_STENCIL_BACK_VALUE_MASK: *params = clampToInt(mState.depthStencil.stencilBackMask); break;
+ case GL_STENCIL_FAIL: *params = mState.depthStencil.stencilFail; break;
+ case GL_STENCIL_PASS_DEPTH_FAIL: *params = mState.depthStencil.stencilPassDepthFail; break;
+ case GL_STENCIL_PASS_DEPTH_PASS: *params = mState.depthStencil.stencilPassDepthPass; break;
+ case GL_STENCIL_BACK_FAIL: *params = mState.depthStencil.stencilBackFail; break;
+ case GL_STENCIL_BACK_PASS_DEPTH_FAIL: *params = mState.depthStencil.stencilBackPassDepthFail; break;
+ case GL_STENCIL_BACK_PASS_DEPTH_PASS: *params = mState.depthStencil.stencilBackPassDepthPass; break;
+ case GL_DEPTH_FUNC: *params = mState.depthStencil.depthFunc; break;
+ case GL_BLEND_SRC_RGB: *params = mState.blend.sourceBlendRGB; break;
+ case GL_BLEND_SRC_ALPHA: *params = mState.blend.sourceBlendAlpha; break;
+ case GL_BLEND_DST_RGB: *params = mState.blend.destBlendRGB; break;
+ case GL_BLEND_DST_ALPHA: *params = mState.blend.destBlendAlpha; break;
+ case GL_BLEND_EQUATION_RGB: *params = mState.blend.blendEquationRGB; break;
+ case GL_BLEND_EQUATION_ALPHA: *params = mState.blend.blendEquationAlpha; break;
+ case GL_STENCIL_WRITEMASK: *params = clampToInt(mState.depthStencil.stencilWritemask); break;
+ case GL_STENCIL_BACK_WRITEMASK: *params = clampToInt(mState.depthStencil.stencilBackWritemask); break;
+ case GL_STENCIL_CLEAR_VALUE: *params = mState.stencilClearValue; break;
+ case GL_SUBPIXEL_BITS: *params = 4; break;
+ case GL_MAX_TEXTURE_SIZE: *params = getMaximum2DTextureDimension(); break;
+ case GL_MAX_CUBE_MAP_TEXTURE_SIZE: *params = getMaximumCubeTextureDimension(); break;
+ case GL_MAX_3D_TEXTURE_SIZE: *params = getMaximum3DTextureDimension(); break;
+ case GL_MAX_ARRAY_TEXTURE_LAYERS: *params = getMaximum2DArrayTextureLayers(); break;
+ case GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT: *params = getUniformBufferOffsetAlignment(); break;
+ case GL_MAX_UNIFORM_BUFFER_BINDINGS: *params = getMaximumCombinedUniformBufferBindings(); break;
+ case GL_MAX_VERTEX_UNIFORM_BLOCKS: *params = mRenderer->getMaxVertexShaderUniformBuffers(); break;
+ case GL_MAX_FRAGMENT_UNIFORM_BLOCKS: *params = mRenderer->getMaxFragmentShaderUniformBuffers(); break;
+ case GL_MAX_COMBINED_UNIFORM_BLOCKS: *params = getMaximumCombinedUniformBufferBindings(); break;
+ case GL_MAJOR_VERSION: *params = mClientVersion; break;
+ case GL_MINOR_VERSION: *params = 0; break;
+ case GL_MAX_ELEMENTS_INDICES: *params = mRenderer->getMaxRecommendedElementsIndices(); break;
+ case GL_MAX_ELEMENTS_VERTICES: *params = mRenderer->getMaxRecommendedElementsVertices(); break;
+ case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: *params = mRenderer->getMaxTransformFeedbackInterleavedComponents(); break;
+ case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: *params = mRenderer->getMaxTransformFeedbackBuffers(); break;
+ case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: *params = mRenderer->getMaxTransformFeedbackSeparateComponents(); break;
+ case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
params[0] = mNumCompressedTextureFormats;
break;
case GL_MAX_SAMPLES_ANGLE:
- {
- GLsizei maxSamples = getMaxSupportedSamples();
- if (maxSamples != 0)
- {
- *params = maxSamples;
- }
- else
- {
- return false;
- }
-
- break;
- }
- case GL_SAMPLE_BUFFERS:
+ *params = static_cast<GLint>(getMaxSupportedSamples());
+ break;
+ case GL_SAMPLE_BUFFERS:
case GL_SAMPLES:
{
gl::Framebuffer *framebuffer = getDrawFramebuffer();
@@ -1377,7 +1824,7 @@ bool Context::getIntegerv(GLenum pname, GLint *params)
break;
}
}
- else
+ else
{
*params = 0;
}
@@ -1386,14 +1833,12 @@ bool Context::getIntegerv(GLenum pname, GLint *params)
case GL_IMPLEMENTATION_COLOR_READ_TYPE:
case GL_IMPLEMENTATION_COLOR_READ_FORMAT:
{
- GLenum format, type;
- if (getCurrentReadFormatType(&format, &type))
- {
- if (pname == GL_IMPLEMENTATION_COLOR_READ_FORMAT)
- *params = format;
- else
- *params = type;
- }
+ GLenum internalFormat, format, type;
+ getCurrentReadFormatType(&internalFormat, &format, &type);
+ if (pname == GL_IMPLEMENTATION_COLOR_READ_FORMAT)
+ *params = format;
+ else
+ *params = type;
}
break;
case GL_MAX_VIEWPORT_DIMS:
@@ -1439,7 +1884,7 @@ bool Context::getIntegerv(GLenum pname, GLint *params)
case GL_ALPHA_BITS:
{
gl::Framebuffer *framebuffer = getDrawFramebuffer();
- gl::Renderbuffer *colorbuffer = framebuffer->getFirstColorbuffer();
+ gl::FramebufferAttachment *colorbuffer = framebuffer->getFirstColorbuffer();
if (colorbuffer)
{
@@ -1460,7 +1905,7 @@ bool Context::getIntegerv(GLenum pname, GLint *params)
case GL_DEPTH_BITS:
{
gl::Framebuffer *framebuffer = getDrawFramebuffer();
- gl::Renderbuffer *depthbuffer = framebuffer->getDepthbuffer();
+ gl::FramebufferAttachment *depthbuffer = framebuffer->getDepthbuffer();
if (depthbuffer)
{
@@ -1475,7 +1920,7 @@ bool Context::getIntegerv(GLenum pname, GLint *params)
case GL_STENCIL_BITS:
{
gl::Framebuffer *framebuffer = getDrawFramebuffer();
- gl::Renderbuffer *stencilbuffer = framebuffer->getStencilbuffer();
+ gl::FramebufferAttachment *stencilbuffer = framebuffer->getStencilbuffer();
if (stencilbuffer)
{
@@ -1488,26 +1933,20 @@ bool Context::getIntegerv(GLenum pname, GLint *params)
}
break;
case GL_TEXTURE_BINDING_2D:
- {
- if (mState.activeSampler > mRenderer->getMaxCombinedTextureImageUnits() - 1)
- {
- gl::error(GL_INVALID_OPERATION);
- return false;
- }
-
- *params = mState.samplerTexture[TEXTURE_2D][mState.activeSampler].id();
- }
+ ASSERT(mState.activeSampler < mRenderer->getMaxCombinedTextureImageUnits());
+ *params = mState.samplerTexture[TEXTURE_2D][mState.activeSampler].id();
break;
case GL_TEXTURE_BINDING_CUBE_MAP:
- {
- if (mState.activeSampler > mRenderer->getMaxCombinedTextureImageUnits() - 1)
- {
- gl::error(GL_INVALID_OPERATION);
- return false;
- }
-
- *params = mState.samplerTexture[TEXTURE_CUBE][mState.activeSampler].id();
- }
+ ASSERT(mState.activeSampler < mRenderer->getMaxCombinedTextureImageUnits());
+ *params = mState.samplerTexture[TEXTURE_CUBE][mState.activeSampler].id();
+ break;
+ case GL_TEXTURE_BINDING_3D:
+ ASSERT(mState.activeSampler < mRenderer->getMaxCombinedTextureImageUnits());
+ *params = mState.samplerTexture[TEXTURE_3D][mState.activeSampler].id();
+ break;
+ case GL_TEXTURE_BINDING_2D_ARRAY:
+ ASSERT(mState.activeSampler < mRenderer->getMaxCombinedTextureImageUnits());
+ *params = mState.samplerTexture[TEXTURE_2D_ARRAY][mState.activeSampler].id();
break;
case GL_RESET_NOTIFICATION_STRATEGY_EXT:
*params = mResetStrategy;
@@ -1518,6 +1957,118 @@ bool Context::getIntegerv(GLenum pname, GLint *params)
case GL_PROGRAM_BINARY_FORMATS_OES:
*params = GL_PROGRAM_BINARY_ANGLE;
break;
+ case GL_UNIFORM_BUFFER_BINDING:
+ *params = mState.genericUniformBuffer.id();
+ break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
+ *params = mState.genericTransformFeedbackBuffer.id();
+ break;
+ case GL_COPY_READ_BUFFER_BINDING:
+ *params = mState.copyReadBuffer.id();
+ break;
+ case GL_COPY_WRITE_BUFFER_BINDING:
+ *params = mState.copyWriteBuffer.id();
+ break;
+ case GL_PIXEL_PACK_BUFFER_BINDING:
+ *params = mState.pack.pixelBuffer.id();
+ break;
+ case GL_PIXEL_UNPACK_BUFFER_BINDING:
+ *params = mState.unpack.pixelBuffer.id();
+ break;
+ case GL_NUM_EXTENSIONS:
+ *params = static_cast<GLint>(getNumExtensions());
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+void Context::getInteger64v(GLenum pname, GLint64 *params)
+{
+ switch (pname)
+ {
+ case GL_MAX_ELEMENT_INDEX:
+ *params = static_cast<GLint64>(std::numeric_limits<unsigned int>::max());
+ break;
+ case GL_MAX_UNIFORM_BLOCK_SIZE:
+ *params = static_cast<GLint64>(mRenderer->getMaxUniformBufferSize());
+ break;
+ case GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:
+ {
+ GLint64 uniformBufferComponents = static_cast<GLint64>(mRenderer->getMaxVertexShaderUniformBuffers()) * static_cast<GLint64>(mRenderer->getMaxUniformBufferSize() / 4);
+ GLint64 defaultBufferComponents = static_cast<GLint64>(mRenderer->getMaxVertexUniformVectors() * 4);
+ *params = uniformBufferComponents + defaultBufferComponents;
+ }
+ break;
+ case GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:
+ {
+ GLint64 uniformBufferComponents = static_cast<GLint64>(mRenderer->getMaxFragmentShaderUniformBuffers()) * static_cast<GLint64>(mRenderer->getMaxUniformBufferSize() / 4);
+ GLint64 defaultBufferComponents = static_cast<GLint64>(mRenderer->getMaxVertexUniformVectors() * 4);
+ *params = uniformBufferComponents + defaultBufferComponents;
+ }
+ break;
+ case GL_MAX_SERVER_WAIT_TIMEOUT:
+ // We do not wait for server fence objects internally, so report a max timeout of zero.
+ *params = 0;
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+bool Context::getIndexedIntegerv(GLenum target, GLuint index, GLint *data)
+{
+ switch (target)
+ {
+ case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
+ if (index < IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS)
+ {
+ *data = mState.transformFeedbackBuffers[index].id();
+ }
+ break;
+ case GL_UNIFORM_BUFFER_BINDING:
+ if (index < IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS)
+ {
+ *data = mState.uniformBuffers[index].id();
+ }
+ break;
+ default:
+ return false;
+ }
+
+ return true;
+}
+
+bool Context::getIndexedInteger64v(GLenum target, GLuint index, GLint64 *data)
+{
+ switch (target)
+ {
+ case GL_TRANSFORM_FEEDBACK_BUFFER_START:
+ if (index < IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS)
+ {
+ *data = mState.transformFeedbackBuffers[index].getOffset();
+ }
+ break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
+ if (index < IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS)
+ {
+ *data = mState.transformFeedbackBuffers[index].getSize();
+ }
+ break;
+ case GL_UNIFORM_BUFFER_START:
+ if (index < IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS)
+ {
+ *data = mState.uniformBuffers[index].getOffset();
+ }
+ break;
+ case GL_UNIFORM_BUFFER_SIZE:
+ if (index < IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS)
+ {
+ *data = mState.uniformBuffers[index].getSize();
+ }
+ break;
default:
return false;
}
@@ -1537,7 +2088,7 @@ bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *nu
// Please note: the query type returned for DEPTH_CLEAR_VALUE in this implementation
// is FLOAT rather than INT, as would be suggested by the GL ES 2.0 spec. This is due
// to the fact that it is stored internally as a float, and so would require conversion
- // if returned from Context::getIntegerv. Since this conversion is already implemented
+ // if returned from Context::getIntegerv. Since this conversion is already implemented
// in the case that one calls glGetIntegerv to retrieve a float-typed state variable, we
// place DEPTH_CLEAR_VALUE with the floats. This should make no difference to the calling
// application.
@@ -1548,13 +2099,13 @@ bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *nu
*type = GL_INT;
*numParams = mNumCompressedTextureFormats;
}
- break;
+ return true;
case GL_SHADER_BINARY_FORMATS:
{
*type = GL_INT;
*numParams = 0;
}
- break;
+ return true;
case GL_MAX_VERTEX_ATTRIBS:
case GL_MAX_VERTEX_UNIFORM_VECTORS:
case GL_MAX_VARYING_VECTORS:
@@ -1568,7 +2119,9 @@ bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *nu
case GL_NUM_SHADER_BINARY_FORMATS:
case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
case GL_ARRAY_BUFFER_BINDING:
- case GL_FRAMEBUFFER_BINDING:
+ //case GL_FRAMEBUFFER_BINDING: // equivalent to DRAW_FRAMEBUFFER_BINDING_ANGLE
+ case GL_DRAW_FRAMEBUFFER_BINDING_ANGLE:
+ case GL_READ_FRAMEBUFFER_BINDING_ANGLE:
case GL_RENDERBUFFER_BINDING:
case GL_CURRENT_PROGRAM:
case GL_PACK_ALIGNMENT:
@@ -1624,7 +2177,7 @@ bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *nu
*type = GL_INT;
*numParams = 1;
}
- break;
+ return true;
case GL_MAX_SAMPLES_ANGLE:
{
if (getMaxSupportedSamples() != 0)
@@ -1637,20 +2190,34 @@ bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *nu
return false;
}
}
- break;
+ return true;
+ case GL_PIXEL_PACK_BUFFER_BINDING:
+ case GL_PIXEL_UNPACK_BUFFER_BINDING:
+ {
+ if (supportsPBOs())
+ {
+ *type = GL_INT;
+ *numParams = 1;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ return true;
case GL_MAX_VIEWPORT_DIMS:
{
*type = GL_INT;
*numParams = 2;
}
- break;
+ return true;
case GL_VIEWPORT:
case GL_SCISSOR_BOX:
{
*type = GL_INT;
*numParams = 4;
}
- break;
+ return true;
case GL_SHADER_COMPILER:
case GL_SAMPLE_COVERAGE_INVERT:
case GL_DEPTH_WRITEMASK:
@@ -1668,13 +2235,13 @@ bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *nu
*type = GL_BOOL;
*numParams = 1;
}
- break;
+ return true;
case GL_COLOR_WRITEMASK:
{
*type = GL_BOOL;
*numParams = 4;
}
- break;
+ return true;
case GL_POLYGON_OFFSET_FACTOR:
case GL_POLYGON_OFFSET_UNITS:
case GL_SAMPLE_COVERAGE_VALUE:
@@ -1684,7 +2251,7 @@ bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *nu
*type = GL_FLOAT;
*numParams = 1;
}
- break;
+ return true;
case GL_ALIASED_LINE_WIDTH_RANGE:
case GL_ALIASED_POINT_SIZE_RANGE:
case GL_DEPTH_RANGE:
@@ -1692,14 +2259,14 @@ bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *nu
*type = GL_FLOAT;
*numParams = 2;
}
- break;
+ return true;
case GL_COLOR_CLEAR_VALUE:
case GL_BLEND_COLOR:
{
*type = GL_FLOAT;
*numParams = 4;
}
- break;
+ return true;
case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:
if (!supportsTextureFilterAnisotropy())
{
@@ -1707,12 +2274,98 @@ bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *nu
}
*type = GL_FLOAT;
*numParams = 1;
- break;
- default:
+ return true;
+ }
+
+ if (mClientVersion < 3)
+ {
return false;
}
- return true;
+ // Check for ES3.0+ parameter names
+ switch (pname)
+ {
+ case GL_MAX_UNIFORM_BUFFER_BINDINGS:
+ case GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT:
+ case GL_UNIFORM_BUFFER_BINDING:
+ case GL_TRANSFORM_FEEDBACK_BINDING:
+ case GL_COPY_READ_BUFFER_BINDING:
+ case GL_COPY_WRITE_BUFFER_BINDING:
+ case GL_TEXTURE_BINDING_3D:
+ case GL_TEXTURE_BINDING_2D_ARRAY:
+ case GL_MAX_3D_TEXTURE_SIZE:
+ case GL_MAX_ARRAY_TEXTURE_LAYERS:
+ case GL_MAX_VERTEX_UNIFORM_BLOCKS:
+ case GL_MAX_FRAGMENT_UNIFORM_BLOCKS:
+ case GL_MAX_COMBINED_UNIFORM_BLOCKS:
+ case GL_MAX_VARYING_COMPONENTS:
+ case GL_VERTEX_ARRAY_BINDING:
+ case GL_MAX_VERTEX_UNIFORM_COMPONENTS:
+ case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS:
+ case GL_NUM_EXTENSIONS:
+ case GL_MAJOR_VERSION:
+ case GL_MINOR_VERSION:
+ case GL_MAX_ELEMENTS_INDICES:
+ case GL_MAX_ELEMENTS_VERTICES:
+ case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:
+ case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:
+ case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:
+ {
+ *type = GL_INT;
+ *numParams = 1;
+ }
+ return true;
+
+ case GL_MAX_ELEMENT_INDEX:
+ case GL_MAX_UNIFORM_BLOCK_SIZE:
+ case GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:
+ case GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:
+ case GL_MAX_SERVER_WAIT_TIMEOUT:
+ {
+ *type = GL_INT_64_ANGLEX;
+ *numParams = 1;
+ }
+ return true;
+
+ case GL_TRANSFORM_FEEDBACK_ACTIVE:
+ case GL_TRANSFORM_FEEDBACK_PAUSED:
+ {
+ *type = GL_BOOL;
+ *numParams = 1;
+ }
+ return true;
+ }
+
+ return false;
+}
+
+bool Context::getIndexedQueryParameterInfo(GLenum target, GLenum *type, unsigned int *numParams)
+{
+ if (mClientVersion < 3)
+ {
+ return false;
+ }
+
+ switch (target)
+ {
+ case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
+ case GL_UNIFORM_BUFFER_BINDING:
+ {
+ *type = GL_INT;
+ *numParams = 1;
+ }
+ return true;
+ case GL_TRANSFORM_FEEDBACK_BUFFER_START:
+ case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
+ case GL_UNIFORM_BUFFER_START:
+ case GL_UNIFORM_BUFFER_SIZE:
+ {
+ *type = GL_INT_64_ANGLEX;
+ *numParams = 1;
+ }
+ }
+
+ return false;
}
// Applies the render target surface, depth stencil surface, viewport rectangle and
@@ -1754,7 +2407,7 @@ void Context::applyState(GLenum drawMode)
{
if (mState.sampleCoverageValue != 0)
{
-
+
float threshold = 0.5f;
for (int i = 0; i < samples; ++i)
@@ -1778,146 +2431,217 @@ void Context::applyState(GLenum drawMode)
{
mask = 0xFFFFFFFF;
}
- mRenderer->setBlendState(mState.blend, mState.blendColor, mask);
+ mRenderer->setBlendState(framebufferObject, mState.blend, mState.blendColor, mask);
mRenderer->setDepthStencilState(mState.depthStencil, mState.stencilRef, mState.stencilBackRef,
mState.rasterizer.frontFace == GL_CCW);
}
// Applies the shaders and shader constants to the Direct3D 9 device
-void Context::applyShaders()
+void Context::applyShaders(ProgramBinary *programBinary, bool transformFeedbackActive)
{
- ProgramBinary *programBinary = getCurrentProgramBinary();
+ const VertexAttribute *vertexAttributes = getCurrentVertexArray()->getVertexAttributes();
+
+ VertexFormat inputLayout[gl::MAX_VERTEX_ATTRIBS];
+ VertexFormat::GetInputLayout(inputLayout, programBinary, vertexAttributes, mState.vertexAttribCurrentValues);
+
+ mRenderer->applyShaders(programBinary, mState.rasterizer.rasterizerDiscard, transformFeedbackActive, inputLayout);
- mRenderer->applyShaders(programBinary);
-
programBinary->applyUniforms();
}
-// Applies the textures and sampler states to the Direct3D 9 device
-void Context::applyTextures()
+size_t Context::getCurrentTexturesAndSamplerStates(ProgramBinary *programBinary, SamplerType type, Texture **outTextures,
+ TextureType *outTextureTypes, SamplerState *outSamplers)
{
- applyTextures(SAMPLER_PIXEL);
+ size_t samplerRange = programBinary->getUsedSamplerRange(type);
+ for (size_t i = 0; i < samplerRange; i++)
+ {
+ outTextureTypes[i] = programBinary->getSamplerTextureType(type, i);
+ GLint textureUnit = programBinary->getSamplerMapping(type, i); // OpenGL texture image unit index
+ if (textureUnit != -1)
+ {
+ outTextures[i] = getSamplerTexture(textureUnit, outTextureTypes[i]);
+ outTextures[i]->getSamplerState(&outSamplers[i]);
+ if (mState.samplers[textureUnit] != 0)
+ {
+ Sampler *samplerObject = getSampler(mState.samplers[textureUnit]);
+ samplerObject->getState(&outSamplers[i]);
+ }
+ }
+ else
+ {
+ outTextures[i] = NULL;
+ }
+ }
+
+ return samplerRange;
+}
- if (mSupportsVertexTexture)
+void Context::generateSwizzles(Texture *textures[], size_t count)
+{
+ for (size_t i = 0; i < count; i++)
{
- applyTextures(SAMPLER_VERTEX);
+ if (textures[i] && textures[i]->isSwizzled())
+ {
+ mRenderer->generateSwizzle(textures[i]);
+ }
}
}
-// For each Direct3D 9 sampler of either the pixel or vertex stage,
+// For each Direct3D sampler of either the pixel or vertex stage,
// looks up the corresponding OpenGL texture image unit and texture type,
// and sets the texture and its addressing/filtering state (or NULL when inactive).
-void Context::applyTextures(SamplerType type)
+void Context::applyTextures(SamplerType shaderType, Texture *textures[], TextureType *textureTypes, SamplerState *samplers,
+ size_t textureCount, const FramebufferTextureSerialArray& framebufferSerials,
+ size_t framebufferSerialCount)
{
- ProgramBinary *programBinary = getCurrentProgramBinary();
-
- FramebufferTextureSerialSet boundFramebufferTextures = getBoundFramebufferTextureSerials();
-
// Range of Direct3D samplers of given sampler type
- int samplerCount = (type == SAMPLER_PIXEL) ? MAX_TEXTURE_IMAGE_UNITS : mRenderer->getMaxVertexTextureImageUnits();
- int samplerRange = programBinary->getUsedSamplerRange(type);
+ size_t samplerCount = (shaderType == SAMPLER_PIXEL) ? MAX_TEXTURE_IMAGE_UNITS
+ : mRenderer->getMaxVertexTextureImageUnits();
- for (int samplerIndex = 0; samplerIndex < samplerRange; samplerIndex++)
+ for (size_t samplerIndex = 0; samplerIndex < textureCount; samplerIndex++)
{
- int textureUnit = programBinary->getSamplerMapping(type, samplerIndex); // OpenGL texture image unit index
+ Texture *texture = textures[samplerIndex];
+ const SamplerState &sampler = samplers[samplerIndex];
+ TextureType textureType = textureTypes[samplerIndex];
- if (textureUnit != -1)
+ if (texture)
{
- TextureType textureType = programBinary->getSamplerTextureType(type, samplerIndex);
- Texture *texture = getSamplerTexture(textureUnit, textureType);
-
- if (texture->isSamplerComplete() &&
- boundFramebufferTextures.find(texture->getTextureSerial()) == boundFramebufferTextures.end())
+ // TODO: std::binary_search may become unavailable using older versions of GCC
+ if (texture->isSamplerComplete(sampler) &&
+ !std::binary_search(framebufferSerials.begin(), framebufferSerials.begin() + framebufferSerialCount, texture->getTextureSerial()))
{
- SamplerState samplerState;
- texture->getSamplerState(&samplerState);
- mRenderer->setSamplerState(type, samplerIndex, samplerState);
-
- mRenderer->setTexture(type, samplerIndex, texture);
-
+ mRenderer->setSamplerState(shaderType, samplerIndex, sampler);
+ mRenderer->setTexture(shaderType, samplerIndex, texture);
texture->resetDirty();
}
else
{
- mRenderer->setTexture(type, samplerIndex, getIncompleteTexture(textureType));
+ Texture *incompleteTexture = getIncompleteTexture(textureType);
+ mRenderer->setTexture(shaderType, samplerIndex, incompleteTexture);
+ incompleteTexture->resetDirty();
}
}
else
{
- mRenderer->setTexture(type, samplerIndex, NULL);
+ mRenderer->setTexture(shaderType, samplerIndex, NULL);
}
}
- for (int samplerIndex = samplerRange; samplerIndex < samplerCount; samplerIndex++)
+ for (size_t samplerIndex = textureCount; samplerIndex < samplerCount; samplerIndex++)
{
- mRenderer->setTexture(type, samplerIndex, NULL);
+ mRenderer->setTexture(shaderType, samplerIndex, NULL);
}
}
-void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type, GLsizei *bufSize, void* pixels)
+bool Context::applyUniformBuffers()
{
- Framebuffer *framebuffer = getReadFramebuffer();
+ Program *programObject = getProgram(mState.currentProgram);
+ ProgramBinary *programBinary = programObject->getProgramBinary();
+
+ std::vector<gl::Buffer*> boundBuffers;
- if (framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE)
+ for (unsigned int uniformBlockIndex = 0; uniformBlockIndex < programBinary->getActiveUniformBlockCount(); uniformBlockIndex++)
{
- return gl::error(GL_INVALID_FRAMEBUFFER_OPERATION);
+ GLuint blockBinding = programObject->getUniformBlockBinding(uniformBlockIndex);
+ const OffsetBindingPointer<Buffer>& boundBuffer = mState.uniformBuffers[blockBinding];
+ if (boundBuffer.id() == 0)
+ {
+ // undefined behaviour
+ return false;
+ }
+ else
+ {
+ gl::Buffer *uniformBuffer = boundBuffer.get();
+ ASSERT(uniformBuffer);
+ boundBuffers.push_back(uniformBuffer);
+ }
}
- if (getReadFramebufferHandle() != 0 && framebuffer->getSamples() != 0)
+ return programBinary->applyUniformBuffers(boundBuffers);
+}
+
+bool Context::applyTransformFeedbackBuffers()
+{
+ TransformFeedback *curTransformFeedback = getCurrentTransformFeedback();
+ if (curTransformFeedback && curTransformFeedback->isStarted() && !curTransformFeedback->isPaused())
{
- return gl::error(GL_INVALID_OPERATION);
+ Buffer *transformFeedbackBuffers[IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS];
+ GLintptr transformFeedbackOffsets[IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS];
+ for (size_t i = 0; i < IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS; i++)
+ {
+ transformFeedbackBuffers[i] = mState.transformFeedbackBuffers[i].get();
+ transformFeedbackOffsets[i] = mState.transformFeedbackBuffers[i].getOffset();
+ }
+ mRenderer->applyTransformFeedbackBuffers(transformFeedbackBuffers, transformFeedbackOffsets);
+ return true;
}
+ else
+ {
+ return false;
+ }
+}
- GLsizei outputPitch = ComputePitch(width, ConvertSizedInternalFormat(format, type), getPackAlignment());
- // sized query sanity check
- if (bufSize)
+void Context::markTransformFeedbackUsage()
+{
+ for (size_t i = 0; i < IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS; i++)
{
- int requiredSize = outputPitch * height;
- if (requiredSize > *bufSize)
+ Buffer *buffer = mState.transformFeedbackBuffers[i].get();
+ if (buffer)
{
- return gl::error(GL_INVALID_OPERATION);
+ buffer->markTransformFeedbackUsage();
}
}
-
- mRenderer->readPixels(framebuffer, x, y, width, height, format, type, outputPitch, getPackReverseRowOrder(), getPackAlignment(), pixels);
}
void Context::clear(GLbitfield mask)
{
- Framebuffer *framebufferObject = getDrawFramebuffer();
-
- if (!framebufferObject || framebufferObject->completeness() != GL_FRAMEBUFFER_COMPLETE)
+ if (isRasterizerDiscardEnabled())
{
- return gl::error(GL_INVALID_FRAMEBUFFER_OPERATION);
+ return;
}
- DWORD flags = 0;
- GLbitfield finalMask = 0;
+ ClearParameters clearParams = { 0 };
+ for (unsigned int i = 0; i < ArraySize(clearParams.clearColor); i++)
+ {
+ clearParams.clearColor[i] = false;
+ }
+ clearParams.colorFClearValue = mState.colorClearValue;
+ clearParams.colorClearType = GL_FLOAT;
+ clearParams.colorMaskRed = mState.blend.colorMaskRed;
+ clearParams.colorMaskGreen = mState.blend.colorMaskGreen;
+ clearParams.colorMaskBlue = mState.blend.colorMaskBlue;
+ clearParams.colorMaskAlpha = mState.blend.colorMaskAlpha;
+ clearParams.clearDepth = false;
+ clearParams.depthClearValue = mState.depthClearValue;
+ clearParams.clearStencil = false;
+ clearParams.stencilClearValue = mState.stencilClearValue;
+ clearParams.stencilWriteMask = mState.depthStencil.stencilWritemask;
+ clearParams.scissorEnabled = mState.scissorTest;
+ clearParams.scissor = mState.scissor;
+ Framebuffer *framebufferObject = getDrawFramebuffer();
if (mask & GL_COLOR_BUFFER_BIT)
{
- mask &= ~GL_COLOR_BUFFER_BIT;
-
if (framebufferObject->hasEnabledColorAttachment())
{
- finalMask |= GL_COLOR_BUFFER_BIT;
+ for (unsigned int i = 0; i < ArraySize(clearParams.clearColor); i++)
+ {
+ clearParams.clearColor[i] = true;
+ }
}
}
if (mask & GL_DEPTH_BUFFER_BIT)
{
- mask &= ~GL_DEPTH_BUFFER_BIT;
if (mState.depthStencil.depthMask && framebufferObject->getDepthbufferType() != GL_NONE)
{
- finalMask |= GL_DEPTH_BUFFER_BIT;
+ clearParams.clearDepth = true;
}
}
if (mask & GL_STENCIL_BUFFER_BIT)
{
- mask &= ~GL_STENCIL_BUFFER_BIT;
if (framebufferObject->getStencilbufferType() != GL_NONE)
{
rx::RenderTarget *depthStencil = framebufferObject->getStencilbuffer()->getDepthStencil();
@@ -1927,35 +2651,221 @@ void Context::clear(GLbitfield mask)
return;
}
- if (GetStencilSize(depthStencil->getActualFormat()) > 0)
+ if (gl::GetStencilBits(depthStencil->getActualFormat(), mClientVersion) > 0)
{
- finalMask |= GL_STENCIL_BUFFER_BIT;
+ clearParams.clearStencil = true;
}
}
}
- if (mask != 0)
+
+ if (!applyRenderTarget(GL_TRIANGLES, true)) // Clips the clear to the scissor rectangle but not the viewport
+ {
+ return;
+ }
+
+ mRenderer->clear(clearParams, framebufferObject);
+}
+
+void Context::clearBufferfv(GLenum buffer, int drawbuffer, const float *values)
+{
+ if (isRasterizerDiscardEnabled())
+ {
+ return;
+ }
+
+ // glClearBufferfv can be called to clear the color buffer or depth buffer
+ ClearParameters clearParams = { 0 };
+
+ if (buffer == GL_COLOR)
+ {
+ for (unsigned int i = 0; i < ArraySize(clearParams.clearColor); i++)
+ {
+ clearParams.clearColor[i] = (drawbuffer == static_cast<int>(i));
+ }
+ clearParams.colorFClearValue = ColorF(values[0], values[1], values[2], values[3]);
+ clearParams.colorClearType = GL_FLOAT;
+ }
+ else
+ {
+ for (unsigned int i = 0; i < ArraySize(clearParams.clearColor); i++)
+ {
+ clearParams.clearColor[i] = false;
+ }
+ clearParams.colorFClearValue = mState.colorClearValue;
+ clearParams.colorClearType = GL_FLOAT;
+ }
+
+ clearParams.colorMaskRed = mState.blend.colorMaskRed;
+ clearParams.colorMaskGreen = mState.blend.colorMaskGreen;
+ clearParams.colorMaskBlue = mState.blend.colorMaskBlue;
+ clearParams.colorMaskAlpha = mState.blend.colorMaskAlpha;
+
+ if (buffer == GL_DEPTH)
+ {
+ clearParams.clearDepth = true;
+ clearParams.depthClearValue = values[0];
+ }
+ else
{
- return gl::error(GL_INVALID_VALUE);
+ clearParams.clearDepth = false;
+ clearParams.depthClearValue = mState.depthClearValue;
}
+ clearParams.clearStencil = false;
+ clearParams.stencilClearValue = mState.stencilClearValue;
+ clearParams.stencilWriteMask = mState.depthStencil.stencilWritemask;
+ clearParams.scissorEnabled = mState.scissorTest;
+ clearParams.scissor = mState.scissor;
+
if (!applyRenderTarget(GL_TRIANGLES, true)) // Clips the clear to the scissor rectangle but not the viewport
{
return;
}
- ClearParameters clearParams;
- clearParams.mask = finalMask;
- clearParams.colorClearValue = mState.colorClearValue;
+ mRenderer->clear(clearParams, getDrawFramebuffer());
+}
+
+void Context::clearBufferuiv(GLenum buffer, int drawbuffer, const unsigned int *values)
+{
+ if (isRasterizerDiscardEnabled())
+ {
+ return;
+ }
+
+ // glClearBufferuv can only be called to clear a color buffer
+ ClearParameters clearParams = { 0 };
+ for (unsigned int i = 0; i < ArraySize(clearParams.clearColor); i++)
+ {
+ clearParams.clearColor[i] = (drawbuffer == static_cast<int>(i));
+ }
+ clearParams.colorUIClearValue = ColorUI(values[0], values[1], values[2], values[3]);
+ clearParams.colorClearType = GL_UNSIGNED_INT;
clearParams.colorMaskRed = mState.blend.colorMaskRed;
clearParams.colorMaskGreen = mState.blend.colorMaskGreen;
clearParams.colorMaskBlue = mState.blend.colorMaskBlue;
clearParams.colorMaskAlpha = mState.blend.colorMaskAlpha;
+ clearParams.clearDepth = false;
clearParams.depthClearValue = mState.depthClearValue;
+ clearParams.clearStencil = false;
clearParams.stencilClearValue = mState.stencilClearValue;
clearParams.stencilWriteMask = mState.depthStencil.stencilWritemask;
+ clearParams.scissorEnabled = mState.scissorTest;
+ clearParams.scissor = mState.scissor;
- mRenderer->clear(clearParams, framebufferObject);
+ if (!applyRenderTarget(GL_TRIANGLES, true)) // Clips the clear to the scissor rectangle but not the viewport
+ {
+ return;
+ }
+
+ mRenderer->clear(clearParams, getDrawFramebuffer());
+}
+
+void Context::clearBufferiv(GLenum buffer, int drawbuffer, const int *values)
+{
+ if (isRasterizerDiscardEnabled())
+ {
+ return;
+ }
+
+ // glClearBufferfv can be called to clear the color buffer or stencil buffer
+ ClearParameters clearParams = { 0 };
+
+ if (buffer == GL_COLOR)
+ {
+ for (unsigned int i = 0; i < ArraySize(clearParams.clearColor); i++)
+ {
+ clearParams.clearColor[i] = (drawbuffer == static_cast<int>(i));
+ }
+ clearParams.colorIClearValue = ColorI(values[0], values[1], values[2], values[3]);
+ clearParams.colorClearType = GL_INT;
+ }
+ else
+ {
+ for (unsigned int i = 0; i < ArraySize(clearParams.clearColor); i++)
+ {
+ clearParams.clearColor[i] = false;
+ }
+ clearParams.colorFClearValue = mState.colorClearValue;
+ clearParams.colorClearType = GL_FLOAT;
+ }
+
+ clearParams.colorMaskRed = mState.blend.colorMaskRed;
+ clearParams.colorMaskGreen = mState.blend.colorMaskGreen;
+ clearParams.colorMaskBlue = mState.blend.colorMaskBlue;
+ clearParams.colorMaskAlpha = mState.blend.colorMaskAlpha;
+
+ clearParams.clearDepth = false;
+ clearParams.depthClearValue = mState.depthClearValue;
+
+ if (buffer == GL_STENCIL)
+ {
+ clearParams.clearStencil = true;
+ clearParams.stencilClearValue = values[1];
+ }
+ else
+ {
+ clearParams.clearStencil = false;
+ clearParams.stencilClearValue = mState.stencilClearValue;
+ }
+ clearParams.stencilWriteMask = mState.depthStencil.stencilWritemask;
+
+ clearParams.scissorEnabled = mState.scissorTest;
+ clearParams.scissor = mState.scissor;
+
+ if (!applyRenderTarget(GL_TRIANGLES, true)) // Clips the clear to the scissor rectangle but not the viewport
+ {
+ return;
+ }
+
+ mRenderer->clear(clearParams, getDrawFramebuffer());
+}
+
+void Context::clearBufferfi(GLenum buffer, int drawbuffer, float depth, int stencil)
+{
+ if (isRasterizerDiscardEnabled())
+ {
+ return;
+ }
+
+ // glClearBufferfi can only be called to clear a depth stencil buffer
+ ClearParameters clearParams = { 0 };
+ for (unsigned int i = 0; i < ArraySize(clearParams.clearColor); i++)
+ {
+ clearParams.clearColor[i] = false;
+ }
+ clearParams.colorFClearValue = mState.colorClearValue;
+ clearParams.colorClearType = GL_FLOAT;
+ clearParams.colorMaskRed = mState.blend.colorMaskRed;
+ clearParams.colorMaskGreen = mState.blend.colorMaskGreen;
+ clearParams.colorMaskBlue = mState.blend.colorMaskBlue;
+ clearParams.colorMaskAlpha = mState.blend.colorMaskAlpha;
+ clearParams.clearDepth = true;
+ clearParams.depthClearValue = depth;
+ clearParams.clearStencil = true;
+ clearParams.stencilClearValue = stencil;
+ clearParams.stencilWriteMask = mState.depthStencil.stencilWritemask;
+ clearParams.scissorEnabled = mState.scissorTest;
+ clearParams.scissor = mState.scissor;
+
+ if (!applyRenderTarget(GL_TRIANGLES, true)) // Clips the clear to the scissor rectangle but not the viewport
+ {
+ return;
+ }
+
+ mRenderer->clear(clearParams, getDrawFramebuffer());
+}
+
+void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
+ GLenum format, GLenum type, GLsizei *bufSize, void* pixels)
+{
+ gl::Framebuffer *framebuffer = getReadFramebuffer();
+
+ bool isSized = IsSizedInternalFormat(format, mClientVersion);
+ GLenum sizedInternalFormat = (isSized ? format : GetSizedInternalFormat(format, type, mClientVersion));
+ GLuint outputPitch = GetRowPitch(sizedInternalFormat, type, mClientVersion, width, mState.pack.alignment);
+
+ mRenderer->readPixels(framebuffer, x, y, width, height, format, type, outputPitch, mState.pack, pixels);
}
void Context::drawArrays(GLenum mode, GLint first, GLsizei count, GLsizei instances)
@@ -1965,6 +2875,22 @@ void Context::drawArrays(GLenum mode, GLint first, GLsizei count, GLsizei instan
return gl::error(GL_INVALID_OPERATION);
}
+ ProgramBinary *programBinary = getCurrentProgramBinary();
+ programBinary->applyUniforms();
+
+ Texture *vsTextures[IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS];
+ TextureType vsTextureTypes[IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS];
+ SamplerState vsSamplers[IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS];
+ size_t vsTextureCount = getCurrentTexturesAndSamplerStates(programBinary, SAMPLER_VERTEX, vsTextures, vsTextureTypes, vsSamplers);
+
+ Texture *psTextures[MAX_TEXTURE_IMAGE_UNITS];
+ TextureType psTextureTypes[MAX_TEXTURE_IMAGE_UNITS];
+ SamplerState psSamplers[MAX_TEXTURE_IMAGE_UNITS];
+ size_t psTextureCount = getCurrentTexturesAndSamplerStates(programBinary, SAMPLER_PIXEL, psTextures, psTextureTypes, psSamplers);
+
+ generateSwizzles(vsTextures, vsTextureCount);
+ generateSwizzles(psTextures, psTextureCount);
+
if (!mRenderer->applyPrimitiveType(mode, count))
{
return;
@@ -1977,16 +2903,26 @@ void Context::drawArrays(GLenum mode, GLint first, GLsizei count, GLsizei instan
applyState(mode);
- ProgramBinary *programBinary = getCurrentProgramBinary();
-
- GLenum err = mRenderer->applyVertexBuffer(programBinary, mState.vertexAttribute, first, count, instances);
+ GLenum err = mRenderer->applyVertexBuffer(programBinary, getCurrentVertexArray()->getVertexAttributes(), mState.vertexAttribCurrentValues, first, count, instances);
if (err != GL_NO_ERROR)
{
return gl::error(err);
}
- applyShaders();
- applyTextures();
+ bool transformFeedbackActive = applyTransformFeedbackBuffers();
+
+ applyShaders(programBinary, transformFeedbackActive);
+
+ FramebufferTextureSerialArray frameBufferSerials;
+ size_t framebufferSerialCount = getBoundFramebufferTextureSerials(&frameBufferSerials);
+
+ applyTextures(SAMPLER_VERTEX, vsTextures, vsTextureTypes, vsSamplers, vsTextureCount, frameBufferSerials, framebufferSerialCount);
+ applyTextures(SAMPLER_PIXEL, psTextures, psTextureTypes, psSamplers, psTextureCount, frameBufferSerials, framebufferSerialCount);
+
+ if (!applyUniformBuffers())
+ {
+ return;
+ }
if (!programBinary->validateSamplers(NULL))
{
@@ -1995,7 +2931,12 @@ void Context::drawArrays(GLenum mode, GLint first, GLsizei count, GLsizei instan
if (!skipDraw(mode))
{
- mRenderer->drawArrays(mode, count, instances);
+ mRenderer->drawArrays(mode, count, instances, transformFeedbackActive);
+
+ if (transformFeedbackActive)
+ {
+ markTransformFeedbackUsage();
+ }
}
}
@@ -2006,11 +2947,28 @@ void Context::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid
return gl::error(GL_INVALID_OPERATION);
}
- if (!indices && !mState.elementArrayBuffer)
+ VertexArray *vao = getCurrentVertexArray();
+ if (!indices && !vao->getElementArrayBuffer())
{
return gl::error(GL_INVALID_OPERATION);
}
-
+
+ ProgramBinary *programBinary = getCurrentProgramBinary();
+ programBinary->applyUniforms();
+
+ Texture *vsTextures[IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS];
+ TextureType vsTextureTypes[IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS];
+ SamplerState vsSamplers[IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS];
+ size_t vsTextureCount = getCurrentTexturesAndSamplerStates(programBinary, SAMPLER_VERTEX, vsTextures, vsTextureTypes, vsSamplers);
+
+ Texture *psTextures[MAX_TEXTURE_IMAGE_UNITS];
+ TextureType psTextureTypes[MAX_TEXTURE_IMAGE_UNITS];
+ SamplerState psSamplers[MAX_TEXTURE_IMAGE_UNITS];
+ size_t psTextureCount = getCurrentTexturesAndSamplerStates(programBinary, SAMPLER_PIXEL, psTextures, psTextureTypes, psSamplers);
+
+ generateSwizzles(vsTextures, vsTextureCount);
+ generateSwizzles(psTextures, psTextureCount);
+
if (!mRenderer->applyPrimitiveType(mode, count))
{
return;
@@ -2024,23 +2982,36 @@ void Context::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid
applyState(mode);
rx::TranslatedIndexData indexInfo;
- GLenum err = mRenderer->applyIndexBuffer(indices, mState.elementArrayBuffer.get(), count, mode, type, &indexInfo);
+ GLenum err = mRenderer->applyIndexBuffer(indices, vao->getElementArrayBuffer(), count, mode, type, &indexInfo);
if (err != GL_NO_ERROR)
{
return gl::error(err);
}
- ProgramBinary *programBinary = getCurrentProgramBinary();
-
GLsizei vertexCount = indexInfo.maxIndex - indexInfo.minIndex + 1;
- err = mRenderer->applyVertexBuffer(programBinary, mState.vertexAttribute, indexInfo.minIndex, vertexCount, instances);
+ err = mRenderer->applyVertexBuffer(programBinary, vao->getVertexAttributes(), mState.vertexAttribCurrentValues, indexInfo.minIndex, vertexCount, instances);
if (err != GL_NO_ERROR)
{
return gl::error(err);
}
- applyShaders();
- applyTextures();
+ bool transformFeedbackActive = applyTransformFeedbackBuffers();
+ // Transform feedback is not allowed for DrawElements, this error should have been caught at the API validation
+ // layer.
+ ASSERT(!transformFeedbackActive);
+
+ applyShaders(programBinary, transformFeedbackActive);
+
+ FramebufferTextureSerialArray frameBufferSerials;
+ size_t framebufferSerialCount = getBoundFramebufferTextureSerials(&frameBufferSerials);
+
+ applyTextures(SAMPLER_VERTEX, vsTextures, vsTextureTypes, vsSamplers, vsTextureCount, frameBufferSerials, framebufferSerialCount);
+ applyTextures(SAMPLER_PIXEL, psTextures, psTextureTypes, psSamplers, psTextureCount, frameBufferSerials, framebufferSerialCount);
+
+ if (!applyUniformBuffers())
+ {
+ return;
+ }
if (!programBinary->validateSamplers(NULL))
{
@@ -2049,7 +3020,7 @@ void Context::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid
if (!skipDraw(mode))
{
- mRenderer->drawElements(mode, count, type, indices, mState.elementArrayBuffer.get(), indexInfo, instances);
+ mRenderer->drawElements(mode, count, type, indices, vao->getElementArrayBuffer(), indexInfo, instances);
}
}
@@ -2146,7 +3117,7 @@ GLenum Context::getResetStatus()
mResetStatus = GL_NO_ERROR;
}
}
-
+
return status;
}
@@ -2155,6 +3126,11 @@ bool Context::isResetNotificationEnabled()
return (mResetStrategy == GL_LOSE_CONTEXT_ON_RESET_EXT);
}
+int Context::getClientVersion() const
+{
+ return mClientVersion;
+}
+
int Context::getMajorShaderModel() const
{
return mMajorShaderModel;
@@ -2170,11 +3146,43 @@ unsigned int Context::getMaximumCombinedTextureImageUnits() const
return mRenderer->getMaxCombinedTextureImageUnits();
}
+unsigned int Context::getMaximumCombinedUniformBufferBindings() const
+{
+ return mRenderer->getMaxVertexShaderUniformBuffers() +
+ mRenderer->getMaxFragmentShaderUniformBuffers();
+}
+
int Context::getMaxSupportedSamples() const
{
return mRenderer->getMaxSupportedSamples();
}
+GLsizei Context::getMaxSupportedFormatSamples(GLenum internalFormat) const
+{
+ return mRenderer->getMaxSupportedFormatSamples(internalFormat);
+}
+
+GLsizei Context::getNumSampleCounts(GLenum internalFormat) const
+{
+ return mRenderer->getNumSampleCounts(internalFormat);
+}
+
+void Context::getSampleCounts(GLenum internalFormat, GLsizei bufSize, GLint *params) const
+{
+ mRenderer->getSampleCounts(internalFormat, bufSize, params);
+}
+
+unsigned int Context::getMaxTransformFeedbackBufferBindings() const
+{
+ return mRenderer->getMaxTransformFeedbackBuffers();
+}
+
+GLintptr Context::getUniformBufferOffsetAlignment() const
+{
+ // setting a large alignment forces uniform buffers to bind with zero offset
+ return static_cast<GLintptr>(std::numeric_limits<GLint>::max());
+}
+
unsigned int Context::getMaximumRenderTargets() const
{
return mRenderer->getMaxRenderTargets();
@@ -2245,9 +3253,9 @@ int Context::getMaximumRenderbufferDimension() const
return mMaxRenderbufferDimension;
}
-int Context::getMaximumTextureDimension() const
+int Context::getMaximum2DTextureDimension() const
{
- return mMaxTextureDimension;
+ return mMax2DTextureDimension;
}
int Context::getMaximumCubeTextureDimension() const
@@ -2255,9 +3263,34 @@ int Context::getMaximumCubeTextureDimension() const
return mMaxCubeTextureDimension;
}
-int Context::getMaximumTextureLevel() const
+int Context::getMaximum3DTextureDimension() const
+{
+ return mMax3DTextureDimension;
+}
+
+int Context::getMaximum2DArrayTextureLayers() const
{
- return mMaxTextureLevel;
+ return mMax2DArrayTextureLayers;
+}
+
+int Context::getMaximum2DTextureLevel() const
+{
+ return mMax2DTextureLevel;
+}
+
+int Context::getMaximumCubeTextureLevel() const
+{
+ return mMaxCubeTextureLevel;
+}
+
+int Context::getMaximum3DTextureLevel() const
+{
+ return mMax3DTextureLevel;
+}
+
+int Context::getMaximum2DArrayTextureLevel() const
+{
+ return mMax2DArrayTextureLevel;
}
bool Context::supportsLuminanceTextures() const
@@ -2270,6 +3303,11 @@ bool Context::supportsLuminanceAlphaTextures() const
return mSupportsLuminanceAlphaTextures;
}
+bool Context::supportsRGTextures() const
+{
+ return mSupportsRGTextures;
+}
+
bool Context::supportsDepthTextures() const
{
return mSupportsDepthTextures;
@@ -2295,29 +3333,27 @@ bool Context::supportsTextureFilterAnisotropy() const
return mSupportsTextureFilterAnisotropy;
}
+bool Context::supportsPBOs() const
+{
+ return mSupportsPBOs;
+}
+
float Context::getTextureMaxAnisotropy() const
{
return mMaxTextureAnisotropy;
}
-bool Context::getCurrentReadFormatType(GLenum *format, GLenum *type)
+void Context::getCurrentReadFormatType(GLenum *internalFormat, GLenum *format, GLenum *type)
{
Framebuffer *framebuffer = getReadFramebuffer();
- if (!framebuffer || framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE)
- {
- return gl::error(GL_INVALID_OPERATION, false);
- }
+ ASSERT(framebuffer && framebuffer->completeness() == GL_FRAMEBUFFER_COMPLETE);
- Renderbuffer *renderbuffer = framebuffer->getReadColorbuffer();
- if (!renderbuffer)
- {
- return gl::error(GL_INVALID_OPERATION, false);
- }
+ FramebufferAttachment *attachment = framebuffer->getReadColorbuffer();
+ ASSERT(attachment);
- *format = gl::ExtractFormat(renderbuffer->getActualFormat());
- *type = gl::ExtractType(renderbuffer->getActualFormat());
-
- return true;
+ *internalFormat = attachment->getActualFormat();
+ *format = gl::GetFormat(attachment->getActualFormat(), mClientVersion);
+ *type = gl::GetType(attachment->getActualFormat(), mClientVersion);
}
void Context::detachBuffer(GLuint buffer)
@@ -2331,17 +3367,10 @@ void Context::detachBuffer(GLuint buffer)
mState.arrayBuffer.set(NULL);
}
- if (mState.elementArrayBuffer.id() == buffer)
+ // mark as freed among the vertex array objects
+ for (auto vaoIt = mVertexArrayMap.begin(); vaoIt != mVertexArrayMap.end(); vaoIt++)
{
- mState.elementArrayBuffer.set(NULL);
- }
-
- for (int attribute = 0; attribute < MAX_VERTEX_ATTRIBS; attribute++)
- {
- if (mState.vertexAttribute[attribute].mBoundBuffer.id() == buffer)
- {
- mState.vertexAttribute[attribute].mBoundBuffer.set(NULL);
- }
+ vaoIt->second->detachBuffer(buffer);
}
}
@@ -2364,7 +3393,7 @@ void Context::detachTexture(GLuint texture)
// [OpenGL ES 2.0.24] section 4.4 page 112:
// If a texture object is deleted while its image is attached to the currently bound framebuffer, then it is
- // as if FramebufferTexture2D had been called, with a texture of 0, for each attachment point to which this
+ // as if Texture2DAttachment had been called, with a texture of 0, for each attachment point to which this
// image was attached in the currently bound framebuffer.
Framebuffer *readFramebuffer = getReadFramebuffer();
@@ -2428,13 +3457,48 @@ void Context::detachRenderbuffer(GLuint renderbuffer)
}
}
+void Context::detachVertexArray(GLuint vertexArray)
+{
+ // [OpenGL ES 3.0.2] section 2.10 page 43:
+ // If a vertex array object that is currently bound is deleted, the binding
+ // for that object reverts to zero and the default vertex array becomes current.
+ if (mState.vertexArray == vertexArray)
+ {
+ bindVertexArray(0);
+ }
+}
+
+void Context::detachTransformFeedback(GLuint transformFeedback)
+{
+ if (mState.transformFeedback.id() == transformFeedback)
+ {
+ bindTransformFeedback(0);
+ }
+}
+
+void Context::detachSampler(GLuint sampler)
+{
+ // [OpenGL ES 3.0.2] section 3.8.2 pages 123-124:
+ // If a sampler object that is currently bound to one or more texture units is
+ // deleted, it is as though BindSampler is called once for each texture unit to
+ // which the sampler is bound, with unit set to the texture unit and sampler set to zero.
+ for (unsigned int textureUnit = 0; textureUnit < ArraySize(mState.samplers); textureUnit++)
+ {
+ if (mState.samplers[textureUnit] == sampler)
+ {
+ mState.samplers[textureUnit] = 0;
+ }
+ }
+}
+
Texture *Context::getIncompleteTexture(TextureType type)
{
Texture *t = mIncompleteTextures[type].get();
if (t == NULL)
{
- static const GLubyte color[] = { 0, 0, 0, 255 };
+ const GLubyte color[] = { 0, 0, 0, 255 };
+ const PixelUnpackState incompleteUnpackState(1);
switch (type)
{
@@ -2445,7 +3509,7 @@ Texture *Context::getIncompleteTexture(TextureType type)
case TEXTURE_2D:
{
Texture2D *incomplete2d = new Texture2D(mRenderer, Texture::INCOMPLETE_TEXTURE_ID);
- incomplete2d->setImage(0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, color);
+ incomplete2d->setImage(0, 1, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
t = incomplete2d;
}
break;
@@ -2454,16 +3518,34 @@ Texture *Context::getIncompleteTexture(TextureType type)
{
TextureCubeMap *incompleteCube = new TextureCubeMap(mRenderer, Texture::INCOMPLETE_TEXTURE_ID);
- incompleteCube->setImagePosX(0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, color);
- incompleteCube->setImageNegX(0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, color);
- incompleteCube->setImagePosY(0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, color);
- incompleteCube->setImageNegY(0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, color);
- incompleteCube->setImagePosZ(0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, color);
- incompleteCube->setImageNegZ(0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, color);
+ incompleteCube->setImagePosX(0, 1, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
+ incompleteCube->setImageNegX(0, 1, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
+ incompleteCube->setImagePosY(0, 1, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
+ incompleteCube->setImageNegY(0, 1, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
+ incompleteCube->setImagePosZ(0, 1, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
+ incompleteCube->setImageNegZ(0, 1, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
t = incompleteCube;
}
break;
+
+ case TEXTURE_3D:
+ {
+ Texture3D *incomplete3d = new Texture3D(mRenderer, Texture::INCOMPLETE_TEXTURE_ID);
+ incomplete3d->setImage(0, 1, 1, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
+
+ t = incomplete3d;
+ }
+ break;
+
+ case TEXTURE_2D_ARRAY:
+ {
+ Texture2DArray *incomplete2darray = new Texture2DArray(mRenderer, Texture::INCOMPLETE_TEXTURE_ID);
+ incomplete2darray->setImage(0, 1, 1, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
+
+ t = incomplete2darray;
+ }
+ break;
}
mIncompleteTextures[type].set(t);
@@ -2481,7 +3563,7 @@ bool Context::skipDraw(GLenum drawMode)
// undefined when not written, just skip drawing to avoid unexpected results.
if (!getCurrentProgramBinary()->usesPointSize())
{
- // This is stictly speaking not an error, but developers should be
+ // This is stictly speaking not an error, but developers should be
// notified of risking undefined behavior.
ERR("Point rendering without writing to gl_PointSize.");
@@ -2499,148 +3581,284 @@ bool Context::skipDraw(GLenum drawMode)
return false;
}
-void Context::setVertexAttrib(GLuint index, const GLfloat *values)
+void Context::setVertexAttribf(GLuint index, const GLfloat values[4])
{
ASSERT(index < gl::MAX_VERTEX_ATTRIBS);
+ mState.vertexAttribCurrentValues[index].setFloatValues(values);
+}
- mState.vertexAttribute[index].mCurrentValue[0] = values[0];
- mState.vertexAttribute[index].mCurrentValue[1] = values[1];
- mState.vertexAttribute[index].mCurrentValue[2] = values[2];
- mState.vertexAttribute[index].mCurrentValue[3] = values[3];
+void Context::setVertexAttribu(GLuint index, const GLuint values[4])
+{
+ ASSERT(index < gl::MAX_VERTEX_ATTRIBS);
+ mState.vertexAttribCurrentValues[index].setUnsignedIntValues(values);
}
-void Context::setVertexAttribDivisor(GLuint index, GLuint divisor)
+void Context::setVertexAttribi(GLuint index, const GLint values[4])
{
ASSERT(index < gl::MAX_VERTEX_ATTRIBS);
+ mState.vertexAttribCurrentValues[index].setIntValues(values);
+}
- mState.vertexAttribute[index].mDivisor = divisor;
+void Context::setVertexAttribDivisor(GLuint index, GLuint divisor)
+{
+ getCurrentVertexArray()->setVertexAttribDivisor(index, divisor);
}
-// keep list sorted in following order
-// OES extensions
-// EXT extensions
-// Vendor extensions
-void Context::initExtensionString()
+void Context::samplerParameteri(GLuint sampler, GLenum pname, GLint param)
{
- std::string extensionString = "";
+ mResourceManager->checkSamplerAllocation(sampler);
- // OES extensions
- if (supports32bitIndices())
- {
- extensionString += "GL_OES_element_index_uint ";
- }
+ Sampler *samplerObject = getSampler(sampler);
+ ASSERT(samplerObject);
- extensionString += "GL_OES_packed_depth_stencil ";
- extensionString += "GL_OES_get_program_binary ";
- extensionString += "GL_OES_rgb8_rgba8 ";
- if (mRenderer->getDerivativeInstructionSupport())
+ switch (pname)
{
- extensionString += "GL_OES_standard_derivatives ";
+ case GL_TEXTURE_MIN_FILTER: samplerObject->setMinFilter(static_cast<GLenum>(param)); break;
+ case GL_TEXTURE_MAG_FILTER: samplerObject->setMagFilter(static_cast<GLenum>(param)); break;
+ case GL_TEXTURE_WRAP_S: samplerObject->setWrapS(static_cast<GLenum>(param)); break;
+ case GL_TEXTURE_WRAP_T: samplerObject->setWrapT(static_cast<GLenum>(param)); break;
+ case GL_TEXTURE_WRAP_R: samplerObject->setWrapR(static_cast<GLenum>(param)); break;
+ case GL_TEXTURE_MIN_LOD: samplerObject->setMinLod(static_cast<GLfloat>(param)); break;
+ case GL_TEXTURE_MAX_LOD: samplerObject->setMaxLod(static_cast<GLfloat>(param)); break;
+ case GL_TEXTURE_COMPARE_MODE: samplerObject->setComparisonMode(static_cast<GLenum>(param)); break;
+ case GL_TEXTURE_COMPARE_FUNC: samplerObject->setComparisonFunc(static_cast<GLenum>(param)); break;
+ default: UNREACHABLE(); break;
}
+}
- if (supportsFloat16Textures())
- {
- extensionString += "GL_OES_texture_half_float ";
- }
- if (supportsFloat16LinearFilter())
- {
- extensionString += "GL_OES_texture_half_float_linear ";
- }
- if (supportsFloat32Textures())
- {
- extensionString += "GL_OES_texture_float ";
- }
- if (supportsFloat32LinearFilter())
- {
- extensionString += "GL_OES_texture_float_linear ";
- }
+void Context::samplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
+{
+ mResourceManager->checkSamplerAllocation(sampler);
- if (supportsNonPower2Texture())
- {
- extensionString += "GL_OES_texture_npot ";
- }
+ Sampler *samplerObject = getSampler(sampler);
+ ASSERT(samplerObject);
- // Multi-vendor (EXT) extensions
- if (supportsOcclusionQueries())
+ switch (pname)
{
- extensionString += "GL_EXT_occlusion_query_boolean ";
+ case GL_TEXTURE_MIN_FILTER: samplerObject->setMinFilter(uiround<GLenum>(param)); break;
+ case GL_TEXTURE_MAG_FILTER: samplerObject->setMagFilter(uiround<GLenum>(param)); break;
+ case GL_TEXTURE_WRAP_S: samplerObject->setWrapS(uiround<GLenum>(param)); break;
+ case GL_TEXTURE_WRAP_T: samplerObject->setWrapT(uiround<GLenum>(param)); break;
+ case GL_TEXTURE_WRAP_R: samplerObject->setWrapR(uiround<GLenum>(param)); break;
+ case GL_TEXTURE_MIN_LOD: samplerObject->setMinLod(param); break;
+ case GL_TEXTURE_MAX_LOD: samplerObject->setMaxLod(param); break;
+ case GL_TEXTURE_COMPARE_MODE: samplerObject->setComparisonMode(uiround<GLenum>(param)); break;
+ case GL_TEXTURE_COMPARE_FUNC: samplerObject->setComparisonFunc(uiround<GLenum>(param)); break;
+ default: UNREACHABLE(); break;
}
+}
- extensionString += "GL_EXT_read_format_bgra ";
- extensionString += "GL_EXT_robustness ";
+GLint Context::getSamplerParameteri(GLuint sampler, GLenum pname)
+{
+ mResourceManager->checkSamplerAllocation(sampler);
- if (supportsDXT1Textures())
- {
- extensionString += "GL_EXT_texture_compression_dxt1 ";
- }
+ Sampler *samplerObject = getSampler(sampler);
+ ASSERT(samplerObject);
- if (supportsTextureFilterAnisotropy())
+ switch (pname)
{
- extensionString += "GL_EXT_texture_filter_anisotropic ";
+ case GL_TEXTURE_MIN_FILTER: return static_cast<GLint>(samplerObject->getMinFilter());
+ case GL_TEXTURE_MAG_FILTER: return static_cast<GLint>(samplerObject->getMagFilter());
+ case GL_TEXTURE_WRAP_S: return static_cast<GLint>(samplerObject->getWrapS());
+ case GL_TEXTURE_WRAP_T: return static_cast<GLint>(samplerObject->getWrapT());
+ case GL_TEXTURE_WRAP_R: return static_cast<GLint>(samplerObject->getWrapR());
+ case GL_TEXTURE_MIN_LOD: return uiround<GLint>(samplerObject->getMinLod());
+ case GL_TEXTURE_MAX_LOD: return uiround<GLint>(samplerObject->getMaxLod());
+ case GL_TEXTURE_COMPARE_MODE: return static_cast<GLint>(samplerObject->getComparisonMode());
+ case GL_TEXTURE_COMPARE_FUNC: return static_cast<GLint>(samplerObject->getComparisonFunc());
+ default: UNREACHABLE(); return 0;
}
+}
- if (supportsBGRATextures())
+GLfloat Context::getSamplerParameterf(GLuint sampler, GLenum pname)
+{
+ mResourceManager->checkSamplerAllocation(sampler);
+
+ Sampler *samplerObject = getSampler(sampler);
+ ASSERT(samplerObject);
+
+ switch (pname)
{
- extensionString += "GL_EXT_texture_format_BGRA8888 ";
+ case GL_TEXTURE_MIN_FILTER: return static_cast<GLfloat>(samplerObject->getMinFilter());
+ case GL_TEXTURE_MAG_FILTER: return static_cast<GLfloat>(samplerObject->getMagFilter());
+ case GL_TEXTURE_WRAP_S: return static_cast<GLfloat>(samplerObject->getWrapS());
+ case GL_TEXTURE_WRAP_T: return static_cast<GLfloat>(samplerObject->getWrapT());
+ case GL_TEXTURE_WRAP_R: return static_cast<GLfloat>(samplerObject->getWrapR());
+ case GL_TEXTURE_MIN_LOD: return samplerObject->getMinLod();
+ case GL_TEXTURE_MAX_LOD: return samplerObject->getMaxLod();
+ case GL_TEXTURE_COMPARE_MODE: return static_cast<GLfloat>(samplerObject->getComparisonMode());
+ case GL_TEXTURE_COMPARE_FUNC: return static_cast<GLfloat>(samplerObject->getComparisonFunc());
+ default: UNREACHABLE(); return 0;
}
+}
- if (mRenderer->getMaxRenderTargets() > 1)
+// keep list sorted in following order
+// OES extensions
+// EXT extensions
+// Vendor extensions
+void Context::initExtensionString()
+{
+ // Do not report extension in GLES 3 contexts for now
+ if (mClientVersion == 2)
{
- extensionString += "GL_EXT_draw_buffers ";
- }
+ // OES extensions
+ if (supports32bitIndices())
+ {
+ mExtensionStringList.push_back("GL_OES_element_index_uint");
+ }
- extensionString += "GL_EXT_texture_storage ";
- extensionString += "GL_EXT_frag_depth ";
+ mExtensionStringList.push_back("GL_OES_packed_depth_stencil");
+ mExtensionStringList.push_back("GL_OES_get_program_binary");
+ mExtensionStringList.push_back("GL_OES_rgb8_rgba8");
- // ANGLE-specific extensions
- if (supportsDepthTextures())
- {
- extensionString += "GL_ANGLE_depth_texture ";
- }
+ if (supportsPBOs())
+ {
+ mExtensionStringList.push_back("NV_pixel_buffer_object");
+ mExtensionStringList.push_back("GL_OES_mapbuffer");
+ mExtensionStringList.push_back("GL_EXT_map_buffer_range");
+ }
- extensionString += "GL_ANGLE_framebuffer_blit ";
- if (getMaxSupportedSamples() != 0)
- {
- extensionString += "GL_ANGLE_framebuffer_multisample ";
- }
+ if (mRenderer->getDerivativeInstructionSupport())
+ {
+ mExtensionStringList.push_back("GL_OES_standard_derivatives");
+ }
- if (supportsInstancing())
- {
- extensionString += "GL_ANGLE_instanced_arrays ";
- }
+ if (supportsFloat16Textures())
+ {
+ mExtensionStringList.push_back("GL_OES_texture_half_float");
+ }
+ if (supportsFloat16LinearFilter())
+ {
+ mExtensionStringList.push_back("GL_OES_texture_half_float_linear");
+ }
+ if (supportsFloat32Textures())
+ {
+ mExtensionStringList.push_back("GL_OES_texture_float");
+ }
+ if (supportsFloat32LinearFilter())
+ {
+ mExtensionStringList.push_back("GL_OES_texture_float_linear");
+ }
+
+ if (supportsRGTextures())
+ {
+ mExtensionStringList.push_back("GL_EXT_texture_rg");
+ }
- extensionString += "GL_ANGLE_pack_reverse_row_order ";
+ if (supportsNonPower2Texture())
+ {
+ mExtensionStringList.push_back("GL_OES_texture_npot");
+ }
- if (supportsDXT3Textures())
- {
- extensionString += "GL_ANGLE_texture_compression_dxt3 ";
+ // Multi-vendor (EXT) extensions
+ if (supportsOcclusionQueries())
+ {
+ mExtensionStringList.push_back("GL_EXT_occlusion_query_boolean");
+ }
+
+ mExtensionStringList.push_back("GL_EXT_read_format_bgra");
+ mExtensionStringList.push_back("GL_EXT_robustness");
+ mExtensionStringList.push_back("GL_EXT_shader_texture_lod");
+
+ if (supportsDXT1Textures())
+ {
+ mExtensionStringList.push_back("GL_EXT_texture_compression_dxt1");
+ }
+
+ if (supportsTextureFilterAnisotropy())
+ {
+ mExtensionStringList.push_back("GL_EXT_texture_filter_anisotropic");
+ }
+
+ if (supportsBGRATextures())
+ {
+ mExtensionStringList.push_back("GL_EXT_texture_format_BGRA8888");
+ }
+
+ if (mRenderer->getMaxRenderTargets() > 1)
+ {
+ mExtensionStringList.push_back("GL_EXT_draw_buffers");
+ }
+
+ mExtensionStringList.push_back("GL_EXT_texture_storage");
+ mExtensionStringList.push_back("GL_EXT_frag_depth");
+ mExtensionStringList.push_back("GL_EXT_blend_minmax");
+
+ // ANGLE-specific extensions
+ if (supportsDepthTextures())
+ {
+ mExtensionStringList.push_back("GL_ANGLE_depth_texture");
+ }
+
+ mExtensionStringList.push_back("GL_ANGLE_framebuffer_blit");
+ if (getMaxSupportedSamples() != 0)
+ {
+ mExtensionStringList.push_back("GL_ANGLE_framebuffer_multisample");
+ }
+
+ if (supportsInstancing())
+ {
+ mExtensionStringList.push_back("GL_ANGLE_instanced_arrays");
+ }
+
+ mExtensionStringList.push_back("GL_ANGLE_pack_reverse_row_order");
+
+ if (supportsDXT3Textures())
+ {
+ mExtensionStringList.push_back("GL_ANGLE_texture_compression_dxt3");
+ }
+ if (supportsDXT5Textures())
+ {
+ mExtensionStringList.push_back("GL_ANGLE_texture_compression_dxt5");
+ }
+
+ mExtensionStringList.push_back("GL_ANGLE_texture_usage");
+ mExtensionStringList.push_back("GL_ANGLE_translated_shader_source");
+
+ // Other vendor-specific extensions
+ if (supportsEventQueries())
+ {
+ mExtensionStringList.push_back("GL_NV_fence");
+ }
}
- if (supportsDXT5Textures())
+
+ if (mClientVersion == 3)
{
- extensionString += "GL_ANGLE_texture_compression_dxt5 ";
- }
+ mExtensionStringList.push_back("GL_EXT_color_buffer_float");
- extensionString += "GL_ANGLE_texture_usage ";
- extensionString += "GL_ANGLE_translated_shader_source ";
+ mExtensionStringList.push_back("GL_EXT_read_format_bgra");
- // Other vendor-specific extensions
- if (supportsEventQueries())
- {
- extensionString += "GL_NV_fence ";
+ if (supportsBGRATextures())
+ {
+ mExtensionStringList.push_back("GL_EXT_texture_format_BGRA8888");
+ }
}
- std::string::size_type end = extensionString.find_last_not_of(' ');
- if (end != std::string::npos)
+ // Join the extension strings to one long string for use with GetString
+ std::stringstream strstr;
+ for (unsigned int extensionIndex = 0; extensionIndex < mExtensionStringList.size(); extensionIndex++)
{
- extensionString.resize(end+1);
+ strstr << mExtensionStringList[extensionIndex];
+ strstr << " ";
}
- mExtensionString = makeStaticString(extensionString);
+ mCombinedExtensionsString = makeStaticString(strstr.str());
+}
+
+const char *Context::getCombinedExtensionsString() const
+{
+ return mCombinedExtensionsString;
+}
+
+const char *Context::getExtensionString(const GLuint index) const
+{
+ ASSERT(index < mExtensionStringList.size());
+ return mExtensionStringList[index].c_str();
}
-const char *Context::getExtensionString() const
+unsigned int Context::getNumExtensions() const
{
- return mExtensionString;
+ return mExtensionStringList.size();
}
void Context::initRendererString()
@@ -2658,321 +3876,170 @@ const char *Context::getRendererString() const
return mRendererString;
}
-Context::FramebufferTextureSerialSet Context::getBoundFramebufferTextureSerials()
+size_t Context::getBoundFramebufferTextureSerials(FramebufferTextureSerialArray *outSerialArray)
{
- FramebufferTextureSerialSet set;
+ size_t serialCount = 0;
Framebuffer *drawFramebuffer = getDrawFramebuffer();
for (unsigned int i = 0; i < IMPLEMENTATION_MAX_DRAW_BUFFERS; i++)
{
- Renderbuffer *renderBuffer = drawFramebuffer->getColorbuffer(i);
- if (renderBuffer && renderBuffer->getTextureSerial() != 0)
+ FramebufferAttachment *attachment = drawFramebuffer->getColorbuffer(i);
+ if (attachment && attachment->isTexture())
{
- set.insert(renderBuffer->getTextureSerial());
+ (*outSerialArray)[serialCount++] = attachment->getTextureSerial();
}
}
- Renderbuffer *depthStencilBuffer = drawFramebuffer->getDepthOrStencilbuffer();
- if (depthStencilBuffer && depthStencilBuffer->getTextureSerial() != 0)
+ FramebufferAttachment *depthStencilAttachment = drawFramebuffer->getDepthOrStencilbuffer();
+ if (depthStencilAttachment && depthStencilAttachment->isTexture())
{
- set.insert(depthStencilBuffer->getTextureSerial());
+ (*outSerialArray)[serialCount++] = depthStencilAttachment->getTextureSerial();
}
- return set;
+ std::sort(outSerialArray->begin(), outSerialArray->begin() + serialCount);
+
+ return serialCount;
}
-void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
- GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
- GLbitfield mask)
+void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
+ GLbitfield mask, GLenum filter)
{
Framebuffer *readFramebuffer = getReadFramebuffer();
Framebuffer *drawFramebuffer = getDrawFramebuffer();
- if (!readFramebuffer || readFramebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE ||
- !drawFramebuffer || drawFramebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE)
- {
- return gl::error(GL_INVALID_FRAMEBUFFER_OPERATION);
- }
-
- if (drawFramebuffer->getSamples() != 0)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- Renderbuffer *readColorBuffer = readFramebuffer->getReadColorbuffer();
- Renderbuffer *drawColorBuffer = drawFramebuffer->getFirstColorbuffer();
-
- if (drawColorBuffer == NULL)
- {
- ERR("Draw buffers formats don't match, which is not supported in this implementation of BlitFramebufferANGLE");
- return gl::error(GL_INVALID_OPERATION);
- }
-
- int readBufferWidth = readColorBuffer->getWidth();
- int readBufferHeight = readColorBuffer->getHeight();
- int drawBufferWidth = drawColorBuffer->getWidth();
- int drawBufferHeight = drawColorBuffer->getHeight();
-
- Rectangle sourceRect;
- Rectangle destRect;
-
- if (srcX0 < srcX1)
- {
- sourceRect.x = srcX0;
- destRect.x = dstX0;
- sourceRect.width = srcX1 - srcX0;
- destRect.width = dstX1 - dstX0;
- }
- else
- {
- sourceRect.x = srcX1;
- destRect.x = dstX1;
- sourceRect.width = srcX0 - srcX1;
- destRect.width = dstX0 - dstX1;
- }
-
- if (srcY0 < srcY1)
- {
- sourceRect.height = srcY1 - srcY0;
- destRect.height = dstY1 - dstY0;
- sourceRect.y = srcY0;
- destRect.y = dstY0;
- }
- else
- {
- sourceRect.height = srcY0 - srcY1;
- destRect.height = dstY0 - srcY1;
- sourceRect.y = srcY1;
- destRect.y = dstY1;
- }
-
- Rectangle sourceScissoredRect = sourceRect;
- Rectangle destScissoredRect = destRect;
-
- if (mState.scissorTest)
- {
- // Only write to parts of the destination framebuffer which pass the scissor test.
- if (destRect.x < mState.scissor.x)
- {
- int xDiff = mState.scissor.x - destRect.x;
- destScissoredRect.x = mState.scissor.x;
- destScissoredRect.width -= xDiff;
- sourceScissoredRect.x += xDiff;
- sourceScissoredRect.width -= xDiff;
-
- }
-
- if (destRect.x + destRect.width > mState.scissor.x + mState.scissor.width)
- {
- int xDiff = (destRect.x + destRect.width) - (mState.scissor.x + mState.scissor.width);
- destScissoredRect.width -= xDiff;
- sourceScissoredRect.width -= xDiff;
- }
-
- if (destRect.y < mState.scissor.y)
- {
- int yDiff = mState.scissor.y - destRect.y;
- destScissoredRect.y = mState.scissor.y;
- destScissoredRect.height -= yDiff;
- sourceScissoredRect.y += yDiff;
- sourceScissoredRect.height -= yDiff;
- }
-
- if (destRect.y + destRect.height > mState.scissor.y + mState.scissor.height)
- {
- int yDiff = (destRect.y + destRect.height) - (mState.scissor.y + mState.scissor.height);
- destScissoredRect.height -= yDiff;
- sourceScissoredRect.height -= yDiff;
- }
- }
-
bool blitRenderTarget = false;
- bool blitDepthStencil = false;
-
- Rectangle sourceTrimmedRect = sourceScissoredRect;
- Rectangle destTrimmedRect = destScissoredRect;
-
- // The source & destination rectangles also may need to be trimmed if they fall out of the bounds of
- // the actual draw and read surfaces.
- if (sourceTrimmedRect.x < 0)
+ bool blitDepth = false;
+ bool blitStencil = false;
+ if ((mask & GL_COLOR_BUFFER_BIT) && readFramebuffer->getReadColorbuffer() && drawFramebuffer->getFirstColorbuffer())
{
- int xDiff = 0 - sourceTrimmedRect.x;
- sourceTrimmedRect.x = 0;
- sourceTrimmedRect.width -= xDiff;
- destTrimmedRect.x += xDiff;
- destTrimmedRect.width -= xDiff;
- }
-
- if (sourceTrimmedRect.x + sourceTrimmedRect.width > readBufferWidth)
- {
- int xDiff = (sourceTrimmedRect.x + sourceTrimmedRect.width) - readBufferWidth;
- sourceTrimmedRect.width -= xDiff;
- destTrimmedRect.width -= xDiff;
- }
-
- if (sourceTrimmedRect.y < 0)
- {
- int yDiff = 0 - sourceTrimmedRect.y;
- sourceTrimmedRect.y = 0;
- sourceTrimmedRect.height -= yDiff;
- destTrimmedRect.y += yDiff;
- destTrimmedRect.height -= yDiff;
- }
-
- if (sourceTrimmedRect.y + sourceTrimmedRect.height > readBufferHeight)
- {
- int yDiff = (sourceTrimmedRect.y + sourceTrimmedRect.height) - readBufferHeight;
- sourceTrimmedRect.height -= yDiff;
- destTrimmedRect.height -= yDiff;
- }
-
- if (destTrimmedRect.x < 0)
- {
- int xDiff = 0 - destTrimmedRect.x;
- destTrimmedRect.x = 0;
- destTrimmedRect.width -= xDiff;
- sourceTrimmedRect.x += xDiff;
- sourceTrimmedRect.width -= xDiff;
+ blitRenderTarget = true;
}
-
- if (destTrimmedRect.x + destTrimmedRect.width > drawBufferWidth)
+ if ((mask & GL_STENCIL_BUFFER_BIT) && readFramebuffer->getStencilbuffer() && drawFramebuffer->getStencilbuffer())
{
- int xDiff = (destTrimmedRect.x + destTrimmedRect.width) - drawBufferWidth;
- destTrimmedRect.width -= xDiff;
- sourceTrimmedRect.width -= xDiff;
+ blitStencil = true;
}
-
- if (destTrimmedRect.y < 0)
+ if ((mask & GL_DEPTH_BUFFER_BIT) && readFramebuffer->getDepthbuffer() && drawFramebuffer->getDepthbuffer())
{
- int yDiff = 0 - destTrimmedRect.y;
- destTrimmedRect.y = 0;
- destTrimmedRect.height -= yDiff;
- sourceTrimmedRect.y += yDiff;
- sourceTrimmedRect.height -= yDiff;
+ blitDepth = true;
}
- if (destTrimmedRect.y + destTrimmedRect.height > drawBufferHeight)
+ gl::Rectangle srcRect(srcX0, srcY0, srcX1 - srcX0, srcY1 - srcY0);
+ gl::Rectangle dstRect(dstX0, dstY0, dstX1 - dstX0, dstY1 - dstY0);
+ if (blitRenderTarget || blitDepth || blitStencil)
{
- int yDiff = (destTrimmedRect.y + destTrimmedRect.height) - drawBufferHeight;
- destTrimmedRect.height -= yDiff;
- sourceTrimmedRect.height -= yDiff;
+ const gl::Rectangle *scissor = mState.scissorTest ? &mState.scissor : NULL;
+ mRenderer->blitRect(readFramebuffer, srcRect, drawFramebuffer, dstRect, scissor,
+ blitRenderTarget, blitDepth, blitStencil, filter);
}
+}
- bool partialBufferCopy = false;
- if (sourceTrimmedRect.height < readBufferHeight ||
- sourceTrimmedRect.width < readBufferWidth ||
- destTrimmedRect.height < drawBufferHeight ||
- destTrimmedRect.width < drawBufferWidth ||
- sourceTrimmedRect.y != 0 || destTrimmedRect.y != 0 || sourceTrimmedRect.x != 0 || destTrimmedRect.x != 0)
+void Context::invalidateFrameBuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments,
+ GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ Framebuffer *frameBuffer = NULL;
+ switch (target)
{
- partialBufferCopy = true;
+ case GL_FRAMEBUFFER:
+ case GL_DRAW_FRAMEBUFFER:
+ frameBuffer = getDrawFramebuffer();
+ break;
+ case GL_READ_FRAMEBUFFER:
+ frameBuffer = getReadFramebuffer();
+ break;
+ default:
+ UNREACHABLE();
}
- if (mask & GL_COLOR_BUFFER_BIT)
+ if (frameBuffer && frameBuffer->completeness() == GL_FRAMEBUFFER_COMPLETE)
{
- const GLenum readColorbufferType = readFramebuffer->getReadColorbufferType();
- const bool validReadType = (readColorbufferType == GL_TEXTURE_2D) || (readColorbufferType == GL_RENDERBUFFER);
- bool validDrawType = true;
- bool validDrawFormat = true;
-
- for (unsigned int colorAttachment = 0; colorAttachment < gl::IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
+ for (int i = 0; i < numAttachments; ++i)
{
- if (drawFramebuffer->isEnabledColorAttachment(colorAttachment))
- {
- if (drawFramebuffer->getColorbufferType(colorAttachment) != GL_TEXTURE_2D &&
- drawFramebuffer->getColorbufferType(colorAttachment) != GL_RENDERBUFFER)
- {
- validDrawType = false;
- }
+ rx::RenderTarget *renderTarget = NULL;
- if (drawFramebuffer->getColorbuffer(colorAttachment)->getActualFormat() != readColorBuffer->getActualFormat())
+ if (attachments[i] >= GL_COLOR_ATTACHMENT0 && attachments[i] <= GL_COLOR_ATTACHMENT15)
+ {
+ gl::FramebufferAttachment *attachment = frameBuffer->getColorbuffer(attachments[i] - GL_COLOR_ATTACHMENT0);
+ if (attachment)
{
- validDrawFormat = false;
+ renderTarget = attachment->getRenderTarget();
}
}
- }
-
- if (!validReadType || !validDrawType || !validDrawFormat)
- {
- ERR("Color buffer format conversion in BlitFramebufferANGLE not supported by this implementation");
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (partialBufferCopy && readFramebuffer->getSamples() != 0)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- blitRenderTarget = true;
-
- }
-
- if (mask & (GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT))
- {
- Renderbuffer *readDSBuffer = NULL;
- Renderbuffer *drawDSBuffer = NULL;
-
- // We support OES_packed_depth_stencil, and do not support a separately attached depth and stencil buffer, so if we have
- // both a depth and stencil buffer, it will be the same buffer.
-
- if (mask & GL_DEPTH_BUFFER_BIT)
- {
- if (readFramebuffer->getDepthbuffer() && drawFramebuffer->getDepthbuffer())
+ else if (attachments[i] == GL_COLOR)
{
- if (readFramebuffer->getDepthbufferType() != drawFramebuffer->getDepthbufferType() ||
- readFramebuffer->getDepthbuffer()->getActualFormat() != drawFramebuffer->getDepthbuffer()->getActualFormat())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- blitDepthStencil = true;
- readDSBuffer = readFramebuffer->getDepthbuffer();
- drawDSBuffer = drawFramebuffer->getDepthbuffer();
+ gl::FramebufferAttachment *attachment = frameBuffer->getColorbuffer(0);
+ if (attachment)
+ {
+ renderTarget = attachment->getRenderTarget();
+ }
}
- }
-
- if (mask & GL_STENCIL_BUFFER_BIT)
- {
- if (readFramebuffer->getStencilbuffer() && drawFramebuffer->getStencilbuffer())
+ else
{
- if (readFramebuffer->getStencilbufferType() != drawFramebuffer->getStencilbufferType() ||
- readFramebuffer->getStencilbuffer()->getActualFormat() != drawFramebuffer->getStencilbuffer()->getActualFormat())
+ gl::FramebufferAttachment *attachment = NULL;
+ switch (attachments[i])
{
- return gl::error(GL_INVALID_OPERATION);
+ case GL_DEPTH_ATTACHMENT:
+ case GL_DEPTH:
+ attachment = frameBuffer->getDepthbuffer();
+ break;
+ case GL_STENCIL_ATTACHMENT:
+ case GL_STENCIL:
+ attachment = frameBuffer->getStencilbuffer();
+ break;
+ case GL_DEPTH_STENCIL_ATTACHMENT:
+ attachment = frameBuffer->getDepthOrStencilbuffer();
+ break;
+ default:
+ UNREACHABLE();
}
- blitDepthStencil = true;
- readDSBuffer = readFramebuffer->getStencilbuffer();
- drawDSBuffer = drawFramebuffer->getStencilbuffer();
+ if (attachment)
+ {
+ renderTarget = attachment->getDepthStencil();
+ }
}
- }
- if (partialBufferCopy)
- {
- ERR("Only whole-buffer depth and stencil blits are supported by this implementation.");
- return gl::error(GL_INVALID_OPERATION); // only whole-buffer copies are permitted
+ if (renderTarget)
+ {
+ renderTarget->invalidate(x, y, width, height);
+ }
}
+ }
+}
- if ((drawDSBuffer && drawDSBuffer->getSamples() != 0) ||
- (readDSBuffer && readDSBuffer->getSamples() != 0))
+bool Context::hasMappedBuffer(GLenum target) const
+{
+ if (target == GL_ARRAY_BUFFER)
+ {
+ for (unsigned int attribIndex = 0; attribIndex < gl::MAX_VERTEX_ATTRIBS; attribIndex++)
{
- return gl::error(GL_INVALID_OPERATION);
+ const gl::VertexAttribute &vertexAttrib = getVertexAttribState(attribIndex);
+ gl::Buffer *boundBuffer = vertexAttrib.mBoundBuffer.get();
+ if (vertexAttrib.mArrayEnabled && boundBuffer && boundBuffer->mapped())
+ {
+ return true;
+ }
}
}
-
- if (blitRenderTarget || blitDepthStencil)
+ else if (target == GL_ELEMENT_ARRAY_BUFFER)
+ {
+ Buffer *elementBuffer = getElementArrayBuffer();
+ return (elementBuffer && elementBuffer->mapped());
+ }
+ else if (target == GL_TRANSFORM_FEEDBACK_BUFFER)
{
- mRenderer->blitRect(readFramebuffer, sourceTrimmedRect, drawFramebuffer, destTrimmedRect, blitRenderTarget, blitDepthStencil);
+ UNIMPLEMENTED();
}
+ else UNREACHABLE();
+ return false;
}
}
extern "C"
{
-gl::Context *glCreateContext(const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess)
+gl::Context *glCreateContext(int clientVersion, const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess)
{
- return new gl::Context(shareContext, renderer, notifyResets, robustAccess);
+ return new gl::Context(clientVersion, shareContext, renderer, notifyResets, robustAccess);
}
void glDestroyContext(gl::Context *context)
diff --git a/chromium/third_party/angle/src/libGLESv2/Context.h b/chromium/third_party/angle/src/libGLESv2/Context.h
index 09eede9ff94..ab790042596 100644
--- a/chromium/third_party/angle/src/libGLESv2/Context.h
+++ b/chromium/third_party/angle/src/libGLESv2/Context.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -10,26 +10,24 @@
#ifndef LIBGLESV2_CONTEXT_H_
#define LIBGLESV2_CONTEXT_H_
-#define GL_APICALL
+#include <GLES3/gl3.h>
+#include <GLES3/gl3ext.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
-#define EGLAPI
#include <EGL/egl.h>
#include <string>
-#include <map>
#include <set>
-#ifdef _MSC_VER
-#include <hash_map>
-#else
+#include <map>
#include <unordered_map>
-#endif
+#include <array>
#include "common/angleutils.h"
#include "common/RefCountObject.h"
#include "libGLESv2/HandleAllocator.h"
#include "libGLESv2/angletypes.h"
#include "libGLESv2/Constants.h"
+#include "libGLESv2/VertexAttribute.h"
namespace rx
{
@@ -49,80 +47,29 @@ class ProgramBinary;
class Texture;
class Texture2D;
class TextureCubeMap;
+class Texture3D;
+class Texture2DArray;
class Framebuffer;
-class Renderbuffer;
+class FramebufferAttachment;
class RenderbufferStorage;
class Colorbuffer;
class Depthbuffer;
class Stencilbuffer;
class DepthStencilbuffer;
-class Fence;
+class FenceNV;
+class FenceSync;
class Query;
class ResourceManager;
class Buffer;
-
-enum QueryType
-{
- QUERY_ANY_SAMPLES_PASSED,
- QUERY_ANY_SAMPLES_PASSED_CONSERVATIVE,
-
- QUERY_TYPE_COUNT
-};
-
-// Helper structure describing a single vertex attribute
-class VertexAttribute
-{
- public:
- VertexAttribute() : mType(GL_FLOAT), mSize(0), mNormalized(false), mStride(0), mPointer(NULL), mArrayEnabled(false), mDivisor(0)
- {
- mCurrentValue[0] = 0.0f;
- mCurrentValue[1] = 0.0f;
- mCurrentValue[2] = 0.0f;
- mCurrentValue[3] = 1.0f;
- }
-
- int typeSize() const
- {
- switch (mType)
- {
- case GL_BYTE: return mSize * sizeof(GLbyte);
- case GL_UNSIGNED_BYTE: return mSize * sizeof(GLubyte);
- case GL_SHORT: return mSize * sizeof(GLshort);
- case GL_UNSIGNED_SHORT: return mSize * sizeof(GLushort);
- case GL_FIXED: return mSize * sizeof(GLfixed);
- case GL_FLOAT: return mSize * sizeof(GLfloat);
- default: UNREACHABLE(); return mSize * sizeof(GLfloat);
- }
- }
-
- GLsizei stride() const
- {
- return mStride ? mStride : typeSize();
- }
-
- // From glVertexAttribPointer
- GLenum mType;
- GLint mSize;
- bool mNormalized;
- GLsizei mStride; // 0 means natural stride
-
- union
- {
- const void *mPointer;
- intptr_t mOffset;
- };
-
- BindingPointer<Buffer> mBoundBuffer; // Captured when glVertexAttribPointer is called.
-
- bool mArrayEnabled; // From glEnable/DisableVertexAttribArray
- float mCurrentValue[4]; // From glVertexAttrib
- unsigned int mDivisor;
-};
+class VertexAttribute;
+class VertexArray;
+class Sampler;
+class TransformFeedback;
// Helper structure to store all raw state
struct State
{
- Color colorClearValue;
+ ColorF colorClearValue;
GLclampf depthClearValue;
int stencilClearValue;
@@ -131,7 +78,7 @@ struct State
Rectangle scissor;
BlendState blend;
- Color blendColor;
+ ColorF blendColor;
bool sampleCoverage;
GLclampf sampleCoverageValue;
bool sampleCoverageInvert;
@@ -151,27 +98,40 @@ struct State
unsigned int activeSampler; // Active texture unit selector - GL_TEXTURE0
BindingPointer<Buffer> arrayBuffer;
- BindingPointer<Buffer> elementArrayBuffer;
GLuint readFramebuffer;
GLuint drawFramebuffer;
- BindingPointer<Renderbuffer> renderbuffer;
+ BindingPointer<FramebufferAttachment> renderbuffer;
GLuint currentProgram;
- VertexAttribute vertexAttribute[MAX_VERTEX_ATTRIBS];
+ VertexAttribCurrentValueData vertexAttribCurrentValues[MAX_VERTEX_ATTRIBS]; // From glVertexAttrib
+ unsigned int vertexArray;
+
BindingPointer<Texture> samplerTexture[TEXTURE_TYPE_COUNT][IMPLEMENTATION_MAX_COMBINED_TEXTURE_IMAGE_UNITS];
- BindingPointer<Query> activeQuery[QUERY_TYPE_COUNT];
+ GLuint samplers[IMPLEMENTATION_MAX_COMBINED_TEXTURE_IMAGE_UNITS];
+
+ typedef std::map< GLenum, BindingPointer<Query> > ActiveQueryMap;
+ ActiveQueryMap activeQueries;
+
+ BindingPointer<Buffer> genericUniformBuffer;
+ OffsetBindingPointer<Buffer> uniformBuffers[IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS];
- GLint unpackAlignment;
- GLint packAlignment;
- bool packReverseRowOrder;
+ BindingPointer<TransformFeedback> transformFeedback;
+ BindingPointer<Buffer> genericTransformFeedbackBuffer;
+ OffsetBindingPointer<Buffer> transformFeedbackBuffers[IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS];
+
+ BindingPointer<Buffer> copyReadBuffer;
+ BindingPointer<Buffer> copyWriteBuffer;
+
+ PixelUnpackState unpack;
+ PixelPackState pack;
};
class Context
{
public:
- Context(const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess);
+ Context(int clientVersion, const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess);
- ~Context();
+ virtual ~Context();
void makeCurrent(egl::Surface *surface);
@@ -179,12 +139,18 @@ class Context
bool isContextLost();
// State manipulation
+ void setCap(GLenum cap, bool enabled);
+ bool getCap(GLenum cap);
+
void setClearColor(float red, float green, float blue, float alpha);
void setClearDepth(float depth);
void setClearStencil(int stencil);
+ void setRasterizerDiscard(bool enabled);
+ bool isRasterizerDiscardEnabled() const;
+
void setCullFace(bool enabled);
bool isCullFaceEnabled() const;
@@ -243,6 +209,7 @@ class Context
void setViewportParams(GLint x, GLint y, GLsizei width, GLsizei height);
void setScissorParams(GLint x, GLint y, GLsizei width, GLsizei height);
+ void getScissorParams(GLint *x, GLint *y, GLsizei *width, GLsizei *height);
void setColorMask(bool red, bool green, bool blue, bool alpha);
void setDepthMask(bool mask);
@@ -252,22 +219,30 @@ class Context
GLuint getReadFramebufferHandle() const;
GLuint getDrawFramebufferHandle() const;
GLuint getRenderbufferHandle() const;
+ GLuint getVertexArrayHandle() const;
+ GLuint getSamplerHandle(GLuint textureUnit) const;
+ unsigned int getActiveSampler() const;
GLuint getArrayBufferHandle() const;
- GLuint getActiveQuery(GLenum target) const;
+ bool isQueryActive() const;
+ const Query *getActiveQuery(GLenum target) const;
+ GLuint getActiveQueryId(GLenum target) const;
void setEnableVertexAttribArray(unsigned int attribNum, bool enabled);
- const VertexAttribute &getVertexAttribState(unsigned int attribNum);
+ const VertexAttribute &getVertexAttribState(unsigned int attribNum) const;
+ const VertexAttribCurrentValueData &getVertexAttribCurrentValue(unsigned int attribNum) const;
void setVertexAttribState(unsigned int attribNum, Buffer *boundBuffer, GLint size, GLenum type,
- bool normalized, GLsizei stride, const void *pointer);
+ bool normalized, bool pureInteger, GLsizei stride, const void *pointer);
const void *getVertexAttribPointer(unsigned int attribNum) const;
void setUnpackAlignment(GLint alignment);
GLint getUnpackAlignment() const;
+ const PixelUnpackState &getUnpackState() const;
void setPackAlignment(GLint alignment);
GLint getPackAlignment() const;
+ const PixelPackState &getPackState() const;
void setPackReverseRowOrder(bool reverseRowOrder);
bool getPackReverseRowOrder() const;
@@ -279,35 +254,58 @@ class Context
GLuint createProgram();
GLuint createTexture();
GLuint createRenderbuffer();
+ GLuint createSampler();
+ GLuint createTransformFeedback();
+ GLsync createFenceSync(GLenum condition);
void deleteBuffer(GLuint buffer);
void deleteShader(GLuint shader);
void deleteProgram(GLuint program);
void deleteTexture(GLuint texture);
void deleteRenderbuffer(GLuint renderbuffer);
+ void deleteSampler(GLuint sampler);
+ void deleteTransformFeedback(GLuint transformFeedback);
+ void deleteFenceSync(GLsync fenceSync);
// Framebuffers are owned by the Context, so these methods do not pass through
GLuint createFramebuffer();
void deleteFramebuffer(GLuint framebuffer);
- // Fences are owned by the Context.
- GLuint createFence();
- void deleteFence(GLuint fence);
+ // NV Fences are owned by the Context.
+ GLuint createFenceNV();
+ void deleteFenceNV(GLuint fence);
// Queries are owned by the Context;
GLuint createQuery();
void deleteQuery(GLuint query);
+ // Vertex arrays are owned by the Context
+ GLuint createVertexArray();
+ void deleteVertexArray(GLuint vertexArray);
+
void bindArrayBuffer(GLuint buffer);
void bindElementArrayBuffer(GLuint buffer);
void bindTexture2D(GLuint texture);
void bindTextureCubeMap(GLuint texture);
+ void bindTexture3D(GLuint texture);
+ void bindTexture2DArray(GLuint texture);
void bindReadFramebuffer(GLuint framebuffer);
void bindDrawFramebuffer(GLuint framebuffer);
void bindRenderbuffer(GLuint renderbuffer);
+ void bindVertexArray(GLuint vertexArray);
+ void bindSampler(GLuint textureUnit, GLuint sampler);
+ void bindGenericUniformBuffer(GLuint buffer);
+ void bindIndexedUniformBuffer(GLuint buffer, GLuint index, GLintptr offset, GLsizeiptr size);
+ void bindGenericTransformFeedbackBuffer(GLuint buffer);
+ void bindIndexedTransformFeedbackBuffer(GLuint buffer, GLuint index, GLintptr offset, GLsizeiptr size);
+ void bindCopyReadBuffer(GLuint buffer);
+ void bindCopyWriteBuffer(GLuint buffer);
+ void bindPixelPackBuffer(GLuint buffer);
+ void bindPixelUnpackBuffer(GLuint buffer);
void useProgram(GLuint program);
void linkProgram(GLuint program);
void setProgramBinary(GLuint program, const void *binary, GLint length);
+ void bindTransformFeedback(GLuint transformFeedback);
void beginQuery(GLenum target, GLuint query);
void endQuery(GLenum target);
@@ -316,35 +314,75 @@ class Context
void setRenderbufferStorage(GLsizei width, GLsizei height, GLenum internalformat, GLsizei samples);
- void setVertexAttrib(GLuint index, const GLfloat *values);
+ void setVertexAttribf(GLuint index, const GLfloat values[4]);
+ void setVertexAttribu(GLuint index, const GLuint values[4]);
+ void setVertexAttribi(GLuint index, const GLint values[4]);
void setVertexAttribDivisor(GLuint index, GLuint divisor);
+ void samplerParameteri(GLuint sampler, GLenum pname, GLint param);
+ void samplerParameterf(GLuint sampler, GLenum pname, GLfloat param);
+ GLint getSamplerParameteri(GLuint sampler, GLenum pname);
+ GLfloat getSamplerParameterf(GLuint sampler, GLenum pname);
+
Buffer *getBuffer(GLuint handle);
- Fence *getFence(GLuint handle);
- Shader *getShader(GLuint handle);
- Program *getProgram(GLuint handle);
+ FenceNV *getFenceNV(GLuint handle);
+ FenceSync *getFenceSync(GLsync handle) const;
+ Shader *getShader(GLuint handle) const;
+ Program *getProgram(GLuint handle) const;
Texture *getTexture(GLuint handle);
- Framebuffer *getFramebuffer(GLuint handle);
- Renderbuffer *getRenderbuffer(GLuint handle);
+ Framebuffer *getFramebuffer(GLuint handle) const;
+ FramebufferAttachment *getRenderbuffer(GLuint handle);
+ VertexArray *getVertexArray(GLuint handle) const;
+ Sampler *getSampler(GLuint handle) const;
Query *getQuery(GLuint handle, bool create, GLenum type);
+ TransformFeedback *getTransformFeedback(GLuint handle) const;
+ Buffer *getTargetBuffer(GLenum target) const;
Buffer *getArrayBuffer();
- Buffer *getElementArrayBuffer();
+ Buffer *getElementArrayBuffer() const;
ProgramBinary *getCurrentProgramBinary();
- Texture2D *getTexture2D();
- TextureCubeMap *getTextureCubeMap();
- Texture *getSamplerTexture(unsigned int sampler, TextureType type);
+
+ Texture *getTargetTexture(GLenum target) const;
+ Texture2D *getTexture2D() const;
+ TextureCubeMap *getTextureCubeMap() const;
+ Texture3D *getTexture3D() const;
+ Texture2DArray *getTexture2DArray() const;
+
+ Buffer *getGenericUniformBuffer();
+ Buffer *getGenericTransformFeedbackBuffer();
+ Buffer *getCopyReadBuffer();
+ Buffer *getCopyWriteBuffer();
+ Buffer *getPixelPackBuffer();
+ Buffer *getPixelUnpackBuffer();
+ Texture *getSamplerTexture(unsigned int sampler, TextureType type) const;
+
+ Framebuffer *getTargetFramebuffer(GLenum target) const;
+ GLuint getTargetFramebufferHandle(GLenum target) const;
Framebuffer *getReadFramebuffer();
Framebuffer *getDrawFramebuffer();
+ VertexArray *getCurrentVertexArray() const;
+ TransformFeedback *getCurrentTransformFeedback() const;
+
+ bool isSampler(GLuint samplerName) const;
- bool getFloatv(GLenum pname, GLfloat *params);
- bool getIntegerv(GLenum pname, GLint *params);
- bool getBooleanv(GLenum pname, GLboolean *params);
+ void getBooleanv(GLenum pname, GLboolean *params);
+ void getFloatv(GLenum pname, GLfloat *params);
+ void getIntegerv(GLenum pname, GLint *params);
+ void getInteger64v(GLenum pname, GLint64 *params);
+
+ bool getIndexedIntegerv(GLenum target, GLuint index, GLint *data);
+ bool getIndexedInteger64v(GLenum target, GLuint index, GLint64 *data);
bool getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams);
+ bool getIndexedQueryParameterInfo(GLenum target, GLenum *type, unsigned int *numParams);
- void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei *bufSize, void* pixels);
void clear(GLbitfield mask);
+ void clearBufferfv(GLenum buffer, int drawbuffer, const float *values);
+ void clearBufferuiv(GLenum buffer, int drawbuffer, const unsigned int *values);
+ void clearBufferiv(GLenum buffer, int drawbuffer, const int *values);
+ void clearBufferfi(GLenum buffer, int drawbuffer, float depth, int stencil);
+
+ void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei *bufSize, void* pixels);
void drawArrays(GLenum mode, GLint first, GLsizei count, GLsizei instances);
void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instances);
void sync(bool block); // flush/finish
@@ -359,16 +397,31 @@ class Context
GLenum getResetStatus();
virtual bool isResetNotificationEnabled();
+ virtual int getClientVersion() const;
+
int getMajorShaderModel() const;
float getMaximumPointSize() const;
unsigned int getMaximumCombinedTextureImageUnits() const;
+ unsigned int getMaximumCombinedUniformBufferBindings() const;
int getMaximumRenderbufferDimension() const;
- int getMaximumTextureDimension() const;
+ int getMaximum2DTextureDimension() const;
int getMaximumCubeTextureDimension() const;
- int getMaximumTextureLevel() const;
+ int getMaximum3DTextureDimension() const;
+ int getMaximum2DArrayTextureLayers() const;
+ int getMaximum2DTextureLevel() const;
+ int getMaximumCubeTextureLevel() const;
+ int getMaximum3DTextureLevel() const;
+ int getMaximum2DArrayTextureLevel() const;
unsigned int getMaximumRenderTargets() const;
GLsizei getMaxSupportedSamples() const;
- const char *getExtensionString() const;
+ GLsizei getMaxSupportedFormatSamples(GLenum internalFormat) const;
+ GLsizei getNumSampleCounts(GLenum internalFormat) const;
+ void getSampleCounts(GLenum internalFormat, GLsizei bufSize, GLint *params) const;
+ unsigned int getMaxTransformFeedbackBufferBindings() const;
+ GLintptr getUniformBufferOffsetAlignment() const;
+ const char *getCombinedExtensionsString() const;
+ const char *getExtensionString(const GLuint index) const;
+ unsigned int getNumExtensions() const;
const char *getRendererString() const;
bool supportsEventQueries() const;
bool supportsOcclusionQueries() const;
@@ -384,36 +437,55 @@ class Context
bool supportsFloat16RenderableTextures() const;
bool supportsLuminanceTextures() const;
bool supportsLuminanceAlphaTextures() const;
+ bool supportsRGTextures() const;
bool supportsDepthTextures() const;
bool supports32bitIndices() const;
bool supportsNonPower2Texture() const;
bool supportsInstancing() const;
bool supportsTextureFilterAnisotropy() const;
+ bool supportsPBOs() const;
- bool getCurrentReadFormatType(GLenum *format, GLenum *type);
+ void getCurrentReadFormatType(GLenum *internalFormat, GLenum *format, GLenum *type);
float getTextureMaxAnisotropy() const;
- void blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
- GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
- GLbitfield mask);
+ void blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
+ GLbitfield mask, GLenum filter);
+
+ void invalidateFrameBuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments,
+ GLint x, GLint y, GLsizei width, GLsizei height);
+
+ bool hasMappedBuffer(GLenum target) const;
rx::Renderer *getRenderer() { return mRenderer; }
private:
DISALLOW_COPY_AND_ASSIGN(Context);
+ // TODO: std::array may become unavailable using older versions of GCC
+ typedef std::array<unsigned int, IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS> FramebufferTextureSerialArray;
+
bool applyRenderTarget(GLenum drawMode, bool ignoreViewport);
void applyState(GLenum drawMode);
- void applyShaders();
- void applyTextures();
- void applyTextures(SamplerType type);
+ void applyShaders(ProgramBinary *programBinary, bool transformFeedbackActive);
+ void applyTextures(SamplerType shaderType, Texture *textures[], TextureType *textureTypes, SamplerState *samplers,
+ size_t textureCount, const FramebufferTextureSerialArray& framebufferSerials,
+ size_t framebufferSerialCount);
+ bool applyUniformBuffers();
+ bool applyTransformFeedbackBuffers();
+ void markTransformFeedbackUsage();
void detachBuffer(GLuint buffer);
void detachTexture(GLuint texture);
void detachFramebuffer(GLuint framebuffer);
void detachRenderbuffer(GLuint renderbuffer);
+ void detachVertexArray(GLuint vertexArray);
+ void detachTransformFeedback(GLuint transformFeedback);
+ void detachSampler(GLuint sampler);
+ void generateSwizzles(Texture *textures[], size_t count);
+ size_t getCurrentTexturesAndSamplerStates(ProgramBinary *programBinary, SamplerType type, Texture **outTextures,
+ TextureType *outTextureTypes, SamplerState *outSamplers);
Texture *getIncompleteTexture(TextureType type);
bool skipDraw(GLenum drawMode);
@@ -421,37 +493,42 @@ class Context
void initExtensionString();
void initRendererString();
- typedef std::set<unsigned> FramebufferTextureSerialSet;
- FramebufferTextureSerialSet getBoundFramebufferTextureSerials();
+ size_t getBoundFramebufferTextureSerials(FramebufferTextureSerialArray *outSerialArray);
rx::Renderer *const mRenderer;
+ int mClientVersion;
+
State mState;
BindingPointer<Texture2D> mTexture2DZero;
BindingPointer<TextureCubeMap> mTextureCubeMapZero;
+ BindingPointer<Texture3D> mTexture3DZero;
+ BindingPointer<Texture2DArray> mTexture2DArrayZero;
-#ifndef HASH_MAP
-# ifdef _MSC_VER
-# define HASH_MAP stdext::hash_map
-# else
-# define HASH_MAP std::unordered_map
-# endif
-#endif
-
- typedef HASH_MAP<GLuint, Framebuffer*> FramebufferMap;
+ typedef std::unordered_map<GLuint, Framebuffer*> FramebufferMap;
FramebufferMap mFramebufferMap;
HandleAllocator mFramebufferHandleAllocator;
- typedef HASH_MAP<GLuint, Fence*> FenceMap;
- FenceMap mFenceMap;
- HandleAllocator mFenceHandleAllocator;
+ typedef std::unordered_map<GLuint, FenceNV*> FenceNVMap;
+ FenceNVMap mFenceNVMap;
+ HandleAllocator mFenceNVHandleAllocator;
- typedef HASH_MAP<GLuint, Query*> QueryMap;
+ typedef std::unordered_map<GLuint, Query*> QueryMap;
QueryMap mQueryMap;
HandleAllocator mQueryHandleAllocator;
- const char *mExtensionString;
+ typedef std::unordered_map<GLuint, VertexArray*> VertexArrayMap;
+ VertexArrayMap mVertexArrayMap;
+ HandleAllocator mVertexArrayHandleAllocator;
+
+ BindingPointer<TransformFeedback> mTransformFeedbackZero;
+ typedef std::unordered_map<GLuint, TransformFeedback*> TransformFeedbackMap;
+ TransformFeedbackMap mTransformFeedbackMap;
+ HandleAllocator mTransformFeedbackAllocator;
+
+ std::vector<std::string> mExtensionStringList;
+ const char *mCombinedExtensionsString;
const char *mRendererString;
BindingPointer<Texture> mIncompleteTextures[TEXTURE_TYPE_COUNT];
@@ -480,9 +557,14 @@ class Context
bool mSupportsInstancing;
int mMaxViewportDimension;
int mMaxRenderbufferDimension;
- int mMaxTextureDimension;
+ int mMax2DTextureDimension;
int mMaxCubeTextureDimension;
- int mMaxTextureLevel;
+ int mMax3DTextureDimension;
+ int mMax2DArrayTextureLayers;
+ int mMax2DTextureLevel;
+ int mMaxCubeTextureLevel;
+ int mMax3DTextureLevel;
+ int mMax2DArrayTextureLevel;
float mMaxTextureAnisotropy;
bool mSupportsEventQueries;
bool mSupportsOcclusionQueries;
@@ -498,9 +580,11 @@ class Context
bool mSupportsFloat16RenderableTextures;
bool mSupportsLuminanceTextures;
bool mSupportsLuminanceAlphaTextures;
+ bool mSupportsRGTextures;
bool mSupportsDepthTextures;
bool mSupports32bitIndices;
bool mSupportsTextureFilterAnisotropy;
+ bool mSupportsPBOs;
int mNumCompressedTextureFormats;
ResourceManager *mResourceManager;
diff --git a/chromium/third_party/angle/src/libGLESv2/DynamicHLSL.cpp b/chromium/third_party/angle/src/libGLESv2/DynamicHLSL.cpp
new file mode 100644
index 00000000000..20e4a205488
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/DynamicHLSL.cpp
@@ -0,0 +1,1057 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// DynamicHLSL.cpp: Implementation for link and run-time HLSL generation
+//
+
+#include "precompiled.h"
+
+#include "libGLESv2/DynamicHLSL.h"
+#include "libGLESv2/Shader.h"
+#include "libGLESv2/Program.h"
+#include "libGLESv2/renderer/Renderer.h"
+#include "common/utilities.h"
+#include "libGLESv2/ProgramBinary.h"
+#include "libGLESv2/formatutils.h"
+#include "common/blocklayout.h"
+
+static std::string Str(int i)
+{
+ char buffer[20];
+ snprintf(buffer, sizeof(buffer), "%d", i);
+ return buffer;
+}
+
+namespace gl_d3d
+{
+
+std::string HLSLComponentTypeString(GLenum componentType)
+{
+ switch (componentType)
+ {
+ case GL_UNSIGNED_INT: return "uint";
+ case GL_INT: return "int";
+ case GL_UNSIGNED_NORMALIZED:
+ case GL_SIGNED_NORMALIZED:
+ case GL_FLOAT: return "float";
+ default: UNREACHABLE(); return "not-component-type";
+ }
+}
+
+std::string HLSLComponentTypeString(GLenum componentType, int componentCount)
+{
+ return HLSLComponentTypeString(componentType) + (componentCount > 1 ? Str(componentCount) : "");
+}
+
+std::string HLSLMatrixTypeString(GLenum type)
+{
+ switch (type)
+ {
+ case GL_FLOAT_MAT2: return "float2x2";
+ case GL_FLOAT_MAT3: return "float3x3";
+ case GL_FLOAT_MAT4: return "float4x4";
+ case GL_FLOAT_MAT2x3: return "float2x3";
+ case GL_FLOAT_MAT3x2: return "float3x2";
+ case GL_FLOAT_MAT2x4: return "float2x4";
+ case GL_FLOAT_MAT4x2: return "float4x2";
+ case GL_FLOAT_MAT3x4: return "float3x4";
+ case GL_FLOAT_MAT4x3: return "float4x3";
+ default: UNREACHABLE(); return "not-matrix-type";
+ }
+}
+
+std::string HLSLTypeString(GLenum type)
+{
+ if (gl::IsMatrixType(type))
+ {
+ return HLSLMatrixTypeString(type);
+ }
+
+ return HLSLComponentTypeString(gl::UniformComponentType(type), gl::UniformComponentCount(type));
+}
+
+}
+
+namespace gl
+{
+
+std::string ArrayString(unsigned int i)
+{
+ return (i == GL_INVALID_INDEX ? "" : "[" + Str(i) + "]");
+}
+
+const std::string DynamicHLSL::VERTEX_ATTRIBUTE_STUB_STRING = "@@ VERTEX ATTRIBUTES @@";
+
+DynamicHLSL::DynamicHLSL(rx::Renderer *const renderer)
+ : mRenderer(renderer)
+{
+}
+
+static bool packVarying(PackedVarying *varying, const int maxVaryingVectors, VaryingPacking packing)
+{
+ GLenum transposedType = TransposeMatrixType(varying->type);
+
+ // matrices within varying structs are not transposed
+ int registers = (varying->isStruct() ? HLSLVariableRegisterCount(*varying) : VariableRowCount(transposedType)) * varying->elementCount();
+ int elements = (varying->isStruct() ? 4 : VariableColumnCount(transposedType));
+
+ if (elements >= 2 && elements <= 4)
+ {
+ for (int r = 0; r <= maxVaryingVectors - registers; r++)
+ {
+ bool available = true;
+
+ for (int y = 0; y < registers && available; y++)
+ {
+ for (int x = 0; x < elements && available; x++)
+ {
+ if (packing[r + y][x])
+ {
+ available = false;
+ }
+ }
+ }
+
+ if (available)
+ {
+ varying->registerIndex = r;
+
+ for (int y = 0; y < registers; y++)
+ {
+ for (int x = 0; x < elements; x++)
+ {
+ packing[r + y][x] = &*varying;
+ }
+ }
+
+ return true;
+ }
+ }
+
+ if (elements == 2)
+ {
+ for (int r = maxVaryingVectors - registers; r >= 0; r--)
+ {
+ bool available = true;
+
+ for (int y = 0; y < registers && available; y++)
+ {
+ for (int x = 2; x < 4 && available; x++)
+ {
+ if (packing[r + y][x])
+ {
+ available = false;
+ }
+ }
+ }
+
+ if (available)
+ {
+ varying->registerIndex = r;
+
+ for (int y = 0; y < registers; y++)
+ {
+ for (int x = 2; x < 4; x++)
+ {
+ packing[r + y][x] = &*varying;
+ }
+ }
+
+ return true;
+ }
+ }
+ }
+ }
+ else if (elements == 1)
+ {
+ int space[4] = { 0 };
+
+ for (int y = 0; y < maxVaryingVectors; y++)
+ {
+ for (int x = 0; x < 4; x++)
+ {
+ space[x] += packing[y][x] ? 0 : 1;
+ }
+ }
+
+ int column = 0;
+
+ for (int x = 0; x < 4; x++)
+ {
+ if (space[x] >= registers && space[x] < space[column])
+ {
+ column = x;
+ }
+ }
+
+ if (space[column] >= registers)
+ {
+ for (int r = 0; r < maxVaryingVectors; r++)
+ {
+ if (!packing[r][column])
+ {
+ varying->registerIndex = r;
+
+ for (int y = r; y < r + registers; y++)
+ {
+ packing[y][column] = &*varying;
+ }
+
+ break;
+ }
+ }
+
+ return true;
+ }
+ }
+ else UNREACHABLE();
+
+ return false;
+}
+
+// Packs varyings into generic varying registers, using the algorithm from [OpenGL ES Shading Language 1.00 rev. 17] appendix A section 7 page 111
+// Returns the number of used varying registers, or -1 if unsuccesful
+int DynamicHLSL::packVaryings(InfoLog &infoLog, VaryingPacking packing, FragmentShader *fragmentShader,
+ VertexShader *vertexShader, const std::vector<std::string>& transformFeedbackVaryings)
+{
+ const int maxVaryingVectors = mRenderer->getMaxVaryingVectors();
+
+ vertexShader->resetVaryingsRegisterAssignment();
+ fragmentShader->resetVaryingsRegisterAssignment();
+
+ std::set<std::string> packedVaryings;
+
+ for (unsigned int varyingIndex = 0; varyingIndex < fragmentShader->mVaryings.size(); varyingIndex++)
+ {
+ PackedVarying *varying = &fragmentShader->mVaryings[varyingIndex];
+ if (packVarying(varying, maxVaryingVectors, packing))
+ {
+ packedVaryings.insert(varying->name);
+ }
+ else
+ {
+ infoLog.append("Could not pack varying %s", varying->name.c_str());
+ return -1;
+ }
+ }
+
+ for (unsigned int feedbackVaryingIndex = 0; feedbackVaryingIndex < transformFeedbackVaryings.size(); feedbackVaryingIndex++)
+ {
+ const std::string &transformFeedbackVarying = transformFeedbackVaryings[feedbackVaryingIndex];
+ if (packedVaryings.find(transformFeedbackVarying) == packedVaryings.end())
+ {
+ bool found = false;
+ for (unsigned int varyingIndex = 0; varyingIndex < vertexShader->mVaryings.size(); varyingIndex++)
+ {
+ PackedVarying *varying = &vertexShader->mVaryings[varyingIndex];
+ if (transformFeedbackVarying == varying->name)
+ {
+ if (!packVarying(varying, maxVaryingVectors, packing))
+ {
+ infoLog.append("Could not pack varying %s", varying->name.c_str());
+ return -1;
+ }
+
+ found = true;
+ break;
+ }
+ }
+
+ if (!found && transformFeedbackVarying != "gl_Position" && transformFeedbackVarying != "gl_PointSize")
+ {
+ infoLog.append("Transform feedback varying %s does not exist in the vertex shader.", transformFeedbackVarying.c_str());
+ return -1;
+ }
+ }
+ }
+
+ // Return the number of used registers
+ int registers = 0;
+
+ for (int r = 0; r < maxVaryingVectors; r++)
+ {
+ if (packing[r][0] || packing[r][1] || packing[r][2] || packing[r][3])
+ {
+ registers++;
+ }
+ }
+
+ return registers;
+}
+
+std::string DynamicHLSL::generateVaryingHLSL(VertexShader *shader, const std::string &varyingSemantic,
+ std::vector<LinkedVarying> *linkedVaryings) const
+{
+ std::string varyingHLSL;
+
+ for (unsigned int varyingIndex = 0; varyingIndex < shader->mVaryings.size(); varyingIndex++)
+ {
+ const PackedVarying &varying = shader->mVaryings[varyingIndex];
+ if (varying.registerAssigned())
+ {
+ GLenum transposedType = TransposeMatrixType(varying.type);
+ int variableRows = (varying.isStruct() ? 1 : VariableRowCount(transposedType));
+
+ for (unsigned int elementIndex = 0; elementIndex < varying.elementCount(); elementIndex++)
+ {
+ for (int row = 0; row < variableRows; row++)
+ {
+ switch (varying.interpolation)
+ {
+ case INTERPOLATION_SMOOTH: varyingHLSL += " "; break;
+ case INTERPOLATION_FLAT: varyingHLSL += " nointerpolation "; break;
+ case INTERPOLATION_CENTROID: varyingHLSL += " centroid "; break;
+ default: UNREACHABLE();
+ }
+
+ unsigned int semanticIndex = elementIndex * variableRows + varying.registerIndex + row;
+ std::string n = Str(semanticIndex);
+
+ std::string typeString;
+
+ if (varying.isStruct())
+ {
+ // matrices within structs are not transposed, so
+ // do not use the special struct prefix "rm"
+ typeString = decorateVariable(varying.structName);
+ }
+ else
+ {
+ GLenum componentType = UniformComponentType(transposedType);
+ int columnCount = VariableColumnCount(transposedType);
+ typeString = gl_d3d::HLSLComponentTypeString(componentType, columnCount);
+ }
+ varyingHLSL += typeString + " v" + n + " : " + varyingSemantic + n + ";\n";
+ }
+ }
+
+ if (linkedVaryings)
+ {
+ linkedVaryings->push_back(LinkedVarying(varying.name, varying.type, varying.elementCount(),
+ varyingSemantic, varying.registerIndex,
+ variableRows * varying.elementCount()));
+ }
+ }
+ }
+
+ return varyingHLSL;
+}
+
+std::string DynamicHLSL::generateInputLayoutHLSL(const VertexFormat inputLayout[], const Attribute shaderAttributes[]) const
+{
+ std::string structHLSL, initHLSL;
+
+ int semanticIndex = 0;
+ unsigned int inputIndex = 0;
+
+ for (unsigned int attributeIndex = 0; attributeIndex < MAX_VERTEX_ATTRIBS; attributeIndex++)
+ {
+ ASSERT(inputIndex < MAX_VERTEX_ATTRIBS);
+
+ const VertexFormat &vertexFormat = inputLayout[inputIndex];
+ const Attribute &shaderAttribute = shaderAttributes[attributeIndex];
+
+ if (!shaderAttribute.name.empty())
+ {
+ // HLSL code for input structure
+ if (IsMatrixType(shaderAttribute.type))
+ {
+ // Matrix types are always transposed
+ structHLSL += " " + gl_d3d::HLSLMatrixTypeString(TransposeMatrixType(shaderAttribute.type));
+ }
+ else
+ {
+ GLenum componentType = mRenderer->getVertexComponentType(vertexFormat);
+ structHLSL += " " + gl_d3d::HLSLComponentTypeString(componentType, UniformComponentCount(shaderAttribute.type));
+ }
+
+ structHLSL += " " + decorateVariable(shaderAttribute.name) + " : TEXCOORD" + Str(semanticIndex) + ";\n";
+ semanticIndex += AttributeRegisterCount(shaderAttribute.type);
+
+ // HLSL code for initialization
+ initHLSL += " " + decorateVariable(shaderAttribute.name) + " = ";
+
+ // Mismatched vertex attribute to vertex input may result in an undefined
+ // data reinterpretation (eg for pure integer->float, float->pure integer)
+ // TODO: issue warning with gl debug info extension, when supported
+ if (IsMatrixType(shaderAttribute.type) ||
+ (mRenderer->getVertexConversionType(vertexFormat) & rx::VERTEX_CONVERT_GPU) != 0)
+ {
+ initHLSL += generateAttributeConversionHLSL(vertexFormat, shaderAttribute);
+ }
+ else
+ {
+ initHLSL += "input." + decorateVariable(shaderAttribute.name);
+ }
+
+ initHLSL += ";\n";
+
+ inputIndex += VariableRowCount(TransposeMatrixType(shaderAttribute.type));
+ }
+ }
+
+ return "struct VS_INPUT\n"
+ "{\n" +
+ structHLSL +
+ "};\n"
+ "\n"
+ "void initAttributes(VS_INPUT input)\n"
+ "{\n" +
+ initHLSL +
+ "}\n";
+}
+
+bool DynamicHLSL::generateShaderLinkHLSL(InfoLog &infoLog, int registers, const VaryingPacking packing,
+ std::string& pixelHLSL, std::string& vertexHLSL,
+ FragmentShader *fragmentShader, VertexShader *vertexShader,
+ const std::vector<std::string>& transformFeedbackVaryings,
+ std::vector<LinkedVarying> *linkedVaryings,
+ std::map<int, VariableLocation> *programOutputVars) const
+{
+ if (pixelHLSL.empty() || vertexHLSL.empty())
+ {
+ return false;
+ }
+
+ bool usesMRT = fragmentShader->mUsesMultipleRenderTargets;
+ bool usesFragColor = fragmentShader->mUsesFragColor;
+ bool usesFragData = fragmentShader->mUsesFragData;
+ if (usesFragColor && usesFragData)
+ {
+ infoLog.append("Cannot use both gl_FragColor and gl_FragData in the same fragment shader.");
+ return false;
+ }
+
+ // Write the HLSL input/output declarations
+ const int shaderModel = mRenderer->getMajorShaderModel();
+ const int maxVaryingVectors = mRenderer->getMaxVaryingVectors();
+
+ const int registersNeeded = registers + (fragmentShader->mUsesFragCoord ? 1 : 0) + (fragmentShader->mUsesPointCoord ? 1 : 0);
+
+ // Two cases when writing to gl_FragColor and using ESSL 1.0:
+ // - with a 3.0 context, the output color is copied to channel 0
+ // - with a 2.0 context, the output color is broadcast to all channels
+ const bool broadcast = (fragmentShader->mUsesFragColor && mRenderer->getCurrentClientVersion() < 3);
+ const unsigned int numRenderTargets = (broadcast || usesMRT ? mRenderer->getMaxRenderTargets() : 1);
+
+ int shaderVersion = vertexShader->getShaderVersion();
+
+ if (registersNeeded > maxVaryingVectors)
+ {
+ infoLog.append("No varying registers left to support gl_FragCoord/gl_PointCoord");
+
+ return false;
+ }
+
+ std::string varyingSemantic = (vertexShader->mUsesPointSize && shaderModel == 3) ? "COLOR" : "TEXCOORD";
+ std::string targetSemantic = (shaderModel >= 4) ? "SV_Target" : "COLOR";
+ std::string dxPositionSemantic = (shaderModel >= 4) ? "SV_Position" : "POSITION";
+ std::string depthSemantic = (shaderModel >= 4) ? "SV_Depth" : "DEPTH";
+
+ std::string varyingHLSL = generateVaryingHLSL(vertexShader, varyingSemantic, linkedVaryings);
+
+ // special varyings that use reserved registers
+ int reservedRegisterIndex = registers;
+
+ unsigned int glPositionSemanticIndex = reservedRegisterIndex++;
+ std::string glPositionSemantic = varyingSemantic;
+
+ std::string fragCoordSemantic;
+ unsigned int fragCoordSemanticIndex = 0;
+ if (fragmentShader->mUsesFragCoord)
+ {
+ fragCoordSemanticIndex = reservedRegisterIndex++;
+ fragCoordSemantic = varyingSemantic;
+ }
+
+ std::string pointCoordSemantic;
+ unsigned int pointCoordSemanticIndex = 0;
+ if (fragmentShader->mUsesPointCoord)
+ {
+ // Shader model 3 uses a special TEXCOORD semantic for point sprite texcoords.
+ // In DX11 we compute this in the GS.
+ if (shaderModel == 3)
+ {
+ pointCoordSemanticIndex = 0;
+ pointCoordSemantic = "TEXCOORD0";
+ }
+ else if (shaderModel >= 4)
+ {
+ pointCoordSemanticIndex = reservedRegisterIndex++;
+ pointCoordSemantic = varyingSemantic;
+ }
+ }
+
+ // Add stub string to be replaced when shader is dynamically defined by its layout
+ vertexHLSL += "\n" + VERTEX_ATTRIBUTE_STUB_STRING + "\n";
+
+ vertexHLSL += "struct VS_OUTPUT\n"
+ "{\n";
+
+ if (shaderModel < 4)
+ {
+ vertexHLSL += " float4 _dx_Position : " + dxPositionSemantic + ";\n";
+ vertexHLSL += " float4 gl_Position : " + glPositionSemantic + Str(glPositionSemanticIndex) + ";\n";
+ linkedVaryings->push_back(LinkedVarying("gl_Position", GL_FLOAT_VEC4, 1, glPositionSemantic, glPositionSemanticIndex, 1));
+
+ }
+
+ vertexHLSL += varyingHLSL;
+
+ if (fragmentShader->mUsesFragCoord)
+ {
+ vertexHLSL += " float4 gl_FragCoord : " + fragCoordSemantic + Str(fragCoordSemanticIndex) + ";\n";
+ linkedVaryings->push_back(LinkedVarying("gl_FragCoord", GL_FLOAT_VEC4, 1, fragCoordSemantic, fragCoordSemanticIndex, 1));
+ }
+
+ if (vertexShader->mUsesPointSize && shaderModel >= 3)
+ {
+ vertexHLSL += " float gl_PointSize : PSIZE;\n";
+ linkedVaryings->push_back(LinkedVarying("gl_PointSize", GL_FLOAT, 1, "PSIZE", 0, 1));
+ }
+
+ if (shaderModel >= 4)
+ {
+ vertexHLSL += " float4 _dx_Position : " + dxPositionSemantic + ";\n";
+ vertexHLSL += " float4 gl_Position : " + glPositionSemantic + Str(glPositionSemanticIndex) + ";\n";
+ linkedVaryings->push_back(LinkedVarying("gl_Position", GL_FLOAT_VEC4, 1, glPositionSemantic, glPositionSemanticIndex, 1));
+ }
+
+ vertexHLSL += "};\n"
+ "\n"
+ "VS_OUTPUT main(VS_INPUT input)\n"
+ "{\n"
+ " initAttributes(input);\n";
+
+ if (shaderModel >= 4)
+ {
+ vertexHLSL += "\n"
+ " gl_main();\n"
+ "\n"
+ " VS_OUTPUT output;\n"
+ " output.gl_Position = gl_Position;\n"
+ " output._dx_Position.x = gl_Position.x;\n"
+ " output._dx_Position.y = -gl_Position.y;\n"
+ " output._dx_Position.z = (gl_Position.z + gl_Position.w) * 0.5;\n"
+ " output._dx_Position.w = gl_Position.w;\n";
+ }
+ else
+ {
+ vertexHLSL += "\n"
+ " gl_main();\n"
+ "\n"
+ " VS_OUTPUT output;\n"
+ " output.gl_Position = gl_Position;\n"
+ " output._dx_Position.x = gl_Position.x * dx_ViewAdjust.z + dx_ViewAdjust.x * gl_Position.w;\n"
+ " output._dx_Position.y = -(gl_Position.y * dx_ViewAdjust.w + dx_ViewAdjust.y * gl_Position.w);\n"
+ " output._dx_Position.z = (gl_Position.z + gl_Position.w) * 0.5;\n"
+ " output._dx_Position.w = gl_Position.w;\n";
+ }
+
+ if (vertexShader->mUsesPointSize && shaderModel >= 3)
+ {
+ vertexHLSL += " output.gl_PointSize = gl_PointSize;\n";
+ }
+
+ if (fragmentShader->mUsesFragCoord)
+ {
+ vertexHLSL += " output.gl_FragCoord = gl_Position;\n";
+ }
+
+ for (unsigned int vertVaryingIndex = 0; vertVaryingIndex < vertexShader->mVaryings.size(); vertVaryingIndex++)
+ {
+ const PackedVarying &varying = vertexShader->mVaryings[vertVaryingIndex];
+ if (varying.registerAssigned())
+ {
+ for (unsigned int elementIndex = 0; elementIndex < varying.elementCount(); elementIndex++)
+ {
+ int variableRows = (varying.isStruct() ? 1 : VariableRowCount(TransposeMatrixType(varying.type)));
+
+ for (int row = 0; row < variableRows; row++)
+ {
+ int r = varying.registerIndex + elementIndex * variableRows + row;
+ vertexHLSL += " output.v" + Str(r);
+
+ bool sharedRegister = false; // Register used by multiple varyings
+
+ for (int x = 0; x < 4; x++)
+ {
+ if (packing[r][x] && packing[r][x] != packing[r][0])
+ {
+ sharedRegister = true;
+ break;
+ }
+ }
+
+ if(sharedRegister)
+ {
+ vertexHLSL += ".";
+
+ for (int x = 0; x < 4; x++)
+ {
+ if (packing[r][x] == &varying)
+ {
+ switch(x)
+ {
+ case 0: vertexHLSL += "x"; break;
+ case 1: vertexHLSL += "y"; break;
+ case 2: vertexHLSL += "z"; break;
+ case 3: vertexHLSL += "w"; break;
+ }
+ }
+ }
+ }
+
+ vertexHLSL += " = _" + varying.name;
+
+ if (varying.isArray())
+ {
+ vertexHLSL += ArrayString(elementIndex);
+ }
+
+ if (variableRows > 1)
+ {
+ vertexHLSL += ArrayString(row);
+ }
+
+ vertexHLSL += ";\n";
+ }
+ }
+ }
+ }
+
+ vertexHLSL += "\n"
+ " return output;\n"
+ "}\n";
+
+ pixelHLSL += "struct PS_INPUT\n"
+ "{\n";
+
+ pixelHLSL += varyingHLSL;
+
+ if (fragmentShader->mUsesFragCoord)
+ {
+ pixelHLSL += " float4 gl_FragCoord : " + fragCoordSemantic + Str(fragCoordSemanticIndex) + ";\n";
+ }
+
+ if (fragmentShader->mUsesPointCoord && shaderModel >= 3)
+ {
+ pixelHLSL += " float2 gl_PointCoord : " + pointCoordSemantic + Str(pointCoordSemanticIndex) + ";\n";
+ }
+
+ // Must consume the PSIZE element if the geometry shader is not active
+ // We won't know if we use a GS until we draw
+ if (vertexShader->mUsesPointSize && shaderModel >= 4)
+ {
+ pixelHLSL += " float gl_PointSize : PSIZE;\n";
+ }
+
+ if (fragmentShader->mUsesFragCoord)
+ {
+ if (shaderModel >= 4)
+ {
+ pixelHLSL += " float4 dx_VPos : SV_Position;\n";
+ }
+ else if (shaderModel >= 3)
+ {
+ pixelHLSL += " float2 dx_VPos : VPOS;\n";
+ }
+ }
+
+ pixelHLSL += "};\n"
+ "\n"
+ "struct PS_OUTPUT\n"
+ "{\n";
+
+ if (shaderVersion < 300)
+ {
+ for (unsigned int renderTargetIndex = 0; renderTargetIndex < numRenderTargets; renderTargetIndex++)
+ {
+ pixelHLSL += " float4 gl_Color" + Str(renderTargetIndex) + " : " + targetSemantic + Str(renderTargetIndex) + ";\n";
+ }
+
+ if (fragmentShader->mUsesFragDepth)
+ {
+ pixelHLSL += " float gl_Depth : " + depthSemantic + ";\n";
+ }
+ }
+ else
+ {
+ defineOutputVariables(fragmentShader, programOutputVars);
+
+ const std::vector<Attribute> &shaderOutputVars = fragmentShader->getOutputVariables();
+ for (auto locationIt = programOutputVars->begin(); locationIt != programOutputVars->end(); locationIt++)
+ {
+ const VariableLocation &outputLocation = locationIt->second;
+ const ShaderVariable &outputVariable = shaderOutputVars[outputLocation.index];
+ const std::string &elementString = (outputLocation.element == GL_INVALID_INDEX ? "" : Str(outputLocation.element));
+
+ pixelHLSL += " " + gl_d3d::HLSLTypeString(outputVariable.type) +
+ " out_" + outputLocation.name + elementString +
+ " : " + targetSemantic + Str(locationIt->first) + ";\n";
+ }
+ }
+
+ pixelHLSL += "};\n"
+ "\n";
+
+ if (fragmentShader->mUsesFrontFacing)
+ {
+ if (shaderModel >= 4)
+ {
+ pixelHLSL += "PS_OUTPUT main(PS_INPUT input, bool isFrontFace : SV_IsFrontFace)\n"
+ "{\n";
+ }
+ else
+ {
+ pixelHLSL += "PS_OUTPUT main(PS_INPUT input, float vFace : VFACE)\n"
+ "{\n";
+ }
+ }
+ else
+ {
+ pixelHLSL += "PS_OUTPUT main(PS_INPUT input)\n"
+ "{\n";
+ }
+
+ if (fragmentShader->mUsesFragCoord)
+ {
+ pixelHLSL += " float rhw = 1.0 / input.gl_FragCoord.w;\n";
+
+ if (shaderModel >= 4)
+ {
+ pixelHLSL += " gl_FragCoord.x = input.dx_VPos.x;\n"
+ " gl_FragCoord.y = input.dx_VPos.y;\n";
+ }
+ else if (shaderModel >= 3)
+ {
+ pixelHLSL += " gl_FragCoord.x = input.dx_VPos.x + 0.5;\n"
+ " gl_FragCoord.y = input.dx_VPos.y + 0.5;\n";
+ }
+ else
+ {
+ // dx_ViewCoords contains the viewport width/2, height/2, center.x and center.y. See Renderer::setViewport()
+ pixelHLSL += " gl_FragCoord.x = (input.gl_FragCoord.x * rhw) * dx_ViewCoords.x + dx_ViewCoords.z;\n"
+ " gl_FragCoord.y = (input.gl_FragCoord.y * rhw) * dx_ViewCoords.y + dx_ViewCoords.w;\n";
+ }
+
+ pixelHLSL += " gl_FragCoord.z = (input.gl_FragCoord.z * rhw) * dx_DepthFront.x + dx_DepthFront.y;\n"
+ " gl_FragCoord.w = rhw;\n";
+ }
+
+ if (fragmentShader->mUsesPointCoord && shaderModel >= 3)
+ {
+ pixelHLSL += " gl_PointCoord.x = input.gl_PointCoord.x;\n";
+ pixelHLSL += " gl_PointCoord.y = 1.0 - input.gl_PointCoord.y;\n";
+ }
+
+ if (fragmentShader->mUsesFrontFacing)
+ {
+ if (shaderModel <= 3)
+ {
+ pixelHLSL += " gl_FrontFacing = (vFace * dx_DepthFront.z >= 0.0);\n";
+ }
+ else
+ {
+ pixelHLSL += " gl_FrontFacing = isFrontFace;\n";
+ }
+ }
+
+ for (unsigned int varyingIndex = 0; varyingIndex < fragmentShader->mVaryings.size(); varyingIndex++)
+ {
+ const PackedVarying &varying = fragmentShader->mVaryings[varyingIndex];
+ if (varying.registerAssigned())
+ {
+ for (unsigned int elementIndex = 0; elementIndex < varying.elementCount(); elementIndex++)
+ {
+ GLenum transposedType = TransposeMatrixType(varying.type);
+ int variableRows = (varying.isStruct() ? 1 : VariableRowCount(transposedType));
+ for (int row = 0; row < variableRows; row++)
+ {
+ std::string n = Str(varying.registerIndex + elementIndex * variableRows + row);
+ pixelHLSL += " _" + varying.name;
+
+ if (varying.isArray())
+ {
+ pixelHLSL += ArrayString(elementIndex);
+ }
+
+ if (variableRows > 1)
+ {
+ pixelHLSL += ArrayString(row);
+ }
+
+ if (varying.isStruct())
+ {
+ pixelHLSL += " = input.v" + n + ";\n"; break;
+ }
+ else
+ {
+ switch (VariableColumnCount(transposedType))
+ {
+ case 1: pixelHLSL += " = input.v" + n + ".x;\n"; break;
+ case 2: pixelHLSL += " = input.v" + n + ".xy;\n"; break;
+ case 3: pixelHLSL += " = input.v" + n + ".xyz;\n"; break;
+ case 4: pixelHLSL += " = input.v" + n + ";\n"; break;
+ default: UNREACHABLE();
+ }
+ }
+ }
+ }
+ }
+ else UNREACHABLE();
+ }
+
+ pixelHLSL += "\n"
+ " gl_main();\n"
+ "\n"
+ " PS_OUTPUT output;\n";
+
+ if (shaderVersion < 300)
+ {
+ for (unsigned int renderTargetIndex = 0; renderTargetIndex < numRenderTargets; renderTargetIndex++)
+ {
+ unsigned int sourceColorIndex = broadcast ? 0 : renderTargetIndex;
+
+ pixelHLSL += " output.gl_Color" + Str(renderTargetIndex) + " = gl_Color[" + Str(sourceColorIndex) + "];\n";
+ }
+
+ if (fragmentShader->mUsesFragDepth)
+ {
+ pixelHLSL += " output.gl_Depth = gl_Depth;\n";
+ }
+ }
+ else
+ {
+ for (auto locationIt = programOutputVars->begin(); locationIt != programOutputVars->end(); locationIt++)
+ {
+ const VariableLocation &outputLocation = locationIt->second;
+ const std::string &variableName = "out_" + outputLocation.name;
+ const std::string &outVariableName = variableName + (outputLocation.element == GL_INVALID_INDEX ? "" : Str(outputLocation.element));
+ const std::string &staticVariableName = variableName + ArrayString(outputLocation.element);
+
+ pixelHLSL += " output." + outVariableName + " = " + staticVariableName + ";\n";
+ }
+ }
+
+ pixelHLSL += "\n"
+ " return output;\n"
+ "}\n";
+
+ return true;
+}
+
+void DynamicHLSL::defineOutputVariables(FragmentShader *fragmentShader, std::map<int, VariableLocation> *programOutputVars) const
+{
+ const std::vector<Attribute> &shaderOutputVars = fragmentShader->getOutputVariables();
+
+ for (unsigned int outputVariableIndex = 0; outputVariableIndex < shaderOutputVars.size(); outputVariableIndex++)
+ {
+ const Attribute &outputVariable = shaderOutputVars[outputVariableIndex];
+ const int baseLocation = outputVariable.location == -1 ? 0 : outputVariable.location;
+
+ if (outputVariable.arraySize > 0)
+ {
+ for (unsigned int elementIndex = 0; elementIndex < outputVariable.arraySize; elementIndex++)
+ {
+ const int location = baseLocation + elementIndex;
+ ASSERT(programOutputVars->count(location) == 0);
+ (*programOutputVars)[location] = VariableLocation(outputVariable.name, elementIndex, outputVariableIndex);
+ }
+ }
+ else
+ {
+ ASSERT(programOutputVars->count(baseLocation) == 0);
+ (*programOutputVars)[baseLocation] = VariableLocation(outputVariable.name, GL_INVALID_INDEX, outputVariableIndex);
+ }
+ }
+}
+
+std::string DynamicHLSL::generateGeometryShaderHLSL(int registers, FragmentShader *fragmentShader, VertexShader *vertexShader) const
+{
+ // for now we only handle point sprite emulation
+ ASSERT(vertexShader->mUsesPointSize && mRenderer->getMajorShaderModel() >= 4);
+ return generatePointSpriteHLSL(registers, fragmentShader, vertexShader);
+}
+
+std::string DynamicHLSL::generatePointSpriteHLSL(int registers, FragmentShader *fragmentShader, VertexShader *vertexShader) const
+{
+ ASSERT(registers >= 0);
+ ASSERT(vertexShader->mUsesPointSize);
+ ASSERT(mRenderer->getMajorShaderModel() >= 4);
+
+ std::string geomHLSL;
+
+ std::string varyingSemantic = "TEXCOORD";
+
+ std::string fragCoordSemantic;
+ std::string pointCoordSemantic;
+
+ int reservedRegisterIndex = registers;
+
+ if (fragmentShader->mUsesFragCoord)
+ {
+ fragCoordSemantic = varyingSemantic + Str(reservedRegisterIndex++);
+ }
+
+ if (fragmentShader->mUsesPointCoord)
+ {
+ pointCoordSemantic = varyingSemantic + Str(reservedRegisterIndex++);
+ }
+
+ geomHLSL += "uniform float4 dx_ViewCoords : register(c1);\n"
+ "\n"
+ "struct GS_INPUT\n"
+ "{\n";
+
+ std::string varyingHLSL = generateVaryingHLSL(vertexShader, varyingSemantic, NULL);
+
+ geomHLSL += varyingHLSL;
+
+ if (fragmentShader->mUsesFragCoord)
+ {
+ geomHLSL += " float4 gl_FragCoord : " + fragCoordSemantic + ";\n";
+ }
+
+ geomHLSL += " float gl_PointSize : PSIZE;\n"
+ " float4 gl_Position : SV_Position;\n"
+ "};\n"
+ "\n"
+ "struct GS_OUTPUT\n"
+ "{\n";
+
+ geomHLSL += varyingHLSL;
+
+ if (fragmentShader->mUsesFragCoord)
+ {
+ geomHLSL += " float4 gl_FragCoord : " + fragCoordSemantic + ";\n";
+ }
+
+ if (fragmentShader->mUsesPointCoord)
+ {
+ geomHLSL += " float2 gl_PointCoord : " + pointCoordSemantic + ";\n";
+ }
+
+ geomHLSL += " float gl_PointSize : PSIZE;\n"
+ " float4 gl_Position : SV_Position;\n"
+ "};\n"
+ "\n"
+ "static float2 pointSpriteCorners[] = \n"
+ "{\n"
+ " float2( 0.5f, -0.5f),\n"
+ " float2( 0.5f, 0.5f),\n"
+ " float2(-0.5f, -0.5f),\n"
+ " float2(-0.5f, 0.5f)\n"
+ "};\n"
+ "\n"
+ "static float2 pointSpriteTexcoords[] = \n"
+ "{\n"
+ " float2(1.0f, 1.0f),\n"
+ " float2(1.0f, 0.0f),\n"
+ " float2(0.0f, 1.0f),\n"
+ " float2(0.0f, 0.0f)\n"
+ "};\n"
+ "\n"
+ "static float minPointSize = " + Str(ALIASED_POINT_SIZE_RANGE_MIN) + ".0f;\n"
+ "static float maxPointSize = " + Str(mRenderer->getMaxPointSize()) + ".0f;\n"
+ "\n"
+ "[maxvertexcount(4)]\n"
+ "void main(point GS_INPUT input[1], inout TriangleStream<GS_OUTPUT> outStream)\n"
+ "{\n"
+ " GS_OUTPUT output = (GS_OUTPUT)0;\n"
+ " output.gl_PointSize = input[0].gl_PointSize;\n";
+
+ for (int r = 0; r < registers; r++)
+ {
+ geomHLSL += " output.v" + Str(r) + " = input[0].v" + Str(r) + ";\n";
+ }
+
+ if (fragmentShader->mUsesFragCoord)
+ {
+ geomHLSL += " output.gl_FragCoord = input[0].gl_FragCoord;\n";
+ }
+
+ geomHLSL += " \n"
+ " float gl_PointSize = clamp(input[0].gl_PointSize, minPointSize, maxPointSize);\n"
+ " float4 gl_Position = input[0].gl_Position;\n"
+ " float2 viewportScale = float2(1.0f / dx_ViewCoords.x, 1.0f / dx_ViewCoords.y) * gl_Position.w;\n";
+
+ for (int corner = 0; corner < 4; corner++)
+ {
+ geomHLSL += " \n"
+ " output.gl_Position = gl_Position + float4(pointSpriteCorners[" + Str(corner) + "] * viewportScale * gl_PointSize, 0.0f, 0.0f);\n";
+
+ if (fragmentShader->mUsesPointCoord)
+ {
+ geomHLSL += " output.gl_PointCoord = pointSpriteTexcoords[" + Str(corner) + "];\n";
+ }
+
+ geomHLSL += " outStream.Append(output);\n";
+ }
+
+ geomHLSL += " \n"
+ " outStream.RestartStrip();\n"
+ "}\n";
+
+ return geomHLSL;
+}
+
+// This method needs to match OutputHLSL::decorate
+std::string DynamicHLSL::decorateVariable(const std::string &name)
+{
+ if (name.compare(0, 3, "gl_") != 0 && name.compare(0, 3, "dx_") != 0)
+ {
+ return "_" + name;
+ }
+
+ return name;
+}
+
+std::string DynamicHLSL::generateAttributeConversionHLSL(const VertexFormat &vertexFormat, const ShaderVariable &shaderAttrib) const
+{
+ std::string attribString = "input." + decorateVariable(shaderAttrib.name);
+
+ // Matrix
+ if (IsMatrixType(shaderAttrib.type))
+ {
+ return "transpose(" + attribString + ")";
+ }
+
+ GLenum shaderComponentType = UniformComponentType(shaderAttrib.type);
+ int shaderComponentCount = UniformComponentCount(shaderAttrib.type);
+
+ // Perform integer to float conversion (if necessary)
+ bool requiresTypeConversion = (shaderComponentType == GL_FLOAT && vertexFormat.mType != GL_FLOAT);
+
+ if (requiresTypeConversion)
+ {
+ // TODO: normalization for 32-bit integer formats
+ ASSERT(!vertexFormat.mNormalized && !vertexFormat.mPureInteger);
+ return "float" + Str(shaderComponentCount) + "(" + attribString + ")";
+ }
+
+ // No conversion necessary
+ return attribString;
+}
+
+void DynamicHLSL::getInputLayoutSignature(const VertexFormat inputLayout[], GLenum signature[]) const
+{
+ for (size_t inputIndex = 0; inputIndex < MAX_VERTEX_ATTRIBS; inputIndex++)
+ {
+ const VertexFormat &vertexFormat = inputLayout[inputIndex];
+
+ if (vertexFormat.mType == GL_NONE)
+ {
+ signature[inputIndex] = GL_NONE;
+ }
+ else
+ {
+ bool gpuConverted = ((mRenderer->getVertexConversionType(vertexFormat) & rx::VERTEX_CONVERT_GPU) != 0);
+ signature[inputIndex] = (gpuConverted ? GL_TRUE : GL_FALSE);
+ }
+ }
+}
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/DynamicHLSL.h b/chromium/third_party/angle/src/libGLESv2/DynamicHLSL.h
new file mode 100644
index 00000000000..07c2a2f2bbc
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/DynamicHLSL.h
@@ -0,0 +1,78 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// DynamicHLSL.h: Interface for link and run-time HLSL generation
+//
+
+#ifndef LIBGLESV2_DYNAMIC_HLSL_H_
+#define LIBGLESV2_DYNAMIC_HLSL_H_
+
+#include "common/angleutils.h"
+#include "libGLESv2/constants.h"
+
+namespace rx
+{
+class Renderer;
+}
+
+namespace gl
+{
+
+class InfoLog;
+class FragmentShader;
+class VertexShader;
+struct VariableLocation;
+struct LinkedVarying;
+class VertexAttribute;
+struct VertexFormat;
+struct ShaderVariable;
+struct Varying;
+struct Attribute;
+struct PackedVarying;
+
+typedef const PackedVarying *VaryingPacking[IMPLEMENTATION_MAX_VARYING_VECTORS][4];
+
+class DynamicHLSL
+{
+ public:
+ explicit DynamicHLSL(rx::Renderer *const renderer);
+
+ int packVaryings(InfoLog &infoLog, VaryingPacking packing, FragmentShader *fragmentShader,
+ VertexShader *vertexShader, const std::vector<std::string>& transformFeedbackVaryings);
+ std::string generateInputLayoutHLSL(const VertexFormat inputLayout[], const Attribute shaderAttributes[]) const;
+ bool generateShaderLinkHLSL(InfoLog &infoLog, int registers, const VaryingPacking packing,
+ std::string& pixelHLSL, std::string& vertexHLSL,
+ FragmentShader *fragmentShader, VertexShader *vertexShader,
+ const std::vector<std::string>& transformFeedbackVaryings,
+ std::vector<LinkedVarying> *linkedVaryings,
+ std::map<int, VariableLocation> *programOutputVars) const;
+
+ std::string generateGeometryShaderHLSL(int registers, FragmentShader *fragmentShader, VertexShader *vertexShader) const;
+ void getInputLayoutSignature(const VertexFormat inputLayout[], GLenum signature[]) const;
+
+ static const std::string VERTEX_ATTRIBUTE_STUB_STRING;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DynamicHLSL);
+
+ rx::Renderer *const mRenderer;
+
+ std::string generateVaryingHLSL(VertexShader *shader, const std::string &varyingSemantic,
+ std::vector<LinkedVarying> *linkedVaryings) const;
+ void defineOutputVariables(FragmentShader *fragmentShader, std::map<int, VariableLocation> *programOutputVars) const;
+ std::string generatePointSpriteHLSL(int registers, FragmentShader *fragmentShader, VertexShader *vertexShader) const;
+
+ // Prepend an underscore
+ static std::string decorateVariable(const std::string &name);
+
+ std::string generateAttributeConversionHLSL(const VertexFormat &vertexFormat, const ShaderVariable &shaderAttrib) const;
+};
+
+// Utility method shared between ProgramBinary and DynamicHLSL
+std::string ArrayString(unsigned int i);
+
+}
+
+#endif // LIBGLESV2_DYNAMIC_HLSL_H_
diff --git a/chromium/third_party/angle/src/libGLESv2/Fence.cpp b/chromium/third_party/angle/src/libGLESv2/Fence.cpp
index e4218bbeec2..31d149d629f 100644
--- a/chromium/third_party/angle/src/libGLESv2/Fence.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/Fence.cpp
@@ -7,46 +7,187 @@
// Fence.cpp: Implements the gl::Fence class, which supports the GL_NV_fence extension.
+// Important note on accurate timers in Windows:
+//
+// QueryPerformanceCounter has a few major issues, including being 10x as expensive to call
+// as timeGetTime on laptops and "jumping" during certain hardware events.
+//
+// See the comments at the top of the Chromium source file "chromium/src/base/time/time_win.cc"
+// https://code.google.com/p/chromium/codesearch#chromium/src/base/time/time_win.cc
+//
+// We still opt to use QPC. In the present and moving forward, most newer systems will not suffer
+// from buggy implementations.
+
#include "libGLESv2/Fence.h"
#include "libGLESv2/renderer/FenceImpl.h"
#include "libGLESv2/renderer/Renderer.h"
+#include "libGLESv2/main.h"
namespace gl
{
-Fence::Fence(rx::Renderer *renderer)
+FenceNV::FenceNV(rx::Renderer *renderer)
{
mFence = renderer->createFence();
}
-Fence::~Fence()
+FenceNV::~FenceNV()
{
delete mFence;
}
-GLboolean Fence::isFence()
+GLboolean FenceNV::isFence() const
+{
+ // GL_NV_fence spec:
+ // A name returned by GenFencesNV, but not yet set via SetFenceNV, is not the name of an existing fence.
+ return (mFence->isSet() ? GL_TRUE : GL_FALSE);
+}
+
+void FenceNV::setFence(GLenum condition)
+{
+ mFence->set();
+
+ mCondition = condition;
+ mStatus = GL_FALSE;
+}
+
+GLboolean FenceNV::testFence()
+{
+ // Flush the command buffer by default
+ bool result = mFence->test(true);
+
+ mStatus = (result ? GL_TRUE : GL_FALSE);
+ return mStatus;
+}
+
+void FenceNV::finishFence()
+{
+ ASSERT(mFence->isSet());
+
+ while (!mFence->test(true))
+ {
+ Sleep(0);
+ }
+}
+
+GLint FenceNV::getFencei(GLenum pname)
+{
+ ASSERT(mFence->isSet());
+
+ switch (pname)
+ {
+ case GL_FENCE_STATUS_NV:
+ {
+ // GL_NV_fence spec:
+ // Once the status of a fence has been finished (via FinishFenceNV) or tested and the returned status is TRUE (via either TestFenceNV
+ // or GetFenceivNV querying the FENCE_STATUS_NV), the status remains TRUE until the next SetFenceNV of the fence.
+ if (mStatus == GL_TRUE)
+ {
+ return GL_TRUE;
+ }
+
+ mStatus = (mFence->test(false) ? GL_TRUE : GL_FALSE);
+ return mStatus;
+ }
+
+ case GL_FENCE_CONDITION_NV:
+ return mCondition;
+
+ default: UNREACHABLE(); return 0;
+ }
+}
+
+FenceSync::FenceSync(rx::Renderer *renderer, GLuint id)
+ : RefCountObject(id)
{
- return mFence->isFence();
+ mFence = renderer->createFence();
+
+ LARGE_INTEGER counterFreqency = { 0 };
+ BOOL success = QueryPerformanceFrequency(&counterFreqency);
+ UNUSED_ASSERTION_VARIABLE(success);
+ ASSERT(success);
+
+ mCounterFrequency = counterFreqency.QuadPart;
+}
+
+FenceSync::~FenceSync()
+{
+ delete mFence;
}
-void Fence::setFence(GLenum condition)
+void FenceSync::set(GLenum condition)
{
- mFence->setFence(condition);
+ mCondition = condition;
+ mFence->set();
}
-GLboolean Fence::testFence()
+GLenum FenceSync::clientWait(GLbitfield flags, GLuint64 timeout)
{
- return mFence->testFence();
+ ASSERT(mFence->isSet());
+
+ bool flushCommandBuffer = ((flags & GL_SYNC_FLUSH_COMMANDS_BIT) != 0);
+
+ if (mFence->test(flushCommandBuffer))
+ {
+ return GL_ALREADY_SIGNALED;
+ }
+
+ if (mFence->hasError())
+ {
+ return GL_WAIT_FAILED;
+ }
+
+ if (timeout == 0)
+ {
+ return GL_TIMEOUT_EXPIRED;
+ }
+
+ LARGE_INTEGER currentCounter = { 0 };
+ BOOL success = QueryPerformanceCounter(&currentCounter);
+ UNUSED_ASSERTION_VARIABLE(success);
+ ASSERT(success);
+
+ LONGLONG timeoutInSeconds = static_cast<LONGLONG>(timeout) * static_cast<LONGLONG>(1000000ll);
+ LONGLONG endCounter = currentCounter.QuadPart + mCounterFrequency * timeoutInSeconds;
+
+ while (currentCounter.QuadPart < endCounter && !mFence->test(flushCommandBuffer))
+ {
+ Sleep(0);
+ BOOL success = QueryPerformanceCounter(&currentCounter);
+ UNUSED_ASSERTION_VARIABLE(success);
+ ASSERT(success);
+ }
+
+ if (mFence->hasError())
+ {
+ return GL_WAIT_FAILED;
+ }
+
+ if (currentCounter.QuadPart >= endCounter)
+ {
+ return GL_TIMEOUT_EXPIRED;
+ }
+
+ return GL_CONDITION_SATISFIED;
}
-void Fence::finishFence()
+void FenceSync::serverWait()
{
- mFence->finishFence();
+ // Because our API is currently designed to be called from a single thread, we don't need to do
+ // extra work for a server-side fence. GPU commands issued after the fence is created will always
+ // be processed after the fence is signaled.
}
-void Fence::getFenceiv(GLenum pname, GLint *params)
+GLenum FenceSync::getStatus() const
{
- mFence->getFenceiv(pname, params);
+ if (mFence->test(false))
+ {
+ // The spec does not specify any way to report errors during the status test (e.g. device lost)
+ // so we report the fence is unblocked in case of error or signaled.
+ return GL_SIGNALED;
+ }
+
+ return GL_UNSIGNALED;
}
}
diff --git a/chromium/third_party/angle/src/libGLESv2/Fence.h b/chromium/third_party/angle/src/libGLESv2/Fence.h
index 1cedebb112d..291edb3de12 100644
--- a/chromium/third_party/angle/src/libGLESv2/Fence.h
+++ b/chromium/third_party/angle/src/libGLESv2/Fence.h
@@ -10,6 +10,7 @@
#define LIBGLESV2_FENCE_H_
#include "common/angleutils.h"
+#include "common/RefCountObject.h"
namespace rx
{
@@ -20,22 +21,50 @@ class FenceImpl;
namespace gl
{
-class Fence
+class FenceNV
{
public:
- explicit Fence(rx::Renderer *renderer);
- virtual ~Fence();
+ explicit FenceNV(rx::Renderer *renderer);
+ virtual ~FenceNV();
- GLboolean isFence();
+ GLboolean isFence() const;
void setFence(GLenum condition);
GLboolean testFence();
void finishFence();
- void getFenceiv(GLenum pname, GLint *params);
+ GLint getFencei(GLenum pname);
+
+ GLboolean getStatus() const { return mStatus; }
+ GLuint getCondition() const { return mCondition; }
private:
- DISALLOW_COPY_AND_ASSIGN(Fence);
+ DISALLOW_COPY_AND_ASSIGN(FenceNV);
rx::FenceImpl *mFence;
+
+ GLboolean mStatus;
+ GLenum mCondition;
+};
+
+class FenceSync : public RefCountObject
+{
+ public:
+ explicit FenceSync(rx::Renderer *renderer, GLuint id);
+ virtual ~FenceSync();
+
+ void set(GLenum condition);
+ GLenum clientWait(GLbitfield flags, GLuint64 timeout);
+ void serverWait();
+ GLenum getStatus() const;
+
+ GLuint getCondition() const { return mCondition; }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(FenceSync);
+
+ rx::FenceImpl *mFence;
+ LONGLONG mCounterFrequency;
+
+ GLenum mCondition;
};
}
diff --git a/chromium/third_party/angle/src/libGLESv2/Framebuffer.cpp b/chromium/third_party/angle/src/libGLESv2/Framebuffer.cpp
index b0abba0ac44..b78419fc40a 100644
--- a/chromium/third_party/angle/src/libGLESv2/Framebuffer.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/Framebuffer.cpp
@@ -11,7 +11,8 @@
#include "libGLESv2/Framebuffer.h"
#include "libGLESv2/main.h"
-#include "libGLESv2/utilities.h"
+#include "common/utilities.h"
+#include "libGLESv2/formatutils.h"
#include "libGLESv2/Texture.h"
#include "libGLESv2/Context.h"
#include "libGLESv2/renderer/Renderer.h"
@@ -25,91 +26,171 @@ Framebuffer::Framebuffer(rx::Renderer *renderer)
{
for (unsigned int colorAttachment = 0; colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
{
- mColorbufferTypes[colorAttachment] = GL_NONE;
mDrawBufferStates[colorAttachment] = GL_NONE;
}
mDrawBufferStates[0] = GL_COLOR_ATTACHMENT0_EXT;
mReadBufferState = GL_COLOR_ATTACHMENT0_EXT;
-
- mDepthbufferType = GL_NONE;
- mStencilbufferType = GL_NONE;
}
Framebuffer::~Framebuffer()
{
for (unsigned int colorAttachment = 0; colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
{
- mColorbufferPointers[colorAttachment].set(NULL);
+ mColorbuffers[colorAttachment].set(NULL, GL_NONE, 0, 0);
}
- mDepthbufferPointer.set(NULL);
- mStencilbufferPointer.set(NULL);
+ mDepthbuffer.set(NULL, GL_NONE, 0, 0);
+ mStencilbuffer.set(NULL, GL_NONE, 0, 0);
}
-Renderbuffer *Framebuffer::lookupRenderbuffer(GLenum type, GLuint handle) const
+FramebufferAttachment *Framebuffer::lookupAttachment(GLenum type, GLuint handle, GLint level, GLint layer) const
{
gl::Context *context = gl::getContext();
- Renderbuffer *buffer = NULL;
- if (type == GL_NONE)
- {
- buffer = NULL;
- }
- else if (type == GL_RENDERBUFFER)
+ switch (type)
{
- buffer = context->getRenderbuffer(handle);
+ case GL_NONE:
+ return NULL;
+
+ case GL_RENDERBUFFER:
+ return context->getRenderbuffer(handle);
+
+ case GL_TEXTURE_2D:
+ {
+ Texture *texture = context->getTexture(handle);
+ if (texture && texture->getTarget() == GL_TEXTURE_2D)
+ {
+ return static_cast<Texture2D*>(texture)->getAttachment(level);
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ {
+ Texture *texture = context->getTexture(handle);
+ if (texture && texture->getTarget() == GL_TEXTURE_CUBE_MAP)
+ {
+ return static_cast<TextureCubeMap*>(texture)->getAttachment(type, level);
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+
+ case GL_TEXTURE_3D:
+ {
+ Texture *texture = context->getTexture(handle);
+ if (texture && texture->getTarget() == GL_TEXTURE_3D)
+ {
+ return static_cast<Texture3D*>(texture)->getAttachment(level, layer);
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+
+ case GL_TEXTURE_2D_ARRAY:
+ {
+ Texture *texture = context->getTexture(handle);
+ if (texture && texture->getTarget() == GL_TEXTURE_2D_ARRAY)
+ {
+ return static_cast<Texture2DArray*>(texture)->getAttachment(level, layer);
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+
+ default:
+ UNREACHABLE();
+ return NULL;
}
- else if (IsInternalTextureTarget(type))
+}
+
+void Framebuffer::setColorbuffer(unsigned int colorAttachment, GLenum type, GLuint colorbuffer, GLint level, GLint layer)
+{
+ ASSERT(colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS);
+ FramebufferAttachment *attachment = lookupAttachment(type, colorbuffer, level, layer);
+ if (attachment)
{
- buffer = context->getTexture(handle)->getRenderbuffer(type);
+ mColorbuffers[colorAttachment].set(attachment, type, level, layer);
}
else
{
- UNREACHABLE();
+ mColorbuffers[colorAttachment].set(NULL, GL_NONE, 0, 0);
}
-
- return buffer;
}
-void Framebuffer::setColorbuffer(unsigned int colorAttachment, GLenum type, GLuint colorbuffer)
+void Framebuffer::setDepthbuffer(GLenum type, GLuint depthbuffer, GLint level, GLint layer)
{
- ASSERT(colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS);
- mColorbufferTypes[colorAttachment] = (colorbuffer != 0) ? type : GL_NONE;
- mColorbufferPointers[colorAttachment].set(lookupRenderbuffer(type, colorbuffer));
+ FramebufferAttachment *attachment = lookupAttachment(type, depthbuffer, level, layer);
+ if (attachment)
+ {
+ mDepthbuffer.set(attachment, type, level, layer);
+ }
+ else
+ {
+ mDepthbuffer.set(NULL, GL_NONE, 0, 0);
+ }
}
-void Framebuffer::setDepthbuffer(GLenum type, GLuint depthbuffer)
+void Framebuffer::setStencilbuffer(GLenum type, GLuint stencilbuffer, GLint level, GLint layer)
{
- mDepthbufferType = (depthbuffer != 0) ? type : GL_NONE;
- mDepthbufferPointer.set(lookupRenderbuffer(type, depthbuffer));
+ FramebufferAttachment *attachment = lookupAttachment(type, stencilbuffer, level, layer);
+ if (attachment)
+ {
+ mStencilbuffer.set(attachment, type, level, layer);
+ }
+ else
+ {
+ mStencilbuffer.set(NULL, GL_NONE, 0, 0);
+ }
}
-void Framebuffer::setStencilbuffer(GLenum type, GLuint stencilbuffer)
+void Framebuffer::setDepthStencilBuffer(GLenum type, GLuint depthStencilBuffer, GLint level, GLint layer)
{
- mStencilbufferType = (stencilbuffer != 0) ? type : GL_NONE;
- mStencilbufferPointer.set(lookupRenderbuffer(type, stencilbuffer));
+ FramebufferAttachment *attachment = lookupAttachment(type, depthStencilBuffer, level, layer);
+ if (attachment && attachment->getDepthSize() > 0 && attachment->getStencilSize() > 0)
+ {
+ mDepthbuffer.set(attachment, type, level, layer);
+ mStencilbuffer.set(attachment, type, level, layer);
+ }
+ else
+ {
+ mDepthbuffer.set(NULL, GL_NONE, 0, 0);
+ mStencilbuffer.set(NULL, GL_NONE, 0, 0);
+ }
}
void Framebuffer::detachTexture(GLuint texture)
{
for (unsigned int colorAttachment = 0; colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
{
- if (mColorbufferPointers[colorAttachment].id() == texture && IsInternalTextureTarget(mColorbufferTypes[colorAttachment]))
+ if (mColorbuffers[colorAttachment].id() == texture &&
+ IsInternalTextureTarget(mColorbuffers[colorAttachment].type(), mRenderer->getCurrentClientVersion()))
{
- mColorbufferTypes[colorAttachment] = GL_NONE;
- mColorbufferPointers[colorAttachment].set(NULL);
+ mColorbuffers[colorAttachment].set(NULL, GL_NONE, 0, 0);
}
}
- if (mDepthbufferPointer.id() == texture && IsInternalTextureTarget(mDepthbufferType))
+ if (mDepthbuffer.id() == texture && IsInternalTextureTarget(mDepthbuffer.type(), mRenderer->getCurrentClientVersion()))
{
- mDepthbufferType = GL_NONE;
- mDepthbufferPointer.set(NULL);
+ mDepthbuffer.set(NULL, GL_NONE, 0, 0);
}
- if (mStencilbufferPointer.id() == texture && IsInternalTextureTarget(mStencilbufferType))
+ if (mStencilbuffer.id() == texture && IsInternalTextureTarget(mStencilbuffer.type(), mRenderer->getCurrentClientVersion()))
{
- mStencilbufferType = GL_NONE;
- mStencilbufferPointer.set(NULL);
+ mStencilbuffer.set(NULL, GL_NONE, 0, 0);
}
}
@@ -117,23 +198,20 @@ void Framebuffer::detachRenderbuffer(GLuint renderbuffer)
{
for (unsigned int colorAttachment = 0; colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
{
- if (mColorbufferPointers[colorAttachment].id() == renderbuffer && mColorbufferTypes[colorAttachment] == GL_RENDERBUFFER)
+ if (mColorbuffers[colorAttachment].id() == renderbuffer && mColorbuffers[colorAttachment].type() == GL_RENDERBUFFER)
{
- mColorbufferTypes[colorAttachment] = GL_NONE;
- mColorbufferPointers[colorAttachment].set(NULL);
+ mColorbuffers[colorAttachment].set(NULL, GL_NONE, 0, 0);
}
}
- if (mDepthbufferPointer.id() == renderbuffer && mDepthbufferType == GL_RENDERBUFFER)
+ if (mDepthbuffer.id() == renderbuffer && mDepthbuffer.type() == GL_RENDERBUFFER)
{
- mDepthbufferType = GL_NONE;
- mDepthbufferPointer.set(NULL);
+ mDepthbuffer.set(NULL, GL_NONE, 0, 0);
}
- if (mStencilbufferPointer.id() == renderbuffer && mStencilbufferType == GL_RENDERBUFFER)
+ if (mStencilbuffer.id() == renderbuffer && mStencilbuffer.type() == GL_RENDERBUFFER)
{
- mStencilbufferType = GL_NONE;
- mStencilbufferPointer.set(NULL);
+ mStencilbuffer.set(NULL, GL_NONE, 0, 0);
}
}
@@ -141,7 +219,7 @@ unsigned int Framebuffer::getRenderTargetSerial(unsigned int colorAttachment) co
{
ASSERT(colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS);
- Renderbuffer *colorbuffer = mColorbufferPointers[colorAttachment].get();
+ FramebufferAttachment *colorbuffer = mColorbuffers[colorAttachment].get();
if (colorbuffer)
{
@@ -153,7 +231,7 @@ unsigned int Framebuffer::getRenderTargetSerial(unsigned int colorAttachment) co
unsigned int Framebuffer::getDepthbufferSerial() const
{
- Renderbuffer *depthbuffer = mDepthbufferPointer.get();
+ FramebufferAttachment *depthbuffer = mDepthbuffer.get();
if (depthbuffer)
{
@@ -165,7 +243,7 @@ unsigned int Framebuffer::getDepthbufferSerial() const
unsigned int Framebuffer::getStencilbufferSerial() const
{
- Renderbuffer *stencilbuffer = mStencilbufferPointer.get();
+ FramebufferAttachment *stencilbuffer = mStencilbuffer.get();
if (stencilbuffer)
{
@@ -175,53 +253,58 @@ unsigned int Framebuffer::getStencilbufferSerial() const
return 0;
}
-Renderbuffer *Framebuffer::getColorbuffer(unsigned int colorAttachment) const
+FramebufferAttachment *Framebuffer::getColorbuffer(unsigned int colorAttachment) const
{
ASSERT(colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS);
- return mColorbufferPointers[colorAttachment].get();
+ return mColorbuffers[colorAttachment].get();
}
-Renderbuffer *Framebuffer::getDepthbuffer() const
+FramebufferAttachment *Framebuffer::getDepthbuffer() const
{
- return mDepthbufferPointer.get();
+ return mDepthbuffer.get();
}
-Renderbuffer *Framebuffer::getStencilbuffer() const
+FramebufferAttachment *Framebuffer::getStencilbuffer() const
{
- return mStencilbufferPointer.get();
+ return mStencilbuffer.get();
}
-Renderbuffer *Framebuffer::getDepthOrStencilbuffer() const
+FramebufferAttachment *Framebuffer::getDepthStencilBuffer() const
{
- Renderbuffer *depthstencilbuffer = mDepthbufferPointer.get();
+ return (mDepthbuffer.id() == mStencilbuffer.id()) ? mDepthbuffer.get() : NULL;
+}
+
+FramebufferAttachment *Framebuffer::getDepthOrStencilbuffer() const
+{
+ FramebufferAttachment *depthstencilbuffer = mDepthbuffer.get();
if (!depthstencilbuffer)
{
- depthstencilbuffer = mStencilbufferPointer.get();
+ depthstencilbuffer = mStencilbuffer.get();
}
return depthstencilbuffer;
}
-Renderbuffer *Framebuffer::getReadColorbuffer() const
+FramebufferAttachment *Framebuffer::getReadColorbuffer() const
{
// Will require more logic if glReadBuffers is supported
- return mColorbufferPointers[0].get();
+ return mColorbuffers[0].get();
}
GLenum Framebuffer::getReadColorbufferType() const
{
// Will require more logic if glReadBuffers is supported
- return mColorbufferTypes[0];
+ return mColorbuffers[0].type();
}
-Renderbuffer *Framebuffer::getFirstColorbuffer() const
+FramebufferAttachment *Framebuffer::getFirstColorbuffer() const
{
for (unsigned int colorAttachment = 0; colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
{
- if (mColorbufferTypes[colorAttachment] != GL_NONE)
+ if (mColorbuffers[colorAttachment].type() != GL_NONE)
{
- return mColorbufferPointers[colorAttachment].get();
+ return mColorbuffers[colorAttachment].get();
}
}
@@ -231,33 +314,85 @@ Renderbuffer *Framebuffer::getFirstColorbuffer() const
GLenum Framebuffer::getColorbufferType(unsigned int colorAttachment) const
{
ASSERT(colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS);
- return mColorbufferTypes[colorAttachment];
+ return mColorbuffers[colorAttachment].type();
}
GLenum Framebuffer::getDepthbufferType() const
{
- return mDepthbufferType;
+ return mDepthbuffer.type();
}
GLenum Framebuffer::getStencilbufferType() const
{
- return mStencilbufferType;
+ return mStencilbuffer.type();
+}
+
+GLenum Framebuffer::getDepthStencilbufferType() const
+{
+ return (mDepthbuffer.id() == mStencilbuffer.id()) ? mDepthbuffer.type() : GL_NONE;
}
GLuint Framebuffer::getColorbufferHandle(unsigned int colorAttachment) const
{
ASSERT(colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS);
- return mColorbufferPointers[colorAttachment].id();
+ return mColorbuffers[colorAttachment].id();
}
GLuint Framebuffer::getDepthbufferHandle() const
{
- return mDepthbufferPointer.id();
+ return mDepthbuffer.id();
}
GLuint Framebuffer::getStencilbufferHandle() const
{
- return mStencilbufferPointer.id();
+ return mStencilbuffer.id();
+}
+
+GLenum Framebuffer::getDepthStencilbufferHandle() const
+{
+ return (mDepthbuffer.id() == mStencilbuffer.id()) ? mDepthbuffer.id() : 0;
+}
+
+GLenum Framebuffer::getColorbufferMipLevel(unsigned int colorAttachment) const
+{
+ ASSERT(colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS);
+ return mColorbuffers[colorAttachment].mipLevel();
+}
+
+GLenum Framebuffer::getDepthbufferMipLevel() const
+{
+ return mDepthbuffer.mipLevel();
+}
+
+GLenum Framebuffer::getStencilbufferMipLevel() const
+{
+ return mStencilbuffer.mipLevel();
+}
+
+GLenum Framebuffer::getDepthStencilbufferMipLevel() const
+{
+ return (mDepthbuffer.id() == mStencilbuffer.id()) ? mDepthbuffer.mipLevel() : 0;
+}
+
+GLenum Framebuffer::getColorbufferLayer(unsigned int colorAttachment) const
+{
+ ASSERT(colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS);
+ return mColorbuffers[colorAttachment].layer();
+}
+
+GLenum Framebuffer::getDepthbufferLayer() const
+{
+ return mDepthbuffer.layer();
+}
+
+GLenum Framebuffer::getStencilbufferLayer() const
+{
+ return mStencilbuffer.layer();
+}
+
+GLenum Framebuffer::getDepthStencilbufferLayer() const
+{
+ return (mDepthbuffer.id() == mStencilbuffer.id()) ? mDepthbuffer.layer() : 0;
}
GLenum Framebuffer::getDrawBufferState(unsigned int colorAttachment) const
@@ -272,7 +407,7 @@ void Framebuffer::setDrawBufferState(unsigned int colorAttachment, GLenum drawBu
bool Framebuffer::isEnabledColorAttachment(unsigned int colorAttachment) const
{
- return (mColorbufferTypes[colorAttachment] != GL_NONE && mDrawBufferStates[colorAttachment] != GL_NONE);
+ return (mColorbuffers[colorAttachment].type() != GL_NONE && mDrawBufferStates[colorAttachment] != GL_NONE);
}
bool Framebuffer::hasEnabledColorAttachment() const
@@ -290,9 +425,9 @@ bool Framebuffer::hasEnabledColorAttachment() const
bool Framebuffer::hasStencil() const
{
- if (mStencilbufferType != GL_NONE)
+ if (mStencilbuffer.type() != GL_NONE)
{
- const Renderbuffer *stencilbufferObject = getStencilbuffer();
+ const FramebufferAttachment *stencilbufferObject = getStencilbuffer();
if (stencilbufferObject)
{
@@ -320,15 +455,16 @@ GLenum Framebuffer::completeness() const
{
int width = 0;
int height = 0;
- int colorbufferSize = 0;
+ unsigned int colorbufferSize = 0;
int samples = -1;
bool missingAttachment = true;
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
for (unsigned int colorAttachment = 0; colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
{
- if (mColorbufferTypes[colorAttachment] != GL_NONE)
+ if (mColorbuffers[colorAttachment].type() != GL_NONE)
{
- const Renderbuffer *colorbuffer = getColorbuffer(colorAttachment);
+ const FramebufferAttachment *colorbuffer = getColorbuffer(colorAttachment);
if (!colorbuffer)
{
@@ -340,35 +476,24 @@ GLenum Framebuffer::completeness() const
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
- if (mColorbufferTypes[colorAttachment] == GL_RENDERBUFFER)
+ if (mColorbuffers[colorAttachment].type() == GL_RENDERBUFFER)
{
- if (!gl::IsColorRenderable(colorbuffer->getInternalFormat()))
+ if (!gl::IsColorRenderingSupported(colorbuffer->getInternalFormat(), mRenderer))
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
}
- else if (IsInternalTextureTarget(mColorbufferTypes[colorAttachment]))
+ else if (IsInternalTextureTarget(mColorbuffers[colorAttachment].type(), mRenderer->getCurrentClientVersion()))
{
- GLint internalformat = colorbuffer->getInternalFormat();
- GLenum format = gl::ExtractFormat(internalformat);
+ GLenum internalformat = colorbuffer->getInternalFormat();
- if (IsCompressed(format) ||
- format == GL_ALPHA ||
- format == GL_LUMINANCE ||
- format == GL_LUMINANCE_ALPHA)
+ if (!gl::IsColorRenderingSupported(internalformat, mRenderer))
{
return GL_FRAMEBUFFER_UNSUPPORTED;
}
- bool filtering, renderable;
-
- if ((gl::IsFloat32Format(internalformat) && !mRenderer->getFloat32TextureSupport(&filtering, &renderable)) ||
- (gl::IsFloat16Format(internalformat) && !mRenderer->getFloat16TextureSupport(&filtering, &renderable)))
- {
- return GL_FRAMEBUFFER_UNSUPPORTED;
- }
-
- if (gl::IsDepthTexture(internalformat) || gl::IsStencilTexture(internalformat))
+ if (gl::GetDepthBits(internalformat, clientVersion) > 0 ||
+ gl::GetStencilBits(internalformat, clientVersion) > 0)
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
@@ -394,16 +519,20 @@ GLenum Framebuffer::completeness() const
return GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT;
}
- // all color attachments attachments must have the same number of bitplanes
- if (gl::ComputePixelSize(colorbuffer->getInternalFormat()) != colorbufferSize)
+ // in GLES 2.0, all color attachments attachments must have the same number of bitplanes
+ // in GLES 3.0, there is no such restriction
+ if (clientVersion < 3)
{
- return GL_FRAMEBUFFER_UNSUPPORTED;
+ if (gl::GetPixelBytes(colorbuffer->getInternalFormat(), clientVersion) != colorbufferSize)
+ {
+ return GL_FRAMEBUFFER_UNSUPPORTED;
+ }
}
// D3D11 does not allow for overlapping RenderTargetViews, so ensure uniqueness
for (unsigned int previousColorAttachment = 0; previousColorAttachment < colorAttachment; previousColorAttachment++)
{
- if (mColorbufferPointers[colorAttachment].get() == mColorbufferPointers[previousColorAttachment].get())
+ if (mColorbuffers[colorAttachment].get() == mColorbuffers[previousColorAttachment].get())
{
return GL_FRAMEBUFFER_UNSUPPORTED;
}
@@ -414,16 +543,16 @@ GLenum Framebuffer::completeness() const
width = colorbuffer->getWidth();
height = colorbuffer->getHeight();
samples = colorbuffer->getSamples();
- colorbufferSize = gl::ComputePixelSize(colorbuffer->getInternalFormat());
+ colorbufferSize = gl::GetPixelBytes(colorbuffer->getInternalFormat(), clientVersion);
missingAttachment = false;
}
}
}
- const Renderbuffer *depthbuffer = NULL;
- const Renderbuffer *stencilbuffer = NULL;
+ const FramebufferAttachment *depthbuffer = NULL;
+ const FramebufferAttachment *stencilbuffer = NULL;
- if (mDepthbufferType != GL_NONE)
+ if (mDepthbuffer.type() != GL_NONE)
{
depthbuffer = getDepthbuffer();
@@ -437,16 +566,16 @@ GLenum Framebuffer::completeness() const
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
- if (mDepthbufferType == GL_RENDERBUFFER)
+ if (mDepthbuffer.type() == GL_RENDERBUFFER)
{
- if (!gl::IsDepthRenderable(depthbuffer->getInternalFormat()))
+ if (!gl::IsDepthRenderingSupported(depthbuffer->getInternalFormat(), mRenderer))
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
}
- else if (IsInternalTextureTarget(mDepthbufferType))
+ else if (IsInternalTextureTarget(mDepthbuffer.type(), mRenderer->getCurrentClientVersion()))
{
- GLint internalformat = depthbuffer->getInternalFormat();
+ GLenum internalformat = depthbuffer->getInternalFormat();
// depth texture attachments require OES/ANGLE_depth_texture
if (!mRenderer->getDepthTextureSupport())
@@ -454,7 +583,7 @@ GLenum Framebuffer::completeness() const
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
- if (!gl::IsDepthTexture(internalformat))
+ if (gl::GetDepthBits(internalformat, clientVersion) == 0)
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
@@ -482,7 +611,7 @@ GLenum Framebuffer::completeness() const
}
}
- if (mStencilbufferType != GL_NONE)
+ if (mStencilbuffer.type() != GL_NONE)
{
stencilbuffer = getStencilbuffer();
@@ -496,16 +625,16 @@ GLenum Framebuffer::completeness() const
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
- if (mStencilbufferType == GL_RENDERBUFFER)
+ if (mStencilbuffer.type() == GL_RENDERBUFFER)
{
- if (!gl::IsStencilRenderable(stencilbuffer->getInternalFormat()))
+ if (!gl::IsStencilRenderingSupported(stencilbuffer->getInternalFormat(), mRenderer))
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
}
- else if (IsInternalTextureTarget(mStencilbufferType))
+ else if (IsInternalTextureTarget(mStencilbuffer.type(), mRenderer->getCurrentClientVersion()))
{
- GLint internalformat = stencilbuffer->getInternalFormat();
+ GLenum internalformat = stencilbuffer->getInternalFormat();
// texture stencil attachments come along as part
// of OES_packed_depth_stencil + OES/ANGLE_depth_texture
@@ -514,7 +643,7 @@ GLenum Framebuffer::completeness() const
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
- if (!gl::IsStencilTexture(internalformat))
+ if (gl::GetStencilBits(internalformat, clientVersion) == 0)
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
@@ -561,15 +690,11 @@ GLenum Framebuffer::completeness() const
DefaultFramebuffer::DefaultFramebuffer(rx::Renderer *renderer, Colorbuffer *colorbuffer, DepthStencilbuffer *depthStencil)
: Framebuffer(renderer)
{
- mColorbufferPointers[0].set(new Renderbuffer(mRenderer, 0, colorbuffer));
-
- Renderbuffer *depthStencilRenderbuffer = new Renderbuffer(mRenderer, 0, depthStencil);
- mDepthbufferPointer.set(depthStencilRenderbuffer);
- mStencilbufferPointer.set(depthStencilRenderbuffer);
+ mColorbuffers[0].set(new FramebufferAttachment(mRenderer, 0, colorbuffer), GL_RENDERBUFFER, 0, 0);
- mColorbufferTypes[0] = GL_RENDERBUFFER;
- mDepthbufferType = (depthStencilRenderbuffer->getDepthSize() != 0) ? GL_RENDERBUFFER : GL_NONE;
- mStencilbufferType = (depthStencilRenderbuffer->getStencilSize() != 0) ? GL_RENDERBUFFER : GL_NONE;
+ FramebufferAttachment *depthStencilRenderbuffer = new FramebufferAttachment(mRenderer, 0, depthStencil);
+ mDepthbuffer.set(depthStencilRenderbuffer, (depthStencilRenderbuffer->getDepthSize() != 0) ? GL_RENDERBUFFER : GL_NONE, 0, 0);
+ mStencilbuffer.set(depthStencilRenderbuffer, (depthStencilRenderbuffer->getStencilSize() != 0) ? GL_RENDERBUFFER : GL_NONE, 0, 0);
mDrawBufferStates[0] = GL_BACK;
mReadBufferState = GL_BACK;
@@ -583,7 +708,7 @@ int Framebuffer::getSamples() const
// in this case return the first nonzero sample size
for (unsigned int colorAttachment = 0; colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
{
- if (mColorbufferTypes[colorAttachment] != GL_NONE)
+ if (mColorbuffers[colorAttachment].type() != GL_NONE)
{
return getColorbuffer(colorAttachment)->getSamples();
}
diff --git a/chromium/third_party/angle/src/libGLESv2/Framebuffer.h b/chromium/third_party/angle/src/libGLESv2/Framebuffer.h
index 50bfd4fd0f8..1a5e2b6801c 100644
--- a/chromium/third_party/angle/src/libGLESv2/Framebuffer.h
+++ b/chromium/third_party/angle/src/libGLESv2/Framebuffer.h
@@ -12,7 +12,7 @@
#include "common/angleutils.h"
#include "common/RefCountObject.h"
-#include "Constants.h"
+#include "constants.h"
namespace rx
{
@@ -21,7 +21,7 @@ class Renderer;
namespace gl
{
-class Renderbuffer;
+class FramebufferAttachment;
class Colorbuffer;
class Depthbuffer;
class Stencilbuffer;
@@ -34,9 +34,10 @@ class Framebuffer
virtual ~Framebuffer();
- void setColorbuffer(unsigned int colorAttachment, GLenum type, GLuint colorbuffer);
- void setDepthbuffer(GLenum type, GLuint depthbuffer);
- void setStencilbuffer(GLenum type, GLuint stencilbuffer);
+ void setColorbuffer(unsigned int colorAttachment, GLenum type, GLuint colorbuffer, GLint level, GLint layer);
+ void setDepthbuffer(GLenum type, GLuint depthbuffer, GLint level, GLint layer);
+ void setStencilbuffer(GLenum type, GLuint stencilbuffer, GLint level, GLint layer);
+ void setDepthStencilBuffer(GLenum type, GLuint depthStencilBuffer, GLint level, GLint layer);
void detachTexture(GLuint texture);
void detachRenderbuffer(GLuint renderbuffer);
@@ -45,21 +46,34 @@ class Framebuffer
unsigned int getDepthbufferSerial() const;
unsigned int getStencilbufferSerial() const;
- Renderbuffer *getColorbuffer(unsigned int colorAttachment) const;
- Renderbuffer *getDepthbuffer() const;
- Renderbuffer *getStencilbuffer() const;
- Renderbuffer *getDepthOrStencilbuffer() const;
- Renderbuffer *getReadColorbuffer() const;
+ FramebufferAttachment *getColorbuffer(unsigned int colorAttachment) const;
+ FramebufferAttachment *getDepthbuffer() const;
+ FramebufferAttachment *getStencilbuffer() const;
+ FramebufferAttachment *getDepthStencilBuffer() const;
+ FramebufferAttachment *getDepthOrStencilbuffer() const;
+ FramebufferAttachment *getReadColorbuffer() const;
GLenum getReadColorbufferType() const;
- Renderbuffer *getFirstColorbuffer() const;
+ FramebufferAttachment *getFirstColorbuffer() const;
GLenum getColorbufferType(unsigned int colorAttachment) const;
GLenum getDepthbufferType() const;
GLenum getStencilbufferType() const;
+ GLenum getDepthStencilbufferType() const;
GLuint getColorbufferHandle(unsigned int colorAttachment) const;
GLuint getDepthbufferHandle() const;
GLuint getStencilbufferHandle() const;
+ GLenum getDepthStencilbufferHandle() const;
+
+ GLenum getColorbufferMipLevel(unsigned int colorAttachment) const;
+ GLenum getDepthbufferMipLevel() const;
+ GLenum getStencilbufferMipLevel() const;
+ GLenum getDepthStencilbufferMipLevel() const;
+
+ GLenum getColorbufferLayer(unsigned int colorAttachment) const;
+ GLenum getDepthbufferLayer() const;
+ GLenum getStencilbufferLayer() const;
+ GLenum getDepthStencilbufferLayer() const;
GLenum getDrawBufferState(unsigned int colorAttachment) const;
void setDrawBufferState(unsigned int colorAttachment, GLenum drawBuffer);
@@ -73,23 +87,19 @@ class Framebuffer
virtual GLenum completeness() const;
protected:
- GLenum mColorbufferTypes[IMPLEMENTATION_MAX_DRAW_BUFFERS];
- BindingPointer<Renderbuffer> mColorbufferPointers[IMPLEMENTATION_MAX_DRAW_BUFFERS];
+ FramebufferTextureBindingPointer<FramebufferAttachment> mColorbuffers[IMPLEMENTATION_MAX_DRAW_BUFFERS];
GLenum mDrawBufferStates[IMPLEMENTATION_MAX_DRAW_BUFFERS];
GLenum mReadBufferState;
- GLenum mDepthbufferType;
- BindingPointer<Renderbuffer> mDepthbufferPointer;
-
- GLenum mStencilbufferType;
- BindingPointer<Renderbuffer> mStencilbufferPointer;
+ FramebufferTextureBindingPointer<FramebufferAttachment> mDepthbuffer;
+ FramebufferTextureBindingPointer<FramebufferAttachment> mStencilbuffer;
rx::Renderer *mRenderer;
private:
DISALLOW_COPY_AND_ASSIGN(Framebuffer);
- Renderbuffer *lookupRenderbuffer(GLenum type, GLuint handle) const;
+ FramebufferAttachment *lookupAttachment(GLenum type, GLuint handle, GLint level, GLint layer) const;
};
class DefaultFramebuffer : public Framebuffer
diff --git a/chromium/third_party/angle/src/libGLESv2/FramebufferAttachment.cpp b/chromium/third_party/angle/src/libGLESv2/FramebufferAttachment.cpp
new file mode 100644
index 00000000000..574ce7ee912
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/FramebufferAttachment.cpp
@@ -0,0 +1,491 @@
+#include "precompiled.h"
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// FramebufferAttachment.cpp: the gl::FramebufferAttachment class and its derived classes
+// objects and related functionality. [OpenGL ES 2.0.24] section 4.4.3 page 108.
+
+#include "libGLESv2/FramebufferAttachment.h"
+#include "libGLESv2/renderer/RenderTarget.h"
+
+#include "libGLESv2/Texture.h"
+#include "libGLESv2/renderer/Renderer.h"
+#include "libGLESv2/renderer/TextureStorage.h"
+#include "common/utilities.h"
+#include "libGLESv2/formatutils.h"
+#include "libGLESv2/Renderbuffer.h"
+
+namespace gl
+{
+
+FramebufferAttachmentInterface::FramebufferAttachmentInterface()
+{
+}
+
+// The default case for classes inherited from FramebufferAttachmentInterface is not to
+// need to do anything upon the reference count to the parent FramebufferAttachment incrementing
+// or decrementing.
+void FramebufferAttachmentInterface::addProxyRef(const FramebufferAttachment *proxy)
+{
+}
+
+void FramebufferAttachmentInterface::releaseProxy(const FramebufferAttachment *proxy)
+{
+}
+
+///// Texture2DAttachment Implementation ////////
+
+Texture2DAttachment::Texture2DAttachment(Texture2D *texture, GLint level) : mLevel(level)
+{
+ mTexture2D.set(texture);
+}
+
+Texture2DAttachment::~Texture2DAttachment()
+{
+ mTexture2D.set(NULL);
+}
+
+// Textures need to maintain their own reference count for references via
+// Renderbuffers acting as proxies. Here, we notify the texture of a reference.
+void Texture2DAttachment::addProxyRef(const FramebufferAttachment *proxy)
+{
+ mTexture2D->addProxyRef(proxy);
+}
+
+void Texture2DAttachment::releaseProxy(const FramebufferAttachment *proxy)
+{
+ mTexture2D->releaseProxy(proxy);
+}
+
+rx::RenderTarget *Texture2DAttachment::getRenderTarget()
+{
+ return mTexture2D->getRenderTarget(mLevel);
+}
+
+rx::RenderTarget *Texture2DAttachment::getDepthStencil()
+{
+ return mTexture2D->getDepthSencil(mLevel);
+}
+
+rx::TextureStorage *Texture2DAttachment::getTextureStorage()
+{
+ return mTexture2D->getNativeTexture()->getStorageInstance();
+}
+
+GLsizei Texture2DAttachment::getWidth() const
+{
+ return mTexture2D->getWidth(mLevel);
+}
+
+GLsizei Texture2DAttachment::getHeight() const
+{
+ return mTexture2D->getHeight(mLevel);
+}
+
+GLenum Texture2DAttachment::getInternalFormat() const
+{
+ return mTexture2D->getInternalFormat(mLevel);
+}
+
+GLenum Texture2DAttachment::getActualFormat() const
+{
+ return mTexture2D->getActualFormat(mLevel);
+}
+
+GLsizei Texture2DAttachment::getSamples() const
+{
+ return 0;
+}
+
+unsigned int Texture2DAttachment::getSerial() const
+{
+ return mTexture2D->getRenderTargetSerial(mLevel);
+}
+
+bool Texture2DAttachment::isTexture() const
+{
+ return true;
+}
+
+unsigned int Texture2DAttachment::getTextureSerial() const
+{
+ return mTexture2D->getTextureSerial();
+}
+
+///// TextureCubeMapAttachment Implementation ////////
+
+TextureCubeMapAttachment::TextureCubeMapAttachment(TextureCubeMap *texture, GLenum faceTarget, GLint level)
+ : mFaceTarget(faceTarget), mLevel(level)
+{
+ mTextureCubeMap.set(texture);
+}
+
+TextureCubeMapAttachment::~TextureCubeMapAttachment()
+{
+ mTextureCubeMap.set(NULL);
+}
+
+// Textures need to maintain their own reference count for references via
+// Renderbuffers acting as proxies. Here, we notify the texture of a reference.
+void TextureCubeMapAttachment::addProxyRef(const FramebufferAttachment *proxy)
+{
+ mTextureCubeMap->addProxyRef(proxy);
+}
+
+void TextureCubeMapAttachment::releaseProxy(const FramebufferAttachment *proxy)
+{
+ mTextureCubeMap->releaseProxy(proxy);
+}
+
+rx::RenderTarget *TextureCubeMapAttachment::getRenderTarget()
+{
+ return mTextureCubeMap->getRenderTarget(mFaceTarget, mLevel);
+}
+
+rx::RenderTarget *TextureCubeMapAttachment::getDepthStencil()
+{
+ return mTextureCubeMap->getDepthStencil(mFaceTarget, mLevel);
+}
+
+rx::TextureStorage *TextureCubeMapAttachment::getTextureStorage()
+{
+ return mTextureCubeMap->getNativeTexture()->getStorageInstance();
+}
+
+GLsizei TextureCubeMapAttachment::getWidth() const
+{
+ return mTextureCubeMap->getWidth(mFaceTarget, mLevel);
+}
+
+GLsizei TextureCubeMapAttachment::getHeight() const
+{
+ return mTextureCubeMap->getHeight(mFaceTarget, mLevel);
+}
+
+GLenum TextureCubeMapAttachment::getInternalFormat() const
+{
+ return mTextureCubeMap->getInternalFormat(mFaceTarget, mLevel);
+}
+
+GLenum TextureCubeMapAttachment::getActualFormat() const
+{
+ return mTextureCubeMap->getActualFormat(mFaceTarget, mLevel);
+}
+
+GLsizei TextureCubeMapAttachment::getSamples() const
+{
+ return 0;
+}
+
+unsigned int TextureCubeMapAttachment::getSerial() const
+{
+ return mTextureCubeMap->getRenderTargetSerial(mFaceTarget, mLevel);
+}
+
+bool TextureCubeMapAttachment::isTexture() const
+{
+ return true;
+}
+
+unsigned int TextureCubeMapAttachment::getTextureSerial() const
+{
+ return mTextureCubeMap->getTextureSerial();
+}
+
+///// Texture3DAttachment Implementation ////////
+
+Texture3DAttachment::Texture3DAttachment(Texture3D *texture, GLint level, GLint layer)
+ : mLevel(level), mLayer(layer)
+{
+ mTexture3D.set(texture);
+}
+
+Texture3DAttachment::~Texture3DAttachment()
+{
+ mTexture3D.set(NULL);
+}
+
+// Textures need to maintain their own reference count for references via
+// Renderbuffers acting as proxies. Here, we notify the texture of a reference.
+void Texture3DAttachment::addProxyRef(const FramebufferAttachment *proxy)
+{
+ mTexture3D->addProxyRef(proxy);
+}
+
+void Texture3DAttachment::releaseProxy(const FramebufferAttachment *proxy)
+{
+ mTexture3D->releaseProxy(proxy);
+}
+
+rx::RenderTarget *Texture3DAttachment::getRenderTarget()
+{
+ return mTexture3D->getRenderTarget(mLevel, mLayer);
+}
+
+rx::RenderTarget *Texture3DAttachment::getDepthStencil()
+{
+ return mTexture3D->getDepthStencil(mLevel, mLayer);
+}
+
+rx::TextureStorage *Texture3DAttachment::getTextureStorage()
+{
+ return mTexture3D->getNativeTexture()->getStorageInstance();
+}
+
+GLsizei Texture3DAttachment::getWidth() const
+{
+ return mTexture3D->getWidth(mLevel);
+}
+
+GLsizei Texture3DAttachment::getHeight() const
+{
+ return mTexture3D->getHeight(mLevel);
+}
+
+GLenum Texture3DAttachment::getInternalFormat() const
+{
+ return mTexture3D->getInternalFormat(mLevel);
+}
+
+GLenum Texture3DAttachment::getActualFormat() const
+{
+ return mTexture3D->getActualFormat(mLevel);
+}
+
+GLsizei Texture3DAttachment::getSamples() const
+{
+ return 0;
+}
+
+unsigned int Texture3DAttachment::getSerial() const
+{
+ return mTexture3D->getRenderTargetSerial(mLevel, mLayer);
+}
+
+bool Texture3DAttachment::isTexture() const
+{
+ return true;
+}
+
+unsigned int Texture3DAttachment::getTextureSerial() const
+{
+ return mTexture3D->getTextureSerial();
+}
+
+////// Texture2DArrayAttachment Implementation //////
+
+Texture2DArrayAttachment::Texture2DArrayAttachment(Texture2DArray *texture, GLint level, GLint layer)
+ : mLevel(level), mLayer(layer)
+{
+ mTexture2DArray.set(texture);
+}
+
+Texture2DArrayAttachment::~Texture2DArrayAttachment()
+{
+ mTexture2DArray.set(NULL);
+}
+
+void Texture2DArrayAttachment::addProxyRef(const FramebufferAttachment *proxy)
+{
+ mTexture2DArray->addProxyRef(proxy);
+}
+
+void Texture2DArrayAttachment::releaseProxy(const FramebufferAttachment *proxy)
+{
+ mTexture2DArray->releaseProxy(proxy);
+}
+
+rx::RenderTarget *Texture2DArrayAttachment::getRenderTarget()
+{
+ return mTexture2DArray->getRenderTarget(mLevel, mLayer);
+}
+
+rx::RenderTarget *Texture2DArrayAttachment::getDepthStencil()
+{
+ return mTexture2DArray->getDepthStencil(mLevel, mLayer);
+}
+
+rx::TextureStorage *Texture2DArrayAttachment::getTextureStorage()
+{
+ return mTexture2DArray->getNativeTexture()->getStorageInstance();
+}
+
+GLsizei Texture2DArrayAttachment::getWidth() const
+{
+ return mTexture2DArray->getWidth(mLevel);
+}
+
+GLsizei Texture2DArrayAttachment::getHeight() const
+{
+ return mTexture2DArray->getHeight(mLevel);
+}
+
+GLenum Texture2DArrayAttachment::getInternalFormat() const
+{
+ return mTexture2DArray->getInternalFormat(mLevel);
+}
+
+GLenum Texture2DArrayAttachment::getActualFormat() const
+{
+ return mTexture2DArray->getActualFormat(mLevel);
+}
+
+GLsizei Texture2DArrayAttachment::getSamples() const
+{
+ return 0;
+}
+
+unsigned int Texture2DArrayAttachment::getSerial() const
+{
+ return mTexture2DArray->getRenderTargetSerial(mLevel, mLayer);
+}
+
+bool Texture2DArrayAttachment::isTexture() const
+{
+ return true;
+}
+
+unsigned int Texture2DArrayAttachment::getTextureSerial() const
+{
+ return mTexture2DArray->getTextureSerial();
+}
+
+////// FramebufferAttachment Implementation //////
+
+FramebufferAttachment::FramebufferAttachment(rx::Renderer *renderer, GLuint id, FramebufferAttachmentInterface *instance) : RefCountObject(id)
+{
+ ASSERT(instance != NULL);
+ mInstance = instance;
+
+ ASSERT(renderer != NULL);
+ mRenderer = renderer;
+}
+
+FramebufferAttachment::~FramebufferAttachment()
+{
+ delete mInstance;
+}
+
+// The FramebufferAttachmentInterface contained in this FramebufferAttachment may need to maintain
+// its own reference count, so we pass it on here.
+void FramebufferAttachment::addRef() const
+{
+ mInstance->addProxyRef(this);
+
+ RefCountObject::addRef();
+}
+
+void FramebufferAttachment::release() const
+{
+ mInstance->releaseProxy(this);
+
+ RefCountObject::release();
+}
+
+rx::RenderTarget *FramebufferAttachment::getRenderTarget()
+{
+ return mInstance->getRenderTarget();
+}
+
+rx::RenderTarget *FramebufferAttachment::getDepthStencil()
+{
+ return mInstance->getDepthStencil();
+}
+
+rx::TextureStorage *FramebufferAttachment::getTextureStorage()
+{
+ return mInstance->getTextureStorage();
+}
+
+GLsizei FramebufferAttachment::getWidth() const
+{
+ return mInstance->getWidth();
+}
+
+GLsizei FramebufferAttachment::getHeight() const
+{
+ return mInstance->getHeight();
+}
+
+GLenum FramebufferAttachment::getInternalFormat() const
+{
+ return mInstance->getInternalFormat();
+}
+
+GLenum FramebufferAttachment::getActualFormat() const
+{
+ return mInstance->getActualFormat();
+}
+
+GLuint FramebufferAttachment::getRedSize() const
+{
+ return gl::GetRedBits(getActualFormat(), mRenderer->getCurrentClientVersion());
+}
+
+GLuint FramebufferAttachment::getGreenSize() const
+{
+ return gl::GetGreenBits(getActualFormat(), mRenderer->getCurrentClientVersion());
+}
+
+GLuint FramebufferAttachment::getBlueSize() const
+{
+ return gl::GetBlueBits(getActualFormat(), mRenderer->getCurrentClientVersion());
+}
+
+GLuint FramebufferAttachment::getAlphaSize() const
+{
+ return gl::GetAlphaBits(getActualFormat(), mRenderer->getCurrentClientVersion());
+}
+
+GLuint FramebufferAttachment::getDepthSize() const
+{
+ return gl::GetDepthBits(getActualFormat(), mRenderer->getCurrentClientVersion());
+}
+
+GLuint FramebufferAttachment::getStencilSize() const
+{
+ return gl::GetStencilBits(getActualFormat(), mRenderer->getCurrentClientVersion());
+}
+
+GLenum FramebufferAttachment::getComponentType() const
+{
+ return gl::GetComponentType(getActualFormat(), mRenderer->getCurrentClientVersion());
+}
+
+GLenum FramebufferAttachment::getColorEncoding() const
+{
+ return gl::GetColorEncoding(getActualFormat(), mRenderer->getCurrentClientVersion());
+}
+
+GLsizei FramebufferAttachment::getSamples() const
+{
+ return mInstance->getSamples();
+}
+
+unsigned int FramebufferAttachment::getSerial() const
+{
+ return mInstance->getSerial();
+}
+
+bool FramebufferAttachment::isTexture() const
+{
+ return mInstance->isTexture();
+}
+
+unsigned int FramebufferAttachment::getTextureSerial() const
+{
+ return mInstance->getTextureSerial();
+}
+
+void FramebufferAttachment::setStorage(RenderbufferStorage *newStorage)
+{
+ ASSERT(newStorage != NULL);
+
+ delete mInstance;
+ mInstance = newStorage;
+}
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/FramebufferAttachment.h b/chromium/third_party/angle/src/libGLESv2/FramebufferAttachment.h
new file mode 100644
index 00000000000..9ba63cc3aac
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/FramebufferAttachment.h
@@ -0,0 +1,247 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// FramebufferAttachment.h: Defines the wrapper class gl::FramebufferAttachment, as well as the
+// objects and related functionality. [OpenGL ES 2.0.24] section 4.4.3 page 108.
+
+#ifndef LIBGLESV2_FRAMEBUFFERATTACHMENT_H_
+#define LIBGLESV2_FRAMEBUFFERATTACHMENT_H_
+
+#include <GLES3/gl3.h>
+#include <GLES2/gl2.h>
+
+#include "common/angleutils.h"
+#include "common/RefCountObject.h"
+
+namespace rx
+{
+class Renderer;
+class RenderTarget;
+class TextureStorage;
+}
+
+namespace gl
+{
+class Texture2D;
+class TextureCubeMap;
+class Texture3D;
+class Texture2DArray;
+class FramebufferAttachment;
+class FramebufferAttachmentInterface;
+class RenderbufferStorage;
+
+// FramebufferAttachment implements the GL renderbuffer object.
+// It's only a proxy for a FramebufferAttachmentInterface instance; the internal object
+// can change whenever glRenderbufferStorage is called.
+class FramebufferAttachment : public RefCountObject
+{
+ public:
+ FramebufferAttachment(rx::Renderer *renderer, GLuint id, FramebufferAttachmentInterface *storage);
+
+ virtual ~FramebufferAttachment();
+
+ // These functions from RefCountObject are overloaded here because
+ // Textures need to maintain their own count of references to them via
+ // Renderbuffers/RenderbufferTextures. These functions invoke those
+ // reference counting functions on the FramebufferAttachmentInterface.
+ void addRef() const;
+ void release() const;
+
+ rx::RenderTarget *getRenderTarget();
+ rx::RenderTarget *getDepthStencil();
+ rx::TextureStorage *getTextureStorage();
+
+ GLsizei getWidth() const;
+ GLsizei getHeight() const;
+ GLenum getInternalFormat() const;
+ GLenum getActualFormat() const;
+ GLuint getRedSize() const;
+ GLuint getGreenSize() const;
+ GLuint getBlueSize() const;
+ GLuint getAlphaSize() const;
+ GLuint getDepthSize() const;
+ GLuint getStencilSize() const;
+ GLenum getComponentType() const;
+ GLenum getColorEncoding() const;
+ GLsizei getSamples() const;
+
+ unsigned int getSerial() const;
+
+ bool isTexture() const;
+ unsigned int getTextureSerial() const;
+
+ void setStorage(RenderbufferStorage *newStorage);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(FramebufferAttachment);
+
+ rx::Renderer const *mRenderer;
+ FramebufferAttachmentInterface *mInstance;
+};
+
+class FramebufferAttachmentInterface
+{
+ public:
+ FramebufferAttachmentInterface();
+
+ virtual ~FramebufferAttachmentInterface() {};
+
+ virtual void addProxyRef(const FramebufferAttachment *proxy);
+ virtual void releaseProxy(const FramebufferAttachment *proxy);
+
+ virtual rx::RenderTarget *getRenderTarget() = 0;
+ virtual rx::RenderTarget *getDepthStencil() = 0;
+ virtual rx::TextureStorage *getTextureStorage() = 0;
+
+ virtual GLsizei getWidth() const = 0;
+ virtual GLsizei getHeight() const = 0;
+ virtual GLenum getInternalFormat() const = 0;
+ virtual GLenum getActualFormat() const = 0;
+ virtual GLsizei getSamples() const = 0;
+
+ virtual unsigned int getSerial() const = 0;
+
+ virtual bool isTexture() const = 0;
+ virtual unsigned int getTextureSerial() const = 0;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(FramebufferAttachmentInterface);
+};
+
+class Texture2DAttachment : public FramebufferAttachmentInterface
+{
+ public:
+ Texture2DAttachment(Texture2D *texture, GLint level);
+
+ virtual ~Texture2DAttachment();
+
+ void addProxyRef(const FramebufferAttachment *proxy);
+ void releaseProxy(const FramebufferAttachment *proxy);
+
+ rx::RenderTarget *getRenderTarget();
+ rx::RenderTarget *getDepthStencil();
+ rx::TextureStorage *getTextureStorage();
+
+ virtual GLsizei getWidth() const;
+ virtual GLsizei getHeight() const;
+ virtual GLenum getInternalFormat() const;
+ virtual GLenum getActualFormat() const;
+ virtual GLsizei getSamples() const;
+
+ virtual unsigned int getSerial() const;
+
+ virtual bool isTexture() const;
+ virtual unsigned int getTextureSerial() const;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Texture2DAttachment);
+
+ BindingPointer <Texture2D> mTexture2D;
+ const GLint mLevel;
+};
+
+class TextureCubeMapAttachment : public FramebufferAttachmentInterface
+{
+ public:
+ TextureCubeMapAttachment(TextureCubeMap *texture, GLenum faceTarget, GLint level);
+
+ virtual ~TextureCubeMapAttachment();
+
+ void addProxyRef(const FramebufferAttachment *proxy);
+ void releaseProxy(const FramebufferAttachment *proxy);
+
+ rx::RenderTarget *getRenderTarget();
+ rx::RenderTarget *getDepthStencil();
+ rx::TextureStorage *getTextureStorage();
+
+ virtual GLsizei getWidth() const;
+ virtual GLsizei getHeight() const;
+ virtual GLenum getInternalFormat() const;
+ virtual GLenum getActualFormat() const;
+ virtual GLsizei getSamples() const;
+
+ virtual unsigned int getSerial() const;
+
+ virtual bool isTexture() const;
+ virtual unsigned int getTextureSerial() const;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TextureCubeMapAttachment);
+
+ BindingPointer <TextureCubeMap> mTextureCubeMap;
+ const GLint mLevel;
+ const GLenum mFaceTarget;
+};
+
+class Texture3DAttachment : public FramebufferAttachmentInterface
+{
+ public:
+ Texture3DAttachment(Texture3D *texture, GLint level, GLint layer);
+
+ virtual ~Texture3DAttachment();
+
+ void addProxyRef(const FramebufferAttachment *proxy);
+ void releaseProxy(const FramebufferAttachment *proxy);
+
+ rx::RenderTarget *getRenderTarget();
+ rx::RenderTarget *getDepthStencil();
+ rx::TextureStorage *getTextureStorage();
+
+ virtual GLsizei getWidth() const;
+ virtual GLsizei getHeight() const;
+ virtual GLenum getInternalFormat() const;
+ virtual GLenum getActualFormat() const;
+ virtual GLsizei getSamples() const;
+
+ virtual unsigned int getSerial() const;
+
+ virtual bool isTexture() const;
+ virtual unsigned int getTextureSerial() const;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Texture3DAttachment);
+
+ BindingPointer<Texture3D> mTexture3D;
+ const GLint mLevel;
+ const GLint mLayer;
+};
+
+class Texture2DArrayAttachment : public FramebufferAttachmentInterface
+{
+ public:
+ Texture2DArrayAttachment(Texture2DArray *texture, GLint level, GLint layer);
+
+ virtual ~Texture2DArrayAttachment();
+
+ void addProxyRef(const FramebufferAttachment *proxy);
+ void releaseProxy(const FramebufferAttachment *proxy);
+
+ rx::RenderTarget *getRenderTarget();
+ rx::RenderTarget *getDepthStencil();
+ rx::TextureStorage *getTextureStorage();
+
+ virtual GLsizei getWidth() const;
+ virtual GLsizei getHeight() const;
+ virtual GLenum getInternalFormat() const;
+ virtual GLenum getActualFormat() const;
+ virtual GLsizei getSamples() const;
+
+ virtual unsigned int getSerial() const;
+
+ virtual bool isTexture() const;
+ virtual unsigned int getTextureSerial() const;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Texture2DArrayAttachment);
+
+ BindingPointer<Texture2DArray> mTexture2DArray;
+ const GLint mLevel;
+ const GLint mLayer;
+};
+
+}
+
+#endif // LIBGLESV2_FRAMEBUFFERATTACHMENT_H_
diff --git a/chromium/third_party/angle/src/libGLESv2/HandleAllocator.h b/chromium/third_party/angle/src/libGLESv2/HandleAllocator.h
index a92e1684d4f..e23010d918b 100644
--- a/chromium/third_party/angle/src/libGLESv2/HandleAllocator.h
+++ b/chromium/third_party/angle/src/libGLESv2/HandleAllocator.h
@@ -10,7 +10,7 @@
#ifndef LIBGLESV2_HANDLEALLOCATOR_H_
#define LIBGLESV2_HANDLEALLOCATOR_H_
-#define GL_APICALL
+#include <GLES3/gl3.h>
#include <GLES2/gl2.h>
#include <vector>
diff --git a/chromium/third_party/angle/src/libGLESv2/Program.cpp b/chromium/third_party/angle/src/libGLESv2/Program.cpp
index c38aa5a61aa..8a9fb048007 100644
--- a/chromium/third_party/angle/src/libGLESv2/Program.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/Program.cpp
@@ -1,6 +1,6 @@
#include "precompiled.h"
//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -95,32 +95,36 @@ void InfoLog::append(const char *format, ...)
return;
}
- char info[1024];
-
va_list vararg;
va_start(vararg, format);
- vsnprintf(info, sizeof(info), format, vararg);
+ size_t infoLength = vsnprintf(NULL, 0, format, vararg);
va_end(vararg);
- size_t infoLength = strlen(info);
+ char *logPointer = NULL;
if (!mInfoLog)
{
mInfoLog = new char[infoLength + 2];
- strcpy(mInfoLog, info);
- strcpy(mInfoLog + infoLength, "\n");
+ logPointer = mInfoLog;
}
else
{
- size_t logLength = strlen(mInfoLog);
- char *newLog = new char[logLength + infoLength + 2];
+ size_t currentlogLength = strlen(mInfoLog);
+ char *newLog = new char[currentlogLength + infoLength + 2];
strcpy(newLog, mInfoLog);
- strcpy(newLog + logLength, info);
- strcpy(newLog + logLength + infoLength, "\n");
delete[] mInfoLog;
mInfoLog = newLog;
+
+ logPointer = mInfoLog + currentlogLength;
}
+
+ va_start(vararg, format);
+ vsnprintf(logPointer, infoLength, format, vararg);
+ va_end(vararg);
+
+ logPointer[infoLength] = 0;
+ strcpy(logPointer + infoLength, "\n");
}
void InfoLog::reset()
@@ -141,6 +145,8 @@ Program::Program(rx::Renderer *renderer, ResourceManager *manager, GLuint handle
mLinked = false;
mRefCount = 0;
mRenderer = renderer;
+
+ resetUniformBlockBindings();
}
Program::~Program()
@@ -243,9 +249,11 @@ bool Program::link()
unlink(false);
mInfoLog.reset();
+ resetUniformBlockBindings();
mProgramBinary.set(new ProgramBinary(mRenderer));
- mLinked = mProgramBinary->link(mInfoLog, mAttributeBindings, mFragmentShader, mVertexShader);
+ mLinked = mProgramBinary->link(mInfoLog, mAttributeBindings, mFragmentShader, mVertexShader,
+ mTransformFeedbackVaryings, mTransformFeedbackBufferMode);
return mLinked;
}
@@ -290,7 +298,7 @@ bool Program::isLinked()
return mLinked;
}
-ProgramBinary* Program::getProgramBinary()
+ProgramBinary* Program::getProgramBinary() const
{
return mProgramBinary.get();
}
@@ -522,4 +530,132 @@ bool Program::isValidated() const
}
}
+GLint Program::getActiveUniformBlockCount()
+{
+ ProgramBinary *programBinary = getProgramBinary();
+ if (programBinary)
+ {
+ return static_cast<GLint>(programBinary->getActiveUniformBlockCount());
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+GLint Program::getActiveUniformBlockMaxLength()
+{
+ ProgramBinary *programBinary = getProgramBinary();
+ if (programBinary)
+ {
+ return static_cast<GLint>(programBinary->getActiveUniformBlockMaxLength());
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+void Program::bindUniformBlock(GLuint uniformBlockIndex, GLuint uniformBlockBinding)
+{
+ mUniformBlockBindings[uniformBlockIndex] = uniformBlockBinding;
+}
+
+GLuint Program::getUniformBlockBinding(GLuint uniformBlockIndex) const
+{
+ return mUniformBlockBindings[uniformBlockIndex];
+}
+
+void Program::resetUniformBlockBindings()
+{
+ for (unsigned int blockId = 0; blockId < IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS; blockId++)
+ {
+ mUniformBlockBindings[blockId] = 0;
+ }
+}
+
+void Program::setTransformFeedbackVaryings(GLsizei count, const GLchar *const *varyings, GLenum bufferMode)
+{
+ mTransformFeedbackVaryings.resize(count);
+ for (GLsizei i = 0; i < count; i++)
+ {
+ mTransformFeedbackVaryings[i] = varyings[i];
+ }
+
+ mTransformFeedbackBufferMode = bufferMode;
+}
+
+void Program::getTransformFeedbackVarying(GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name) const
+{
+ ProgramBinary *programBinary = getProgramBinary();
+ if (programBinary && index < programBinary->getTransformFeedbackVaryingCount())
+ {
+ const LinkedVarying &varying = programBinary->getTransformFeedbackVarying(index);
+ GLsizei lastNameIdx = std::min(bufSize - 1, static_cast<GLsizei>(varying.name.length()));
+ if (length)
+ {
+ *length = lastNameIdx;
+ }
+ if (size)
+ {
+ *size = varying.size;
+ }
+ if (type)
+ {
+ *type = varying.type;
+ }
+ if (name)
+ {
+ memcpy(name, varying.name.c_str(), lastNameIdx);
+ name[lastNameIdx] = '\0';
+ }
+ }
+}
+
+GLsizei Program::getTransformFeedbackVaryingCount() const
+{
+ ProgramBinary *programBinary = getProgramBinary();
+ if (programBinary)
+ {
+ return static_cast<GLsizei>(programBinary->getTransformFeedbackVaryingCount());
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+GLsizei Program::getTransformFeedbackVaryingMaxLength() const
+{
+ ProgramBinary *programBinary = getProgramBinary();
+ if (programBinary)
+ {
+ GLsizei maxSize = 0;
+ for (size_t i = 0; i < programBinary->getTransformFeedbackVaryingCount(); i++)
+ {
+ const LinkedVarying &varying = programBinary->getTransformFeedbackVarying(i);
+ maxSize = std::max(maxSize, static_cast<GLsizei>(varying.name.length() + 1));
+ }
+
+ return maxSize;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+GLenum Program::getTransformFeedbackBufferMode() const
+{
+ ProgramBinary *programBinary = getProgramBinary();
+ if (programBinary)
+ {
+ return programBinary->getTransformFeedbackBufferMode();
+ }
+ else
+ {
+ return mTransformFeedbackBufferMode;
+ }
+}
+
}
diff --git a/chromium/third_party/angle/src/libGLESv2/Program.h b/chromium/third_party/angle/src/libGLESv2/Program.h
index a9db83403d9..7576be43c0f 100644
--- a/chromium/third_party/angle/src/libGLESv2/Program.h
+++ b/chromium/third_party/angle/src/libGLESv2/Program.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -78,7 +78,7 @@ class Program
bool link();
bool isLinked();
bool setProgramBinary(const void *binary, GLsizei length);
- ProgramBinary *getProgramBinary();
+ ProgramBinary *getProgramBinary() const;
int getInfoLogLength() const;
void getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog);
@@ -92,6 +92,18 @@ class Program
GLint getActiveUniformCount();
GLint getActiveUniformMaxLength();
+ GLint getActiveUniformBlockCount();
+ GLint getActiveUniformBlockMaxLength();
+
+ void bindUniformBlock(GLuint uniformBlockIndex, GLuint uniformBlockBinding);
+ GLuint getUniformBlockBinding(GLuint uniformBlockIndex) const;
+
+ void setTransformFeedbackVaryings(GLsizei count, const GLchar *const *varyings, GLenum bufferMode);
+ void getTransformFeedbackVarying(GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name) const;
+ GLsizei getTransformFeedbackVaryingCount() const;
+ GLsizei getTransformFeedbackVaryingMaxLength() const;
+ GLenum getTransformFeedbackBufferMode() const;
+
void addRef();
void release();
unsigned int getRefCount() const;
@@ -107,12 +119,18 @@ class Program
DISALLOW_COPY_AND_ASSIGN(Program);
void unlink(bool destroy = false);
+ void resetUniformBlockBindings();
FragmentShader *mFragmentShader;
VertexShader *mVertexShader;
AttributeBindings mAttributeBindings;
+ GLuint mUniformBlockBindings[IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS];
+
+ std::vector<std::string> mTransformFeedbackVaryings;
+ GLuint mTransformFeedbackBufferMode;
+
BindingPointer<ProgramBinary> mProgramBinary;
bool mLinked;
bool mDeleteStatus; // Flag to indicate that the program can be deleted when no longer in use
diff --git a/chromium/third_party/angle/src/libGLESv2/ProgramBinary.cpp b/chromium/third_party/angle/src/libGLESv2/ProgramBinary.cpp
index ee0ec8e03f1..e3ffa47964a 100644
--- a/chromium/third_party/angle/src/libGLESv2/ProgramBinary.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/ProgramBinary.cpp
@@ -1,6 +1,6 @@
#include "precompiled.h"
//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -14,46 +14,135 @@
#include "common/debug.h"
#include "common/version.h"
-#include "utilities.h"
+#include "common/utilities.h"
#include "libGLESv2/main.h"
#include "libGLESv2/Shader.h"
#include "libGLESv2/Program.h"
#include "libGLESv2/renderer/Renderer.h"
#include "libGLESv2/renderer/VertexDataManager.h"
+#include "libGLESv2/Context.h"
+#include "libGLESv2/Buffer.h"
+#include "libGLESv2/DynamicHLSL.h"
+#include "common/blocklayout.h"
#undef near
#undef far
namespace gl
{
-std::string str(int i)
+
+namespace
+{
+
+unsigned int ParseAndStripArrayIndex(std::string* name)
{
- char buffer[20];
- snprintf(buffer, sizeof(buffer), "%d", i);
- return buffer;
+ unsigned int subscript = GL_INVALID_INDEX;
+
+ // Strip any trailing array operator and retrieve the subscript
+ size_t open = name->find_last_of('[');
+ size_t close = name->find_last_of(']');
+ if (open != std::string::npos && close == name->length() - 1)
+ {
+ subscript = atoi(name->substr(open + 1).c_str());
+ name->erase(open);
+ }
+
+ return subscript;
}
-static rx::D3DWorkaroundType DiscardWorkaround(bool usesDiscard)
+void GetInputLayoutFromShader(const std::vector<gl::Attribute> &shaderAttributes, VertexFormat inputLayout[MAX_VERTEX_ATTRIBS])
{
- return (usesDiscard ? rx::ANGLE_D3D_WORKAROUND_SM3_OPTIMIZER : rx::ANGLE_D3D_WORKAROUND_NONE);
+ size_t layoutIndex = 0;
+ for (size_t attributeIndex = 0; attributeIndex < shaderAttributes.size(); attributeIndex++)
+ {
+ ASSERT(layoutIndex < MAX_VERTEX_ATTRIBS);
+
+ const gl::Attribute &shaderAttr = shaderAttributes[attributeIndex];
+
+ if (shaderAttr.type != GL_NONE)
+ {
+ GLenum transposedType = TransposeMatrixType(shaderAttr.type);
+
+ for (size_t rowIndex = 0; static_cast<int>(rowIndex) < VariableRowCount(transposedType); rowIndex++, layoutIndex++)
+ {
+ VertexFormat *defaultFormat = &inputLayout[layoutIndex];
+
+ defaultFormat->mType = UniformComponentType(transposedType);
+ defaultFormat->mNormalized = false;
+ defaultFormat->mPureInteger = (defaultFormat->mType != GL_FLOAT); // note: inputs can not be bool
+ defaultFormat->mComponents = VariableColumnCount(transposedType);
+ }
+ }
+ }
}
-UniformLocation::UniformLocation(const std::string &name, unsigned int element, unsigned int index)
+}
+
+VariableLocation::VariableLocation(const std::string &name, unsigned int element, unsigned int index)
: name(name), element(element), index(index)
{
}
-unsigned int ProgramBinary::mCurrentSerial = 1;
+ProgramBinary::VertexExecutable::VertexExecutable(rx::Renderer *const renderer,
+ const VertexFormat inputLayout[],
+ const GLenum signature[],
+ rx::ShaderExecutable *shaderExecutable)
+ : mShaderExecutable(shaderExecutable)
+{
+ for (size_t attributeIndex = 0; attributeIndex < gl::MAX_VERTEX_ATTRIBS; attributeIndex++)
+ {
+ mInputs[attributeIndex] = inputLayout[attributeIndex];
+ mSignature[attributeIndex] = signature[attributeIndex];
+ }
+}
+
+ProgramBinary::VertexExecutable::~VertexExecutable()
+{
+ delete mShaderExecutable;
+}
+
+bool ProgramBinary::VertexExecutable::matchesSignature(const GLenum signature[]) const
+{
+ for (size_t attributeIndex = 0; attributeIndex < MAX_VERTEX_ATTRIBS; attributeIndex++)
+ {
+ if (mSignature[attributeIndex] != signature[attributeIndex])
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
-ProgramBinary::ProgramBinary(rx::Renderer *renderer) : mRenderer(renderer), RefCountObject(0), mSerial(issueSerial())
+LinkedVarying::LinkedVarying()
{
- mPixelExecutable = NULL;
- mVertexExecutable = NULL;
- mGeometryExecutable = NULL;
+}
- mValidated = false;
+LinkedVarying::LinkedVarying(const std::string &name, GLenum type, GLsizei size, const std::string &semanticName,
+ unsigned int semanticIndex, unsigned int semanticIndexCount)
+ : name(name), type(type), size(size), semanticName(semanticName), semanticIndex(semanticIndex), semanticIndexCount(semanticIndexCount)
+{
+}
+unsigned int ProgramBinary::mCurrentSerial = 1;
+
+ProgramBinary::ProgramBinary(rx::Renderer *renderer)
+ : RefCountObject(0),
+ mRenderer(renderer),
+ mDynamicHLSL(NULL),
+ mVertexWorkarounds(rx::ANGLE_D3D_WORKAROUND_NONE),
+ mPixelExecutable(NULL),
+ mGeometryExecutable(NULL),
+ mUsedVertexSamplerRange(0),
+ mUsedPixelSamplerRange(0),
+ mUsesPointSize(false),
+ mShaderVersion(100),
+ mVertexUniformStorage(NULL),
+ mFragmentUniformStorage(NULL),
+ mValidated(false),
+ mSerial(issueSerial())
+{
for (int index = 0; index < MAX_VERTEX_ATTRIBS; index++)
{
mSemanticIndex[index] = -1;
@@ -69,27 +158,35 @@ ProgramBinary::ProgramBinary(rx::Renderer *renderer) : mRenderer(renderer), RefC
mSamplersVS[index].active = false;
}
- mUsedVertexSamplerRange = 0;
- mUsedPixelSamplerRange = 0;
- mUsesPointSize = false;
+ mDynamicHLSL = new DynamicHLSL(renderer);
}
ProgramBinary::~ProgramBinary()
{
- delete mPixelExecutable;
- mPixelExecutable = NULL;
-
- delete mVertexExecutable;
- mVertexExecutable = NULL;
+ while (!mVertexExecutables.empty())
+ {
+ delete mVertexExecutables.back();
+ mVertexExecutables.pop_back();
+ }
- delete mGeometryExecutable;
- mGeometryExecutable = NULL;
+ SafeDelete(mGeometryExecutable);
+ SafeDelete(mPixelExecutable);
while (!mUniforms.empty())
{
delete mUniforms.back();
mUniforms.pop_back();
}
+
+ while (!mUniformBlocks.empty())
+ {
+ delete mUniformBlocks.back();
+ mUniformBlocks.pop_back();
+ }
+
+ SafeDelete(mVertexUniformStorage);
+ SafeDelete(mFragmentUniformStorage);
+ SafeDelete(mDynamicHLSL);
}
unsigned int ProgramBinary::getSerial() const
@@ -97,22 +194,65 @@ unsigned int ProgramBinary::getSerial() const
return mSerial;
}
+int ProgramBinary::getShaderVersion() const
+{
+ return mShaderVersion;
+}
+
unsigned int ProgramBinary::issueSerial()
{
return mCurrentSerial++;
}
-rx::ShaderExecutable *ProgramBinary::getPixelExecutable()
+rx::ShaderExecutable *ProgramBinary::getPixelExecutable() const
{
return mPixelExecutable;
}
-rx::ShaderExecutable *ProgramBinary::getVertexExecutable()
+rx::ShaderExecutable *ProgramBinary::getVertexExecutableForInputLayout(const VertexFormat inputLayout[MAX_VERTEX_ATTRIBS])
{
- return mVertexExecutable;
+ GLenum signature[MAX_VERTEX_ATTRIBS];
+ mDynamicHLSL->getInputLayoutSignature(inputLayout, signature);
+
+ for (size_t executableIndex = 0; executableIndex < mVertexExecutables.size(); executableIndex++)
+ {
+ if (mVertexExecutables[executableIndex]->matchesSignature(signature))
+ {
+ return mVertexExecutables[executableIndex]->shaderExecutable();
+ }
+ }
+
+ // Generate new dynamic layout with attribute conversions
+ const std::string &layoutHLSL = mDynamicHLSL->generateInputLayoutHLSL(inputLayout, mShaderAttributes);
+
+ // Generate new shader source by replacing the attributes stub with the defined input layout
+ std::string vertexHLSL = mVertexHLSL;
+ size_t insertPos = vertexHLSL.find(DynamicHLSL::VERTEX_ATTRIBUTE_STUB_STRING);
+ vertexHLSL.replace(insertPos, DynamicHLSL::VERTEX_ATTRIBUTE_STUB_STRING.length(), layoutHLSL);
+
+ // Generate new vertex executable
+ InfoLog tempInfoLog;
+ rx::ShaderExecutable *vertexExecutable = mRenderer->compileToExecutable(tempInfoLog, vertexHLSL.c_str(),
+ rx::SHADER_VERTEX,
+ mTransformFeedbackLinkedVaryings,
+ (mTransformFeedbackBufferMode == GL_SEPARATE_ATTRIBS),
+ mVertexWorkarounds);
+
+ if (!vertexExecutable)
+ {
+ std::vector<char> tempCharBuffer(tempInfoLog.getLength()+3);
+ tempInfoLog.getLog(tempInfoLog.getLength(), NULL, &tempCharBuffer[0]);
+ ERR("Error compiling dynamic vertex executable:\n%s\n", &tempCharBuffer[0]);
+ }
+ else
+ {
+ mVertexExecutables.push_back(new VertexExecutable(mRenderer, inputLayout, signature, vertexExecutable));
+ }
+
+ return vertexExecutable;
}
-rx::ShaderExecutable *ProgramBinary::getGeometryExecutable()
+rx::ShaderExecutable *ProgramBinary::getGeometryExecutable() const
{
return mGeometryExecutable;
}
@@ -136,7 +276,7 @@ GLuint ProgramBinary::getAttributeLocation(const char *name)
int ProgramBinary::getSemanticIndex(int attributeIndex)
{
ASSERT(attributeIndex >= 0 && attributeIndex < MAX_VERTEX_ATTRIBS);
-
+
return mSemanticIndex[attributeIndex];
}
@@ -227,402 +367,352 @@ TextureType ProgramBinary::getSamplerTextureType(SamplerType type, unsigned int
GLint ProgramBinary::getUniformLocation(std::string name)
{
- unsigned int subscript = 0;
-
- // Strip any trailing array operator and retrieve the subscript
- size_t open = name.find_last_of('[');
- size_t close = name.find_last_of(']');
- if (open != std::string::npos && close == name.length() - 1)
- {
- subscript = atoi(name.substr(open + 1).c_str());
- name.erase(open);
- }
+ unsigned int subscript = ParseAndStripArrayIndex(&name);
unsigned int numUniforms = mUniformIndex.size();
for (unsigned int location = 0; location < numUniforms; location++)
{
- if (mUniformIndex[location].name == name &&
- mUniformIndex[location].element == subscript)
+ if (mUniformIndex[location].name == name)
{
- return location;
+ const int index = mUniformIndex[location].index;
+ const bool isArray = mUniforms[index]->isArray();
+
+ if ((isArray && mUniformIndex[location].element == subscript) ||
+ (subscript == GL_INVALID_INDEX))
+ {
+ return location;
+ }
}
}
return -1;
}
-bool ProgramBinary::setUniform1fv(GLint location, GLsizei count, const GLfloat* v)
+GLuint ProgramBinary::getUniformIndex(std::string name)
{
- if (location < 0 || location >= (int)mUniformIndex.size())
- {
- return false;
- }
-
- Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
- targetUniform->dirty = true;
+ unsigned int subscript = ParseAndStripArrayIndex(&name);
- int elementCount = targetUniform->elementCount();
-
- if (elementCount == 1 && count > 1)
- return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
-
- count = std::min(elementCount - (int)mUniformIndex[location].element, count);
-
- if (targetUniform->type == GL_FLOAT)
+ // The app is not allowed to specify array indices other than 0 for arrays of basic types
+ if (subscript != 0 && subscript != GL_INVALID_INDEX)
{
- GLfloat *target = (GLfloat*)targetUniform->data + mUniformIndex[location].element * 4;
-
- for (int i = 0; i < count; i++)
- {
- target[0] = v[0];
- target[1] = 0;
- target[2] = 0;
- target[3] = 0;
- target += 4;
- v += 1;
- }
+ return GL_INVALID_INDEX;
}
- else if (targetUniform->type == GL_BOOL)
- {
- GLint *boolParams = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
- for (int i = 0; i < count; i++)
+ unsigned int numUniforms = mUniforms.size();
+ for (unsigned int index = 0; index < numUniforms; index++)
+ {
+ if (mUniforms[index]->name == name)
{
- boolParams[0] = (v[0] == 0.0f) ? GL_FALSE : GL_TRUE;
- boolParams[1] = GL_FALSE;
- boolParams[2] = GL_FALSE;
- boolParams[3] = GL_FALSE;
- boolParams += 4;
- v += 1;
+ if (mUniforms[index]->isArray() || subscript == GL_INVALID_INDEX)
+ {
+ return index;
+ }
}
}
- else
- {
- return false;
- }
- return true;
+ return GL_INVALID_INDEX;
}
-bool ProgramBinary::setUniform2fv(GLint location, GLsizei count, const GLfloat *v)
+GLuint ProgramBinary::getUniformBlockIndex(std::string name)
{
- if (location < 0 || location >= (int)mUniformIndex.size())
+ unsigned int subscript = ParseAndStripArrayIndex(&name);
+
+ unsigned int numUniformBlocks = mUniformBlocks.size();
+ for (unsigned int blockIndex = 0; blockIndex < numUniformBlocks; blockIndex++)
{
- return false;
+ const UniformBlock &uniformBlock = *mUniformBlocks[blockIndex];
+ if (uniformBlock.name == name)
+ {
+ const bool arrayElementZero = (subscript == GL_INVALID_INDEX && uniformBlock.elementIndex == 0);
+ if (subscript == uniformBlock.elementIndex || arrayElementZero)
+ {
+ return blockIndex;
+ }
+ }
}
- Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
- targetUniform->dirty = true;
-
- int elementCount = targetUniform->elementCount();
+ return GL_INVALID_INDEX;
+}
- if (elementCount == 1 && count > 1)
- return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
+UniformBlock *ProgramBinary::getUniformBlockByIndex(GLuint blockIndex)
+{
+ ASSERT(blockIndex < mUniformBlocks.size());
+ return mUniformBlocks[blockIndex];
+}
- count = std::min(elementCount - (int)mUniformIndex[location].element, count);
+GLint ProgramBinary::getFragDataLocation(const char *name) const
+{
+ std::string baseName(name);
+ unsigned int arrayIndex;
+ arrayIndex = ParseAndStripArrayIndex(&baseName);
- if (targetUniform->type == GL_FLOAT_VEC2)
+ for (auto locationIt = mOutputVariables.begin(); locationIt != mOutputVariables.end(); locationIt++)
{
- GLfloat *target = (GLfloat*)targetUniform->data + mUniformIndex[location].element * 4;
+ const VariableLocation &outputVariable = locationIt->second;
- for (int i = 0; i < count; i++)
+ if (outputVariable.name == baseName && (arrayIndex == GL_INVALID_INDEX || arrayIndex == outputVariable.element))
{
- target[0] = v[0];
- target[1] = v[1];
- target[2] = 0;
- target[3] = 0;
- target += 4;
- v += 2;
+ return static_cast<GLint>(locationIt->first);
}
}
- else if (targetUniform->type == GL_BOOL_VEC2)
- {
- GLint *boolParams = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
- for (int i = 0; i < count; i++)
- {
- boolParams[0] = (v[0] == 0.0f) ? GL_FALSE : GL_TRUE;
- boolParams[1] = (v[1] == 0.0f) ? GL_FALSE : GL_TRUE;
- boolParams[2] = GL_FALSE;
- boolParams[3] = GL_FALSE;
- boolParams += 4;
- v += 2;
- }
- }
- else
- {
- return false;
- }
+ return -1;
+}
- return true;
+size_t ProgramBinary::getTransformFeedbackVaryingCount() const
+{
+ return mTransformFeedbackLinkedVaryings.size();
}
-bool ProgramBinary::setUniform3fv(GLint location, GLsizei count, const GLfloat *v)
+const LinkedVarying &ProgramBinary::getTransformFeedbackVarying(size_t idx) const
{
- if (location < 0 || location >= (int)mUniformIndex.size())
- {
- return false;
- }
+ return mTransformFeedbackLinkedVaryings[idx];
+}
- Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
- targetUniform->dirty = true;
+GLenum ProgramBinary::getTransformFeedbackBufferMode() const
+{
+ return mTransformFeedbackBufferMode;
+}
- int elementCount = targetUniform->elementCount();
+template <typename T>
+static inline void SetIfDirty(T *dest, const T& source, bool *dirtyFlag)
+{
+ ASSERT(dest != NULL);
+ ASSERT(dirtyFlag != NULL);
+
+ *dirtyFlag = *dirtyFlag || (memcmp(dest, &source, sizeof(T)) != 0);
+ *dest = source;
+}
- if (elementCount == 1 && count > 1)
- return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
+template <typename T>
+void ProgramBinary::setUniform(GLint location, GLsizei count, const T* v, GLenum targetUniformType)
+{
+ const int components = UniformComponentCount(targetUniformType);
+ const GLenum targetBoolType = UniformBoolVectorType(targetUniformType);
+
+ LinkedUniform *targetUniform = getUniformByLocation(location);
+
+ int elementCount = targetUniform->elementCount();
count = std::min(elementCount - (int)mUniformIndex[location].element, count);
- if (targetUniform->type == GL_FLOAT_VEC3)
+ if (targetUniform->type == targetUniformType)
{
- GLfloat *target = (GLfloat*)targetUniform->data + mUniformIndex[location].element * 4;
+ T *target = (T*)targetUniform->data + mUniformIndex[location].element * 4;
for (int i = 0; i < count; i++)
{
- target[0] = v[0];
- target[1] = v[1];
- target[2] = v[2];
- target[3] = 0;
+ for (int c = 0; c < components; c++)
+ {
+ SetIfDirty(target + c, v[c], &targetUniform->dirty);
+ }
+ for (int c = components; c < 4; c++)
+ {
+ SetIfDirty(target + c, T(0), &targetUniform->dirty);
+ }
target += 4;
- v += 3;
+ v += components;
}
}
- else if (targetUniform->type == GL_BOOL_VEC3)
+ else if (targetUniform->type == targetBoolType)
{
GLint *boolParams = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
for (int i = 0; i < count; i++)
{
- boolParams[0] = (v[0] == 0.0f) ? GL_FALSE : GL_TRUE;
- boolParams[1] = (v[1] == 0.0f) ? GL_FALSE : GL_TRUE;
- boolParams[2] = (v[2] == 0.0f) ? GL_FALSE : GL_TRUE;
- boolParams[3] = GL_FALSE;
+ for (int c = 0; c < components; c++)
+ {
+ SetIfDirty(boolParams + c, (v[c] == static_cast<T>(0)) ? GL_FALSE : GL_TRUE, &targetUniform->dirty);
+ }
+ for (int c = components; c < 4; c++)
+ {
+ SetIfDirty(boolParams + c, GL_FALSE, &targetUniform->dirty);
+ }
boolParams += 4;
- v += 3;
+ v += components;
}
}
- else
- {
- return false;
- }
-
- return true;
+ else UNREACHABLE();
}
-bool ProgramBinary::setUniform4fv(GLint location, GLsizei count, const GLfloat *v)
+void ProgramBinary::setUniform1fv(GLint location, GLsizei count, const GLfloat* v)
{
- if (location < 0 || location >= (int)mUniformIndex.size())
- {
- return false;
- }
+ setUniform(location, count, v, GL_FLOAT);
+}
- Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
- targetUniform->dirty = true;
+void ProgramBinary::setUniform2fv(GLint location, GLsizei count, const GLfloat *v)
+{
+ setUniform(location, count, v, GL_FLOAT_VEC2);
+}
- int elementCount = targetUniform->elementCount();
+void ProgramBinary::setUniform3fv(GLint location, GLsizei count, const GLfloat *v)
+{
+ setUniform(location, count, v, GL_FLOAT_VEC3);
+}
- if (elementCount == 1 && count > 1)
- return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
+void ProgramBinary::setUniform4fv(GLint location, GLsizei count, const GLfloat *v)
+{
+ setUniform(location, count, v, GL_FLOAT_VEC4);
+}
- count = std::min(elementCount - (int)mUniformIndex[location].element, count);
+template<typename T>
+bool transposeMatrix(T *target, const GLfloat *value, int targetWidth, int targetHeight, int srcWidth, int srcHeight)
+{
+ bool dirty = false;
+ int copyWidth = std::min(targetHeight, srcWidth);
+ int copyHeight = std::min(targetWidth, srcHeight);
- if (targetUniform->type == GL_FLOAT_VEC4)
+ for (int x = 0; x < copyWidth; x++)
{
- GLfloat *target = (GLfloat*)targetUniform->data + mUniformIndex[location].element * 4;
-
- for (int i = 0; i < count; i++)
+ for (int y = 0; y < copyHeight; y++)
{
- target[0] = v[0];
- target[1] = v[1];
- target[2] = v[2];
- target[3] = v[3];
- target += 4;
- v += 4;
+ SetIfDirty(target + (x * targetWidth + y), static_cast<T>(value[y * srcWidth + x]), &dirty);
}
}
- else if (targetUniform->type == GL_BOOL_VEC4)
+ // clear unfilled right side
+ for (int y = 0; y < copyWidth; y++)
{
- GLint *boolParams = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
-
- for (int i = 0; i < count; i++)
+ for (int x = copyHeight; x < targetWidth; x++)
{
- boolParams[0] = (v[0] == 0.0f) ? GL_FALSE : GL_TRUE;
- boolParams[1] = (v[1] == 0.0f) ? GL_FALSE : GL_TRUE;
- boolParams[2] = (v[2] == 0.0f) ? GL_FALSE : GL_TRUE;
- boolParams[3] = (v[3] == 0.0f) ? GL_FALSE : GL_TRUE;
- boolParams += 4;
- v += 4;
+ SetIfDirty(target + (y * targetWidth + x), static_cast<T>(0), &dirty);
}
}
- else
+ // clear unfilled bottom.
+ for (int y = copyWidth; y < targetHeight; y++)
{
- return false;
+ for (int x = 0; x < targetWidth; x++)
+ {
+ SetIfDirty(target + (y * targetWidth + x), static_cast<T>(0), &dirty);
+ }
}
- return true;
+ return dirty;
}
-template<typename T, int targetWidth, int targetHeight, int srcWidth, int srcHeight>
-void transposeMatrix(T *target, const GLfloat *value)
+template<typename T>
+bool expandMatrix(T *target, const GLfloat *value, int targetWidth, int targetHeight, int srcWidth, int srcHeight)
{
+ bool dirty = false;
int copyWidth = std::min(targetWidth, srcWidth);
int copyHeight = std::min(targetHeight, srcHeight);
- for (int x = 0; x < copyWidth; x++)
+ for (int y = 0; y < copyHeight; y++)
{
- for (int y = 0; y < copyHeight; y++)
+ for (int x = 0; x < copyWidth; x++)
{
- target[x * targetWidth + y] = (T)value[y * srcWidth + x];
+ SetIfDirty(target + (y * targetWidth + x), static_cast<T>(value[y * srcWidth + x]), &dirty);
}
}
// clear unfilled right side
for (int y = 0; y < copyHeight; y++)
{
- for (int x = srcWidth; x < targetWidth; x++)
+ for (int x = copyWidth; x < targetWidth; x++)
{
- target[y * targetWidth + x] = (T)0;
+ SetIfDirty(target + (y * targetWidth + x), static_cast<T>(0), &dirty);
}
}
// clear unfilled bottom.
- for (int y = srcHeight; y < targetHeight; y++)
+ for (int y = copyHeight; y < targetHeight; y++)
{
for (int x = 0; x < targetWidth; x++)
{
- target[y * targetWidth + x] = (T)0;
+ SetIfDirty(target + (y * targetWidth + x), static_cast<T>(0), &dirty);
}
}
+
+ return dirty;
}
-bool ProgramBinary::setUniformMatrix2fv(GLint location, GLsizei count, const GLfloat *value)
+template <int cols, int rows>
+void ProgramBinary::setUniformMatrixfv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value, GLenum targetUniformType)
{
- if (location < 0 || location >= (int)mUniformIndex.size())
- {
- return false;
- }
-
- Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
- targetUniform->dirty = true;
-
- if (targetUniform->type != GL_FLOAT_MAT2)
- {
- return false;
- }
+ LinkedUniform *targetUniform = getUniformByLocation(location);
int elementCount = targetUniform->elementCount();
- if (elementCount == 1 && count > 1)
- return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
-
count = std::min(elementCount - (int)mUniformIndex[location].element, count);
- GLfloat *target = (GLfloat*)targetUniform->data + mUniformIndex[location].element * 8;
+ const unsigned int targetMatrixStride = (4 * rows);
+ GLfloat *target = (GLfloat*)(targetUniform->data + mUniformIndex[location].element * sizeof(GLfloat) * targetMatrixStride);
for (int i = 0; i < count; i++)
{
- transposeMatrix<GLfloat,4,2,2,2>(target, value);
- target += 8;
- value += 4;
+ // Internally store matrices as transposed versions to accomodate HLSL matrix indexing
+ if (transpose == GL_FALSE)
+ {
+ targetUniform->dirty = transposeMatrix<GLfloat>(target, value, 4, rows, rows, cols) || targetUniform->dirty;
+ }
+ else
+ {
+ targetUniform->dirty = expandMatrix<GLfloat>(target, value, 4, rows, cols, rows) || targetUniform->dirty;
+ }
+ target += targetMatrixStride;
+ value += cols * rows;
}
-
- return true;
}
-bool ProgramBinary::setUniformMatrix3fv(GLint location, GLsizei count, const GLfloat *value)
+void ProgramBinary::setUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
{
- if (location < 0 || location >= (int)mUniformIndex.size())
- {
- return false;
- }
-
- Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
- targetUniform->dirty = true;
-
- if (targetUniform->type != GL_FLOAT_MAT3)
- {
- return false;
- }
-
- int elementCount = targetUniform->elementCount();
-
- if (elementCount == 1 && count > 1)
- return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
-
- count = std::min(elementCount - (int)mUniformIndex[location].element, count);
- GLfloat *target = (GLfloat*)targetUniform->data + mUniformIndex[location].element * 12;
-
- for (int i = 0; i < count; i++)
- {
- transposeMatrix<GLfloat,4,3,3,3>(target, value);
- target += 12;
- value += 9;
- }
-
- return true;
+ setUniformMatrixfv<2, 2>(location, count, transpose, value, GL_FLOAT_MAT2);
}
-
-bool ProgramBinary::setUniformMatrix4fv(GLint location, GLsizei count, const GLfloat *value)
+void ProgramBinary::setUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
{
- if (location < 0 || location >= (int)mUniformIndex.size())
- {
- return false;
- }
-
- Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
- targetUniform->dirty = true;
+ setUniformMatrixfv<3, 3>(location, count, transpose, value, GL_FLOAT_MAT3);
+}
- if (targetUniform->type != GL_FLOAT_MAT4)
- {
- return false;
- }
+void ProgramBinary::setUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+ setUniformMatrixfv<4, 4>(location, count, transpose, value, GL_FLOAT_MAT4);
+}
- int elementCount = targetUniform->elementCount();
+void ProgramBinary::setUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+ setUniformMatrixfv<2, 3>(location, count, transpose, value, GL_FLOAT_MAT2x3);
+}
- if (elementCount == 1 && count > 1)
- return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
+void ProgramBinary::setUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+ setUniformMatrixfv<3, 2>(location, count, transpose, value, GL_FLOAT_MAT3x2);
+}
- count = std::min(elementCount - (int)mUniformIndex[location].element, count);
- GLfloat *target = (GLfloat*)(targetUniform->data + mUniformIndex[location].element * sizeof(GLfloat) * 16);
+void ProgramBinary::setUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+ setUniformMatrixfv<2, 4>(location, count, transpose, value, GL_FLOAT_MAT2x4);
+}
- for (int i = 0; i < count; i++)
- {
- transposeMatrix<GLfloat,4,4,4,4>(target, value);
- target += 16;
- value += 16;
- }
+void ProgramBinary::setUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+ setUniformMatrixfv<4, 2>(location, count, transpose, value, GL_FLOAT_MAT4x2);
+}
- return true;
+void ProgramBinary::setUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+ setUniformMatrixfv<3, 4>(location, count, transpose, value, GL_FLOAT_MAT3x4);
}
-bool ProgramBinary::setUniform1iv(GLint location, GLsizei count, const GLint *v)
+void ProgramBinary::setUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
{
- if (location < 0 || location >= (int)mUniformIndex.size())
- {
- return false;
- }
+ setUniformMatrixfv<4, 3>(location, count, transpose, value, GL_FLOAT_MAT4x3);
+}
- Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
- targetUniform->dirty = true;
+void ProgramBinary::setUniform1iv(GLint location, GLsizei count, const GLint *v)
+{
+ LinkedUniform *targetUniform = mUniforms[mUniformIndex[location].index];
int elementCount = targetUniform->elementCount();
- if (elementCount == 1 && count > 1)
- return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
-
count = std::min(elementCount - (int)mUniformIndex[location].element, count);
- if (targetUniform->type == GL_INT ||
- targetUniform->type == GL_SAMPLER_2D ||
- targetUniform->type == GL_SAMPLER_CUBE)
+ if (targetUniform->type == GL_INT || IsSampler(targetUniform->type))
{
GLint *target = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
for (int i = 0; i < count; i++)
{
- target[0] = v[0];
- target[1] = 0;
- target[2] = 0;
- target[3] = 0;
+ SetIfDirty(target + 0, v[0], &targetUniform->dirty);
+ SetIfDirty(target + 1, 0, &targetUniform->dirty);
+ SetIfDirty(target + 2, 0, &targetUniform->dirty);
+ SetIfDirty(target + 3, 0, &targetUniform->dirty);
target += 4;
v += 1;
}
@@ -633,189 +723,56 @@ bool ProgramBinary::setUniform1iv(GLint location, GLsizei count, const GLint *v)
for (int i = 0; i < count; i++)
{
- boolParams[0] = (v[0] == 0) ? GL_FALSE : GL_TRUE;
- boolParams[1] = GL_FALSE;
- boolParams[2] = GL_FALSE;
- boolParams[3] = GL_FALSE;
+ SetIfDirty(boolParams + 0, (v[0] == 0) ? GL_FALSE : GL_TRUE, &targetUniform->dirty);
+ SetIfDirty(boolParams + 1, GL_FALSE, &targetUniform->dirty);
+ SetIfDirty(boolParams + 2, GL_FALSE, &targetUniform->dirty);
+ SetIfDirty(boolParams + 3, GL_FALSE, &targetUniform->dirty);
boolParams += 4;
v += 1;
}
}
- else
- {
- return false;
- }
-
- return true;
+ else UNREACHABLE();
}
-bool ProgramBinary::setUniform2iv(GLint location, GLsizei count, const GLint *v)
+void ProgramBinary::setUniform2iv(GLint location, GLsizei count, const GLint *v)
{
- if (location < 0 || location >= (int)mUniformIndex.size())
- {
- return false;
- }
-
- Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
- targetUniform->dirty = true;
-
- int elementCount = targetUniform->elementCount();
-
- if (elementCount == 1 && count > 1)
- return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
-
- count = std::min(elementCount - (int)mUniformIndex[location].element, count);
-
- if (targetUniform->type == GL_INT_VEC2)
- {
- GLint *target = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
-
- for (int i = 0; i < count; i++)
- {
- target[0] = v[0];
- target[1] = v[1];
- target[2] = 0;
- target[3] = 0;
- target += 4;
- v += 2;
- }
- }
- else if (targetUniform->type == GL_BOOL_VEC2)
- {
- GLint *boolParams = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
-
- for (int i = 0; i < count; i++)
- {
- boolParams[0] = (v[0] == 0) ? GL_FALSE : GL_TRUE;
- boolParams[1] = (v[1] == 0) ? GL_FALSE : GL_TRUE;
- boolParams[2] = GL_FALSE;
- boolParams[3] = GL_FALSE;
- boolParams += 4;
- v += 2;
- }
- }
- else
- {
- return false;
- }
-
- return true;
+ setUniform(location, count, v, GL_INT_VEC2);
}
-bool ProgramBinary::setUniform3iv(GLint location, GLsizei count, const GLint *v)
+void ProgramBinary::setUniform3iv(GLint location, GLsizei count, const GLint *v)
{
- if (location < 0 || location >= (int)mUniformIndex.size())
- {
- return false;
- }
-
- Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
- targetUniform->dirty = true;
-
- int elementCount = targetUniform->elementCount();
-
- if (elementCount == 1 && count > 1)
- return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
-
- count = std::min(elementCount - (int)mUniformIndex[location].element, count);
-
- if (targetUniform->type == GL_INT_VEC3)
- {
- GLint *target = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
-
- for (int i = 0; i < count; i++)
- {
- target[0] = v[0];
- target[1] = v[1];
- target[2] = v[2];
- target[3] = 0;
- target += 4;
- v += 3;
- }
- }
- else if (targetUniform->type == GL_BOOL_VEC3)
- {
- GLint *boolParams = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
-
- for (int i = 0; i < count; i++)
- {
- boolParams[0] = (v[0] == 0) ? GL_FALSE : GL_TRUE;
- boolParams[1] = (v[1] == 0) ? GL_FALSE : GL_TRUE;
- boolParams[2] = (v[2] == 0) ? GL_FALSE : GL_TRUE;
- boolParams[3] = GL_FALSE;
- boolParams += 4;
- v += 3;
- }
- }
- else
- {
- return false;
- }
-
- return true;
+ setUniform(location, count, v, GL_INT_VEC3);
}
-bool ProgramBinary::setUniform4iv(GLint location, GLsizei count, const GLint *v)
+void ProgramBinary::setUniform4iv(GLint location, GLsizei count, const GLint *v)
{
- if (location < 0 || location >= (int)mUniformIndex.size())
- {
- return false;
- }
-
- Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
- targetUniform->dirty = true;
-
- int elementCount = targetUniform->elementCount();
-
- if (elementCount == 1 && count > 1)
- return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
-
- count = std::min(elementCount - (int)mUniformIndex[location].element, count);
-
- if (targetUniform->type == GL_INT_VEC4)
- {
- GLint *target = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
+ setUniform(location, count, v, GL_INT_VEC4);
+}
- for (int i = 0; i < count; i++)
- {
- target[0] = v[0];
- target[1] = v[1];
- target[2] = v[2];
- target[3] = v[3];
- target += 4;
- v += 4;
- }
- }
- else if (targetUniform->type == GL_BOOL_VEC4)
- {
- GLint *boolParams = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
+void ProgramBinary::setUniform1uiv(GLint location, GLsizei count, const GLuint *v)
+{
+ setUniform(location, count, v, GL_UNSIGNED_INT);
+}
- for (int i = 0; i < count; i++)
- {
- boolParams[0] = (v[0] == 0) ? GL_FALSE : GL_TRUE;
- boolParams[1] = (v[1] == 0) ? GL_FALSE : GL_TRUE;
- boolParams[2] = (v[2] == 0) ? GL_FALSE : GL_TRUE;
- boolParams[3] = (v[3] == 0) ? GL_FALSE : GL_TRUE;
- boolParams += 4;
- v += 4;
- }
- }
- else
- {
- return false;
- }
+void ProgramBinary::setUniform2uiv(GLint location, GLsizei count, const GLuint *v)
+{
+ setUniform(location, count, v, GL_UNSIGNED_INT_VEC2);
+}
- return true;
+void ProgramBinary::setUniform3uiv(GLint location, GLsizei count, const GLuint *v)
+{
+ setUniform(location, count, v, GL_UNSIGNED_INT_VEC3);
}
-bool ProgramBinary::getUniformfv(GLint location, GLsizei *bufSize, GLfloat *params)
+void ProgramBinary::setUniform4uiv(GLint location, GLsizei count, const GLuint *v)
{
- if (location < 0 || location >= (int)mUniformIndex.size())
- {
- return false;
- }
+ setUniform(location, count, v, GL_UNSIGNED_INT_VEC4);
+}
- Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
+template <typename T>
+bool ProgramBinary::getUniformv(GLint location, GLsizei *bufSize, T *params, GLenum uniformType)
+{
+ LinkedUniform *targetUniform = mUniforms[mUniformIndex[location].index];
// sized queries -- ensure the provided buffer is large enough
if (bufSize)
@@ -827,123 +784,89 @@ bool ProgramBinary::getUniformfv(GLint location, GLsizei *bufSize, GLfloat *para
}
}
- switch (targetUniform->type)
+ if (IsMatrixType(targetUniform->type))
{
- case GL_FLOAT_MAT2:
- transposeMatrix<GLfloat,2,2,4,2>(params, (GLfloat*)targetUniform->data + mUniformIndex[location].element * 8);
- break;
- case GL_FLOAT_MAT3:
- transposeMatrix<GLfloat,3,3,4,3>(params, (GLfloat*)targetUniform->data + mUniformIndex[location].element * 12);
- break;
- case GL_FLOAT_MAT4:
- transposeMatrix<GLfloat,4,4,4,4>(params, (GLfloat*)targetUniform->data + mUniformIndex[location].element * 16);
- break;
- default:
+ const int rows = VariableRowCount(targetUniform->type);
+ const int cols = VariableColumnCount(targetUniform->type);
+ transposeMatrix(params, (GLfloat*)targetUniform->data + mUniformIndex[location].element * 4 * rows, rows, cols, 4, rows);
+ }
+ else if (uniformType == UniformComponentType(targetUniform->type))
+ {
+ unsigned int size = UniformComponentCount(targetUniform->type);
+ memcpy(params, targetUniform->data + mUniformIndex[location].element * 4 * sizeof(T),
+ size * sizeof(T));
+ }
+ else
+ {
+ unsigned int size = UniformComponentCount(targetUniform->type);
+ switch (UniformComponentType(targetUniform->type))
{
- unsigned int size = UniformComponentCount(targetUniform->type);
-
- switch (UniformComponentType(targetUniform->type))
+ case GL_BOOL:
{
- case GL_BOOL:
- {
- GLint *boolParams = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
+ GLint *boolParams = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
- for (unsigned int i = 0; i < size; i++)
- {
- params[i] = (boolParams[i] == GL_FALSE) ? 0.0f : 1.0f;
- }
- }
- break;
- case GL_FLOAT:
- memcpy(params, targetUniform->data + mUniformIndex[location].element * 4 * sizeof(GLfloat),
- size * sizeof(GLfloat));
- break;
- case GL_INT:
+ for (unsigned int i = 0; i < size; i++)
{
- GLint *intParams = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
-
- for (unsigned int i = 0; i < size; i++)
- {
- params[i] = (float)intParams[i];
- }
+ params[i] = (boolParams[i] == GL_FALSE) ? static_cast<T>(0) : static_cast<T>(1);
}
- break;
- default: UNREACHABLE();
}
- }
- }
-
- return true;
-}
+ break;
-bool ProgramBinary::getUniformiv(GLint location, GLsizei *bufSize, GLint *params)
-{
- if (location < 0 || location >= (int)mUniformIndex.size())
- {
- return false;
- }
+ case GL_FLOAT:
+ {
+ GLfloat *floatParams = (GLfloat*)targetUniform->data + mUniformIndex[location].element * 4;
- Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
+ for (unsigned int i = 0; i < size; i++)
+ {
+ params[i] = static_cast<T>(floatParams[i]);
+ }
+ }
+ break;
- // sized queries -- ensure the provided buffer is large enough
- if (bufSize)
- {
- int requiredBytes = UniformExternalSize(targetUniform->type);
- if (*bufSize < requiredBytes)
- {
- return false;
- }
- }
+ case GL_INT:
+ {
+ GLint *intParams = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
- switch (targetUniform->type)
- {
- case GL_FLOAT_MAT2:
- transposeMatrix<GLint,2,2,4,2>(params, (GLfloat*)targetUniform->data + mUniformIndex[location].element * 8);
- break;
- case GL_FLOAT_MAT3:
- transposeMatrix<GLint,3,3,4,3>(params, (GLfloat*)targetUniform->data + mUniformIndex[location].element * 12);
- break;
- case GL_FLOAT_MAT4:
- transposeMatrix<GLint,4,4,4,4>(params, (GLfloat*)targetUniform->data + mUniformIndex[location].element * 16);
- break;
- default:
- {
- unsigned int size = VariableColumnCount(targetUniform->type);
+ for (unsigned int i = 0; i < size; i++)
+ {
+ params[i] = static_cast<T>(intParams[i]);
+ }
+ }
+ break;
- switch (UniformComponentType(targetUniform->type))
+ case GL_UNSIGNED_INT:
{
- case GL_BOOL:
- {
- GLint *boolParams = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
+ GLuint *uintParams = (GLuint*)targetUniform->data + mUniformIndex[location].element * 4;
- for (unsigned int i = 0; i < size; i++)
- {
- params[i] = boolParams[i];
- }
- }
- break;
- case GL_FLOAT:
+ for (unsigned int i = 0; i < size; i++)
{
- GLfloat *floatParams = (GLfloat*)targetUniform->data + mUniformIndex[location].element * 4;
-
- for (unsigned int i = 0; i < size; i++)
- {
- params[i] = (GLint)floatParams[i];
- }
+ params[i] = static_cast<T>(uintParams[i]);
}
- break;
- case GL_INT:
- memcpy(params, targetUniform->data + mUniformIndex[location].element * 4 * sizeof(GLint),
- size * sizeof(GLint));
- break;
- default: UNREACHABLE();
}
+ break;
+
+ default: UNREACHABLE();
}
}
return true;
}
+bool ProgramBinary::getUniformfv(GLint location, GLsizei *bufSize, GLfloat *params)
+{
+ return getUniformv(location, bufSize, params, GL_FLOAT);
+}
+
+bool ProgramBinary::getUniformiv(GLint location, GLsizei *bufSize, GLint *params)
+{
+ return getUniformv(location, bufSize, params, GL_INT);
+}
+
+bool ProgramBinary::getUniformuiv(GLint location, GLsizei *bufSize, GLuint *params)
+{
+ return getUniformv(location, bufSize, params, GL_UNSIGNED_INT);
+}
+
void ProgramBinary::dirtyAllUniforms()
{
unsigned int numUniforms = mUniforms.size();
@@ -957,19 +880,18 @@ void ProgramBinary::dirtyAllUniforms()
void ProgramBinary::applyUniforms()
{
// Retrieve sampler uniform values
- for (std::vector<Uniform*>::iterator ub = mUniforms.begin(), ue = mUniforms.end(); ub != ue; ++ub)
+ for (size_t uniformIndex = 0; uniformIndex < mUniforms.size(); uniformIndex++)
{
- Uniform *targetUniform = *ub;
+ LinkedUniform *targetUniform = mUniforms[uniformIndex];
if (targetUniform->dirty)
{
- if (targetUniform->type == GL_SAMPLER_2D ||
- targetUniform->type == GL_SAMPLER_CUBE)
+ if (IsSampler(targetUniform->type))
{
int count = targetUniform->elementCount();
GLint (*v)[4] = (GLint(*)[4])targetUniform->data;
- if (targetUniform->psRegisterIndex >= 0)
+ if (targetUniform->isReferencedByFragmentShader())
{
unsigned int firstIndex = targetUniform->psRegisterIndex;
@@ -985,7 +907,7 @@ void ProgramBinary::applyUniforms()
}
}
- if (targetUniform->vsRegisterIndex >= 0)
+ if (targetUniform->isReferencedByVertexShader())
{
unsigned int firstIndex = targetUniform->vsRegisterIndex;
@@ -1004,214 +926,80 @@ void ProgramBinary::applyUniforms()
}
}
- mRenderer->applyUniforms(this, &mUniforms);
-}
-
-// Packs varyings into generic varying registers, using the algorithm from [OpenGL ES Shading Language 1.00 rev. 17] appendix A section 7 page 111
-// Returns the number of used varying registers, or -1 if unsuccesful
-int ProgramBinary::packVaryings(InfoLog &infoLog, const Varying *packing[][4], FragmentShader *fragmentShader)
-{
- const int maxVaryingVectors = mRenderer->getMaxVaryingVectors();
+ mRenderer->applyUniforms(*this);
- fragmentShader->resetVaryingsRegisterAssignment();
-
- for (VaryingList::iterator varying = fragmentShader->mVaryings.begin(); varying != fragmentShader->mVaryings.end(); varying++)
+ for (size_t uniformIndex = 0; uniformIndex < mUniforms.size(); uniformIndex++)
{
- int n = VariableRowCount(varying->type) * varying->size;
- int m = VariableColumnCount(varying->type);
- bool success = false;
-
- if (m == 2 || m == 3 || m == 4)
- {
- for (int r = 0; r <= maxVaryingVectors - n && !success; r++)
- {
- bool available = true;
-
- for (int y = 0; y < n && available; y++)
- {
- for (int x = 0; x < m && available; x++)
- {
- if (packing[r + y][x])
- {
- available = false;
- }
- }
- }
-
- if (available)
- {
- varying->reg = r;
- varying->col = 0;
-
- for (int y = 0; y < n; y++)
- {
- for (int x = 0; x < m; x++)
- {
- packing[r + y][x] = &*varying;
- }
- }
+ mUniforms[uniformIndex]->dirty = false;
+ }
+}
- success = true;
- }
- }
+bool ProgramBinary::applyUniformBuffers(const std::vector<gl::Buffer*> boundBuffers)
+{
+ const gl::Buffer *vertexUniformBuffers[gl::IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS] = {NULL};
+ const gl::Buffer *fragmentUniformBuffers[gl::IMPLEMENTATION_MAX_FRAGMENT_SHADER_UNIFORM_BUFFERS] = {NULL};
- if (!success && m == 2)
- {
- for (int r = maxVaryingVectors - n; r >= 0 && !success; r--)
- {
- bool available = true;
+ const unsigned int reservedBuffersInVS = mRenderer->getReservedVertexUniformBuffers();
+ const unsigned int reservedBuffersInFS = mRenderer->getReservedFragmentUniformBuffers();
- for (int y = 0; y < n && available; y++)
- {
- for (int x = 2; x < 4 && available; x++)
- {
- if (packing[r + y][x])
- {
- available = false;
- }
- }
- }
+ ASSERT(boundBuffers.size() == mUniformBlocks.size());
- if (available)
- {
- varying->reg = r;
- varying->col = 2;
+ for (unsigned int uniformBlockIndex = 0; uniformBlockIndex < mUniformBlocks.size(); uniformBlockIndex++)
+ {
+ gl::UniformBlock *uniformBlock = getUniformBlockByIndex(uniformBlockIndex);
+ gl::Buffer *uniformBuffer = boundBuffers[uniformBlockIndex];
- for (int y = 0; y < n; y++)
- {
- for (int x = 2; x < 4; x++)
- {
- packing[r + y][x] = &*varying;
- }
- }
+ ASSERT(uniformBlock && uniformBuffer);
- success = true;
- }
- }
- }
- }
- else if (m == 1)
+ if (uniformBuffer->size() < uniformBlock->dataSize)
{
- int space[4] = {0};
-
- for (int y = 0; y < maxVaryingVectors; y++)
- {
- for (int x = 0; x < 4; x++)
- {
- space[x] += packing[y][x] ? 0 : 1;
- }
- }
-
- int column = 0;
-
- for (int x = 0; x < 4; x++)
- {
- if (space[x] >= n && space[x] < space[column])
- {
- column = x;
- }
- }
-
- if (space[column] >= n)
- {
- for (int r = 0; r < maxVaryingVectors; r++)
- {
- if (!packing[r][column])
- {
- varying->reg = r;
-
- for (int y = r; y < r + n; y++)
- {
- packing[y][column] = &*varying;
- }
-
- break;
- }
- }
-
- varying->col = column;
-
- success = true;
- }
+ // undefined behaviour
+ return false;
}
- else UNREACHABLE();
- if (!success)
- {
- infoLog.append("Could not pack varying %s", varying->name.c_str());
+ ASSERT(uniformBlock->isReferencedByVertexShader() || uniformBlock->isReferencedByFragmentShader());
- return -1;
+ if (uniformBlock->isReferencedByVertexShader())
+ {
+ unsigned int registerIndex = uniformBlock->vsRegisterIndex - reservedBuffersInVS;
+ ASSERT(vertexUniformBuffers[registerIndex] == NULL);
+ ASSERT(registerIndex < mRenderer->getMaxVertexShaderUniformBuffers());
+ vertexUniformBuffers[registerIndex] = uniformBuffer;
}
- }
-
- // Return the number of used registers
- int registers = 0;
- for (int r = 0; r < maxVaryingVectors; r++)
- {
- if (packing[r][0] || packing[r][1] || packing[r][2] || packing[r][3])
+ if (uniformBlock->isReferencedByFragmentShader())
{
- registers++;
+ unsigned int registerIndex = uniformBlock->psRegisterIndex - reservedBuffersInFS;
+ ASSERT(fragmentUniformBuffers[registerIndex] == NULL);
+ ASSERT(registerIndex < mRenderer->getMaxFragmentShaderUniformBuffers());
+ fragmentUniformBuffers[registerIndex] = uniformBuffer;
}
}
- return registers;
+ return mRenderer->setUniformBuffers(vertexUniformBuffers, fragmentUniformBuffers);
}
-bool ProgramBinary::linkVaryings(InfoLog &infoLog, int registers, const Varying *packing[][4],
- std::string& pixelHLSL, std::string& vertexHLSL,
- FragmentShader *fragmentShader, VertexShader *vertexShader)
+bool ProgramBinary::linkVaryings(InfoLog &infoLog, FragmentShader *fragmentShader, VertexShader *vertexShader)
{
- if (pixelHLSL.empty() || vertexHLSL.empty())
- {
- return false;
- }
+ std::vector<PackedVarying> &fragmentVaryings = fragmentShader->getVaryings();
+ std::vector<PackedVarying> &vertexVaryings = vertexShader->getVaryings();
- bool usesMRT = fragmentShader->mUsesMultipleRenderTargets;
- bool usesFragColor = fragmentShader->mUsesFragColor;
- bool usesFragData = fragmentShader->mUsesFragData;
- if (usesFragColor && usesFragData)
- {
- infoLog.append("Cannot use both gl_FragColor and gl_FragData in the same fragment shader.");
- return false;
- }
-
- // Write the HLSL input/output declarations
- const int shaderModel = mRenderer->getMajorShaderModel();
- const int maxVaryingVectors = mRenderer->getMaxVaryingVectors();
-
- const int registersNeeded = registers + (fragmentShader->mUsesFragCoord ? 1 : 0) + (fragmentShader->mUsesPointCoord ? 1 : 0);
-
- // The output color is broadcast to all enabled draw buffers when writing to gl_FragColor
- const bool broadcast = fragmentShader->mUsesFragColor;
- const unsigned int numRenderTargets = (broadcast || usesMRT ? mRenderer->getMaxRenderTargets() : 1);
-
- if (registersNeeded > maxVaryingVectors)
- {
- infoLog.append("No varying registers left to support gl_FragCoord/gl_PointCoord");
-
- return false;
- }
-
- vertexShader->resetVaryingsRegisterAssignment();
-
- for (VaryingList::iterator input = fragmentShader->mVaryings.begin(); input != fragmentShader->mVaryings.end(); input++)
+ for (size_t fragVaryingIndex = 0; fragVaryingIndex < fragmentVaryings.size(); fragVaryingIndex++)
{
+ PackedVarying *input = &fragmentVaryings[fragVaryingIndex];
bool matched = false;
- for (VaryingList::iterator output = vertexShader->mVaryings.begin(); output != vertexShader->mVaryings.end(); output++)
+ for (size_t vertVaryingIndex = 0; vertVaryingIndex < vertexVaryings.size(); vertVaryingIndex++)
{
+ PackedVarying *output = &vertexVaryings[vertVaryingIndex];
if (output->name == input->name)
{
- if (output->type != input->type || output->size != input->size)
+ if (!linkValidateVariables(infoLog, output->name, *input, *output))
{
- infoLog.append("Type of vertex varying %s does not match that of the fragment varying", output->name.c_str());
-
return false;
}
- output->reg = input->reg;
- output->col = input->col;
+ output->registerIndex = input->registerIndex;
matched = true;
break;
@@ -1221,645 +1009,409 @@ bool ProgramBinary::linkVaryings(InfoLog &infoLog, int registers, const Varying
if (!matched)
{
infoLog.append("Fragment varying %s does not match any vertex varying", input->name.c_str());
-
return false;
}
}
- mUsesPointSize = vertexShader->mUsesPointSize;
- std::string varyingSemantic = (mUsesPointSize && shaderModel == 3) ? "COLOR" : "TEXCOORD";
- std::string targetSemantic = (shaderModel >= 4) ? "SV_Target" : "COLOR";
- std::string positionSemantic = (shaderModel >= 4) ? "SV_Position" : "POSITION";
- std::string depthSemantic = (shaderModel >= 4) ? "SV_Depth" : "DEPTH";
+ return true;
+}
- // special varyings that use reserved registers
- int reservedRegisterIndex = registers;
- std::string fragCoordSemantic;
- std::string pointCoordSemantic;
+bool ProgramBinary::load(InfoLog &infoLog, const void *binary, GLsizei length)
+{
+#ifdef ANGLE_DISABLE_PROGRAM_BINARY_LOAD
+ return false;
+#else
+ BinaryInputStream stream(binary, length);
- if (fragmentShader->mUsesFragCoord)
+ int format = stream.readInt<int>();
+ if (format != GL_PROGRAM_BINARY_ANGLE)
{
- fragCoordSemantic = varyingSemantic + str(reservedRegisterIndex++);
+ infoLog.append("Invalid program binary format.");
+ return false;
}
- if (fragmentShader->mUsesPointCoord)
+ int majorVersion = stream.readInt<int>();
+ int minorVersion = stream.readInt<int>();
+ if (majorVersion != ANGLE_MAJOR_VERSION || minorVersion != ANGLE_MINOR_VERSION)
{
- // Shader model 3 uses a special TEXCOORD semantic for point sprite texcoords.
- // In DX11 we compute this in the GS.
- if (shaderModel == 3)
- {
- pointCoordSemantic = "TEXCOORD0";
- }
- else if (shaderModel >= 4)
- {
- pointCoordSemantic = varyingSemantic + str(reservedRegisterIndex++);
- }
+ infoLog.append("Invalid program binary version.");
+ return false;
}
- vertexHLSL += "struct VS_INPUT\n"
- "{\n";
-
- int semanticIndex = 0;
- for (AttributeArray::iterator attribute = vertexShader->mAttributes.begin(); attribute != vertexShader->mAttributes.end(); attribute++)
+ unsigned char commitString[ANGLE_COMMIT_HASH_SIZE];
+ stream.readBytes(commitString, ANGLE_COMMIT_HASH_SIZE);
+ if (memcmp(commitString, ANGLE_COMMIT_HASH, sizeof(unsigned char) * ANGLE_COMMIT_HASH_SIZE) != 0)
{
- switch (attribute->type)
- {
- case GL_FLOAT: vertexHLSL += " float "; break;
- case GL_FLOAT_VEC2: vertexHLSL += " float2 "; break;
- case GL_FLOAT_VEC3: vertexHLSL += " float3 "; break;
- case GL_FLOAT_VEC4: vertexHLSL += " float4 "; break;
- case GL_FLOAT_MAT2: vertexHLSL += " float2x2 "; break;
- case GL_FLOAT_MAT3: vertexHLSL += " float3x3 "; break;
- case GL_FLOAT_MAT4: vertexHLSL += " float4x4 "; break;
- default: UNREACHABLE();
- }
-
- vertexHLSL += decorateAttribute(attribute->name) + " : TEXCOORD" + str(semanticIndex) + ";\n";
-
- semanticIndex += VariableRowCount(attribute->type);
+ infoLog.append("Invalid program binary version.");
+ return false;
}
- vertexHLSL += "};\n"
- "\n"
- "struct VS_OUTPUT\n"
- "{\n";
-
- if (shaderModel < 4)
+ int compileFlags = stream.readInt<int>();
+ if (compileFlags != ANGLE_COMPILE_OPTIMIZATION_LEVEL)
{
- vertexHLSL += " float4 gl_Position : " + positionSemantic + ";\n";
+ infoLog.append("Mismatched compilation flags.");
+ return false;
}
- for (int r = 0; r < registers; r++)
+ for (int i = 0; i < MAX_VERTEX_ATTRIBS; ++i)
{
- int registerSize = packing[r][3] ? 4 : (packing[r][2] ? 3 : (packing[r][1] ? 2 : 1));
-
- vertexHLSL += " float" + str(registerSize) + " v" + str(r) + " : " + varyingSemantic + str(r) + ";\n";
+ stream.readInt(&mLinkedAttribute[i].type);
+ stream.readString(&mLinkedAttribute[i].name);
+ stream.readInt(&mShaderAttributes[i].type);
+ stream.readString(&mShaderAttributes[i].name);
+ stream.readInt(&mSemanticIndex[i]);
}
- if (fragmentShader->mUsesFragCoord)
+ initAttributesByLayout();
+
+ for (unsigned int i = 0; i < MAX_TEXTURE_IMAGE_UNITS; ++i)
{
- vertexHLSL += " float4 gl_FragCoord : " + fragCoordSemantic + ";\n";
+ stream.readBool(&mSamplersPS[i].active);
+ stream.readInt(&mSamplersPS[i].logicalTextureUnit);
+ stream.readInt(&mSamplersPS[i].textureType);
}
- if (vertexShader->mUsesPointSize && shaderModel >= 3)
+ for (unsigned int i = 0; i < IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS; ++i)
{
- vertexHLSL += " float gl_PointSize : PSIZE;\n";
+ stream.readBool(&mSamplersVS[i].active);
+ stream.readInt(&mSamplersVS[i].logicalTextureUnit);
+ stream.readInt(&mSamplersVS[i].textureType);
}
- if (shaderModel >= 4)
+ stream.readInt(&mUsedVertexSamplerRange);
+ stream.readInt(&mUsedPixelSamplerRange);
+ stream.readBool(&mUsesPointSize);
+ stream.readInt(&mShaderVersion);
+
+ const unsigned int uniformCount = stream.readInt<unsigned int>();
+ if (stream.error())
{
- vertexHLSL += " float4 gl_Position : " + positionSemantic + ";\n";
+ infoLog.append("Invalid program binary.");
+ return false;
}
- vertexHLSL += "};\n"
- "\n"
- "VS_OUTPUT main(VS_INPUT input)\n"
- "{\n";
-
- for (AttributeArray::iterator attribute = vertexShader->mAttributes.begin(); attribute != vertexShader->mAttributes.end(); attribute++)
+ mUniforms.resize(uniformCount);
+ for (unsigned int uniformIndex = 0; uniformIndex < uniformCount; uniformIndex++)
{
- vertexHLSL += " " + decorateAttribute(attribute->name) + " = ";
+ GLenum type = stream.readInt<GLenum>();
+ GLenum precision = stream.readInt<GLenum>();
+ std::string name = stream.readString();
+ unsigned int arraySize = stream.readInt<unsigned int>();
+ int blockIndex = stream.readInt<int>();
- if (VariableRowCount(attribute->type) > 1) // Matrix
- {
- vertexHLSL += "transpose";
- }
+ int offset = stream.readInt<int>();
+ int arrayStride = stream.readInt<int>();
+ int matrixStride = stream.readInt<int>();
+ bool isRowMajorMatrix = stream.readBool();
- vertexHLSL += "(input." + decorateAttribute(attribute->name) + ");\n";
- }
+ const gl::BlockMemberInfo blockInfo(offset, arrayStride, matrixStride, isRowMajorMatrix);
- if (shaderModel >= 4)
- {
- vertexHLSL += "\n"
- " gl_main();\n"
- "\n"
- " VS_OUTPUT output;\n"
- " output.gl_Position.x = gl_Position.x;\n"
- " output.gl_Position.y = -gl_Position.y;\n"
- " output.gl_Position.z = (gl_Position.z + gl_Position.w) * 0.5;\n"
- " output.gl_Position.w = gl_Position.w;\n";
- }
- else
- {
- vertexHLSL += "\n"
- " gl_main();\n"
- "\n"
- " VS_OUTPUT output;\n"
- " output.gl_Position.x = gl_Position.x * dx_ViewAdjust.z + dx_ViewAdjust.x * gl_Position.w;\n"
- " output.gl_Position.y = -(gl_Position.y * dx_ViewAdjust.w + dx_ViewAdjust.y * gl_Position.w);\n"
- " output.gl_Position.z = (gl_Position.z + gl_Position.w) * 0.5;\n"
- " output.gl_Position.w = gl_Position.w;\n";
- }
+ LinkedUniform *uniform = new LinkedUniform(type, precision, name, arraySize, blockIndex, blockInfo);
- if (vertexShader->mUsesPointSize && shaderModel >= 3)
- {
- vertexHLSL += " output.gl_PointSize = gl_PointSize;\n";
+ stream.readInt(&uniform->psRegisterIndex);
+ stream.readInt(&uniform->vsRegisterIndex);
+ stream.readInt(&uniform->registerCount);
+ stream.readInt(&uniform->registerElement);
+
+ mUniforms[uniformIndex] = uniform;
}
- if (fragmentShader->mUsesFragCoord)
+ unsigned int uniformBlockCount = stream.readInt<unsigned int>();
+ if (stream.error())
{
- vertexHLSL += " output.gl_FragCoord = gl_Position;\n";
+ infoLog.append("Invalid program binary.");
+ return false;
}
- for (VaryingList::iterator varying = vertexShader->mVaryings.begin(); varying != vertexShader->mVaryings.end(); varying++)
+ mUniformBlocks.resize(uniformBlockCount);
+ for (unsigned int uniformBlockIndex = 0; uniformBlockIndex < uniformBlockCount; ++uniformBlockIndex)
{
- if (varying->reg >= 0)
- {
- for (int i = 0; i < varying->size; i++)
- {
- int rows = VariableRowCount(varying->type);
-
- for (int j = 0; j < rows; j++)
- {
- int r = varying->reg + i * rows + j;
- vertexHLSL += " output.v" + str(r);
-
- bool sharedRegister = false; // Register used by multiple varyings
-
- for (int x = 0; x < 4; x++)
- {
- if (packing[r][x] && packing[r][x] != packing[r][0])
- {
- sharedRegister = true;
- break;
- }
- }
-
- if(sharedRegister)
- {
- vertexHLSL += ".";
-
- for (int x = 0; x < 4; x++)
- {
- if (packing[r][x] == &*varying)
- {
- switch(x)
- {
- case 0: vertexHLSL += "x"; break;
- case 1: vertexHLSL += "y"; break;
- case 2: vertexHLSL += "z"; break;
- case 3: vertexHLSL += "w"; break;
- }
- }
- }
- }
+ std::string name = stream.readString();
+ unsigned int elementIndex = stream.readInt<unsigned int>();
+ unsigned int dataSize = stream.readInt<unsigned int>();
- vertexHLSL += " = " + varying->name;
-
- if (varying->array)
- {
- vertexHLSL += "[" + str(i) + "]";
- }
-
- if (rows > 1)
- {
- vertexHLSL += "[" + str(j) + "]";
- }
-
- vertexHLSL += ";\n";
- }
- }
- }
- }
+ UniformBlock *uniformBlock = new UniformBlock(name, elementIndex, dataSize);
- vertexHLSL += "\n"
- " return output;\n"
- "}\n";
+ stream.readInt(&uniformBlock->psRegisterIndex);
+ stream.readInt(&uniformBlock->vsRegisterIndex);
- pixelHLSL += "struct PS_INPUT\n"
- "{\n";
-
- for (VaryingList::iterator varying = fragmentShader->mVaryings.begin(); varying != fragmentShader->mVaryings.end(); varying++)
- {
- if (varying->reg >= 0)
+ unsigned int numMembers = stream.readInt<unsigned int>();
+ uniformBlock->memberUniformIndexes.resize(numMembers);
+ for (unsigned int blockMemberIndex = 0; blockMemberIndex < numMembers; blockMemberIndex++)
{
- for (int i = 0; i < varying->size; i++)
- {
- int rows = VariableRowCount(varying->type);
- for (int j = 0; j < rows; j++)
- {
- std::string n = str(varying->reg + i * rows + j);
- pixelHLSL += " float" + str(VariableColumnCount(varying->type)) + " v" + n + " : " + varyingSemantic + n + ";\n";
- }
- }
+ stream.readInt(&uniformBlock->memberUniformIndexes[blockMemberIndex]);
}
- else UNREACHABLE();
- }
- if (fragmentShader->mUsesFragCoord)
- {
- pixelHLSL += " float4 gl_FragCoord : " + fragCoordSemantic + ";\n";
- }
-
- if (fragmentShader->mUsesPointCoord && shaderModel >= 3)
- {
- pixelHLSL += " float2 gl_PointCoord : " + pointCoordSemantic + ";\n";
+ mUniformBlocks[uniformBlockIndex] = uniformBlock;
}
- // Must consume the PSIZE element if the geometry shader is not active
- // We won't know if we use a GS until we draw
- if (vertexShader->mUsesPointSize && shaderModel >= 4)
+ const unsigned int uniformIndexCount = stream.readInt<unsigned int>();
+ if (stream.error())
{
- pixelHLSL += " float gl_PointSize : PSIZE;\n";
+ infoLog.append("Invalid program binary.");
+ return false;
}
- if (fragmentShader->mUsesFragCoord)
+ mUniformIndex.resize(uniformIndexCount);
+ for (unsigned int uniformIndexIndex = 0; uniformIndexIndex < uniformIndexCount; uniformIndexIndex++)
{
- if (shaderModel >= 4)
- {
- pixelHLSL += " float4 dx_VPos : SV_Position;\n";
- }
- else if (shaderModel >= 3)
- {
- pixelHLSL += " float2 dx_VPos : VPOS;\n";
- }
+ stream.readString(&mUniformIndex[uniformIndexIndex].name);
+ stream.readInt(&mUniformIndex[uniformIndexIndex].element);
+ stream.readInt(&mUniformIndex[uniformIndexIndex].index);
}
- pixelHLSL += "};\n"
- "\n"
- "struct PS_OUTPUT\n"
- "{\n";
-
- for (unsigned int renderTargetIndex = 0; renderTargetIndex < numRenderTargets; renderTargetIndex++)
+ stream.readInt(&mTransformFeedbackBufferMode);
+ const unsigned int transformFeedbackVaryingCount = stream.readInt<unsigned int>();
+ mTransformFeedbackLinkedVaryings.resize(transformFeedbackVaryingCount);
+ for (unsigned int varyingIndex = 0; varyingIndex < transformFeedbackVaryingCount; varyingIndex++)
{
- pixelHLSL += " float4 gl_Color" + str(renderTargetIndex) + " : " + targetSemantic + str(renderTargetIndex) + ";\n";
- }
+ LinkedVarying &varying = mTransformFeedbackLinkedVaryings[varyingIndex];
- if (fragmentShader->mUsesFragDepth)
- {
- pixelHLSL += " float gl_Depth : " + depthSemantic + ";\n";
+ stream.readString(&varying.name);
+ stream.readInt(&varying.type);
+ stream.readInt(&varying.size);
+ stream.readString(&varying.semanticName);
+ stream.readInt(&varying.semanticIndex);
+ stream.readInt(&varying.semanticIndexCount);
}
- pixelHLSL += "};\n"
- "\n";
+ stream.readString(&mVertexHLSL);
- if (fragmentShader->mUsesFrontFacing)
- {
- if (shaderModel >= 4)
- {
- pixelHLSL += "PS_OUTPUT main(PS_INPUT input, bool isFrontFace : SV_IsFrontFace)\n"
- "{\n";
- }
- else
- {
- pixelHLSL += "PS_OUTPUT main(PS_INPUT input, float vFace : VFACE)\n"
- "{\n";
- }
- }
- else
- {
- pixelHLSL += "PS_OUTPUT main(PS_INPUT input)\n"
- "{\n";
- }
+ stream.readInt(&mVertexWorkarounds);
- if (fragmentShader->mUsesFragCoord)
+ const unsigned int vertexShaderCount = stream.readInt<unsigned int>();
+
+ for (unsigned int vertexShaderIndex = 0; vertexShaderIndex < vertexShaderCount; vertexShaderIndex++)
{
- pixelHLSL += " float rhw = 1.0 / input.gl_FragCoord.w;\n";
-
- if (shaderModel >= 4)
- {
- pixelHLSL += " gl_FragCoord.x = input.dx_VPos.x;\n"
- " gl_FragCoord.y = input.dx_VPos.y;\n";
- }
- else if (shaderModel >= 3)
+ VertexFormat inputLayout[MAX_VERTEX_ATTRIBS];
+
+ for (size_t inputIndex = 0; inputIndex < MAX_VERTEX_ATTRIBS; inputIndex++)
{
- pixelHLSL += " gl_FragCoord.x = input.dx_VPos.x + 0.5;\n"
- " gl_FragCoord.y = input.dx_VPos.y + 0.5;\n";
+ VertexFormat *vertexInput = &inputLayout[inputIndex];
+ stream.readInt(&vertexInput->mType);
+ stream.readInt(&vertexInput->mNormalized);
+ stream.readInt(&vertexInput->mComponents);
+ stream.readBool(&vertexInput->mPureInteger);
}
- else
+
+ unsigned int vertexShaderSize = stream.readInt<unsigned int>();
+
+ const char *vertexShaderFunction = (const char*) binary + stream.offset();
+
+ rx::ShaderExecutable *shaderExecutable = mRenderer->loadExecutable(reinterpret_cast<const DWORD*>(vertexShaderFunction),
+ vertexShaderSize, rx::SHADER_VERTEX,
+ mTransformFeedbackLinkedVaryings,
+ (mTransformFeedbackBufferMode == GL_SEPARATE_ATTRIBS));
+ if (!shaderExecutable)
{
- // dx_ViewCoords contains the viewport width/2, height/2, center.x and center.y. See Renderer::setViewport()
- pixelHLSL += " gl_FragCoord.x = (input.gl_FragCoord.x * rhw) * dx_ViewCoords.x + dx_ViewCoords.z;\n"
- " gl_FragCoord.y = (input.gl_FragCoord.y * rhw) * dx_ViewCoords.y + dx_ViewCoords.w;\n";
+ infoLog.append("Could not create vertex shader.");
+ return false;
}
-
- pixelHLSL += " gl_FragCoord.z = (input.gl_FragCoord.z * rhw) * dx_DepthFront.x + dx_DepthFront.y;\n"
- " gl_FragCoord.w = rhw;\n";
- }
- if (fragmentShader->mUsesPointCoord && shaderModel >= 3)
- {
- pixelHLSL += " gl_PointCoord.x = input.gl_PointCoord.x;\n";
- pixelHLSL += " gl_PointCoord.y = 1.0 - input.gl_PointCoord.y;\n";
+ // generated converted input layout
+ GLenum signature[MAX_VERTEX_ATTRIBS];
+ mDynamicHLSL->getInputLayoutSignature(inputLayout, signature);
+
+ // add new binary
+ mVertexExecutables.push_back(new VertexExecutable(mRenderer, inputLayout, signature, shaderExecutable));
+
+ stream.skip(vertexShaderSize);
}
- if (fragmentShader->mUsesFrontFacing)
+ unsigned int pixelShaderSize = stream.readInt<unsigned int>();
+
+ const char *pixelShaderFunction = (const char*) binary + stream.offset();
+ mPixelExecutable = mRenderer->loadExecutable(reinterpret_cast<const DWORD*>(pixelShaderFunction),
+ pixelShaderSize, rx::SHADER_PIXEL, mTransformFeedbackLinkedVaryings,
+ (mTransformFeedbackBufferMode == GL_SEPARATE_ATTRIBS));
+ if (!mPixelExecutable)
{
- if (shaderModel <= 3)
- {
- pixelHLSL += " gl_FrontFacing = (vFace * dx_DepthFront.z >= 0.0);\n";
- }
- else
- {
- pixelHLSL += " gl_FrontFacing = isFrontFace;\n";
- }
+ infoLog.append("Could not create pixel shader.");
+ return false;
}
+ stream.skip(pixelShaderSize);
+
+ unsigned int geometryShaderSize = stream.readInt<unsigned int>();
- for (VaryingList::iterator varying = fragmentShader->mVaryings.begin(); varying != fragmentShader->mVaryings.end(); varying++)
+ if (geometryShaderSize > 0)
{
- if (varying->reg >= 0)
+ const char *geometryShaderFunction = (const char*) binary + stream.offset();
+ mGeometryExecutable = mRenderer->loadExecutable(reinterpret_cast<const DWORD*>(geometryShaderFunction),
+ geometryShaderSize, rx::SHADER_GEOMETRY, mTransformFeedbackLinkedVaryings,
+ (mTransformFeedbackBufferMode == GL_SEPARATE_ATTRIBS));
+ if (!mGeometryExecutable)
{
- for (int i = 0; i < varying->size; i++)
- {
- int rows = VariableRowCount(varying->type);
- for (int j = 0; j < rows; j++)
- {
- std::string n = str(varying->reg + i * rows + j);
- pixelHLSL += " " + varying->name;
-
- if (varying->array)
- {
- pixelHLSL += "[" + str(i) + "]";
- }
-
- if (rows > 1)
- {
- pixelHLSL += "[" + str(j) + "]";
- }
-
- switch (VariableColumnCount(varying->type))
- {
- case 1: pixelHLSL += " = input.v" + n + ".x;\n"; break;
- case 2: pixelHLSL += " = input.v" + n + ".xy;\n"; break;
- case 3: pixelHLSL += " = input.v" + n + ".xyz;\n"; break;
- case 4: pixelHLSL += " = input.v" + n + ";\n"; break;
- default: UNREACHABLE();
- }
- }
- }
+ infoLog.append("Could not create geometry shader.");
+ SafeDelete(mPixelExecutable);
+ return false;
}
- else UNREACHABLE();
+ stream.skip(geometryShaderSize);
}
- pixelHLSL += "\n"
- " gl_main();\n"
- "\n"
- " PS_OUTPUT output;\n";
-
- for (unsigned int renderTargetIndex = 0; renderTargetIndex < numRenderTargets; renderTargetIndex++)
- {
- unsigned int sourceColorIndex = broadcast ? 0 : renderTargetIndex;
+ const char *ptr = (const char*) binary + stream.offset();
- pixelHLSL += " output.gl_Color" + str(renderTargetIndex) + " = gl_Color[" + str(sourceColorIndex) + "];\n";
- }
+ const GUID *binaryIdentifier = (const GUID *) ptr;
+ ptr += sizeof(GUID);
- if (fragmentShader->mUsesFragDepth)
+ GUID identifier = mRenderer->getAdapterIdentifier();
+ if (memcmp(&identifier, binaryIdentifier, sizeof(GUID)) != 0)
{
- pixelHLSL += " output.gl_Depth = gl_Depth;\n";
+ infoLog.append("Invalid program binary.");
+ return false;
}
- pixelHLSL += "\n"
- " return output;\n"
- "}\n";
+ initializeUniformStorage();
return true;
+#endif // #ifdef ANGLE_DISABLE_PROGRAM_BINARY_LOAD
}
-bool ProgramBinary::load(InfoLog &infoLog, const void *binary, GLsizei length)
+bool ProgramBinary::save(void* binary, GLsizei bufSize, GLsizei *length)
{
- BinaryInputStream stream(binary, length);
-
- int format = 0;
- stream.read(&format);
- if (format != GL_PROGRAM_BINARY_ANGLE)
- {
- infoLog.append("Invalid program binary format.");
- return false;
- }
+ BinaryOutputStream stream;
- int version = 0;
- stream.read(&version);
- if (version != VERSION_DWORD)
- {
- infoLog.append("Invalid program binary version.");
- return false;
- }
+ stream.writeInt(GL_PROGRAM_BINARY_ANGLE);
+ stream.writeInt(ANGLE_MAJOR_VERSION);
+ stream.writeInt(ANGLE_MINOR_VERSION);
+ stream.writeBytes(reinterpret_cast<unsigned char*>(ANGLE_COMMIT_HASH), ANGLE_COMMIT_HASH_SIZE);
+ stream.writeInt(ANGLE_COMPILE_OPTIMIZATION_LEVEL);
- int compileFlags = 0;
- stream.read(&compileFlags);
- if (compileFlags != ANGLE_COMPILE_OPTIMIZATION_LEVEL)
- {
- infoLog.append("Mismatched compilation flags.");
- return false;
- }
-
- for (int i = 0; i < MAX_VERTEX_ATTRIBS; ++i)
+ for (unsigned int i = 0; i < MAX_VERTEX_ATTRIBS; ++i)
{
- stream.read(&mLinkedAttribute[i].type);
- std::string name;
- stream.read(&name);
- mLinkedAttribute[i].name = name;
- stream.read(&mSemanticIndex[i]);
+ stream.writeInt(mLinkedAttribute[i].type);
+ stream.writeString(mLinkedAttribute[i].name);
+ stream.writeInt(mShaderAttributes[i].type);
+ stream.writeString(mShaderAttributes[i].name);
+ stream.writeInt(mSemanticIndex[i]);
}
- initAttributesByLayout();
-
for (unsigned int i = 0; i < MAX_TEXTURE_IMAGE_UNITS; ++i)
{
- stream.read(&mSamplersPS[i].active);
- stream.read(&mSamplersPS[i].logicalTextureUnit);
-
- int textureType;
- stream.read(&textureType);
- mSamplersPS[i].textureType = (TextureType) textureType;
+ stream.writeInt(mSamplersPS[i].active);
+ stream.writeInt(mSamplersPS[i].logicalTextureUnit);
+ stream.writeInt(mSamplersPS[i].textureType);
}
for (unsigned int i = 0; i < IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS; ++i)
{
- stream.read(&mSamplersVS[i].active);
- stream.read(&mSamplersVS[i].logicalTextureUnit);
-
- int textureType;
- stream.read(&textureType);
- mSamplersVS[i].textureType = (TextureType) textureType;
+ stream.writeInt(mSamplersVS[i].active);
+ stream.writeInt(mSamplersVS[i].logicalTextureUnit);
+ stream.writeInt(mSamplersVS[i].textureType);
}
- stream.read(&mUsedVertexSamplerRange);
- stream.read(&mUsedPixelSamplerRange);
- stream.read(&mUsesPointSize);
+ stream.writeInt(mUsedVertexSamplerRange);
+ stream.writeInt(mUsedPixelSamplerRange);
+ stream.writeInt(mUsesPointSize);
+ stream.writeInt(mShaderVersion);
- size_t size;
- stream.read(&size);
- if (stream.error())
+ stream.writeInt(mUniforms.size());
+ for (size_t uniformIndex = 0; uniformIndex < mUniforms.size(); ++uniformIndex)
{
- infoLog.append("Invalid program binary.");
- return false;
- }
+ const LinkedUniform &uniform = *mUniforms[uniformIndex];
- mUniforms.resize(size);
- for (unsigned int i = 0; i < size; ++i)
- {
- GLenum type;
- GLenum precision;
- std::string name;
- unsigned int arraySize;
+ stream.writeInt(uniform.type);
+ stream.writeInt(uniform.precision);
+ stream.writeString(uniform.name);
+ stream.writeInt(uniform.arraySize);
+ stream.writeInt(uniform.blockIndex);
- stream.read(&type);
- stream.read(&precision);
- stream.read(&name);
- stream.read(&arraySize);
+ stream.writeInt(uniform.blockInfo.offset);
+ stream.writeInt(uniform.blockInfo.arrayStride);
+ stream.writeInt(uniform.blockInfo.matrixStride);
+ stream.writeInt(uniform.blockInfo.isRowMajorMatrix);
- mUniforms[i] = new Uniform(type, precision, name, arraySize);
-
- stream.read(&mUniforms[i]->psRegisterIndex);
- stream.read(&mUniforms[i]->vsRegisterIndex);
- stream.read(&mUniforms[i]->registerCount);
- }
-
- stream.read(&size);
- if (stream.error())
- {
- infoLog.append("Invalid program binary.");
- return false;
+ stream.writeInt(uniform.psRegisterIndex);
+ stream.writeInt(uniform.vsRegisterIndex);
+ stream.writeInt(uniform.registerCount);
+ stream.writeInt(uniform.registerElement);
}
- mUniformIndex.resize(size);
- for (unsigned int i = 0; i < size; ++i)
+ stream.writeInt(mUniformBlocks.size());
+ for (size_t uniformBlockIndex = 0; uniformBlockIndex < mUniformBlocks.size(); ++uniformBlockIndex)
{
- stream.read(&mUniformIndex[i].name);
- stream.read(&mUniformIndex[i].element);
- stream.read(&mUniformIndex[i].index);
- }
-
- unsigned int pixelShaderSize;
- stream.read(&pixelShaderSize);
-
- unsigned int vertexShaderSize;
- stream.read(&vertexShaderSize);
+ const UniformBlock& uniformBlock = *mUniformBlocks[uniformBlockIndex];
- unsigned int geometryShaderSize;
- stream.read(&geometryShaderSize);
+ stream.writeString(uniformBlock.name);
+ stream.writeInt(uniformBlock.elementIndex);
+ stream.writeInt(uniformBlock.dataSize);
- const char *ptr = (const char*) binary + stream.offset();
-
- const GUID *binaryIdentifier = (const GUID *) ptr;
- ptr += sizeof(GUID);
+ stream.writeInt(uniformBlock.memberUniformIndexes.size());
+ for (unsigned int blockMemberIndex = 0; blockMemberIndex < uniformBlock.memberUniformIndexes.size(); blockMemberIndex++)
+ {
+ stream.writeInt(uniformBlock.memberUniformIndexes[blockMemberIndex]);
+ }
- GUID identifier = mRenderer->getAdapterIdentifier();
- if (memcmp(&identifier, binaryIdentifier, sizeof(GUID)) != 0)
- {
- infoLog.append("Invalid program binary.");
- return false;
+ stream.writeInt(uniformBlock.psRegisterIndex);
+ stream.writeInt(uniformBlock.vsRegisterIndex);
}
- const char *pixelShaderFunction = ptr;
- ptr += pixelShaderSize;
-
- const char *vertexShaderFunction = ptr;
- ptr += vertexShaderSize;
-
- const char *geometryShaderFunction = geometryShaderSize > 0 ? ptr : NULL;
- ptr += geometryShaderSize;
-
- mPixelExecutable = mRenderer->loadExecutable(reinterpret_cast<const DWORD*>(pixelShaderFunction),
- pixelShaderSize, rx::SHADER_PIXEL);
- if (!mPixelExecutable)
+ stream.writeInt(mUniformIndex.size());
+ for (size_t i = 0; i < mUniformIndex.size(); ++i)
{
- infoLog.append("Could not create pixel shader.");
- return false;
+ stream.writeString(mUniformIndex[i].name);
+ stream.writeInt(mUniformIndex[i].element);
+ stream.writeInt(mUniformIndex[i].index);
}
- mVertexExecutable = mRenderer->loadExecutable(reinterpret_cast<const DWORD*>(vertexShaderFunction),
- vertexShaderSize, rx::SHADER_VERTEX);
- if (!mVertexExecutable)
+ stream.writeInt(mTransformFeedbackBufferMode);
+ stream.writeInt(mTransformFeedbackLinkedVaryings.size());
+ for (size_t i = 0; i < mTransformFeedbackLinkedVaryings.size(); i++)
{
- infoLog.append("Could not create vertex shader.");
- delete mPixelExecutable;
- mPixelExecutable = NULL;
- return false;
- }
+ const LinkedVarying &varying = mTransformFeedbackLinkedVaryings[i];
- if (geometryShaderFunction != NULL && geometryShaderSize > 0)
- {
- mGeometryExecutable = mRenderer->loadExecutable(reinterpret_cast<const DWORD*>(geometryShaderFunction),
- geometryShaderSize, rx::SHADER_GEOMETRY);
- if (!mGeometryExecutable)
- {
- infoLog.append("Could not create geometry shader.");
- delete mPixelExecutable;
- mPixelExecutable = NULL;
- delete mVertexExecutable;
- mVertexExecutable = NULL;
- return false;
- }
- }
- else
- {
- mGeometryExecutable = NULL;
+ stream.writeString(varying.name);
+ stream.writeInt(varying.type);
+ stream.writeInt(varying.size);
+ stream.writeString(varying.semanticName);
+ stream.writeInt(varying.semanticIndex);
+ stream.writeInt(varying.semanticIndexCount);
}
- return true;
-}
-
-bool ProgramBinary::save(void* binary, GLsizei bufSize, GLsizei *length)
-{
- BinaryOutputStream stream;
+ stream.writeString(mVertexHLSL);
+ stream.writeInt(mVertexWorkarounds);
- stream.write(GL_PROGRAM_BINARY_ANGLE);
- stream.write(VERSION_DWORD);
- stream.write(ANGLE_COMPILE_OPTIMIZATION_LEVEL);
-
- for (unsigned int i = 0; i < MAX_VERTEX_ATTRIBS; ++i)
+ stream.writeInt(mVertexExecutables.size());
+ for (size_t vertexExecutableIndex = 0; vertexExecutableIndex < mVertexExecutables.size(); vertexExecutableIndex++)
{
- stream.write(mLinkedAttribute[i].type);
- stream.write(mLinkedAttribute[i].name);
- stream.write(mSemanticIndex[i]);
- }
+ VertexExecutable *vertexExecutable = mVertexExecutables[vertexExecutableIndex];
- for (unsigned int i = 0; i < MAX_TEXTURE_IMAGE_UNITS; ++i)
- {
- stream.write(mSamplersPS[i].active);
- stream.write(mSamplersPS[i].logicalTextureUnit);
- stream.write((int) mSamplersPS[i].textureType);
- }
+ for (size_t inputIndex = 0; inputIndex < gl::MAX_VERTEX_ATTRIBS; inputIndex++)
+ {
+ const VertexFormat &vertexInput = vertexExecutable->inputs()[inputIndex];
+ stream.writeInt(vertexInput.mType);
+ stream.writeInt(vertexInput.mNormalized);
+ stream.writeInt(vertexInput.mComponents);
+ stream.writeInt(vertexInput.mPureInteger);
+ }
- for (unsigned int i = 0; i < IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS; ++i)
- {
- stream.write(mSamplersVS[i].active);
- stream.write(mSamplersVS[i].logicalTextureUnit);
- stream.write((int) mSamplersVS[i].textureType);
+ size_t vertexShaderSize = vertexExecutable->shaderExecutable()->getLength();
+ stream.writeInt(vertexShaderSize);
+
+ unsigned char *vertexBlob = static_cast<unsigned char *>(vertexExecutable->shaderExecutable()->getFunction());
+ stream.writeBytes(vertexBlob, vertexShaderSize);
}
- stream.write(mUsedVertexSamplerRange);
- stream.write(mUsedPixelSamplerRange);
- stream.write(mUsesPointSize);
+ size_t pixelShaderSize = mPixelExecutable->getLength();
+ stream.writeInt(pixelShaderSize);
- stream.write(mUniforms.size());
- for (unsigned int i = 0; i < mUniforms.size(); ++i)
- {
- stream.write(mUniforms[i]->type);
- stream.write(mUniforms[i]->precision);
- stream.write(mUniforms[i]->name);
- stream.write(mUniforms[i]->arraySize);
+ unsigned char *pixelBlob = static_cast<unsigned char *>(mPixelExecutable->getFunction());
+ stream.writeBytes(pixelBlob, pixelShaderSize);
- stream.write(mUniforms[i]->psRegisterIndex);
- stream.write(mUniforms[i]->vsRegisterIndex);
- stream.write(mUniforms[i]->registerCount);
- }
+ size_t geometryShaderSize = (mGeometryExecutable != NULL) ? mGeometryExecutable->getLength() : 0;
+ stream.writeInt(geometryShaderSize);
- stream.write(mUniformIndex.size());
- for (unsigned int i = 0; i < mUniformIndex.size(); ++i)
+ if (mGeometryExecutable != NULL && geometryShaderSize > 0)
{
- stream.write(mUniformIndex[i].name);
- stream.write(mUniformIndex[i].element);
- stream.write(mUniformIndex[i].index);
+ unsigned char *geometryBlob = static_cast<unsigned char *>(mGeometryExecutable->getFunction());
+ stream.writeBytes(geometryBlob, geometryShaderSize);
}
- UINT pixelShaderSize = mPixelExecutable->getLength();
- stream.write(pixelShaderSize);
-
- UINT vertexShaderSize = mVertexExecutable->getLength();
- stream.write(vertexShaderSize);
-
- UINT geometryShaderSize = (mGeometryExecutable != NULL) ? mGeometryExecutable->getLength() : 0;
- stream.write(geometryShaderSize);
-
GUID identifier = mRenderer->getAdapterIdentifier();
GLsizei streamLength = stream.length();
const void *streamData = stream.data();
- GLsizei totalLength = streamLength + sizeof(GUID) + pixelShaderSize + vertexShaderSize + geometryShaderSize;
+ GLsizei totalLength = streamLength + sizeof(GUID);
if (totalLength > bufSize)
{
if (length)
@@ -1880,18 +1432,6 @@ bool ProgramBinary::save(void* binary, GLsizei bufSize, GLsizei *length)
memcpy(ptr, &identifier, sizeof(GUID));
ptr += sizeof(GUID);
- memcpy(ptr, mPixelExecutable->getFunction(), pixelShaderSize);
- ptr += pixelShaderSize;
-
- memcpy(ptr, mVertexExecutable->getFunction(), vertexShaderSize);
- ptr += vertexShaderSize;
-
- if (mGeometryExecutable != NULL && geometryShaderSize > 0)
- {
- memcpy(ptr, mGeometryExecutable->getFunction(), geometryShaderSize);
- ptr += geometryShaderSize;
- }
-
ASSERT(ptr - totalLength == binary);
}
@@ -1916,7 +1456,8 @@ GLint ProgramBinary::getLength()
}
}
-bool ProgramBinary::link(InfoLog &infoLog, const AttributeBindings &attributeBindings, FragmentShader *fragmentShader, VertexShader *vertexShader)
+bool ProgramBinary::link(InfoLog &infoLog, const AttributeBindings &attributeBindings, FragmentShader *fragmentShader, VertexShader *vertexShader,
+ const std::vector<std::string>& transformFeedbackVaryings, GLenum transformFeedbackBufferMode)
{
if (!fragmentShader || !fragmentShader->isCompiled())
{
@@ -1928,19 +1469,34 @@ bool ProgramBinary::link(InfoLog &infoLog, const AttributeBindings &attributeBin
return false;
}
+ mTransformFeedbackLinkedVaryings.clear();
+ mTransformFeedbackBufferMode = transformFeedbackBufferMode;
+
+ mShaderVersion = vertexShader->getShaderVersion();
+
std::string pixelHLSL = fragmentShader->getHLSL();
- std::string vertexHLSL = vertexShader->getHLSL();
+ mVertexHLSL = vertexShader->getHLSL();
+ mVertexWorkarounds = vertexShader->getD3DWorkarounds();
// Map the varyings to the register file
- const Varying *packing[IMPLEMENTATION_MAX_VARYING_VECTORS][4] = {NULL};
- int registers = packVaryings(infoLog, packing, fragmentShader);
+ VaryingPacking packing = { NULL };
+ int registers = mDynamicHLSL->packVaryings(infoLog, packing, fragmentShader, vertexShader, transformFeedbackVaryings);
if (registers < 0)
{
return false;
}
- if (!linkVaryings(infoLog, registers, packing, pixelHLSL, vertexHLSL, fragmentShader, vertexShader))
+ if (!linkVaryings(infoLog, fragmentShader, vertexShader))
+ {
+ return false;
+ }
+
+ mUsesPointSize = vertexShader->usesPointSize();
+ std::vector<LinkedVarying> linkedVaryings;
+ if (!mDynamicHLSL->generateShaderLinkHLSL(infoLog, registers, packing, pixelHLSL, mVertexHLSL,
+ fragmentShader, vertexShader, transformFeedbackVaryings,
+ &linkedVaryings, &mOutputVariables))
{
return false;
}
@@ -1958,35 +1514,59 @@ bool ProgramBinary::link(InfoLog &infoLog, const AttributeBindings &attributeBin
}
// special case for gl_DepthRange, the only built-in uniform (also a struct)
- if (vertexShader->mUsesDepthRange || fragmentShader->mUsesDepthRange)
+ if (vertexShader->usesDepthRange() || fragmentShader->usesDepthRange())
+ {
+ mUniforms.push_back(new LinkedUniform(GL_FLOAT, GL_HIGH_FLOAT, "gl_DepthRange.near", 0, -1, BlockMemberInfo::getDefaultBlockInfo()));
+ mUniforms.push_back(new LinkedUniform(GL_FLOAT, GL_HIGH_FLOAT, "gl_DepthRange.far", 0, -1, BlockMemberInfo::getDefaultBlockInfo()));
+ mUniforms.push_back(new LinkedUniform(GL_FLOAT, GL_HIGH_FLOAT, "gl_DepthRange.diff", 0, -1, BlockMemberInfo::getDefaultBlockInfo()));
+ }
+
+ if (!linkUniformBlocks(infoLog, vertexShader->getInterfaceBlocks(), fragmentShader->getInterfaceBlocks()))
{
- mUniforms.push_back(new Uniform(GL_FLOAT, GL_HIGH_FLOAT, "gl_DepthRange.near", 0));
- mUniforms.push_back(new Uniform(GL_FLOAT, GL_HIGH_FLOAT, "gl_DepthRange.far", 0));
- mUniforms.push_back(new Uniform(GL_FLOAT, GL_HIGH_FLOAT, "gl_DepthRange.diff", 0));
+ success = false;
+ }
+
+ if (!gatherTransformFeedbackLinkedVaryings(infoLog, linkedVaryings, transformFeedbackVaryings,
+ transformFeedbackBufferMode, &mTransformFeedbackLinkedVaryings))
+ {
+ success = false;
}
if (success)
{
- mVertexExecutable = mRenderer->compileToExecutable(infoLog, vertexHLSL.c_str(), rx::SHADER_VERTEX, DiscardWorkaround(vertexShader->mUsesDiscardRewriting));
- mPixelExecutable = mRenderer->compileToExecutable(infoLog, pixelHLSL.c_str(), rx::SHADER_PIXEL, DiscardWorkaround(fragmentShader->mUsesDiscardRewriting));
+ VertexFormat defaultInputLayout[MAX_VERTEX_ATTRIBS];
+ GetInputLayoutFromShader(vertexShader->activeAttributes(), defaultInputLayout);
+
+ rx::ShaderExecutable *defaultVertexExecutable = getVertexExecutableForInputLayout(defaultInputLayout);
+ mPixelExecutable = mRenderer->compileToExecutable(infoLog, pixelHLSL.c_str(), rx::SHADER_PIXEL,
+ mTransformFeedbackLinkedVaryings,
+ (mTransformFeedbackBufferMode == GL_SEPARATE_ATTRIBS),
+ fragmentShader->getD3DWorkarounds());
if (usesGeometryShader())
{
- std::string geometryHLSL = generateGeometryShaderHLSL(registers, packing, fragmentShader, vertexShader);
- mGeometryExecutable = mRenderer->compileToExecutable(infoLog, geometryHLSL.c_str(), rx::SHADER_GEOMETRY, rx::ANGLE_D3D_WORKAROUND_NONE);
+ std::string geometryHLSL = mDynamicHLSL->generateGeometryShaderHLSL(registers, fragmentShader, vertexShader);
+ mGeometryExecutable = mRenderer->compileToExecutable(infoLog, geometryHLSL.c_str(), rx::SHADER_GEOMETRY,
+ mTransformFeedbackLinkedVaryings,
+ (mTransformFeedbackBufferMode == GL_SEPARATE_ATTRIBS),
+ rx::ANGLE_D3D_WORKAROUND_NONE);
}
- if (!mVertexExecutable || !mPixelExecutable || (usesGeometryShader() && !mGeometryExecutable))
+ if (!defaultVertexExecutable || !mPixelExecutable || (usesGeometryShader() && !mGeometryExecutable))
{
infoLog.append("Failed to create D3D shaders.");
success = false;
- delete mVertexExecutable;
- mVertexExecutable = NULL;
- delete mPixelExecutable;
- mPixelExecutable = NULL;
- delete mGeometryExecutable;
- mGeometryExecutable = NULL;
+ while (!mVertexExecutables.empty())
+ {
+ delete mVertexExecutables.back();
+ mVertexExecutables.pop_back();
+ }
+
+ SafeDelete(mGeometryExecutable);
+ SafeDelete(mPixelExecutable);
+
+ mTransformFeedbackLinkedVaryings.clear();
}
}
@@ -1997,62 +1577,75 @@ bool ProgramBinary::link(InfoLog &infoLog, const AttributeBindings &attributeBin
bool ProgramBinary::linkAttributes(InfoLog &infoLog, const AttributeBindings &attributeBindings, FragmentShader *fragmentShader, VertexShader *vertexShader)
{
unsigned int usedLocations = 0;
+ const std::vector<gl::Attribute> &activeAttributes = vertexShader->activeAttributes();
// Link attributes that have a binding location
- for (AttributeArray::iterator attribute = vertexShader->mAttributes.begin(); attribute != vertexShader->mAttributes.end(); attribute++)
+ for (unsigned int attributeIndex = 0; attributeIndex < activeAttributes.size(); attributeIndex++)
{
- int location = attributeBindings.getAttributeBinding(attribute->name);
-
- if (location != -1) // Set by glBindAttribLocation
- {
- if (!mLinkedAttribute[location].name.empty())
- {
- // Multiple active attributes bound to the same location; not an error
- }
+ const gl::Attribute &attribute = activeAttributes[attributeIndex];
+ const int location = attribute.location == -1 ? attributeBindings.getAttributeBinding(attribute.name) : attribute.location;
- mLinkedAttribute[location] = *attribute;
+ mShaderAttributes[attributeIndex] = attribute;
- int rows = VariableRowCount(attribute->type);
+ if (location != -1) // Set by glBindAttribLocation or by location layout qualifier
+ {
+ const int rows = AttributeRegisterCount(attribute.type);
if (rows + location > MAX_VERTEX_ATTRIBS)
{
- infoLog.append("Active attribute (%s) at location %d is too big to fit", attribute->name.c_str(), location);
+ infoLog.append("Active attribute (%s) at location %d is too big to fit", attribute.name.c_str(), location);
return false;
}
- for (int i = 0; i < rows; i++)
+ for (int row = 0; row < rows; row++)
{
- usedLocations |= 1 << (location + i);
+ const int rowLocation = location + row;
+ gl::ShaderVariable &linkedAttribute = mLinkedAttribute[rowLocation];
+
+ // In GLSL 3.00, attribute aliasing produces a link error
+ // In GLSL 1.00, attribute aliasing is allowed
+ if (mShaderVersion >= 300)
+ {
+ if (!linkedAttribute.name.empty())
+ {
+ infoLog.append("Attribute '%s' aliases attribute '%s' at location %d", attribute.name.c_str(), linkedAttribute.name.c_str(), rowLocation);
+ return false;
+ }
+ }
+
+ linkedAttribute = attribute;
+ usedLocations |= 1 << rowLocation;
}
}
}
// Link attributes that don't have a binding location
- for (AttributeArray::iterator attribute = vertexShader->mAttributes.begin(); attribute != vertexShader->mAttributes.end(); attribute++)
+ for (unsigned int attributeIndex = 0; attributeIndex < activeAttributes.size(); attributeIndex++)
{
- int location = attributeBindings.getAttributeBinding(attribute->name);
+ const gl::Attribute &attribute = activeAttributes[attributeIndex];
+ const int location = attribute.location == -1 ? attributeBindings.getAttributeBinding(attribute.name) : attribute.location;
- if (location == -1) // Not set by glBindAttribLocation
+ if (location == -1) // Not set by glBindAttribLocation or by location layout qualifier
{
- int rows = VariableRowCount(attribute->type);
+ int rows = AttributeRegisterCount(attribute.type);
int availableIndex = AllocateFirstFreeBits(&usedLocations, rows, MAX_VERTEX_ATTRIBS);
if (availableIndex == -1 || availableIndex + rows > MAX_VERTEX_ATTRIBS)
{
- infoLog.append("Too many active attributes (%s)", attribute->name.c_str());
+ infoLog.append("Too many active attributes (%s)", attribute.name.c_str());
return false; // Fail to link
}
- mLinkedAttribute[availableIndex] = *attribute;
+ mLinkedAttribute[availableIndex] = attribute;
}
}
for (int attributeIndex = 0; attributeIndex < MAX_VERTEX_ATTRIBS; )
{
int index = vertexShader->getSemanticIndex(mLinkedAttribute[attributeIndex].name);
- int rows = std::max(VariableRowCount(mLinkedAttribute[attributeIndex].type), 1);
+ int rows = AttributeRegisterCount(mLinkedAttribute[attributeIndex].type);
for (int r = 0; r < rows; r++)
{
@@ -2065,34 +1658,248 @@ bool ProgramBinary::linkAttributes(InfoLog &infoLog, const AttributeBindings &at
return true;
}
-bool ProgramBinary::linkUniforms(InfoLog &infoLog, const sh::ActiveUniforms &vertexUniforms, const sh::ActiveUniforms &fragmentUniforms)
+bool ProgramBinary::linkValidateVariablesBase(InfoLog &infoLog, const std::string &variableName, const gl::ShaderVariable &vertexVariable, const gl::ShaderVariable &fragmentVariable, bool validatePrecision)
+{
+ if (vertexVariable.type != fragmentVariable.type)
+ {
+ infoLog.append("Types for %s differ between vertex and fragment shaders", variableName.c_str());
+ return false;
+ }
+ if (vertexVariable.arraySize != fragmentVariable.arraySize)
+ {
+ infoLog.append("Array sizes for %s differ between vertex and fragment shaders", variableName.c_str());
+ return false;
+ }
+ if (validatePrecision && vertexVariable.precision != fragmentVariable.precision)
+ {
+ infoLog.append("Precisions for %s differ between vertex and fragment shaders", variableName.c_str());
+ return false;
+ }
+
+ return true;
+}
+
+template <class ShaderVarType>
+bool ProgramBinary::linkValidateFields(InfoLog &infoLog, const std::string &varName, const ShaderVarType &vertexVar, const ShaderVarType &fragmentVar)
{
- for (sh::ActiveUniforms::const_iterator uniform = vertexUniforms.begin(); uniform != vertexUniforms.end(); uniform++)
+ if (vertexVar.fields.size() != fragmentVar.fields.size())
{
- if (!defineUniform(GL_VERTEX_SHADER, *uniform, infoLog))
+ infoLog.append("Structure lengths for %s differ between vertex and fragment shaders", varName.c_str());
+ return false;
+ }
+ const unsigned int numMembers = vertexVar.fields.size();
+ for (unsigned int memberIndex = 0; memberIndex < numMembers; memberIndex++)
+ {
+ const ShaderVarType &vertexMember = vertexVar.fields[memberIndex];
+ const ShaderVarType &fragmentMember = fragmentVar.fields[memberIndex];
+
+ if (vertexMember.name != fragmentMember.name)
+ {
+ infoLog.append("Name mismatch for field '%d' of %s: (in vertex: '%s', in fragment: '%s')",
+ memberIndex, varName.c_str(), vertexMember.name.c_str(), fragmentMember.name.c_str());
+ return false;
+ }
+
+ const std::string memberName = varName.substr(0, varName.length()-1) + "." + vertexVar.name + "'";
+ if (!linkValidateVariables(infoLog, memberName, vertexMember, fragmentMember))
{
return false;
}
}
- for (sh::ActiveUniforms::const_iterator uniform = fragmentUniforms.begin(); uniform != fragmentUniforms.end(); uniform++)
+ return true;
+}
+
+bool ProgramBinary::linkValidateVariables(InfoLog &infoLog, const std::string &uniformName, const gl::Uniform &vertexUniform, const gl::Uniform &fragmentUniform)
+{
+ if (!linkValidateVariablesBase(infoLog, uniformName, vertexUniform, fragmentUniform, true))
+ {
+ return false;
+ }
+
+ if (!linkValidateFields<gl::Uniform>(infoLog, uniformName, vertexUniform, fragmentUniform))
{
- if (!defineUniform(GL_FRAGMENT_SHADER, *uniform, infoLog))
+ return false;
+ }
+
+ return true;
+}
+
+bool ProgramBinary::linkValidateVariables(InfoLog &infoLog, const std::string &varyingName, const gl::Varying &vertexVarying, const gl::Varying &fragmentVarying)
+{
+ if (!linkValidateVariablesBase(infoLog, varyingName, vertexVarying, fragmentVarying, false))
+ {
+ return false;
+ }
+
+ if (vertexVarying.interpolation != fragmentVarying.interpolation)
+ {
+ infoLog.append("Interpolation types for %s differ between vertex and fragment shaders", varyingName.c_str());
+ return false;
+ }
+
+ if (!linkValidateFields<gl::Varying>(infoLog, varyingName, vertexVarying, fragmentVarying))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ProgramBinary::linkValidateVariables(InfoLog &infoLog, const std::string &uniformName, const gl::InterfaceBlockField &vertexUniform, const gl::InterfaceBlockField &fragmentUniform)
+{
+ if (!linkValidateVariablesBase(infoLog, uniformName, vertexUniform, fragmentUniform, true))
+ {
+ return false;
+ }
+
+ if (vertexUniform.isRowMajorMatrix != fragmentUniform.isRowMajorMatrix)
+ {
+ infoLog.append("Matrix packings for %s differ between vertex and fragment shaders", uniformName.c_str());
+ return false;
+ }
+
+ if (!linkValidateFields<gl::InterfaceBlockField>(infoLog, uniformName, vertexUniform, fragmentUniform))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ProgramBinary::linkUniforms(InfoLog &infoLog, const std::vector<gl::Uniform> &vertexUniforms, const std::vector<gl::Uniform> &fragmentUniforms)
+{
+ // Check that uniforms defined in the vertex and fragment shaders are identical
+ typedef std::map<std::string, const gl::Uniform*> UniformMap;
+ UniformMap linkedUniforms;
+
+ for (unsigned int vertexUniformIndex = 0; vertexUniformIndex < vertexUniforms.size(); vertexUniformIndex++)
+ {
+ const gl::Uniform &vertexUniform = vertexUniforms[vertexUniformIndex];
+ linkedUniforms[vertexUniform.name] = &vertexUniform;
+ }
+
+ for (unsigned int fragmentUniformIndex = 0; fragmentUniformIndex < fragmentUniforms.size(); fragmentUniformIndex++)
+ {
+ const gl::Uniform &fragmentUniform = fragmentUniforms[fragmentUniformIndex];
+ UniformMap::const_iterator entry = linkedUniforms.find(fragmentUniform.name);
+ if (entry != linkedUniforms.end())
+ {
+ const gl::Uniform &vertexUniform = *entry->second;
+ const std::string &uniformName = "uniform '" + vertexUniform.name + "'";
+ if (!linkValidateVariables(infoLog, uniformName, vertexUniform, fragmentUniform))
+ {
+ return false;
+ }
+ }
+ }
+
+ for (unsigned int uniformIndex = 0; uniformIndex < vertexUniforms.size(); uniformIndex++)
+ {
+ if (!defineUniform(GL_VERTEX_SHADER, vertexUniforms[uniformIndex], infoLog))
{
return false;
}
}
+ for (unsigned int uniformIndex = 0; uniformIndex < fragmentUniforms.size(); uniformIndex++)
+ {
+ if (!defineUniform(GL_FRAGMENT_SHADER, fragmentUniforms[uniformIndex], infoLog))
+ {
+ return false;
+ }
+ }
+
+ initializeUniformStorage();
+
return true;
}
-bool ProgramBinary::defineUniform(GLenum shader, const sh::Uniform &constant, InfoLog &infoLog)
+TextureType ProgramBinary::getTextureType(GLenum samplerType, InfoLog &infoLog)
{
- if (constant.type == GL_SAMPLER_2D ||
- constant.type == GL_SAMPLER_CUBE)
+ switch(samplerType)
+ {
+ case GL_SAMPLER_2D:
+ case GL_INT_SAMPLER_2D:
+ case GL_UNSIGNED_INT_SAMPLER_2D:
+ case GL_SAMPLER_2D_SHADOW:
+ return TEXTURE_2D;
+ case GL_SAMPLER_3D:
+ case GL_INT_SAMPLER_3D:
+ case GL_UNSIGNED_INT_SAMPLER_3D:
+ return TEXTURE_3D;
+ case GL_SAMPLER_CUBE:
+ case GL_SAMPLER_CUBE_SHADOW:
+ return TEXTURE_CUBE;
+ case GL_INT_SAMPLER_CUBE:
+ case GL_UNSIGNED_INT_SAMPLER_CUBE:
+ return TEXTURE_CUBE;
+ case GL_SAMPLER_2D_ARRAY:
+ case GL_INT_SAMPLER_2D_ARRAY:
+ case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
+ case GL_SAMPLER_2D_ARRAY_SHADOW:
+ return TEXTURE_2D_ARRAY;
+ default: UNREACHABLE();
+ }
+
+ return TEXTURE_2D;
+}
+
+bool ProgramBinary::defineUniform(GLenum shader, const gl::Uniform &constant, InfoLog &infoLog)
+{
+ if (constant.isStruct())
+ {
+ if (constant.arraySize > 0)
+ {
+ ShShaderOutput outputType = Shader::getCompilerOutputType(shader);
+ const unsigned int elementRegisterCount = HLSLVariableRegisterCount(constant, outputType) / constant.arraySize;
+
+ for (unsigned int elementIndex = 0; elementIndex < constant.arraySize; elementIndex++)
+ {
+ const unsigned int elementRegisterOffset = elementRegisterCount * elementIndex;
+
+ for (size_t fieldIndex = 0; fieldIndex < constant.fields.size(); fieldIndex++)
+ {
+ const gl::Uniform &field = constant.fields[fieldIndex];
+ const std::string &uniformName = constant.name + ArrayString(elementIndex) + "." + field.name;
+ const unsigned int fieldRegisterIndex = field.registerIndex + elementRegisterOffset;
+ gl::Uniform fieldUniform(field.type, field.precision, uniformName.c_str(), field.arraySize,
+ fieldRegisterIndex, field.elementIndex);
+
+ fieldUniform.fields = field.fields;
+ if (!defineUniform(shader, fieldUniform, infoLog))
+ {
+ return false;
+ }
+ }
+ }
+ }
+ else
+ {
+ for (size_t fieldIndex = 0; fieldIndex < constant.fields.size(); fieldIndex++)
+ {
+ const gl::Uniform &field = constant.fields[fieldIndex];
+ const std::string &uniformName = constant.name + "." + field.name;
+
+ gl::Uniform fieldUniform(field.type, field.precision, uniformName.c_str(), field.arraySize,
+ field.registerIndex, field.elementIndex);
+
+ fieldUniform.fields = field.fields;
+
+ if (!defineUniform(shader, fieldUniform, infoLog))
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ if (IsSampler(constant.type))
{
unsigned int samplerIndex = constant.registerIndex;
-
+
do
{
if (shader == GL_VERTEX_SHADER)
@@ -2100,7 +1907,7 @@ bool ProgramBinary::defineUniform(GLenum shader, const sh::Uniform &constant, In
if (samplerIndex < mRenderer->getMaxVertexTextureImageUnits())
{
mSamplersVS[samplerIndex].active = true;
- mSamplersVS[samplerIndex].textureType = (constant.type == GL_SAMPLER_CUBE) ? TEXTURE_CUBE : TEXTURE_2D;
+ mSamplersVS[samplerIndex].textureType = getTextureType(constant.type, infoLog);
mSamplersVS[samplerIndex].logicalTextureUnit = 0;
mUsedVertexSamplerRange = std::max(samplerIndex + 1, mUsedVertexSamplerRange);
}
@@ -2115,7 +1922,7 @@ bool ProgramBinary::defineUniform(GLenum shader, const sh::Uniform &constant, In
if (samplerIndex < MAX_TEXTURE_IMAGE_UNITS)
{
mSamplersPS[samplerIndex].active = true;
- mSamplersPS[samplerIndex].textureType = (constant.type == GL_SAMPLER_CUBE) ? TEXTURE_CUBE : TEXTURE_2D;
+ mSamplersPS[samplerIndex].textureType = getTextureType(constant.type, infoLog);
mSamplersPS[samplerIndex].logicalTextureUnit = 0;
mUsedPixelSamplerRange = std::max(samplerIndex + 1, mUsedPixelSamplerRange);
}
@@ -2132,28 +1939,18 @@ bool ProgramBinary::defineUniform(GLenum shader, const sh::Uniform &constant, In
while (samplerIndex < constant.registerIndex + constant.arraySize);
}
- Uniform *uniform = NULL;
+ LinkedUniform *uniform = NULL;
GLint location = getUniformLocation(constant.name);
if (location >= 0) // Previously defined, type and precision must match
{
uniform = mUniforms[mUniformIndex[location].index];
-
- if (uniform->type != constant.type)
- {
- infoLog.append("Types for uniform %s do not match between the vertex and fragment shader", uniform->name.c_str());
- return false;
- }
-
- if (uniform->precision != constant.precision)
- {
- infoLog.append("Precisions for uniform %s do not match between the vertex and fragment shader", uniform->name.c_str());
- return false;
- }
}
else
{
- uniform = new Uniform(constant.type, constant.precision, constant.name, constant.arraySize);
+ uniform = new LinkedUniform(constant.type, constant.precision, constant.name, constant.arraySize,
+ -1, BlockMemberInfo::getDefaultBlockInfo());
+ uniform->registerElement = constant.elementIndex;
}
if (!uniform)
@@ -2179,9 +1976,9 @@ bool ProgramBinary::defineUniform(GLenum shader, const sh::Uniform &constant, In
mUniforms.push_back(uniform);
unsigned int uniformIndex = mUniforms.size() - 1;
- for (unsigned int i = 0; i < uniform->elementCount(); i++)
+ for (unsigned int arrayElementIndex = 0; arrayElementIndex < uniform->elementCount(); arrayElementIndex++)
{
- mUniformIndex.push_back(UniformLocation(constant.name, i, uniformIndex));
+ mUniformIndex.push_back(VariableLocation(uniform->name, arrayElementIndex, uniformIndex));
}
if (shader == GL_VERTEX_SHADER)
@@ -2205,155 +2002,271 @@ bool ProgramBinary::defineUniform(GLenum shader, const sh::Uniform &constant, In
return true;
}
-std::string ProgramBinary::generateGeometryShaderHLSL(int registers, const Varying *packing[][4], FragmentShader *fragmentShader, VertexShader *vertexShader) const
+bool ProgramBinary::areMatchingInterfaceBlocks(InfoLog &infoLog, const gl::InterfaceBlock &vertexInterfaceBlock, const gl::InterfaceBlock &fragmentInterfaceBlock)
{
- // for now we only handle point sprite emulation
- ASSERT(usesPointSpriteEmulation());
- return generatePointSpriteHLSL(registers, packing, fragmentShader, vertexShader);
-}
+ const char* blockName = vertexInterfaceBlock.name.c_str();
-std::string ProgramBinary::generatePointSpriteHLSL(int registers, const Varying *packing[][4], FragmentShader *fragmentShader, VertexShader *vertexShader) const
-{
- ASSERT(registers >= 0);
- ASSERT(vertexShader->mUsesPointSize);
- ASSERT(mRenderer->getMajorShaderModel() >= 4);
+ // validate blocks for the same member types
+ if (vertexInterfaceBlock.fields.size() != fragmentInterfaceBlock.fields.size())
+ {
+ infoLog.append("Types for interface block '%s' differ between vertex and fragment shaders", blockName);
+ return false;
+ }
- std::string geomHLSL;
+ if (vertexInterfaceBlock.arraySize != fragmentInterfaceBlock.arraySize)
+ {
+ infoLog.append("Array sizes differ for interface block '%s' between vertex and fragment shaders", blockName);
+ return false;
+ }
- std::string varyingSemantic = "TEXCOORD";
+ if (vertexInterfaceBlock.layout != fragmentInterfaceBlock.layout || vertexInterfaceBlock.isRowMajorLayout != fragmentInterfaceBlock.isRowMajorLayout)
+ {
+ infoLog.append("Layout qualifiers differ for interface block '%s' between vertex and fragment shaders", blockName);
+ return false;
+ }
- std::string fragCoordSemantic;
- std::string pointCoordSemantic;
+ const unsigned int numBlockMembers = vertexInterfaceBlock.fields.size();
+ for (unsigned int blockMemberIndex = 0; blockMemberIndex < numBlockMembers; blockMemberIndex++)
+ {
+ const gl::InterfaceBlockField &vertexMember = vertexInterfaceBlock.fields[blockMemberIndex];
+ const gl::InterfaceBlockField &fragmentMember = fragmentInterfaceBlock.fields[blockMemberIndex];
- int reservedRegisterIndex = registers;
+ if (vertexMember.name != fragmentMember.name)
+ {
+ infoLog.append("Name mismatch for field %d of interface block '%s': (in vertex: '%s', in fragment: '%s')",
+ blockMemberIndex, blockName, vertexMember.name.c_str(), fragmentMember.name.c_str());
+ return false;
+ }
- if (fragmentShader->mUsesFragCoord)
- {
- fragCoordSemantic = varyingSemantic + str(reservedRegisterIndex++);
+ std::string uniformName = "interface block '" + vertexInterfaceBlock.name + "' member '" + vertexMember.name + "'";
+ if (!linkValidateVariables(infoLog, uniformName, vertexMember, fragmentMember))
+ {
+ return false;
+ }
}
- if (fragmentShader->mUsesPointCoord)
+ return true;
+}
+
+bool ProgramBinary::linkUniformBlocks(InfoLog &infoLog, const std::vector<gl::InterfaceBlock> &vertexInterfaceBlocks,
+ const std::vector<gl::InterfaceBlock> &fragmentInterfaceBlocks)
+{
+ // Check that interface blocks defined in the vertex and fragment shaders are identical
+ typedef std::map<std::string, const gl::InterfaceBlock*> UniformBlockMap;
+ UniformBlockMap linkedUniformBlocks;
+
+ for (unsigned int blockIndex = 0; blockIndex < vertexInterfaceBlocks.size(); blockIndex++)
{
- pointCoordSemantic = varyingSemantic + str(reservedRegisterIndex++);
+ const gl::InterfaceBlock &vertexInterfaceBlock = vertexInterfaceBlocks[blockIndex];
+ linkedUniformBlocks[vertexInterfaceBlock.name] = &vertexInterfaceBlock;
}
- geomHLSL += "uniform float4 dx_ViewCoords : register(c1);\n"
- "\n"
- "struct GS_INPUT\n"
- "{\n";
-
- for (int r = 0; r < registers; r++)
+ for (unsigned int blockIndex = 0; blockIndex < fragmentInterfaceBlocks.size(); blockIndex++)
{
- int registerSize = packing[r][3] ? 4 : (packing[r][2] ? 3 : (packing[r][1] ? 2 : 1));
+ const gl::InterfaceBlock &fragmentInterfaceBlock = fragmentInterfaceBlocks[blockIndex];
+ UniformBlockMap::const_iterator entry = linkedUniformBlocks.find(fragmentInterfaceBlock.name);
+ if (entry != linkedUniformBlocks.end())
+ {
+ const gl::InterfaceBlock &vertexInterfaceBlock = *entry->second;
+ if (!areMatchingInterfaceBlocks(infoLog, vertexInterfaceBlock, fragmentInterfaceBlock))
+ {
+ return false;
+ }
+ }
+ }
- geomHLSL += " float" + str(registerSize) + " v" + str(r) + " : " + varyingSemantic + str(r) + ";\n";
+ for (unsigned int blockIndex = 0; blockIndex < vertexInterfaceBlocks.size(); blockIndex++)
+ {
+ if (!defineUniformBlock(infoLog, GL_VERTEX_SHADER, vertexInterfaceBlocks[blockIndex]))
+ {
+ return false;
+ }
}
- if (fragmentShader->mUsesFragCoord)
+ for (unsigned int blockIndex = 0; blockIndex < fragmentInterfaceBlocks.size(); blockIndex++)
{
- geomHLSL += " float4 gl_FragCoord : " + fragCoordSemantic + ";\n";
+ if (!defineUniformBlock(infoLog, GL_FRAGMENT_SHADER, fragmentInterfaceBlocks[blockIndex]))
+ {
+ return false;
+ }
}
- geomHLSL += " float gl_PointSize : PSIZE;\n"
- " float4 gl_Position : SV_Position;\n"
- "};\n"
- "\n"
- "struct GS_OUTPUT\n"
- "{\n";
+ return true;
+}
+
+bool ProgramBinary::gatherTransformFeedbackLinkedVaryings(InfoLog &infoLog, const std::vector<LinkedVarying> &linkedVaryings,
+ const std::vector<std::string> &transformFeedbackVaryingNames,
+ GLenum transformFeedbackBufferMode,
+ std::vector<LinkedVarying> *outTransformFeedbackLinkedVaryings) const
+{
+ size_t totalComponents = 0;
+ const size_t maxSeparateComponents = mRenderer->getMaxTransformFeedbackSeparateComponents();
+ const size_t maxInterleavedComponents = mRenderer->getMaxTransformFeedbackInterleavedComponents();
- for (int r = 0; r < registers; r++)
+ // Gather the linked varyings that are used for transform feedback, they should all exist.
+ outTransformFeedbackLinkedVaryings->clear();
+ for (size_t i = 0; i < transformFeedbackVaryingNames.size(); i++)
{
- int registerSize = packing[r][3] ? 4 : (packing[r][2] ? 3 : (packing[r][1] ? 2 : 1));
+ bool found = false;
+ for (size_t j = 0; j < linkedVaryings.size(); j++)
+ {
+ if (transformFeedbackVaryingNames[i] == linkedVaryings[j].name)
+ {
+ for (size_t k = 0; k < outTransformFeedbackLinkedVaryings->size(); k++)
+ {
+ if (outTransformFeedbackLinkedVaryings->at(k).name == linkedVaryings[j].name)
+ {
+ infoLog.append("Two transform feedback varyings specify the same output variable (%s).", linkedVaryings[j].name.c_str());
+ return false;
+ }
+ }
- geomHLSL += " float" + str(registerSize) + " v" + str(r) + " : " + varyingSemantic + str(r) + ";\n";
- }
+ size_t componentCount = linkedVaryings[j].semanticIndexCount * 4;
+ if (transformFeedbackBufferMode == GL_SEPARATE_ATTRIBS &&
+ componentCount > maxSeparateComponents)
+ {
+ infoLog.append("Transform feedback varying's %s components (%u) exceed the maximum separate components (%u).",
+ linkedVaryings[j].name.c_str(), componentCount, maxSeparateComponents);
+ return false;
+ }
- if (fragmentShader->mUsesFragCoord)
- {
- geomHLSL += " float4 gl_FragCoord : " + fragCoordSemantic + ";\n";
+ totalComponents += componentCount;
+
+ outTransformFeedbackLinkedVaryings->push_back(linkedVaryings[j]);
+ found = true;
+ break;
+ }
+ }
+
+ // All transform feedback varyings are expected to exist since packVaryings checks for them.
+ ASSERT(found);
}
- if (fragmentShader->mUsesPointCoord)
+ if (transformFeedbackBufferMode == GL_INTERLEAVED_ATTRIBS && totalComponents > maxInterleavedComponents)
{
- geomHLSL += " float2 gl_PointCoord : " + pointCoordSemantic + ";\n";
+ infoLog.append("Transform feedback varying total components (%u) exceed the maximum interleaved components (%u).",
+ totalComponents, maxInterleavedComponents);
+ return false;
}
- geomHLSL += " float gl_PointSize : PSIZE;\n"
- " float4 gl_Position : SV_Position;\n"
- "};\n"
- "\n"
- "static float2 pointSpriteCorners[] = \n"
- "{\n"
- " float2( 0.5f, -0.5f),\n"
- " float2( 0.5f, 0.5f),\n"
- " float2(-0.5f, -0.5f),\n"
- " float2(-0.5f, 0.5f)\n"
- "};\n"
- "\n"
- "static float2 pointSpriteTexcoords[] = \n"
- "{\n"
- " float2(1.0f, 1.0f),\n"
- " float2(1.0f, 0.0f),\n"
- " float2(0.0f, 1.0f),\n"
- " float2(0.0f, 0.0f)\n"
- "};\n"
- "\n"
- "static float minPointSize = " + str(ALIASED_POINT_SIZE_RANGE_MIN) + ".0f;\n"
- "static float maxPointSize = " + str(mRenderer->getMaxPointSize()) + ".0f;\n"
- "\n"
- "[maxvertexcount(4)]\n"
- "void main(point GS_INPUT input[1], inout TriangleStream<GS_OUTPUT> outStream)\n"
- "{\n"
- " GS_OUTPUT output = (GS_OUTPUT)0;\n"
- " output.gl_PointSize = input[0].gl_PointSize;\n";
+ return true;
+}
- for (int r = 0; r < registers; r++)
+void ProgramBinary::defineUniformBlockMembers(const std::vector<gl::InterfaceBlockField> &fields, const std::string &prefix, int blockIndex, BlockInfoItr *blockInfoItr, std::vector<unsigned int> *blockUniformIndexes)
+{
+ for (unsigned int uniformIndex = 0; uniformIndex < fields.size(); uniformIndex++)
{
- geomHLSL += " output.v" + str(r) + " = input[0].v" + str(r) + ";\n";
+ const gl::InterfaceBlockField &field = fields[uniformIndex];
+ const std::string &fieldName = (prefix.empty() ? field.name : prefix + "." + field.name);
+
+ if (!field.fields.empty())
+ {
+ if (field.arraySize > 0)
+ {
+ for (unsigned int arrayElement = 0; arrayElement < field.arraySize; arrayElement++)
+ {
+ const std::string uniformElementName = fieldName + ArrayString(arrayElement);
+ defineUniformBlockMembers(field.fields, uniformElementName, blockIndex, blockInfoItr, blockUniformIndexes);
+ }
+ }
+ else
+ {
+ defineUniformBlockMembers(field.fields, fieldName, blockIndex, blockInfoItr, blockUniformIndexes);
+ }
+ }
+ else
+ {
+ LinkedUniform *newUniform = new LinkedUniform(field.type, field.precision, fieldName, field.arraySize,
+ blockIndex, **blockInfoItr);
+
+ // add to uniform list, but not index, since uniform block uniforms have no location
+ blockUniformIndexes->push_back(mUniforms.size());
+ mUniforms.push_back(newUniform);
+ (*blockInfoItr)++;
+ }
}
+}
- if (fragmentShader->mUsesFragCoord)
+bool ProgramBinary::defineUniformBlock(InfoLog &infoLog, GLenum shader, const gl::InterfaceBlock &interfaceBlock)
+{
+ // create uniform block entries if they do not exist
+ if (getUniformBlockIndex(interfaceBlock.name) == GL_INVALID_INDEX)
{
- geomHLSL += " output.gl_FragCoord = input[0].gl_FragCoord;\n";
+ std::vector<unsigned int> blockUniformIndexes;
+ const unsigned int blockIndex = mUniformBlocks.size();
+
+ // define member uniforms
+ BlockInfoItr blockInfoItr = interfaceBlock.blockInfo.cbegin();
+ defineUniformBlockMembers(interfaceBlock.fields, "", blockIndex, &blockInfoItr, &blockUniformIndexes);
+
+ // create all the uniform blocks
+ if (interfaceBlock.arraySize > 0)
+ {
+ for (unsigned int uniformBlockElement = 0; uniformBlockElement < interfaceBlock.arraySize; uniformBlockElement++)
+ {
+ gl::UniformBlock *newUniformBlock = new UniformBlock(interfaceBlock.name, uniformBlockElement, interfaceBlock.dataSize);
+ newUniformBlock->memberUniformIndexes = blockUniformIndexes;
+ mUniformBlocks.push_back(newUniformBlock);
+ }
+ }
+ else
+ {
+ gl::UniformBlock *newUniformBlock = new UniformBlock(interfaceBlock.name, GL_INVALID_INDEX, interfaceBlock.dataSize);
+ newUniformBlock->memberUniformIndexes = blockUniformIndexes;
+ mUniformBlocks.push_back(newUniformBlock);
+ }
}
- geomHLSL += " \n"
- " float gl_PointSize = clamp(input[0].gl_PointSize, minPointSize, maxPointSize);\n"
- " float4 gl_Position = input[0].gl_Position;\n"
- " float2 viewportScale = float2(1.0f / dx_ViewCoords.x, 1.0f / dx_ViewCoords.y) * gl_Position.w;\n";
+ // Assign registers to the uniform blocks
+ const GLuint blockIndex = getUniformBlockIndex(interfaceBlock.name);
+ const unsigned int elementCount = std::max(1u, interfaceBlock.arraySize);
+ ASSERT(blockIndex != GL_INVALID_INDEX);
+ ASSERT(blockIndex + elementCount <= mUniformBlocks.size());
- for (int corner = 0; corner < 4; corner++)
+ for (unsigned int uniformBlockElement = 0; uniformBlockElement < elementCount; uniformBlockElement++)
{
- geomHLSL += " \n"
- " output.gl_Position = gl_Position + float4(pointSpriteCorners[" + str(corner) + "] * viewportScale * gl_PointSize, 0.0f, 0.0f);\n";
+ gl::UniformBlock *uniformBlock = mUniformBlocks[blockIndex + uniformBlockElement];
+ ASSERT(uniformBlock->name == interfaceBlock.name);
- if (fragmentShader->mUsesPointCoord)
+ if (!assignUniformBlockRegister(infoLog, uniformBlock, shader, interfaceBlock.registerIndex + uniformBlockElement))
{
- geomHLSL += " output.gl_PointCoord = pointSpriteTexcoords[" + str(corner) + "];\n";
+ return false;
}
-
- geomHLSL += " outStream.Append(output);\n";
}
- geomHLSL += " \n"
- " outStream.RestartStrip();\n"
- "}\n";
-
- return geomHLSL;
+ return true;
}
-// This method needs to match OutputHLSL::decorate
-std::string ProgramBinary::decorateAttribute(const std::string &name)
+bool ProgramBinary::assignUniformBlockRegister(InfoLog &infoLog, UniformBlock *uniformBlock, GLenum shader, unsigned int registerIndex)
{
- if (name.compare(0, 3, "gl_") != 0 && name.compare(0, 3, "dx_") != 0)
+ if (shader == GL_VERTEX_SHADER)
{
- return "_" + name;
+ uniformBlock->vsRegisterIndex = registerIndex;
+ unsigned int maximumBlocks = mRenderer->getMaxVertexShaderUniformBuffers();
+
+ if (registerIndex - mRenderer->getReservedVertexUniformBuffers() >= maximumBlocks)
+ {
+ infoLog.append("Vertex shader uniform block count exceed GL_MAX_VERTEX_UNIFORM_BLOCKS (%u)", maximumBlocks);
+ return false;
+ }
}
-
- return name;
+ else if (shader == GL_FRAGMENT_SHADER)
+ {
+ uniformBlock->psRegisterIndex = registerIndex;
+ unsigned int maximumBlocks = mRenderer->getMaxFragmentShaderUniformBuffers();
+
+ if (registerIndex - mRenderer->getReservedFragmentUniformBuffers() >= maximumBlocks)
+ {
+ infoLog.append("Fragment shader uniform block count exceed GL_MAX_FRAGMENT_UNIFORM_BLOCKS (%u)", maximumBlocks);
+ return false;
+ }
+ }
+ else UNREACHABLE();
+
+ return true;
}
-bool ProgramBinary::isValidated() const
+bool ProgramBinary::isValidated() const
{
return mValidated;
}
@@ -2479,6 +2392,128 @@ GLint ProgramBinary::getActiveUniformMaxLength() const
return maxLength;
}
+GLint ProgramBinary::getActiveUniformi(GLuint index, GLenum pname) const
+{
+ const gl::LinkedUniform& uniform = *mUniforms[index];
+
+ switch (pname)
+ {
+ case GL_UNIFORM_TYPE: return static_cast<GLint>(uniform.type);
+ case GL_UNIFORM_SIZE: return static_cast<GLint>(uniform.elementCount());
+ case GL_UNIFORM_NAME_LENGTH: return static_cast<GLint>(uniform.name.size() + 1 + (uniform.isArray() ? 3 : 0));
+ case GL_UNIFORM_BLOCK_INDEX: return uniform.blockIndex;
+
+ case GL_UNIFORM_OFFSET: return uniform.blockInfo.offset;
+ case GL_UNIFORM_ARRAY_STRIDE: return uniform.blockInfo.arrayStride;
+ case GL_UNIFORM_MATRIX_STRIDE: return uniform.blockInfo.matrixStride;
+ case GL_UNIFORM_IS_ROW_MAJOR: return static_cast<GLint>(uniform.blockInfo.isRowMajorMatrix);
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+ return 0;
+}
+
+bool ProgramBinary::isValidUniformLocation(GLint location) const
+{
+ ASSERT(rx::IsIntegerCastSafe<GLint>(mUniformIndex.size()));
+ return (location >= 0 && location < static_cast<GLint>(mUniformIndex.size()));
+}
+
+LinkedUniform *ProgramBinary::getUniformByLocation(GLint location) const
+{
+ ASSERT(location >= 0 && static_cast<size_t>(location) < mUniformIndex.size());
+ return mUniforms[mUniformIndex[location].index];
+}
+
+void ProgramBinary::getActiveUniformBlockName(GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName) const
+{
+ ASSERT(uniformBlockIndex < mUniformBlocks.size()); // index must be smaller than getActiveUniformBlockCount()
+
+ const UniformBlock &uniformBlock = *mUniformBlocks[uniformBlockIndex];
+
+ if (bufSize > 0)
+ {
+ std::string string = uniformBlock.name;
+
+ if (uniformBlock.isArrayElement())
+ {
+ string += ArrayString(uniformBlock.elementIndex);
+ }
+
+ strncpy(uniformBlockName, string.c_str(), bufSize);
+ uniformBlockName[bufSize - 1] = '\0';
+
+ if (length)
+ {
+ *length = strlen(uniformBlockName);
+ }
+ }
+}
+
+void ProgramBinary::getActiveUniformBlockiv(GLuint uniformBlockIndex, GLenum pname, GLint *params) const
+{
+ ASSERT(uniformBlockIndex < mUniformBlocks.size()); // index must be smaller than getActiveUniformBlockCount()
+
+ const UniformBlock &uniformBlock = *mUniformBlocks[uniformBlockIndex];
+
+ switch (pname)
+ {
+ case GL_UNIFORM_BLOCK_DATA_SIZE:
+ *params = static_cast<GLint>(uniformBlock.dataSize);
+ break;
+ case GL_UNIFORM_BLOCK_NAME_LENGTH:
+ *params = static_cast<GLint>(uniformBlock.name.size() + 1 + (uniformBlock.isArrayElement() ? 3 : 0));
+ break;
+ case GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS:
+ *params = static_cast<GLint>(uniformBlock.memberUniformIndexes.size());
+ break;
+ case GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:
+ {
+ for (unsigned int blockMemberIndex = 0; blockMemberIndex < uniformBlock.memberUniformIndexes.size(); blockMemberIndex++)
+ {
+ params[blockMemberIndex] = static_cast<GLint>(uniformBlock.memberUniformIndexes[blockMemberIndex]);
+ }
+ }
+ break;
+ case GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:
+ *params = static_cast<GLint>(uniformBlock.isReferencedByVertexShader());
+ break;
+ case GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:
+ *params = static_cast<GLint>(uniformBlock.isReferencedByFragmentShader());
+ break;
+ default: UNREACHABLE();
+ }
+}
+
+GLuint ProgramBinary::getActiveUniformBlockCount() const
+{
+ return mUniformBlocks.size();
+}
+
+GLuint ProgramBinary::getActiveUniformBlockMaxLength() const
+{
+ unsigned int maxLength = 0;
+
+ unsigned int numUniformBlocks = mUniformBlocks.size();
+ for (unsigned int uniformBlockIndex = 0; uniformBlockIndex < numUniformBlocks; uniformBlockIndex++)
+ {
+ const UniformBlock &uniformBlock = *mUniformBlocks[uniformBlockIndex];
+ if (!uniformBlock.name.empty())
+ {
+ const unsigned int length = uniformBlock.name.length() + 1;
+
+ // Counting in "[0]".
+ const unsigned int arrayLength = (uniformBlock.isArrayElement() ? 3 : 0);
+
+ maxLength = std::max(length + arrayLength, maxLength);
+ }
+ }
+
+ return maxLength;
+}
+
void ProgramBinary::validate(InfoLog &infoLog)
{
applyUniforms();
@@ -2511,7 +2546,7 @@ bool ProgramBinary::validateSamplers(InfoLog *infoLog)
if (mSamplersPS[i].active)
{
unsigned int unit = mSamplersPS[i].logicalTextureUnit;
-
+
if (unit >= maxCombinedTextureImageUnits)
{
if (infoLog)
@@ -2546,7 +2581,7 @@ bool ProgramBinary::validateSamplers(InfoLog *infoLog)
if (mSamplersVS[i].active)
{
unsigned int unit = mSamplersVS[i].logicalTextureUnit;
-
+
if (unit >= maxCombinedTextureImageUnits)
{
if (infoLog)
@@ -2592,7 +2627,9 @@ struct AttributeSorter
bool operator()(int a, int b)
{
- return originalIndices[a] == -1 ? false : originalIndices[a] < originalIndices[b];
+ if (originalIndices[a] == -1) return false;
+ if (originalIndices[b] == -1) return true;
+ return (originalIndices[a] < originalIndices[b]);
}
const int (&originalIndices)[MAX_VERTEX_ATTRIBS];
@@ -2625,4 +2662,30 @@ void ProgramBinary::sortAttributesByLayout(rx::TranslatedAttribute attributes[MA
}
}
+void ProgramBinary::initializeUniformStorage()
+{
+ // Compute total default block size
+ unsigned int vertexRegisters = 0;
+ unsigned int fragmentRegisters = 0;
+ for (size_t uniformIndex = 0; uniformIndex < mUniforms.size(); uniformIndex++)
+ {
+ const LinkedUniform &uniform = *mUniforms[uniformIndex];
+
+ if (!IsSampler(uniform.type))
+ {
+ if (uniform.isReferencedByVertexShader())
+ {
+ vertexRegisters = std::max(vertexRegisters, uniform.vsRegisterIndex + uniform.registerCount);
+ }
+ if (uniform.isReferencedByFragmentShader())
+ {
+ fragmentRegisters = std::max(fragmentRegisters, uniform.psRegisterIndex + uniform.registerCount);
+ }
+ }
+ }
+
+ mVertexUniformStorage = mRenderer->createUniformStorage(vertexRegisters * 16u);
+ mFragmentUniformStorage = mRenderer->createUniformStorage(fragmentRegisters * 16u);
+}
+
}
diff --git a/chromium/third_party/angle/src/libGLESv2/ProgramBinary.h b/chromium/third_party/angle/src/libGLESv2/ProgramBinary.h
index d6320863f2b..839923b68c2 100644
--- a/chromium/third_party/angle/src/libGLESv2/ProgramBinary.h
+++ b/chromium/third_party/angle/src/libGLESv2/ProgramBinary.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -10,7 +10,8 @@
#ifndef LIBGLESV2_PROGRAM_BINARY_H_
#define LIBGLESV2_PROGRAM_BINARY_H_
-#define GL_APICALL
+#include <GLES3/gl3.h>
+#include <GLES3/gl3ext.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
@@ -19,16 +20,19 @@
#include "common/RefCountObject.h"
#include "angletypes.h"
-#include "libGLESv2/mathutil.h"
+#include "common/mathutil.h"
#include "libGLESv2/Uniform.h"
#include "libGLESv2/Shader.h"
#include "libGLESv2/Constants.h"
+#include "libGLESv2/renderer/VertexDataManager.h"
namespace rx
{
class ShaderExecutable;
class Renderer;
struct TranslatedAttribute;
+class UniformStorage;
+class DynamicHLSL;
}
namespace gl
@@ -37,22 +41,40 @@ class FragmentShader;
class VertexShader;
class InfoLog;
class AttributeBindings;
-struct Varying;
+class Buffer;
// Struct used for correlating uniforms/elements of uniform arrays to handles
-struct UniformLocation
+struct VariableLocation
{
- UniformLocation()
+ VariableLocation()
{
}
- UniformLocation(const std::string &name, unsigned int element, unsigned int index);
+ VariableLocation(const std::string &name, unsigned int element, unsigned int index);
std::string name;
unsigned int element;
unsigned int index;
};
+struct LinkedVarying
+{
+ LinkedVarying();
+ LinkedVarying(const std::string &name, GLenum type, GLsizei size, const std::string &semanticName,
+ unsigned int semanticIndex, unsigned int semanticIndexCount);
+
+ // Original GL name
+ std::string name;
+
+ GLenum type;
+ GLsizei size;
+
+ // DirectX semantic information
+ std::string semanticName;
+ unsigned int semanticIndex;
+ unsigned int semanticIndexCount;
+};
+
// This is the result of linking a program. It is the state that would be passed to ProgramBinary.
class ProgramBinary : public RefCountObject
{
@@ -60,9 +82,9 @@ class ProgramBinary : public RefCountObject
explicit ProgramBinary(rx::Renderer *renderer);
~ProgramBinary();
- rx::ShaderExecutable *getPixelExecutable();
- rx::ShaderExecutable *getVertexExecutable();
- rx::ShaderExecutable *getGeometryExecutable();
+ rx::ShaderExecutable *getPixelExecutable() const;
+ rx::ShaderExecutable *getVertexExecutableForInputLayout(const VertexFormat inputLayout[MAX_VERTEX_ATTRIBS]);
+ rx::ShaderExecutable *getGeometryExecutable() const;
GLuint getAttributeLocation(const char *name);
int getSemanticIndex(int attributeIndex);
@@ -75,29 +97,44 @@ class ProgramBinary : public RefCountObject
bool usesGeometryShader() const;
GLint getUniformLocation(std::string name);
- bool setUniform1fv(GLint location, GLsizei count, const GLfloat *v);
- bool setUniform2fv(GLint location, GLsizei count, const GLfloat *v);
- bool setUniform3fv(GLint location, GLsizei count, const GLfloat *v);
- bool setUniform4fv(GLint location, GLsizei count, const GLfloat *v);
- bool setUniformMatrix2fv(GLint location, GLsizei count, const GLfloat *value);
- bool setUniformMatrix3fv(GLint location, GLsizei count, const GLfloat *value);
- bool setUniformMatrix4fv(GLint location, GLsizei count, const GLfloat *value);
- bool setUniform1iv(GLint location, GLsizei count, const GLint *v);
- bool setUniform2iv(GLint location, GLsizei count, const GLint *v);
- bool setUniform3iv(GLint location, GLsizei count, const GLint *v);
- bool setUniform4iv(GLint location, GLsizei count, const GLint *v);
+ GLuint getUniformIndex(std::string name);
+ GLuint getUniformBlockIndex(std::string name);
+ void setUniform1fv(GLint location, GLsizei count, const GLfloat *v);
+ void setUniform2fv(GLint location, GLsizei count, const GLfloat *v);
+ void setUniform3fv(GLint location, GLsizei count, const GLfloat *v);
+ void setUniform4fv(GLint location, GLsizei count, const GLfloat *v);
+ void setUniform1iv(GLint location, GLsizei count, const GLint *v);
+ void setUniform2iv(GLint location, GLsizei count, const GLint *v);
+ void setUniform3iv(GLint location, GLsizei count, const GLint *v);
+ void setUniform4iv(GLint location, GLsizei count, const GLint *v);
+ void setUniform1uiv(GLint location, GLsizei count, const GLuint *v);
+ void setUniform2uiv(GLint location, GLsizei count, const GLuint *v);
+ void setUniform3uiv(GLint location, GLsizei count, const GLuint *v);
+ void setUniform4uiv(GLint location, GLsizei count, const GLuint *v);
+ void setUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+ void setUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+ void setUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+ void setUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+ void setUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+ void setUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+ void setUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+ void setUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+ void setUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
bool getUniformfv(GLint location, GLsizei *bufSize, GLfloat *params);
bool getUniformiv(GLint location, GLsizei *bufSize, GLint *params);
+ bool getUniformuiv(GLint location, GLsizei *bufSize, GLuint *params);
void dirtyAllUniforms();
void applyUniforms();
+ bool applyUniformBuffers(const std::vector<Buffer*> boundBuffers);
bool load(InfoLog &infoLog, const void *binary, GLsizei length);
bool save(void* binary, GLsizei bufSize, GLsizei *length);
GLint getLength();
- bool link(InfoLog &infoLog, const AttributeBindings &attributeBindings, FragmentShader *fragmentShader, VertexShader *vertexShader);
+ bool link(InfoLog &infoLog, const AttributeBindings &attributeBindings, FragmentShader *fragmentShader, VertexShader *vertexShader,
+ const std::vector<std::string>& transformFeedbackVaryings, GLenum transformFeedbackBufferMode);
void getAttachedShaders(GLsizei maxCount, GLsizei *count, GLuint *shaders);
void getActiveAttribute(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name) const;
@@ -107,44 +144,114 @@ class ProgramBinary : public RefCountObject
void getActiveUniform(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name) const;
GLint getActiveUniformCount() const;
GLint getActiveUniformMaxLength() const;
+ GLint getActiveUniformi(GLuint index, GLenum pname) const;
+ bool isValidUniformLocation(GLint location) const;
+ LinkedUniform *getUniformByLocation(GLint location) const;
+
+ void getActiveUniformBlockName(GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName) const;
+ void getActiveUniformBlockiv(GLuint uniformBlockIndex, GLenum pname, GLint *params) const;
+ GLuint getActiveUniformBlockCount() const;
+ GLuint getActiveUniformBlockMaxLength() const;
+ UniformBlock *getUniformBlockByIndex(GLuint blockIndex);
+
+ GLint getFragDataLocation(const char *name) const;
+
+ size_t getTransformFeedbackVaryingCount() const;
+ const LinkedVarying &getTransformFeedbackVarying(size_t idx) const;
+ GLenum getTransformFeedbackBufferMode() const;
void validate(InfoLog &infoLog);
bool validateSamplers(InfoLog *infoLog);
bool isValidated() const;
unsigned int getSerial() const;
+ int getShaderVersion() const;
void initAttributesByLayout();
- void sortAttributesByLayout(rx::TranslatedAttribute attributes[gl::MAX_VERTEX_ATTRIBS], int sortedSemanticIndices[MAX_VERTEX_ATTRIBS]) const;
+ void sortAttributesByLayout(rx::TranslatedAttribute attributes[MAX_VERTEX_ATTRIBS], int sortedSemanticIndices[MAX_VERTEX_ATTRIBS]) const;
- static std::string decorateAttribute(const std::string &name); // Prepend an underscore
+ const std::vector<LinkedUniform*> &getUniforms() const { return mUniforms; }
+ const rx::UniformStorage &getVertexUniformStorage() const { return *mVertexUniformStorage; }
+ const rx::UniformStorage &getFragmentUniformStorage() const { return *mFragmentUniformStorage; }
private:
DISALLOW_COPY_AND_ASSIGN(ProgramBinary);
- int packVaryings(InfoLog &infoLog, const Varying *packing[][4], FragmentShader *fragmentShader);
- bool linkVaryings(InfoLog &infoLog, int registers, const Varying *packing[][4],
- std::string& pixelHLSL, std::string& vertexHLSL,
- FragmentShader *fragmentShader, VertexShader *vertexShader);
-
+ bool linkVaryings(InfoLog &infoLog, FragmentShader *fragmentShader, VertexShader *vertexShader);
bool linkAttributes(InfoLog &infoLog, const AttributeBindings &attributeBindings, FragmentShader *fragmentShader, VertexShader *vertexShader);
- bool linkUniforms(InfoLog &infoLog, const sh::ActiveUniforms &vertexUniforms, const sh::ActiveUniforms &fragmentUniforms);
- bool defineUniform(GLenum shader, const sh::Uniform &constant, InfoLog &infoLog);
-
- std::string generateGeometryShaderHLSL(int registers, const Varying *packing[][4], FragmentShader *fragmentShader, VertexShader *vertexShader) const;
- std::string generatePointSpriteHLSL(int registers, const Varying *packing[][4], FragmentShader *fragmentShader, VertexShader *vertexShader) const;
+ typedef std::vector<BlockMemberInfo>::const_iterator BlockInfoItr;
+
+ template <class ShaderVarType>
+ bool linkValidateFields(InfoLog &infoLog, const std::string &varName, const ShaderVarType &vertexVar, const ShaderVarType &fragmentVar);
+ bool linkValidateVariablesBase(InfoLog &infoLog, const std::string &variableName, const ShaderVariable &vertexVariable, const ShaderVariable &fragmentVariable, bool validatePrecision);
+
+ bool linkValidateVariables(InfoLog &infoLog, const std::string &uniformName, const Uniform &vertexUniform, const Uniform &fragmentUniform);
+ bool linkValidateVariables(InfoLog &infoLog, const std::string &varyingName, const Varying &vertexVarying, const Varying &fragmentVarying);
+ bool linkValidateVariables(InfoLog &infoLog, const std::string &uniformName, const InterfaceBlockField &vertexUniform, const InterfaceBlockField &fragmentUniform);
+ bool linkUniforms(InfoLog &infoLog, const std::vector<Uniform> &vertexUniforms, const std::vector<Uniform> &fragmentUniforms);
+ bool defineUniform(GLenum shader, const Uniform &constant, InfoLog &infoLog);
+ bool areMatchingInterfaceBlocks(InfoLog &infoLog, const InterfaceBlock &vertexInterfaceBlock, const InterfaceBlock &fragmentInterfaceBlock);
+ bool linkUniformBlocks(InfoLog &infoLog, const std::vector<InterfaceBlock> &vertexUniformBlocks, const std::vector<InterfaceBlock> &fragmentUniformBlocks);
+ bool gatherTransformFeedbackLinkedVaryings(InfoLog &infoLog, const std::vector<LinkedVarying> &linkedVaryings,
+ const std::vector<std::string> &transformFeedbackVaryingNames,
+ GLenum transformFeedbackBufferMode,
+ std::vector<LinkedVarying> *outTransformFeedbackLinkedVaryings) const;
+ void defineUniformBlockMembers(const std::vector<InterfaceBlockField> &fields, const std::string &prefix, int blockIndex, BlockInfoItr *blockInfoItr, std::vector<unsigned int> *blockUniformIndexes);
+ bool defineUniformBlock(InfoLog &infoLog, GLenum shader, const InterfaceBlock &interfaceBlock);
+ bool assignUniformBlockRegister(InfoLog &infoLog, UniformBlock *uniformBlock, GLenum shader, unsigned int registerIndex);
+ void defineOutputVariables(FragmentShader *fragmentShader);
+ void initializeUniformStorage();
+
+ template <typename T>
+ void setUniform(GLint location, GLsizei count, const T* v, GLenum targetUniformType);
+
+ template <int cols, int rows>
+ void setUniformMatrixfv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value, GLenum targetUniformType);
+
+ template <typename T>
+ bool getUniformv(GLint location, GLsizei *bufSize, T *params, GLenum uniformType);
+
+ static TextureType getTextureType(GLenum samplerType, InfoLog &infoLog);
+
+ class VertexExecutable
+ {
+ public:
+ VertexExecutable(rx::Renderer *const renderer,
+ const VertexFormat inputLayout[MAX_VERTEX_ATTRIBS],
+ const GLenum signature[MAX_VERTEX_ATTRIBS],
+ rx::ShaderExecutable *shaderExecutable);
+ ~VertexExecutable();
+
+ bool matchesSignature(const GLenum convertedLayout[MAX_VERTEX_ATTRIBS]) const;
+
+ const VertexFormat *inputs() const { return mInputs; }
+ const GLenum *signature() const { return mSignature; }
+ rx::ShaderExecutable *shaderExecutable() const { return mShaderExecutable; }
+
+ private:
+ VertexFormat mInputs[MAX_VERTEX_ATTRIBS];
+ GLenum mSignature[MAX_VERTEX_ATTRIBS];
+ rx::ShaderExecutable *mShaderExecutable;
+ };
rx::Renderer *const mRenderer;
+ DynamicHLSL *mDynamicHLSL;
- rx::ShaderExecutable *mPixelExecutable;
- rx::ShaderExecutable *mVertexExecutable;
+ std::string mVertexHLSL;
+ rx::D3DWorkaroundType mVertexWorkarounds;
+ std::vector<VertexExecutable *> mVertexExecutables;
rx::ShaderExecutable *mGeometryExecutable;
+ rx::ShaderExecutable *mPixelExecutable;
Attribute mLinkedAttribute[MAX_VERTEX_ATTRIBS];
+ Attribute mShaderAttributes[MAX_VERTEX_ATTRIBS];
int mSemanticIndex[MAX_VERTEX_ATTRIBS];
int mAttributesByLayout[MAX_VERTEX_ATTRIBS];
+ GLenum mTransformFeedbackBufferMode;
+ std::vector<LinkedVarying> mTransformFeedbackLinkedVaryings;
+
struct Sampler
{
Sampler();
@@ -159,10 +266,14 @@ class ProgramBinary : public RefCountObject
GLuint mUsedVertexSamplerRange;
GLuint mUsedPixelSamplerRange;
bool mUsesPointSize;
+ int mShaderVersion;
- UniformArray mUniforms;
- typedef std::vector<UniformLocation> UniformIndex;
- UniformIndex mUniformIndex;
+ std::vector<LinkedUniform*> mUniforms;
+ std::vector<UniformBlock*> mUniformBlocks;
+ std::vector<VariableLocation> mUniformIndex;
+ std::map<int, VariableLocation> mOutputVariables;
+ rx::UniformStorage *mVertexUniformStorage;
+ rx::UniformStorage *mFragmentUniformStorage;
bool mValidated;
@@ -171,6 +282,7 @@ class ProgramBinary : public RefCountObject
static unsigned int issueSerial();
static unsigned int mCurrentSerial;
};
+
}
#endif // LIBGLESV2_PROGRAM_BINARY_H_
diff --git a/chromium/third_party/angle/src/libGLESv2/Query.cpp b/chromium/third_party/angle/src/libGLESv2/Query.cpp
index bd987954f1f..6546d06c34c 100644
--- a/chromium/third_party/angle/src/libGLESv2/Query.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/Query.cpp
@@ -49,4 +49,9 @@ GLenum Query::getType() const
return mQuery->getType();
}
+bool Query::isStarted() const
+{
+ return mQuery->isStarted();
+}
+
}
diff --git a/chromium/third_party/angle/src/libGLESv2/Query.h b/chromium/third_party/angle/src/libGLESv2/Query.h
index e9b95b729b6..4eb236f1041 100644
--- a/chromium/third_party/angle/src/libGLESv2/Query.h
+++ b/chromium/third_party/angle/src/libGLESv2/Query.h
@@ -9,7 +9,7 @@
#ifndef LIBGLESV2_QUERY_H_
#define LIBGLESV2_QUERY_H_
-#define GL_APICALL
+#include <GLES3/gl3.h>
#include <GLES2/gl2.h>
#include "common/angleutils.h"
@@ -37,6 +37,7 @@ class Query : public RefCountObject
GLboolean isResultAvailable();
GLenum getType() const;
+ bool isStarted() const;
private:
DISALLOW_COPY_AND_ASSIGN(Query);
diff --git a/chromium/third_party/angle/src/libGLESv2/Renderbuffer.cpp b/chromium/third_party/angle/src/libGLESv2/Renderbuffer.cpp
index 98d33ec6c38..dade014b830 100644
--- a/chromium/third_party/angle/src/libGLESv2/Renderbuffer.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/Renderbuffer.cpp
@@ -14,308 +14,15 @@
#include "libGLESv2/Texture.h"
#include "libGLESv2/renderer/Renderer.h"
-#include "libGLESv2/utilities.h"
+#include "libGLESv2/renderer/TextureStorage.h"
+#include "common/utilities.h"
+#include "libGLESv2/formatutils.h"
namespace gl
{
unsigned int RenderbufferStorage::mCurrentSerial = 1;
-RenderbufferInterface::RenderbufferInterface()
-{
-}
-
-// The default case for classes inherited from RenderbufferInterface is not to
-// need to do anything upon the reference count to the parent Renderbuffer incrementing
-// or decrementing.
-void RenderbufferInterface::addProxyRef(const Renderbuffer *proxy)
-{
-}
-
-void RenderbufferInterface::releaseProxy(const Renderbuffer *proxy)
-{
-}
-
-GLuint RenderbufferInterface::getRedSize() const
-{
- return gl::GetRedSize(getActualFormat());
-}
-
-GLuint RenderbufferInterface::getGreenSize() const
-{
- return gl::GetGreenSize(getActualFormat());
-}
-
-GLuint RenderbufferInterface::getBlueSize() const
-{
- return gl::GetBlueSize(getActualFormat());
-}
-
-GLuint RenderbufferInterface::getAlphaSize() const
-{
- return gl::GetAlphaSize(getActualFormat());
-}
-
-GLuint RenderbufferInterface::getDepthSize() const
-{
- return gl::GetDepthSize(getActualFormat());
-}
-
-GLuint RenderbufferInterface::getStencilSize() const
-{
- return gl::GetStencilSize(getActualFormat());
-}
-
-///// RenderbufferTexture2D Implementation ////////
-
-RenderbufferTexture2D::RenderbufferTexture2D(Texture2D *texture, GLenum target) : mTarget(target)
-{
- mTexture2D.set(texture);
-}
-
-RenderbufferTexture2D::~RenderbufferTexture2D()
-{
- mTexture2D.set(NULL);
-}
-
-// Textures need to maintain their own reference count for references via
-// Renderbuffers acting as proxies. Here, we notify the texture of a reference.
-void RenderbufferTexture2D::addProxyRef(const Renderbuffer *proxy)
-{
- mTexture2D->addProxyRef(proxy);
-}
-
-void RenderbufferTexture2D::releaseProxy(const Renderbuffer *proxy)
-{
- mTexture2D->releaseProxy(proxy);
-}
-
-rx::RenderTarget *RenderbufferTexture2D::getRenderTarget()
-{
- return mTexture2D->getRenderTarget(mTarget);
-}
-
-rx::RenderTarget *RenderbufferTexture2D::getDepthStencil()
-{
- return mTexture2D->getDepthStencil(mTarget);
-}
-
-GLsizei RenderbufferTexture2D::getWidth() const
-{
- return mTexture2D->getWidth(0);
-}
-
-GLsizei RenderbufferTexture2D::getHeight() const
-{
- return mTexture2D->getHeight(0);
-}
-
-GLenum RenderbufferTexture2D::getInternalFormat() const
-{
- return mTexture2D->getInternalFormat(0);
-}
-
-GLenum RenderbufferTexture2D::getActualFormat() const
-{
- return mTexture2D->getActualFormat(0);
-}
-
-GLsizei RenderbufferTexture2D::getSamples() const
-{
- return 0;
-}
-
-unsigned int RenderbufferTexture2D::getSerial() const
-{
- return mTexture2D->getRenderTargetSerial(mTarget);
-}
-
-unsigned int RenderbufferTexture2D::getTextureSerial() const
-{
- return mTexture2D->getTextureSerial();
-}
-
-///// RenderbufferTextureCubeMap Implementation ////////
-
-RenderbufferTextureCubeMap::RenderbufferTextureCubeMap(TextureCubeMap *texture, GLenum target) : mTarget(target)
-{
- mTextureCubeMap.set(texture);
-}
-
-RenderbufferTextureCubeMap::~RenderbufferTextureCubeMap()
-{
- mTextureCubeMap.set(NULL);
-}
-
-// Textures need to maintain their own reference count for references via
-// Renderbuffers acting as proxies. Here, we notify the texture of a reference.
-void RenderbufferTextureCubeMap::addProxyRef(const Renderbuffer *proxy)
-{
- mTextureCubeMap->addProxyRef(proxy);
-}
-
-void RenderbufferTextureCubeMap::releaseProxy(const Renderbuffer *proxy)
-{
- mTextureCubeMap->releaseProxy(proxy);
-}
-
-rx::RenderTarget *RenderbufferTextureCubeMap::getRenderTarget()
-{
- return mTextureCubeMap->getRenderTarget(mTarget);
-}
-
-rx::RenderTarget *RenderbufferTextureCubeMap::getDepthStencil()
-{
- return NULL;
-}
-
-GLsizei RenderbufferTextureCubeMap::getWidth() const
-{
- return mTextureCubeMap->getWidth(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0);
-}
-
-GLsizei RenderbufferTextureCubeMap::getHeight() const
-{
- return mTextureCubeMap->getHeight(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0);
-}
-
-GLenum RenderbufferTextureCubeMap::getInternalFormat() const
-{
- return mTextureCubeMap->getInternalFormat(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0);
-}
-
-GLenum RenderbufferTextureCubeMap::getActualFormat() const
-{
- return mTextureCubeMap->getActualFormat(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0);
-}
-
-GLsizei RenderbufferTextureCubeMap::getSamples() const
-{
- return 0;
-}
-
-unsigned int RenderbufferTextureCubeMap::getSerial() const
-{
- return mTextureCubeMap->getRenderTargetSerial(mTarget);
-}
-
-unsigned int RenderbufferTextureCubeMap::getTextureSerial() const
-{
- return mTextureCubeMap->getTextureSerial();
-}
-
-////// Renderbuffer Implementation //////
-
-Renderbuffer::Renderbuffer(rx::Renderer *renderer, GLuint id, RenderbufferInterface *instance) : RefCountObject(id)
-{
- ASSERT(instance != NULL);
- mInstance = instance;
-}
-
-Renderbuffer::~Renderbuffer()
-{
- delete mInstance;
-}
-
-// The RenderbufferInterface contained in this Renderbuffer may need to maintain
-// its own reference count, so we pass it on here.
-void Renderbuffer::addRef() const
-{
- mInstance->addProxyRef(this);
-
- RefCountObject::addRef();
-}
-
-void Renderbuffer::release() const
-{
- mInstance->releaseProxy(this);
-
- RefCountObject::release();
-}
-
-rx::RenderTarget *Renderbuffer::getRenderTarget()
-{
- return mInstance->getRenderTarget();
-}
-
-rx::RenderTarget *Renderbuffer::getDepthStencil()
-{
- return mInstance->getDepthStencil();
-}
-
-GLsizei Renderbuffer::getWidth() const
-{
- return mInstance->getWidth();
-}
-
-GLsizei Renderbuffer::getHeight() const
-{
- return mInstance->getHeight();
-}
-
-GLenum Renderbuffer::getInternalFormat() const
-{
- return mInstance->getInternalFormat();
-}
-
-GLenum Renderbuffer::getActualFormat() const
-{
- return mInstance->getActualFormat();
-}
-
-GLuint Renderbuffer::getRedSize() const
-{
- return mInstance->getRedSize();
-}
-
-GLuint Renderbuffer::getGreenSize() const
-{
- return mInstance->getGreenSize();
-}
-
-GLuint Renderbuffer::getBlueSize() const
-{
- return mInstance->getBlueSize();
-}
-
-GLuint Renderbuffer::getAlphaSize() const
-{
- return mInstance->getAlphaSize();
-}
-
-GLuint Renderbuffer::getDepthSize() const
-{
- return mInstance->getDepthSize();
-}
-
-GLuint Renderbuffer::getStencilSize() const
-{
- return mInstance->getStencilSize();
-}
-
-GLsizei Renderbuffer::getSamples() const
-{
- return mInstance->getSamples();
-}
-
-unsigned int Renderbuffer::getSerial() const
-{
- return mInstance->getSerial();
-}
-
-unsigned int Renderbuffer::getTextureSerial() const
-{
- return mInstance->getTextureSerial();
-}
-
-void Renderbuffer::setStorage(RenderbufferStorage *newStorage)
-{
- ASSERT(newStorage != NULL);
-
- delete mInstance;
- mInstance = newStorage;
-}
-
-RenderbufferStorage::RenderbufferStorage() : mSerial(issueSerial())
+RenderbufferStorage::RenderbufferStorage() : mSerial(issueSerials(1))
{
mWidth = 0;
mHeight = 0;
@@ -338,6 +45,11 @@ rx::RenderTarget *RenderbufferStorage::getDepthStencil()
return NULL;
}
+rx::TextureStorage *RenderbufferStorage::getTextureStorage()
+{
+ return NULL;
+}
+
GLsizei RenderbufferStorage::getWidth() const
{
return mWidth;
@@ -368,16 +80,21 @@ unsigned int RenderbufferStorage::getSerial() const
return mSerial;
}
-unsigned int RenderbufferStorage::issueSerial()
+unsigned int RenderbufferStorage::issueSerials(GLuint count)
{
- return mCurrentSerial++;
+ unsigned int firstSerial = mCurrentSerial;
+ mCurrentSerial += count;
+ return firstSerial;
}
-unsigned int RenderbufferStorage::issueCubeSerials()
+bool RenderbufferStorage::isTexture() const
{
- unsigned int firstSerial = mCurrentSerial;
- mCurrentSerial += 6;
- return firstSerial;
+ return false;
+}
+
+unsigned int RenderbufferStorage::getTextureSerial() const
+{
+ return -1;
}
Colorbuffer::Colorbuffer(rx::Renderer *renderer, rx::SwapChain *swapChain)
@@ -396,7 +113,7 @@ Colorbuffer::Colorbuffer(rx::Renderer *renderer, rx::SwapChain *swapChain)
Colorbuffer::Colorbuffer(rx::Renderer *renderer, int width, int height, GLenum format, GLsizei samples) : mRenderTarget(NULL)
{
- mRenderTarget = renderer->createRenderTarget(width, height, format, samples, false);
+ mRenderTarget = renderer->createRenderTarget(width, height, format, samples);
if (mRenderTarget)
{
@@ -418,12 +135,7 @@ Colorbuffer::~Colorbuffer()
rx::RenderTarget *Colorbuffer::getRenderTarget()
{
- if (mRenderTarget)
- {
- return mRenderTarget;
- }
-
- return NULL;
+ return mRenderTarget;
}
DepthStencilbuffer::DepthStencilbuffer(rx::Renderer *renderer, rx::SwapChain *swapChain)
@@ -442,7 +154,7 @@ DepthStencilbuffer::DepthStencilbuffer(rx::Renderer *renderer, rx::SwapChain *sw
DepthStencilbuffer::DepthStencilbuffer(rx::Renderer *renderer, int width, int height, GLsizei samples)
{
- mDepthStencil = renderer->createRenderTarget(width, height, GL_DEPTH24_STENCIL8_OES, samples, true);
+ mDepthStencil = renderer->createRenderTarget(width, height, GL_DEPTH24_STENCIL8_OES, samples);
mWidth = mDepthStencil->getWidth();
mHeight = mDepthStencil->getHeight();
@@ -461,12 +173,7 @@ DepthStencilbuffer::~DepthStencilbuffer()
rx::RenderTarget *DepthStencilbuffer::getDepthStencil()
{
- if (mDepthStencil)
- {
- return mDepthStencil;
- }
-
- return NULL;
+ return mDepthStencil;
}
Depthbuffer::Depthbuffer(rx::Renderer *renderer, int width, int height, GLsizei samples) : DepthStencilbuffer(renderer, width, height, samples)
diff --git a/chromium/third_party/angle/src/libGLESv2/Renderbuffer.h b/chromium/third_party/angle/src/libGLESv2/Renderbuffer.h
index d46fd44557c..4da447ae93c 100644
--- a/chromium/third_party/angle/src/libGLESv2/Renderbuffer.h
+++ b/chromium/third_party/angle/src/libGLESv2/Renderbuffer.h
@@ -12,122 +12,28 @@
#ifndef LIBGLESV2_RENDERBUFFER_H_
#define LIBGLESV2_RENDERBUFFER_H_
-#define GL_APICALL
+#include <GLES3/gl3.h>
#include <GLES2/gl2.h>
#include "common/angleutils.h"
#include "common/RefCountObject.h"
+#include "libGLESv2/FramebufferAttachment.h"
namespace rx
{
class Renderer;
class SwapChain;
class RenderTarget;
+class TextureStorage;
}
namespace gl
{
-class Texture2D;
-class TextureCubeMap;
-class Renderbuffer;
-class Colorbuffer;
-class DepthStencilbuffer;
-
-class RenderbufferInterface
-{
- public:
- RenderbufferInterface();
-
- virtual ~RenderbufferInterface() {};
-
- virtual void addProxyRef(const Renderbuffer *proxy);
- virtual void releaseProxy(const Renderbuffer *proxy);
-
- virtual rx::RenderTarget *getRenderTarget() = 0;
- virtual rx::RenderTarget *getDepthStencil() = 0;
-
- virtual GLsizei getWidth() const = 0;
- virtual GLsizei getHeight() const = 0;
- virtual GLenum getInternalFormat() const = 0;
- virtual GLenum getActualFormat() const = 0;
- virtual GLsizei getSamples() const = 0;
-
- GLuint getRedSize() const;
- GLuint getGreenSize() const;
- GLuint getBlueSize() const;
- GLuint getAlphaSize() const;
- GLuint getDepthSize() const;
- GLuint getStencilSize() const;
-
- virtual unsigned int getSerial() const = 0;
- virtual unsigned int getTextureSerial() const = 0;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(RenderbufferInterface);
-};
-
-class RenderbufferTexture2D : public RenderbufferInterface
-{
- public:
- RenderbufferTexture2D(Texture2D *texture, GLenum target);
-
- virtual ~RenderbufferTexture2D();
-
- void addProxyRef(const Renderbuffer *proxy);
- void releaseProxy(const Renderbuffer *proxy);
-
- rx::RenderTarget *getRenderTarget();
- rx::RenderTarget *getDepthStencil();
-
- virtual GLsizei getWidth() const;
- virtual GLsizei getHeight() const;
- virtual GLenum getInternalFormat() const;
- virtual GLenum getActualFormat() const;
- virtual GLsizei getSamples() const;
-
- virtual unsigned int getSerial() const;
- virtual unsigned int getTextureSerial() const;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(RenderbufferTexture2D);
-
- BindingPointer <Texture2D> mTexture2D;
- GLenum mTarget;
-};
-
-class RenderbufferTextureCubeMap : public RenderbufferInterface
-{
- public:
- RenderbufferTextureCubeMap(TextureCubeMap *texture, GLenum target);
-
- virtual ~RenderbufferTextureCubeMap();
-
- void addProxyRef(const Renderbuffer *proxy);
- void releaseProxy(const Renderbuffer *proxy);
-
- rx::RenderTarget *getRenderTarget();
- rx::RenderTarget *getDepthStencil();
-
- virtual GLsizei getWidth() const;
- virtual GLsizei getHeight() const;
- virtual GLenum getInternalFormat() const;
- virtual GLenum getActualFormat() const;
- virtual GLsizei getSamples() const;
-
- virtual unsigned int getSerial() const;
- virtual unsigned int getTextureSerial() const;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(RenderbufferTextureCubeMap);
-
- BindingPointer <TextureCubeMap> mTextureCubeMap;
- GLenum mTarget;
-};
// A class derived from RenderbufferStorage is created whenever glRenderbufferStorage
// is called. The specific concrete type depends on whether the internal format is
// colour depth, stencil or packed depth/stencil.
-class RenderbufferStorage : public RenderbufferInterface
+class RenderbufferStorage : public FramebufferAttachmentInterface
{
public:
RenderbufferStorage();
@@ -136,6 +42,7 @@ class RenderbufferStorage : public RenderbufferInterface
virtual rx::RenderTarget *getRenderTarget();
virtual rx::RenderTarget *getDepthStencil();
+ virtual rx::TextureStorage *getTextureStorage();
virtual GLsizei getWidth() const;
virtual GLsizei getHeight() const;
@@ -144,10 +51,11 @@ class RenderbufferStorage : public RenderbufferInterface
virtual GLsizei getSamples() const;
virtual unsigned int getSerial() const;
- virtual unsigned int getTextureSerial() const { return 0; }
- static unsigned int issueSerial();
- static unsigned int issueCubeSerials();
+ virtual bool isTexture() const;
+ virtual unsigned int getTextureSerial() const;
+
+ static unsigned int issueSerials(GLuint count);
protected:
GLsizei mWidth;
@@ -164,49 +72,6 @@ class RenderbufferStorage : public RenderbufferInterface
static unsigned int mCurrentSerial;
};
-// Renderbuffer implements the GL renderbuffer object.
-// It's only a proxy for a RenderbufferInterface instance; the internal object
-// can change whenever glRenderbufferStorage is called.
-class Renderbuffer : public RefCountObject
-{
- public:
- Renderbuffer(rx::Renderer *renderer, GLuint id, RenderbufferInterface *storage);
-
- virtual ~Renderbuffer();
-
- // These functions from RefCountObject are overloaded here because
- // Textures need to maintain their own count of references to them via
- // Renderbuffers/RenderbufferTextures. These functions invoke those
- // reference counting functions on the RenderbufferInterface.
- void addRef() const;
- void release() const;
-
- rx::RenderTarget *getRenderTarget();
- rx::RenderTarget *getDepthStencil();
-
- GLsizei getWidth() const;
- GLsizei getHeight() const;
- GLenum getInternalFormat() const;
- GLenum getActualFormat() const;
- GLuint getRedSize() const;
- GLuint getGreenSize() const;
- GLuint getBlueSize() const;
- GLuint getAlphaSize() const;
- GLuint getDepthSize() const;
- GLuint getStencilSize() const;
- GLsizei getSamples() const;
-
- unsigned int getSerial() const;
- unsigned int getTextureSerial() const;
-
- void setStorage(RenderbufferStorage *newStorage);
-
- private:
- DISALLOW_COPY_AND_ASSIGN(Renderbuffer);
-
- RenderbufferInterface *mInstance;
-};
-
class Colorbuffer : public RenderbufferStorage
{
public:
diff --git a/chromium/third_party/angle/src/libGLESv2/RenderbufferProxySet.cpp b/chromium/third_party/angle/src/libGLESv2/RenderbufferProxySet.cpp
new file mode 100644
index 00000000000..f4fbe513254
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/RenderbufferProxySet.cpp
@@ -0,0 +1,87 @@
+#include "precompiled.h"
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// RenderbufferProxySet.cpp: Implements the gl::RenderbufferProxySet, a class for
+// maintaining a Texture's weak references to the Renderbuffers that represent it.
+
+#include "libGLESv2/RenderbufferProxySet.h"
+#include "common/debug.h"
+
+namespace gl
+{
+
+void RenderbufferProxySet::addRef(const FramebufferAttachment *proxy)
+{
+ RefCountMap::iterator i = mRefCountMap.find(proxy);
+ if (i != mRefCountMap.end())
+ {
+ i->second++;
+ }
+}
+
+void RenderbufferProxySet::release(const FramebufferAttachment *proxy)
+{
+ RefCountMap::iterator i = mRefCountMap.find(proxy);
+ if (i != mRefCountMap.end())
+ {
+ if (i->second > 0)
+ {
+ i->second--;
+ }
+
+ if (i->second == 0)
+ {
+ // Clear the buffer map of references to this FramebufferAttachment
+ BufferMap::iterator j = mBufferMap.begin();
+ while (j != mBufferMap.end())
+ {
+ if (j->second == proxy)
+ {
+ j = mBufferMap.erase(j);
+ }
+ else
+ {
+ ++j;
+ }
+ }
+
+ mRefCountMap.erase(i);
+ }
+ }
+}
+
+void RenderbufferProxySet::add(unsigned int mipLevel, unsigned int layer, FramebufferAttachment *renderBuffer)
+{
+ if (mRefCountMap.find(renderBuffer) == mRefCountMap.end())
+ {
+ mRefCountMap.insert(std::make_pair(renderBuffer, 0));
+ }
+
+ RenderbufferKey key;
+ key.mipLevel = mipLevel;
+ key.layer = layer;
+ if (mBufferMap.find(key) == mBufferMap.end())
+ {
+ mBufferMap.insert(std::make_pair(key, renderBuffer));
+ }
+}
+
+FramebufferAttachment *RenderbufferProxySet::get(unsigned int mipLevel, unsigned int layer) const
+{
+ RenderbufferKey key;
+ key.mipLevel = mipLevel;
+ key.layer = layer;
+ BufferMap::const_iterator i = mBufferMap.find(key);
+ return (i != mBufferMap.end()) ? i->second : NULL;
+}
+
+bool RenderbufferProxySet::RenderbufferKey::operator<(const RenderbufferKey &other) const
+{
+ return (mipLevel != other.mipLevel) ? mipLevel < other.mipLevel : layer < other.layer;
+}
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/RenderbufferProxySet.h b/chromium/third_party/angle/src/libGLESv2/RenderbufferProxySet.h
new file mode 100644
index 00000000000..f1511515197
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/RenderbufferProxySet.h
@@ -0,0 +1,46 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// RenderbufferProxySet.h: Defines the gl::RenderbufferProxySet, a class for
+// maintaining a Texture's weak references to the Renderbuffers that represent it.
+
+#ifndef LIBGLESV2_RENDERBUFFERPROXYSET_H_
+#define LIBGLESV2_RENDERBUFFERPROXYSET_H_
+
+#include <map>
+
+namespace gl
+{
+class FramebufferAttachment;
+
+class RenderbufferProxySet
+{
+ public:
+ void addRef(const FramebufferAttachment *proxy);
+ void release(const FramebufferAttachment *proxy);
+
+ void add(unsigned int mipLevel, unsigned int layer, FramebufferAttachment *renderBuffer);
+ FramebufferAttachment *get(unsigned int mipLevel, unsigned int layer) const;
+
+ private:
+ struct RenderbufferKey
+ {
+ unsigned int mipLevel;
+ unsigned int layer;
+
+ bool operator<(const RenderbufferKey &other) const;
+ };
+
+ typedef std::map<RenderbufferKey, FramebufferAttachment*> BufferMap;
+ BufferMap mBufferMap;
+
+ typedef std::map<const FramebufferAttachment*, unsigned int> RefCountMap;
+ RefCountMap mRefCountMap;
+};
+
+}
+
+#endif // LIBGLESV2_RENDERBUFFERPROXYSET_H_
diff --git a/chromium/third_party/angle/src/libGLESv2/ResourceManager.cpp b/chromium/third_party/angle/src/libGLESv2/ResourceManager.cpp
index 58dd44fd955..cf0812d7361 100644
--- a/chromium/third_party/angle/src/libGLESv2/ResourceManager.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/ResourceManager.cpp
@@ -1,6 +1,6 @@
#include "precompiled.h"
//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -15,6 +15,8 @@
#include "libGLESv2/Renderbuffer.h"
#include "libGLESv2/Shader.h"
#include "libGLESv2/Texture.h"
+#include "libGLESv2/Sampler.h"
+#include "libGLESv2/Fence.h"
namespace gl
{
@@ -50,6 +52,16 @@ ResourceManager::~ResourceManager()
{
deleteTexture(mTextureMap.begin()->first);
}
+
+ while (!mSamplerMap.empty())
+ {
+ deleteSampler(mSamplerMap.begin()->first);
+ }
+
+ while (!mFenceSyncMap.empty())
+ {
+ deleteFenceSync(mFenceSyncMap.begin()->first);
+ }
}
void ResourceManager::addRef()
@@ -123,6 +135,26 @@ GLuint ResourceManager::createRenderbuffer()
return handle;
}
+// Returns an unused sampler name
+GLuint ResourceManager::createSampler()
+{
+ GLuint handle = mSamplerHandleAllocator.allocate();
+
+ mSamplerMap[handle] = NULL;
+
+ return handle;
+}
+
+// Returns the next unused fence name, and allocates the fence
+GLuint ResourceManager::createFenceSync()
+{
+ GLuint handle = mFenceSyncHandleAllocator.allocate();
+
+ mFenceSyncMap[handle] = new FenceSync(mRenderer, handle);
+
+ return handle;
+}
+
void ResourceManager::deleteBuffer(GLuint buffer)
{
BufferMap::iterator bufferObject = mBufferMap.find(buffer);
@@ -197,6 +229,30 @@ void ResourceManager::deleteRenderbuffer(GLuint renderbuffer)
}
}
+void ResourceManager::deleteSampler(GLuint sampler)
+{
+ auto samplerObject = mSamplerMap.find(sampler);
+
+ if (samplerObject != mSamplerMap.end())
+ {
+ mSamplerHandleAllocator.release(samplerObject->first);
+ if (samplerObject->second) samplerObject->second->release();
+ mSamplerMap.erase(samplerObject);
+ }
+}
+
+void ResourceManager::deleteFenceSync(GLuint fenceSync)
+{
+ auto fenceObjectIt = mFenceSyncMap.find(fenceSync);
+
+ if (fenceObjectIt != mFenceSyncMap.end())
+ {
+ mFenceSyncHandleAllocator.release(fenceObjectIt->first);
+ if (fenceObjectIt->second) fenceObjectIt->second->release();
+ mFenceSyncMap.erase(fenceObjectIt);
+ }
+}
+
Buffer *ResourceManager::getBuffer(unsigned int handle)
{
BufferMap::iterator buffer = mBufferMap.find(handle);
@@ -255,7 +311,7 @@ Program *ResourceManager::getProgram(unsigned int handle)
}
}
-Renderbuffer *ResourceManager::getRenderbuffer(unsigned int handle)
+FramebufferAttachment *ResourceManager::getRenderbuffer(unsigned int handle)
{
RenderbufferMap::iterator renderbuffer = mRenderbufferMap.find(handle);
@@ -269,7 +325,35 @@ Renderbuffer *ResourceManager::getRenderbuffer(unsigned int handle)
}
}
-void ResourceManager::setRenderbuffer(GLuint handle, Renderbuffer *buffer)
+Sampler *ResourceManager::getSampler(unsigned int handle)
+{
+ auto sampler = mSamplerMap.find(handle);
+
+ if (sampler == mSamplerMap.end())
+ {
+ return NULL;
+ }
+ else
+ {
+ return sampler->second;
+ }
+}
+
+FenceSync *ResourceManager::getFenceSync(unsigned int handle)
+{
+ auto fenceObjectIt = mFenceSyncMap.find(handle);
+
+ if (fenceObjectIt == mFenceSyncMap.end())
+ {
+ return NULL;
+ }
+ else
+ {
+ return fenceObjectIt->second;
+ }
+}
+
+void ResourceManager::setRenderbuffer(GLuint handle, FramebufferAttachment *buffer)
{
mRenderbufferMap[handle] = buffer;
}
@@ -298,6 +382,14 @@ void ResourceManager::checkTextureAllocation(GLuint texture, TextureType type)
{
textureObject = new TextureCubeMap(mRenderer, texture);
}
+ else if (type == TEXTURE_3D)
+ {
+ textureObject = new Texture3D(mRenderer, texture);
+ }
+ else if (type == TEXTURE_2D_ARRAY)
+ {
+ textureObject = new Texture2DArray(mRenderer, texture);
+ }
else
{
UNREACHABLE();
@@ -313,10 +405,25 @@ void ResourceManager::checkRenderbufferAllocation(GLuint renderbuffer)
{
if (renderbuffer != 0 && !getRenderbuffer(renderbuffer))
{
- Renderbuffer *renderbufferObject = new Renderbuffer(mRenderer, renderbuffer, new Colorbuffer(mRenderer, 0, 0, GL_RGBA4, 0));
+ FramebufferAttachment *renderbufferObject = new FramebufferAttachment(mRenderer, renderbuffer, new Colorbuffer(mRenderer, 0, 0, GL_RGBA4, 0));
mRenderbufferMap[renderbuffer] = renderbufferObject;
renderbufferObject->addRef();
}
}
+void ResourceManager::checkSamplerAllocation(GLuint sampler)
+{
+ if (sampler != 0 && !getSampler(sampler))
+ {
+ Sampler *samplerObject = new Sampler(sampler);
+ mSamplerMap[sampler] = samplerObject;
+ samplerObject->addRef();
+ }
+}
+
+bool ResourceManager::isSampler(GLuint sampler)
+{
+ return mSamplerMap.find(sampler) != mSamplerMap.end();
+}
+
}
diff --git a/chromium/third_party/angle/src/libGLESv2/ResourceManager.h b/chromium/third_party/angle/src/libGLESv2/ResourceManager.h
index e99c77c35d2..a08a6aae1ed 100644
--- a/chromium/third_party/angle/src/libGLESv2/ResourceManager.h
+++ b/chromium/third_party/angle/src/libGLESv2/ResourceManager.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -10,14 +10,10 @@
#ifndef LIBGLESV2_RESOURCEMANAGER_H_
#define LIBGLESV2_RESOURCEMANAGER_H_
-#define GL_APICALL
+#include <GLES3/gl3.h>
#include <GLES2/gl2.h>
-#ifdef _MSC_VER
-#include <hash_map>
-#else
#include <unordered_map>
-#endif
#include "common/angleutils.h"
#include "libGLESv2/angletypes.h"
@@ -34,7 +30,9 @@ class Buffer;
class Shader;
class Program;
class Texture;
-class Renderbuffer;
+class FramebufferAttachment;
+class Sampler;
+class FenceSync;
class ResourceManager
{
@@ -50,24 +48,33 @@ class ResourceManager
GLuint createProgram();
GLuint createTexture();
GLuint createRenderbuffer();
+ GLuint createSampler();
+ GLuint createFenceSync();
void deleteBuffer(GLuint buffer);
void deleteShader(GLuint shader);
void deleteProgram(GLuint program);
void deleteTexture(GLuint texture);
void deleteRenderbuffer(GLuint renderbuffer);
+ void deleteSampler(GLuint sampler);
+ void deleteFenceSync(GLuint fenceSync);
Buffer *getBuffer(GLuint handle);
Shader *getShader(GLuint handle);
Program *getProgram(GLuint handle);
Texture *getTexture(GLuint handle);
- Renderbuffer *getRenderbuffer(GLuint handle);
+ FramebufferAttachment *getRenderbuffer(GLuint handle);
+ Sampler *getSampler(GLuint handle);
+ FenceSync *getFenceSync(GLuint handle);
- void setRenderbuffer(GLuint handle, Renderbuffer *renderbuffer);
+ void setRenderbuffer(GLuint handle, FramebufferAttachment *renderbuffer);
void checkBufferAllocation(unsigned int buffer);
void checkTextureAllocation(GLuint texture, TextureType type);
void checkRenderbufferAllocation(GLuint renderbuffer);
+ void checkSamplerAllocation(GLuint sampler);
+
+ bool isSampler(GLuint sampler);
private:
DISALLOW_COPY_AND_ASSIGN(ResourceManager);
@@ -75,32 +82,32 @@ class ResourceManager
std::size_t mRefCount;
rx::Renderer *mRenderer;
-#ifndef HASH_MAP
-# ifdef _MSC_VER
-# define HASH_MAP stdext::hash_map
-# else
-# define HASH_MAP std::unordered_map
-# endif
-#endif
-
- typedef HASH_MAP<GLuint, Buffer*> BufferMap;
+ typedef std::unordered_map<GLuint, Buffer*> BufferMap;
BufferMap mBufferMap;
HandleAllocator mBufferHandleAllocator;
- typedef HASH_MAP<GLuint, Shader*> ShaderMap;
+ typedef std::unordered_map<GLuint, Shader*> ShaderMap;
ShaderMap mShaderMap;
- typedef HASH_MAP<GLuint, Program*> ProgramMap;
+ typedef std::unordered_map<GLuint, Program*> ProgramMap;
ProgramMap mProgramMap;
HandleAllocator mProgramShaderHandleAllocator;
- typedef HASH_MAP<GLuint, Texture*> TextureMap;
+ typedef std::unordered_map<GLuint, Texture*> TextureMap;
TextureMap mTextureMap;
HandleAllocator mTextureHandleAllocator;
- typedef HASH_MAP<GLuint, Renderbuffer*> RenderbufferMap;
+ typedef std::unordered_map<GLuint, FramebufferAttachment*> RenderbufferMap;
RenderbufferMap mRenderbufferMap;
HandleAllocator mRenderbufferHandleAllocator;
+
+ typedef std::unordered_map<GLuint, Sampler*> SamplerMap;
+ SamplerMap mSamplerMap;
+ HandleAllocator mSamplerHandleAllocator;
+
+ typedef std::unordered_map<GLuint, FenceSync*> FenceMap;
+ FenceMap mFenceSyncMap;
+ HandleAllocator mFenceSyncHandleAllocator;
};
}
diff --git a/chromium/third_party/angle/src/libGLESv2/Sampler.cpp b/chromium/third_party/angle/src/libGLESv2/Sampler.cpp
new file mode 100644
index 00000000000..ed6e29f89ef
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/Sampler.cpp
@@ -0,0 +1,44 @@
+#include "precompiled.h"
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Sampler.cpp : Implements the Sampler class, which represents a GLES 3
+// sampler object. Sampler objects store some state needed to sample textures.
+
+#include "libGLESv2/Sampler.h"
+#include "libGLESv2/angletypes.h"
+
+namespace gl
+{
+
+Sampler::Sampler(GLuint id)
+ : RefCountObject(id),
+ mMinFilter(GL_NEAREST_MIPMAP_LINEAR),
+ mMagFilter(GL_LINEAR),
+ mWrapS(GL_REPEAT),
+ mWrapT(GL_REPEAT),
+ mWrapR(GL_REPEAT),
+ mMinLod(-1000.0f),
+ mMaxLod(1000.0f),
+ mComparisonMode(GL_NONE),
+ mComparisonFunc(GL_LEQUAL)
+{
+}
+
+void Sampler::getState(SamplerState *samplerState) const
+{
+ samplerState->minFilter = mMinFilter;
+ samplerState->magFilter = mMagFilter;
+ samplerState->wrapS = mWrapS;
+ samplerState->wrapT = mWrapT;
+ samplerState->wrapR = mWrapR;
+ samplerState->minLod = mMinLod;
+ samplerState->maxLod = mMaxLod;
+ samplerState->compareMode = mComparisonMode;
+ samplerState->compareFunc = mComparisonFunc;
+}
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/Sampler.h b/chromium/third_party/angle/src/libGLESv2/Sampler.h
new file mode 100644
index 00000000000..257bc25d22a
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/Sampler.h
@@ -0,0 +1,60 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Sampler.h : Defines the Sampler class, which represents a GLES 3
+// sampler object. Sampler objects store some state needed to sample textures.
+
+#ifndef LIBGLESV2_SAMPLER_H_
+#define LIBGLESV2_SAMPLER_H_
+
+#include "common/RefCountObject.h"
+
+namespace gl
+{
+struct SamplerState;
+
+class Sampler : public RefCountObject
+{
+ public:
+ Sampler(GLuint id);
+
+ void setMinFilter(GLenum minFilter) { mMinFilter = minFilter; }
+ void setMagFilter(GLenum magFilter) { mMagFilter = magFilter; }
+ void setWrapS(GLenum wrapS) { mWrapS = wrapS; }
+ void setWrapT(GLenum wrapT) { mWrapT = wrapT; }
+ void setWrapR(GLenum wrapR) { mWrapR = wrapR; }
+ void setMinLod(GLfloat minLod) { mMinLod = minLod; }
+ void setMaxLod(GLfloat maxLod) { mMaxLod = maxLod; }
+ void setComparisonMode(GLenum comparisonMode) { mComparisonMode = comparisonMode; }
+ void setComparisonFunc(GLenum comparisonFunc) { mComparisonFunc = comparisonFunc; }
+
+ GLenum getMinFilter() const { return mMinFilter; }
+ GLenum getMagFilter() const { return mMagFilter; }
+ GLenum getWrapS() const { return mWrapS; }
+ GLenum getWrapT() const { return mWrapT; }
+ GLenum getWrapR() const { return mWrapR; }
+ GLfloat getMinLod() const { return mMinLod; }
+ GLfloat getMaxLod() const { return mMaxLod; }
+ GLenum getComparisonMode() const { return mComparisonMode; }
+ GLenum getComparisonFunc() const { return mComparisonFunc; }
+
+ void getState(SamplerState *samplerState) const;
+
+ private:
+ GLenum mMinFilter;
+ GLenum mMagFilter;
+ GLenum mWrapS;
+ GLenum mWrapT;
+ GLenum mWrapR;
+ GLfloat mMinLod;
+ GLfloat mMaxLod;
+ GLenum mComparisonMode;
+ GLenum mComparisonFunc;
+};
+
+}
+
+#endif // LIBGLESV2_SAMPLER_H_
diff --git a/chromium/third_party/angle/src/libGLESv2/Shader.cpp b/chromium/third_party/angle/src/libGLESv2/Shader.cpp
index f6a2f03dfc4..7d0d781093e 100644
--- a/chromium/third_party/angle/src/libGLESv2/Shader.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/Shader.cpp
@@ -12,7 +12,7 @@
#include "libGLESv2/Shader.h"
#include "GLSLANG/ShaderLang.h"
-#include "libGLESv2/utilities.h"
+#include "common/utilities.h"
#include "libGLESv2/renderer/Renderer.h"
#include "libGLESv2/Constants.h"
#include "libGLESv2/ResourceManager.h"
@@ -25,22 +25,16 @@ void *Shader::mVertexCompiler = NULL;
Shader::Shader(ResourceManager *manager, const rx::Renderer *renderer, GLuint handle)
: mHandle(handle), mRenderer(renderer), mResourceManager(manager)
{
- mSource = NULL;
- mHlsl = NULL;
- mInfoLog = NULL;
-
uncompile();
initializeCompiler();
mRefCount = 0;
mDeleteStatus = false;
+ mShaderVersion = 100;
}
Shader::~Shader()
{
- delete[] mSource;
- delete[] mHlsl;
- delete[] mInfoLog;
}
GLuint Shader::getHandle() const
@@ -48,69 +42,31 @@ GLuint Shader::getHandle() const
return mHandle;
}
-void Shader::setSource(GLsizei count, const char **string, const GLint *length)
+void Shader::setSource(GLsizei count, const char *const *string, const GLint *length)
{
- delete[] mSource;
- int totalLength = 0;
-
- for (int i = 0; i < count; i++)
- {
- if (length && length[i] >= 0)
- {
- totalLength += length[i];
- }
- else
- {
- totalLength += (int)strlen(string[i]);
- }
- }
-
- mSource = new char[totalLength + 1];
- char *code = mSource;
+ std::ostringstream stream;
for (int i = 0; i < count; i++)
{
- int stringLength;
-
- if (length && length[i] >= 0)
- {
- stringLength = length[i];
- }
- else
- {
- stringLength = (int)strlen(string[i]);
- }
-
- strncpy(code, string[i], stringLength);
- code += stringLength;
+ stream << string[i];
}
- mSource[totalLength] = '\0';
+ mSource = stream.str();
}
int Shader::getInfoLogLength() const
{
- if (!mInfoLog)
- {
- return 0;
- }
- else
- {
- return strlen(mInfoLog) + 1;
- }
+ return mInfoLog.empty() ? 0 : (mInfoLog.length() + 1);
}
-void Shader::getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog)
+void Shader::getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog) const
{
int index = 0;
if (bufSize > 0)
{
- if (mInfoLog)
- {
- index = std::min(bufSize - 1, (int)strlen(mInfoLog));
- memcpy(infoLog, mInfoLog, index);
- }
+ index = std::min(bufSize - 1, static_cast<GLsizei>(mInfoLog.length()));
+ memcpy(infoLog, mInfoLog.c_str(), index);
infoLog[index] = '\0';
}
@@ -123,39 +79,22 @@ void Shader::getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog)
int Shader::getSourceLength() const
{
- if (!mSource)
- {
- return 0;
- }
- else
- {
- return strlen(mSource) + 1;
- }
+ return mSource.empty() ? 0 : (mSource.length() + 1);
}
int Shader::getTranslatedSourceLength() const
{
- if (!mHlsl)
- {
- return 0;
- }
- else
- {
- return strlen(mHlsl) + 1;
- }
+ return mHlsl.empty() ? 0 : (mHlsl.length() + 1);
}
-void Shader::getSourceImpl(char *source, GLsizei bufSize, GLsizei *length, char *buffer)
+void Shader::getSourceImpl(const std::string &source, GLsizei bufSize, GLsizei *length, char *buffer) const
{
int index = 0;
if (bufSize > 0)
{
- if (source)
- {
- index = std::min(bufSize - 1, (int)strlen(source));
- memcpy(buffer, source, index);
- }
+ index = std::min(bufSize - 1, static_cast<GLsizei>(source.length()));
+ memcpy(buffer, source.c_str(), index);
buffer[index] = '\0';
}
@@ -166,27 +105,37 @@ void Shader::getSourceImpl(char *source, GLsizei bufSize, GLsizei *length, char
}
}
-void Shader::getSource(GLsizei bufSize, GLsizei *length, char *buffer)
+void Shader::getSource(GLsizei bufSize, GLsizei *length, char *buffer) const
{
getSourceImpl(mSource, bufSize, length, buffer);
}
-void Shader::getTranslatedSource(GLsizei bufSize, GLsizei *length, char *buffer)
+void Shader::getTranslatedSource(GLsizei bufSize, GLsizei *length, char *buffer) const
{
getSourceImpl(mHlsl, bufSize, length, buffer);
}
-const sh::ActiveUniforms &Shader::getUniforms()
+const std::vector<Uniform> &Shader::getUniforms() const
{
return mActiveUniforms;
}
-bool Shader::isCompiled()
+const std::vector<InterfaceBlock> &Shader::getInterfaceBlocks() const
{
- return mHlsl != NULL;
+ return mActiveInterfaceBlocks;
}
-const char *Shader::getHLSL()
+std::vector<PackedVarying> &Shader::getVaryings()
+{
+ return mVaryings;
+}
+
+bool Shader::isCompiled() const
+{
+ return !mHlsl.empty();
+}
+
+const std::string &Shader::getHLSL() const
{
return mHlsl;
}
@@ -245,9 +194,15 @@ void Shader::initializeCompiler()
resources.MaxDrawBuffers = mRenderer->getMaxRenderTargets();
resources.OES_standard_derivatives = mRenderer->getDerivativeInstructionSupport();
resources.EXT_draw_buffers = mRenderer->getMaxRenderTargets() > 1;
+ resources.EXT_shader_texture_lod = 1;
// resources.OES_EGL_image_external = mRenderer->getShareHandleSupport() ? 1 : 0; // TODO: commented out until the extension is actually supported.
resources.FragmentPrecisionHigh = 1; // Shader Model 2+ always supports FP24 (s16e7) which corresponds to highp
resources.EXT_frag_depth = 1; // Shader Model 2+ always supports explicit depth output
+ // GLSL ES 3.0 constants
+ resources.MaxVertexOutputVectors = mRenderer->getMaxVaryingVectors();
+ resources.MaxFragmentInputVectors = mRenderer->getMaxVaryingVectors();
+ resources.MinProgramTexelOffset = -8; // D3D10_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE
+ resources.MaxProgramTexelOffset = 7; // D3D10_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE
mFragmentCompiler = ShConstructCompiler(SH_FRAGMENT_SHADER, SH_GLES2_SPEC, hlslVersion, &resources);
mVertexCompiler = ShConstructCompiler(SH_VERTEX_SHADER, SH_GLES2_SPEC, hlslVersion, &resources);
@@ -266,57 +221,37 @@ void Shader::releaseCompiler()
ShFinalize();
}
-void Shader::parseVaryings()
+void Shader::parseVaryings(void *compiler)
{
- if (mHlsl)
+ if (!mHlsl.empty())
{
- const char *input = strstr(mHlsl, "// Varyings") + 12;
+ std::vector<Varying> *activeVaryings;
+ ShGetInfoPointer(compiler, SH_ACTIVE_VARYINGS_ARRAY, reinterpret_cast<void**>(&activeVaryings));
- while(true)
+ for (size_t varyingIndex = 0; varyingIndex < activeVaryings->size(); varyingIndex++)
{
- char varyingType[256];
- char varyingName[256];
-
- int matches = sscanf(input, "static %255s %255s", varyingType, varyingName);
-
- if (matches != 2)
- {
- break;
- }
-
- char *array = strstr(varyingName, "[");
- int size = 1;
-
- if (array)
- {
- size = atoi(array + 1);
- *array = '\0';
- }
-
- mVaryings.push_back(Varying(parseType(varyingType), varyingName, size, array != NULL));
-
- input = strstr(input, ";") + 2;
+ mVaryings.push_back(PackedVarying((*activeVaryings)[varyingIndex]));
}
- mUsesMultipleRenderTargets = strstr(mHlsl, "GL_USES_MRT") != NULL;
- mUsesFragColor = strstr(mHlsl, "GL_USES_FRAG_COLOR") != NULL;
- mUsesFragData = strstr(mHlsl, "GL_USES_FRAG_DATA") != NULL;
- mUsesFragCoord = strstr(mHlsl, "GL_USES_FRAG_COORD") != NULL;
- mUsesFrontFacing = strstr(mHlsl, "GL_USES_FRONT_FACING") != NULL;
- mUsesPointSize = strstr(mHlsl, "GL_USES_POINT_SIZE") != NULL;
- mUsesPointCoord = strstr(mHlsl, "GL_USES_POINT_COORD") != NULL;
- mUsesDepthRange = strstr(mHlsl, "GL_USES_DEPTH_RANGE") != NULL;
- mUsesFragDepth = strstr(mHlsl, "GL_USES_FRAG_DEPTH") != NULL;
- mUsesDiscardRewriting = strstr(mHlsl, "ANGLE_USES_DISCARD_REWRITING") != NULL;
+ mUsesMultipleRenderTargets = mHlsl.find("GL_USES_MRT") != std::string::npos;
+ mUsesFragColor = mHlsl.find("GL_USES_FRAG_COLOR") != std::string::npos;
+ mUsesFragData = mHlsl.find("GL_USES_FRAG_DATA") != std::string::npos;
+ mUsesFragCoord = mHlsl.find("GL_USES_FRAG_COORD") != std::string::npos;
+ mUsesFrontFacing = mHlsl.find("GL_USES_FRONT_FACING") != std::string::npos;
+ mUsesPointSize = mHlsl.find("GL_USES_POINT_SIZE") != std::string::npos;
+ mUsesPointCoord = mHlsl.find("GL_USES_POINT_COORD") != std::string::npos;
+ mUsesDepthRange = mHlsl.find("GL_USES_DEPTH_RANGE") != std::string::npos;
+ mUsesFragDepth = mHlsl.find("GL_USES_FRAG_DEPTH") != std::string::npos;
+ mUsesDiscardRewriting = mHlsl.find("ANGLE_USES_DISCARD_REWRITING") != std::string::npos;
+ mUsesNestedBreak = mHlsl.find("ANGLE_USES_NESTED_BREAK") != std::string::npos;
}
}
void Shader::resetVaryingsRegisterAssignment()
{
- for (VaryingList::iterator var = mVaryings.begin(); var != mVaryings.end(); var++)
+ for (unsigned int varyingIndex = 0; varyingIndex < mVaryings.size(); varyingIndex++)
{
- var->reg = -1;
- var->col = -1;
+ mVaryings[varyingIndex].resetRegisterAssignment();
}
}
@@ -324,10 +259,8 @@ void Shader::resetVaryingsRegisterAssignment()
void Shader::uncompile()
{
// set by compileToHLSL
- delete[] mHlsl;
- mHlsl = NULL;
- delete[] mInfoLog;
- mInfoLog = NULL;
+ mHlsl.clear();
+ mInfoLog.clear();
// set by parseVaryings
mVaryings.clear();
@@ -341,20 +274,16 @@ void Shader::uncompile()
mUsesPointCoord = false;
mUsesDepthRange = false;
mUsesFragDepth = false;
+ mShaderVersion = 100;
mUsesDiscardRewriting = false;
+ mUsesNestedBreak = false;
mActiveUniforms.clear();
+ mActiveInterfaceBlocks.clear();
}
void Shader::compileToHLSL(void *compiler)
{
- // ensure we don't pass a NULL source to the compiler
- const char *source = "\0";
- if (mSource)
- {
- source = mSource;
- }
-
// ensure the compiler is loaded
initializeCompiler();
@@ -363,164 +292,189 @@ void Shader::compileToHLSL(void *compiler)
if (perfActive())
{
sourcePath = getTempPath();
- writeFile(sourcePath.c_str(), source, strlen(source));
+ writeFile(sourcePath.c_str(), mSource.c_str(), mSource.length());
compileOptions |= SH_LINE_DIRECTIVES;
}
int result;
if (sourcePath.empty())
{
- result = ShCompile(compiler, &source, 1, compileOptions);
+ const char* sourceStrings[] =
+ {
+ mSource.c_str(),
+ };
+
+ result = ShCompile(compiler, sourceStrings, ArraySize(sourceStrings), compileOptions);
}
else
{
- const char* sourceStrings[2] =
+ const char* sourceStrings[] =
{
sourcePath.c_str(),
- source
+ mSource.c_str(),
};
- result = ShCompile(compiler, sourceStrings, 2, compileOptions | SH_SOURCE_PATH);
+ result = ShCompile(compiler, sourceStrings, ArraySize(sourceStrings), compileOptions | SH_SOURCE_PATH);
}
- if (result)
+ size_t shaderVersion = 100;
+ ShGetInfo(compiler, SH_SHADER_VERSION, &shaderVersion);
+
+ mShaderVersion = static_cast<int>(shaderVersion);
+
+ if (shaderVersion == 300 && mRenderer->getCurrentClientVersion() < 3)
+ {
+ mInfoLog = "GLSL ES 3.00 is not supported by OpenGL ES 2.0 contexts";
+ TRACE("\n%s", mInfoLog.c_str());
+ }
+ else if (result)
{
size_t objCodeLen = 0;
ShGetInfo(compiler, SH_OBJECT_CODE_LENGTH, &objCodeLen);
- mHlsl = new char[objCodeLen];
- ShGetObjectCode(compiler, mHlsl);
+
+ char* outputHLSL = new char[objCodeLen];
+ ShGetObjectCode(compiler, outputHLSL);
+
+#ifdef _DEBUG
+ std::ostringstream hlslStream;
+ hlslStream << "// GLSL\n";
+ hlslStream << "//\n";
+
+ size_t curPos = 0;
+ while (curPos != std::string::npos)
+ {
+ size_t nextLine = mSource.find("\n", curPos);
+ size_t len = (nextLine == std::string::npos) ? std::string::npos : (nextLine - curPos + 1);
+
+ hlslStream << "// " << mSource.substr(curPos, len);
+
+ curPos = (nextLine == std::string::npos) ? std::string::npos : (nextLine + 1);
+ }
+ hlslStream << "\n\n";
+ hlslStream << outputHLSL;
+ mHlsl = hlslStream.str();
+#else
+ mHlsl = outputHLSL;
+#endif
+
+ delete[] outputHLSL;
void *activeUniforms;
ShGetInfoPointer(compiler, SH_ACTIVE_UNIFORMS_ARRAY, &activeUniforms);
- mActiveUniforms = *(sh::ActiveUniforms*)activeUniforms;
+ mActiveUniforms = *(std::vector<Uniform>*)activeUniforms;
+
+ void *activeInterfaceBlocks;
+ ShGetInfoPointer(compiler, SH_ACTIVE_INTERFACE_BLOCKS_ARRAY, &activeInterfaceBlocks);
+ mActiveInterfaceBlocks = *(std::vector<InterfaceBlock>*)activeInterfaceBlocks;
}
else
{
size_t infoLogLen = 0;
ShGetInfo(compiler, SH_INFO_LOG_LENGTH, &infoLogLen);
- mInfoLog = new char[infoLogLen];
- ShGetInfoLog(compiler, mInfoLog);
- TRACE("\n%s", mInfoLog);
+ char* infoLog = new char[infoLogLen];
+ ShGetInfoLog(compiler, infoLog);
+ mInfoLog = infoLog;
+
+ TRACE("\n%s", mInfoLog.c_str());
}
}
-GLenum Shader::parseType(const std::string &type)
+rx::D3DWorkaroundType Shader::getD3DWorkarounds() const
{
- if (type == "float")
- {
- return GL_FLOAT;
- }
- else if (type == "float2")
- {
- return GL_FLOAT_VEC2;
- }
- else if (type == "float3")
- {
- return GL_FLOAT_VEC3;
- }
- else if (type == "float4")
- {
- return GL_FLOAT_VEC4;
- }
- else if (type == "float2x2")
+ if (mUsesDiscardRewriting)
{
- return GL_FLOAT_MAT2;
+ // ANGLE issue 486:
+ // Work-around a D3D9 compiler bug that presents itself when using conditional discard, by disabling optimization
+ return rx::ANGLE_D3D_WORKAROUND_SKIP_OPTIMIZATION;
}
- else if (type == "float3x3")
- {
- return GL_FLOAT_MAT3;
- }
- else if (type == "float4x4")
+
+ if (mUsesNestedBreak)
{
- return GL_FLOAT_MAT4;
+ // ANGLE issue 603:
+ // Work-around a D3D9 compiler bug that presents itself when using break in a nested loop, by maximizing optimization
+ // We want to keep the use of ANGLE_D3D_WORKAROUND_MAX_OPTIMIZATION minimal to prevent hangs, so usesDiscard takes precedence
+ return rx::ANGLE_D3D_WORKAROUND_MAX_OPTIMIZATION;
}
- else UNREACHABLE();
- return GL_NONE;
+ return rx::ANGLE_D3D_WORKAROUND_NONE;
}
+// [OpenGL ES SL 3.00.4] Section 11 p. 120
+// Vertex Outs/Fragment Ins packing priorities
+static const GLenum varyingPriorityList[] =
+{
+ // 1. Arrays of mat4 and mat4
+ GL_FLOAT_MAT4,
+
+ // Non-square matrices of type matCxR consume the same space as a square
+ // matrix of type matN where N is the greater of C and R
+ GL_FLOAT_MAT3x4,
+ GL_FLOAT_MAT4x3,
+ GL_FLOAT_MAT2x4,
+ GL_FLOAT_MAT4x2,
+
+ // 2. Arrays of mat2 and mat2 (since they occupy full rows)
+ GL_FLOAT_MAT2,
+
+ // 3. Arrays of vec4 and vec4
+ GL_FLOAT_VEC4,
+ GL_INT_VEC4,
+ GL_UNSIGNED_INT_VEC4,
+
+ // 4. Arrays of mat3 and mat3
+ GL_FLOAT_MAT3,
+ GL_FLOAT_MAT2x3,
+ GL_FLOAT_MAT3x2,
+
+ // 5. Arrays of vec3 and vec3
+ GL_FLOAT_VEC3,
+ GL_INT_VEC3,
+ GL_UNSIGNED_INT_VEC3,
+
+ // 6. Arrays of vec2 and vec2
+ GL_FLOAT_VEC2,
+ GL_INT_VEC2,
+ GL_UNSIGNED_INT_VEC2,
+
+ // 7. Arrays of float and float
+ GL_FLOAT,
+ GL_INT,
+ GL_UNSIGNED_INT,
+};
+
// true if varying x has a higher priority in packing than y
-bool Shader::compareVarying(const Varying &x, const Varying &y)
+bool Shader::compareVarying(const PackedVarying &x, const PackedVarying &y)
{
- if(x.type == y.type)
+ if (x.type == y.type)
{
- return x.size > y.size;
+ return x.arraySize > y.arraySize;
}
- switch (x.type)
+ // Special case for handling structs: we sort these to the end of the list
+ if (x.type == GL_STRUCT_ANGLEX)
{
- case GL_FLOAT_MAT4: return true;
- case GL_FLOAT_MAT2:
- switch(y.type)
- {
- case GL_FLOAT_MAT4: return false;
- case GL_FLOAT_MAT2: return true;
- case GL_FLOAT_VEC4: return true;
- case GL_FLOAT_MAT3: return true;
- case GL_FLOAT_VEC3: return true;
- case GL_FLOAT_VEC2: return true;
- case GL_FLOAT: return true;
- default: UNREACHABLE();
- }
- break;
- case GL_FLOAT_VEC4:
- switch(y.type)
- {
- case GL_FLOAT_MAT4: return false;
- case GL_FLOAT_MAT2: return false;
- case GL_FLOAT_VEC4: return true;
- case GL_FLOAT_MAT3: return true;
- case GL_FLOAT_VEC3: return true;
- case GL_FLOAT_VEC2: return true;
- case GL_FLOAT: return true;
- default: UNREACHABLE();
- }
- break;
- case GL_FLOAT_MAT3:
- switch(y.type)
- {
- case GL_FLOAT_MAT4: return false;
- case GL_FLOAT_MAT2: return false;
- case GL_FLOAT_VEC4: return false;
- case GL_FLOAT_MAT3: return true;
- case GL_FLOAT_VEC3: return true;
- case GL_FLOAT_VEC2: return true;
- case GL_FLOAT: return true;
- default: UNREACHABLE();
- }
- break;
- case GL_FLOAT_VEC3:
- switch(y.type)
- {
- case GL_FLOAT_MAT4: return false;
- case GL_FLOAT_MAT2: return false;
- case GL_FLOAT_VEC4: return false;
- case GL_FLOAT_MAT3: return false;
- case GL_FLOAT_VEC3: return true;
- case GL_FLOAT_VEC2: return true;
- case GL_FLOAT: return true;
- default: UNREACHABLE();
- }
- break;
- case GL_FLOAT_VEC2:
- switch(y.type)
- {
- case GL_FLOAT_MAT4: return false;
- case GL_FLOAT_MAT2: return false;
- case GL_FLOAT_VEC4: return false;
- case GL_FLOAT_MAT3: return false;
- case GL_FLOAT_VEC3: return false;
- case GL_FLOAT_VEC2: return true;
- case GL_FLOAT: return true;
- default: UNREACHABLE();
- }
- break;
- case GL_FLOAT: return false;
- default: UNREACHABLE();
+ return false;
+ }
+
+ unsigned int xPriority = GL_INVALID_INDEX;
+ unsigned int yPriority = GL_INVALID_INDEX;
+
+ for (unsigned int priorityIndex = 0; priorityIndex < ArraySize(varyingPriorityList); priorityIndex++)
+ {
+ if (varyingPriorityList[priorityIndex] == x.type) xPriority = priorityIndex;
+ if (varyingPriorityList[priorityIndex] == y.type) yPriority = priorityIndex;
+ if (xPriority != GL_INVALID_INDEX && yPriority != GL_INVALID_INDEX) break;
}
- return false;
+ ASSERT(xPriority != GL_INVALID_INDEX && yPriority != GL_INVALID_INDEX);
+
+ return xPriority <= yPriority;
+}
+
+int Shader::getShaderVersion() const
+{
+ return mShaderVersion;
}
VertexShader::VertexShader(ResourceManager *manager, const rx::Renderer *renderer, GLuint handle)
@@ -542,7 +496,7 @@ void VertexShader::uncompile()
Shader::uncompile();
// set by ParseAttributes
- mAttributes.clear();
+ mActiveAttributes.clear();
}
void VertexShader::compile()
@@ -551,7 +505,7 @@ void VertexShader::compile()
compileToHLSL(mVertexCompiler);
parseAttributes();
- parseVaryings();
+ parseVaryings(mVertexCompiler);
}
int VertexShader::getSemanticIndex(const std::string &attributeName)
@@ -559,14 +513,16 @@ int VertexShader::getSemanticIndex(const std::string &attributeName)
if (!attributeName.empty())
{
int semanticIndex = 0;
- for (AttributeArray::iterator attribute = mAttributes.begin(); attribute != mAttributes.end(); attribute++)
+ for (unsigned int attributeIndex = 0; attributeIndex < mActiveAttributes.size(); attributeIndex++)
{
- if (attribute->name == attributeName)
+ const ShaderVariable &attribute = mActiveAttributes[attributeIndex];
+
+ if (attribute.name == attributeName)
{
return semanticIndex;
}
- semanticIndex += VariableRowCount(attribute->type);
+ semanticIndex += AttributeRegisterCount(attribute.type);
}
}
@@ -575,27 +531,12 @@ int VertexShader::getSemanticIndex(const std::string &attributeName)
void VertexShader::parseAttributes()
{
- const char *hlsl = getHLSL();
- if (hlsl)
+ const std::string &hlsl = getHLSL();
+ if (!hlsl.empty())
{
- const char *input = strstr(hlsl, "// Attributes") + 14;
-
- while(true)
- {
- char attributeType[256];
- char attributeName[256];
-
- int matches = sscanf(input, "static %255s _%255s", attributeType, attributeName);
-
- if (matches != 2)
- {
- break;
- }
-
- mAttributes.push_back(Attribute(parseType(attributeType), attributeName));
-
- input = strstr(input, ";") + 2;
- }
+ void *activeAttributes;
+ ShGetInfoPointer(mVertexCompiler, SH_ACTIVE_ATTRIBUTES_ARRAY, &activeAttributes);
+ mActiveAttributes = *(std::vector<Attribute>*)activeAttributes;
}
}
@@ -618,7 +559,45 @@ void FragmentShader::compile()
uncompile();
compileToHLSL(mFragmentCompiler);
- parseVaryings();
- mVaryings.sort(compareVarying);
+ parseVaryings(mFragmentCompiler);
+ std::sort(mVaryings.begin(), mVaryings.end(), compareVarying);
+
+ const std::string &hlsl = getHLSL();
+ if (!hlsl.empty())
+ {
+ void *activeOutputVariables;
+ ShGetInfoPointer(mFragmentCompiler, SH_ACTIVE_OUTPUT_VARIABLES_ARRAY, &activeOutputVariables);
+ mActiveOutputVariables = *(std::vector<Attribute>*)activeOutputVariables;
+ }
}
+
+void FragmentShader::uncompile()
+{
+ Shader::uncompile();
+
+ mActiveOutputVariables.clear();
+}
+
+const std::vector<Attribute> &FragmentShader::getOutputVariables() const
+{
+ return mActiveOutputVariables;
+}
+
+ShShaderOutput Shader::getCompilerOutputType(GLenum shader)
+{
+ void *compiler = NULL;
+
+ switch (shader)
+ {
+ case GL_VERTEX_SHADER: compiler = mVertexCompiler; break;
+ case GL_FRAGMENT_SHADER: compiler = mFragmentCompiler; break;
+ default: UNREACHABLE(); return SH_HLSL9_OUTPUT;
+ }
+
+ size_t outputType = 0;
+ ShGetInfo(compiler, SH_OUTPUT_TYPE, &outputType);
+
+ return static_cast<ShShaderOutput>(outputType);
+}
+
}
diff --git a/chromium/third_party/angle/src/libGLESv2/Shader.h b/chromium/third_party/angle/src/libGLESv2/Shader.h
index 848d4c99a71..a4189499406 100644
--- a/chromium/third_party/angle/src/libGLESv2/Shader.h
+++ b/chromium/third_party/angle/src/libGLESv2/Shader.h
@@ -12,14 +12,16 @@
#ifndef LIBGLESV2_SHADER_H_
#define LIBGLESV2_SHADER_H_
-#define GL_APICALL
+#include <GLES3/gl3.h>
#include <GLES2/gl2.h>
#include <string>
#include <list>
#include <vector>
-#include "compiler/Uniform.h"
+#include "common/shadervars.h"
#include "common/angleutils.h"
+#include "libGLESv2/angletypes.h"
+#include "GLSLANG/ShaderLang.h"
namespace rx
{
@@ -30,27 +32,26 @@ namespace gl
{
class ResourceManager;
-struct Varying
+struct PackedVarying : public Varying
{
- Varying(GLenum type, const std::string &name, int size, bool array)
- : type(type), name(name), size(size), array(array), reg(-1), col(-1)
- {
- }
+ unsigned int registerIndex; // Assigned during link
- GLenum type;
- std::string name;
- int size; // Number of 'type' elements
- bool array;
+ PackedVarying(const Varying &varying)
+ : Varying(varying),
+ registerIndex(GL_INVALID_INDEX)
+ {}
- int reg; // First varying register, assigned during link
- int col; // First register element, assigned during link
-};
+ bool registerAssigned() const { return registerIndex != GL_INVALID_INDEX; }
-typedef std::list<Varying> VaryingList;
+ void resetRegisterAssignment()
+ {
+ registerIndex = GL_INVALID_INDEX;
+ }
+};
class Shader
{
- friend class ProgramBinary;
+ friend class DynamicHLSL;
public:
Shader(ResourceManager *manager, const rx::Renderer *renderer, GLuint handle);
@@ -61,42 +62,49 @@ class Shader
GLuint getHandle() const;
void deleteSource();
- void setSource(GLsizei count, const char **string, const GLint *length);
+ void setSource(GLsizei count, const char *const *string, const GLint *length);
int getInfoLogLength() const;
- void getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog);
+ void getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog) const;
int getSourceLength() const;
- void getSource(GLsizei bufSize, GLsizei *length, char *buffer);
+ void getSource(GLsizei bufSize, GLsizei *length, char *buffer) const;
int getTranslatedSourceLength() const;
- void getTranslatedSource(GLsizei bufSize, GLsizei *length, char *buffer);
- const sh::ActiveUniforms &getUniforms();
+ void getTranslatedSource(GLsizei bufSize, GLsizei *length, char *buffer) const;
+ const std::vector<Uniform> &getUniforms() const;
+ const std::vector<InterfaceBlock> &getInterfaceBlocks() const;
+ std::vector<PackedVarying> &getVaryings();
virtual void compile() = 0;
virtual void uncompile();
- bool isCompiled();
- const char *getHLSL();
+ bool isCompiled() const;
+ const std::string &getHLSL() const;
void addRef();
void release();
unsigned int getRefCount() const;
bool isFlaggedForDeletion() const;
void flagForDeletion();
+ int getShaderVersion() const;
+ void resetVaryingsRegisterAssignment();
static void releaseCompiler();
+ static ShShaderOutput getCompilerOutputType(GLenum shader);
+
+ bool usesDepthRange() const { return mUsesDepthRange; }
+ bool usesPointSize() const { return mUsesPointSize; }
+ rx::D3DWorkaroundType getD3DWorkarounds() const;
protected:
- void parseVaryings();
- void resetVaryingsRegisterAssignment();
+ void parseVaryings(void *compiler);
void compileToHLSL(void *compiler);
- void getSourceImpl(char *source, GLsizei bufSize, GLsizei *length, char *buffer);
+ void getSourceImpl(const std::string &source, GLsizei bufSize, GLsizei *length, char *buffer) const;
- static GLenum parseType(const std::string &type);
- static bool compareVarying(const Varying &x, const Varying &y);
+ static bool compareVarying(const PackedVarying &x, const PackedVarying &y);
const rx::Renderer *const mRenderer;
- VaryingList mVaryings;
+ std::vector<PackedVarying> mVaryings;
bool mUsesMultipleRenderTargets;
bool mUsesFragColor;
@@ -107,7 +115,9 @@ class Shader
bool mUsesPointCoord;
bool mUsesDepthRange;
bool mUsesFragDepth;
+ int mShaderVersion;
bool mUsesDiscardRewriting;
+ bool mUsesNestedBreak;
static void *mFragmentCompiler;
static void *mVertexCompiler;
@@ -121,33 +131,18 @@ class Shader
unsigned int mRefCount; // Number of program objects this shader is attached to
bool mDeleteStatus; // Flag to indicate that the shader can be deleted when no longer in use
- char *mSource;
- char *mHlsl;
- char *mInfoLog;
- sh::ActiveUniforms mActiveUniforms;
+ std::string mSource;
+ std::string mHlsl;
+ std::string mInfoLog;
+ std::vector<Uniform> mActiveUniforms;
+ std::vector<InterfaceBlock> mActiveInterfaceBlocks;
ResourceManager *mResourceManager;
};
-struct Attribute
-{
- Attribute() : type(GL_NONE), name("")
- {
- }
-
- Attribute(GLenum type, const std::string &name) : type(type), name(name)
- {
- }
-
- GLenum type;
- std::string name;
-};
-
-typedef std::vector<Attribute> AttributeArray;
-
class VertexShader : public Shader
{
- friend class ProgramBinary;
+ friend class DynamicHLSL;
public:
VertexShader(ResourceManager *manager, const rx::Renderer *renderer, GLuint handle);
@@ -159,12 +154,14 @@ class VertexShader : public Shader
virtual void uncompile();
int getSemanticIndex(const std::string &attributeName);
+ const std::vector<Attribute> &activeAttributes() const { return mActiveAttributes; }
+
private:
DISALLOW_COPY_AND_ASSIGN(VertexShader);
void parseAttributes();
- AttributeArray mAttributes;
+ std::vector<Attribute> mActiveAttributes;
};
class FragmentShader : public Shader
@@ -176,9 +173,13 @@ class FragmentShader : public Shader
virtual GLenum getType();
virtual void compile();
+ virtual void uncompile();
+ const std::vector<Attribute> &getOutputVariables() const;
private:
DISALLOW_COPY_AND_ASSIGN(FragmentShader);
+
+ std::vector<Attribute> mActiveOutputVariables;
};
}
diff --git a/chromium/third_party/angle/src/libGLESv2/Texture.cpp b/chromium/third_party/angle/src/libGLESv2/Texture.cpp
index cee9c57dacf..baa5bc68a96 100644
--- a/chromium/third_party/angle/src/libGLESv2/Texture.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/Texture.cpp
@@ -12,19 +12,44 @@
#include "libGLESv2/Texture.h"
#include "libGLESv2/main.h"
-#include "libGLESv2/mathutil.h"
-#include "libGLESv2/utilities.h"
-#include "libGLESv2/renderer/Blit.h"
+#include "common/mathutil.h"
+#include "common/utilities.h"
+#include "libGLESv2/formatutils.h"
#include "libGLESv2/Renderbuffer.h"
#include "libGLESv2/renderer/Image.h"
#include "libGLESv2/renderer/Renderer.h"
#include "libGLESv2/renderer/TextureStorage.h"
#include "libEGL/Surface.h"
+#include "libGLESv2/Buffer.h"
+#include "libGLESv2/renderer/BufferStorage.h"
+#include "libGLESv2/renderer/RenderTarget.h"
namespace gl
{
-Texture::Texture(rx::Renderer *renderer, GLuint id) : RefCountObject(id)
+bool IsMipmapFiltered(const SamplerState &samplerState)
+{
+ switch (samplerState.minFilter)
+ {
+ case GL_NEAREST:
+ case GL_LINEAR:
+ return false;
+ case GL_NEAREST_MIPMAP_NEAREST:
+ case GL_LINEAR_MIPMAP_NEAREST:
+ case GL_NEAREST_MIPMAP_LINEAR:
+ case GL_LINEAR_MIPMAP_LINEAR:
+ return true;
+ default: UNREACHABLE();
+ return false;
+ }
+}
+
+bool IsRenderTargetUsage(GLenum usage)
+{
+ return (usage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
+}
+
+Texture::Texture(rx::Renderer *renderer, GLuint id, GLenum target) : RefCountObject(id)
{
mRenderer = renderer;
@@ -32,107 +57,129 @@ Texture::Texture(rx::Renderer *renderer, GLuint id) : RefCountObject(id)
mSamplerState.magFilter = GL_LINEAR;
mSamplerState.wrapS = GL_REPEAT;
mSamplerState.wrapT = GL_REPEAT;
+ mSamplerState.wrapR = GL_REPEAT;
mSamplerState.maxAnisotropy = 1.0f;
- mSamplerState.lodOffset = 0;
+ mSamplerState.baseLevel = 0;
+ mSamplerState.maxLevel = 1000;
+ mSamplerState.minLod = -1000.0f;
+ mSamplerState.maxLod = 1000.0f;
+ mSamplerState.compareMode = GL_NONE;
+ mSamplerState.compareFunc = GL_LEQUAL;
+ mSamplerState.swizzleRed = GL_RED;
+ mSamplerState.swizzleGreen = GL_GREEN;
+ mSamplerState.swizzleBlue = GL_BLUE;
+ mSamplerState.swizzleAlpha = GL_ALPHA;
mUsage = GL_NONE;
-
+
mDirtyImages = true;
mImmutable = false;
+
+ mTarget = target;
}
Texture::~Texture()
{
}
-// Returns true on successful filter state update (valid enum parameter)
-bool Texture::setMinFilter(GLenum filter)
+GLenum Texture::getTarget() const
{
- switch (filter)
- {
- case GL_NEAREST:
- case GL_LINEAR:
- case GL_NEAREST_MIPMAP_NEAREST:
- case GL_LINEAR_MIPMAP_NEAREST:
- case GL_NEAREST_MIPMAP_LINEAR:
- case GL_LINEAR_MIPMAP_LINEAR:
- mSamplerState.minFilter = filter;
- return true;
- default:
- return false;
- }
+ return mTarget;
}
-// Returns true on successful filter state update (valid enum parameter)
-bool Texture::setMagFilter(GLenum filter)
+void Texture::addProxyRef(const FramebufferAttachment *proxy)
{
- switch (filter)
- {
- case GL_NEAREST:
- case GL_LINEAR:
- mSamplerState.magFilter = filter;
- return true;
- default:
- return false;
- }
+ mRenderbufferProxies.addRef(proxy);
}
-// Returns true on successful wrap state update (valid enum parameter)
-bool Texture::setWrapS(GLenum wrap)
+void Texture::releaseProxy(const FramebufferAttachment *proxy)
{
- switch (wrap)
- {
- case GL_REPEAT:
- case GL_CLAMP_TO_EDGE:
- case GL_MIRRORED_REPEAT:
- mSamplerState.wrapS = wrap;
- return true;
- default:
- return false;
- }
+ mRenderbufferProxies.release(proxy);
}
-// Returns true on successful wrap state update (valid enum parameter)
-bool Texture::setWrapT(GLenum wrap)
+void Texture::setMinFilter(GLenum filter)
{
- switch (wrap)
- {
- case GL_REPEAT:
- case GL_CLAMP_TO_EDGE:
- case GL_MIRRORED_REPEAT:
- mSamplerState.wrapT = wrap;
- return true;
- default:
- return false;
- }
+ mSamplerState.minFilter = filter;
}
-// Returns true on successful max anisotropy update (valid anisotropy value)
-bool Texture::setMaxAnisotropy(float textureMaxAnisotropy, float contextMaxAnisotropy)
+void Texture::setMagFilter(GLenum filter)
{
- textureMaxAnisotropy = std::min(textureMaxAnisotropy, contextMaxAnisotropy);
- if (textureMaxAnisotropy < 1.0f)
- {
- return false;
- }
+ mSamplerState.magFilter = filter;
+}
- mSamplerState.maxAnisotropy = textureMaxAnisotropy;
+void Texture::setWrapS(GLenum wrap)
+{
+ mSamplerState.wrapS = wrap;
+}
- return true;
+void Texture::setWrapT(GLenum wrap)
+{
+ mSamplerState.wrapT = wrap;
}
-// Returns true on successful usage state update (valid enum parameter)
-bool Texture::setUsage(GLenum usage)
+void Texture::setWrapR(GLenum wrap)
{
- switch (usage)
- {
- case GL_NONE:
- case GL_FRAMEBUFFER_ATTACHMENT_ANGLE:
- mUsage = usage;
- return true;
- default:
- return false;
- }
+ mSamplerState.wrapR = wrap;
+}
+
+void Texture::setMaxAnisotropy(float textureMaxAnisotropy, float contextMaxAnisotropy)
+{
+ mSamplerState.maxAnisotropy = std::min(textureMaxAnisotropy, contextMaxAnisotropy);
+}
+
+void Texture::setCompareMode(GLenum mode)
+{
+ mSamplerState.compareMode = mode;
+}
+
+void Texture::setCompareFunc(GLenum func)
+{
+ mSamplerState.compareFunc = func;
+}
+
+void Texture::setSwizzleRed(GLenum swizzle)
+{
+ mSamplerState.swizzleRed = swizzle;
+}
+
+void Texture::setSwizzleGreen(GLenum swizzle)
+{
+ mSamplerState.swizzleGreen = swizzle;
+}
+
+void Texture::setSwizzleBlue(GLenum swizzle)
+{
+ mSamplerState.swizzleBlue = swizzle;
+}
+
+void Texture::setSwizzleAlpha(GLenum swizzle)
+{
+ mSamplerState.swizzleAlpha = swizzle;
+}
+
+void Texture::setBaseLevel(GLint baseLevel)
+{
+ mSamplerState.baseLevel = baseLevel;
+}
+
+void Texture::setMaxLevel(GLint maxLevel)
+{
+ mSamplerState.maxLevel = maxLevel;
+}
+
+void Texture::setMinLod(GLfloat minLod)
+{
+ mSamplerState.minLod = minLod;
+}
+
+void Texture::setMaxLod(GLfloat maxLod)
+{
+ mSamplerState.maxLod = maxLod;
+}
+
+void Texture::setUsage(GLenum usage)
+{
+ mUsage = usage;
}
GLenum Texture::getMinFilter() const
@@ -155,21 +202,72 @@ GLenum Texture::getWrapT() const
return mSamplerState.wrapT;
}
+GLenum Texture::getWrapR() const
+{
+ return mSamplerState.wrapR;
+}
+
float Texture::getMaxAnisotropy() const
{
return mSamplerState.maxAnisotropy;
}
-int Texture::getLodOffset()
+GLenum Texture::getSwizzleRed() const
+{
+ return mSamplerState.swizzleRed;
+}
+
+GLenum Texture::getSwizzleGreen() const
+{
+ return mSamplerState.swizzleGreen;
+}
+
+GLenum Texture::getSwizzleBlue() const
+{
+ return mSamplerState.swizzleBlue;
+}
+
+GLenum Texture::getSwizzleAlpha() const
{
- rx::TextureStorageInterface *texture = getStorage(false);
- return texture ? texture->getLodOffset() : 0;
+ return mSamplerState.swizzleAlpha;
+}
+
+GLint Texture::getBaseLevel() const
+{
+ return mSamplerState.baseLevel;
+}
+
+GLint Texture::getMaxLevel() const
+{
+ return mSamplerState.maxLevel;
+}
+
+GLfloat Texture::getMinLod() const
+{
+ return mSamplerState.minLod;
+}
+
+GLfloat Texture::getMaxLod() const
+{
+ return mSamplerState.maxLod;
+}
+
+bool Texture::isSwizzled() const
+{
+ return mSamplerState.swizzleRed != GL_RED ||
+ mSamplerState.swizzleGreen != GL_GREEN ||
+ mSamplerState.swizzleBlue != GL_BLUE ||
+ mSamplerState.swizzleAlpha != GL_ALPHA;
}
void Texture::getSamplerState(SamplerState *sampler)
{
*sampler = mSamplerState;
- sampler->lodOffset = getLodOffset();
+
+ // Offset the effective base level by the texture storage's top level
+ rx::TextureStorageInterface *texture = getNativeTexture();
+ int topLevel = texture ? texture->getTopLevel() : 0;
+ sampler->baseLevel = topLevel + mSamplerState.baseLevel;
}
GLenum Texture::getUsage() const
@@ -177,57 +275,121 @@ GLenum Texture::getUsage() const
return mUsage;
}
-bool Texture::isMipmapFiltered() const
+GLint Texture::getBaseLevelWidth() const
{
- switch (mSamplerState.minFilter)
+ const rx::Image *baseImage = getBaseLevelImage();
+ return (baseImage ? baseImage->getWidth() : 0);
+}
+
+GLint Texture::getBaseLevelHeight() const
+{
+ const rx::Image *baseImage = getBaseLevelImage();
+ return (baseImage ? baseImage->getHeight() : 0);
+}
+
+GLint Texture::getBaseLevelDepth() const
+{
+ const rx::Image *baseImage = getBaseLevelImage();
+ return (baseImage ? baseImage->getDepth() : 0);
+}
+
+// Note: "base level image" is loosely defined to be any image from the base level,
+// where in the base of 2D array textures and cube maps there are several. Don't use
+// the base level image for anything except querying texture format and size.
+GLenum Texture::getBaseLevelInternalFormat() const
+{
+ const rx::Image *baseImage = getBaseLevelImage();
+ return (baseImage ? baseImage->getInternalFormat() : GL_NONE);
+}
+
+void Texture::setImage(const PixelUnpackState &unpack, GLenum type, const void *pixels, rx::Image *image)
+{
+ // No-op
+ if (image->getWidth() == 0 || image->getHeight() == 0 || image->getDepth() == 0)
{
- case GL_NEAREST:
- case GL_LINEAR:
- return false;
- case GL_NEAREST_MIPMAP_NEAREST:
- case GL_LINEAR_MIPMAP_NEAREST:
- case GL_NEAREST_MIPMAP_LINEAR:
- case GL_LINEAR_MIPMAP_LINEAR:
- return true;
- default: UNREACHABLE();
- return false;
+ return;
+ }
+
+ // We no longer need the "GLenum format" parameter to TexImage to determine what data format "pixels" contains.
+ // From our image internal format we know how many channels to expect, and "type" gives the format of pixel's components.
+ const void *pixelData = pixels;
+
+ if (unpack.pixelBuffer.id() != 0)
+ {
+ // Do a CPU readback here, if we have an unpack buffer bound and the fast GPU path is not supported
+ Buffer *pixelBuffer = unpack.pixelBuffer.get();
+ ptrdiff_t offset = reinterpret_cast<ptrdiff_t>(pixels);
+ const void *bufferData = pixelBuffer->getStorage()->getData();
+ pixelData = static_cast<const unsigned char *>(bufferData) + offset;
+ }
+
+ if (pixelData != NULL)
+ {
+ image->loadData(0, 0, 0, image->getWidth(), image->getHeight(), image->getDepth(), unpack.alignment, type, pixelData);
+ mDirtyImages = true;
}
}
-void Texture::setImage(GLint unpackAlignment, const void *pixels, rx::Image *image)
+bool Texture::isFastUnpackable(const PixelUnpackState &unpack, GLenum sizedInternalFormat)
{
- if (pixels != NULL)
+ return unpack.pixelBuffer.id() != 0 && mRenderer->supportsFastCopyBufferToTexture(sizedInternalFormat);
+}
+
+bool Texture::fastUnpackPixels(const PixelUnpackState &unpack, const void *pixels, const Box &destArea,
+ GLenum sizedInternalFormat, GLenum type, rx::RenderTarget *destRenderTarget)
+{
+ if (destArea.width <= 0 && destArea.height <= 0 && destArea.depth <= 0)
{
- image->loadData(0, 0, image->getWidth(), image->getHeight(), unpackAlignment, pixels);
- mDirtyImages = true;
+ return true;
}
+
+ // In order to perform the fast copy through the shader, we must have the right format, and be able
+ // to create a render target.
+ ASSERT(mRenderer->supportsFastCopyBufferToTexture(sizedInternalFormat));
+
+ unsigned int offset = reinterpret_cast<unsigned int>(pixels);
+
+ return mRenderer->fastCopyBufferToTexture(unpack, offset, destRenderTarget, sizedInternalFormat, type, destArea);
}
void Texture::setCompressedImage(GLsizei imageSize, const void *pixels, rx::Image *image)
{
if (pixels != NULL)
{
- image->loadCompressedData(0, 0, image->getWidth(), image->getHeight(), pixels);
+ image->loadCompressedData(0, 0, 0, image->getWidth(), image->getHeight(), image->getDepth(), pixels);
mDirtyImages = true;
}
}
-bool Texture::subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, rx::Image *image)
+bool Texture::subImage(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
+ GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels, rx::Image *image)
{
- if (pixels != NULL)
+ const void *pixelData = pixels;
+
+ // CPU readback & copy where direct GPU copy is not supported
+ if (unpack.pixelBuffer.id() != 0)
{
- image->loadData(xoffset, yoffset, width, height, unpackAlignment, pixels);
+ Buffer *pixelBuffer = unpack.pixelBuffer.get();
+ unsigned int offset = reinterpret_cast<unsigned int>(pixels);
+ const void *bufferData = pixelBuffer->getStorage()->getData();
+ pixelData = static_cast<const unsigned char *>(bufferData) + offset;
+ }
+
+ if (pixelData != NULL)
+ {
+ image->loadData(xoffset, yoffset, zoffset, width, height, depth, unpack.alignment, type, pixelData);
mDirtyImages = true;
}
return true;
}
-bool Texture::subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels, rx::Image *image)
+bool Texture::subImageCompressed(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
+ GLenum format, GLsizei imageSize, const void *pixels, rx::Image *image)
{
if (pixels != NULL)
{
- image->loadCompressedData(xoffset, yoffset, width, height, pixels);
+ image->loadCompressedData(xoffset, yoffset, zoffset, width, height, depth, pixels);
mDirtyImages = true;
}
@@ -237,11 +399,12 @@ bool Texture::subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GL
rx::TextureStorageInterface *Texture::getNativeTexture()
{
// ensure the underlying texture is created
+ initializeStorage(false);
- rx::TextureStorageInterface *storage = getStorage(false);
+ rx::TextureStorageInterface *storage = getBaseLevelStorage();
if (storage)
{
- updateTexture();
+ updateStorage();
}
return storage;
@@ -259,26 +422,26 @@ void Texture::resetDirty()
unsigned int Texture::getTextureSerial()
{
- rx::TextureStorageInterface *texture = getStorage(false);
+ rx::TextureStorageInterface *texture = getNativeTexture();
return texture ? texture->getTextureSerial() : 0;
}
-unsigned int Texture::getRenderTargetSerial(GLenum target)
+bool Texture::isImmutable() const
{
- rx::TextureStorageInterface *texture = getStorage(true);
- return texture ? texture->getRenderTargetSerial(target) : 0;
+ return mImmutable;
}
-bool Texture::isImmutable() const
+int Texture::immutableLevelCount()
{
- return mImmutable;
+ return (mImmutable ? getNativeTexture()->getStorageInstance()->getLevelCount() : 0);
}
-GLint Texture::creationLevels(GLsizei width, GLsizei height) const
+GLint Texture::creationLevels(GLsizei width, GLsizei height, GLsizei depth) const
{
- if ((isPow2(width) && isPow2(height)) || mRenderer->getNonPower2TextureSupport())
+ if ((isPow2(width) && isPow2(height) && isPow2(depth)) || mRenderer->getNonPower2TextureSupport())
{
- return 0; // Maximum number of levels
+ // Maximum number of levels
+ return log2(std::max(std::max(width, height), depth)) + 1;
}
else
{
@@ -287,17 +450,15 @@ GLint Texture::creationLevels(GLsizei width, GLsizei height) const
}
}
-GLint Texture::creationLevels(GLsizei size) const
+int Texture::mipLevels() const
{
- return creationLevels(size, size);
+ return log2(std::max(std::max(getBaseLevelWidth(), getBaseLevelHeight()), getBaseLevelDepth())) + 1;
}
-Texture2D::Texture2D(rx::Renderer *renderer, GLuint id) : Texture(renderer, id)
+Texture2D::Texture2D(rx::Renderer *renderer, GLuint id) : Texture(renderer, id, GL_TEXTURE_2D)
{
mTexStorage = NULL;
mSurface = NULL;
- mColorbufferProxy = NULL;
- mProxyRefs = 0;
for (int i = 0; i < IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++i)
{
@@ -307,8 +468,6 @@ Texture2D::Texture2D(rx::Renderer *renderer, GLuint id) : Texture(renderer, id)
Texture2D::~Texture2D()
{
- mColorbufferProxy = NULL;
-
delete mTexStorage;
mTexStorage = NULL;
@@ -324,28 +483,6 @@ Texture2D::~Texture2D()
}
}
-// We need to maintain a count of references to renderbuffers acting as
-// proxies for this texture, so that we do not attempt to use a pointer
-// to a renderbuffer proxy which has been deleted.
-void Texture2D::addProxyRef(const Renderbuffer *proxy)
-{
- mProxyRefs++;
-}
-
-void Texture2D::releaseProxy(const Renderbuffer *proxy)
-{
- if (mProxyRefs > 0)
- mProxyRefs--;
-
- if (mProxyRefs == 0)
- mColorbufferProxy = NULL;
-}
-
-GLenum Texture2D::getTarget() const
-{
- return GL_TEXTURE_2D;
-}
-
GLsizei Texture2D::getWidth(GLint level) const
{
if (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS)
@@ -375,24 +512,24 @@ GLenum Texture2D::getActualFormat(GLint level) const
if (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS)
return mImageArray[level]->getActualFormat();
else
- return D3DFMT_UNKNOWN;
+ return GL_NONE;
}
-void Texture2D::redefineImage(GLint level, GLint internalformat, GLsizei width, GLsizei height)
+void Texture2D::redefineImage(GLint level, GLenum internalformat, GLsizei width, GLsizei height)
{
releaseTexImage();
// If there currently is a corresponding storage texture image, it has these parameters
- const int storageWidth = std::max(1, mImageArray[0]->getWidth() >> level);
- const int storageHeight = std::max(1, mImageArray[0]->getHeight() >> level);
- const int storageFormat = mImageArray[0]->getInternalFormat();
+ const int storageWidth = std::max(1, getBaseLevelWidth() >> level);
+ const int storageHeight = std::max(1, getBaseLevelHeight() >> level);
+ const GLenum storageFormat = getBaseLevelInternalFormat();
- mImageArray[level]->redefine(mRenderer, internalformat, width, height, false);
+ mImageArray[level]->redefine(mRenderer, GL_TEXTURE_2D, internalformat, width, height, 1, false);
if (mTexStorage)
{
- const int storageLevels = mTexStorage->levelCount();
-
+ const int storageLevels = mTexStorage->getLevelCount();
+
if ((level >= storageLevels && storageLevels != 0) ||
width != storageWidth ||
height != storageHeight ||
@@ -410,21 +547,44 @@ void Texture2D::redefineImage(GLint level, GLint internalformat, GLsizei width,
}
}
-void Texture2D::setImage(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
+void Texture2D::setImage(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
{
- GLint internalformat = ConvertSizedInternalFormat(format, type);
- redefineImage(level, internalformat, width, height);
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+ GLenum sizedInternalFormat = IsSizedInternalFormat(internalFormat, clientVersion) ? internalFormat
+ : GetSizedInternalFormat(format, type, clientVersion);
+ redefineImage(level, sizedInternalFormat, width, height);
+
+ bool fastUnpacked = false;
- Texture::setImage(unpackAlignment, pixels, mImageArray[level]);
+ // Attempt a fast gpu copy of the pixel data to the surface
+ if (isFastUnpackable(unpack, sizedInternalFormat) && isLevelComplete(level))
+ {
+ // Will try to create RT storage if it does not exist
+ rx::RenderTarget *destRenderTarget = getRenderTarget(level);
+ Box destArea(0, 0, 0, getWidth(level), getHeight(level), 1);
+
+ if (destRenderTarget && fastUnpackPixels(unpack, pixels, destArea, sizedInternalFormat, type, destRenderTarget))
+ {
+ // Ensure we don't overwrite our newly initialized data
+ mImageArray[level]->markClean();
+
+ fastUnpacked = true;
+ }
+ }
+
+ if (!fastUnpacked)
+ {
+ Texture::setImage(unpack, type, pixels, mImageArray[level]);
+ }
}
void Texture2D::bindTexImage(egl::Surface *surface)
{
releaseTexImage();
- GLint internalformat = surface->getFormat();
+ GLenum internalformat = surface->getFormat();
- mImageArray[0]->redefine(mRenderer, internalformat, surface->getWidth(), surface->getHeight(), true);
+ mImageArray[0]->redefine(mRenderer, GL_TEXTURE_2D, internalformat, surface->getWidth(), surface->getHeight(), 1, true);
delete mTexStorage;
mTexStorage = new rx::TextureStorageInterface2D(mRenderer, surface->getSwapChain());
@@ -449,7 +609,7 @@ void Texture2D::releaseTexImage()
for (int i = 0; i < IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
{
- mImageArray[i]->redefine(mRenderer, GL_NONE, 0, 0, true);
+ mImageArray[i]->redefine(mRenderer, GL_TEXTURE_2D, GL_NONE, 0, 0, 0, true);
}
}
}
@@ -464,19 +624,35 @@ void Texture2D::setCompressedImage(GLint level, GLenum format, GLsizei width, GL
void Texture2D::commitRect(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
{
- if (level < levelCount())
+ if (isValidLevel(level))
{
rx::Image *image = mImageArray[level];
- if (image->updateSurface(mTexStorage, level, xoffset, yoffset, width, height))
+ if (image->copyToStorage(mTexStorage, level, xoffset, yoffset, width, height))
{
image->markClean();
}
}
}
-void Texture2D::subImage(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
+void Texture2D::subImage(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
{
- if (Texture::subImage(xoffset, yoffset, width, height, format, type, unpackAlignment, pixels, mImageArray[level]))
+ bool fastUnpacked = false;
+
+ if (isFastUnpackable(unpack, getInternalFormat(level)) && isLevelComplete(level))
+ {
+ rx::RenderTarget *renderTarget = getRenderTarget(level);
+ Box destArea(xoffset, yoffset, 0, width, height, 1);
+
+ if (renderTarget && fastUnpackPixels(unpack, pixels, destArea, getInternalFormat(level), type, renderTarget))
+ {
+ // Ensure we don't overwrite our newly initialized data
+ mImageArray[level]->markClean();
+
+ fastUnpacked = true;
+ }
+ }
+
+ if (!fastUnpacked && Texture::subImage(xoffset, yoffset, 0, width, height, 1, format, type, unpack, pixels, mImageArray[level]))
{
commitRect(level, xoffset, yoffset, width, height);
}
@@ -484,7 +660,7 @@ void Texture2D::subImage(GLint level, GLint xoffset, GLint yoffset, GLsizei widt
void Texture2D::subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels)
{
- if (Texture::subImageCompressed(xoffset, yoffset, width, height, format, imageSize, pixels, mImageArray[level]))
+ if (Texture::subImageCompressed(xoffset, yoffset, 0, width, height, 1, format, imageSize, pixels, mImageArray[level]))
{
commitRect(level, xoffset, yoffset, width, height);
}
@@ -492,24 +668,22 @@ void Texture2D::subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GL
void Texture2D::copyImage(GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source)
{
- GLint internalformat = ConvertSizedInternalFormat(format, GL_UNSIGNED_BYTE);
- redefineImage(level, internalformat, width, height);
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+ GLenum sizedInternalFormat = IsSizedInternalFormat(format, clientVersion) ? format
+ : GetSizedInternalFormat(format, GL_UNSIGNED_BYTE, clientVersion);
+ redefineImage(level, sizedInternalFormat, width, height);
if (!mImageArray[level]->isRenderableFormat())
{
- mImageArray[level]->copy(0, 0, x, y, width, height, source);
+ mImageArray[level]->copy(0, 0, 0, x, y, width, height, source);
mDirtyImages = true;
}
else
{
- if (!mTexStorage || !mTexStorage->isRenderTarget())
- {
- convertToRenderTarget();
- }
-
+ ensureRenderTarget();
mImageArray[level]->markClean();
- if (width != 0 && height != 0 && level < levelCount())
+ if (width != 0 && height != 0 && isValidLevel(level))
{
gl::Rectangle sourceRect;
sourceRect.x = x;
@@ -522,37 +696,35 @@ void Texture2D::copyImage(GLint level, GLenum format, GLint x, GLint y, GLsizei
}
}
-void Texture2D::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source)
+void Texture2D::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source)
{
- if (xoffset + width > mImageArray[level]->getWidth() || yoffset + height > mImageArray[level]->getHeight())
- {
- return gl::error(GL_INVALID_VALUE);
- }
+ // can only make our texture storage to a render target if level 0 is defined (with a width & height) and
+ // the current level we're copying to is defined (with appropriate format, width & height)
+ bool canCreateRenderTarget = isLevelComplete(level) && isLevelComplete(0);
- if (!mImageArray[level]->isRenderableFormat() || (!mTexStorage && !isSamplerComplete()))
+ if (!mImageArray[level]->isRenderableFormat() || (!mTexStorage && !canCreateRenderTarget))
{
- mImageArray[level]->copy(xoffset, yoffset, x, y, width, height, source);
+ mImageArray[level]->copy(xoffset, yoffset, 0, x, y, width, height, source);
mDirtyImages = true;
}
else
{
- if (!mTexStorage || !mTexStorage->isRenderTarget())
- {
- convertToRenderTarget();
- }
+ ensureRenderTarget();
- updateTexture();
-
- if (level < levelCount())
+ if (isValidLevel(level))
{
+ updateStorageLevel(level);
+
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+
gl::Rectangle sourceRect;
sourceRect.x = x;
sourceRect.width = width;
sourceRect.y = y;
sourceRect.height = height;
- mRenderer->copyImage(source, sourceRect,
- gl::ExtractFormat(mImageArray[0]->getInternalFormat()),
+ mRenderer->copyImage(source, sourceRect,
+ gl::GetFormat(getBaseLevelInternalFormat(), clientVersion),
xoffset, yoffset, mTexStorage, level);
}
}
@@ -560,52 +732,54 @@ void Texture2D::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yo
void Texture2D::storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
{
- delete mTexStorage;
- mTexStorage = new rx::TextureStorageInterface2D(mRenderer, levels, internalformat, mUsage, false, width, height);
- mImmutable = true;
-
for (int level = 0; level < levels; level++)
{
- mImageArray[level]->redefine(mRenderer, internalformat, width, height, true);
- width = std::max(1, width >> 1);
- height = std::max(1, height >> 1);
+ GLsizei levelWidth = std::max(1, width >> level);
+ GLsizei levelHeight = std::max(1, height >> level);
+ mImageArray[level]->redefine(mRenderer, GL_TEXTURE_2D, internalformat, levelWidth, levelHeight, 1, true);
}
for (int level = levels; level < IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
{
- mImageArray[level]->redefine(mRenderer, GL_NONE, 0, 0, true);
+ mImageArray[level]->redefine(mRenderer, GL_TEXTURE_2D, GL_NONE, 0, 0, 0, true);
}
- if (mTexStorage->isManaged())
- {
- int levels = levelCount();
+ mImmutable = true;
+
+ setCompleteTexStorage(new rx::TextureStorageInterface2D(mRenderer, internalformat, IsRenderTargetUsage(mUsage), width, height, levels));
+}
+
+void Texture2D::setCompleteTexStorage(rx::TextureStorageInterface2D *newCompleteTexStorage)
+{
+ SafeDelete(mTexStorage);
+ mTexStorage = newCompleteTexStorage;
- for (int level = 0; level < levels; level++)
+ if (mTexStorage && mTexStorage->isManaged())
+ {
+ for (int level = 0; level < mTexStorage->getLevelCount(); level++)
{
mImageArray[level]->setManagedSurface(mTexStorage, level);
}
}
+
+ mDirtyImages = true;
}
// Tests for 2D texture sampling completeness. [OpenGL ES 2.0.24] section 3.8.2 page 85.
-bool Texture2D::isSamplerComplete() const
+bool Texture2D::isSamplerComplete(const SamplerState &samplerState) const
{
- GLsizei width = mImageArray[0]->getWidth();
- GLsizei height = mImageArray[0]->getHeight();
+ GLsizei width = getBaseLevelWidth();
+ GLsizei height = getBaseLevelHeight();
if (width <= 0 || height <= 0)
{
return false;
}
- bool mipmapping = isMipmapFiltered();
- bool filtering, renderable;
-
- if ((IsFloat32Format(getInternalFormat(0)) && !mRenderer->getFloat32TextureSupport(&filtering, &renderable)) ||
- (IsFloat16Format(getInternalFormat(0)) && !mRenderer->getFloat16TextureSupport(&filtering, &renderable)))
+ if (!IsTextureFilteringSupported(getInternalFormat(0), mRenderer))
{
- if (mSamplerState.magFilter != GL_NEAREST ||
- (mSamplerState.minFilter != GL_NEAREST && mSamplerState.minFilter != GL_NEAREST_MIPMAP_NEAREST))
+ if (samplerState.magFilter != GL_NEAREST ||
+ (samplerState.minFilter != GL_NEAREST && samplerState.minFilter != GL_NEAREST_MIPMAP_NEAREST))
{
return false;
}
@@ -615,14 +789,14 @@ bool Texture2D::isSamplerComplete() const
if (!npotSupport)
{
- if ((mSamplerState.wrapS != GL_CLAMP_TO_EDGE && !isPow2(width)) ||
- (mSamplerState.wrapT != GL_CLAMP_TO_EDGE && !isPow2(height)))
+ if ((samplerState.wrapS != GL_CLAMP_TO_EDGE && !isPow2(width)) ||
+ (samplerState.wrapT != GL_CLAMP_TO_EDGE && !isPow2(height)))
{
return false;
}
}
- if (mipmapping)
+ if (IsMipmapFiltered(samplerState))
{
if (!npotSupport)
{
@@ -638,43 +812,82 @@ bool Texture2D::isSamplerComplete() const
}
}
+ // OpenGLES 3.0.2 spec section 3.8.13 states that a texture is not mipmap complete if:
+ // The internalformat specified for the texture arrays is a sized internal depth or
+ // depth and stencil format (see table 3.13), the value of TEXTURE_COMPARE_-
+ // MODE is NONE, and either the magnification filter is not NEAREST or the mini-
+ // fication filter is neither NEAREST nor NEAREST_MIPMAP_NEAREST.
+ if (gl::GetDepthBits(getInternalFormat(0), mRenderer->getCurrentClientVersion()) > 0 &&
+ mRenderer->getCurrentClientVersion() > 2)
+ {
+ if (mSamplerState.compareMode == GL_NONE)
+ {
+ if ((mSamplerState.minFilter != GL_NEAREST && mSamplerState.minFilter != GL_NEAREST_MIPMAP_NEAREST) ||
+ mSamplerState.magFilter != GL_NEAREST)
+ {
+ return false;
+ }
+ }
+ }
+
return true;
}
// Tests for 2D texture (mipmap) completeness. [OpenGL ES 2.0.24] section 3.7.10 page 81.
bool Texture2D::isMipmapComplete() const
{
+ int levelCount = mipLevels();
+
+ for (int level = 0; level < levelCount; level++)
+ {
+ if (!isLevelComplete(level))
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool Texture2D::isLevelComplete(int level) const
+{
if (isImmutable())
{
return true;
}
- GLsizei width = mImageArray[0]->getWidth();
- GLsizei height = mImageArray[0]->getHeight();
+ const rx::Image *baseImage = getBaseLevelImage();
+
+ GLsizei width = baseImage->getWidth();
+ GLsizei height = baseImage->getHeight();
if (width <= 0 || height <= 0)
{
return false;
}
- int q = log2(std::max(width, height));
+ // The base image level is complete if the width and height are positive
+ if (level == 0)
+ {
+ return true;
+ }
+
+ ASSERT(level >= 1 && level <= (int)ArraySize(mImageArray) && mImageArray[level] != NULL);
+ rx::Image *image = mImageArray[level];
- for (int level = 1; level <= q; level++)
+ if (image->getInternalFormat() != baseImage->getInternalFormat())
{
- if (mImageArray[level]->getInternalFormat() != mImageArray[0]->getInternalFormat())
- {
- return false;
- }
+ return false;
+ }
- if (mImageArray[level]->getWidth() != std::max(1, width >> level))
- {
- return false;
- }
+ if (image->getWidth() != std::max(1, width >> level))
+ {
+ return false;
+ }
- if (mImageArray[level]->getHeight() != std::max(1, height >> level))
- {
- return false;
- }
+ if (image->getHeight() != std::max(1, height >> level))
+ {
+ return false;
}
return true;
@@ -682,211 +895,203 @@ bool Texture2D::isMipmapComplete() const
bool Texture2D::isCompressed(GLint level) const
{
- return IsCompressed(getInternalFormat(level));
+ return IsFormatCompressed(getInternalFormat(level), mRenderer->getCurrentClientVersion());
}
bool Texture2D::isDepth(GLint level) const
{
- return IsDepthTexture(getInternalFormat(level));
+ return GetDepthBits(getInternalFormat(level), mRenderer->getCurrentClientVersion()) > 0;
}
// Constructs a native texture resource from the texture images
-void Texture2D::createTexture()
+void Texture2D::initializeStorage(bool renderTarget)
{
- GLsizei width = mImageArray[0]->getWidth();
- GLsizei height = mImageArray[0]->getHeight();
-
- if (!(width > 0 && height > 0))
- return; // do not attempt to create native textures for nonexistant data
-
- GLint levels = creationLevels(width, height);
- GLenum internalformat = mImageArray[0]->getInternalFormat();
-
- delete mTexStorage;
- mTexStorage = new rx::TextureStorageInterface2D(mRenderer, levels, internalformat, mUsage, false, width, height);
-
- if (mTexStorage->isManaged())
+ // Only initialize the first time this texture is used as a render target or shader resource
+ if (mTexStorage)
{
- int levels = levelCount();
+ return;
+ }
- for (int level = 0; level < levels; level++)
- {
- mImageArray[level]->setManagedSurface(mTexStorage, level);
- }
+ // do not attempt to create storage for nonexistant data
+ if (!isLevelComplete(0))
+ {
+ return;
}
- mDirtyImages = true;
+ bool createRenderTarget = (renderTarget || IsRenderTargetUsage(mUsage));
+
+ setCompleteTexStorage(createCompleteStorage(createRenderTarget));
+ ASSERT(mTexStorage);
+
+ // flush image data to the storage
+ updateStorage();
}
-void Texture2D::updateTexture()
+rx::TextureStorageInterface2D *Texture2D::createCompleteStorage(bool renderTarget) const
{
- bool mipmapping = (isMipmapFiltered() && isMipmapComplete());
+ GLsizei width = getBaseLevelWidth();
+ GLsizei height = getBaseLevelHeight();
- int levels = (mipmapping ? levelCount() : 1);
+ ASSERT(width > 0 && height > 0);
- for (int level = 0; level < levels; level++)
- {
- rx::Image *image = mImageArray[level];
+ // use existing storage level count, when previously specified by TexStorage*D
+ GLint levels = (mTexStorage ? mTexStorage->getLevelCount() : creationLevels(width, height, 1));
- if (image->isDirty())
+ return new rx::TextureStorageInterface2D(mRenderer, getBaseLevelInternalFormat(), renderTarget, width, height, levels);
+}
+
+void Texture2D::updateStorage()
+{
+ ASSERT(mTexStorage != NULL);
+ GLint storageLevels = mTexStorage->getLevelCount();
+ for (int level = 0; level < storageLevels; level++)
+ {
+ if (mImageArray[level]->isDirty() && isLevelComplete(level))
{
- commitRect(level, 0, 0, mImageArray[level]->getWidth(), mImageArray[level]->getHeight());
+ updateStorageLevel(level);
}
}
}
-void Texture2D::convertToRenderTarget()
+void Texture2D::updateStorageLevel(int level)
{
- rx::TextureStorageInterface2D *newTexStorage = NULL;
+ ASSERT(level <= (int)ArraySize(mImageArray) && mImageArray[level] != NULL);
+ ASSERT(isLevelComplete(level));
- if (mImageArray[0]->getWidth() != 0 && mImageArray[0]->getHeight() != 0)
+ if (mImageArray[level]->isDirty())
{
- GLsizei width = mImageArray[0]->getWidth();
- GLsizei height = mImageArray[0]->getHeight();
- GLint levels = mTexStorage != NULL ? mTexStorage->levelCount() : creationLevels(width, height);
- GLenum internalformat = mImageArray[0]->getInternalFormat();
+ commitRect(level, 0, 0, getWidth(level), getHeight(level));
+ }
+}
- newTexStorage = new rx::TextureStorageInterface2D(mRenderer, levels, internalformat, GL_FRAMEBUFFER_ATTACHMENT_ANGLE, true, width, height);
+bool Texture2D::ensureRenderTarget()
+{
+ initializeStorage(true);
- if (mTexStorage != NULL)
+ if (getBaseLevelWidth() > 0 && getBaseLevelHeight() > 0)
+ {
+ ASSERT(mTexStorage);
+ if (!mTexStorage->isRenderTarget())
{
- if (!mRenderer->copyToRenderTarget(newTexStorage, mTexStorage))
- {
- delete newTexStorage;
- return gl::error(GL_OUT_OF_MEMORY);
+ rx::TextureStorageInterface2D *newRenderTargetStorage = createCompleteStorage(true);
+
+ if (!mRenderer->copyToRenderTarget(newRenderTargetStorage, mTexStorage))
+ {
+ delete newRenderTargetStorage;
+ return gl::error(GL_OUT_OF_MEMORY, false);
}
+
+ setCompleteTexStorage(newRenderTargetStorage);
}
}
- delete mTexStorage;
- mTexStorage = newTexStorage;
-
- mDirtyImages = true;
+ return (mTexStorage && mTexStorage->isRenderTarget());
}
void Texture2D::generateMipmaps()
{
- if (!mRenderer->getNonPower2TextureSupport())
- {
- if (!isPow2(mImageArray[0]->getWidth()) || !isPow2(mImageArray[0]->getHeight()))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- }
-
// Purge array levels 1 through q and reset them to represent the generated mipmap levels.
- unsigned int q = log2(std::max(mImageArray[0]->getWidth(), mImageArray[0]->getHeight()));
- for (unsigned int i = 1; i <= q; i++)
+ int levelCount = mipLevels();
+ for (int level = 1; level < levelCount; level++)
{
- redefineImage(i, mImageArray[0]->getInternalFormat(),
- std::max(mImageArray[0]->getWidth() >> i, 1),
- std::max(mImageArray[0]->getHeight() >> i, 1));
+ redefineImage(level, getBaseLevelInternalFormat(),
+ std::max(getBaseLevelWidth() >> level, 1),
+ std::max(getBaseLevelHeight() >> level, 1));
}
if (mTexStorage && mTexStorage->isRenderTarget())
{
- for (unsigned int i = 1; i <= q; i++)
+ for (int level = 1; level < levelCount; level++)
{
- mTexStorage->generateMipmap(i);
+ mTexStorage->generateMipmap(level);
- mImageArray[i]->markClean();
+ mImageArray[level]->markClean();
}
}
else
{
- for (unsigned int i = 1; i <= q; i++)
+ for (int level = 1; level < levelCount; level++)
{
- mRenderer->generateMipmap(mImageArray[i], mImageArray[i - 1]);
+ mRenderer->generateMipmap(mImageArray[level], mImageArray[level - 1]);
}
}
}
-Renderbuffer *Texture2D::getRenderbuffer(GLenum target)
+const rx::Image *Texture2D::getBaseLevelImage() const
{
- if (target != GL_TEXTURE_2D)
- {
- return gl::error(GL_INVALID_OPERATION, (Renderbuffer *)NULL);
- }
+ return mImageArray[0];
+}
- if (mColorbufferProxy == NULL)
+rx::TextureStorageInterface *Texture2D::getBaseLevelStorage()
+{
+ return mTexStorage;
+}
+
+FramebufferAttachment *Texture2D::getAttachment(GLint level)
+{
+ FramebufferAttachment *attachment = mRenderbufferProxies.get(level, 0);
+ if (!attachment)
{
- mColorbufferProxy = new Renderbuffer(mRenderer, id(), new RenderbufferTexture2D(this, target));
+ attachment = new FramebufferAttachment(mRenderer, id(), new Texture2DAttachment(this, level));
+ mRenderbufferProxies.add(level, 0, attachment);
}
- return mColorbufferProxy;
+ return attachment;
}
-rx::RenderTarget *Texture2D::getRenderTarget(GLenum target)
+unsigned int Texture2D::getRenderTargetSerial(GLint level)
{
- ASSERT(target == GL_TEXTURE_2D);
+ return (ensureRenderTarget() ? mTexStorage->getRenderTargetSerial(level) : 0);
+}
+rx::RenderTarget *Texture2D::getRenderTarget(GLint level)
+{
// ensure the underlying texture is created
- if (getStorage(true) == NULL)
+ if (!ensureRenderTarget())
{
return NULL;
}
- updateTexture();
-
+ updateStorageLevel(level);
+
// ensure this is NOT a depth texture
- if (isDepth(0))
+ if (isDepth(level))
{
return NULL;
}
- return mTexStorage->getRenderTarget();
+ return mTexStorage->getRenderTarget(level);
}
-rx::RenderTarget *Texture2D::getDepthStencil(GLenum target)
+rx::RenderTarget *Texture2D::getDepthSencil(GLint level)
{
- ASSERT(target == GL_TEXTURE_2D);
-
// ensure the underlying texture is created
- if (getStorage(true) == NULL)
+ if (!ensureRenderTarget())
{
return NULL;
}
- updateTexture();
+ updateStorageLevel(level);
// ensure this is actually a depth texture
- if (!isDepth(0))
+ if (!isDepth(level))
{
return NULL;
}
- return mTexStorage->getRenderTarget();
-}
-int Texture2D::levelCount()
-{
- return mTexStorage ? mTexStorage->levelCount() : 0;
+ return mTexStorage->getRenderTarget(level);
}
-rx::TextureStorageInterface *Texture2D::getStorage(bool renderTarget)
+bool Texture2D::isValidLevel(int level) const
{
- if (!mTexStorage || (renderTarget && !mTexStorage->isRenderTarget()))
- {
- if (renderTarget)
- {
- convertToRenderTarget();
- }
- else
- {
- createTexture();
- }
- }
-
- return mTexStorage;
+ return (mTexStorage ? (level >= 0 && level < mTexStorage->getLevelCount()) : false);
}
-TextureCubeMap::TextureCubeMap(rx::Renderer *renderer, GLuint id) : Texture(renderer, id)
+TextureCubeMap::TextureCubeMap(rx::Renderer *renderer, GLuint id) : Texture(renderer, id, GL_TEXTURE_CUBE_MAP)
{
mTexStorage = NULL;
for (int i = 0; i < 6; i++)
{
- mFaceProxies[i] = NULL;
- mFaceProxyRefs[i] = 0;
-
for (int j = 0; j < IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++j)
{
mImageArray[i][j] = renderer->createImage();
@@ -898,8 +1103,6 @@ TextureCubeMap::~TextureCubeMap()
{
for (int i = 0; i < 6; i++)
{
- mFaceProxies[i] = NULL;
-
for (int j = 0; j < IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++j)
{
delete mImageArray[i][j];
@@ -910,44 +1113,10 @@ TextureCubeMap::~TextureCubeMap()
mTexStorage = NULL;
}
-// We need to maintain a count of references to renderbuffers acting as
-// proxies for this texture, so that the texture is not deleted while
-// proxy references still exist. If the reference count drops to zero,
-// we set our proxy pointer NULL, so that a new attempt at referencing
-// will cause recreation.
-void TextureCubeMap::addProxyRef(const Renderbuffer *proxy)
-{
- for (int i = 0; i < 6; i++)
- {
- if (mFaceProxies[i] == proxy)
- mFaceProxyRefs[i]++;
- }
-}
-
-void TextureCubeMap::releaseProxy(const Renderbuffer *proxy)
-{
- for (int i = 0; i < 6; i++)
- {
- if (mFaceProxies[i] == proxy)
- {
- if (mFaceProxyRefs[i] > 0)
- mFaceProxyRefs[i]--;
-
- if (mFaceProxyRefs[i] == 0)
- mFaceProxies[i] = NULL;
- }
- }
-}
-
-GLenum TextureCubeMap::getTarget() const
-{
- return GL_TEXTURE_CUBE_MAP;
-}
-
GLsizei TextureCubeMap::getWidth(GLenum target, GLint level) const
{
if (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS)
- return mImageArray[faceIndex(target)][level]->getWidth();
+ return mImageArray[targetToIndex(target)][level]->getWidth();
else
return 0;
}
@@ -955,7 +1124,7 @@ GLsizei TextureCubeMap::getWidth(GLenum target, GLint level) const
GLsizei TextureCubeMap::getHeight(GLenum target, GLint level) const
{
if (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS)
- return mImageArray[faceIndex(target)][level]->getHeight();
+ return mImageArray[targetToIndex(target)][level]->getHeight();
else
return 0;
}
@@ -963,7 +1132,7 @@ GLsizei TextureCubeMap::getHeight(GLenum target, GLint level) const
GLenum TextureCubeMap::getInternalFormat(GLenum target, GLint level) const
{
if (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS)
- return mImageArray[faceIndex(target)][level]->getInternalFormat();
+ return mImageArray[targetToIndex(target)][level]->getInternalFormat();
else
return GL_NONE;
}
@@ -971,88 +1140,89 @@ GLenum TextureCubeMap::getInternalFormat(GLenum target, GLint level) const
GLenum TextureCubeMap::getActualFormat(GLenum target, GLint level) const
{
if (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS)
- return mImageArray[faceIndex(target)][level]->getActualFormat();
+ return mImageArray[targetToIndex(target)][level]->getActualFormat();
else
- return D3DFMT_UNKNOWN;
+ return GL_NONE;
}
-void TextureCubeMap::setImagePosX(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
+void TextureCubeMap::setImagePosX(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
{
- setImage(0, level, width, height, format, type, unpackAlignment, pixels);
+ setImage(0, level, width, height, internalFormat, format, type, unpack, pixels);
}
-void TextureCubeMap::setImageNegX(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
+void TextureCubeMap::setImageNegX(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
{
- setImage(1, level, width, height, format, type, unpackAlignment, pixels);
+ setImage(1, level, width, height, internalFormat, format, type, unpack, pixels);
}
-void TextureCubeMap::setImagePosY(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
+void TextureCubeMap::setImagePosY(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
{
- setImage(2, level, width, height, format, type, unpackAlignment, pixels);
+ setImage(2, level, width, height, internalFormat, format, type, unpack, pixels);
}
-void TextureCubeMap::setImageNegY(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
+void TextureCubeMap::setImageNegY(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
{
- setImage(3, level, width, height, format, type, unpackAlignment, pixels);
+ setImage(3, level, width, height, internalFormat, format, type, unpack, pixels);
}
-void TextureCubeMap::setImagePosZ(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
+void TextureCubeMap::setImagePosZ(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
{
- setImage(4, level, width, height, format, type, unpackAlignment, pixels);
+ setImage(4, level, width, height, internalFormat, format, type, unpack, pixels);
}
-void TextureCubeMap::setImageNegZ(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
+void TextureCubeMap::setImageNegZ(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
{
- setImage(5, level, width, height, format, type, unpackAlignment, pixels);
+ setImage(5, level, width, height, internalFormat, format, type, unpack, pixels);
}
-void TextureCubeMap::setCompressedImage(GLenum face, GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels)
+void TextureCubeMap::setCompressedImage(GLenum target, GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels)
{
// compressed formats don't have separate sized internal formats-- we can just use the compressed format directly
- redefineImage(faceIndex(face), level, format, width, height);
+ int faceIndex = targetToIndex(target);
+ redefineImage(faceIndex, level, format, width, height);
- Texture::setCompressedImage(imageSize, pixels, mImageArray[faceIndex(face)][level]);
+ Texture::setCompressedImage(imageSize, pixels, mImageArray[faceIndex][level]);
}
-void TextureCubeMap::commitRect(int face, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
+void TextureCubeMap::commitRect(int faceIndex, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
{
- if (level < levelCount())
+ if (isValidFaceLevel(faceIndex, level))
{
- rx::Image *image = mImageArray[face][level];
- if (image->updateSurface(mTexStorage, face, level, xoffset, yoffset, width, height))
+ rx::Image *image = mImageArray[faceIndex][level];
+ if (image->copyToStorage(mTexStorage, faceIndex, level, xoffset, yoffset, width, height))
image->markClean();
}
}
-void TextureCubeMap::subImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
+void TextureCubeMap::subImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
{
- if (Texture::subImage(xoffset, yoffset, width, height, format, type, unpackAlignment, pixels, mImageArray[faceIndex(target)][level]))
+ int faceIndex = targetToIndex(target);
+ if (Texture::subImage(xoffset, yoffset, 0, width, height, 1, format, type, unpack, pixels, mImageArray[faceIndex][level]))
{
- commitRect(faceIndex(target), level, xoffset, yoffset, width, height);
+ commitRect(faceIndex, level, xoffset, yoffset, width, height);
}
}
void TextureCubeMap::subImageCompressed(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels)
{
- if (Texture::subImageCompressed(xoffset, yoffset, width, height, format, imageSize, pixels, mImageArray[faceIndex(target)][level]))
+ int faceIndex = targetToIndex(target);
+ if (Texture::subImageCompressed(xoffset, yoffset, 0, width, height, 1, format, imageSize, pixels, mImageArray[faceIndex][level]))
{
- commitRect(faceIndex(target), level, xoffset, yoffset, width, height);
+ commitRect(faceIndex, level, xoffset, yoffset, width, height);
}
}
// Tests for cube map sampling completeness. [OpenGL ES 2.0.24] section 3.8.2 page 86.
-bool TextureCubeMap::isSamplerComplete() const
+bool TextureCubeMap::isSamplerComplete(const SamplerState &samplerState) const
{
- int size = mImageArray[0][0]->getWidth();
+ int size = getBaseLevelWidth();
- bool mipmapping = isMipmapFiltered();
- bool filtering, renderable;
+ bool mipmapping = IsMipmapFiltered(samplerState);
- if ((gl::ExtractType(getInternalFormat(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0)) == GL_FLOAT && !mRenderer->getFloat32TextureSupport(&filtering, &renderable)) ||
- (gl::ExtractType(getInternalFormat(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0) == GL_HALF_FLOAT_OES) && !mRenderer->getFloat16TextureSupport(&filtering, &renderable)))
+ if (!IsTextureFilteringSupported(getInternalFormat(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0), mRenderer))
{
- if (mSamplerState.magFilter != GL_NEAREST ||
- (mSamplerState.minFilter != GL_NEAREST && mSamplerState.minFilter != GL_NEAREST_MIPMAP_NEAREST))
+ if (samplerState.magFilter != GL_NEAREST ||
+ (samplerState.minFilter != GL_NEAREST && samplerState.minFilter != GL_NEAREST_MIPMAP_NEAREST))
{
return false;
}
@@ -1060,7 +1230,7 @@ bool TextureCubeMap::isSamplerComplete() const
if (!isPow2(size) && !mRenderer->getNonPower2TextureSupport())
{
- if (mSamplerState.wrapS != GL_CLAMP_TO_EDGE || mSamplerState.wrapT != GL_CLAMP_TO_EDGE || mipmapping)
+ if (samplerState.wrapS != GL_CLAMP_TO_EDGE || samplerState.wrapT != GL_CLAMP_TO_EDGE || mipmapping)
{
return false;
}
@@ -1087,16 +1257,22 @@ bool TextureCubeMap::isSamplerComplete() const
// Tests for cube texture completeness. [OpenGL ES 2.0.24] section 3.7.10 page 81.
bool TextureCubeMap::isCubeComplete() const
{
- if (mImageArray[0][0]->getWidth() <= 0 || mImageArray[0][0]->getHeight() != mImageArray[0][0]->getWidth())
+ int baseWidth = getBaseLevelWidth();
+ int baseHeight = getBaseLevelHeight();
+ GLenum baseFormat = getBaseLevelInternalFormat();
+
+ if (baseWidth <= 0 || baseWidth != baseHeight)
{
return false;
}
- for (unsigned int face = 1; face < 6; face++)
+ for (int faceIndex = 1; faceIndex < 6; faceIndex++)
{
- if (mImageArray[face][0]->getWidth() != mImageArray[0][0]->getWidth() ||
- mImageArray[face][0]->getWidth() != mImageArray[0][0]->getHeight() ||
- mImageArray[face][0]->getInternalFormat() != mImageArray[0][0]->getInternalFormat())
+ const rx::Image &faceBaseImage = *mImageArray[faceIndex][0];
+
+ if (faceBaseImage.getWidth() != baseWidth ||
+ faceBaseImage.getHeight() != baseHeight ||
+ faceBaseImage.getInternalFormat() != baseFormat )
{
return false;
}
@@ -1117,20 +1293,13 @@ bool TextureCubeMap::isMipmapCubeComplete() const
return false;
}
- GLsizei size = mImageArray[0][0]->getWidth();
-
- int q = log2(size);
+ int levelCount = mipLevels();
for (int face = 0; face < 6; face++)
{
- for (int level = 1; level <= q; level++)
+ for (int level = 1; level < levelCount; level++)
{
- if (mImageArray[face][level]->getInternalFormat() != mImageArray[0][0]->getInternalFormat())
- {
- return false;
- }
-
- if (mImageArray[face][level]->getWidth() != std::max(1, size >> level))
+ if (!isFaceLevelComplete(face, level))
{
return false;
}
@@ -1140,34 +1309,103 @@ bool TextureCubeMap::isMipmapCubeComplete() const
return true;
}
+bool TextureCubeMap::isFaceLevelComplete(int faceIndex, int level) const
+{
+ ASSERT(level >= 0 && faceIndex < 6 && level < (int)ArraySize(mImageArray[faceIndex]) && mImageArray[faceIndex][level] != NULL);
+
+ if (isImmutable())
+ {
+ return true;
+ }
+
+ int baseSize = getBaseLevelWidth();
+
+ if (baseSize <= 0)
+ {
+ return false;
+ }
+
+ // "isCubeComplete" checks for base level completeness and we must call that
+ // to determine if any face at level 0 is complete. We omit that check here
+ // to avoid re-checking cube-completeness for every face at level 0.
+ if (level == 0)
+ {
+ return true;
+ }
+
+ // Check that non-zero levels are consistent with the base level.
+ const rx::Image *faceLevelImage = mImageArray[faceIndex][level];
+
+ if (faceLevelImage->getInternalFormat() != getBaseLevelInternalFormat())
+ {
+ return false;
+ }
+
+ if (faceLevelImage->getWidth() != std::max(1, baseSize >> level))
+ {
+ return false;
+ }
+
+ return true;
+}
+
bool TextureCubeMap::isCompressed(GLenum target, GLint level) const
{
- return IsCompressed(getInternalFormat(target, level));
+ return IsFormatCompressed(getInternalFormat(target, level), mRenderer->getCurrentClientVersion());
+}
+
+bool TextureCubeMap::isDepth(GLenum target, GLint level) const
+{
+ return GetDepthBits(getInternalFormat(target, level), mRenderer->getCurrentClientVersion()) > 0;
+}
+
+void TextureCubeMap::initializeStorage(bool renderTarget)
+{
+ // Only initialize the first time this texture is used as a render target or shader resource
+ if (mTexStorage)
+ {
+ return;
+ }
+
+ // do not attempt to create storage for nonexistant data
+ if (!isFaceLevelComplete(0, 0))
+ {
+ return;
+ }
+
+ bool createRenderTarget = (renderTarget || IsRenderTargetUsage(mUsage));
+
+ setCompleteTexStorage(createCompleteStorage(createRenderTarget));
+ ASSERT(mTexStorage);
+
+ // flush image data to the storage
+ updateStorage();
}
-// Constructs a native texture resource from the texture images, or returns an existing one
-void TextureCubeMap::createTexture()
+rx::TextureStorageInterfaceCube *TextureCubeMap::createCompleteStorage(bool renderTarget) const
{
- GLsizei size = mImageArray[0][0]->getWidth();
+ GLsizei size = getBaseLevelWidth();
- if (!(size > 0))
- return; // do not attempt to create native textures for nonexistant data
+ ASSERT(size > 0);
- GLint levels = creationLevels(size);
- GLenum internalformat = mImageArray[0][0]->getInternalFormat();
+ // use existing storage level count, when previously specified by TexStorage*D
+ GLint levels = (mTexStorage ? mTexStorage->getLevelCount() : creationLevels(size, size, 1));
- delete mTexStorage;
- mTexStorage = new rx::TextureStorageInterfaceCube(mRenderer, levels, internalformat, mUsage, false, size);
+ return new rx::TextureStorageInterfaceCube(mRenderer, getBaseLevelInternalFormat(), renderTarget, size, levels);
+}
- if (mTexStorage->isManaged())
- {
- int levels = levelCount();
+void TextureCubeMap::setCompleteTexStorage(rx::TextureStorageInterfaceCube *newCompleteTexStorage)
+{
+ SafeDelete(mTexStorage);
+ mTexStorage = newCompleteTexStorage;
- for (int face = 0; face < 6; face++)
+ if (mTexStorage && mTexStorage->isManaged())
+ {
+ for (int faceIndex = 0; faceIndex < 6; faceIndex++)
{
- for (int level = 0; level < levels; level++)
+ for (int level = 0; level < mTexStorage->getLevelCount(); level++)
{
- mImageArray[face][level]->setManagedSurface(mTexStorage, face, level);
+ mImageArray[faceIndex][level]->setManagedSurface(mTexStorage, faceIndex, level);
}
}
}
@@ -1175,63 +1413,69 @@ void TextureCubeMap::createTexture()
mDirtyImages = true;
}
-void TextureCubeMap::updateTexture()
+void TextureCubeMap::updateStorage()
{
- bool mipmapping = isMipmapFiltered() && isMipmapCubeComplete();
-
+ ASSERT(mTexStorage != NULL);
+ GLint storageLevels = mTexStorage->getLevelCount();
for (int face = 0; face < 6; face++)
{
- int levels = (mipmapping ? levelCount() : 1);
-
- for (int level = 0; level < levels; level++)
+ for (int level = 0; level < storageLevels; level++)
{
- rx::Image *image = mImageArray[face][level];
-
- if (image->isDirty())
+ if (mImageArray[face][level]->isDirty() && isFaceLevelComplete(face, level))
{
- commitRect(face, level, 0, 0, image->getWidth(), image->getHeight());
+ updateStorageFaceLevel(face, level);
}
}
}
}
-void TextureCubeMap::convertToRenderTarget()
+void TextureCubeMap::updateStorageFaceLevel(int faceIndex, int level)
{
- rx::TextureStorageInterfaceCube *newTexStorage = NULL;
+ ASSERT(level >= 0 && faceIndex < 6 && level < (int)ArraySize(mImageArray[faceIndex]) && mImageArray[faceIndex][level] != NULL);
+ rx::Image *image = mImageArray[faceIndex][level];
- if (mImageArray[0][0]->getWidth() != 0)
+ if (image->isDirty())
{
- GLsizei size = mImageArray[0][0]->getWidth();
- GLint levels = mTexStorage != NULL ? mTexStorage->levelCount() : creationLevels(size);
- GLenum internalformat = mImageArray[0][0]->getInternalFormat();
+ commitRect(faceIndex, level, 0, 0, image->getWidth(), image->getHeight());
+ }
+}
- newTexStorage = new rx::TextureStorageInterfaceCube(mRenderer, levels, internalformat, GL_FRAMEBUFFER_ATTACHMENT_ANGLE, true, size);
+bool TextureCubeMap::ensureRenderTarget()
+{
+ initializeStorage(true);
- if (mTexStorage != NULL)
+ if (getBaseLevelWidth() > 0)
+ {
+ ASSERT(mTexStorage);
+ if (!mTexStorage->isRenderTarget())
{
- if (!mRenderer->copyToRenderTarget(newTexStorage, mTexStorage))
+ rx::TextureStorageInterfaceCube *newRenderTargetStorage = createCompleteStorage(true);
+
+ if (!mRenderer->copyToRenderTarget(newRenderTargetStorage, mTexStorage))
{
- delete newTexStorage;
- return gl::error(GL_OUT_OF_MEMORY);
+ delete newRenderTargetStorage;
+ return gl::error(GL_OUT_OF_MEMORY, false);
}
+
+ setCompleteTexStorage(newRenderTargetStorage);
}
}
- delete mTexStorage;
- mTexStorage = newTexStorage;
-
- mDirtyImages = true;
+ return (mTexStorage && mTexStorage->isRenderTarget());
}
-void TextureCubeMap::setImage(int faceIndex, GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
+void TextureCubeMap::setImage(int faceIndex, GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
{
- GLint internalformat = ConvertSizedInternalFormat(format, type);
- redefineImage(faceIndex, level, internalformat, width, height);
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+ GLenum sizedInternalFormat = IsSizedInternalFormat(internalFormat, clientVersion) ? internalFormat
+ : GetSizedInternalFormat(format, type, clientVersion);
- Texture::setImage(unpackAlignment, pixels, mImageArray[faceIndex][level]);
+ redefineImage(faceIndex, level, sizedInternalFormat, width, height);
+
+ Texture::setImage(unpack, type, pixels, mImageArray[faceIndex][level]);
}
-unsigned int TextureCubeMap::faceIndex(GLenum face)
+int TextureCubeMap::targetToIndex(GLenum target)
{
META_ASSERT(GL_TEXTURE_CUBE_MAP_NEGATIVE_X - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 1);
META_ASSERT(GL_TEXTURE_CUBE_MAP_POSITIVE_Y - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 2);
@@ -1239,32 +1483,32 @@ unsigned int TextureCubeMap::faceIndex(GLenum face)
META_ASSERT(GL_TEXTURE_CUBE_MAP_POSITIVE_Z - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 4);
META_ASSERT(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 5);
- return face - GL_TEXTURE_CUBE_MAP_POSITIVE_X;
+ return target - GL_TEXTURE_CUBE_MAP_POSITIVE_X;
}
-void TextureCubeMap::redefineImage(int face, GLint level, GLint internalformat, GLsizei width, GLsizei height)
+void TextureCubeMap::redefineImage(int faceIndex, GLint level, GLenum internalformat, GLsizei width, GLsizei height)
{
// If there currently is a corresponding storage texture image, it has these parameters
- const int storageWidth = std::max(1, mImageArray[0][0]->getWidth() >> level);
- const int storageHeight = std::max(1, mImageArray[0][0]->getHeight() >> level);
- const int storageFormat = mImageArray[0][0]->getInternalFormat();
+ const int storageWidth = std::max(1, getBaseLevelWidth() >> level);
+ const int storageHeight = std::max(1, getBaseLevelHeight() >> level);
+ const GLenum storageFormat = getBaseLevelInternalFormat();
- mImageArray[face][level]->redefine(mRenderer, internalformat, width, height, false);
+ mImageArray[faceIndex][level]->redefine(mRenderer, GL_TEXTURE_CUBE_MAP, internalformat, width, height, 1, false);
if (mTexStorage)
{
- const int storageLevels = mTexStorage->levelCount();
-
+ const int storageLevels = mTexStorage->getLevelCount();
+
if ((level >= storageLevels && storageLevels != 0) ||
width != storageWidth ||
height != storageHeight ||
internalformat != storageFormat) // Discard mismatched storage
{
- for (int i = 0; i < IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+ for (int level = 0; level < IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
{
- for (int f = 0; f < 6; f++)
+ for (int faceIndex = 0; faceIndex < 6; faceIndex++)
{
- mImageArray[f][i]->markDirty();
+ mImageArray[faceIndex][level]->markDirty();
}
}
@@ -1278,27 +1522,25 @@ void TextureCubeMap::redefineImage(int face, GLint level, GLint internalformat,
void TextureCubeMap::copyImage(GLenum target, GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source)
{
- unsigned int faceindex = faceIndex(target);
- GLint internalformat = gl::ConvertSizedInternalFormat(format, GL_UNSIGNED_BYTE);
- redefineImage(faceindex, level, internalformat, width, height);
+ int faceIndex = targetToIndex(target);
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+ GLenum sizedInternalFormat = IsSizedInternalFormat(format, clientVersion) ? format
+ : GetSizedInternalFormat(format, GL_UNSIGNED_BYTE, clientVersion);
+ redefineImage(faceIndex, level, sizedInternalFormat, width, height);
- if (!mImageArray[faceindex][level]->isRenderableFormat())
+ if (!mImageArray[faceIndex][level]->isRenderableFormat())
{
- mImageArray[faceindex][level]->copy(0, 0, x, y, width, height, source);
+ mImageArray[faceIndex][level]->copy(0, 0, 0, x, y, width, height, source);
mDirtyImages = true;
}
else
{
- if (!mTexStorage || !mTexStorage->isRenderTarget())
- {
- convertToRenderTarget();
- }
-
- mImageArray[faceindex][level]->markClean();
+ ensureRenderTarget();
+ mImageArray[faceIndex][level]->markClean();
ASSERT(width == height);
- if (width > 0 && level < levelCount())
+ if (width > 0 && isValidFaceLevel(faceIndex, level))
{
gl::Rectangle sourceRect;
sourceRect.x = x;
@@ -1311,40 +1553,37 @@ void TextureCubeMap::copyImage(GLenum target, GLint level, GLenum format, GLint
}
}
-void TextureCubeMap::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source)
+void TextureCubeMap::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source)
{
- GLsizei size = mImageArray[faceIndex(target)][level]->getWidth();
+ int faceIndex = targetToIndex(target);
- if (xoffset + width > size || yoffset + height > size)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- unsigned int faceindex = faceIndex(target);
+ // We can only make our texture storage to a render target if the level we're copying *to* is complete
+ // and the base level is cube-complete. The base level must be cube complete (common case) because we cannot
+ // rely on the "getBaseLevel*" methods reliably otherwise.
+ bool canCreateRenderTarget = isFaceLevelComplete(faceIndex, level) && isCubeComplete();
- if (!mImageArray[faceindex][level]->isRenderableFormat() || (!mTexStorage && !isSamplerComplete()))
+ if (!mImageArray[faceIndex][level]->isRenderableFormat() || (!mTexStorage && !canCreateRenderTarget))
{
- mImageArray[faceindex][level]->copy(0, 0, x, y, width, height, source);
+ mImageArray[faceIndex][level]->copy(0, 0, 0, x, y, width, height, source);
mDirtyImages = true;
}
else
{
- if (!mTexStorage || !mTexStorage->isRenderTarget())
- {
- convertToRenderTarget();
- }
+ ensureRenderTarget();
- updateTexture();
-
- if (level < levelCount())
+ if (isValidFaceLevel(faceIndex, level))
{
+ updateStorageFaceLevel(faceIndex, level);
+
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+
gl::Rectangle sourceRect;
sourceRect.x = x;
sourceRect.width = width;
sourceRect.y = y;
sourceRect.height = height;
- mRenderer->copyImage(source, sourceRect, gl::ExtractFormat(mImageArray[0][0]->getInternalFormat()),
+ mRenderer->copyImage(source, sourceRect, gl::GetFormat(getBaseLevelInternalFormat(), clientVersion),
xoffset, yoffset, mTexStorage, target, level);
}
}
@@ -1352,144 +1591,1229 @@ void TextureCubeMap::copySubImage(GLenum target, GLint level, GLint xoffset, GLi
void TextureCubeMap::storage(GLsizei levels, GLenum internalformat, GLsizei size)
{
- delete mTexStorage;
- mTexStorage = new rx::TextureStorageInterfaceCube(mRenderer, levels, internalformat, mUsage, false, size);
- mImmutable = true;
-
for (int level = 0; level < levels; level++)
{
GLsizei mipSize = std::max(1, size >> level);
- for (int face = 0; face < 6; face++)
+ for (int faceIndex = 0; faceIndex < 6; faceIndex++)
{
- mImageArray[face][level]->redefine(mRenderer, internalformat, mipSize, mipSize, true);
+ mImageArray[faceIndex][level]->redefine(mRenderer, GL_TEXTURE_CUBE_MAP, internalformat, mipSize, mipSize, 1, true);
}
}
for (int level = levels; level < IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
{
- for (int face = 0; face < 6; face++)
+ for (int faceIndex = 0; faceIndex < 6; faceIndex++)
{
- mImageArray[face][level]->redefine(mRenderer, GL_NONE, 0, 0, true);
+ mImageArray[faceIndex][level]->redefine(mRenderer, GL_TEXTURE_CUBE_MAP, GL_NONE, 0, 0, 0, true);
}
}
- if (mTexStorage->isManaged())
+ mImmutable = true;
+
+ setCompleteTexStorage(new rx::TextureStorageInterfaceCube(mRenderer, internalformat, IsRenderTargetUsage(mUsage), size, levels));
+}
+
+void TextureCubeMap::generateMipmaps()
+{
+ // Purge array levels 1 through q and reset them to represent the generated mipmap levels.
+ int levelCount = mipLevels();
+ for (int faceIndex = 0; faceIndex < 6; faceIndex++)
{
- int levels = levelCount();
+ for (int level = 1; level < levelCount; level++)
+ {
+ int faceLevelSize = (std::max(mImageArray[faceIndex][0]->getWidth() >> level, 1));
+ redefineImage(faceIndex, level, mImageArray[faceIndex][0]->getInternalFormat(), faceLevelSize, faceLevelSize);
+ }
+ }
- for (int face = 0; face < 6; face++)
+ if (mTexStorage && mTexStorage->isRenderTarget())
+ {
+ for (int faceIndex = 0; faceIndex < 6; faceIndex++)
{
- for (int level = 0; level < levels; level++)
+ for (int level = 1; level < levelCount; level++)
{
- mImageArray[face][level]->setManagedSurface(mTexStorage, face, level);
+ mTexStorage->generateMipmap(faceIndex, level);
+
+ mImageArray[faceIndex][level]->markClean();
+ }
+ }
+ }
+ else
+ {
+ for (int faceIndex = 0; faceIndex < 6; faceIndex++)
+ {
+ for (int level = 1; level < levelCount; level++)
+ {
+ mRenderer->generateMipmap(mImageArray[faceIndex][level], mImageArray[faceIndex][level - 1]);
}
}
}
}
-void TextureCubeMap::generateMipmaps()
+const rx::Image *TextureCubeMap::getBaseLevelImage() const
{
- if (!isCubeComplete())
+ // Note: if we are not cube-complete, there is no single base level image that can describe all
+ // cube faces, so this method is only well-defined for a cube-complete base level.
+ return mImageArray[0][0];
+}
+
+rx::TextureStorageInterface *TextureCubeMap::getBaseLevelStorage()
+{
+ return mTexStorage;
+}
+
+FramebufferAttachment *TextureCubeMap::getAttachment(GLenum target, GLint level)
+{
+ ASSERT(!IsCubemapTextureTarget(target));
+ int faceIndex = targetToIndex(target);
+
+ FramebufferAttachment *attachment = mRenderbufferProxies.get(level, faceIndex);
+ if (!attachment)
+ {
+ attachment = new FramebufferAttachment(mRenderer, id(), new TextureCubeMapAttachment(this, target, level));
+ mRenderbufferProxies.add(level, faceIndex, attachment);
+ }
+
+ return attachment;
+}
+
+unsigned int TextureCubeMap::getRenderTargetSerial(GLenum target, GLint level)
+{
+ return (ensureRenderTarget() ? mTexStorage->getRenderTargetSerial(target, level) : 0);
+}
+
+rx::RenderTarget *TextureCubeMap::getRenderTarget(GLenum target, GLint level)
+{
+ ASSERT(IsCubemapTextureTarget(target));
+
+ // ensure the underlying texture is created
+ if (!ensureRenderTarget())
{
- return gl::error(GL_INVALID_OPERATION);
+ return NULL;
}
- if (!mRenderer->getNonPower2TextureSupport())
+ updateStorageFaceLevel(targetToIndex(target), level);
+
+ // ensure this is NOT a depth texture
+ if (isDepth(target, level))
+ {
+ return NULL;
+ }
+
+ return mTexStorage->getRenderTarget(target, level);
+}
+
+rx::RenderTarget *TextureCubeMap::getDepthStencil(GLenum target, GLint level)
+{
+ ASSERT(IsCubemapTextureTarget(target));
+
+ // ensure the underlying texture is created
+ if (!ensureRenderTarget())
+ {
+ return NULL;
+ }
+
+ updateStorageFaceLevel(targetToIndex(target), level);
+
+ // ensure this is a depth texture
+ if (!isDepth(target, level))
{
- if (!isPow2(mImageArray[0][0]->getWidth()))
+ return NULL;
+ }
+
+ return mTexStorage->getRenderTarget(target, level);
+}
+
+bool TextureCubeMap::isValidFaceLevel(int faceIndex, int level) const
+{
+ return (mTexStorage ? (level >= 0 && level < mTexStorage->getLevelCount()) : 0);
+}
+
+Texture3D::Texture3D(rx::Renderer *renderer, GLuint id) : Texture(renderer, id, GL_TEXTURE_3D)
+{
+ mTexStorage = NULL;
+
+ for (int i = 0; i < IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++i)
+ {
+ mImageArray[i] = renderer->createImage();
+ }
+}
+
+Texture3D::~Texture3D()
+{
+ delete mTexStorage;
+ mTexStorage = NULL;
+
+ for (int i = 0; i < IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++i)
+ {
+ delete mImageArray[i];
+ }
+}
+
+GLsizei Texture3D::getWidth(GLint level) const
+{
+ return (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS) ? mImageArray[level]->getWidth() : 0;
+}
+
+GLsizei Texture3D::getHeight(GLint level) const
+{
+ return (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS) ? mImageArray[level]->getHeight() : 0;
+}
+
+GLsizei Texture3D::getDepth(GLint level) const
+{
+ return (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS) ? mImageArray[level]->getDepth() : 0;
+}
+
+GLenum Texture3D::getInternalFormat(GLint level) const
+{
+ return (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS) ? mImageArray[level]->getInternalFormat() : GL_NONE;
+}
+
+GLenum Texture3D::getActualFormat(GLint level) const
+{
+ return (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS) ? mImageArray[level]->getActualFormat() : GL_NONE;
+}
+
+bool Texture3D::isCompressed(GLint level) const
+{
+ return IsFormatCompressed(getInternalFormat(level), mRenderer->getCurrentClientVersion());
+}
+
+bool Texture3D::isDepth(GLint level) const
+{
+ return GetDepthBits(getInternalFormat(level), mRenderer->getCurrentClientVersion()) > 0;
+}
+
+void Texture3D::setImage(GLint level, GLsizei width, GLsizei height, GLsizei depth, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
+{
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+ GLenum sizedInternalFormat = IsSizedInternalFormat(internalFormat, clientVersion) ? internalFormat
+ : GetSizedInternalFormat(format, type, clientVersion);
+ redefineImage(level, sizedInternalFormat, width, height, depth);
+
+ bool fastUnpacked = false;
+
+ // Attempt a fast gpu copy of the pixel data to the surface if the app bound an unpack buffer
+ if (isFastUnpackable(unpack, sizedInternalFormat))
+ {
+ // Will try to create RT storage if it does not exist
+ rx::RenderTarget *destRenderTarget = getRenderTarget(level);
+ Box destArea(0, 0, 0, getWidth(level), getHeight(level), getDepth(level));
+
+ if (destRenderTarget && fastUnpackPixels(unpack, pixels, destArea, sizedInternalFormat, type, destRenderTarget))
{
- return gl::error(GL_INVALID_OPERATION);
+ // Ensure we don't overwrite our newly initialized data
+ mImageArray[level]->markClean();
+
+ fastUnpacked = true;
}
}
- // Purge array levels 1 through q and reset them to represent the generated mipmap levels.
- unsigned int q = log2(mImageArray[0][0]->getWidth());
- for (unsigned int f = 0; f < 6; f++)
+ if (!fastUnpacked)
{
- for (unsigned int i = 1; i <= q; i++)
+ Texture::setImage(unpack, type, pixels, mImageArray[level]);
+ }
+}
+
+void Texture3D::setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei depth, GLsizei imageSize, const void *pixels)
+{
+ // compressed formats don't have separate sized internal formats-- we can just use the compressed format directly
+ redefineImage(level, format, width, height, depth);
+
+ Texture::setCompressedImage(imageSize, pixels, mImageArray[level]);
+}
+
+void Texture3D::subImage(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
+{
+ bool fastUnpacked = false;
+
+ // Attempt a fast gpu copy of the pixel data to the surface if the app bound an unpack buffer
+ if (isFastUnpackable(unpack, getInternalFormat(level)))
+ {
+ rx::RenderTarget *destRenderTarget = getRenderTarget(level);
+ Box destArea(xoffset, yoffset, zoffset, width, height, depth);
+
+ if (destRenderTarget && fastUnpackPixels(unpack, pixels, destArea, getInternalFormat(level), type, destRenderTarget))
{
- redefineImage(f, i, mImageArray[f][0]->getInternalFormat(),
- std::max(mImageArray[f][0]->getWidth() >> i, 1),
- std::max(mImageArray[f][0]->getWidth() >> i, 1));
+ // Ensure we don't overwrite our newly initialized data
+ mImageArray[level]->markClean();
+
+ fastUnpacked = true;
}
}
+ if (!fastUnpacked && Texture::subImage(xoffset, yoffset, zoffset, width, height, depth, format, type, unpack, pixels, mImageArray[level]))
+ {
+ commitRect(level, xoffset, yoffset, zoffset, width, height, depth);
+ }
+}
+
+void Texture3D::subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *pixels)
+{
+ if (Texture::subImageCompressed(xoffset, yoffset, zoffset, width, height, depth, format, imageSize, pixels, mImageArray[level]))
+ {
+ commitRect(level, xoffset, yoffset, zoffset, width, height, depth);
+ }
+}
+
+void Texture3D::storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
+{
+ for (int level = 0; level < levels; level++)
+ {
+ GLsizei levelWidth = std::max(1, width >> level);
+ GLsizei levelHeight = std::max(1, height >> level);
+ GLsizei levelDepth = std::max(1, depth >> level);
+ mImageArray[level]->redefine(mRenderer, GL_TEXTURE_3D, internalformat, levelWidth, levelHeight, levelDepth, true);
+ }
+
+ for (int level = levels; level < IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+ {
+ mImageArray[level]->redefine(mRenderer, GL_TEXTURE_3D, GL_NONE, 0, 0, 0, true);
+ }
+
+ mImmutable = true;
+
+ setCompleteTexStorage(new rx::TextureStorageInterface3D(mRenderer, internalformat, IsRenderTargetUsage(mUsage), width, height, depth, levels));
+}
+
+void Texture3D::generateMipmaps()
+{
+ // Purge array levels 1 through q and reset them to represent the generated mipmap levels.
+ int levelCount = mipLevels();
+ for (int level = 1; level < levelCount; level++)
+ {
+ redefineImage(level, getBaseLevelInternalFormat(),
+ std::max(getBaseLevelWidth() >> level, 1),
+ std::max(getBaseLevelHeight() >> level, 1),
+ std::max(getBaseLevelDepth() >> level, 1));
+ }
+
if (mTexStorage && mTexStorage->isRenderTarget())
{
- for (unsigned int f = 0; f < 6; f++)
+ for (int level = 1; level < levelCount; level++)
+ {
+ mTexStorage->generateMipmap(level);
+
+ mImageArray[level]->markClean();
+ }
+ }
+ else
+ {
+ for (int level = 1; level < levelCount; level++)
+ {
+ mRenderer->generateMipmap(mImageArray[level], mImageArray[level - 1]);
+ }
+ }
+}
+
+const rx::Image *Texture3D::getBaseLevelImage() const
+{
+ return mImageArray[0];
+}
+
+rx::TextureStorageInterface *Texture3D::getBaseLevelStorage()
+{
+ return mTexStorage;
+}
+
+void Texture3D::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source)
+{
+ // can only make our texture storage to a render target if level 0 is defined (with a width & height) and
+ // the current level we're copying to is defined (with appropriate format, width & height)
+ bool canCreateRenderTarget = isLevelComplete(level) && isLevelComplete(0);
+
+ if (!mImageArray[level]->isRenderableFormat() || (!mTexStorage && !canCreateRenderTarget))
+ {
+ mImageArray[level]->copy(xoffset, yoffset, zoffset, x, y, width, height, source);
+ mDirtyImages = true;
+ }
+ else
+ {
+ ensureRenderTarget();
+
+ if (isValidLevel(level))
+ {
+ updateStorageLevel(level);
+
+ gl::Rectangle sourceRect;
+ sourceRect.x = x;
+ sourceRect.width = width;
+ sourceRect.y = y;
+ sourceRect.height = height;
+
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+
+ mRenderer->copyImage(source, sourceRect,
+ gl::GetFormat(getBaseLevelInternalFormat(), clientVersion),
+ xoffset, yoffset, zoffset, mTexStorage, level);
+ }
+ }
+}
+
+bool Texture3D::isSamplerComplete(const SamplerState &samplerState) const
+{
+ GLsizei width = getBaseLevelWidth();
+ GLsizei height = getBaseLevelHeight();
+ GLsizei depth = getBaseLevelDepth();
+
+ if (width <= 0 || height <= 0 || depth <= 0)
+ {
+ return false;
+ }
+
+ if (!IsTextureFilteringSupported(getInternalFormat(0), mRenderer))
+ {
+ if (samplerState.magFilter != GL_NEAREST ||
+ (samplerState.minFilter != GL_NEAREST && samplerState.minFilter != GL_NEAREST_MIPMAP_NEAREST))
+ {
+ return false;
+ }
+ }
+
+ if (IsMipmapFiltered(samplerState) && !isMipmapComplete())
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool Texture3D::isMipmapComplete() const
+{
+ int levelCount = mipLevels();
+
+ for (int level = 0; level < levelCount; level++)
+ {
+ if (!isLevelComplete(level))
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool Texture3D::isLevelComplete(int level) const
+{
+ ASSERT(level >= 0 && level < (int)ArraySize(mImageArray) && mImageArray[level] != NULL);
+
+ if (isImmutable())
+ {
+ return true;
+ }
+
+ GLsizei width = getBaseLevelWidth();
+ GLsizei height = getBaseLevelHeight();
+ GLsizei depth = getBaseLevelDepth();
+
+ if (width <= 0 || height <= 0 || depth <= 0)
+ {
+ return false;
+ }
+
+ if (level == 0)
+ {
+ return true;
+ }
+
+ rx::Image *levelImage = mImageArray[level];
+
+ if (levelImage->getInternalFormat() != getBaseLevelInternalFormat())
+ {
+ return false;
+ }
+
+ if (levelImage->getWidth() != std::max(1, width >> level))
+ {
+ return false;
+ }
+
+ if (levelImage->getHeight() != std::max(1, height >> level))
+ {
+ return false;
+ }
+
+ if (levelImage->getDepth() != std::max(1, depth >> level))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+FramebufferAttachment *Texture3D::getAttachment(GLint level, GLint layer)
+{
+ FramebufferAttachment *attachment = mRenderbufferProxies.get(level, layer);
+ if (!attachment)
+ {
+ attachment = new FramebufferAttachment(mRenderer, id(), new Texture3DAttachment(this, level, layer));
+ mRenderbufferProxies.add(level, 0, attachment);
+ }
+
+ return attachment;
+}
+
+unsigned int Texture3D::getRenderTargetSerial(GLint level, GLint layer)
+{
+ return (ensureRenderTarget() ? mTexStorage->getRenderTargetSerial(level, layer) : 0);
+}
+
+bool Texture3D::isValidLevel(int level) const
+{
+ return (mTexStorage ? (level >= 0 && level < mTexStorage->getLevelCount()) : 0);
+}
+
+void Texture3D::initializeStorage(bool renderTarget)
+{
+ // Only initialize the first time this texture is used as a render target or shader resource
+ if (mTexStorage)
+ {
+ return;
+ }
+
+ // do not attempt to create storage for nonexistant data
+ if (!isLevelComplete(0))
+ {
+ return;
+ }
+
+ bool createRenderTarget = (renderTarget || mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
+
+ setCompleteTexStorage(createCompleteStorage(createRenderTarget));
+ ASSERT(mTexStorage);
+
+ // flush image data to the storage
+ updateStorage();
+}
+
+rx::TextureStorageInterface3D *Texture3D::createCompleteStorage(bool renderTarget) const
+{
+ GLsizei width = getBaseLevelWidth();
+ GLsizei height = getBaseLevelHeight();
+ GLsizei depth = getBaseLevelDepth();
+
+ ASSERT(width > 0 && height > 0 && depth > 0);
+
+ // use existing storage level count, when previously specified by TexStorage*D
+ GLint levels = (mTexStorage ? mTexStorage->getLevelCount() : creationLevels(width, height, depth));
+
+ return new rx::TextureStorageInterface3D(mRenderer, getBaseLevelInternalFormat(), renderTarget, width, height, depth, levels);
+}
+
+void Texture3D::setCompleteTexStorage(rx::TextureStorageInterface3D *newCompleteTexStorage)
+{
+ SafeDelete(mTexStorage);
+ mTexStorage = newCompleteTexStorage;
+ mDirtyImages = true;
+
+ // We do not support managed 3D storage, as that is D3D9/ES2-only
+ ASSERT(!mTexStorage->isManaged());
+}
+
+void Texture3D::updateStorage()
+{
+ ASSERT(mTexStorage != NULL);
+ GLint storageLevels = mTexStorage->getLevelCount();
+ for (int level = 0; level < storageLevels; level++)
+ {
+ if (mImageArray[level]->isDirty() && isLevelComplete(level))
+ {
+ updateStorageLevel(level);
+ }
+ }
+}
+
+void Texture3D::updateStorageLevel(int level)
+{
+ ASSERT(level >= 0 && level < (int)ArraySize(mImageArray) && mImageArray[level] != NULL);
+ ASSERT(isLevelComplete(level));
+
+ if (mImageArray[level]->isDirty())
+ {
+ commitRect(level, 0, 0, 0, getWidth(level), getHeight(level), getDepth(level));
+ }
+}
+
+bool Texture3D::ensureRenderTarget()
+{
+ initializeStorage(true);
+
+ if (getBaseLevelWidth() > 0 && getBaseLevelHeight() > 0 && getBaseLevelDepth() > 0)
+ {
+ ASSERT(mTexStorage);
+ if (!mTexStorage->isRenderTarget())
+ {
+ rx::TextureStorageInterface3D *newRenderTargetStorage = createCompleteStorage(true);
+
+ if (!mRenderer->copyToRenderTarget(newRenderTargetStorage, mTexStorage))
+ {
+ delete newRenderTargetStorage;
+ return gl::error(GL_OUT_OF_MEMORY, false);
+ }
+
+ setCompleteTexStorage(newRenderTargetStorage);
+ }
+ }
+
+ return (mTexStorage && mTexStorage->isRenderTarget());
+}
+
+rx::RenderTarget *Texture3D::getRenderTarget(GLint level)
+{
+ // ensure the underlying texture is created
+ if (!ensureRenderTarget())
+ {
+ return NULL;
+ }
+
+ updateStorageLevel(level);
+
+ // ensure this is NOT a depth texture
+ if (isDepth(level))
+ {
+ return NULL;
+ }
+
+ return mTexStorage->getRenderTarget(level);
+}
+
+rx::RenderTarget *Texture3D::getRenderTarget(GLint level, GLint layer)
+{
+ // ensure the underlying texture is created
+ if (!ensureRenderTarget())
+ {
+ return NULL;
+ }
+
+ updateStorage();
+
+ // ensure this is NOT a depth texture
+ if (isDepth(level))
+ {
+ return NULL;
+ }
+
+ return mTexStorage->getRenderTarget(level, layer);
+}
+
+rx::RenderTarget *Texture3D::getDepthStencil(GLint level, GLint layer)
+{
+ // ensure the underlying texture is created
+ if (!ensureRenderTarget())
+ {
+ return NULL;
+ }
+
+ updateStorageLevel(level);
+
+ // ensure this is a depth texture
+ if (!isDepth(level))
+ {
+ return NULL;
+ }
+
+ return mTexStorage->getRenderTarget(level, layer);
+}
+
+void Texture3D::redefineImage(GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
+{
+ // If there currently is a corresponding storage texture image, it has these parameters
+ const int storageWidth = std::max(1, getBaseLevelWidth() >> level);
+ const int storageHeight = std::max(1, getBaseLevelHeight() >> level);
+ const int storageDepth = std::max(1, getBaseLevelDepth() >> level);
+ const GLenum storageFormat = getBaseLevelInternalFormat();
+
+ mImageArray[level]->redefine(mRenderer, GL_TEXTURE_3D, internalformat, width, height, depth, false);
+
+ if (mTexStorage)
+ {
+ const int storageLevels = mTexStorage->getLevelCount();
+
+ if ((level >= storageLevels && storageLevels != 0) ||
+ width != storageWidth ||
+ height != storageHeight ||
+ depth != storageDepth ||
+ internalformat != storageFormat) // Discard mismatched storage
+ {
+ for (int i = 0; i < IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+ {
+ mImageArray[i]->markDirty();
+ }
+
+ delete mTexStorage;
+ mTexStorage = NULL;
+ mDirtyImages = true;
+ }
+ }
+}
+
+void Texture3D::commitRect(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth)
+{
+ if (isValidLevel(level))
+ {
+ rx::Image *image = mImageArray[level];
+ if (image->copyToStorage(mTexStorage, level, xoffset, yoffset, zoffset, width, height, depth))
+ {
+ image->markClean();
+ }
+ }
+}
+
+Texture2DArray::Texture2DArray(rx::Renderer *renderer, GLuint id) : Texture(renderer, id, GL_TEXTURE_2D_ARRAY)
+{
+ mTexStorage = NULL;
+
+ for (int level = 0; level < IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++level)
+ {
+ mLayerCounts[level] = 0;
+ mImageArray[level] = NULL;
+ }
+}
+
+Texture2DArray::~Texture2DArray()
+{
+ delete mTexStorage;
+ mTexStorage = NULL;
+
+ deleteImages();
+}
+
+void Texture2DArray::deleteImages()
+{
+ for (int level = 0; level < IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++level)
+ {
+ for (int layer = 0; layer < mLayerCounts[level]; ++layer)
+ {
+ delete mImageArray[level][layer];
+ }
+ delete[] mImageArray[level];
+ mImageArray[level] = NULL;
+ mLayerCounts[level] = 0;
+ }
+}
+
+GLsizei Texture2DArray::getWidth(GLint level) const
+{
+ return (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS && mLayerCounts[level] > 0) ? mImageArray[level][0]->getWidth() : 0;
+}
+
+GLsizei Texture2DArray::getHeight(GLint level) const
+{
+ return (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS && mLayerCounts[level] > 0) ? mImageArray[level][0]->getHeight() : 0;
+}
+
+GLsizei Texture2DArray::getLayers(GLint level) const
+{
+ return (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS && mLayerCounts[level] > 0) ? mLayerCounts[level] : 0;
+}
+
+GLenum Texture2DArray::getInternalFormat(GLint level) const
+{
+ return (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS && mLayerCounts[level] > 0) ? mImageArray[level][0]->getInternalFormat() : GL_NONE;
+}
+
+GLenum Texture2DArray::getActualFormat(GLint level) const
+{
+ return (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS && mLayerCounts[level] > 0) ? mImageArray[level][0]->getActualFormat() : GL_NONE;
+}
+
+bool Texture2DArray::isCompressed(GLint level) const
+{
+ return IsFormatCompressed(getInternalFormat(level), mRenderer->getCurrentClientVersion());
+}
+
+bool Texture2DArray::isDepth(GLint level) const
+{
+ return GetDepthBits(getInternalFormat(level), mRenderer->getCurrentClientVersion()) > 0;
+}
+
+void Texture2DArray::setImage(GLint level, GLsizei width, GLsizei height, GLsizei depth, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
+{
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+ GLenum sizedInternalFormat = IsSizedInternalFormat(internalFormat, clientVersion) ? internalFormat
+ : GetSizedInternalFormat(format, type, clientVersion);
+ redefineImage(level, sizedInternalFormat, width, height, depth);
+
+ GLsizei inputDepthPitch = gl::GetDepthPitch(sizedInternalFormat, type, clientVersion, width, height, unpack.alignment);
+
+ for (int i = 0; i < depth; i++)
+ {
+ const void *layerPixels = pixels ? (reinterpret_cast<const unsigned char*>(pixels) + (inputDepthPitch * i)) : NULL;
+ Texture::setImage(unpack, type, layerPixels, mImageArray[level][i]);
+ }
+}
+
+void Texture2DArray::setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei depth, GLsizei imageSize, const void *pixels)
+{
+ // compressed formats don't have separate sized internal formats-- we can just use the compressed format directly
+ redefineImage(level, format, width, height, depth);
+
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+ GLsizei inputDepthPitch = gl::GetDepthPitch(format, GL_UNSIGNED_BYTE, clientVersion, width, height, 1);
+
+ for (int i = 0; i < depth; i++)
+ {
+ const void *layerPixels = pixels ? (reinterpret_cast<const unsigned char*>(pixels) + (inputDepthPitch * i)) : NULL;
+ Texture::setCompressedImage(imageSize, layerPixels, mImageArray[level][i]);
+ }
+}
+
+void Texture2DArray::subImage(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
+{
+ GLenum internalformat = getInternalFormat(level);
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+ GLsizei inputDepthPitch = gl::GetDepthPitch(internalformat, type, clientVersion, width, height, unpack.alignment);
+
+ for (int i = 0; i < depth; i++)
+ {
+ int layer = zoffset + i;
+ const void *layerPixels = pixels ? (reinterpret_cast<const unsigned char*>(pixels) + (inputDepthPitch * i)) : NULL;
+
+ if (Texture::subImage(xoffset, yoffset, zoffset, width, height, 1, format, type, unpack, layerPixels, mImageArray[level][layer]))
{
- for (unsigned int i = 1; i <= q; i++)
+ commitRect(level, xoffset, yoffset, layer, width, height);
+ }
+ }
+}
+
+void Texture2DArray::subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *pixels)
+{
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+ GLsizei inputDepthPitch = gl::GetDepthPitch(format, GL_UNSIGNED_BYTE, clientVersion, width, height, 1);
+
+ for (int i = 0; i < depth; i++)
+ {
+ int layer = zoffset + i;
+ const void *layerPixels = pixels ? (reinterpret_cast<const unsigned char*>(pixels) + (inputDepthPitch * i)) : NULL;
+
+ if (Texture::subImageCompressed(xoffset, yoffset, zoffset, width, height, 1, format, imageSize, layerPixels, mImageArray[level][layer]))
+ {
+ commitRect(level, xoffset, yoffset, layer, width, height);
+ }
+ }
+}
+
+void Texture2DArray::storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
+{
+ deleteImages();
+
+ for (int level = 0; level < IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+ {
+ GLsizei levelWidth = std::max(1, width >> level);
+ GLsizei levelHeight = std::max(1, height >> level);
+
+ mLayerCounts[level] = (level < levels ? depth : 0);
+
+ if (mLayerCounts[level] > 0)
+ {
+ // Create new images for this level
+ mImageArray[level] = new rx::Image*[mLayerCounts[level]];
+
+ for (int layer = 0; layer < mLayerCounts[level]; layer++)
{
- mTexStorage->generateMipmap(f, i);
+ mImageArray[level][layer] = mRenderer->createImage();
+ mImageArray[level][layer]->redefine(mRenderer, GL_TEXTURE_2D_ARRAY, internalformat, levelWidth,
+ levelHeight, 1, true);
+ }
+ }
+ }
+
+ mImmutable = true;
+ setCompleteTexStorage(new rx::TextureStorageInterface2DArray(mRenderer, internalformat, IsRenderTargetUsage(mUsage), width, height, depth, levels));
+}
+
+void Texture2DArray::generateMipmaps()
+{
+ int baseWidth = getBaseLevelWidth();
+ int baseHeight = getBaseLevelHeight();
+ int baseDepth = getBaseLevelDepth();
+ GLenum baseFormat = getBaseLevelInternalFormat();
+
+ // Purge array levels 1 through q and reset them to represent the generated mipmap levels.
+ int levelCount = mipLevels();
+ for (int level = 1; level < levelCount; level++)
+ {
+ redefineImage(level, baseFormat, std::max(baseWidth >> level, 1), std::max(baseHeight >> level, 1), baseDepth);
+ }
+
+ if (mTexStorage && mTexStorage->isRenderTarget())
+ {
+ for (int level = 1; level < levelCount; level++)
+ {
+ mTexStorage->generateMipmap(level);
- mImageArray[f][i]->markClean();
+ for (int layer = 0; layer < mLayerCounts[level]; layer++)
+ {
+ mImageArray[level][layer]->markClean();
}
}
}
else
{
- for (unsigned int f = 0; f < 6; f++)
+ for (int level = 1; level < levelCount; level++)
{
- for (unsigned int i = 1; i <= q; i++)
+ for (int layer = 0; layer < mLayerCounts[level]; layer++)
{
- mRenderer->generateMipmap(mImageArray[f][i], mImageArray[f][i - 1]);
+ mRenderer->generateMipmap(mImageArray[level][layer], mImageArray[level - 1][layer]);
}
}
}
}
-Renderbuffer *TextureCubeMap::getRenderbuffer(GLenum target)
+const rx::Image *Texture2DArray::getBaseLevelImage() const
+{
+ return (mLayerCounts[0] > 0 ? mImageArray[0][0] : NULL);
+}
+
+rx::TextureStorageInterface *Texture2DArray::getBaseLevelStorage()
+{
+ return mTexStorage;
+}
+
+void Texture2DArray::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source)
+{
+ // can only make our texture storage to a render target if level 0 is defined (with a width & height) and
+ // the current level we're copying to is defined (with appropriate format, width & height)
+ bool canCreateRenderTarget = isLevelComplete(level) && isLevelComplete(0);
+
+ if (!mImageArray[level][0]->isRenderableFormat() || (!mTexStorage && !canCreateRenderTarget))
+ {
+ mImageArray[level][zoffset]->copy(xoffset, yoffset, 0, x, y, width, height, source);
+ mDirtyImages = true;
+ }
+ else
+ {
+ ensureRenderTarget();
+
+ if (isValidLevel(level))
+ {
+ updateStorageLevel(level);
+
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+
+ gl::Rectangle sourceRect;
+ sourceRect.x = x;
+ sourceRect.width = width;
+ sourceRect.y = y;
+ sourceRect.height = height;
+
+ mRenderer->copyImage(source, sourceRect, gl::GetFormat(getInternalFormat(0), clientVersion),
+ xoffset, yoffset, zoffset, mTexStorage, level);
+ }
+ }
+}
+
+bool Texture2DArray::isSamplerComplete(const SamplerState &samplerState) const
{
- if (!IsCubemapTextureTarget(target))
+ GLsizei width = getBaseLevelWidth();
+ GLsizei height = getBaseLevelHeight();
+ GLsizei depth = getLayers(0);
+
+ if (width <= 0 || height <= 0 || depth <= 0)
{
- return gl::error(GL_INVALID_OPERATION, (Renderbuffer *)NULL);
+ return false;
}
- unsigned int face = faceIndex(target);
+ if (!IsTextureFilteringSupported(getBaseLevelInternalFormat(), mRenderer))
+ {
+ if (samplerState.magFilter != GL_NEAREST ||
+ (samplerState.minFilter != GL_NEAREST && samplerState.minFilter != GL_NEAREST_MIPMAP_NEAREST))
+ {
+ return false;
+ }
+ }
- if (mFaceProxies[face] == NULL)
+ if (IsMipmapFiltered(samplerState) && !isMipmapComplete())
{
- mFaceProxies[face] = new Renderbuffer(mRenderer, id(), new RenderbufferTextureCubeMap(this, target));
+ return false;
}
- return mFaceProxies[face];
+ return true;
}
-rx::RenderTarget *TextureCubeMap::getRenderTarget(GLenum target)
+bool Texture2DArray::isMipmapComplete() const
{
- ASSERT(IsCubemapTextureTarget(target));
+ int levelCount = mipLevels();
+
+ for (int level = 1; level < levelCount; level++)
+ {
+ if (!isLevelComplete(level))
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool Texture2DArray::isLevelComplete(int level) const
+{
+ ASSERT(level >= 0 && level < (int)ArraySize(mImageArray));
+
+ if (isImmutable())
+ {
+ return true;
+ }
+
+ GLsizei width = getBaseLevelWidth();
+ GLsizei height = getBaseLevelHeight();
+ GLsizei layers = getLayers(0);
+ if (width <= 0 || height <= 0 || layers <= 0)
+ {
+ return false;
+ }
+
+ if (level == 0)
+ {
+ return true;
+ }
+
+ if (getInternalFormat(level) != getInternalFormat(0))
+ {
+ return false;
+ }
+
+ if (getWidth(level) != std::max(1, width >> level))
+ {
+ return false;
+ }
+
+ if (getHeight(level) != std::max(1, height >> level))
+ {
+ return false;
+ }
+
+ if (getLayers(level) != layers)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+FramebufferAttachment *Texture2DArray::getAttachment(GLint level, GLint layer)
+{
+ FramebufferAttachment *attachment = mRenderbufferProxies.get(level, layer);
+ if (!attachment)
+ {
+ attachment = new FramebufferAttachment(mRenderer, id(), new Texture2DArrayAttachment(this, level, layer));
+ mRenderbufferProxies.add(level, 0, attachment);
+ }
+
+ return attachment;
+}
+
+unsigned int Texture2DArray::getRenderTargetSerial(GLint level, GLint layer)
+{
+ return (ensureRenderTarget() ? mTexStorage->getRenderTargetSerial(level, layer) : 0);
+}
+
+bool Texture2DArray::isValidLevel(int level) const
+{
+ return (mTexStorage ? (level >= 0 && level < mTexStorage->getLevelCount()) : 0);
+}
+
+void Texture2DArray::initializeStorage(bool renderTarget)
+{
+ // Only initialize the first time this texture is used as a render target or shader resource
+ if (mTexStorage)
+ {
+ return;
+ }
+
+ // do not attempt to create storage for nonexistant data
+ if (!isLevelComplete(0))
+ {
+ return;
+ }
+
+ bool createRenderTarget = (renderTarget || mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
+
+ setCompleteTexStorage(createCompleteStorage(createRenderTarget));
+ ASSERT(mTexStorage);
+
+ // flush image data to the storage
+ updateStorage();
+}
+
+rx::TextureStorageInterface2DArray *Texture2DArray::createCompleteStorage(bool renderTarget) const
+{
+ GLsizei width = getBaseLevelWidth();
+ GLsizei height = getBaseLevelHeight();
+ GLsizei depth = getLayers(0);
+
+ ASSERT(width > 0 && height > 0 && depth > 0);
+
+ // use existing storage level count, when previously specified by TexStorage*D
+ GLint levels = (mTexStorage ? mTexStorage->getLevelCount() : creationLevels(width, height, 1));
+
+ return new rx::TextureStorageInterface2DArray(mRenderer, getBaseLevelInternalFormat(), renderTarget, width, height, depth, levels);
+}
+
+void Texture2DArray::setCompleteTexStorage(rx::TextureStorageInterface2DArray *newCompleteTexStorage)
+{
+ SafeDelete(mTexStorage);
+ mTexStorage = newCompleteTexStorage;
+ mDirtyImages = true;
+
+ // We do not support managed 2D array storage, as managed storage is ES2/D3D9 only
+ ASSERT(!mTexStorage->isManaged());
+}
+
+void Texture2DArray::updateStorage()
+{
+ ASSERT(mTexStorage != NULL);
+ GLint storageLevels = mTexStorage->getLevelCount();
+ for (int level = 0; level < storageLevels; level++)
+ {
+ if (isLevelComplete(level))
+ {
+ updateStorageLevel(level);
+ }
+ }
+}
+
+void Texture2DArray::updateStorageLevel(int level)
+{
+ ASSERT(level >= 0 && level < (int)ArraySize(mLayerCounts));
+ ASSERT(isLevelComplete(level));
+
+ for (int layer = 0; layer < mLayerCounts[level]; layer++)
+ {
+ ASSERT(mImageArray[level] != NULL && mImageArray[level][layer] != NULL);
+ if (mImageArray[level][layer]->isDirty())
+ {
+ commitRect(level, 0, 0, layer, getWidth(level), getHeight(level));
+ }
+ }
+}
+
+bool Texture2DArray::ensureRenderTarget()
+{
+ initializeStorage(true);
+
+ if (getBaseLevelWidth() > 0 && getBaseLevelHeight() > 0 && getLayers(0) > 0)
+ {
+ ASSERT(mTexStorage);
+ if (!mTexStorage->isRenderTarget())
+ {
+ rx::TextureStorageInterface2DArray *newRenderTargetStorage = createCompleteStorage(true);
+
+ if (!mRenderer->copyToRenderTarget(newRenderTargetStorage, mTexStorage))
+ {
+ delete newRenderTargetStorage;
+ return gl::error(GL_OUT_OF_MEMORY, false);
+ }
+
+ setCompleteTexStorage(newRenderTargetStorage);
+ }
+ }
+
+ return (mTexStorage && mTexStorage->isRenderTarget());
+}
+
+rx::RenderTarget *Texture2DArray::getRenderTarget(GLint level, GLint layer)
+{
// ensure the underlying texture is created
- if (getStorage(true) == NULL)
+ if (!ensureRenderTarget())
{
return NULL;
}
- updateTexture();
-
- return mTexStorage->getRenderTarget(target);
+ updateStorageLevel(level);
+
+ // ensure this is NOT a depth texture
+ if (isDepth(level))
+ {
+ return NULL;
+ }
+
+ return mTexStorage->getRenderTarget(level, layer);
}
-int TextureCubeMap::levelCount()
+rx::RenderTarget *Texture2DArray::getDepthStencil(GLint level, GLint layer)
{
- return mTexStorage ? mTexStorage->levelCount() - getLodOffset() : 0;
+ // ensure the underlying texture is created
+ if (!ensureRenderTarget())
+ {
+ return NULL;
+ }
+
+ updateStorageLevel(level);
+
+ // ensure this is a depth texture
+ if (!isDepth(level))
+ {
+ return NULL;
+ }
+
+ return mTexStorage->getRenderTarget(level, layer);
}
-rx::TextureStorageInterface *TextureCubeMap::getStorage(bool renderTarget)
+void Texture2DArray::redefineImage(GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
{
- if (!mTexStorage || (renderTarget && !mTexStorage->isRenderTarget()))
+ // If there currently is a corresponding storage texture image, it has these parameters
+ const int storageWidth = std::max(1, getBaseLevelWidth() >> level);
+ const int storageHeight = std::max(1, getBaseLevelHeight() >> level);
+ const int storageDepth = getLayers(0);
+ const GLenum storageFormat = getBaseLevelInternalFormat();
+
+ for (int layer = 0; layer < mLayerCounts[level]; layer++)
{
- if (renderTarget)
+ delete mImageArray[level][layer];
+ }
+ delete[] mImageArray[level];
+ mImageArray[level] = NULL;
+ mLayerCounts[level] = depth;
+
+ if (depth > 0)
+ {
+ mImageArray[level] = new rx::Image*[depth]();
+
+ for (int layer = 0; layer < mLayerCounts[level]; layer++)
{
- convertToRenderTarget();
+ mImageArray[level][layer] = mRenderer->createImage();
+ mImageArray[level][layer]->redefine(mRenderer, GL_TEXTURE_2D_ARRAY, internalformat, width, height, 1, false);
}
- else
+ }
+
+ if (mTexStorage)
+ {
+ const int storageLevels = mTexStorage->getLevelCount();
+
+ if ((level >= storageLevels && storageLevels != 0) ||
+ width != storageWidth ||
+ height != storageHeight ||
+ depth != storageDepth ||
+ internalformat != storageFormat) // Discard mismatched storage
{
- createTexture();
+ for (int level = 0; level < IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+ {
+ for (int layer = 0; layer < mLayerCounts[level]; layer++)
+ {
+ mImageArray[level][layer]->markDirty();
+ }
+ }
+
+ delete mTexStorage;
+ mTexStorage = NULL;
+ mDirtyImages = true;
}
}
+}
- return mTexStorage;
+void Texture2DArray::commitRect(GLint level, GLint xoffset, GLint yoffset, GLint layerTarget, GLsizei width, GLsizei height)
+{
+ if (isValidLevel(level) && layerTarget < getLayers(level))
+ {
+ rx::Image *image = mImageArray[level][layerTarget];
+ if (image->copyToStorage(mTexStorage, level, xoffset, yoffset, layerTarget, width, height))
+ {
+ image->markClean();
+ }
+ }
}
}
diff --git a/chromium/third_party/angle/src/libGLESv2/Texture.h b/chromium/third_party/angle/src/libGLESv2/Texture.h
index 4f5fab28d01..84ca289877b 100644
--- a/chromium/third_party/angle/src/libGLESv2/Texture.h
+++ b/chromium/third_party/angle/src/libGLESv2/Texture.h
@@ -13,12 +13,13 @@
#include <vector>
-#define GL_APICALL
+#include <GLES3/gl3.h>
#include <GLES2/gl2.h>
#include "common/debug.h"
#include "common/RefCountObject.h"
#include "libGLESv2/angletypes.h"
+#include "libGLESv2/RenderbufferProxySet.h"
namespace egl
{
@@ -31,6 +32,8 @@ class Renderer;
class TextureStorageInterface;
class TextureStorageInterface2D;
class TextureStorageInterfaceCube;
+class TextureStorageInterface3D;
+class TextureStorageInterface2DArray;
class RenderTarget;
class Image;
}
@@ -38,81 +41,110 @@ class Image;
namespace gl
{
class Framebuffer;
-class Renderbuffer;
+class FramebufferAttachment;
enum
{
// These are the maximums the implementation can support
// The actual GL caps are limited by the device caps
// and should be queried from the Context
- IMPLEMENTATION_MAX_TEXTURE_SIZE = 16384,
+ IMPLEMENTATION_MAX_2D_TEXTURE_SIZE = 16384,
IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE = 16384,
+ IMPLEMENTATION_MAX_3D_TEXTURE_SIZE = 2048,
+ IMPLEMENTATION_MAX_2D_ARRAY_TEXTURE_LAYERS = 2048,
IMPLEMENTATION_MAX_TEXTURE_LEVELS = 15 // 1+log2 of MAX_TEXTURE_SIZE
};
+bool IsMipmapFiltered(const SamplerState &samplerState);
+
class Texture : public RefCountObject
{
public:
- Texture(rx::Renderer *renderer, GLuint id);
+ Texture(rx::Renderer *renderer, GLuint id, GLenum target);
virtual ~Texture();
- virtual void addProxyRef(const Renderbuffer *proxy) = 0;
- virtual void releaseProxy(const Renderbuffer *proxy) = 0;
-
- virtual GLenum getTarget() const = 0;
-
- bool setMinFilter(GLenum filter);
- bool setMagFilter(GLenum filter);
- bool setWrapS(GLenum wrap);
- bool setWrapT(GLenum wrap);
- bool setMaxAnisotropy(float textureMaxAnisotropy, float contextMaxAnisotropy);
- bool setUsage(GLenum usage);
+ void addProxyRef(const FramebufferAttachment *proxy);
+ void releaseProxy(const FramebufferAttachment *proxy);
+
+ GLenum getTarget() const;
+
+ void setMinFilter(GLenum filter);
+ void setMagFilter(GLenum filter);
+ void setWrapS(GLenum wrap);
+ void setWrapT(GLenum wrap);
+ void setWrapR(GLenum wrap);
+ void setMaxAnisotropy(float textureMaxAnisotropy, float contextMaxAnisotropy);
+ void setCompareMode(GLenum mode);
+ void setCompareFunc(GLenum func);
+ void setSwizzleRed(GLenum swizzle);
+ void setSwizzleGreen(GLenum swizzle);
+ void setSwizzleBlue(GLenum swizzle);
+ void setSwizzleAlpha(GLenum swizzle);
+ void setBaseLevel(GLint baseLevel);
+ void setMaxLevel(GLint maxLevel);
+ void setMinLod(GLfloat minLod);
+ void setMaxLod(GLfloat maxLod);
+ void setUsage(GLenum usage);
GLenum getMinFilter() const;
GLenum getMagFilter() const;
GLenum getWrapS() const;
GLenum getWrapT() const;
+ GLenum getWrapR() const;
float getMaxAnisotropy() const;
- int getLodOffset();
+ GLenum getSwizzleRed() const;
+ GLenum getSwizzleGreen() const;
+ GLenum getSwizzleBlue() const;
+ GLenum getSwizzleAlpha() const;
+ GLint getBaseLevel() const;
+ GLint getMaxLevel() const;
+ GLfloat getMinLod() const;
+ GLfloat getMaxLod() const;
+ bool isSwizzled() const;
void getSamplerState(SamplerState *sampler);
GLenum getUsage() const;
- bool isMipmapFiltered() const;
- virtual bool isSamplerComplete() const = 0;
+ GLint getBaseLevelWidth() const;
+ GLint getBaseLevelHeight() const;
+ GLint getBaseLevelDepth() const;
+ GLenum getBaseLevelInternalFormat() const;
+
+ virtual bool isSamplerComplete(const SamplerState &samplerState) const = 0;
rx::TextureStorageInterface *getNativeTexture();
- virtual Renderbuffer *getRenderbuffer(GLenum target) = 0;
virtual void generateMipmaps() = 0;
- virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source) = 0;
+ virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source) = 0;
bool hasDirtyParameters() const;
bool hasDirtyImages() const;
void resetDirty();
unsigned int getTextureSerial();
- unsigned int getRenderTargetSerial(GLenum target);
bool isImmutable() const;
+ int immutableLevelCount();
static const GLuint INCOMPLETE_TEXTURE_ID = static_cast<GLuint>(-1); // Every texture takes an id at creation time. The value is arbitrary because it is never registered with the resource manager.
protected:
- void setImage(GLint unpackAlignment, const void *pixels, rx::Image *image);
- bool subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, rx::Image *image);
+ void setImage(const PixelUnpackState &unpack, GLenum type, const void *pixels, rx::Image *image);
+ bool subImage(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
+ GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels, rx::Image *image);
void setCompressedImage(GLsizei imageSize, const void *pixels, rx::Image *image);
- bool subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels, rx::Image *image);
-
- GLint creationLevels(GLsizei width, GLsizei height) const;
- GLint creationLevels(GLsizei size) const;
+ bool subImageCompressed(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
+ GLenum format, GLsizei imageSize, const void *pixels, rx::Image *image);
+ bool isFastUnpackable(const PixelUnpackState &unpack, GLenum sizedInternalFormat);
+ bool fastUnpackPixels(const PixelUnpackState &unpack, const void *pixels, const Box &destArea,
+ GLenum sizedInternalFormat, GLenum type, rx::RenderTarget *destRenderTarget);
- virtual void createTexture() = 0;
- virtual void updateTexture() = 0;
- virtual void convertToRenderTarget() = 0;
- virtual rx::RenderTarget *getRenderTarget(GLenum target) = 0;
+ GLint creationLevels(GLsizei width, GLsizei height, GLsizei depth) const;
+ int mipLevels() const;
- virtual int levelCount() = 0;
+ virtual void initializeStorage(bool renderTarget) = 0;
+ virtual void updateStorage() = 0;
+ virtual bool ensureRenderTarget() = 0;
rx::Renderer *mRenderer;
@@ -123,10 +155,20 @@ class Texture : public RefCountObject
bool mImmutable;
+ GLenum mTarget;
+
+ // A specific internal reference count is kept for colorbuffer proxy references,
+ // because, as the renderbuffer acting as proxy will maintain a binding pointer
+ // back to this texture, there would be a circular reference if we used a binding
+ // pointer here. This reference count will cause the pointer to be set to NULL if
+ // the count drops to zero, but will not cause deletion of the FramebufferAttachment.
+ RenderbufferProxySet mRenderbufferProxies;
+
private:
DISALLOW_COPY_AND_ASSIGN(Texture);
- virtual rx::TextureStorageInterface *getStorage(bool renderTarget) = 0;
+ virtual rx::TextureStorageInterface *getBaseLevelStorage() = 0;
+ virtual const rx::Image *getBaseLevelImage() const = 0;
};
class Texture2D : public Texture
@@ -136,11 +178,6 @@ class Texture2D : public Texture
~Texture2D();
- void addProxyRef(const Renderbuffer *proxy);
- void releaseProxy(const Renderbuffer *proxy);
-
- virtual GLenum getTarget() const;
-
GLsizei getWidth(GLint level) const;
GLsizei getHeight(GLint level) const;
GLenum getInternalFormat(GLint level) const;
@@ -148,53 +185,52 @@ class Texture2D : public Texture
bool isCompressed(GLint level) const;
bool isDepth(GLint level) const;
- void setImage(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
+ void setImage(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
void setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels);
- void subImage(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
+ void subImage(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
void subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels);
void copyImage(GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);
- virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);
+ virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);
void storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
- virtual bool isSamplerComplete() const;
+ virtual bool isSamplerComplete(const SamplerState &samplerState) const;
virtual void bindTexImage(egl::Surface *surface);
virtual void releaseTexImage();
virtual void generateMipmaps();
- virtual Renderbuffer *getRenderbuffer(GLenum target);
+ FramebufferAttachment *getAttachment(GLint level);
+ unsigned int getRenderTargetSerial(GLint level);
protected:
- friend class RenderbufferTexture2D;
- virtual rx::RenderTarget *getRenderTarget(GLenum target);
- virtual rx::RenderTarget *getDepthStencil(GLenum target);
- virtual int levelCount();
+ friend class Texture2DAttachment;
+ rx::RenderTarget *getRenderTarget(GLint level);
+ rx::RenderTarget *getDepthSencil(GLint level);
private:
DISALLOW_COPY_AND_ASSIGN(Texture2D);
- virtual void createTexture();
- virtual void updateTexture();
- virtual void convertToRenderTarget();
- virtual rx::TextureStorageInterface *getStorage(bool renderTarget);
+ virtual void initializeStorage(bool renderTarget);
+ rx::TextureStorageInterface2D *createCompleteStorage(bool renderTarget) const;
+ void setCompleteTexStorage(rx::TextureStorageInterface2D *newCompleteTexStorage);
+
+ virtual void updateStorage();
+ virtual bool ensureRenderTarget();
+ virtual rx::TextureStorageInterface *getBaseLevelStorage();
+ virtual const rx::Image *getBaseLevelImage() const;
bool isMipmapComplete() const;
+ bool isValidLevel(int level) const;
+ bool isLevelComplete(int level) const;
+ void updateStorageLevel(int level);
- void redefineImage(GLint level, GLint internalformat, GLsizei width, GLsizei height);
+ void redefineImage(GLint level, GLenum internalformat, GLsizei width, GLsizei height);
void commitRect(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
rx::Image *mImageArray[IMPLEMENTATION_MAX_TEXTURE_LEVELS];
rx::TextureStorageInterface2D *mTexStorage;
egl::Surface *mSurface;
-
- // A specific internal reference count is kept for colorbuffer proxy references,
- // because, as the renderbuffer acting as proxy will maintain a binding pointer
- // back to this texture, there would be a circular reference if we used a binding
- // pointer here. This reference count will cause the pointer to be set to NULL if
- // the count drops to zero, but will not cause deletion of the Renderbuffer.
- Renderbuffer *mColorbufferProxy;
- unsigned int mProxyRefs;
};
class TextureCubeMap : public Texture
@@ -204,72 +240,196 @@ class TextureCubeMap : public Texture
~TextureCubeMap();
- void addProxyRef(const Renderbuffer *proxy);
- void releaseProxy(const Renderbuffer *proxy);
-
- virtual GLenum getTarget() const;
-
GLsizei getWidth(GLenum target, GLint level) const;
GLsizei getHeight(GLenum target, GLint level) const;
GLenum getInternalFormat(GLenum target, GLint level) const;
GLenum getActualFormat(GLenum target, GLint level) const;
bool isCompressed(GLenum target, GLint level) const;
+ bool isDepth(GLenum target, GLint level) const;
- void setImagePosX(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
- void setImageNegX(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
- void setImagePosY(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
- void setImageNegY(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
- void setImagePosZ(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
- void setImageNegZ(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
+ void setImagePosX(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
+ void setImageNegX(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
+ void setImagePosY(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
+ void setImageNegY(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
+ void setImagePosZ(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
+ void setImageNegZ(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
- void setCompressedImage(GLenum face, GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels);
+ void setCompressedImage(GLenum target, GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels);
- void subImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
+ void subImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
void subImageCompressed(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels);
void copyImage(GLenum target, GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);
- virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);
+ virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);
void storage(GLsizei levels, GLenum internalformat, GLsizei size);
- virtual bool isSamplerComplete() const;
+ virtual bool isSamplerComplete(const SamplerState &samplerState) const;
+ bool isCubeComplete() const;
virtual void generateMipmaps();
- virtual Renderbuffer *getRenderbuffer(GLenum target);
+ FramebufferAttachment *getAttachment(GLenum target, GLint level);
+ unsigned int getRenderTargetSerial(GLenum target, GLint level);
- static unsigned int faceIndex(GLenum face);
+ static int targetToIndex(GLenum target);
protected:
- friend class RenderbufferTextureCubeMap;
- virtual rx::RenderTarget *getRenderTarget(GLenum target);
- virtual int levelCount();
+ friend class TextureCubeMapAttachment;
+ rx::RenderTarget *getRenderTarget(GLenum target, GLint level);
+ rx::RenderTarget *getDepthStencil(GLenum target, GLint level);
private:
DISALLOW_COPY_AND_ASSIGN(TextureCubeMap);
- virtual void createTexture();
- virtual void updateTexture();
- virtual void convertToRenderTarget();
- virtual rx::TextureStorageInterface *getStorage(bool renderTarget);
+ virtual void initializeStorage(bool renderTarget);
+ rx::TextureStorageInterfaceCube *createCompleteStorage(bool renderTarget) const;
+ void setCompleteTexStorage(rx::TextureStorageInterfaceCube *newCompleteTexStorage);
+
+ virtual void updateStorage();
+ virtual bool ensureRenderTarget();
+ virtual rx::TextureStorageInterface *getBaseLevelStorage();
+ virtual const rx::Image *getBaseLevelImage() const;
- bool isCubeComplete() const;
bool isMipmapCubeComplete() const;
+ bool isValidFaceLevel(int faceIndex, int level) const;
+ bool isFaceLevelComplete(int faceIndex, int level) const;
+ void updateStorageFaceLevel(int faceIndex, int level);
- void setImage(int faceIndex, GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
+ void setImage(int faceIndex, GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
void commitRect(int faceIndex, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
- void redefineImage(int faceIndex, GLint level, GLint internalformat, GLsizei width, GLsizei height);
+ void redefineImage(int faceIndex, GLint level, GLenum internalformat, GLsizei width, GLsizei height);
rx::Image *mImageArray[6][IMPLEMENTATION_MAX_TEXTURE_LEVELS];
rx::TextureStorageInterfaceCube *mTexStorage;
+};
- // A specific internal reference count is kept for colorbuffer proxy references,
- // because, as the renderbuffer acting as proxy will maintain a binding pointer
- // back to this texture, there would be a circular reference if we used a binding
- // pointer here. This reference count will cause the pointer to be set to NULL if
- // the count drops to zero, but will not cause deletion of the Renderbuffer.
- Renderbuffer *mFaceProxies[6];
- unsigned int *mFaceProxyRefs[6];
+class Texture3D : public Texture
+{
+ public:
+ Texture3D(rx::Renderer *renderer, GLuint id);
+
+ ~Texture3D();
+
+ GLsizei getWidth(GLint level) const;
+ GLsizei getHeight(GLint level) const;
+ GLsizei getDepth(GLint level) const;
+ GLenum getInternalFormat(GLint level) const;
+ GLenum getActualFormat(GLint level) const;
+ bool isCompressed(GLint level) const;
+ bool isDepth(GLint level) const;
+
+ void setImage(GLint level, GLsizei width, GLsizei height, GLsizei depth, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
+ void setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei depth, GLsizei imageSize, const void *pixels);
+ void subImage(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
+ void subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *pixels);
+ void storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+
+ virtual void generateMipmaps();
+ virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);
+
+ virtual bool isSamplerComplete(const SamplerState &samplerState) const;
+ virtual bool isMipmapComplete() const;
+
+ FramebufferAttachment *getAttachment(GLint level, GLint layer);
+ unsigned int getRenderTargetSerial(GLint level, GLint layer);
+
+ protected:
+ friend class Texture3DAttachment;
+ rx::RenderTarget *getRenderTarget(GLint level);
+ rx::RenderTarget *getRenderTarget(GLint level, GLint layer);
+ rx::RenderTarget *getDepthStencil(GLint level, GLint layer);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Texture3D);
+
+ virtual void initializeStorage(bool renderTarget);
+ rx::TextureStorageInterface3D *createCompleteStorage(bool renderTarget) const;
+ void setCompleteTexStorage(rx::TextureStorageInterface3D *newCompleteTexStorage);
+
+ virtual void updateStorage();
+ virtual bool ensureRenderTarget();
+
+ virtual rx::TextureStorageInterface *getBaseLevelStorage();
+ virtual const rx::Image *getBaseLevelImage() const;
+
+ void redefineImage(GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+ void commitRect(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);
+
+ bool isValidLevel(int level) const;
+ bool isLevelComplete(int level) const;
+ void updateStorageLevel(int level);
+
+ rx::Image *mImageArray[IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+
+ rx::TextureStorageInterface3D *mTexStorage;
+};
+
+class Texture2DArray : public Texture
+{
+ public:
+ Texture2DArray(rx::Renderer *renderer, GLuint id);
+
+ ~Texture2DArray();
+
+ GLsizei getWidth(GLint level) const;
+ GLsizei getHeight(GLint level) const;
+ GLsizei getLayers(GLint level) const;
+ GLenum getInternalFormat(GLint level) const;
+ GLenum getActualFormat(GLint level) const;
+ bool isCompressed(GLint level) const;
+ bool isDepth(GLint level) const;
+
+ void setImage(GLint level, GLsizei width, GLsizei height, GLsizei depth, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
+ void setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei depth, GLsizei imageSize, const void *pixels);
+ void subImage(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
+ void subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *pixels);
+ void storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+
+ virtual void generateMipmaps();
+ virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);
+
+ virtual bool isSamplerComplete(const SamplerState &samplerState) const;
+ virtual bool isMipmapComplete() const;
+
+ FramebufferAttachment *getAttachment(GLint level, GLint layer);
+ unsigned int getRenderTargetSerial(GLint level, GLint layer);
+
+ protected:
+ friend class Texture2DArrayAttachment;
+ rx::RenderTarget *getRenderTarget(GLint level, GLint layer);
+ rx::RenderTarget *getDepthStencil(GLint level, GLint layer);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Texture2DArray);
+
+ virtual void initializeStorage(bool renderTarget);
+ rx::TextureStorageInterface2DArray *createCompleteStorage(bool renderTarget) const;
+ void setCompleteTexStorage(rx::TextureStorageInterface2DArray *newCompleteTexStorage);
+
+ virtual void updateStorage();
+ virtual bool ensureRenderTarget();
+
+ virtual rx::TextureStorageInterface *getBaseLevelStorage();
+ virtual const rx::Image *getBaseLevelImage() const;
+
+ void deleteImages();
+ void redefineImage(GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+ void commitRect(GLint level, GLint xoffset, GLint yoffset, GLint layerTarget, GLsizei width, GLsizei height);
+
+ bool isValidLevel(int level) const;
+ bool isLevelComplete(int level) const;
+ void updateStorageLevel(int level);
+
+ // Storing images as an array of single depth textures since D3D11 treats each array level of a
+ // Texture2D object as a separate subresource. Each layer would have to be looped over
+ // to update all the texture layers since they cannot all be updated at once and it makes the most
+ // sense for the Image class to not have to worry about layer subresource as well as mip subresources.
+ GLsizei mLayerCounts[IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+ rx::Image **mImageArray[IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+
+ rx::TextureStorageInterface2DArray *mTexStorage;
};
+
}
#endif // LIBGLESV2_TEXTURE_H_
diff --git a/chromium/third_party/angle/src/libGLESv2/TransformFeedback.cpp b/chromium/third_party/angle/src/libGLESv2/TransformFeedback.cpp
new file mode 100644
index 00000000000..79ce08405d1
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/TransformFeedback.cpp
@@ -0,0 +1,63 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "libGLESv2/TransformFeedback.h"
+
+namespace gl
+{
+
+TransformFeedback::TransformFeedback(GLuint id)
+ : RefCountObject(id),
+ mStarted(GL_FALSE),
+ mPrimitiveMode(GL_NONE),
+ mPaused(GL_FALSE)
+{
+}
+
+TransformFeedback::~TransformFeedback()
+{
+}
+
+void TransformFeedback::start(GLenum primitiveMode)
+{
+ mStarted = GL_TRUE;
+ mPrimitiveMode = primitiveMode;
+ mPaused = GL_FALSE;
+}
+
+void TransformFeedback::stop()
+{
+ mStarted = GL_FALSE;
+ mPrimitiveMode = GL_NONE;
+ mPaused = GL_FALSE;
+}
+
+GLboolean TransformFeedback::isStarted() const
+{
+ return mStarted;
+}
+
+GLenum TransformFeedback::getDrawMode() const
+{
+ return mPrimitiveMode;
+}
+
+void TransformFeedback::pause()
+{
+ mPaused = GL_TRUE;
+}
+
+void TransformFeedback::resume()
+{
+ mPaused = GL_FALSE;
+}
+
+GLboolean TransformFeedback::isPaused() const
+{
+ return mPaused;
+}
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/TransformFeedback.h b/chromium/third_party/angle/src/libGLESv2/TransformFeedback.h
new file mode 100644
index 00000000000..183873c82ff
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/TransformFeedback.h
@@ -0,0 +1,45 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef LIBGLESV2_TRANSFORM_FEEDBACK_H_
+#define LIBGLESV2_TRANSFORM_FEEDBACK_H_
+
+#include "common/angleutils.h"
+#include "common/RefCountObject.h"
+
+#include <GLES3/gl3.h>
+#include <GLES2/gl2.h>
+
+namespace gl
+{
+
+class TransformFeedback : public RefCountObject
+{
+ public:
+ explicit TransformFeedback(GLuint id);
+ virtual ~TransformFeedback();
+
+ void start(GLenum primitiveMode);
+ void stop();
+ GLboolean isStarted() const;
+
+ GLenum getDrawMode() const;
+
+ void pause();
+ void resume();
+ GLboolean isPaused() const;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TransformFeedback);
+
+ GLboolean mStarted;
+ GLenum mPrimitiveMode;
+ GLboolean mPaused;
+};
+
+}
+
+#endif // LIBGLESV2_TRANSFORM_FEEDBACK_H_
diff --git a/chromium/third_party/angle/src/libGLESv2/Uniform.cpp b/chromium/third_party/angle/src/libGLESv2/Uniform.cpp
index 5424e271b5c..a5ab7cb517d 100644
--- a/chromium/third_party/angle/src/libGLESv2/Uniform.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/Uniform.cpp
@@ -7,37 +7,100 @@
#include "libGLESv2/Uniform.h"
-#include "libGLESv2/utilities.h"
+#include "common/utilities.h"
namespace gl
{
-Uniform::Uniform(GLenum type, GLenum precision, const std::string &name, unsigned int arraySize)
- : type(type), precision(precision), name(name), arraySize(arraySize)
+LinkedUniform::LinkedUniform(GLenum type, GLenum precision, const std::string &name, unsigned int arraySize,
+ const int blockIndex, const BlockMemberInfo &blockInfo)
+ : type(type),
+ precision(precision),
+ name(name),
+ arraySize(arraySize),
+ blockIndex(blockIndex),
+ blockInfo(blockInfo),
+ data(NULL),
+ dirty(true),
+ psRegisterIndex(GL_INVALID_INDEX),
+ vsRegisterIndex(GL_INVALID_INDEX),
+ registerCount(0),
+ registerElement(0)
{
- int bytes = gl::UniformInternalSize(type) * elementCount();
- data = new unsigned char[bytes];
- memset(data, 0, bytes);
- dirty = true;
-
- psRegisterIndex = -1;
- vsRegisterIndex = -1;
- registerCount = VariableRowCount(type) * elementCount();
+ // We use data storage for default block uniforms to cache values that are sent to D3D during rendering
+ // Uniform blocks/buffers are treated separately by the Renderer (ES3 path only)
+ if (isInDefaultBlock())
+ {
+ size_t bytes = dataSize();
+ data = new unsigned char[bytes];
+ memset(data, 0, bytes);
+ registerCount = VariableRowCount(type) * elementCount();
+ }
}
-Uniform::~Uniform()
+LinkedUniform::~LinkedUniform()
{
delete[] data;
}
-bool Uniform::isArray() const
+bool LinkedUniform::isArray() const
{
return arraySize > 0;
}
-unsigned int Uniform::elementCount() const
+unsigned int LinkedUniform::elementCount() const
{
return arraySize > 0 ? arraySize : 1;
}
+bool LinkedUniform::isReferencedByVertexShader() const
+{
+ return vsRegisterIndex != GL_INVALID_INDEX;
+}
+
+bool LinkedUniform::isReferencedByFragmentShader() const
+{
+ return psRegisterIndex != GL_INVALID_INDEX;
+}
+
+bool LinkedUniform::isInDefaultBlock() const
+{
+ return blockIndex == -1;
+}
+
+size_t LinkedUniform::dataSize() const
+{
+ ASSERT(type != GL_STRUCT_ANGLEX);
+ return UniformInternalSize(type) * elementCount();
+}
+
+bool LinkedUniform::isSampler() const
+{
+ return IsSampler(type);
+}
+
+UniformBlock::UniformBlock(const std::string &name, unsigned int elementIndex, unsigned int dataSize)
+ : name(name),
+ elementIndex(elementIndex),
+ dataSize(dataSize),
+ psRegisterIndex(GL_INVALID_INDEX),
+ vsRegisterIndex(GL_INVALID_INDEX)
+{
+}
+
+bool UniformBlock::isArrayElement() const
+{
+ return elementIndex != GL_INVALID_INDEX;
+}
+
+bool UniformBlock::isReferencedByVertexShader() const
+{
+ return vsRegisterIndex != GL_INVALID_INDEX;
+}
+
+bool UniformBlock::isReferencedByFragmentShader() const
+{
+ return psRegisterIndex != GL_INVALID_INDEX;
+}
+
}
diff --git a/chromium/third_party/angle/src/libGLESv2/Uniform.h b/chromium/third_party/angle/src/libGLESv2/Uniform.h
index 8ab0fbe2341..221ba48f949 100644
--- a/chromium/third_party/angle/src/libGLESv2/Uniform.h
+++ b/chromium/third_party/angle/src/libGLESv2/Uniform.h
@@ -10,38 +10,69 @@
#include <string>
#include <vector>
-#define GL_APICALL
+#include <GLES3/gl3.h>
#include <GLES2/gl2.h>
#include "common/debug.h"
+#include "angletypes.h"
+#include "common/shadervars.h"
namespace gl
{
// Helper struct representing a single shader uniform
-struct Uniform
+struct LinkedUniform
{
- Uniform(GLenum type, GLenum precision, const std::string &name, unsigned int arraySize);
+ LinkedUniform(GLenum type, GLenum precision, const std::string &name, unsigned int arraySize, const int blockIndex, const BlockMemberInfo &blockInfo);
- ~Uniform();
+ ~LinkedUniform();
bool isArray() const;
unsigned int elementCount() const;
+ bool isReferencedByVertexShader() const;
+ bool isReferencedByFragmentShader() const;
+ bool isInDefaultBlock() const;
+ size_t dataSize() const;
+ bool isSampler() const;
const GLenum type;
const GLenum precision;
const std::string name;
const unsigned int arraySize;
+ const int blockIndex;
+ const BlockMemberInfo blockInfo;
unsigned char *data;
bool dirty;
- int psRegisterIndex;
- int vsRegisterIndex;
+ unsigned int psRegisterIndex;
+ unsigned int vsRegisterIndex;
unsigned int registerCount;
+
+ // Register "elements" are used for uniform structs in ES3, to appropriately identify single uniforms
+ // inside aggregate types, which are packed according C-like structure rules.
+ unsigned int registerElement;
};
-typedef std::vector<Uniform*> UniformArray;
+// Helper struct representing a single shader uniform block
+struct UniformBlock
+{
+ // use GL_INVALID_INDEX for non-array elements
+ UniformBlock(const std::string &name, unsigned int elementIndex, unsigned int dataSize);
+
+ bool isArrayElement() const;
+ bool isReferencedByVertexShader() const;
+ bool isReferencedByFragmentShader() const;
+
+ const std::string name;
+ const unsigned int elementIndex;
+ const unsigned int dataSize;
+
+ std::vector<unsigned int> memberUniformIndexes;
+
+ unsigned int psRegisterIndex;
+ unsigned int vsRegisterIndex;
+};
}
diff --git a/chromium/third_party/angle/src/libGLESv2/VertexArray.cpp b/chromium/third_party/angle/src/libGLESv2/VertexArray.cpp
new file mode 100644
index 00000000000..bd2df391695
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/VertexArray.cpp
@@ -0,0 +1,71 @@
+#include "precompiled.h"
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Implementation of the state class for mananging GLES 3 Vertex Array Objects.
+//
+
+#include "libGLESv2/VertexArray.h"
+#include "libGLESv2/Buffer.h"
+
+namespace gl
+{
+
+VertexArray::VertexArray(rx::Renderer *renderer, GLuint id)
+ : RefCountObject(id)
+{
+}
+
+VertexArray::~VertexArray()
+{
+ for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
+ {
+ mVertexAttributes[i].mBoundBuffer.set(NULL);
+ }
+ mElementArrayBuffer.set(NULL);
+}
+
+void VertexArray::detachBuffer(GLuint bufferName)
+{
+ for (int attribute = 0; attribute < MAX_VERTEX_ATTRIBS; attribute++)
+ {
+ if (mVertexAttributes[attribute].mBoundBuffer.id() == bufferName)
+ {
+ mVertexAttributes[attribute].mBoundBuffer.set(NULL);
+ }
+ }
+
+ if (mElementArrayBuffer.id() == bufferName)
+ {
+ mElementArrayBuffer.set(NULL);
+ }
+}
+
+const VertexAttribute& VertexArray::getVertexAttribute(unsigned int attributeIndex) const
+{
+ ASSERT(attributeIndex < MAX_VERTEX_ATTRIBS);
+ return mVertexAttributes[attributeIndex];
+}
+
+void VertexArray::setVertexAttribDivisor(GLuint index, GLuint divisor)
+{
+ ASSERT(index < gl::MAX_VERTEX_ATTRIBS);
+ mVertexAttributes[index].mDivisor = divisor;
+}
+
+void VertexArray::enableAttribute(unsigned int attributeIndex, bool enabledState)
+{
+ ASSERT(attributeIndex < gl::MAX_VERTEX_ATTRIBS);
+ mVertexAttributes[attributeIndex].mArrayEnabled = enabledState;
+}
+
+void VertexArray::setAttributeState(unsigned int attributeIndex, gl::Buffer *boundBuffer, GLint size, GLenum type,
+ bool normalized, bool pureInteger, GLsizei stride, const void *pointer)
+{
+ ASSERT(attributeIndex < gl::MAX_VERTEX_ATTRIBS);
+ mVertexAttributes[attributeIndex].setState(boundBuffer, size, type, normalized, pureInteger, stride, pointer);
+}
+
+} \ No newline at end of file
diff --git a/chromium/third_party/angle/src/libGLESv2/VertexArray.h b/chromium/third_party/angle/src/libGLESv2/VertexArray.h
new file mode 100644
index 00000000000..ecfe7ad8f91
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/VertexArray.h
@@ -0,0 +1,54 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// This class contains prototypes for representing GLES 3 Vertex Array Objects:
+//
+// The buffer objects that are to be used by the vertex stage of the GL are collected
+// together to form a vertex array object. All state related to the definition of data used
+// by the vertex processor is encapsulated in a vertex array object.
+//
+
+#ifndef LIBGLESV2_VERTEXARRAY_H_
+#define LIBGLESV2_VERTEXARRAY_H_
+
+#include "common/RefCountObject.h"
+#include "libGLESv2/constants.h"
+#include "libGLESv2/VertexAttribute.h"
+
+namespace rx
+{
+class Renderer;
+}
+
+namespace gl
+{
+class Buffer;
+
+class VertexArray : public RefCountObject
+{
+ public:
+ VertexArray(rx::Renderer *renderer, GLuint id);
+ ~VertexArray();
+
+ const VertexAttribute& getVertexAttribute(unsigned int attributeIndex) const;
+ void detachBuffer(GLuint bufferName);
+ void setVertexAttribDivisor(GLuint index, GLuint divisor);
+ void enableAttribute(unsigned int attributeIndex, bool enabledState);
+ void setAttributeState(unsigned int attributeIndex, gl::Buffer *boundBuffer, GLint size, GLenum type,
+ bool normalized, bool pureInteger, GLsizei stride, const void *pointer);
+
+ const VertexAttribute* getVertexAttributes() const { return mVertexAttributes; }
+ Buffer *getElementArrayBuffer() const { return mElementArrayBuffer.get(); }
+ void setElementArrayBuffer(Buffer *elementArrayBuffer) { mElementArrayBuffer.set(elementArrayBuffer); }
+ GLuint getElementArrayBufferId() const { return mElementArrayBuffer.id(); }
+
+ private:
+ VertexAttribute mVertexAttributes[MAX_VERTEX_ATTRIBS];
+ BindingPointer<Buffer> mElementArrayBuffer;
+};
+
+}
+
+#endif // LIBGLESV2_VERTEXARRAY_H_
diff --git a/chromium/third_party/angle/src/libGLESv2/VertexAttribute.h b/chromium/third_party/angle/src/libGLESv2/VertexAttribute.h
new file mode 100644
index 00000000000..e9364d66e83
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/VertexAttribute.h
@@ -0,0 +1,156 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Helper structure describing a single vertex attribute
+//
+
+#ifndef LIBGLESV2_VERTEXATTRIBUTE_H_
+#define LIBGLESV2_VERTEXATTRIBUTE_H_
+
+#include "libGLESv2/Buffer.h"
+
+namespace gl
+{
+
+class VertexAttribute
+{
+ public:
+ VertexAttribute() : mType(GL_FLOAT), mSize(4), mNormalized(false), mPureInteger(false),
+ mStride(0), mPointer(NULL), mArrayEnabled(false), mDivisor(0)
+ {
+ }
+
+ int typeSize() const
+ {
+ switch (mType)
+ {
+ case GL_BYTE: return mSize * sizeof(GLbyte);
+ case GL_UNSIGNED_BYTE: return mSize * sizeof(GLubyte);
+ case GL_SHORT: return mSize * sizeof(GLshort);
+ case GL_UNSIGNED_SHORT: return mSize * sizeof(GLushort);
+ case GL_INT: return mSize * sizeof(GLint);
+ case GL_UNSIGNED_INT: return mSize * sizeof(GLuint);
+ case GL_INT_2_10_10_10_REV: return 4;
+ case GL_UNSIGNED_INT_2_10_10_10_REV: return 4;
+ case GL_FIXED: return mSize * sizeof(GLfixed);
+ case GL_HALF_FLOAT: return mSize * sizeof(GLhalf);
+ case GL_FLOAT: return mSize * sizeof(GLfloat);
+ default: UNREACHABLE(); return mSize * sizeof(GLfloat);
+ }
+ }
+
+ GLsizei stride() const
+ {
+ return (mArrayEnabled ? (mStride ? mStride : typeSize()) : 16);
+ }
+
+ void setState(gl::Buffer *boundBuffer, GLint size, GLenum type, bool normalized,
+ bool pureInteger, GLsizei stride, const void *pointer)
+ {
+ mBoundBuffer.set(boundBuffer);
+ mSize = size;
+ mType = type;
+ mNormalized = normalized;
+ mPureInteger = pureInteger;
+ mStride = stride;
+ mPointer = pointer;
+ }
+
+ template <typename T>
+ T querySingleParameter(GLenum pname) const
+ {
+ switch (pname)
+ {
+ case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
+ return static_cast<T>(mArrayEnabled ? GL_TRUE : GL_FALSE);
+ case GL_VERTEX_ATTRIB_ARRAY_SIZE:
+ return static_cast<T>(mSize);
+ case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
+ return static_cast<T>(mStride);
+ case GL_VERTEX_ATTRIB_ARRAY_TYPE:
+ return static_cast<T>(mType);
+ case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
+ return static_cast<T>(mNormalized ? GL_TRUE : GL_FALSE);
+ case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
+ return static_cast<T>(mBoundBuffer.id());
+ case GL_VERTEX_ATTRIB_ARRAY_DIVISOR:
+ return static_cast<T>(mDivisor);
+ case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
+ return static_cast<T>(mPureInteger ? GL_TRUE : GL_FALSE);
+ default:
+ UNREACHABLE();
+ return static_cast<T>(0);
+ }
+ }
+
+ // From glVertexAttribPointer
+ GLenum mType;
+ GLint mSize;
+ bool mNormalized;
+ bool mPureInteger;
+ GLsizei mStride; // 0 means natural stride
+
+ union
+ {
+ const void *mPointer;
+ intptr_t mOffset;
+ };
+
+ BindingPointer<Buffer> mBoundBuffer; // Captured when glVertexAttribPointer is called.
+ bool mArrayEnabled; // From glEnable/DisableVertexAttribArray
+ unsigned int mDivisor;
+};
+
+struct VertexAttribCurrentValueData
+{
+ union
+ {
+ GLfloat FloatValues[4];
+ GLint IntValues[4];
+ GLuint UnsignedIntValues[4];
+ };
+ GLenum Type;
+
+ void setFloatValues(const GLfloat floatValues[4])
+ {
+ for (unsigned int valueIndex = 0; valueIndex < 4; valueIndex++)
+ {
+ FloatValues[valueIndex] = floatValues[valueIndex];
+ }
+ Type = GL_FLOAT;
+ }
+
+ void setIntValues(const GLint intValues[4])
+ {
+ for (unsigned int valueIndex = 0; valueIndex < 4; valueIndex++)
+ {
+ IntValues[valueIndex] = intValues[valueIndex];
+ }
+ Type = GL_INT;
+ }
+
+ void setUnsignedIntValues(const GLuint unsignedIntValues[4])
+ {
+ for (unsigned int valueIndex = 0; valueIndex < 4; valueIndex++)
+ {
+ UnsignedIntValues[valueIndex] = unsignedIntValues[valueIndex];
+ }
+ Type = GL_UNSIGNED_INT;
+ }
+
+ bool operator==(const VertexAttribCurrentValueData &other)
+ {
+ return (Type == other.Type && memcmp(FloatValues, other.FloatValues, sizeof(float) * 4) == 0);
+ }
+
+ bool operator!=(const VertexAttribCurrentValueData &other)
+ {
+ return !(*this == other);
+ }
+};
+
+}
+
+#endif // LIBGLESV2_VERTEXATTRIBUTE_H_
diff --git a/chromium/third_party/angle/src/libGLESv2/angletypes.cpp b/chromium/third_party/angle/src/libGLESv2/angletypes.cpp
new file mode 100644
index 00000000000..acb3da8999d
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/angletypes.cpp
@@ -0,0 +1,177 @@
+#include "precompiled.h"
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// angletypes.h : Defines a variety of structures and enum types that are used throughout libGLESv2
+
+#include "libGLESv2/angletypes.h"
+#include "libGLESv2/ProgramBinary.h"
+#include "libGLESv2/VertexAttribute.h"
+
+namespace gl
+{
+
+bool SamplerState::swizzleRequired() const
+{
+ return swizzleRed != GL_RED || swizzleGreen != GL_GREEN ||
+ swizzleBlue != GL_BLUE || swizzleAlpha != GL_ALPHA;
+}
+
+static void MinMax(int a, int b, int *minimum, int *maximum)
+{
+ if (a < b)
+ {
+ *minimum = a;
+ *maximum = b;
+ }
+ else
+ {
+ *minimum = b;
+ *maximum = a;
+ }
+}
+
+bool ClipRectangle(const Rectangle &source, const Rectangle &clip, Rectangle *intersection)
+{
+ int minSourceX, maxSourceX, minSourceY, maxSourceY;
+ MinMax(source.x, source.x + source.width, &minSourceX, &maxSourceX);
+ MinMax(source.y, source.y + source.height, &minSourceY, &maxSourceY);
+
+ int minClipX, maxClipX, minClipY, maxClipY;
+ MinMax(clip.x, clip.x + clip.width, &minClipX, &maxClipX);
+ MinMax(clip.y, clip.y + clip.height, &minClipY, &maxClipY);
+
+ if (minSourceX >= maxClipX || maxSourceX <= minClipX || minSourceY >= maxClipY || maxSourceY <= minClipY)
+ {
+ if (intersection)
+ {
+ intersection->x = minSourceX;
+ intersection->y = maxSourceY;
+ intersection->width = maxSourceX - minSourceX;
+ intersection->height = maxSourceY - minSourceY;
+ }
+
+ return false;
+ }
+ else
+ {
+ if (intersection)
+ {
+ intersection->x = std::max(minSourceX, minClipX);
+ intersection->y = std::max(minSourceY, minClipY);
+ intersection->width = std::min(maxSourceX, maxClipX) - std::max(minSourceX, minClipX);
+ intersection->height = std::min(maxSourceY, maxClipY) - std::max(minSourceY, minClipY);
+ }
+
+ return true;
+ }
+}
+
+VertexFormat::VertexFormat()
+ : mType(GL_NONE),
+ mNormalized(GL_FALSE),
+ mComponents(0),
+ mPureInteger(false)
+{}
+
+VertexFormat::VertexFormat(GLenum type, GLboolean normalized, GLuint components, bool pureInteger)
+ : mType(type),
+ mNormalized(normalized),
+ mComponents(components),
+ mPureInteger(pureInteger)
+{
+ // Float data can not be normalized, so ignore the user setting
+ if (mType == GL_FLOAT || mType == GL_HALF_FLOAT || mType == GL_FIXED)
+ {
+ mNormalized = GL_FALSE;
+ }
+}
+
+VertexFormat::VertexFormat(const VertexAttribute &attribute)
+ : mType(attribute.mType),
+ mNormalized(attribute.mNormalized ? GL_TRUE : GL_FALSE),
+ mComponents(attribute.mSize),
+ mPureInteger(attribute.mPureInteger)
+{
+ // Ensure we aren't initializing a vertex format which should be using
+ // the current-value type
+ ASSERT(attribute.mArrayEnabled);
+
+ // Float data can not be normalized, so ignore the user setting
+ if (mType == GL_FLOAT || mType == GL_HALF_FLOAT || mType == GL_FIXED)
+ {
+ mNormalized = GL_FALSE;
+ }
+}
+
+VertexFormat::VertexFormat(const VertexAttribute &attribute, GLenum currentValueType)
+ : mType(attribute.mType),
+ mNormalized(attribute.mNormalized ? GL_TRUE : GL_FALSE),
+ mComponents(attribute.mSize),
+ mPureInteger(attribute.mPureInteger)
+{
+ if (!attribute.mArrayEnabled)
+ {
+ mType = currentValueType;
+ mNormalized = GL_FALSE;
+ mComponents = 4;
+ mPureInteger = (currentValueType != GL_FLOAT);
+ }
+
+ // Float data can not be normalized, so ignore the user setting
+ if (mType == GL_FLOAT || mType == GL_HALF_FLOAT || mType == GL_FIXED)
+ {
+ mNormalized = GL_FALSE;
+ }
+}
+
+void VertexFormat::GetInputLayout(VertexFormat *inputLayout,
+ ProgramBinary *programBinary,
+ const VertexAttribute *attributes,
+ const gl::VertexAttribCurrentValueData *currentValues)
+{
+ for (unsigned int attributeIndex = 0; attributeIndex < MAX_VERTEX_ATTRIBS; attributeIndex++)
+ {
+ int semanticIndex = programBinary->getSemanticIndex(attributeIndex);
+
+ if (semanticIndex != -1)
+ {
+ inputLayout[semanticIndex] = VertexFormat(attributes[attributeIndex], currentValues[attributeIndex].Type);
+ }
+ }
+}
+
+bool VertexFormat::operator==(const VertexFormat &other) const
+{
+ return (mType == other.mType &&
+ mComponents == other.mComponents &&
+ mNormalized == other.mNormalized &&
+ mPureInteger == other.mPureInteger );
+}
+
+bool VertexFormat::operator!=(const VertexFormat &other) const
+{
+ return !(*this == other);
+}
+
+bool VertexFormat::operator<(const VertexFormat& other) const
+{
+ if (mType != other.mType)
+ {
+ return mType < other.mType;
+ }
+ if (mNormalized != other.mNormalized)
+ {
+ return mNormalized < other.mNormalized;
+ }
+ if (mComponents != other.mComponents)
+ {
+ return mComponents < other.mComponents;
+ }
+ return mPureInteger < other.mPureInteger;
+}
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/angletypes.h b/chromium/third_party/angle/src/libGLESv2/angletypes.h
index b2f0cad2659..0e91279d241 100644
--- a/chromium/third_party/angle/src/libGLESv2/angletypes.h
+++ b/chromium/third_party/angle/src/libGLESv2/angletypes.h
@@ -9,13 +9,22 @@
#ifndef LIBGLESV2_ANGLETYPES_H_
#define LIBGLESV2_ANGLETYPES_H_
+#include "libGLESv2/constants.h"
+#include "common/RefCountObject.h"
+
namespace gl
{
+class Buffer;
+class ProgramBinary;
+class VertexAttribute;
+struct VertexAttribCurrentValueData;
enum TextureType
{
TEXTURE_2D,
TEXTURE_CUBE,
+ TEXTURE_3D,
+ TEXTURE_2D_ARRAY,
TEXTURE_TYPE_COUNT,
TEXTURE_UNKNOWN
@@ -27,20 +36,56 @@ enum SamplerType
SAMPLER_VERTEX
};
+template <typename T>
struct Color
{
- float red;
- float green;
- float blue;
- float alpha;
+ T red;
+ T green;
+ T blue;
+ T alpha;
+
+ Color() : red(0), green(0), blue(0), alpha(0) { }
+ Color(T r, T g, T b, T a) : red(r), green(g), blue(b), alpha(a) { }
};
+typedef Color<float> ColorF;
+typedef Color<int> ColorI;
+typedef Color<unsigned int> ColorUI;
+
struct Rectangle
{
int x;
int y;
int width;
int height;
+
+ Rectangle() : x(0), y(0), width(0), height(0) { }
+ Rectangle(int x_in, int y_in, int width_in, int height_in) : x(x_in), y(y_in), width(width_in), height(height_in) { }
+};
+
+bool ClipRectangle(const Rectangle &source, const Rectangle &clip, Rectangle *intersection);
+
+struct Box
+{
+ int x;
+ int y;
+ int z;
+ int width;
+ int height;
+ int depth;
+
+ Box() : x(0), y(0), z(0), width(0), height(0), depth(0) { }
+ Box(int x_in, int y_in, int z_in, int width_in, int height_in, int depth_in) : x(x_in), y(y_in), z(z_in), width(width_in), height(height_in), depth(depth_in) { }
+};
+
+struct Extents
+{
+ int width;
+ int height;
+ int depth;
+
+ Extents() : width(0), height(0), depth(0) { }
+ Extents(int width_, int height_, int depth_) : width(width_), height(height_), depth(depth_) { }
};
struct RasterizerState
@@ -55,6 +100,8 @@ struct RasterizerState
bool pointDrawMode;
bool multiSample;
+
+ bool rasterizerDiscard;
};
struct BlendState
@@ -104,24 +151,119 @@ struct SamplerState
GLenum magFilter;
GLenum wrapS;
GLenum wrapT;
+ GLenum wrapR;
float maxAnisotropy;
- int lodOffset;
+
+ GLint baseLevel;
+ GLint maxLevel;
+ GLfloat minLod;
+ GLfloat maxLod;
+
+ GLenum compareMode;
+ GLenum compareFunc;
+
+ GLenum swizzleRed;
+ GLenum swizzleGreen;
+ GLenum swizzleBlue;
+ GLenum swizzleAlpha;
+
+ bool swizzleRequired() const;
};
struct ClearParameters
{
- GLbitfield mask;
-
- Color colorClearValue;
+ bool clearColor[gl::IMPLEMENTATION_MAX_DRAW_BUFFERS];
+ ColorF colorFClearValue;
+ ColorI colorIClearValue;
+ ColorUI colorUIClearValue;
+ GLenum colorClearType;
bool colorMaskRed;
bool colorMaskGreen;
bool colorMaskBlue;
bool colorMaskAlpha;
+ bool clearDepth;
float depthClearValue;
+ bool clearStencil;
GLint stencilClearValue;
GLuint stencilWriteMask;
+
+ bool scissorEnabled;
+ Rectangle scissor;
+};
+
+struct PixelUnpackState
+{
+ BindingPointer<Buffer> pixelBuffer;
+ GLint alignment;
+
+ PixelUnpackState()
+ : alignment(4)
+ {}
+
+ explicit PixelUnpackState(GLint alignmentIn)
+ : alignment(alignmentIn)
+ {}
+};
+
+struct PixelPackState
+{
+ BindingPointer<Buffer> pixelBuffer;
+ GLint alignment;
+ bool reverseRowOrder;
+
+ PixelPackState()
+ : alignment(4),
+ reverseRowOrder(false)
+ {}
+
+ explicit PixelPackState(GLint alignmentIn, bool reverseRowOrderIn)
+ : alignment(alignmentIn),
+ reverseRowOrder(reverseRowOrderIn)
+ {}
+};
+
+struct VertexFormat
+{
+ GLenum mType;
+ GLboolean mNormalized;
+ GLuint mComponents;
+ bool mPureInteger;
+
+ VertexFormat();
+ VertexFormat(GLenum type, GLboolean normalized, GLuint components, bool pureInteger);
+ explicit VertexFormat(const VertexAttribute &attribute);
+ VertexFormat(const VertexAttribute &attribute, GLenum currentValueType);
+
+ static void GetInputLayout(VertexFormat *inputLayout,
+ ProgramBinary *programBinary,
+ const VertexAttribute *attributes,
+ const gl::VertexAttribCurrentValueData *currentValues);
+
+ bool operator==(const VertexFormat &other) const;
+ bool operator!=(const VertexFormat &other) const;
+ bool operator<(const VertexFormat& other) const;
+};
+
+}
+
+namespace rx
+{
+
+enum VertexConversionType
+{
+ VERTEX_CONVERT_NONE = 0,
+ VERTEX_CONVERT_CPU = 1,
+ VERTEX_CONVERT_GPU = 2,
+ VERTEX_CONVERT_BOTH = 3
+};
+
+enum D3DWorkaroundType
+{
+ ANGLE_D3D_WORKAROUND_NONE,
+ ANGLE_D3D_WORKAROUND_SKIP_OPTIMIZATION,
+ ANGLE_D3D_WORKAROUND_MAX_OPTIMIZATION
};
}
diff --git a/chromium/third_party/angle/src/libGLESv2/Constants.h b/chromium/third_party/angle/src/libGLESv2/constants.h
index 9f24d66a7dc..0c1c0ef1375 100644
--- a/chromium/third_party/angle/src/libGLESv2/Constants.h
+++ b/chromium/third_party/angle/src/libGLESv2/constants.h
@@ -22,7 +22,15 @@ enum
IMPLEMENTATION_MAX_COMBINED_TEXTURE_IMAGE_UNITS = MAX_TEXTURE_IMAGE_UNITS + IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS,
IMPLEMENTATION_MAX_VARYING_VECTORS = 32,
- IMPLEMENTATION_MAX_DRAW_BUFFERS = 8
+ IMPLEMENTATION_MAX_DRAW_BUFFERS = 8,
+ IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS = IMPLEMENTATION_MAX_DRAW_BUFFERS + 2, // 2 extra for depth and/or stencil buffers
+
+ IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS = 16,
+ IMPLEMENTATION_MAX_FRAGMENT_SHADER_UNIFORM_BUFFERS = 16,
+ IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS = IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS +
+ IMPLEMENTATION_MAX_FRAGMENT_SHADER_UNIFORM_BUFFERS,
+
+ IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS = 4,
};
const float ALIASED_LINE_WIDTH_RANGE_MIN = 1.0f;
diff --git a/chromium/third_party/angle/src/libGLESv2/formatutils.cpp b/chromium/third_party/angle/src/libGLESv2/formatutils.cpp
new file mode 100644
index 00000000000..3aac25efadd
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/formatutils.cpp
@@ -0,0 +1,1812 @@
+#include "precompiled.h"
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// formatutils.cpp: Queries for GL image formats.
+
+#include "common/mathutil.h"
+#include "libGLESv2/formatutils.h"
+#include "libGLESv2/Context.h"
+#include "libGLESv2/Framebuffer.h"
+#include "libGLESv2/renderer/Renderer.h"
+#include "libGLESv2/renderer/imageformats.h"
+#include "libGLESv2/renderer/copyimage.h"
+
+namespace gl
+{
+
+// ES2 requires that format is equal to internal format at all glTex*Image2D entry points and the implementation
+// can decide the true, sized, internal format. The ES2FormatMap determines the internal format for all valid
+// format and type combinations.
+
+struct FormatTypeInfo
+{
+ GLenum mInternalFormat;
+ ColorWriteFunction mColorWriteFunction;
+
+ FormatTypeInfo(GLenum internalFormat, ColorWriteFunction writeFunc)
+ : mInternalFormat(internalFormat), mColorWriteFunction(writeFunc)
+ { }
+};
+
+typedef std::pair<GLenum, GLenum> FormatTypePair;
+typedef std::pair<FormatTypePair, FormatTypeInfo> FormatPair;
+typedef std::map<FormatTypePair, FormatTypeInfo> FormatMap;
+
+// A helper function to insert data into the format map with fewer characters.
+static inline void InsertFormatMapping(FormatMap *map, GLenum format, GLenum type, GLenum internalFormat, ColorWriteFunction writeFunc)
+{
+ map->insert(FormatPair(FormatTypePair(format, type), FormatTypeInfo(internalFormat, writeFunc)));
+}
+
+FormatMap BuildES2FormatMap()
+{
+ FormatMap map;
+
+ using namespace rx;
+
+ // | Format | Type | Internal format | Color write function |
+ InsertFormatMapping(&map, GL_ALPHA, GL_UNSIGNED_BYTE, GL_ALPHA8_EXT, WriteColor<A8, GLfloat> );
+ InsertFormatMapping(&map, GL_ALPHA, GL_FLOAT, GL_ALPHA32F_EXT, WriteColor<A32F, GLfloat> );
+ InsertFormatMapping(&map, GL_ALPHA, GL_HALF_FLOAT_OES, GL_ALPHA16F_EXT, WriteColor<A16F, GLfloat> );
+
+ InsertFormatMapping(&map, GL_LUMINANCE, GL_UNSIGNED_BYTE, GL_LUMINANCE8_EXT, WriteColor<L8, GLfloat> );
+ InsertFormatMapping(&map, GL_LUMINANCE, GL_FLOAT, GL_LUMINANCE32F_EXT, WriteColor<L32F, GLfloat> );
+ InsertFormatMapping(&map, GL_LUMINANCE, GL_HALF_FLOAT_OES, GL_LUMINANCE16F_EXT, WriteColor<L16F, GLfloat> );
+
+ InsertFormatMapping(&map, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, GL_LUMINANCE8_ALPHA8_EXT, WriteColor<L8A8, GLfloat> );
+ InsertFormatMapping(&map, GL_LUMINANCE_ALPHA, GL_FLOAT, GL_LUMINANCE_ALPHA32F_EXT, WriteColor<L32A32F, GLfloat> );
+ InsertFormatMapping(&map, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT_OES, GL_LUMINANCE_ALPHA16F_EXT, WriteColor<L16A16F, GLfloat> );
+
+ InsertFormatMapping(&map, GL_RED, GL_UNSIGNED_BYTE, GL_R8_EXT, WriteColor<R8, GLfloat> );
+ InsertFormatMapping(&map, GL_RED, GL_FLOAT, GL_R32F_EXT, WriteColor<R32F, GLfloat> );
+ InsertFormatMapping(&map, GL_RED, GL_HALF_FLOAT_OES, GL_R16F_EXT, WriteColor<R16F, GLfloat> );
+
+ InsertFormatMapping(&map, GL_RG, GL_UNSIGNED_BYTE, GL_RG8_EXT, WriteColor<R8G8, GLfloat> );
+ InsertFormatMapping(&map, GL_RG, GL_FLOAT, GL_RG32F_EXT, WriteColor<R32G32F, GLfloat> );
+ InsertFormatMapping(&map, GL_RG, GL_HALF_FLOAT_OES, GL_RG16F_EXT, WriteColor<R16G16F, GLfloat> );
+
+ InsertFormatMapping(&map, GL_RGB, GL_UNSIGNED_BYTE, GL_RGB8_OES, WriteColor<R8G8B8, GLfloat> );
+ InsertFormatMapping(&map, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, GL_RGB565, WriteColor<R5G6B5, GLfloat> );
+ InsertFormatMapping(&map, GL_RGB, GL_FLOAT, GL_RGB32F_EXT, WriteColor<R32G32B32F, GLfloat> );
+ InsertFormatMapping(&map, GL_RGB, GL_HALF_FLOAT_OES, GL_RGB16F_EXT, WriteColor<R16G16B16F, GLfloat> );
+
+ InsertFormatMapping(&map, GL_RGBA, GL_UNSIGNED_BYTE, GL_RGBA8_OES, WriteColor<R8G8B8A8, GLfloat> );
+ InsertFormatMapping(&map, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, GL_RGBA4, WriteColor<R4G4B4A4, GLfloat> );
+ InsertFormatMapping(&map, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, GL_RGB5_A1, WriteColor<R5G5B5A1, GLfloat> );
+ InsertFormatMapping(&map, GL_RGBA, GL_FLOAT, GL_RGBA32F_EXT, WriteColor<R32G32B32A32F, GLfloat>);
+ InsertFormatMapping(&map, GL_RGBA, GL_HALF_FLOAT_OES, GL_RGBA16F_EXT, WriteColor<R16G16B16A16F, GLfloat>);
+
+ InsertFormatMapping(&map, GL_BGRA_EXT, GL_UNSIGNED_BYTE, GL_BGRA8_EXT, WriteColor<B8G8R8A8, GLfloat> );
+ InsertFormatMapping(&map, GL_BGRA_EXT, GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT, GL_BGRA4_ANGLEX, WriteColor<B4G4R4A4, GLfloat> );
+ InsertFormatMapping(&map, GL_BGRA_EXT, GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT, GL_BGR5_A1_ANGLEX, WriteColor<B5G5R5A1, GLfloat> );
+
+ InsertFormatMapping(&map, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_UNSIGNED_BYTE, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, NULL );
+ InsertFormatMapping(&map, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, GL_UNSIGNED_BYTE, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, NULL );
+ InsertFormatMapping(&map, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, GL_UNSIGNED_BYTE, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, NULL );
+ InsertFormatMapping(&map, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, GL_UNSIGNED_BYTE, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, NULL );
+
+ InsertFormatMapping(&map, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, GL_DEPTH_COMPONENT16, NULL );
+ InsertFormatMapping(&map, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, GL_DEPTH_COMPONENT32_OES, NULL );
+
+ InsertFormatMapping(&map, GL_DEPTH_STENCIL_OES, GL_UNSIGNED_INT_24_8_OES, GL_DEPTH24_STENCIL8_OES, NULL );
+
+ return map;
+}
+
+FormatMap BuildES3FormatMap()
+{
+ FormatMap map;
+
+ using namespace rx;
+
+ // | Format | Type | Internal format | Color write function |
+ InsertFormatMapping(&map, GL_RGBA, GL_UNSIGNED_BYTE, GL_RGBA8, WriteColor<R8G8B8A8, GLfloat> );
+ InsertFormatMapping(&map, GL_RGBA, GL_BYTE, GL_RGBA8_SNORM, WriteColor<R8G8B8A8S, GLfloat> );
+ InsertFormatMapping(&map, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, GL_RGBA4, WriteColor<R4G4B4A4, GLfloat> );
+ InsertFormatMapping(&map, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, GL_RGB5_A1, WriteColor<R5G5B5A1, GLfloat> );
+ InsertFormatMapping(&map, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, GL_RGB10_A2, WriteColor<R10G10B10A2, GLfloat> );
+ InsertFormatMapping(&map, GL_RGBA, GL_FLOAT, GL_RGBA32F, WriteColor<R32G32B32A32F, GLfloat>);
+ InsertFormatMapping(&map, GL_RGBA, GL_HALF_FLOAT, GL_RGBA16F, WriteColor<R16G16B16A16F, GLfloat>);
+
+ InsertFormatMapping(&map, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE, GL_RGBA8UI, WriteColor<R8G8B8A8, GLuint> );
+ InsertFormatMapping(&map, GL_RGBA_INTEGER, GL_BYTE, GL_RGBA8I, WriteColor<R8G8B8A8S, GLint> );
+ InsertFormatMapping(&map, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT, GL_RGBA16UI, WriteColor<R16G16B16A16, GLuint> );
+ InsertFormatMapping(&map, GL_RGBA_INTEGER, GL_SHORT, GL_RGBA16I, WriteColor<R16G16B16A16S, GLint> );
+ InsertFormatMapping(&map, GL_RGBA_INTEGER, GL_UNSIGNED_INT, GL_RGBA32UI, WriteColor<R32G32B32A32, GLuint> );
+ InsertFormatMapping(&map, GL_RGBA_INTEGER, GL_INT, GL_RGBA32I, WriteColor<R32G32B32A32S, GLint> );
+ InsertFormatMapping(&map, GL_RGBA_INTEGER, GL_UNSIGNED_INT_2_10_10_10_REV, GL_RGB10_A2UI, WriteColor<R10G10B10A2, GLuint> );
+
+ InsertFormatMapping(&map, GL_RGB, GL_UNSIGNED_BYTE, GL_RGB8, WriteColor<R8G8B8, GLfloat> );
+ InsertFormatMapping(&map, GL_RGB, GL_BYTE, GL_RGB8_SNORM, WriteColor<R8G8B8S, GLfloat> );
+ InsertFormatMapping(&map, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, GL_RGB565, WriteColor<R5G6B5, GLfloat> );
+ InsertFormatMapping(&map, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, GL_R11F_G11F_B10F, WriteColor<R11G11B10F, GLfloat> );
+ InsertFormatMapping(&map, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV, GL_RGB9_E5, WriteColor<R9G9B9E5, GLfloat> );
+ InsertFormatMapping(&map, GL_RGB, GL_FLOAT, GL_RGB32F, WriteColor<R32G32B32F, GLfloat> );
+ InsertFormatMapping(&map, GL_RGB, GL_HALF_FLOAT, GL_RGB16F, WriteColor<R16G16B16F, GLfloat> );
+
+ InsertFormatMapping(&map, GL_RGB_INTEGER, GL_UNSIGNED_BYTE, GL_RGB8UI, WriteColor<R8G8B8, GLuint> );
+ InsertFormatMapping(&map, GL_RGB_INTEGER, GL_BYTE, GL_RGB8I, WriteColor<R8G8B8S, GLint> );
+ InsertFormatMapping(&map, GL_RGB_INTEGER, GL_UNSIGNED_SHORT, GL_RGB16UI, WriteColor<R16G16B16, GLuint> );
+ InsertFormatMapping(&map, GL_RGB_INTEGER, GL_SHORT, GL_RGB16I, WriteColor<R16G16B16S, GLint> );
+ InsertFormatMapping(&map, GL_RGB_INTEGER, GL_UNSIGNED_INT, GL_RGB32UI, WriteColor<R32G32B32, GLuint> );
+ InsertFormatMapping(&map, GL_RGB_INTEGER, GL_INT, GL_RGB32I, WriteColor<R32G32B32S, GLint> );
+
+ InsertFormatMapping(&map, GL_RG, GL_UNSIGNED_BYTE, GL_RG8, WriteColor<R8G8, GLfloat> );
+ InsertFormatMapping(&map, GL_RG, GL_BYTE, GL_RG8_SNORM, WriteColor<R8G8S, GLfloat> );
+ InsertFormatMapping(&map, GL_RG, GL_FLOAT, GL_RG32F, WriteColor<R32G32F, GLfloat> );
+ InsertFormatMapping(&map, GL_RG, GL_HALF_FLOAT, GL_RG16F, WriteColor<R16G16F, GLfloat> );
+
+ InsertFormatMapping(&map, GL_RG_INTEGER, GL_UNSIGNED_BYTE, GL_RG8UI, WriteColor<R8G8, GLuint> );
+ InsertFormatMapping(&map, GL_RG_INTEGER, GL_BYTE, GL_RG8I, WriteColor<R8G8S, GLint> );
+ InsertFormatMapping(&map, GL_RG_INTEGER, GL_UNSIGNED_SHORT, GL_RG16UI, WriteColor<R16G16, GLuint> );
+ InsertFormatMapping(&map, GL_RG_INTEGER, GL_SHORT, GL_RG16I, WriteColor<R16G16S, GLint> );
+ InsertFormatMapping(&map, GL_RG_INTEGER, GL_UNSIGNED_INT, GL_RG32UI, WriteColor<R32G32, GLuint> );
+ InsertFormatMapping(&map, GL_RG_INTEGER, GL_INT, GL_RG32I, WriteColor<R32G32S, GLint> );
+
+ InsertFormatMapping(&map, GL_RED, GL_UNSIGNED_BYTE, GL_R8, WriteColor<R8, GLfloat> );
+ InsertFormatMapping(&map, GL_RED, GL_BYTE, GL_R8_SNORM, WriteColor<R8S, GLfloat> );
+ InsertFormatMapping(&map, GL_RED, GL_FLOAT, GL_R32F, WriteColor<R32F, GLfloat> );
+ InsertFormatMapping(&map, GL_RED, GL_HALF_FLOAT, GL_R16F, WriteColor<R16F, GLfloat> );
+
+ InsertFormatMapping(&map, GL_RED_INTEGER, GL_UNSIGNED_BYTE, GL_R8UI, WriteColor<R8, GLuint> );
+ InsertFormatMapping(&map, GL_RED_INTEGER, GL_BYTE, GL_R8I, WriteColor<R8S, GLint> );
+ InsertFormatMapping(&map, GL_RED_INTEGER, GL_UNSIGNED_SHORT, GL_R16UI, WriteColor<R16, GLuint> );
+ InsertFormatMapping(&map, GL_RED_INTEGER, GL_SHORT, GL_R16I, WriteColor<R16S, GLint> );
+ InsertFormatMapping(&map, GL_RED_INTEGER, GL_UNSIGNED_INT, GL_R32UI, WriteColor<R32, GLuint> );
+ InsertFormatMapping(&map, GL_RED_INTEGER, GL_INT, GL_R32I, WriteColor<R32S, GLint> );
+
+ InsertFormatMapping(&map, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, GL_LUMINANCE8_ALPHA8_EXT, WriteColor<L8A8, GLfloat> );
+ InsertFormatMapping(&map, GL_LUMINANCE, GL_UNSIGNED_BYTE, GL_LUMINANCE8_EXT, WriteColor<L8, GLfloat> );
+ InsertFormatMapping(&map, GL_ALPHA, GL_UNSIGNED_BYTE, GL_ALPHA8_EXT, WriteColor<A8, GLfloat> );
+ InsertFormatMapping(&map, GL_LUMINANCE_ALPHA, GL_FLOAT, GL_LUMINANCE_ALPHA32F_EXT, WriteColor<L32A32F, GLfloat> );
+ InsertFormatMapping(&map, GL_LUMINANCE, GL_FLOAT, GL_LUMINANCE32F_EXT, WriteColor<L32F, GLfloat> );
+ InsertFormatMapping(&map, GL_ALPHA, GL_FLOAT, GL_ALPHA32F_EXT, WriteColor<A32F, GLfloat> );
+ InsertFormatMapping(&map, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT, GL_LUMINANCE_ALPHA16F_EXT, WriteColor<L16A16F, GLfloat> );
+ InsertFormatMapping(&map, GL_LUMINANCE, GL_HALF_FLOAT, GL_LUMINANCE16F_EXT, WriteColor<L16F, GLfloat> );
+ InsertFormatMapping(&map, GL_ALPHA, GL_HALF_FLOAT, GL_ALPHA16F_EXT, WriteColor<A16F, GLfloat> );
+
+ InsertFormatMapping(&map, GL_BGRA_EXT, GL_UNSIGNED_BYTE, GL_BGRA8_EXT, WriteColor<B8G8R8A8, GLfloat> );
+ InsertFormatMapping(&map, GL_BGRA_EXT, GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT, GL_BGRA4_ANGLEX, WriteColor<B4G4R4A4, GLfloat> );
+ InsertFormatMapping(&map, GL_BGRA_EXT, GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT, GL_BGR5_A1_ANGLEX, WriteColor<B5G5R5A1, GLfloat> );
+
+ InsertFormatMapping(&map, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, GL_DEPTH_COMPONENT16, NULL );
+ InsertFormatMapping(&map, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, GL_DEPTH_COMPONENT24, NULL );
+ InsertFormatMapping(&map, GL_DEPTH_COMPONENT, GL_FLOAT, GL_DEPTH_COMPONENT32F, NULL );
+
+ InsertFormatMapping(&map, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, GL_DEPTH24_STENCIL8, NULL );
+ InsertFormatMapping(&map, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, GL_DEPTH32F_STENCIL8, NULL );
+
+ return map;
+}
+
+static const FormatMap &GetFormatMap(GLuint clientVersion)
+{
+ if (clientVersion == 2)
+ {
+ static const FormatMap formats = BuildES2FormatMap();
+ return formats;
+ }
+ else if (clientVersion == 3)
+ {
+ static const FormatMap formats = BuildES3FormatMap();
+ return formats;
+ }
+ else
+ {
+ UNREACHABLE();
+ static FormatMap emptyMap;
+ return emptyMap;
+ }
+}
+
+struct FormatInfo
+{
+ GLenum mInternalformat;
+ GLenum mFormat;
+ GLenum mType;
+
+ FormatInfo(GLenum internalformat, GLenum format, GLenum type)
+ : mInternalformat(internalformat), mFormat(format), mType(type) { }
+
+ bool operator<(const FormatInfo& other) const
+ {
+ return memcmp(this, &other, sizeof(FormatInfo)) < 0;
+ }
+};
+
+// ES3 has a specific set of permutations of internal formats, formats and types which are acceptable.
+typedef std::set<FormatInfo> ES3FormatSet;
+
+ES3FormatSet BuildES3FormatSet()
+{
+ ES3FormatSet set;
+
+ // Format combinations from ES 3.0.1 spec, table 3.2
+
+ // | Internal format | Format | Type |
+ // | | | |
+ set.insert(FormatInfo(GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE ));
+ set.insert(FormatInfo(GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_BYTE ));
+ set.insert(FormatInfo(GL_RGBA4, GL_RGBA, GL_UNSIGNED_BYTE ));
+ set.insert(FormatInfo(GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE ));
+ set.insert(FormatInfo(GL_RGBA8_SNORM, GL_RGBA, GL_BYTE ));
+ set.insert(FormatInfo(GL_RGBA4, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4 ));
+ set.insert(FormatInfo(GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV ));
+ set.insert(FormatInfo(GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV ));
+ set.insert(FormatInfo(GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1 ));
+ set.insert(FormatInfo(GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT ));
+ set.insert(FormatInfo(GL_RGBA32F, GL_RGBA, GL_FLOAT ));
+ set.insert(FormatInfo(GL_RGBA16F, GL_RGBA, GL_FLOAT ));
+ set.insert(FormatInfo(GL_RGBA8UI, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE ));
+ set.insert(FormatInfo(GL_RGBA8I, GL_RGBA_INTEGER, GL_BYTE ));
+ set.insert(FormatInfo(GL_RGBA16UI, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT ));
+ set.insert(FormatInfo(GL_RGBA16I, GL_RGBA_INTEGER, GL_SHORT ));
+ set.insert(FormatInfo(GL_RGBA32UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT ));
+ set.insert(FormatInfo(GL_RGBA32I, GL_RGBA_INTEGER, GL_INT ));
+ set.insert(FormatInfo(GL_RGB10_A2UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT_2_10_10_10_REV ));
+ set.insert(FormatInfo(GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE ));
+ set.insert(FormatInfo(GL_RGB565, GL_RGB, GL_UNSIGNED_BYTE ));
+ set.insert(FormatInfo(GL_SRGB8, GL_RGB, GL_UNSIGNED_BYTE ));
+ set.insert(FormatInfo(GL_RGB8_SNORM, GL_RGB, GL_BYTE ));
+ set.insert(FormatInfo(GL_RGB565, GL_RGB, GL_UNSIGNED_SHORT_5_6_5 ));
+ set.insert(FormatInfo(GL_R11F_G11F_B10F, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV ));
+ set.insert(FormatInfo(GL_RGB9_E5, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV ));
+ set.insert(FormatInfo(GL_RGB16F, GL_RGB, GL_HALF_FLOAT ));
+ set.insert(FormatInfo(GL_R11F_G11F_B10F, GL_RGB, GL_HALF_FLOAT ));
+ set.insert(FormatInfo(GL_RGB9_E5, GL_RGB, GL_HALF_FLOAT ));
+ set.insert(FormatInfo(GL_RGB32F, GL_RGB, GL_FLOAT ));
+ set.insert(FormatInfo(GL_RGB16F, GL_RGB, GL_FLOAT ));
+ set.insert(FormatInfo(GL_R11F_G11F_B10F, GL_RGB, GL_FLOAT ));
+ set.insert(FormatInfo(GL_RGB9_E5, GL_RGB, GL_FLOAT ));
+ set.insert(FormatInfo(GL_RGB8UI, GL_RGB_INTEGER, GL_UNSIGNED_BYTE ));
+ set.insert(FormatInfo(GL_RGB8I, GL_RGB_INTEGER, GL_BYTE ));
+ set.insert(FormatInfo(GL_RGB16UI, GL_RGB_INTEGER, GL_UNSIGNED_SHORT ));
+ set.insert(FormatInfo(GL_RGB16I, GL_RGB_INTEGER, GL_SHORT ));
+ set.insert(FormatInfo(GL_RGB32UI, GL_RGB_INTEGER, GL_UNSIGNED_INT ));
+ set.insert(FormatInfo(GL_RGB32I, GL_RGB_INTEGER, GL_INT ));
+ set.insert(FormatInfo(GL_RG8, GL_RG, GL_UNSIGNED_BYTE ));
+ set.insert(FormatInfo(GL_RG8_SNORM, GL_RG, GL_BYTE ));
+ set.insert(FormatInfo(GL_RG16F, GL_RG, GL_HALF_FLOAT ));
+ set.insert(FormatInfo(GL_RG32F, GL_RG, GL_FLOAT ));
+ set.insert(FormatInfo(GL_RG16F, GL_RG, GL_FLOAT ));
+ set.insert(FormatInfo(GL_RG8UI, GL_RG_INTEGER, GL_UNSIGNED_BYTE ));
+ set.insert(FormatInfo(GL_RG8I, GL_RG_INTEGER, GL_BYTE ));
+ set.insert(FormatInfo(GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT ));
+ set.insert(FormatInfo(GL_RG16I, GL_RG_INTEGER, GL_SHORT ));
+ set.insert(FormatInfo(GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT ));
+ set.insert(FormatInfo(GL_RG32I, GL_RG_INTEGER, GL_INT ));
+ set.insert(FormatInfo(GL_R8, GL_RED, GL_UNSIGNED_BYTE ));
+ set.insert(FormatInfo(GL_R8_SNORM, GL_RED, GL_BYTE ));
+ set.insert(FormatInfo(GL_R16F, GL_RED, GL_HALF_FLOAT ));
+ set.insert(FormatInfo(GL_R32F, GL_RED, GL_FLOAT ));
+ set.insert(FormatInfo(GL_R16F, GL_RED, GL_FLOAT ));
+ set.insert(FormatInfo(GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE ));
+ set.insert(FormatInfo(GL_R8I, GL_RED_INTEGER, GL_BYTE ));
+ set.insert(FormatInfo(GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT ));
+ set.insert(FormatInfo(GL_R16I, GL_RED_INTEGER, GL_SHORT ));
+ set.insert(FormatInfo(GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT ));
+ set.insert(FormatInfo(GL_R32I, GL_RED_INTEGER, GL_INT ));
+
+ // Unsized formats
+ set.insert(FormatInfo(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE ));
+ set.insert(FormatInfo(GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4 ));
+ set.insert(FormatInfo(GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1 ));
+ set.insert(FormatInfo(GL_RGB, GL_RGB, GL_UNSIGNED_BYTE ));
+ set.insert(FormatInfo(GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5 ));
+ set.insert(FormatInfo(GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE ));
+ set.insert(FormatInfo(GL_LUMINANCE, GL_LUMINANCE, GL_UNSIGNED_BYTE ));
+ set.insert(FormatInfo(GL_ALPHA, GL_ALPHA, GL_UNSIGNED_BYTE ));
+
+ // Depth stencil formats
+ set.insert(FormatInfo(GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT ));
+ set.insert(FormatInfo(GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT ));
+ set.insert(FormatInfo(GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT ));
+ set.insert(FormatInfo(GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT ));
+ set.insert(FormatInfo(GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8 ));
+ set.insert(FormatInfo(GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV));
+
+ // From GL_OES_texture_float
+ set.insert(FormatInfo(GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_FLOAT ));
+ set.insert(FormatInfo(GL_LUMINANCE, GL_LUMINANCE, GL_FLOAT ));
+ set.insert(FormatInfo(GL_ALPHA, GL_ALPHA, GL_FLOAT ));
+
+ // From GL_OES_texture_half_float
+ set.insert(FormatInfo(GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT ));
+ set.insert(FormatInfo(GL_LUMINANCE, GL_LUMINANCE, GL_HALF_FLOAT ));
+ set.insert(FormatInfo(GL_ALPHA, GL_ALPHA, GL_HALF_FLOAT ));
+
+ // From GL_EXT_texture_format_BGRA8888
+ set.insert(FormatInfo(GL_BGRA_EXT, GL_BGRA_EXT, GL_UNSIGNED_BYTE ));
+
+ // From GL_EXT_texture_storage
+ // | Internal format | Format | Type |
+ // | | | |
+ set.insert(FormatInfo(GL_ALPHA8_EXT, GL_ALPHA, GL_UNSIGNED_BYTE ));
+ set.insert(FormatInfo(GL_LUMINANCE8_EXT, GL_LUMINANCE, GL_UNSIGNED_BYTE ));
+ set.insert(FormatInfo(GL_LUMINANCE8_ALPHA8_EXT, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE ));
+ set.insert(FormatInfo(GL_ALPHA32F_EXT, GL_ALPHA, GL_FLOAT ));
+ set.insert(FormatInfo(GL_LUMINANCE32F_EXT, GL_LUMINANCE, GL_FLOAT ));
+ set.insert(FormatInfo(GL_LUMINANCE_ALPHA32F_EXT, GL_LUMINANCE_ALPHA, GL_FLOAT ));
+ set.insert(FormatInfo(GL_ALPHA16F_EXT, GL_ALPHA, GL_HALF_FLOAT ));
+ set.insert(FormatInfo(GL_LUMINANCE16F_EXT, GL_LUMINANCE, GL_HALF_FLOAT ));
+ set.insert(FormatInfo(GL_LUMINANCE_ALPHA16F_EXT, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT ));
+
+ // From GL_EXT_texture_storage and GL_EXT_texture_format_BGRA8888
+ set.insert(FormatInfo(GL_BGRA8_EXT, GL_BGRA_EXT, GL_UNSIGNED_BYTE ));
+ set.insert(FormatInfo(GL_BGRA4_ANGLEX, GL_BGRA_EXT, GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT));
+ set.insert(FormatInfo(GL_BGRA4_ANGLEX, GL_BGRA_EXT, GL_UNSIGNED_BYTE ));
+ set.insert(FormatInfo(GL_BGR5_A1_ANGLEX, GL_BGRA_EXT, GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT));
+ set.insert(FormatInfo(GL_BGR5_A1_ANGLEX, GL_BGRA_EXT, GL_UNSIGNED_BYTE ));
+
+ // From GL_ANGLE_depth_texture
+ set.insert(FormatInfo(GL_DEPTH_COMPONENT32_OES, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT_24_8_OES ));
+
+ // Compressed formats
+ // From ES 3.0.1 spec, table 3.16
+ // | Internal format | Format | Type |
+ // | | | |
+ set.insert(FormatInfo(GL_COMPRESSED_R11_EAC, GL_COMPRESSED_R11_EAC, GL_UNSIGNED_BYTE));
+ set.insert(FormatInfo(GL_COMPRESSED_R11_EAC, GL_COMPRESSED_R11_EAC, GL_UNSIGNED_BYTE));
+ set.insert(FormatInfo(GL_COMPRESSED_SIGNED_R11_EAC, GL_COMPRESSED_SIGNED_R11_EAC, GL_UNSIGNED_BYTE));
+ set.insert(FormatInfo(GL_COMPRESSED_RG11_EAC, GL_COMPRESSED_RG11_EAC, GL_UNSIGNED_BYTE));
+ set.insert(FormatInfo(GL_COMPRESSED_SIGNED_RG11_EAC, GL_COMPRESSED_SIGNED_RG11_EAC, GL_UNSIGNED_BYTE));
+ set.insert(FormatInfo(GL_COMPRESSED_RGB8_ETC2, GL_COMPRESSED_RGB8_ETC2, GL_UNSIGNED_BYTE));
+ set.insert(FormatInfo(GL_COMPRESSED_SRGB8_ETC2, GL_COMPRESSED_SRGB8_ETC2, GL_UNSIGNED_BYTE));
+ set.insert(FormatInfo(GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_UNSIGNED_BYTE));
+ set.insert(FormatInfo(GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_UNSIGNED_BYTE));
+ set.insert(FormatInfo(GL_COMPRESSED_RGBA8_ETC2_EAC, GL_COMPRESSED_RGBA8_ETC2_EAC, GL_UNSIGNED_BYTE));
+ set.insert(FormatInfo(GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, GL_UNSIGNED_BYTE));
+
+
+ // From GL_EXT_texture_compression_dxt1
+ set.insert(FormatInfo(GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_UNSIGNED_BYTE));
+ set.insert(FormatInfo(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, GL_UNSIGNED_BYTE));
+
+ // From GL_ANGLE_texture_compression_dxt3
+ set.insert(FormatInfo(GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, GL_UNSIGNED_BYTE));
+
+ // From GL_ANGLE_texture_compression_dxt5
+ set.insert(FormatInfo(GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, GL_UNSIGNED_BYTE));
+
+ return set;
+}
+
+static const ES3FormatSet &GetES3FormatSet()
+{
+ static const ES3FormatSet es3FormatSet = BuildES3FormatSet();
+ return es3FormatSet;
+}
+
+// Map of sizes of input types
+struct TypeInfo
+{
+ GLuint mTypeBytes;
+ bool mSpecialInterpretation;
+
+ TypeInfo()
+ : mTypeBytes(0), mSpecialInterpretation(false) { }
+
+ TypeInfo(GLuint typeBytes, bool specialInterpretation)
+ : mTypeBytes(typeBytes), mSpecialInterpretation(specialInterpretation) { }
+
+ bool operator<(const TypeInfo& other) const
+ {
+ return memcmp(this, &other, sizeof(TypeInfo)) < 0;
+ }
+};
+
+typedef std::pair<GLenum, TypeInfo> TypeInfoPair;
+typedef std::map<GLenum, TypeInfo> TypeInfoMap;
+
+static TypeInfoMap BuildTypeInfoMap()
+{
+ TypeInfoMap map;
+
+ map.insert(TypeInfoPair(GL_UNSIGNED_BYTE, TypeInfo( 1, false)));
+ map.insert(TypeInfoPair(GL_BYTE, TypeInfo( 1, false)));
+ map.insert(TypeInfoPair(GL_UNSIGNED_SHORT, TypeInfo( 2, false)));
+ map.insert(TypeInfoPair(GL_SHORT, TypeInfo( 2, false)));
+ map.insert(TypeInfoPair(GL_UNSIGNED_INT, TypeInfo( 4, false)));
+ map.insert(TypeInfoPair(GL_INT, TypeInfo( 4, false)));
+ map.insert(TypeInfoPair(GL_HALF_FLOAT, TypeInfo( 2, false)));
+ map.insert(TypeInfoPair(GL_HALF_FLOAT_OES, TypeInfo( 2, false)));
+ map.insert(TypeInfoPair(GL_FLOAT, TypeInfo( 4, false)));
+ map.insert(TypeInfoPair(GL_UNSIGNED_SHORT_5_6_5, TypeInfo( 2, true )));
+ map.insert(TypeInfoPair(GL_UNSIGNED_SHORT_4_4_4_4, TypeInfo( 2, true )));
+ map.insert(TypeInfoPair(GL_UNSIGNED_SHORT_5_5_5_1, TypeInfo( 2, true )));
+ map.insert(TypeInfoPair(GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT, TypeInfo( 2, true )));
+ map.insert(TypeInfoPair(GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT, TypeInfo( 2, true )));
+ map.insert(TypeInfoPair(GL_UNSIGNED_INT_2_10_10_10_REV, TypeInfo( 4, true )));
+ map.insert(TypeInfoPair(GL_UNSIGNED_INT_24_8, TypeInfo( 4, true )));
+ map.insert(TypeInfoPair(GL_UNSIGNED_INT_10F_11F_11F_REV, TypeInfo( 4, true )));
+ map.insert(TypeInfoPair(GL_UNSIGNED_INT_5_9_9_9_REV, TypeInfo( 4, true )));
+ map.insert(TypeInfoPair(GL_UNSIGNED_INT_24_8_OES, TypeInfo( 4, true )));
+ map.insert(TypeInfoPair(GL_FLOAT_32_UNSIGNED_INT_24_8_REV, TypeInfo( 8, true )));
+
+ return map;
+}
+
+static bool GetTypeInfo(GLenum type, TypeInfo *outTypeInfo)
+{
+ static const TypeInfoMap infoMap = BuildTypeInfoMap();
+ TypeInfoMap::const_iterator iter = infoMap.find(type);
+ if (iter != infoMap.end())
+ {
+ if (outTypeInfo)
+ {
+ *outTypeInfo = iter->second;
+ }
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+// Information about internal formats
+typedef bool ((Context::*ContextSupportCheckMemberFunction)(void) const);
+typedef bool (*ContextSupportCheckFunction)(const Context *context);
+
+typedef bool ((rx::Renderer::*RendererSupportCheckMemberFunction)(void) const);
+typedef bool (*ContextRendererSupportCheckFunction)(const Context *context, const rx::Renderer *renderer);
+
+template <ContextSupportCheckMemberFunction func>
+bool CheckSupport(const Context *context)
+{
+ return (context->*func)();
+}
+
+template <ContextSupportCheckMemberFunction contextFunc, RendererSupportCheckMemberFunction rendererFunc>
+bool CheckSupport(const Context *context, const rx::Renderer *renderer)
+{
+ if (context)
+ {
+ return (context->*contextFunc)();
+ }
+ else if (renderer)
+ {
+ return (renderer->*rendererFunc)();
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+template <typename objectType>
+bool AlwaysSupported(const objectType*)
+{
+ return true;
+}
+
+template <typename objectTypeA, typename objectTypeB>
+bool AlwaysSupported(const objectTypeA*, const objectTypeB*)
+{
+ return true;
+}
+
+template <typename objectType>
+bool NeverSupported(const objectType*)
+{
+ return false;
+}
+
+template <typename objectTypeA, typename objectTypeB>
+bool NeverSupported(const objectTypeA *, const objectTypeB *)
+{
+ return false;
+}
+
+template <typename objectType>
+bool UnimplementedSupport(const objectType*)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+template <typename objectTypeA, typename objectTypeB>
+bool UnimplementedSupport(const objectTypeA*, const objectTypeB*)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+struct InternalFormatInfo
+{
+ GLuint mRedBits;
+ GLuint mGreenBits;
+ GLuint mBlueBits;
+
+ GLuint mLuminanceBits;
+
+ GLuint mAlphaBits;
+ GLuint mSharedBits;
+
+ GLuint mDepthBits;
+ GLuint mStencilBits;
+
+ GLuint mPixelBits;
+
+ GLuint mComponentCount;
+
+ GLuint mCompressedBlockWidth;
+ GLuint mCompressedBlockHeight;
+
+ GLenum mFormat;
+ GLenum mType;
+
+ GLenum mComponentType;
+ GLenum mColorEncoding;
+
+ bool mIsCompressed;
+
+ ContextRendererSupportCheckFunction mIsColorRenderable;
+ ContextRendererSupportCheckFunction mIsDepthRenderable;
+ ContextRendererSupportCheckFunction mIsStencilRenderable;
+ ContextRendererSupportCheckFunction mIsTextureFilterable;
+
+ ContextSupportCheckFunction mSupportFunction;
+
+ InternalFormatInfo() : mRedBits(0), mGreenBits(0), mBlueBits(0), mLuminanceBits(0), mAlphaBits(0), mSharedBits(0), mDepthBits(0), mStencilBits(0),
+ mPixelBits(0), mComponentCount(0), mCompressedBlockWidth(0), mCompressedBlockHeight(0), mFormat(GL_NONE), mType(GL_NONE),
+ mComponentType(GL_NONE), mColorEncoding(GL_NONE), mIsCompressed(false), mIsColorRenderable(NeverSupported),
+ mIsDepthRenderable(NeverSupported), mIsStencilRenderable(NeverSupported), mIsTextureFilterable(NeverSupported),
+ mSupportFunction(NeverSupported)
+ {
+ }
+
+ static InternalFormatInfo UnsizedFormat(GLenum format, ContextSupportCheckFunction supportFunction)
+ {
+ InternalFormatInfo formatInfo;
+ formatInfo.mFormat = format;
+ formatInfo.mSupportFunction = supportFunction;
+
+ if (format == GL_RGB || format == GL_RGBA)
+ formatInfo.mIsColorRenderable = AlwaysSupported;
+
+ return formatInfo;
+ }
+
+ static InternalFormatInfo RGBAFormat(GLuint red, GLuint green, GLuint blue, GLuint alpha, GLuint shared,
+ GLenum format, GLenum type, GLenum componentType, bool srgb,
+ ContextRendererSupportCheckFunction colorRenderable,
+ ContextRendererSupportCheckFunction textureFilterable,
+ ContextSupportCheckFunction supportFunction)
+ {
+ InternalFormatInfo formatInfo;
+ formatInfo.mRedBits = red;
+ formatInfo.mGreenBits = green;
+ formatInfo.mBlueBits = blue;
+ formatInfo.mAlphaBits = alpha;
+ formatInfo.mSharedBits = shared;
+ formatInfo.mPixelBits = red + green + blue + alpha + shared;
+ formatInfo.mComponentCount = ((red > 0) ? 1 : 0) + ((green > 0) ? 1 : 0) + ((blue > 0) ? 1 : 0) + ((alpha > 0) ? 1 : 0);
+ formatInfo.mFormat = format;
+ formatInfo.mType = type;
+ formatInfo.mComponentType = componentType;
+ formatInfo.mColorEncoding = (srgb ? GL_SRGB : GL_LINEAR);
+ formatInfo.mIsColorRenderable = colorRenderable;
+ formatInfo.mIsTextureFilterable = textureFilterable;
+ formatInfo.mSupportFunction = supportFunction;
+ return formatInfo;
+ }
+
+ static InternalFormatInfo LUMAFormat(GLuint luminance, GLuint alpha, GLenum format, GLenum type, GLenum componentType,
+ ContextSupportCheckFunction supportFunction)
+ {
+ InternalFormatInfo formatInfo;
+ formatInfo.mLuminanceBits = luminance;
+ formatInfo.mAlphaBits = alpha;
+ formatInfo.mPixelBits = luminance + alpha;
+ formatInfo.mComponentCount = ((luminance > 0) ? 1 : 0) + ((alpha > 0) ? 1 : 0);
+ formatInfo.mFormat = format;
+ formatInfo.mType = type;
+ formatInfo.mComponentType = componentType;
+ formatInfo.mColorEncoding = GL_LINEAR;
+ formatInfo.mIsTextureFilterable = AlwaysSupported;
+ formatInfo.mSupportFunction = supportFunction;
+ return formatInfo;
+ }
+
+ static InternalFormatInfo DepthStencilFormat(GLuint depthBits, GLuint stencilBits, GLuint unusedBits, GLenum format,
+ GLenum type, GLenum componentType,
+ ContextRendererSupportCheckFunction depthRenderable,
+ ContextRendererSupportCheckFunction stencilRenderable,
+ ContextSupportCheckFunction supportFunction)
+ {
+ InternalFormatInfo formatInfo;
+ formatInfo.mDepthBits = depthBits;
+ formatInfo.mStencilBits = stencilBits;
+ formatInfo.mPixelBits = depthBits + stencilBits + unusedBits;
+ formatInfo.mComponentCount = ((depthBits > 0) ? 1 : 0) + ((stencilBits > 0) ? 1 : 0);
+ formatInfo.mFormat = format;
+ formatInfo.mType = type;
+ formatInfo.mComponentType = componentType;
+ formatInfo.mColorEncoding = GL_LINEAR;
+ formatInfo.mIsDepthRenderable = depthRenderable;
+ formatInfo.mIsStencilRenderable = stencilRenderable;
+ formatInfo.mIsTextureFilterable = AlwaysSupported;
+ formatInfo.mSupportFunction = supportFunction;
+ return formatInfo;
+ }
+
+ static InternalFormatInfo CompressedFormat(GLuint compressedBlockWidth, GLuint compressedBlockHeight, GLuint compressedBlockSize,
+ GLuint componentCount, GLenum format, GLenum type, bool srgb,
+ ContextSupportCheckFunction supportFunction)
+ {
+ InternalFormatInfo formatInfo;
+ formatInfo.mCompressedBlockWidth = compressedBlockWidth;
+ formatInfo.mCompressedBlockHeight = compressedBlockHeight;
+ formatInfo.mPixelBits = compressedBlockSize;
+ formatInfo.mComponentCount = componentCount;
+ formatInfo.mFormat = format;
+ formatInfo.mType = type;
+ formatInfo.mComponentType = GL_UNSIGNED_NORMALIZED;
+ formatInfo.mColorEncoding = (srgb ? GL_SRGB : GL_LINEAR);
+ formatInfo.mIsCompressed = true;
+ formatInfo.mIsTextureFilterable = AlwaysSupported;
+ formatInfo.mSupportFunction = supportFunction;
+ return formatInfo;
+ }
+};
+
+typedef std::pair<GLenum, InternalFormatInfo> InternalFormatInfoPair;
+typedef std::map<GLenum, InternalFormatInfo> InternalFormatInfoMap;
+
+static InternalFormatInfoMap BuildES3InternalFormatInfoMap()
+{
+ InternalFormatInfoMap map;
+
+ // From ES 3.0.1 spec, table 3.12
+ map.insert(InternalFormatInfoPair(GL_NONE, InternalFormatInfo()));
+
+ // | Internal format | | R | G | B | A |S | Format | Type | Component type | SRGB | Color | Texture | Supported |
+ // | | | | | | | | | | | | renderable | filterable | |
+ map.insert(InternalFormatInfoPair(GL_R8, InternalFormatInfo::RGBAFormat( 8, 0, 0, 0, 0, GL_RED, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_R8_SNORM, InternalFormatInfo::RGBAFormat( 8, 0, 0, 0, 0, GL_RED, GL_BYTE, GL_SIGNED_NORMALIZED, false, NeverSupported, AlwaysSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RG8, InternalFormatInfo::RGBAFormat( 8, 8, 0, 0, 0, GL_RG, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RG8_SNORM, InternalFormatInfo::RGBAFormat( 8, 8, 0, 0, 0, GL_RG, GL_BYTE, GL_SIGNED_NORMALIZED, false, NeverSupported, AlwaysSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RGB8, InternalFormatInfo::RGBAFormat( 8, 8, 8, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RGB8_SNORM, InternalFormatInfo::RGBAFormat( 8, 8, 8, 0, 0, GL_RGB, GL_BYTE, GL_SIGNED_NORMALIZED, false, NeverSupported, AlwaysSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RGB565, InternalFormatInfo::RGBAFormat( 5, 6, 5, 0, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RGBA4, InternalFormatInfo::RGBAFormat( 4, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RGB5_A1, InternalFormatInfo::RGBAFormat( 5, 5, 5, 1, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RGBA8, InternalFormatInfo::RGBAFormat( 8, 8, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RGBA8_SNORM, InternalFormatInfo::RGBAFormat( 8, 8, 8, 8, 0, GL_RGBA, GL_BYTE, GL_SIGNED_NORMALIZED, false, NeverSupported, AlwaysSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RGB10_A2, InternalFormatInfo::RGBAFormat(10, 10, 10, 2, 0, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RGB10_A2UI, InternalFormatInfo::RGBAFormat(10, 10, 10, 2, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT, false, AlwaysSupported, NeverSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_SRGB8, InternalFormatInfo::RGBAFormat( 8, 8, 8, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, true, NeverSupported, AlwaysSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_SRGB8_ALPHA8, InternalFormatInfo::RGBAFormat( 8, 8, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, true, AlwaysSupported, AlwaysSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_R11F_G11F_B10F, InternalFormatInfo::RGBAFormat(11, 11, 10, 0, 0, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, GL_FLOAT, false, AlwaysSupported, AlwaysSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RGB9_E5, InternalFormatInfo::RGBAFormat( 9, 9, 9, 0, 5, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV, GL_FLOAT, false, NeverSupported, AlwaysSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_R8I, InternalFormatInfo::RGBAFormat( 8, 0, 0, 0, 0, GL_RED_INTEGER, GL_BYTE, GL_INT, false, AlwaysSupported, NeverSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_R8UI, InternalFormatInfo::RGBAFormat( 8, 0, 0, 0, 0, GL_RED_INTEGER, GL_UNSIGNED_BYTE, GL_UNSIGNED_INT, false, AlwaysSupported, NeverSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_R16I, InternalFormatInfo::RGBAFormat(16, 0, 0, 0, 0, GL_RED_INTEGER, GL_SHORT, GL_INT, false, AlwaysSupported, NeverSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_R16UI, InternalFormatInfo::RGBAFormat(16, 0, 0, 0, 0, GL_RED_INTEGER, GL_UNSIGNED_SHORT, GL_UNSIGNED_INT, false, AlwaysSupported, NeverSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_R32I, InternalFormatInfo::RGBAFormat(32, 0, 0, 0, 0, GL_RED_INTEGER, GL_INT, GL_INT, false, AlwaysSupported, NeverSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_R32UI, InternalFormatInfo::RGBAFormat(32, 0, 0, 0, 0, GL_RED_INTEGER, GL_UNSIGNED_INT, GL_UNSIGNED_INT, false, AlwaysSupported, NeverSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RG8I, InternalFormatInfo::RGBAFormat( 8, 8, 0, 0, 0, GL_RG_INTEGER, GL_BYTE, GL_INT, false, AlwaysSupported, NeverSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RG8UI, InternalFormatInfo::RGBAFormat( 8, 8, 0, 0, 0, GL_RG_INTEGER, GL_UNSIGNED_BYTE, GL_UNSIGNED_INT, false, AlwaysSupported, NeverSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RG16I, InternalFormatInfo::RGBAFormat(16, 16, 0, 0, 0, GL_RG_INTEGER, GL_SHORT, GL_INT, false, AlwaysSupported, NeverSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RG16UI, InternalFormatInfo::RGBAFormat(16, 16, 0, 0, 0, GL_RG_INTEGER, GL_UNSIGNED_SHORT, GL_UNSIGNED_INT, false, AlwaysSupported, NeverSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RG32I, InternalFormatInfo::RGBAFormat(32, 32, 0, 0, 0, GL_RG_INTEGER, GL_INT, GL_INT, false, AlwaysSupported, NeverSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RG32UI, InternalFormatInfo::RGBAFormat(32, 32, 0, 0, 0, GL_RG_INTEGER, GL_UNSIGNED_INT, GL_UNSIGNED_INT, false, AlwaysSupported, NeverSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RGB8I, InternalFormatInfo::RGBAFormat( 8, 8, 8, 0, 0, GL_RGB_INTEGER, GL_BYTE, GL_INT, false, NeverSupported, NeverSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RGB8UI, InternalFormatInfo::RGBAFormat( 8, 8, 8, 0, 0, GL_RGB_INTEGER, GL_UNSIGNED_BYTE, GL_UNSIGNED_INT, false, NeverSupported, NeverSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RGB16I, InternalFormatInfo::RGBAFormat(16, 16, 16, 0, 0, GL_RGB_INTEGER, GL_SHORT, GL_INT, false, NeverSupported, NeverSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RGB16UI, InternalFormatInfo::RGBAFormat(16, 16, 16, 0, 0, GL_RGB_INTEGER, GL_UNSIGNED_SHORT, GL_UNSIGNED_INT, false, NeverSupported, NeverSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RGB32I, InternalFormatInfo::RGBAFormat(32, 32, 32, 0, 0, GL_RGB_INTEGER, GL_INT, GL_INT, false, NeverSupported, NeverSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RGB32UI, InternalFormatInfo::RGBAFormat(32, 32, 32, 0, 0, GL_RGB_INTEGER, GL_UNSIGNED_INT, GL_UNSIGNED_INT, false, NeverSupported, NeverSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RGBA8I, InternalFormatInfo::RGBAFormat( 8, 8, 8, 8, 0, GL_RGBA_INTEGER, GL_BYTE, GL_INT, false, AlwaysSupported, NeverSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RGBA8UI, InternalFormatInfo::RGBAFormat( 8, 8, 8, 8, 0, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE, GL_UNSIGNED_INT, false, AlwaysSupported, NeverSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RGBA16I, InternalFormatInfo::RGBAFormat(16, 16, 16, 16, 0, GL_RGBA_INTEGER, GL_SHORT, GL_INT, false, AlwaysSupported, NeverSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RGBA16UI, InternalFormatInfo::RGBAFormat(16, 16, 16, 16, 0, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT, GL_UNSIGNED_INT, false, AlwaysSupported, NeverSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RGBA32I, InternalFormatInfo::RGBAFormat(32, 32, 32, 32, 0, GL_RGBA_INTEGER, GL_INT, GL_INT, false, AlwaysSupported, NeverSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RGBA32UI, InternalFormatInfo::RGBAFormat(32, 32, 32, 32, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT, GL_UNSIGNED_INT, false, AlwaysSupported, NeverSupported, AlwaysSupported )));
+
+ map.insert(InternalFormatInfoPair(GL_BGRA8_EXT, InternalFormatInfo::RGBAFormat( 8, 8, 8, 8, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_BGRA4_ANGLEX, InternalFormatInfo::RGBAFormat( 4, 4, 4, 4, 0, GL_BGRA_EXT, GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_BGR5_A1_ANGLEX, InternalFormatInfo::RGBAFormat( 5, 5, 5, 1, 0, GL_BGRA_EXT, GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported )));
+
+ // Floating point renderability and filtering is provided by OES_texture_float and OES_texture_half_float
+ // | Internal format | | D |S | Format | Type | Comp | SRGB | Color renderable | Texture filterable | Supported |
+ // | | | | | | | type | | | | |
+ map.insert(InternalFormatInfoPair(GL_R16F, InternalFormatInfo::RGBAFormat(16, 0, 0, 0, 0, GL_RED, GL_HALF_FLOAT, GL_FLOAT, false, CheckSupport<&Context::supportsFloat16RenderableTextures, &rx::Renderer::getFloat16TextureRenderingSupport>, CheckSupport<&Context::supportsFloat16LinearFilter, &rx::Renderer::getFloat16TextureFilteringSupport>, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RG16F, InternalFormatInfo::RGBAFormat(16, 16, 0, 0, 0, GL_RG, GL_HALF_FLOAT, GL_FLOAT, false, CheckSupport<&Context::supportsFloat16RenderableTextures, &rx::Renderer::getFloat16TextureRenderingSupport>, CheckSupport<&Context::supportsFloat16LinearFilter, &rx::Renderer::getFloat16TextureFilteringSupport>, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RGB16F, InternalFormatInfo::RGBAFormat(16, 16, 16, 0, 0, GL_RGB, GL_HALF_FLOAT, GL_FLOAT, false, CheckSupport<&Context::supportsFloat16RenderableTextures, &rx::Renderer::getFloat16TextureRenderingSupport>, CheckSupport<&Context::supportsFloat16LinearFilter, &rx::Renderer::getFloat16TextureFilteringSupport>, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RGBA16F, InternalFormatInfo::RGBAFormat(16, 16, 16, 16, 0, GL_RGBA, GL_HALF_FLOAT, GL_FLOAT, false, CheckSupport<&Context::supportsFloat16RenderableTextures, &rx::Renderer::getFloat16TextureRenderingSupport>, CheckSupport<&Context::supportsFloat16LinearFilter, &rx::Renderer::getFloat16TextureFilteringSupport>, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_R32F, InternalFormatInfo::RGBAFormat(32, 0, 0, 0, 0, GL_RED, GL_FLOAT, GL_FLOAT, false, CheckSupport<&Context::supportsFloat32RenderableTextures, &rx::Renderer::getFloat32TextureRenderingSupport>, CheckSupport<&Context::supportsFloat32LinearFilter, &rx::Renderer::getFloat32TextureFilteringSupport>, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RG32F, InternalFormatInfo::RGBAFormat(32, 32, 0, 0, 0, GL_RG, GL_FLOAT, GL_FLOAT, false, CheckSupport<&Context::supportsFloat32RenderableTextures, &rx::Renderer::getFloat32TextureRenderingSupport>, CheckSupport<&Context::supportsFloat32LinearFilter, &rx::Renderer::getFloat32TextureFilteringSupport>, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RGB32F, InternalFormatInfo::RGBAFormat(32, 32, 32, 0, 0, GL_RGB, GL_FLOAT, GL_FLOAT, false, CheckSupport<&Context::supportsFloat32RenderableTextures, &rx::Renderer::getFloat32TextureRenderingSupport>, CheckSupport<&Context::supportsFloat32LinearFilter, &rx::Renderer::getFloat32TextureFilteringSupport>, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RGBA32F, InternalFormatInfo::RGBAFormat(32, 32, 32, 32, 0, GL_RGBA, GL_FLOAT, GL_FLOAT, false, CheckSupport<&Context::supportsFloat32RenderableTextures, &rx::Renderer::getFloat32TextureRenderingSupport>, CheckSupport<&Context::supportsFloat32LinearFilter, &rx::Renderer::getFloat32TextureFilteringSupport>, AlwaysSupported )));
+
+ // Depth stencil formats
+ // | Internal format | | D |S | X | Format | Type | Component type | Depth | Stencil | Supported |
+ // | | | | | | | | | renderable | renderable | |
+ map.insert(InternalFormatInfoPair(GL_DEPTH_COMPONENT16, InternalFormatInfo::DepthStencilFormat(16, 0, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, GL_UNSIGNED_NORMALIZED, AlwaysSupported, NeverSupported, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_DEPTH_COMPONENT24, InternalFormatInfo::DepthStencilFormat(24, 0, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, GL_UNSIGNED_NORMALIZED, AlwaysSupported, NeverSupported, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_DEPTH_COMPONENT32F, InternalFormatInfo::DepthStencilFormat(32, 0, 0, GL_DEPTH_COMPONENT, GL_FLOAT, GL_FLOAT, AlwaysSupported, NeverSupported, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_DEPTH_COMPONENT32_OES, InternalFormatInfo::DepthStencilFormat(32, 0, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, GL_UNSIGNED_NORMALIZED, AlwaysSupported, NeverSupported, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_DEPTH24_STENCIL8, InternalFormatInfo::DepthStencilFormat(24, 8, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, GL_UNSIGNED_NORMALIZED, AlwaysSupported, AlwaysSupported, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_DEPTH32F_STENCIL8, InternalFormatInfo::DepthStencilFormat(32, 8, 24, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, GL_FLOAT, AlwaysSupported, AlwaysSupported, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_STENCIL_INDEX8, InternalFormatInfo::DepthStencilFormat( 0, 8, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_BYTE, GL_UNSIGNED_INT, NeverSupported, AlwaysSupported, AlwaysSupported)));
+
+ // Luminance alpha formats
+ // | Internal format | | L | A | Format | Type | Component type | Supported |
+ map.insert(InternalFormatInfoPair(GL_ALPHA8_EXT, InternalFormatInfo::LUMAFormat( 0, 8, GL_ALPHA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_LUMINANCE8_EXT, InternalFormatInfo::LUMAFormat( 8, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_ALPHA32F_EXT, InternalFormatInfo::LUMAFormat( 0, 32, GL_ALPHA, GL_FLOAT, GL_FLOAT, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_LUMINANCE32F_EXT, InternalFormatInfo::LUMAFormat(32, 0, GL_LUMINANCE, GL_FLOAT, GL_FLOAT, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_ALPHA16F_EXT, InternalFormatInfo::LUMAFormat( 0, 16, GL_ALPHA, GL_HALF_FLOAT, GL_FLOAT, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_LUMINANCE16F_EXT, InternalFormatInfo::LUMAFormat(16, 0, GL_LUMINANCE, GL_HALF_FLOAT, GL_FLOAT, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_LUMINANCE8_ALPHA8_EXT, InternalFormatInfo::LUMAFormat( 8, 8, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_LUMINANCE_ALPHA32F_EXT, InternalFormatInfo::LUMAFormat(32, 32, GL_LUMINANCE_ALPHA, GL_FLOAT, GL_FLOAT, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_LUMINANCE_ALPHA16F_EXT, InternalFormatInfo::LUMAFormat(16, 16, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT, GL_FLOAT, AlwaysSupported)));
+
+ // Unsized formats
+ // | Internal format | | Format | Supported |
+ map.insert(InternalFormatInfoPair(GL_ALPHA, InternalFormatInfo::UnsizedFormat(GL_ALPHA, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_LUMINANCE, InternalFormatInfo::UnsizedFormat(GL_LUMINANCE, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_LUMINANCE_ALPHA, InternalFormatInfo::UnsizedFormat(GL_LUMINANCE_ALPHA, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_RED, InternalFormatInfo::UnsizedFormat(GL_RED, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_RG, InternalFormatInfo::UnsizedFormat(GL_RG, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_RGB, InternalFormatInfo::UnsizedFormat(GL_RGB, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_RGBA, InternalFormatInfo::UnsizedFormat(GL_RGBA, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_RED_INTEGER, InternalFormatInfo::UnsizedFormat(GL_RED_INTEGER, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_RG_INTEGER, InternalFormatInfo::UnsizedFormat(GL_RG_INTEGER, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_RGB_INTEGER, InternalFormatInfo::UnsizedFormat(GL_RGB_INTEGER, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_RGBA_INTEGER, InternalFormatInfo::UnsizedFormat(GL_RGBA_INTEGER, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_BGRA_EXT, InternalFormatInfo::UnsizedFormat(GL_BGRA_EXT, AlwaysSupported)));
+
+ // Compressed formats, From ES 3.0.1 spec, table 3.16
+ // | Internal format | |W |H | BS |CC| Format | Type | SRGB | Supported |
+ map.insert(InternalFormatInfoPair(GL_COMPRESSED_R11_EAC, InternalFormatInfo::CompressedFormat(4, 4, 64, 1, GL_COMPRESSED_R11_EAC, GL_UNSIGNED_BYTE, false, UnimplementedSupport)));
+ map.insert(InternalFormatInfoPair(GL_COMPRESSED_SIGNED_R11_EAC, InternalFormatInfo::CompressedFormat(4, 4, 64, 1, GL_COMPRESSED_SIGNED_R11_EAC, GL_UNSIGNED_BYTE, false, UnimplementedSupport)));
+ map.insert(InternalFormatInfoPair(GL_COMPRESSED_RG11_EAC, InternalFormatInfo::CompressedFormat(4, 4, 128, 2, GL_COMPRESSED_RG11_EAC, GL_UNSIGNED_BYTE, false, UnimplementedSupport)));
+ map.insert(InternalFormatInfoPair(GL_COMPRESSED_SIGNED_RG11_EAC, InternalFormatInfo::CompressedFormat(4, 4, 128, 2, GL_COMPRESSED_SIGNED_RG11_EAC, GL_UNSIGNED_BYTE, false, UnimplementedSupport)));
+ map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGB8_ETC2, InternalFormatInfo::CompressedFormat(4, 4, 64, 3, GL_COMPRESSED_RGB8_ETC2, GL_UNSIGNED_BYTE, false, UnimplementedSupport)));
+ map.insert(InternalFormatInfoPair(GL_COMPRESSED_SRGB8_ETC2, InternalFormatInfo::CompressedFormat(4, 4, 64, 3, GL_COMPRESSED_SRGB8_ETC2, GL_UNSIGNED_BYTE, true, UnimplementedSupport)));
+ map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, InternalFormatInfo::CompressedFormat(4, 4, 64, 3, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_UNSIGNED_BYTE, false, UnimplementedSupport)));
+ map.insert(InternalFormatInfoPair(GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, InternalFormatInfo::CompressedFormat(4, 4, 64, 3, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_UNSIGNED_BYTE, true, UnimplementedSupport)));
+ map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGBA8_ETC2_EAC, InternalFormatInfo::CompressedFormat(4, 4, 128, 4, GL_COMPRESSED_RGBA8_ETC2_EAC, GL_UNSIGNED_BYTE, false, UnimplementedSupport)));
+ map.insert(InternalFormatInfoPair(GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, InternalFormatInfo::CompressedFormat(4, 4, 128, 4, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, GL_UNSIGNED_BYTE, true, UnimplementedSupport)));
+
+ // From GL_EXT_texture_compression_dxt1
+ // | Internal format | |W |H | BS |CC| Format | Type | SRGB | Supported |
+ map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGB_S3TC_DXT1_EXT, InternalFormatInfo::CompressedFormat(4, 4, 64, 3, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_UNSIGNED_BYTE, false, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, InternalFormatInfo::CompressedFormat(4, 4, 64, 4, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, GL_UNSIGNED_BYTE, false, AlwaysSupported)));
+
+ // From GL_ANGLE_texture_compression_dxt3
+ map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, InternalFormatInfo::CompressedFormat(4, 4, 128, 4, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, GL_UNSIGNED_BYTE, false, AlwaysSupported)));
+
+ // From GL_ANGLE_texture_compression_dxt5
+ map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, InternalFormatInfo::CompressedFormat(4, 4, 128, 4, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, GL_UNSIGNED_BYTE, false, AlwaysSupported)));
+
+ return map;
+}
+
+static InternalFormatInfoMap BuildES2InternalFormatInfoMap()
+{
+ InternalFormatInfoMap map;
+
+ // From ES 2.0.25 table 4.5
+ map.insert(InternalFormatInfoPair(GL_NONE, InternalFormatInfo()));
+
+ // | Internal format | | R | G | B | A |S | Format | Type | Component type | SRGB | Color | Texture | Supported |
+ // | | | | | | | | | | | | renderable | filterable | |
+ map.insert(InternalFormatInfoPair(GL_RGBA4, InternalFormatInfo::RGBAFormat( 4, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_RGB5_A1, InternalFormatInfo::RGBAFormat( 5, 5, 5, 1, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_RGB565, InternalFormatInfo::RGBAFormat( 5, 6, 5, 0, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported)));
+
+ // Extension formats
+ map.insert(InternalFormatInfoPair(GL_R8_EXT, InternalFormatInfo::RGBAFormat( 8, 0, 0, 0, 0, GL_RED_EXT, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures>)));
+ map.insert(InternalFormatInfoPair(GL_RG8_EXT, InternalFormatInfo::RGBAFormat( 8, 8, 0, 0, 0, GL_RG_EXT, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures>)));
+ map.insert(InternalFormatInfoPair(GL_RGB8_OES, InternalFormatInfo::RGBAFormat( 8, 8, 8, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_RGBA8_OES, InternalFormatInfo::RGBAFormat( 8, 8, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_BGRA8_EXT, InternalFormatInfo::RGBAFormat( 8, 8, 8, 8, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_BGRA4_ANGLEX, InternalFormatInfo::RGBAFormat( 4, 4, 4, 4, 0, GL_BGRA_EXT, GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_NORMALIZED, false, NeverSupported, AlwaysSupported, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_BGR5_A1_ANGLEX, InternalFormatInfo::RGBAFormat( 5, 5, 5, 1, 0, GL_BGRA_EXT, GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_NORMALIZED, false, NeverSupported, AlwaysSupported, AlwaysSupported)));
+
+ // Floating point formats have to query the renderer for support
+ // | Internal format | | R | G | B | A |S | Format | Type | Comp | SRGB | Color renderable | Texture filterable | Supported |
+ // | | | | | | | | | | type | | | | |
+ map.insert(InternalFormatInfoPair(GL_R16F_EXT, InternalFormatInfo::RGBAFormat(16, 0, 0, 0, 0, GL_RED, GL_HALF_FLOAT_OES, GL_FLOAT, false, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures> )));
+ map.insert(InternalFormatInfoPair(GL_R32F_EXT, InternalFormatInfo::RGBAFormat(32, 0, 0, 0, 0, GL_RED, GL_FLOAT, GL_FLOAT, false, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures> )));
+ map.insert(InternalFormatInfoPair(GL_RG16F_EXT, InternalFormatInfo::RGBAFormat(16, 16, 0, 0, 0, GL_RG, GL_HALF_FLOAT_OES, GL_FLOAT, false, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures> )));
+ map.insert(InternalFormatInfoPair(GL_RG32F_EXT, InternalFormatInfo::RGBAFormat(32, 32, 0, 0, 0, GL_RG, GL_FLOAT, GL_FLOAT, false, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures> )));
+ map.insert(InternalFormatInfoPair(GL_RGB16F_EXT, InternalFormatInfo::RGBAFormat(16, 16, 16, 0, 0, GL_RGB, GL_HALF_FLOAT_OES, GL_FLOAT, false, CheckSupport<&Context::supportsFloat16RenderableTextures, &rx::Renderer::getFloat16TextureRenderingSupport>, CheckSupport<&Context::supportsFloat16LinearFilter, &rx::Renderer::getFloat16TextureFilteringSupport>, CheckSupport<&Context::supportsFloat16Textures>)));
+ map.insert(InternalFormatInfoPair(GL_RGB32F_EXT, InternalFormatInfo::RGBAFormat(32, 32, 32, 0, 0, GL_RGB, GL_FLOAT, GL_FLOAT, false, CheckSupport<&Context::supportsFloat32RenderableTextures, &rx::Renderer::getFloat32TextureRenderingSupport>, CheckSupport<&Context::supportsFloat32LinearFilter, &rx::Renderer::getFloat32TextureFilteringSupport>, CheckSupport<&Context::supportsFloat32Textures>)));
+ map.insert(InternalFormatInfoPair(GL_RGBA16F_EXT, InternalFormatInfo::RGBAFormat(16, 16, 16, 16, 0, GL_RGBA, GL_HALF_FLOAT_OES, GL_FLOAT, false, CheckSupport<&Context::supportsFloat16RenderableTextures, &rx::Renderer::getFloat16TextureRenderingSupport>, CheckSupport<&Context::supportsFloat16LinearFilter, &rx::Renderer::getFloat16TextureFilteringSupport>, CheckSupport<&Context::supportsFloat16Textures>)));
+ map.insert(InternalFormatInfoPair(GL_RGBA32F_EXT, InternalFormatInfo::RGBAFormat(32, 32, 32, 32, 0, GL_RGBA, GL_FLOAT, GL_FLOAT, false, CheckSupport<&Context::supportsFloat32RenderableTextures, &rx::Renderer::getFloat32TextureRenderingSupport>, CheckSupport<&Context::supportsFloat32LinearFilter, &rx::Renderer::getFloat32TextureFilteringSupport>, CheckSupport<&Context::supportsFloat32Textures>)));
+
+ // Depth and stencil formats
+ // | Internal format | | D |S |X | Format | Type | Internal format | Depth | Stencil | Supported |
+ // | | | | | | | | type | renderable | renderable | |
+ map.insert(InternalFormatInfoPair(GL_DEPTH_COMPONENT32_OES,InternalFormatInfo::DepthStencilFormat(32, 0, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, GL_UNSIGNED_NORMALIZED, AlwaysSupported, NeverSupported, CheckSupport<&Context::supportsDepthTextures>)));
+ map.insert(InternalFormatInfoPair(GL_DEPTH24_STENCIL8_OES, InternalFormatInfo::DepthStencilFormat(24, 8, 0, GL_DEPTH_STENCIL_OES, GL_UNSIGNED_INT_24_8_OES, GL_UNSIGNED_NORMALIZED, AlwaysSupported, AlwaysSupported, CheckSupport<&Context::supportsDepthTextures>)));
+ map.insert(InternalFormatInfoPair(GL_DEPTH_COMPONENT16, InternalFormatInfo::DepthStencilFormat(16, 0, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, GL_UNSIGNED_NORMALIZED, AlwaysSupported, NeverSupported, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_STENCIL_INDEX8, InternalFormatInfo::DepthStencilFormat( 0, 8, 0, GL_DEPTH_STENCIL_OES, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, NeverSupported, AlwaysSupported, AlwaysSupported)));
+
+ // Unsized formats
+ // | Internal format | | Format | Supported |
+ map.insert(InternalFormatInfoPair(GL_ALPHA, InternalFormatInfo::UnsizedFormat(GL_ALPHA, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_LUMINANCE, InternalFormatInfo::UnsizedFormat(GL_LUMINANCE, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_LUMINANCE_ALPHA, InternalFormatInfo::UnsizedFormat(GL_LUMINANCE_ALPHA, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_RED_EXT, InternalFormatInfo::UnsizedFormat(GL_RED_EXT, CheckSupport<&Context::supportsRGTextures>)));
+ map.insert(InternalFormatInfoPair(GL_RG_EXT, InternalFormatInfo::UnsizedFormat(GL_RG_EXT, CheckSupport<&Context::supportsRGTextures>)));
+ map.insert(InternalFormatInfoPair(GL_RGB, InternalFormatInfo::UnsizedFormat(GL_RGB, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_RGBA, InternalFormatInfo::UnsizedFormat(GL_RGBA, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_BGRA_EXT, InternalFormatInfo::UnsizedFormat(GL_BGRA_EXT, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_DEPTH_COMPONENT, InternalFormatInfo::UnsizedFormat(GL_DEPTH_COMPONENT, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_DEPTH_STENCIL_OES, InternalFormatInfo::UnsizedFormat(GL_DEPTH_STENCIL_OES, AlwaysSupported)));
+
+ // Luminance alpha formats from GL_EXT_texture_storage
+ // | Internal format | | L | A | Format | Type | Component type | Supported |
+ map.insert(InternalFormatInfoPair(GL_ALPHA8_EXT, InternalFormatInfo::LUMAFormat( 0, 8, GL_ALPHA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_LUMINANCE8_EXT, InternalFormatInfo::LUMAFormat( 8, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_ALPHA32F_EXT, InternalFormatInfo::LUMAFormat( 0, 32, GL_ALPHA, GL_FLOAT, GL_FLOAT, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_LUMINANCE32F_EXT, InternalFormatInfo::LUMAFormat(32, 0, GL_LUMINANCE, GL_FLOAT, GL_FLOAT, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_ALPHA16F_EXT, InternalFormatInfo::LUMAFormat( 0, 16, GL_ALPHA, GL_HALF_FLOAT_OES, GL_FLOAT, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_LUMINANCE16F_EXT, InternalFormatInfo::LUMAFormat(16, 0, GL_LUMINANCE, GL_HALF_FLOAT_OES, GL_FLOAT, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_LUMINANCE8_ALPHA8_EXT, InternalFormatInfo::LUMAFormat( 8, 8, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_LUMINANCE_ALPHA32F_EXT, InternalFormatInfo::LUMAFormat(32, 32, GL_LUMINANCE_ALPHA, GL_FLOAT, GL_FLOAT, AlwaysSupported)));
+ map.insert(InternalFormatInfoPair(GL_LUMINANCE_ALPHA16F_EXT, InternalFormatInfo::LUMAFormat(16, 16, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT_OES, GL_FLOAT, AlwaysSupported)));
+
+ // From GL_EXT_texture_compression_dxt1
+ // | Internal format | |W |H | BS |CC|Format | Type | SRGB | Supported |
+ map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGB_S3TC_DXT1_EXT, InternalFormatInfo::CompressedFormat(4, 4, 64, 3, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_UNSIGNED_BYTE, false, CheckSupport<&Context::supportsDXT1Textures>)));
+ map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, InternalFormatInfo::CompressedFormat(4, 4, 64, 4, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, GL_UNSIGNED_BYTE, false, CheckSupport<&Context::supportsDXT1Textures>)));
+
+ // From GL_ANGLE_texture_compression_dxt3
+ map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, InternalFormatInfo::CompressedFormat(4, 4, 128, 4, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, GL_UNSIGNED_BYTE, false, CheckSupport<&Context::supportsDXT3Textures>)));
+
+ // From GL_ANGLE_texture_compression_dxt5
+ map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, InternalFormatInfo::CompressedFormat(4, 4, 128, 4, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, GL_UNSIGNED_BYTE, false, CheckSupport<&Context::supportsDXT5Textures>)));
+
+ return map;
+}
+
+static bool GetInternalFormatInfo(GLenum internalFormat, GLuint clientVersion, InternalFormatInfo *outFormatInfo)
+{
+ const InternalFormatInfoMap* map = NULL;
+
+ if (clientVersion == 2)
+ {
+ static const InternalFormatInfoMap formatMap = BuildES2InternalFormatInfoMap();
+ map = &formatMap;
+ }
+ else if (clientVersion == 3)
+ {
+ static const InternalFormatInfoMap formatMap = BuildES3InternalFormatInfoMap();
+ map = &formatMap;
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+
+ InternalFormatInfoMap::const_iterator iter = map->find(internalFormat);
+ if (iter != map->end())
+ {
+ if (outFormatInfo)
+ {
+ *outFormatInfo = iter->second;
+ }
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+typedef std::set<GLenum> FormatSet;
+
+static FormatSet BuildES2ValidFormatSet()
+{
+ static const FormatMap &formatMap = GetFormatMap(2);
+
+ FormatSet set;
+
+ for (FormatMap::const_iterator i = formatMap.begin(); i != formatMap.end(); i++)
+ {
+ const FormatTypePair& formatPair = i->first;
+ set.insert(formatPair.first);
+ }
+
+ return set;
+}
+
+static FormatSet BuildES3ValidFormatSet()
+{
+ static const ES3FormatSet &formatSet = GetES3FormatSet();
+
+ FormatSet set;
+
+ for (ES3FormatSet::const_iterator i = formatSet.begin(); i != formatSet.end(); i++)
+ {
+ const FormatInfo& formatInfo = *i;
+ set.insert(formatInfo.mFormat);
+ }
+
+ return set;
+}
+
+typedef std::set<GLenum> TypeSet;
+
+static TypeSet BuildES2ValidTypeSet()
+{
+ static const FormatMap &formatMap = GetFormatMap(2);
+
+ TypeSet set;
+
+ for (FormatMap::const_iterator i = formatMap.begin(); i != formatMap.end(); i++)
+ {
+ const FormatTypePair& formatPair = i->first;
+ set.insert(formatPair.second);
+ }
+
+ return set;
+}
+
+static TypeSet BuildES3ValidTypeSet()
+{
+ static const ES3FormatSet &formatSet = GetES3FormatSet();
+
+ TypeSet set;
+
+ for (ES3FormatSet::const_iterator i = formatSet.begin(); i != formatSet.end(); i++)
+ {
+ const FormatInfo& formatInfo = *i;
+ set.insert(formatInfo.mType);
+ }
+
+ return set;
+}
+
+struct EffectiveInternalFormatInfo
+{
+ GLenum mEffectiveFormat;
+ GLenum mDestFormat;
+ GLuint mMinRedBits;
+ GLuint mMaxRedBits;
+ GLuint mMinGreenBits;
+ GLuint mMaxGreenBits;
+ GLuint mMinBlueBits;
+ GLuint mMaxBlueBits;
+ GLuint mMinAlphaBits;
+ GLuint mMaxAlphaBits;
+
+ EffectiveInternalFormatInfo(GLenum effectiveFormat, GLenum destFormat, GLuint minRedBits, GLuint maxRedBits,
+ GLuint minGreenBits, GLuint maxGreenBits, GLuint minBlueBits, GLuint maxBlueBits,
+ GLuint minAlphaBits, GLuint maxAlphaBits)
+ : mEffectiveFormat(effectiveFormat), mDestFormat(destFormat), mMinRedBits(minRedBits),
+ mMaxRedBits(maxRedBits), mMinGreenBits(minGreenBits), mMaxGreenBits(maxGreenBits),
+ mMinBlueBits(minBlueBits), mMaxBlueBits(maxBlueBits), mMinAlphaBits(minAlphaBits),
+ mMaxAlphaBits(maxAlphaBits) {};
+};
+
+typedef std::vector<EffectiveInternalFormatInfo> EffectiveInternalFormatList;
+
+static EffectiveInternalFormatList BuildSizedEffectiveInternalFormatList()
+{
+ EffectiveInternalFormatList list;
+
+ // OpenGL ES 3.0.3 Specification, Table 3.17, pg 141: Effective internal format coresponding to destination internal format and
+ // linear source buffer component sizes.
+ // | Source channel min/max sizes |
+ // Effective Internal Format | N/A | R | G | B | A |
+ list.push_back(EffectiveInternalFormatInfo(GL_ALPHA8_EXT, GL_NONE, 0, 0, 0, 0, 0, 0, 1, 8));
+ list.push_back(EffectiveInternalFormatInfo(GL_R8, GL_NONE, 1, 8, 0, 0, 0, 0, 0, 0));
+ list.push_back(EffectiveInternalFormatInfo(GL_RG8, GL_NONE, 1, 8, 1, 8, 0, 0, 0, 0));
+ list.push_back(EffectiveInternalFormatInfo(GL_RGB565, GL_NONE, 1, 5, 1, 6, 1, 5, 0, 0));
+ list.push_back(EffectiveInternalFormatInfo(GL_RGB8, GL_NONE, 6, 8, 7, 8, 6, 8, 0, 0));
+ list.push_back(EffectiveInternalFormatInfo(GL_RGBA4, GL_NONE, 1, 4, 1, 4, 1, 4, 1, 4));
+ list.push_back(EffectiveInternalFormatInfo(GL_RGB5_A1, GL_NONE, 5, 5, 5, 5, 5, 5, 1, 1));
+ list.push_back(EffectiveInternalFormatInfo(GL_RGBA8, GL_NONE, 5, 8, 5, 8, 5, 8, 2, 8));
+ list.push_back(EffectiveInternalFormatInfo(GL_RGB10_A2, GL_NONE, 9, 10, 9, 10, 9, 10, 2, 2));
+
+ return list;
+}
+
+
+static EffectiveInternalFormatList BuildUnsizedEffectiveInternalFormatList()
+{
+ EffectiveInternalFormatList list;
+
+ // OpenGL ES 3.0.3 Specification, Table 3.17, pg 141: Effective internal format coresponding to destination internal format and
+ // linear source buffer component sizes.
+ // | Source channel min/max sizes |
+ // Effective Internal Format | Dest Format | R | G | B | A |
+ list.push_back(EffectiveInternalFormatInfo(GL_ALPHA8_EXT, GL_ALPHA, 0, UINT_MAX, 0, UINT_MAX, 0, UINT_MAX, 1, 8));
+ list.push_back(EffectiveInternalFormatInfo(GL_LUMINANCE8_EXT, GL_LUMINANCE, 1, 8, 0, UINT_MAX, 0, UINT_MAX, 0, UINT_MAX));
+ list.push_back(EffectiveInternalFormatInfo(GL_LUMINANCE8_ALPHA8_EXT, GL_LUMINANCE_ALPHA, 1, 8, 0, UINT_MAX, 0, UINT_MAX, 1, 8));
+ list.push_back(EffectiveInternalFormatInfo(GL_RGB565, GL_RGB, 1, 5, 1, 6, 1, 5, 0, UINT_MAX));
+ list.push_back(EffectiveInternalFormatInfo(GL_RGB8, GL_RGB, 6, 8, 7, 8, 6, 8, 0, UINT_MAX));
+ list.push_back(EffectiveInternalFormatInfo(GL_RGBA4, GL_RGBA, 1, 4, 1, 4, 1, 4, 1, 4));
+ list.push_back(EffectiveInternalFormatInfo(GL_RGB5_A1, GL_RGBA, 5, 5, 5, 5, 5, 5, 1, 1));
+ list.push_back(EffectiveInternalFormatInfo(GL_RGBA8, GL_RGBA, 5, 8, 5, 8, 5, 8, 5, 8));
+
+ return list;
+}
+
+static bool GetEffectiveInternalFormat(const InternalFormatInfo &srcFormat, const InternalFormatInfo &destFormat,
+ GLuint clientVersion, GLenum *outEffectiveFormat)
+{
+ const EffectiveInternalFormatList *list = NULL;
+ GLenum targetFormat = GL_NONE;
+
+ if (gl::IsSizedInternalFormat(destFormat.mFormat, clientVersion))
+ {
+ static const EffectiveInternalFormatList sizedList = BuildSizedEffectiveInternalFormatList();
+ list = &sizedList;
+ }
+ else
+ {
+ static const EffectiveInternalFormatList unsizedList = BuildUnsizedEffectiveInternalFormatList();
+ list = &unsizedList;
+ targetFormat = destFormat.mFormat;
+ }
+
+ for (size_t curFormat = 0; curFormat < list->size(); ++curFormat)
+ {
+ const EffectiveInternalFormatInfo& formatInfo = list->at(curFormat);
+ if ((formatInfo.mDestFormat == targetFormat) &&
+ (formatInfo.mMinRedBits <= srcFormat.mRedBits && formatInfo.mMaxRedBits >= srcFormat.mRedBits) &&
+ (formatInfo.mMinGreenBits <= srcFormat.mGreenBits && formatInfo.mMaxGreenBits >= srcFormat.mGreenBits) &&
+ (formatInfo.mMinBlueBits <= srcFormat.mBlueBits && formatInfo.mMaxBlueBits >= srcFormat.mBlueBits) &&
+ (formatInfo.mMinAlphaBits <= srcFormat.mAlphaBits && formatInfo.mMaxAlphaBits >= srcFormat.mAlphaBits))
+ {
+ *outEffectiveFormat = formatInfo.mEffectiveFormat;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+struct CopyConversion
+{
+ GLenum mTextureFormat;
+ GLenum mFramebufferFormat;
+
+ CopyConversion(GLenum textureFormat, GLenum framebufferFormat)
+ : mTextureFormat(textureFormat), mFramebufferFormat(framebufferFormat) { }
+
+ bool operator<(const CopyConversion& other) const
+ {
+ return memcmp(this, &other, sizeof(CopyConversion)) < 0;
+ }
+};
+
+typedef std::set<CopyConversion> CopyConversionSet;
+
+static CopyConversionSet BuildValidES3CopyTexImageCombinations()
+{
+ CopyConversionSet set;
+
+ // From ES 3.0.1 spec, table 3.15
+ set.insert(CopyConversion(GL_ALPHA, GL_RGBA));
+ set.insert(CopyConversion(GL_LUMINANCE, GL_RED));
+ set.insert(CopyConversion(GL_LUMINANCE, GL_RG));
+ set.insert(CopyConversion(GL_LUMINANCE, GL_RGB));
+ set.insert(CopyConversion(GL_LUMINANCE, GL_RGBA));
+ set.insert(CopyConversion(GL_LUMINANCE_ALPHA, GL_RGBA));
+ set.insert(CopyConversion(GL_RED, GL_RED));
+ set.insert(CopyConversion(GL_RED, GL_RG));
+ set.insert(CopyConversion(GL_RED, GL_RGB));
+ set.insert(CopyConversion(GL_RED, GL_RGBA));
+ set.insert(CopyConversion(GL_RG, GL_RG));
+ set.insert(CopyConversion(GL_RG, GL_RGB));
+ set.insert(CopyConversion(GL_RG, GL_RGBA));
+ set.insert(CopyConversion(GL_RGB, GL_RGB));
+ set.insert(CopyConversion(GL_RGB, GL_RGBA));
+ set.insert(CopyConversion(GL_RGBA, GL_RGBA));
+
+ // Necessary for ANGLE back-buffers
+ set.insert(CopyConversion(GL_ALPHA, GL_BGRA_EXT));
+ set.insert(CopyConversion(GL_LUMINANCE, GL_BGRA_EXT));
+ set.insert(CopyConversion(GL_LUMINANCE_ALPHA, GL_BGRA_EXT));
+ set.insert(CopyConversion(GL_RED, GL_BGRA_EXT));
+ set.insert(CopyConversion(GL_RG, GL_BGRA_EXT));
+ set.insert(CopyConversion(GL_RGB, GL_BGRA_EXT));
+ set.insert(CopyConversion(GL_RGBA, GL_BGRA_EXT));
+
+ set.insert(CopyConversion(GL_RED_INTEGER, GL_RED_INTEGER));
+ set.insert(CopyConversion(GL_RED_INTEGER, GL_RG_INTEGER));
+ set.insert(CopyConversion(GL_RED_INTEGER, GL_RGB_INTEGER));
+ set.insert(CopyConversion(GL_RED_INTEGER, GL_RGBA_INTEGER));
+ set.insert(CopyConversion(GL_RG_INTEGER, GL_RG_INTEGER));
+ set.insert(CopyConversion(GL_RG_INTEGER, GL_RGB_INTEGER));
+ set.insert(CopyConversion(GL_RG_INTEGER, GL_RGBA_INTEGER));
+ set.insert(CopyConversion(GL_RGB_INTEGER, GL_RGB_INTEGER));
+ set.insert(CopyConversion(GL_RGB_INTEGER, GL_RGBA_INTEGER));
+ set.insert(CopyConversion(GL_RGBA_INTEGER, GL_RGBA_INTEGER));
+
+ return set;
+}
+
+bool IsValidInternalFormat(GLenum internalFormat, const Context *context)
+{
+ if (!context)
+ {
+ return false;
+ }
+
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, context->getClientVersion(), &internalFormatInfo))
+ {
+ ASSERT(internalFormatInfo.mSupportFunction != NULL);
+ return internalFormatInfo.mSupportFunction(context);
+ }
+ else
+ {
+ return false;
+ }
+}
+
+bool IsValidFormat(GLenum format, GLuint clientVersion)
+{
+ if (clientVersion == 2)
+ {
+ static const FormatSet formatSet = BuildES2ValidFormatSet();
+ return formatSet.find(format) != formatSet.end();
+ }
+ else if (clientVersion == 3)
+ {
+ static const FormatSet formatSet = BuildES3ValidFormatSet();
+ return formatSet.find(format) != formatSet.end();
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool IsValidType(GLenum type, GLuint clientVersion)
+{
+ if (clientVersion == 2)
+ {
+ static const TypeSet typeSet = BuildES2ValidTypeSet();
+ return typeSet.find(type) != typeSet.end();
+ }
+ else if (clientVersion == 3)
+ {
+ static const TypeSet typeSet = BuildES3ValidTypeSet();
+ return typeSet.find(type) != typeSet.end();
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool IsValidFormatCombination(GLenum internalFormat, GLenum format, GLenum type, GLuint clientVersion)
+{
+ if (clientVersion == 2)
+ {
+ static const FormatMap &formats = GetFormatMap(clientVersion);
+ FormatMap::const_iterator iter = formats.find(FormatTypePair(format, type));
+
+ return (iter != formats.end()) && ((internalFormat == (GLint)type) || (internalFormat == iter->second.mInternalFormat));
+ }
+ else if (clientVersion == 3)
+ {
+ static const ES3FormatSet &formats = GetES3FormatSet();
+ return formats.find(FormatInfo(internalFormat, format, type)) != formats.end();
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool IsValidCopyTexImageCombination(GLenum textureInternalFormat, GLenum frameBufferInternalFormat, GLuint readBufferHandle, GLuint clientVersion)
+{
+ InternalFormatInfo textureInternalFormatInfo;
+ InternalFormatInfo framebufferInternalFormatInfo;
+ if (GetInternalFormatInfo(textureInternalFormat, clientVersion, &textureInternalFormatInfo) &&
+ GetInternalFormatInfo(frameBufferInternalFormat, clientVersion, &framebufferInternalFormatInfo))
+ {
+ if (clientVersion == 2)
+ {
+ UNIMPLEMENTED();
+ return false;
+ }
+ else if (clientVersion == 3)
+ {
+ static const CopyConversionSet conversionSet = BuildValidES3CopyTexImageCombinations();
+ const CopyConversion conversion = CopyConversion(textureInternalFormatInfo.mFormat,
+ framebufferInternalFormatInfo.mFormat);
+ if (conversionSet.find(conversion) != conversionSet.end())
+ {
+ // Section 3.8.5 of the GLES 3.0.3 spec states that source and destination formats
+ // must both be signed, unsigned, or fixed point and both source and destinations
+ // must be either both SRGB or both not SRGB. EXT_color_buffer_float adds allowed
+ // conversion between fixed and floating point.
+
+ if ((textureInternalFormatInfo.mColorEncoding == GL_SRGB) != (framebufferInternalFormatInfo.mColorEncoding == GL_SRGB))
+ {
+ return false;
+ }
+
+ if (((textureInternalFormatInfo.mComponentType == GL_INT) != (framebufferInternalFormatInfo.mComponentType == GL_INT)) ||
+ ((textureInternalFormatInfo.mComponentType == GL_UNSIGNED_INT) != (framebufferInternalFormatInfo.mComponentType == GL_UNSIGNED_INT)))
+ {
+ return false;
+ }
+
+ if (gl::IsFloatOrFixedComponentType(textureInternalFormatInfo.mComponentType) &&
+ !gl::IsFloatOrFixedComponentType(framebufferInternalFormatInfo.mComponentType))
+ {
+ return false;
+ }
+
+ // GLES specification 3.0.3, sec 3.8.5, pg 139-140:
+ // The effective internal format of the source buffer is determined with the following rules applied in order:
+ // * If the source buffer is a texture or renderbuffer that was created with a sized internal format then the
+ // effective internal format is the source buffer's sized internal format.
+ // * If the source buffer is a texture that was created with an unsized base internal format, then the
+ // effective internal format is the source image array's effective internal format, as specified by table
+ // 3.12, which is determined from the <format> and <type> that were used when the source image array was
+ // specified by TexImage*.
+ // * Otherwise the effective internal format is determined by the row in table 3.17 or 3.18 where
+ // Destination Internal Format matches internalformat and where the [source channel sizes] are consistent
+ // with the values of the source buffer's [channel sizes]. Table 3.17 is used if the
+ // FRAMEBUFFER_ATTACHMENT_ENCODING is LINEAR and table 3.18 is used if the FRAMEBUFFER_ATTACHMENT_ENCODING
+ // is SRGB.
+ InternalFormatInfo sourceEffectiveFormat;
+ if (readBufferHandle != 0)
+ {
+ // Not the default framebuffer, therefore the read buffer must be a user-created texture or renderbuffer
+ if (gl::IsSizedInternalFormat(framebufferInternalFormatInfo.mFormat, clientVersion))
+ {
+ sourceEffectiveFormat = framebufferInternalFormatInfo;
+ }
+ else
+ {
+ // Renderbuffers cannot be created with an unsized internal format, so this must be an unsized-format
+ // texture. We can use the same table we use when creating textures to get its effective sized format.
+ GLenum effectiveFormat = gl::GetSizedInternalFormat(framebufferInternalFormatInfo.mFormat,
+ framebufferInternalFormatInfo.mType, clientVersion);
+ gl::GetInternalFormatInfo(effectiveFormat, clientVersion, &sourceEffectiveFormat);
+ }
+ }
+ else
+ {
+ // The effective internal format must be derived from the source framebuffer's channel sizes.
+ // This is done in GetEffectiveInternalFormat for linear buffers (table 3.17)
+ if (framebufferInternalFormatInfo.mColorEncoding == GL_LINEAR)
+ {
+ GLenum effectiveFormat;
+ if (GetEffectiveInternalFormat(framebufferInternalFormatInfo, textureInternalFormatInfo, clientVersion, &effectiveFormat))
+ {
+ gl::GetInternalFormatInfo(effectiveFormat, clientVersion, &sourceEffectiveFormat);
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else if (framebufferInternalFormatInfo.mColorEncoding == GL_SRGB)
+ {
+ // SRGB buffers can only be copied to sized format destinations according to table 3.18
+ if (gl::IsSizedInternalFormat(textureInternalFormat, clientVersion) &&
+ (framebufferInternalFormatInfo.mRedBits >= 1 && framebufferInternalFormatInfo.mRedBits <= 8) &&
+ (framebufferInternalFormatInfo.mGreenBits >= 1 && framebufferInternalFormatInfo.mGreenBits <= 8) &&
+ (framebufferInternalFormatInfo.mBlueBits >= 1 && framebufferInternalFormatInfo.mBlueBits <= 8) &&
+ (framebufferInternalFormatInfo.mAlphaBits >= 1 && framebufferInternalFormatInfo.mAlphaBits <= 8))
+ {
+ gl::GetInternalFormatInfo(GL_SRGB8_ALPHA8, clientVersion, &sourceEffectiveFormat);
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+ }
+
+ if (gl::IsSizedInternalFormat(textureInternalFormatInfo.mFormat, clientVersion))
+ {
+ // Section 3.8.5 of the GLES 3.0.3 spec, pg 139, requires that, if the destination format is sized,
+ // component sizes of the source and destination formats must exactly match
+ if (textureInternalFormatInfo.mRedBits != sourceEffectiveFormat.mRedBits ||
+ textureInternalFormatInfo.mGreenBits != sourceEffectiveFormat.mGreenBits ||
+ textureInternalFormatInfo.mBlueBits != sourceEffectiveFormat.mBlueBits ||
+ textureInternalFormatInfo.mAlphaBits != sourceEffectiveFormat.mAlphaBits)
+ {
+ return false;
+ }
+ }
+
+
+ return true; // A conversion function exists, and no rule in the specification has precluded conversion
+ // between these formats.
+ }
+
+ return false;
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool IsSizedInternalFormat(GLenum internalFormat, GLuint clientVersion)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ return internalFormatInfo.mPixelBits > 0;
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+GLenum GetSizedInternalFormat(GLenum format, GLenum type, GLuint clientVersion)
+{
+ const FormatMap &formats = GetFormatMap(clientVersion);
+ FormatMap::const_iterator iter = formats.find(FormatTypePair(format, type));
+ return (iter != formats.end()) ? iter->second.mInternalFormat : GL_NONE;
+}
+
+GLuint GetPixelBytes(GLenum internalFormat, GLuint clientVersion)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ return internalFormatInfo.mPixelBits / 8;
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+GLuint GetAlphaBits(GLenum internalFormat, GLuint clientVersion)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ return internalFormatInfo.mAlphaBits;
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+GLuint GetRedBits(GLenum internalFormat, GLuint clientVersion)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ return internalFormatInfo.mRedBits;
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+GLuint GetGreenBits(GLenum internalFormat, GLuint clientVersion)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ return internalFormatInfo.mGreenBits;
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+GLuint GetBlueBits(GLenum internalFormat, GLuint clientVersion)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ return internalFormatInfo.mBlueBits;
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+GLuint GetLuminanceBits(GLenum internalFormat, GLuint clientVersion)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ return internalFormatInfo.mLuminanceBits;
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+GLuint GetDepthBits(GLenum internalFormat, GLuint clientVersion)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ return internalFormatInfo.mDepthBits;
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+GLuint GetStencilBits(GLenum internalFormat, GLuint clientVersion)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ return internalFormatInfo.mStencilBits;
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+GLuint GetTypeBytes(GLenum type)
+{
+ TypeInfo typeInfo;
+ if (GetTypeInfo(type, &typeInfo))
+ {
+ return typeInfo.mTypeBytes;
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+bool IsSpecialInterpretationType(GLenum type)
+{
+ TypeInfo typeInfo;
+ if (GetTypeInfo(type, &typeInfo))
+ {
+ return typeInfo.mSpecialInterpretation;
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool IsFloatOrFixedComponentType(GLenum type)
+{
+ if (type == GL_UNSIGNED_NORMALIZED ||
+ type == GL_SIGNED_NORMALIZED ||
+ type == GL_FLOAT)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+GLenum GetFormat(GLenum internalFormat, GLuint clientVersion)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ return internalFormatInfo.mFormat;
+ }
+ else
+ {
+ UNREACHABLE();
+ return GL_NONE;
+ }
+}
+
+GLenum GetType(GLenum internalFormat, GLuint clientVersion)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ return internalFormatInfo.mType;
+ }
+ else
+ {
+ UNREACHABLE();
+ return GL_NONE;
+ }
+}
+
+GLenum GetComponentType(GLenum internalFormat, GLuint clientVersion)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ return internalFormatInfo.mComponentType;
+ }
+ else
+ {
+ UNREACHABLE();
+ return GL_NONE;
+ }
+}
+
+GLuint GetComponentCount(GLenum internalFormat, GLuint clientVersion)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ return internalFormatInfo.mComponentCount;
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+GLenum GetColorEncoding(GLenum internalFormat, GLuint clientVersion)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ return internalFormatInfo.mColorEncoding;
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool IsColorRenderingSupported(GLenum internalFormat, const rx::Renderer *renderer)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (renderer && GetInternalFormatInfo(internalFormat, renderer->getCurrentClientVersion(), &internalFormatInfo))
+ {
+ return internalFormatInfo.mIsColorRenderable(NULL, renderer);
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool IsColorRenderingSupported(GLenum internalFormat, const Context *context)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (context && GetInternalFormatInfo(internalFormat, context->getClientVersion(), &internalFormatInfo))
+ {
+ return internalFormatInfo.mIsColorRenderable(context, NULL);
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool IsTextureFilteringSupported(GLenum internalFormat, const rx::Renderer *renderer)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (renderer && GetInternalFormatInfo(internalFormat, renderer->getCurrentClientVersion(), &internalFormatInfo))
+ {
+ return internalFormatInfo.mIsTextureFilterable(NULL, renderer);
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool IsTextureFilteringSupported(GLenum internalFormat, const Context *context)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (context && GetInternalFormatInfo(internalFormat, context->getClientVersion(), &internalFormatInfo))
+ {
+ return internalFormatInfo.mIsTextureFilterable(context, NULL);
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool IsDepthRenderingSupported(GLenum internalFormat, const rx::Renderer *renderer)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (renderer && GetInternalFormatInfo(internalFormat, renderer->getCurrentClientVersion(), &internalFormatInfo))
+ {
+ return internalFormatInfo.mIsDepthRenderable(NULL, renderer);
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool IsDepthRenderingSupported(GLenum internalFormat, const Context *context)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (context && GetInternalFormatInfo(internalFormat, context->getClientVersion(), &internalFormatInfo))
+ {
+ return internalFormatInfo.mIsDepthRenderable(context, NULL);
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool IsStencilRenderingSupported(GLenum internalFormat, const rx::Renderer *renderer)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (renderer && GetInternalFormatInfo(internalFormat, renderer->getCurrentClientVersion(), &internalFormatInfo))
+ {
+ return internalFormatInfo.mIsStencilRenderable(NULL, renderer);
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool IsStencilRenderingSupported(GLenum internalFormat, const Context *context)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (context && GetInternalFormatInfo(internalFormat, context->getClientVersion(), &internalFormatInfo))
+ {
+ return internalFormatInfo.mIsStencilRenderable(context, NULL);
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+GLuint GetRowPitch(GLenum internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLint alignment)
+{
+ ASSERT(alignment > 0 && isPow2(alignment));
+ return rx::roundUp(GetBlockSize(internalFormat, type, clientVersion, width, 1), static_cast<GLuint>(alignment));
+}
+
+GLuint GetDepthPitch(GLenum internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLsizei height, GLint alignment)
+{
+ return GetRowPitch(internalFormat, type, clientVersion, width, alignment) * height;
+}
+
+GLuint GetBlockSize(GLenum internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLsizei height)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ if (internalFormatInfo.mIsCompressed)
+ {
+ GLsizei numBlocksWide = (width + internalFormatInfo.mCompressedBlockWidth - 1) / internalFormatInfo.mCompressedBlockWidth;
+ GLsizei numBlocksHight = (height + internalFormatInfo.mCompressedBlockHeight - 1) / internalFormatInfo.mCompressedBlockHeight;
+
+ return (internalFormatInfo.mPixelBits * numBlocksWide * numBlocksHight) / 8;
+ }
+ else
+ {
+ TypeInfo typeInfo;
+ if (GetTypeInfo(type, &typeInfo))
+ {
+ if (typeInfo.mSpecialInterpretation)
+ {
+ return typeInfo.mTypeBytes * width * height;
+ }
+ else
+ {
+ return internalFormatInfo.mComponentCount * typeInfo.mTypeBytes * width * height;
+ }
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+ }
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+bool IsFormatCompressed(GLenum internalFormat, GLuint clientVersion)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ return internalFormatInfo.mIsCompressed;
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+GLuint GetCompressedBlockWidth(GLenum internalFormat, GLuint clientVersion)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ return internalFormatInfo.mCompressedBlockWidth;
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+GLuint GetCompressedBlockHeight(GLenum internalFormat, GLuint clientVersion)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ return internalFormatInfo.mCompressedBlockHeight;
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+ColorWriteFunction GetColorWriteFunction(GLenum format, GLenum type, GLuint clientVersion)
+{
+ static const FormatMap &formats = GetFormatMap(clientVersion);
+ FormatMap::const_iterator iter = formats.find(FormatTypePair(format, type));
+ return (iter != formats.end()) ? iter->second.mColorWriteFunction : NULL;
+}
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/formatutils.h b/chromium/third_party/angle/src/libGLESv2/formatutils.h
new file mode 100644
index 00000000000..004c8eda83b
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/formatutils.h
@@ -0,0 +1,98 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// formatutils.h: Queries for GL image formats.
+
+#ifndef LIBGLESV2_FORMATUTILS_H_
+#define LIBGLESV2_FORMATUTILS_H_
+
+#include <GLES3/gl3.h>
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+
+#include "libGLESv2/angletypes.h"
+
+typedef void (*MipGenerationFunction)(unsigned int sourceWidth, unsigned int sourceHeight, unsigned int sourceDepth,
+ const unsigned char *sourceData, int sourceRowPitch, int sourceDepthPitch,
+ unsigned char *destData, int destRowPitch, int destDepthPitch);
+
+typedef void (*LoadImageFunction)(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+typedef void (*InitializeTextureDataFunction)(int width, int height, int depth,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+typedef void (*ColorReadFunction)(const void *source, void *dest);
+typedef void (*ColorWriteFunction)(const void *source, void *dest);
+typedef void (*ColorCopyFunction)(const void *source, void *dest);
+
+typedef void (*VertexCopyFunction)(const void *input, size_t stride, size_t count, void *output);
+
+namespace rx
+{
+
+class Renderer;
+
+}
+
+namespace gl
+{
+
+class Context;
+
+bool IsValidInternalFormat(GLenum internalFormat, const Context *context);
+bool IsValidFormat(GLenum format, GLuint clientVersion);
+bool IsValidType(GLenum type, GLuint clientVersion);
+
+bool IsValidFormatCombination(GLenum internalFormat, GLenum format, GLenum type, GLuint clientVersion);
+bool IsValidCopyTexImageCombination(GLenum textureInternalFormat, GLenum frameBufferInternalFormat, GLuint readBufferHandle, GLuint clientVersion);
+
+bool IsSizedInternalFormat(GLenum internalFormat, GLuint clientVersion);
+GLenum GetSizedInternalFormat(GLenum format, GLenum type, GLuint clientVersion);
+
+GLuint GetPixelBytes(GLenum internalFormat, GLuint clientVersion);
+GLuint GetAlphaBits(GLenum internalFormat, GLuint clientVersion);
+GLuint GetRedBits(GLenum internalFormat, GLuint clientVersion);
+GLuint GetGreenBits(GLenum internalFormat, GLuint clientVersion);
+GLuint GetBlueBits(GLenum internalFormat, GLuint clientVersion);
+GLuint GetLuminanceBits(GLenum internalFormat, GLuint clientVersion);
+GLuint GetDepthBits(GLenum internalFormat, GLuint clientVersion);
+GLuint GetStencilBits(GLenum internalFormat, GLuint clientVersion);
+
+GLuint GetTypeBytes(GLenum type);
+bool IsSpecialInterpretationType(GLenum type);
+bool IsFloatOrFixedComponentType(GLenum type);
+
+GLenum GetFormat(GLenum internalFormat, GLuint clientVersion);
+GLenum GetType(GLenum internalFormat, GLuint clientVersion);
+
+GLenum GetComponentType(GLenum internalFormat, GLuint clientVersion);
+GLuint GetComponentCount(GLenum internalFormat, GLuint clientVersion);
+GLenum GetColorEncoding(GLenum internalFormat, GLuint clientVersion);
+
+bool IsColorRenderingSupported(GLenum internalFormat, const rx::Renderer *renderer);
+bool IsColorRenderingSupported(GLenum internalFormat, const Context *context);
+bool IsTextureFilteringSupported(GLenum internalFormat, const rx::Renderer *renderer);
+bool IsTextureFilteringSupported(GLenum internalFormat, const Context *context);
+bool IsDepthRenderingSupported(GLenum internalFormat, const rx::Renderer *renderer);
+bool IsDepthRenderingSupported(GLenum internalFormat, const Context *context);
+bool IsStencilRenderingSupported(GLenum internalFormat, const rx::Renderer *renderer);
+bool IsStencilRenderingSupported(GLenum internalFormat, const Context *context);
+
+GLuint GetRowPitch(GLenum internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLint alignment);
+GLuint GetDepthPitch(GLenum internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLsizei height, GLint alignment);
+GLuint GetBlockSize(GLenum internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLsizei height);
+
+bool IsFormatCompressed(GLenum internalFormat, GLuint clientVersion);
+GLuint GetCompressedBlockWidth(GLenum internalFormat, GLuint clientVersion);
+GLuint GetCompressedBlockHeight(GLenum internalFormat, GLuint clientVersion);
+
+ColorWriteFunction GetColorWriteFunction(GLenum format, GLenum type, GLuint clientVersion);
+
+}
+
+#endif LIBGLESV2_FORMATUTILS_H_
diff --git a/chromium/third_party/angle/src/libGLESv2/libGLESv2.cpp b/chromium/third_party/angle/src/libGLESv2/libGLESv2.cpp
index 1e7cf9d0cfa..bf3cd0fdaf3 100644
--- a/chromium/third_party/angle/src/libGLESv2/libGLESv2.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/libGLESv2.cpp
@@ -1,6 +1,6 @@
#include "precompiled.h"
//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -10,7 +10,8 @@
#include "common/version.h"
#include "libGLESv2/main.h"
-#include "libGLESv2/utilities.h"
+#include "common/utilities.h"
+#include "libGLESv2/formatutils.h"
#include "libGLESv2/Buffer.h"
#include "libGLESv2/Fence.h"
#include "libGLESv2/Framebuffer.h"
@@ -20,242 +21,19 @@
#include "libGLESv2/Texture.h"
#include "libGLESv2/Query.h"
#include "libGLESv2/Context.h"
+#include "libGLESv2/VertexArray.h"
+#include "libGLESv2/TransformFeedback.h"
-bool validImageSize(GLint level, GLsizei width, GLsizei height)
-{
- if (level < 0 || width < 0 || height < 0)
- {
- return false;
- }
-
- if (gl::getContext() && gl::getContext()->supportsNonPower2Texture())
- {
- return true;
- }
-
- if (level == 0)
- {
- return true;
- }
-
- if (gl::isPow2(width) && gl::isPow2(height))
- {
- return true;
- }
-
- return false;
-}
-
-// Verify that format/type are one of the combinations from table 3.4.
-bool checkTextureFormatType(GLenum format, GLenum type)
-{
- // validate <format> by itself (used as secondary key below)
- switch (format)
- {
- case GL_RGBA:
- case GL_BGRA_EXT:
- case GL_RGB:
- case GL_ALPHA:
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- case GL_DEPTH_COMPONENT:
- case GL_DEPTH_STENCIL_OES:
- break;
- default:
- return gl::error(GL_INVALID_ENUM, false);
- }
-
- // invalid <type> -> sets INVALID_ENUM
- // invalid <format>+<type> combination -> sets INVALID_OPERATION
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- switch (format)
- {
- case GL_RGBA:
- case GL_BGRA_EXT:
- case GL_RGB:
- case GL_ALPHA:
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- return true;
- default:
- return gl::error(GL_INVALID_OPERATION, false);
- }
-
- case GL_FLOAT:
- case GL_HALF_FLOAT_OES:
- switch (format)
- {
- case GL_RGBA:
- case GL_RGB:
- case GL_ALPHA:
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- return true;
- default:
- return gl::error(GL_INVALID_OPERATION, false);
- }
-
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_5_5_5_1:
- switch (format)
- {
- case GL_RGBA:
- return true;
- default:
- return gl::error(GL_INVALID_OPERATION, false);
- }
-
- case GL_UNSIGNED_SHORT_5_6_5:
- switch (format)
- {
- case GL_RGB:
- return true;
- default:
- return gl::error(GL_INVALID_OPERATION, false);
- }
-
- case GL_UNSIGNED_SHORT:
- case GL_UNSIGNED_INT:
- switch (format)
- {
- case GL_DEPTH_COMPONENT:
- return true;
- default:
- return gl::error(GL_INVALID_OPERATION, false);
- }
-
- case GL_UNSIGNED_INT_24_8_OES:
- switch (format)
- {
- case GL_DEPTH_STENCIL_OES:
- return true;
- default:
- return gl::error(GL_INVALID_OPERATION, false);
- }
-
- default:
- return gl::error(GL_INVALID_ENUM, false);
- }
-}
-
-bool validateSubImageParams2D(bool compressed, GLsizei width, GLsizei height,
- GLint xoffset, GLint yoffset, GLint level, GLenum format, GLenum type,
- gl::Texture2D *texture)
-{
- if (!texture)
- {
- return gl::error(GL_INVALID_OPERATION, false);
- }
-
- if (compressed != texture->isCompressed(level))
- {
- return gl::error(GL_INVALID_OPERATION, false);
- }
-
- if (format != GL_NONE)
- {
- GLenum internalformat = gl::ConvertSizedInternalFormat(format, type);
- if (internalformat != texture->getInternalFormat(level))
- {
- return gl::error(GL_INVALID_OPERATION, false);
- }
- }
-
- if (compressed)
- {
- if ((width % 4 != 0 && width != texture->getWidth(0)) ||
- (height % 4 != 0 && height != texture->getHeight(0)))
- {
- return gl::error(GL_INVALID_OPERATION, false);
- }
- }
-
- if (xoffset + width > texture->getWidth(level) ||
- yoffset + height > texture->getHeight(level))
- {
- return gl::error(GL_INVALID_VALUE, false);
- }
-
- return true;
-}
-
-bool validateSubImageParamsCube(bool compressed, GLsizei width, GLsizei height,
- GLint xoffset, GLint yoffset, GLenum target, GLint level, GLenum format, GLenum type,
- gl::TextureCubeMap *texture)
-{
- if (!texture)
- {
- return gl::error(GL_INVALID_OPERATION, false);
- }
-
- if (compressed != texture->isCompressed(target, level))
- {
- return gl::error(GL_INVALID_OPERATION, false);
- }
-
- if (format != GL_NONE)
- {
- GLenum internalformat = gl::ConvertSizedInternalFormat(format, type);
- if (internalformat != texture->getInternalFormat(target, level))
- {
- return gl::error(GL_INVALID_OPERATION, false);
- }
- }
-
- if (compressed)
- {
- if ((width % 4 != 0 && width != texture->getWidth(target, 0)) ||
- (height % 4 != 0 && height != texture->getHeight(target, 0)))
- {
- return gl::error(GL_INVALID_OPERATION, false);
- }
- }
-
- if (xoffset + width > texture->getWidth(target, level) ||
- yoffset + height > texture->getHeight(target, level))
- {
- return gl::error(GL_INVALID_VALUE, false);
- }
-
- return true;
-}
-
-// check for combinations of format and type that are valid for ReadPixels
-bool validReadFormatType(GLenum format, GLenum type)
-{
- switch (format)
- {
- case GL_RGBA:
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- break;
- default:
- return false;
- }
- break;
- case GL_BGRA_EXT:
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT:
- break;
- default:
- return false;
- }
- break;
- default:
- return false;
- }
- return true;
-}
+#include "libGLESv2/validationES.h"
+#include "libGLESv2/validationES2.h"
+#include "libGLESv2/validationES3.h"
+#include "libGLESv2/queryconversions.h"
extern "C"
{
+// OpenGL ES 2.0 functions
+
void __stdcall glActiveTexture(GLenum texture)
{
EVENT("(GLenum texture = 0x%X)", texture);
@@ -274,7 +52,7 @@ void __stdcall glActiveTexture(GLenum texture)
context->setActiveSampler(texture - GL_TEXTURE0);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -323,7 +101,7 @@ void __stdcall glAttachShader(GLuint program, GLuint shader)
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -335,28 +113,19 @@ void __stdcall glBeginQueryEXT(GLenum target, GLuint id)
try
{
- switch (target)
- {
- case GL_ANY_SAMPLES_PASSED_EXT:
- case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- if (id == 0)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
gl::Context *context = gl::getNonLostContext();
if (context)
{
+ if (!ValidateBeginQuery(context, target, id))
+ {
+ return;
+ }
+
context->beginQuery(target, id);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -399,7 +168,7 @@ void __stdcall glBindAttribLocation(GLuint program, GLuint index, const GLchar*
programObject->bindAttributeLocation(index, name);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -415,6 +184,11 @@ void __stdcall glBindBuffer(GLenum target, GLuint buffer)
if (context)
{
+ if (!gl::ValidBufferTarget(context, target))
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+
switch (target)
{
case GL_ARRAY_BUFFER:
@@ -423,12 +197,30 @@ void __stdcall glBindBuffer(GLenum target, GLuint buffer)
case GL_ELEMENT_ARRAY_BUFFER:
context->bindElementArrayBuffer(buffer);
return;
+ case GL_COPY_READ_BUFFER:
+ context->bindCopyReadBuffer(buffer);
+ return;
+ case GL_COPY_WRITE_BUFFER:
+ context->bindCopyWriteBuffer(buffer);
+ return;
+ case GL_PIXEL_PACK_BUFFER:
+ context->bindPixelPackBuffer(buffer);
+ return;
+ case GL_PIXEL_UNPACK_BUFFER:
+ context->bindPixelUnpackBuffer(buffer);
+ return;
+ case GL_UNIFORM_BUFFER:
+ context->bindGenericUniformBuffer(buffer);
+ return;
+ case GL_TRANSFORM_FEEDBACK_BUFFER:
+ context->bindGenericTransformFeedbackBuffer(buffer);
+ return;
default:
return gl::error(GL_INVALID_ENUM);
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -440,7 +232,7 @@ void __stdcall glBindFramebuffer(GLenum target, GLuint framebuffer)
try
{
- if (target != GL_FRAMEBUFFER && target != GL_DRAW_FRAMEBUFFER_ANGLE && target != GL_READ_FRAMEBUFFER_ANGLE)
+ if (!gl::ValidFramebufferTarget(target))
{
return gl::error(GL_INVALID_ENUM);
}
@@ -460,7 +252,7 @@ void __stdcall glBindFramebuffer(GLenum target, GLuint framebuffer)
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -484,7 +276,7 @@ void __stdcall glBindRenderbuffer(GLenum target, GLuint renderbuffer)
context->bindRenderbuffer(renderbuffer);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -515,12 +307,26 @@ void __stdcall glBindTexture(GLenum target, GLuint texture)
case GL_TEXTURE_CUBE_MAP:
context->bindTextureCubeMap(texture);
return;
+ case GL_TEXTURE_3D:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ context->bindTexture3D(texture);
+ return;
+ case GL_TEXTURE_2D_ARRAY:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ context->bindTexture2DArray(texture);
+ return;
default:
return gl::error(GL_INVALID_ENUM);
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -540,7 +346,7 @@ void __stdcall glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclamp
context->setBlendColor(gl::clamp01(red), gl::clamp01(green), gl::clamp01(blue), gl::clamp01(alpha));
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -557,12 +363,17 @@ void __stdcall glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
try
{
+ gl::Context *context = gl::getNonLostContext();
+
switch (modeRGB)
{
case GL_FUNC_ADD:
case GL_FUNC_SUBTRACT:
case GL_FUNC_REVERSE_SUBTRACT:
+ case GL_MIN:
+ case GL_MAX:
break;
+
default:
return gl::error(GL_INVALID_ENUM);
}
@@ -572,19 +383,20 @@ void __stdcall glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
case GL_FUNC_ADD:
case GL_FUNC_SUBTRACT:
case GL_FUNC_REVERSE_SUBTRACT:
+ case GL_MIN:
+ case GL_MAX:
break;
+
default:
return gl::error(GL_INVALID_ENUM);
}
- gl::Context *context = gl::getNonLostContext();
-
if (context)
{
context->setBlendEquation(modeRGB, modeAlpha);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -602,6 +414,8 @@ void __stdcall glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha
try
{
+ gl::Context *context = gl::getNonLostContext();
+
switch (srcRGB)
{
case GL_ZERO:
@@ -641,6 +455,14 @@ void __stdcall glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha
case GL_CONSTANT_ALPHA:
case GL_ONE_MINUS_CONSTANT_ALPHA:
break;
+
+ case GL_SRC_ALPHA_SATURATE:
+ if (!context || context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ break;
+
default:
return gl::error(GL_INVALID_ENUM);
}
@@ -684,6 +506,14 @@ void __stdcall glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha
case GL_CONSTANT_ALPHA:
case GL_ONE_MINUS_CONSTANT_ALPHA:
break;
+
+ case GL_SRC_ALPHA_SATURATE:
+ if (!context || context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ break;
+
default:
return gl::error(GL_INVALID_ENUM);
}
@@ -700,14 +530,12 @@ void __stdcall glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha
return gl::error(GL_INVALID_OPERATION);
}
- gl::Context *context = gl::getNonLostContext();
-
if (context)
{
context->setBlendFactors(srcRGB, dstRGB, srcAlpha, dstAlpha);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -725,34 +553,40 @@ void __stdcall glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data,
return gl::error(GL_INVALID_VALUE);
}
+ gl::Context *context = gl::getNonLostContext();
+
switch (usage)
{
case GL_STREAM_DRAW:
case GL_STATIC_DRAW:
case GL_DYNAMIC_DRAW:
break;
+
+ case GL_STREAM_READ:
+ case GL_STREAM_COPY:
+ case GL_STATIC_READ:
+ case GL_STATIC_COPY:
+ case GL_DYNAMIC_READ:
+ case GL_DYNAMIC_COPY:
+ if (context && context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ break;
+
default:
return gl::error(GL_INVALID_ENUM);
}
- gl::Context *context = gl::getNonLostContext();
-
if (context)
{
- gl::Buffer *buffer;
-
- switch (target)
+ if (!gl::ValidBufferTarget(context, target))
{
- case GL_ARRAY_BUFFER:
- buffer = context->getArrayBuffer();
- break;
- case GL_ELEMENT_ARRAY_BUFFER:
- buffer = context->getElementArrayBuffer();
- break;
- default:
return gl::error(GL_INVALID_ENUM);
}
+ gl::Buffer *buffer = context->getTargetBuffer(target);
+
if (!buffer)
{
return gl::error(GL_INVALID_OPERATION);
@@ -761,7 +595,7 @@ void __stdcall glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data,
buffer->bufferData(data, size, usage);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -788,26 +622,30 @@ void __stdcall glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size,
if (context)
{
- gl::Buffer *buffer;
-
- switch (target)
+ if (!gl::ValidBufferTarget(context, target))
{
- case GL_ARRAY_BUFFER:
- buffer = context->getArrayBuffer();
- break;
- case GL_ELEMENT_ARRAY_BUFFER:
- buffer = context->getElementArrayBuffer();
- break;
- default:
return gl::error(GL_INVALID_ENUM);
}
+ gl::Buffer *buffer = context->getTargetBuffer(target);
+
if (!buffer)
{
return gl::error(GL_INVALID_OPERATION);
}
- if ((size_t)size + offset > buffer->size())
+ if (buffer->mapped())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ // Check for possible overflow of size + offset
+ if (!rx::IsUnsignedAdditionSafe<size_t>(size, offset))
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+
+ if (size + offset > buffer->size())
{
return gl::error(GL_INVALID_VALUE);
}
@@ -815,7 +653,7 @@ void __stdcall glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size,
buffer->bufferSubData(data, size, offset);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -827,7 +665,7 @@ GLenum __stdcall glCheckFramebufferStatus(GLenum target)
try
{
- if (target != GL_FRAMEBUFFER && target != GL_DRAW_FRAMEBUFFER_ANGLE && target != GL_READ_FRAMEBUFFER_ANGLE)
+ if (!gl::ValidFramebufferTarget(target))
{
return gl::error(GL_INVALID_ENUM, 0);
}
@@ -836,20 +674,12 @@ GLenum __stdcall glCheckFramebufferStatus(GLenum target)
if (context)
{
- gl::Framebuffer *framebuffer = NULL;
- if (target == GL_READ_FRAMEBUFFER_ANGLE)
- {
- framebuffer = context->getReadFramebuffer();
- }
- else
- {
- framebuffer = context->getDrawFramebuffer();
- }
-
+ gl::Framebuffer *framebuffer = context->getTargetFramebuffer(target);
+ ASSERT(framebuffer);
return framebuffer->completeness();
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY, 0);
}
@@ -859,7 +689,7 @@ GLenum __stdcall glCheckFramebufferStatus(GLenum target)
void __stdcall glClear(GLbitfield mask)
{
- EVENT("(GLbitfield mask = %X)", mask);
+ EVENT("(GLbitfield mask = 0x%X)", mask);
try
{
@@ -867,10 +697,22 @@ void __stdcall glClear(GLbitfield mask)
if (context)
{
+ gl::Framebuffer *framebufferObject = context->getDrawFramebuffer();
+
+ if (!framebufferObject || framebufferObject->completeness() != GL_FRAMEBUFFER_COMPLETE)
+ {
+ return gl::error(GL_INVALID_FRAMEBUFFER_OPERATION);
+ }
+
+ if ((mask & ~(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)) != 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
context->clear(mask);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -890,7 +732,7 @@ void __stdcall glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclamp
context->setClearColor(red, green, blue, alpha);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -909,7 +751,7 @@ void __stdcall glClearDepthf(GLclampf depth)
context->setClearDepth(depth);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -928,7 +770,7 @@ void __stdcall glClearStencil(GLint s)
context->setClearStencil(s);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -936,7 +778,7 @@ void __stdcall glClearStencil(GLint s)
void __stdcall glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
{
- EVENT("(GLboolean red = %d, GLboolean green = %d, GLboolean blue = %d, GLboolean alpha = %d)",
+ EVENT("(GLboolean red = %d, GLboolean green = %u, GLboolean blue = %u, GLboolean alpha = %u)",
red, green, blue, alpha);
try
@@ -948,7 +790,7 @@ void __stdcall glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboo
context->setColorMask(red == GL_TRUE, green == GL_TRUE, blue == GL_TRUE, alpha == GL_TRUE);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -981,7 +823,7 @@ void __stdcall glCompileShader(GLuint shader)
shaderObject->compile();
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -996,42 +838,25 @@ void __stdcall glCompressedTexImage2D(GLenum target, GLint level, GLenum interna
try
{
- if (!validImageSize(level, width, height) || border != 0 || imageSize < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- switch (internalformat)
- {
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- if (border != 0)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (width != 1 && width != 2 && width % 4 != 0)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (height != 1 && height != 2 && height % 4 != 0)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
gl::Context *context = gl::getNonLostContext();
if (context)
{
- if (level > context->getMaximumTextureLevel())
+ if (context->getClientVersion() < 3 &&
+ !ValidateES2TexImageParameters(context, target, level, internalformat, true, false,
+ 0, 0, width, height, border, GL_NONE, GL_NONE, data))
+ {
+ return;
+ }
+
+ if (context->getClientVersion() >= 3 &&
+ !ValidateES3TexImageParameters(context, target, level, internalformat, true, false,
+ 0, 0, 0, width, height, 1, border, GL_NONE, GL_NONE, data))
+ {
+ return;
+ }
+
+ if (imageSize < 0 || imageSize != (GLsizei)gl::GetBlockSize(internalformat, GL_UNSIGNED_BYTE, context->getClientVersion(), width, height))
{
return gl::error(GL_INVALID_VALUE);
}
@@ -1039,108 +864,30 @@ void __stdcall glCompressedTexImage2D(GLenum target, GLint level, GLenum interna
switch (target)
{
case GL_TEXTURE_2D:
- if (width > (context->getMaximumTextureDimension() >> level) ||
- height > (context->getMaximumTextureDimension() >> level))
{
- return gl::error(GL_INVALID_VALUE);
+ gl::Texture2D *texture = context->getTexture2D();
+ texture->setCompressedImage(level, internalformat, width, height, imageSize, data);
}
break;
+
case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- if (width != height)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- if (width > (context->getMaximumCubeTextureDimension() >> level) ||
- height > (context->getMaximumCubeTextureDimension() >> level))
{
- return gl::error(GL_INVALID_VALUE);
+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ texture->setCompressedImage(target, level, internalformat, width, height, imageSize, data);
}
break;
+
default:
return gl::error(GL_INVALID_ENUM);
}
-
- switch (internalformat) {
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- if (!context->supportsDXT1Textures())
- {
- return gl::error(GL_INVALID_ENUM); // in this case, it's as though the internal format switch failed
- }
- break;
- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
- if (!context->supportsDXT3Textures())
- {
- return gl::error(GL_INVALID_ENUM); // in this case, it's as though the internal format switch failed
- }
- break;
- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
- if (!context->supportsDXT5Textures())
- {
- return gl::error(GL_INVALID_ENUM); // in this case, it's as though the internal format switch failed
- }
- break;
- default: UNREACHABLE();
- }
-
- if (imageSize != gl::ComputeCompressedSize(width, height, internalformat))
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- if (target == GL_TEXTURE_2D)
- {
- gl::Texture2D *texture = context->getTexture2D();
-
- if (!texture)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (texture->isImmutable())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- texture->setCompressedImage(level, internalformat, width, height, imageSize, data);
- }
- else
- {
- gl::TextureCubeMap *texture = context->getTextureCubeMap();
-
- if (!texture)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (texture->isImmutable())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- switch (target)
- {
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- texture->setCompressedImage(target, level, internalformat, width, height, imageSize, data);
- break;
- default: UNREACHABLE();
- }
- }
}
-
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -1156,98 +903,56 @@ void __stdcall glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffs
try
{
- if (!gl::IsInternalTextureTarget(target))
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- if (xoffset < 0 || yoffset < 0 || !validImageSize(level, width, height) || imageSize < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- switch (format)
- {
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- if (width == 0 || height == 0 || data == NULL)
- {
- return;
- }
-
gl::Context *context = gl::getNonLostContext();
if (context)
{
- if (level > context->getMaximumTextureLevel())
+ if (context->getClientVersion() < 3 &&
+ !ValidateES2TexImageParameters(context, target, level, GL_NONE, true, true,
+ xoffset, yoffset, width, height, 0, GL_NONE, GL_NONE, data))
{
- return gl::error(GL_INVALID_VALUE);
- }
-
- switch (format) {
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- if (!context->supportsDXT1Textures())
- {
- return gl::error(GL_INVALID_ENUM); // in this case, it's as though the internal format switch failed
- }
- break;
- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
- if (!context->supportsDXT3Textures())
- {
- return gl::error(GL_INVALID_ENUM); // in this case, it's as though the internal format switch failed
- }
- break;
- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
- if (!context->supportsDXT5Textures())
- {
- return gl::error(GL_INVALID_ENUM); // in this case, it's as though the internal format switch failed
- }
- break;
- default: UNREACHABLE();
+ return;
}
- if (imageSize != gl::ComputeCompressedSize(width, height, format))
+ if (context->getClientVersion() >= 3 &&
+ !ValidateES3TexImageParameters(context, target, level, GL_NONE, true, true,
+ xoffset, yoffset, 0, width, height, 1, 0, GL_NONE, GL_NONE, data))
{
- return gl::error(GL_INVALID_VALUE);
+ return;
}
- if (xoffset % 4 != 0 || yoffset % 4 != 0)
+ if (imageSize < 0 || imageSize != (GLsizei)gl::GetBlockSize(format, GL_UNSIGNED_BYTE, context->getClientVersion(), width, height))
{
- return gl::error(GL_INVALID_OPERATION); // we wait to check the offsets until this point, because the multiple-of-four restriction
- // does not exist unless DXT textures are supported.
+ return gl::error(GL_INVALID_VALUE);
}
- if (target == GL_TEXTURE_2D)
+ switch (target)
{
- gl::Texture2D *texture = context->getTexture2D();
- if (validateSubImageParams2D(true, width, height, xoffset, yoffset, level, format, GL_NONE, texture))
+ case GL_TEXTURE_2D:
{
+ gl::Texture2D *texture = context->getTexture2D();
texture->subImageCompressed(level, xoffset, yoffset, width, height, format, imageSize, data);
}
- }
- else if (gl::IsCubemapTextureTarget(target))
- {
- gl::TextureCubeMap *texture = context->getTextureCubeMap();
- if (validateSubImageParamsCube(true, width, height, xoffset, yoffset, target, level, format, GL_NONE, texture))
+ break;
+
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
{
+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
texture->subImageCompressed(target, level, xoffset, yoffset, width, height, format, imageSize, data);
}
- }
- else
- {
- UNREACHABLE();
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -1261,189 +966,53 @@ void __stdcall glCopyTexImage2D(GLenum target, GLint level, GLenum internalforma
try
{
- if (!validImageSize(level, width, height))
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- if (border != 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
gl::Context *context = gl::getNonLostContext();
if (context)
{
- if (level > context->getMaximumTextureLevel())
+ if (context->getClientVersion() < 3 &&
+ !ValidateES2CopyTexImageParameters(context, target, level, internalformat, false,
+ 0, 0, x, y, width, height, border))
{
- return gl::error(GL_INVALID_VALUE);
+ return;
}
+ if (context->getClientVersion() >= 3 &&
+ !ValidateES3CopyTexImageParameters(context, target, level, internalformat, false,
+ 0, 0, 0, x, y, width, height, border))
+ {
+ return;
+ }
+
+ gl::Framebuffer *framebuffer = context->getReadFramebuffer();
+
switch (target)
{
case GL_TEXTURE_2D:
- if (width > (context->getMaximumTextureDimension() >> level) ||
- height > (context->getMaximumTextureDimension() >> level))
{
- return gl::error(GL_INVALID_VALUE);
+ gl::Texture2D *texture = context->getTexture2D();
+ texture->copyImage(level, internalformat, x, y, width, height, framebuffer);
}
break;
+
case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- if (width != height)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- if (width > (context->getMaximumCubeTextureDimension() >> level) ||
- height > (context->getMaximumCubeTextureDimension() >> level))
{
- return gl::error(GL_INVALID_VALUE);
+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ texture->copyImage(target, level, internalformat, x, y, width, height, framebuffer);
}
break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- gl::Framebuffer *framebuffer = context->getReadFramebuffer();
- if (framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE)
- {
- return gl::error(GL_INVALID_FRAMEBUFFER_OPERATION);
- }
-
- if (context->getReadFramebufferHandle() != 0 && framebuffer->getSamples() != 0)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- gl::Renderbuffer *source = framebuffer->getReadColorbuffer();
- GLenum colorbufferFormat = source->getInternalFormat();
-
- // [OpenGL ES 2.0.24] table 3.9
- switch (internalformat)
- {
- case GL_ALPHA:
- if (colorbufferFormat != GL_ALPHA8_EXT &&
- colorbufferFormat != GL_RGBA4 &&
- colorbufferFormat != GL_RGB5_A1 &&
- colorbufferFormat != GL_BGRA8_EXT &&
- colorbufferFormat != GL_RGBA8_OES)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- break;
- case GL_LUMINANCE:
- case GL_RGB:
- if (colorbufferFormat != GL_RGB565 &&
- colorbufferFormat != GL_RGB8_OES &&
- colorbufferFormat != GL_RGBA4 &&
- colorbufferFormat != GL_RGB5_A1 &&
- colorbufferFormat != GL_BGRA8_EXT &&
- colorbufferFormat != GL_RGBA8_OES)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- break;
- case GL_LUMINANCE_ALPHA:
- case GL_RGBA:
- if (colorbufferFormat != GL_RGBA4 &&
- colorbufferFormat != GL_RGB5_A1 &&
- colorbufferFormat != GL_BGRA8_EXT &&
- colorbufferFormat != GL_RGBA8_OES)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- break;
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- if (context->supportsDXT1Textures())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- else
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
- if (context->supportsDXT3Textures())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- else
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
- if (context->supportsDXT5Textures())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- else
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_DEPTH_COMPONENT:
- case GL_DEPTH_COMPONENT16:
- case GL_DEPTH_COMPONENT32_OES:
- case GL_DEPTH_STENCIL_OES:
- case GL_DEPTH24_STENCIL8_OES:
- if (context->supportsDepthTextures())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- else
- {
- return gl::error(GL_INVALID_ENUM);
- }
- default:
+ default:
return gl::error(GL_INVALID_ENUM);
}
-
- if (target == GL_TEXTURE_2D)
- {
- gl::Texture2D *texture = context->getTexture2D();
-
- if (!texture)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (texture->isImmutable())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- texture->copyImage(level, internalformat, x, y, width, height, framebuffer);
- }
- else if (gl::IsCubemapTextureTarget(target))
- {
- gl::TextureCubeMap *texture = context->getTextureCubeMap();
-
- if (!texture)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (texture->isImmutable())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- texture->copyImage(target, level, internalformat, x, y, width, height, framebuffer);
- }
- else UNREACHABLE();
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -1457,125 +1026,54 @@ void __stdcall glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GL
try
{
- if (!gl::IsInternalTextureTarget(target))
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- if (level < 0 || xoffset < 0 || yoffset < 0 || width < 0 || height < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- if (std::numeric_limits<GLsizei>::max() - xoffset < width || std::numeric_limits<GLsizei>::max() - yoffset < height)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- if (width == 0 || height == 0)
- {
- return;
- }
-
gl::Context *context = gl::getNonLostContext();
if (context)
{
- if (level > context->getMaximumTextureLevel())
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Framebuffer *framebuffer = context->getReadFramebuffer();
-
- if (framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE)
+ if (context->getClientVersion() < 3 &&
+ !ValidateES2CopyTexImageParameters(context, target, level, GL_NONE, true,
+ xoffset, yoffset, x, y, width, height, 0))
{
- return gl::error(GL_INVALID_FRAMEBUFFER_OPERATION);
- }
-
- if (context->getReadFramebufferHandle() != 0 && framebuffer->getSamples() != 0)
- {
- return gl::error(GL_INVALID_OPERATION);
+ return;
}
- gl::Renderbuffer *source = framebuffer->getReadColorbuffer();
- GLenum colorbufferFormat = source->getInternalFormat();
- gl::Texture *texture = NULL;
- GLenum textureFormat = GL_RGBA;
-
- if (target == GL_TEXTURE_2D)
+ if (context->getClientVersion() >= 3 &&
+ !ValidateES3CopyTexImageParameters(context, target, level, GL_NONE, true,
+ xoffset, yoffset, 0, x, y, width, height, 0))
{
- gl::Texture2D *tex2d = context->getTexture2D();
-
- if (!validateSubImageParams2D(false, width, height, xoffset, yoffset, level, GL_NONE, GL_NONE, tex2d))
- {
- return; // error already registered by validateSubImageParams
- }
- textureFormat = gl::ExtractFormat(tex2d->getInternalFormat(level));
- texture = tex2d;
+ return;
}
- else if (gl::IsCubemapTextureTarget(target))
- {
- gl::TextureCubeMap *texcube = context->getTextureCubeMap();
- if (!validateSubImageParamsCube(false, width, height, xoffset, yoffset, target, level, GL_NONE, GL_NONE, texcube))
- {
- return; // error already registered by validateSubImageParams
- }
- textureFormat = gl::ExtractFormat(texcube->getInternalFormat(target, level));
- texture = texcube;
- }
- else UNREACHABLE();
+ gl::Framebuffer *framebuffer = context->getReadFramebuffer();
- // [OpenGL ES 2.0.24] table 3.9
- switch (textureFormat)
+ switch (target)
{
- case GL_ALPHA:
- if (colorbufferFormat != GL_ALPHA8_EXT &&
- colorbufferFormat != GL_RGBA4 &&
- colorbufferFormat != GL_RGB5_A1 &&
- colorbufferFormat != GL_RGBA8_OES)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- break;
- case GL_LUMINANCE:
- case GL_RGB:
- if (colorbufferFormat != GL_RGB565 &&
- colorbufferFormat != GL_RGB8_OES &&
- colorbufferFormat != GL_RGBA4 &&
- colorbufferFormat != GL_RGB5_A1 &&
- colorbufferFormat != GL_RGBA8_OES)
+ case GL_TEXTURE_2D:
{
- return gl::error(GL_INVALID_OPERATION);
+ gl::Texture2D *texture = context->getTexture2D();
+ texture->copySubImage(target, level, xoffset, yoffset, 0, x, y, width, height, framebuffer);
}
break;
- case GL_LUMINANCE_ALPHA:
- case GL_RGBA:
- if (colorbufferFormat != GL_RGBA4 &&
- colorbufferFormat != GL_RGB5_A1 &&
- colorbufferFormat != GL_RGBA8_OES)
+
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
{
- return gl::error(GL_INVALID_OPERATION);
+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ texture->copySubImage(target, level, xoffset, yoffset, 0, x, y, width, height, framebuffer);
}
break;
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
- return gl::error(GL_INVALID_OPERATION);
- case GL_DEPTH_COMPONENT:
- case GL_DEPTH_STENCIL_OES:
- return gl::error(GL_INVALID_OPERATION);
+
default:
- return gl::error(GL_INVALID_OPERATION);
+ return gl::error(GL_INVALID_ENUM);
}
-
- texture->copySubImage(target, level, xoffset, yoffset, x, y, width, height, framebuffer);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -1594,7 +1092,7 @@ GLuint __stdcall glCreateProgram(void)
return context->createProgram();
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY, 0);
}
@@ -1622,7 +1120,7 @@ GLuint __stdcall glCreateShader(GLenum type)
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY, 0);
}
@@ -1654,7 +1152,7 @@ void __stdcall glCullFace(GLenum mode)
return gl::error(GL_INVALID_ENUM);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -1681,7 +1179,7 @@ void __stdcall glDeleteBuffers(GLsizei n, const GLuint* buffers)
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -1704,11 +1202,11 @@ void __stdcall glDeleteFencesNV(GLsizei n, const GLuint* fences)
{
for (int i = 0; i < n; i++)
{
- context->deleteFence(fences[i]);
+ context->deleteFenceNV(fences[i]);
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -1738,7 +1236,7 @@ void __stdcall glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -1774,7 +1272,7 @@ void __stdcall glDeleteProgram(GLuint program)
context->deleteProgram(program);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -1801,7 +1299,7 @@ void __stdcall glDeleteQueriesEXT(GLsizei n, const GLuint *ids)
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -1828,7 +1326,7 @@ void __stdcall glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -1864,7 +1362,7 @@ void __stdcall glDeleteShader(GLuint shader)
context->deleteShader(shader);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -1894,7 +1392,7 @@ void __stdcall glDeleteTextures(GLsizei n, const GLuint* textures)
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -1928,7 +1426,7 @@ void __stdcall glDepthFunc(GLenum func)
context->setDepthFunc(func);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -1936,7 +1434,7 @@ void __stdcall glDepthFunc(GLenum func)
void __stdcall glDepthMask(GLboolean flag)
{
- EVENT("(GLboolean flag = %d)", flag);
+ EVENT("(GLboolean flag = %u)", flag);
try
{
@@ -1947,7 +1445,7 @@ void __stdcall glDepthMask(GLboolean flag)
context->setDepthMask(flag != GL_FALSE);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -1966,7 +1464,7 @@ void __stdcall glDepthRangef(GLclampf zNear, GLclampf zFar)
context->setDepthRange(zNear, zFar);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -2019,7 +1517,7 @@ void __stdcall glDetachShader(GLuint program, GLuint shader)
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -2035,23 +1533,15 @@ void __stdcall glDisable(GLenum cap)
if (context)
{
- switch (cap)
+ if (!ValidCap(context, cap))
{
- case GL_CULL_FACE: context->setCullFace(false); break;
- case GL_POLYGON_OFFSET_FILL: context->setPolygonOffsetFill(false); break;
- case GL_SAMPLE_ALPHA_TO_COVERAGE: context->setSampleAlphaToCoverage(false); break;
- case GL_SAMPLE_COVERAGE: context->setSampleCoverage(false); break;
- case GL_SCISSOR_TEST: context->setScissorTest(false); break;
- case GL_STENCIL_TEST: context->setStencilTest(false); break;
- case GL_DEPTH_TEST: context->setDepthTest(false); break;
- case GL_BLEND: context->setBlend(false); break;
- case GL_DITHER: context->setDither(false); break;
- default:
return gl::error(GL_INVALID_ENUM);
}
+
+ context->setCap(cap, false);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -2075,7 +1565,7 @@ void __stdcall glDisableVertexAttribArray(GLuint index)
context->setEnableVertexAttribArray(index, false);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -2094,12 +1584,28 @@ void __stdcall glDrawArrays(GLenum mode, GLint first, GLsizei count)
gl::Context *context = gl::getNonLostContext();
+ // Check for mapped buffers
+ if (context->hasMappedBuffer(GL_ARRAY_BUFFER))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
if (context)
{
+ gl::TransformFeedback *curTransformFeedback = context->getCurrentTransformFeedback();
+ if (curTransformFeedback && curTransformFeedback->isStarted() && !curTransformFeedback->isPaused() &&
+ curTransformFeedback->getDrawMode() != mode)
+ {
+ // It is an invalid operation to call DrawArrays or DrawArraysInstanced with a draw mode
+ // that does not match the current transform feedback object's draw mode (if transform feedback
+ // is active), (3.0.2, section 2.14, pg 86)
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
context->drawArrays(mode, first, count, 0);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -2120,13 +1626,29 @@ void __stdcall glDrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei coun
{
gl::Context *context = gl::getNonLostContext();
+ // Check for mapped buffers
+ if (context->hasMappedBuffer(GL_ARRAY_BUFFER))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
if (context)
{
+ gl::TransformFeedback *curTransformFeedback = context->getCurrentTransformFeedback();
+ if (curTransformFeedback && curTransformFeedback->isStarted() && !curTransformFeedback->isPaused() &&
+ curTransformFeedback->getDrawMode() != mode)
+ {
+ // It is an invalid operation to call DrawArrays or DrawArraysInstanced with a draw mode
+ // that does not match the current transform feedback object's draw mode (if transform feedback
+ // is active), (3.0.2, section 2.14, pg 86)
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
context->drawArrays(mode, first, count, primcount);
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -2156,17 +1678,31 @@ void __stdcall glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLv
case GL_UNSIGNED_INT:
if (!context->supports32bitIndices())
{
- return gl::error(GL_INVALID_ENUM);
+ return gl::error(GL_INVALID_ENUM);
}
break;
default:
return gl::error(GL_INVALID_ENUM);
}
-
+
+ gl::TransformFeedback *curTransformFeedback = context->getCurrentTransformFeedback();
+ if (curTransformFeedback && curTransformFeedback->isStarted() && !curTransformFeedback->isPaused())
+ {
+ // It is an invalid operation to call DrawElements, DrawRangeElements or DrawElementsInstanced
+ // while transform feedback is active, (3.0.2, section 2.14, pg 86)
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ // Check for mapped buffers
+ if (context->hasMappedBuffer(GL_ARRAY_BUFFER) || context->hasMappedBuffer(GL_ELEMENT_ARRAY_BUFFER))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
context->drawElements(mode, count, type, indices, 0);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -2198,18 +1734,32 @@ void __stdcall glDrawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum t
case GL_UNSIGNED_INT:
if (!context->supports32bitIndices())
{
- return gl::error(GL_INVALID_ENUM);
+ return gl::error(GL_INVALID_ENUM);
}
break;
default:
return gl::error(GL_INVALID_ENUM);
}
-
+
+ gl::TransformFeedback *curTransformFeedback = context->getCurrentTransformFeedback();
+ if (curTransformFeedback && curTransformFeedback->isStarted() && !curTransformFeedback->isPaused())
+ {
+ // It is an invalid operation to call DrawElements, DrawRangeElements or DrawElementsInstanced
+ // while transform feedback is active, (3.0.2, section 2.14, pg 86)
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ // Check for mapped buffers
+ if (context->hasMappedBuffer(GL_ARRAY_BUFFER) || context->hasMappedBuffer(GL_ELEMENT_ARRAY_BUFFER))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
context->drawElements(mode, count, type, indices, primcount);
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -2225,23 +1775,15 @@ void __stdcall glEnable(GLenum cap)
if (context)
{
- switch (cap)
+ if (!ValidCap(context, cap))
{
- case GL_CULL_FACE: context->setCullFace(true); break;
- case GL_POLYGON_OFFSET_FILL: context->setPolygonOffsetFill(true); break;
- case GL_SAMPLE_ALPHA_TO_COVERAGE: context->setSampleAlphaToCoverage(true); break;
- case GL_SAMPLE_COVERAGE: context->setSampleCoverage(true); break;
- case GL_SCISSOR_TEST: context->setScissorTest(true); break;
- case GL_STENCIL_TEST: context->setStencilTest(true); break;
- case GL_DEPTH_TEST: context->setDepthTest(true); break;
- case GL_BLEND: context->setBlend(true); break;
- case GL_DITHER: context->setDither(true); break;
- default:
return gl::error(GL_INVALID_ENUM);
}
+
+ context->setCap(cap, true);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -2265,7 +1807,7 @@ void __stdcall glEnableVertexAttribArray(GLuint index)
context->setEnableVertexAttribArray(index, true);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -2277,23 +1819,19 @@ void __stdcall glEndQueryEXT(GLenum target)
try
{
- switch (target)
- {
- case GL_ANY_SAMPLES_PASSED_EXT:
- case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
gl::Context *context = gl::getNonLostContext();
if (context)
{
+ if (!ValidateEndQuery(context, target))
+ {
+ return;
+ }
+
context->endQuery(target);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -2309,17 +1847,22 @@ void __stdcall glFinishFenceNV(GLuint fence)
if (context)
{
- gl::Fence* fenceObject = context->getFence(fence);
+ gl::FenceNV *fenceObject = context->getFenceNV(fence);
if (fenceObject == NULL)
{
return gl::error(GL_INVALID_OPERATION);
}
+ if (fenceObject->isFence() != GL_TRUE)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
fenceObject->finishFence();
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -2338,7 +1881,7 @@ void __stdcall glFinish(void)
context->sync(true);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -2357,7 +1900,7 @@ void __stdcall glFlush(void)
context->sync(false);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -2370,8 +1913,7 @@ void __stdcall glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenu
try
{
- if ((target != GL_FRAMEBUFFER && target != GL_DRAW_FRAMEBUFFER_ANGLE && target != GL_READ_FRAMEBUFFER_ANGLE)
- || (renderbuffertarget != GL_RENDERBUFFER && renderbuffer != 0))
+ if (!gl::ValidFramebufferTarget(target) || (renderbuffertarget != GL_RENDERBUFFER && renderbuffer != 0))
{
return gl::error(GL_INVALID_ENUM);
}
@@ -2380,52 +1922,40 @@ void __stdcall glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenu
if (context)
{
- gl::Framebuffer *framebuffer = NULL;
- GLuint framebufferHandle = 0;
- if (target == GL_READ_FRAMEBUFFER_ANGLE)
- {
- framebuffer = context->getReadFramebuffer();
- framebufferHandle = context->getReadFramebufferHandle();
- }
- else
+ if (!gl::ValidateFramebufferRenderbufferParameters(context, target, attachment, renderbuffertarget, renderbuffer))
{
- framebuffer = context->getDrawFramebuffer();
- framebufferHandle = context->getDrawFramebufferHandle();
+ return;
}
- if (!framebuffer || (framebufferHandle == 0 && renderbuffer != 0))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
+ gl::Framebuffer *framebuffer = context->getTargetFramebuffer(target);
+ ASSERT(framebuffer);
if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT)
{
- const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT);
-
- if (colorAttachment >= context->getMaximumRenderTargets())
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- framebuffer->setColorbuffer(colorAttachment, GL_RENDERBUFFER, renderbuffer);
+ unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT);
+ framebuffer->setColorbuffer(colorAttachment, GL_RENDERBUFFER, renderbuffer, 0, 0);
}
else
{
switch (attachment)
{
case GL_DEPTH_ATTACHMENT:
- framebuffer->setDepthbuffer(GL_RENDERBUFFER, renderbuffer);
+ framebuffer->setDepthbuffer(GL_RENDERBUFFER, renderbuffer, 0, 0);
break;
case GL_STENCIL_ATTACHMENT:
- framebuffer->setStencilbuffer(GL_RENDERBUFFER, renderbuffer);
+ framebuffer->setStencilbuffer(GL_RENDERBUFFER, renderbuffer, 0, 0);
+ break;
+ case GL_DEPTH_STENCIL_ATTACHMENT:
+ framebuffer->setDepthStencilBuffer(GL_RENDERBUFFER, renderbuffer, 0, 0);
break;
default:
- return gl::error(GL_INVALID_ENUM);
+ UNREACHABLE();
+ break;
}
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -2438,134 +1968,45 @@ void __stdcall glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum t
try
{
- if (target != GL_FRAMEBUFFER && target != GL_DRAW_FRAMEBUFFER_ANGLE && target != GL_READ_FRAMEBUFFER_ANGLE)
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
gl::Context *context = gl::getNonLostContext();
-
if (context)
{
- if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT)
+ if (context->getClientVersion() < 3 &&
+ !ValidateES2FramebufferTextureParameters(context, target, attachment, textarget, texture, level))
{
- const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT);
-
- if (colorAttachment >= context->getMaximumRenderTargets())
- {
- return gl::error(GL_INVALID_VALUE);
- }
+ return;
}
- else
+
+ if (context->getClientVersion() >= 3 &&
+ !ValidateES3FramebufferTextureParameters(context, target, attachment, textarget, texture, level, 0, false))
{
- switch (attachment)
- {
- case GL_DEPTH_ATTACHMENT:
- case GL_STENCIL_ATTACHMENT:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
+ return;
}
if (texture == 0)
{
textarget = GL_NONE;
}
- else
- {
- gl::Texture *tex = context->getTexture(texture);
-
- if (tex == NULL)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- switch (textarget)
- {
- case GL_TEXTURE_2D:
- {
- if (tex->getTarget() != GL_TEXTURE_2D)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- gl::Texture2D *tex2d = static_cast<gl::Texture2D *>(tex);
- if (tex2d->isCompressed(0))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- break;
- }
-
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- {
- if (tex->getTarget() != GL_TEXTURE_CUBE_MAP)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- gl::TextureCubeMap *texcube = static_cast<gl::TextureCubeMap *>(tex);
- if (texcube->isCompressed(textarget, level))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- break;
- }
-
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- if (level != 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
- }
- gl::Framebuffer *framebuffer = NULL;
- GLuint framebufferHandle = 0;
- if (target == GL_READ_FRAMEBUFFER_ANGLE)
- {
- framebuffer = context->getReadFramebuffer();
- framebufferHandle = context->getReadFramebufferHandle();
- }
- else
- {
- framebuffer = context->getDrawFramebuffer();
- framebufferHandle = context->getDrawFramebufferHandle();
- }
-
- if (framebufferHandle == 0 || !framebuffer)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
+ gl::Framebuffer *framebuffer = context->getTargetFramebuffer(target);
if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT)
{
const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT);
-
- if (colorAttachment >= context->getMaximumRenderTargets())
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- framebuffer->setColorbuffer(colorAttachment, textarget, texture);
+ framebuffer->setColorbuffer(colorAttachment, textarget, texture, level, 0);
}
else
{
switch (attachment)
{
- case GL_DEPTH_ATTACHMENT: framebuffer->setDepthbuffer(textarget, texture); break;
- case GL_STENCIL_ATTACHMENT: framebuffer->setStencilbuffer(textarget, texture); break;
+ case GL_DEPTH_ATTACHMENT: framebuffer->setDepthbuffer(textarget, texture, level, 0); break;
+ case GL_STENCIL_ATTACHMENT: framebuffer->setStencilbuffer(textarget, texture, level, 0); break;
+ case GL_DEPTH_STENCIL_ATTACHMENT: framebuffer->setDepthStencilBuffer(textarget, texture, level, 0); break;
}
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -2594,7 +2035,7 @@ void __stdcall glFrontFace(GLenum mode)
return gl::error(GL_INVALID_ENUM);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -2621,7 +2062,7 @@ void __stdcall glGenBuffers(GLsizei n, GLuint* buffers)
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -2637,44 +2078,55 @@ void __stdcall glGenerateMipmap(GLenum target)
if (context)
{
- switch (target)
+ if (!ValidTextureTarget(context, target))
{
- case GL_TEXTURE_2D:
- {
- gl::Texture2D *tex2d = context->getTexture2D();
+ return gl::error(GL_INVALID_ENUM);
+ }
- if (tex2d->isCompressed(0))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- if (tex2d->isDepth(0))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
+ gl::Texture *texture = context->getTargetTexture(target);
- tex2d->generateMipmaps();
- break;
- }
+ if (texture == NULL)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
- case GL_TEXTURE_CUBE_MAP:
- {
- gl::TextureCubeMap *texcube = context->getTextureCubeMap();
+ GLenum internalFormat = texture->getBaseLevelInternalFormat();
- if (texcube->isCompressed(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
+ // Internally, all texture formats are sized so checking if the format
+ // is color renderable and filterable will not fail.
- texcube->generateMipmaps();
- break;
- }
+ bool validRenderable = (gl::IsColorRenderingSupported(internalFormat, context) ||
+ gl::IsSizedInternalFormat(internalFormat, context->getClientVersion()));
- default:
- return gl::error(GL_INVALID_ENUM);
+ if (gl::IsDepthRenderingSupported(internalFormat, context) ||
+ gl::IsFormatCompressed(internalFormat, context->getClientVersion()) ||
+ !gl::IsTextureFilteringSupported(internalFormat, context) ||
+ !validRenderable)
+ {
+ return gl::error(GL_INVALID_OPERATION);
}
+
+ // Non-power of 2 ES2 check
+ if (!context->supportsNonPower2Texture() && (!gl::isPow2(texture->getBaseLevelWidth()) || !gl::isPow2(texture->getBaseLevelHeight())))
+ {
+ ASSERT(context->getClientVersion() <= 2 && (target == GL_TEXTURE_2D || target == GL_TEXTURE_CUBE_MAP));
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ // Cube completeness check
+ if (target == GL_TEXTURE_CUBE_MAP)
+ {
+ gl::TextureCubeMap *textureCube = static_cast<gl::TextureCubeMap *>(texture);
+ if (!textureCube->isCubeComplete())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ }
+
+ texture->generateMipmaps();
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -2697,11 +2149,11 @@ void __stdcall glGenFencesNV(GLsizei n, GLuint* fences)
{
for (int i = 0; i < n; i++)
{
- fences[i] = context->createFence();
+ fences[i] = context->createFenceNV();
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -2728,7 +2180,7 @@ void __stdcall glGenFramebuffers(GLsizei n, GLuint* framebuffers)
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -2740,22 +2192,22 @@ void __stdcall glGenQueriesEXT(GLsizei n, GLuint* ids)
try
{
- if (n < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
gl::Context *context = gl::getNonLostContext();
if (context)
{
- for (int i = 0; i < n; i++)
+ if (n < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ for (GLsizei i = 0; i < n; i++)
{
ids[i] = context->createQuery();
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -2782,7 +2234,7 @@ void __stdcall glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -2790,7 +2242,7 @@ void __stdcall glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
void __stdcall glGenTextures(GLsizei n, GLuint* textures)
{
- EVENT("(GLsizei n = %d, GLuint* textures = 0x%0.8p)", n, textures);
+ EVENT("(GLsizei n = %d, GLuint* textures = 0x%0.8p)", n, textures);
try
{
@@ -2809,7 +2261,7 @@ void __stdcall glGenTextures(GLsizei n, GLuint* textures)
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -2854,7 +2306,7 @@ void __stdcall glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize,
programObject->getActiveAttribute(index, bufsize, length, size, type, name);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -2899,7 +2351,7 @@ void __stdcall glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize,
programObject->getActiveUniform(index, bufsize, length, size, type, name);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -2938,7 +2390,7 @@ void __stdcall glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* c
return programObject->getAttachedShaders(maxcount, count, shaders);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -2978,7 +2430,7 @@ int __stdcall glGetAttribLocation(GLuint program, const GLchar* name)
return programBinary->getAttributeLocation(name);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY, -1);
}
@@ -2996,54 +2448,24 @@ void __stdcall glGetBooleanv(GLenum pname, GLboolean* params)
if (context)
{
- if (!(context->getBooleanv(pname, params)))
+ GLenum nativeType;
+ unsigned int numParams = 0;
+ if (!ValidateStateQuery(context, pname, &nativeType, &numParams))
{
- GLenum nativeType;
- unsigned int numParams = 0;
- if (!context->getQueryParameterInfo(pname, &nativeType, &numParams))
- return gl::error(GL_INVALID_ENUM);
-
- if (numParams == 0)
- return; // it is known that the pname is valid, but there are no parameters to return
-
- if (nativeType == GL_FLOAT)
- {
- GLfloat *floatParams = NULL;
- floatParams = new GLfloat[numParams];
-
- context->getFloatv(pname, floatParams);
-
- for (unsigned int i = 0; i < numParams; ++i)
- {
- if (floatParams[i] == 0.0f)
- params[i] = GL_FALSE;
- else
- params[i] = GL_TRUE;
- }
-
- delete [] floatParams;
- }
- else if (nativeType == GL_INT)
- {
- GLint *intParams = NULL;
- intParams = new GLint[numParams];
-
- context->getIntegerv(pname, intParams);
-
- for (unsigned int i = 0; i < numParams; ++i)
- {
- if (intParams[i] == 0)
- params[i] = GL_FALSE;
- else
- params[i] = GL_TRUE;
- }
+ return;
+ }
- delete [] intParams;
- }
+ if (nativeType == GL_BOOL)
+ {
+ context->getBooleanv(pname, params);
+ }
+ else
+ {
+ CastStateValues(context, nativeType, pname, numParams, params);
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -3059,19 +2481,18 @@ void __stdcall glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params
if (context)
{
- gl::Buffer *buffer;
+ if (!gl::ValidBufferTarget(context, target))
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
- switch (target)
+ if (!gl::ValidBufferParameter(context, pname))
{
- case GL_ARRAY_BUFFER:
- buffer = context->getArrayBuffer();
- break;
- case GL_ELEMENT_ARRAY_BUFFER:
- buffer = context->getElementArrayBuffer();
- break;
- default: return gl::error(GL_INVALID_ENUM);
+ return gl::error(GL_INVALID_ENUM);
}
+ gl::Buffer *buffer = context->getTargetBuffer(target);
+
if (!buffer)
{
// A null buffer means that "0" is bound to the requested buffer target
@@ -3081,16 +2502,28 @@ void __stdcall glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params
switch (pname)
{
case GL_BUFFER_USAGE:
- *params = buffer->usage();
+ *params = static_cast<GLint>(buffer->usage());
break;
case GL_BUFFER_SIZE:
- *params = buffer->size();
+ *params = gl::clampCast<GLint>(buffer->size());
break;
- default: return gl::error(GL_INVALID_ENUM);
+ case GL_BUFFER_ACCESS_FLAGS:
+ *params = buffer->accessFlags();
+ break;
+ case GL_BUFFER_MAPPED:
+ *params = static_cast<GLint>(buffer->mapped());
+ break;
+ case GL_BUFFER_MAP_OFFSET:
+ *params = gl::clampCast<GLint>(buffer->mapOffset());
+ break;
+ case GL_BUFFER_MAP_LENGTH:
+ *params = gl::clampCast<GLint>(buffer->mapLength());
+ break;
+ default: UNREACHABLE(); break;
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -3121,17 +2554,31 @@ void __stdcall glGetFenceivNV(GLuint fence, GLenum pname, GLint *params)
if (context)
{
- gl::Fence *fenceObject = context->getFence(fence);
+ gl::FenceNV *fenceObject = context->getFenceNV(fence);
if (fenceObject == NULL)
{
return gl::error(GL_INVALID_OPERATION);
}
- fenceObject->getFenceiv(pname, params);
+ if (fenceObject->isFence() != GL_TRUE)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ switch (pname)
+ {
+ case GL_FENCE_STATUS_NV:
+ case GL_FENCE_CONDITION_NV:
+ break;
+
+ default: return gl::error(GL_INVALID_ENUM);
+ }
+
+ params[0] = fenceObject->getFencei(pname);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -3147,51 +2594,24 @@ void __stdcall glGetFloatv(GLenum pname, GLfloat* params)
if (context)
{
- if (!(context->getFloatv(pname, params)))
+ GLenum nativeType;
+ unsigned int numParams = 0;
+ if (!ValidateStateQuery(context, pname, &nativeType, &numParams))
{
- GLenum nativeType;
- unsigned int numParams = 0;
- if (!context->getQueryParameterInfo(pname, &nativeType, &numParams))
- return gl::error(GL_INVALID_ENUM);
-
- if (numParams == 0)
- return; // it is known that the pname is valid, but that there are no parameters to return.
-
- if (nativeType == GL_BOOL)
- {
- GLboolean *boolParams = NULL;
- boolParams = new GLboolean[numParams];
-
- context->getBooleanv(pname, boolParams);
-
- for (unsigned int i = 0; i < numParams; ++i)
- {
- if (boolParams[i] == GL_FALSE)
- params[i] = 0.0f;
- else
- params[i] = 1.0f;
- }
-
- delete [] boolParams;
- }
- else if (nativeType == GL_INT)
- {
- GLint *intParams = NULL;
- intParams = new GLint[numParams];
-
- context->getIntegerv(pname, intParams);
-
- for (unsigned int i = 0; i < numParams; ++i)
- {
- params[i] = (GLfloat)intParams[i];
- }
+ return;
+ }
- delete [] intParams;
- }
+ if (nativeType == GL_FLOAT)
+ {
+ context->getFloatv(pname, params);
+ }
+ else
+ {
+ CastStateValues(context, nativeType, pname, numParams, params);
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -3208,68 +2628,162 @@ void __stdcall glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attac
if (context)
{
- if (target != GL_FRAMEBUFFER && target != GL_DRAW_FRAMEBUFFER_ANGLE && target != GL_READ_FRAMEBUFFER_ANGLE)
+ if (!gl::ValidFramebufferTarget(target))
{
return gl::error(GL_INVALID_ENUM);
}
- gl::Framebuffer *framebuffer = NULL;
- if (target == GL_READ_FRAMEBUFFER_ANGLE)
+ switch (pname)
{
- if(context->getReadFramebufferHandle() == 0)
+ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
+ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
+ break;
+ case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE:
+ case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
+ case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
+ case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
+ case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:
+ case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
+ case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:
+ case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:
+ if (context->getClientVersion() >= 3)
{
- return gl::error(GL_INVALID_OPERATION);
+ break;
}
-
- framebuffer = context->getReadFramebuffer();
+ default:
+ return gl::error(GL_INVALID_ENUM);
}
- else
+
+ // Determine if the attachment is a valid enum
+ switch (attachment)
{
- if (context->getDrawFramebufferHandle() == 0)
+ case GL_BACK:
+ case GL_FRONT:
+ case GL_DEPTH:
+ case GL_STENCIL:
+ case GL_DEPTH_STENCIL_ATTACHMENT:
+ if (context->getClientVersion() < 3)
{
- return gl::error(GL_INVALID_OPERATION);
+ return gl::error(GL_INVALID_ENUM);
}
+ break;
- framebuffer = context->getDrawFramebuffer();
+ case GL_DEPTH_ATTACHMENT:
+ case GL_STENCIL_ATTACHMENT:
+ break;
+
+ default:
+ if (attachment < GL_COLOR_ATTACHMENT0_EXT ||
+ (attachment - GL_COLOR_ATTACHMENT0_EXT) >= context->getMaximumRenderTargets())
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ break;
}
+ GLuint framebufferHandle = context->getTargetFramebufferHandle(target);
+ ASSERT(framebufferHandle != GL_INVALID_INDEX);
+ gl::Framebuffer *framebuffer = context->getFramebuffer(framebufferHandle);
+
GLenum attachmentType;
GLuint attachmentHandle;
+ GLuint attachmentLevel;
+ GLuint attachmentLayer;
+ gl::FramebufferAttachment *attachmentObject;
- if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT)
+ if (framebufferHandle == 0)
{
- const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT);
-
- if (colorAttachment >= context->getMaximumRenderTargets())
+ if (context->getClientVersion() < 3)
{
- return gl::error(GL_INVALID_ENUM);
+ return gl::error(GL_INVALID_OPERATION);
}
- attachmentType = framebuffer->getColorbufferType(colorAttachment);
- attachmentHandle = framebuffer->getColorbufferHandle(colorAttachment);
- }
- else
- {
switch (attachment)
{
- case GL_DEPTH_ATTACHMENT:
+ case GL_BACK:
+ attachmentType = framebuffer->getColorbufferType(0);
+ attachmentHandle = framebuffer->getColorbufferHandle(0);
+ attachmentLevel = framebuffer->getColorbufferMipLevel(0);
+ attachmentLayer = framebuffer->getColorbufferLayer(0);
+ attachmentObject = framebuffer->getColorbuffer(0);
+ break;
+ case GL_DEPTH:
attachmentType = framebuffer->getDepthbufferType();
attachmentHandle = framebuffer->getDepthbufferHandle();
+ attachmentLevel = framebuffer->getDepthbufferMipLevel();
+ attachmentLayer = framebuffer->getDepthbufferLayer();
+ attachmentObject = framebuffer->getDepthbuffer();
break;
- case GL_STENCIL_ATTACHMENT:
+ case GL_STENCIL:
attachmentType = framebuffer->getStencilbufferType();
attachmentHandle = framebuffer->getStencilbufferHandle();
+ attachmentLevel = framebuffer->getStencilbufferMipLevel();
+ attachmentLayer = framebuffer->getStencilbufferLayer();
+ attachmentObject = framebuffer->getStencilbuffer();
break;
- default: return gl::error(GL_INVALID_ENUM);
+ default:
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ }
+ else
+ {
+ if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT)
+ {
+ const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT);
+ attachmentType = framebuffer->getColorbufferType(colorAttachment);
+ attachmentHandle = framebuffer->getColorbufferHandle(colorAttachment);
+ attachmentLevel = framebuffer->getColorbufferMipLevel(colorAttachment);
+ attachmentLayer = framebuffer->getColorbufferLayer(colorAttachment);
+ attachmentObject = framebuffer->getColorbuffer(colorAttachment);
+ }
+ else
+ {
+ switch (attachment)
+ {
+ case GL_DEPTH_ATTACHMENT:
+ attachmentType = framebuffer->getDepthbufferType();
+ attachmentHandle = framebuffer->getDepthbufferHandle();
+ attachmentLevel = framebuffer->getDepthbufferMipLevel();
+ attachmentLayer = framebuffer->getDepthbufferLayer();
+ attachmentObject = framebuffer->getDepthbuffer();
+ break;
+ case GL_STENCIL_ATTACHMENT:
+ attachmentType = framebuffer->getStencilbufferType();
+ attachmentHandle = framebuffer->getStencilbufferHandle();
+ attachmentLevel = framebuffer->getStencilbufferMipLevel();
+ attachmentLayer = framebuffer->getStencilbufferLayer();
+ attachmentObject = framebuffer->getStencilbuffer();
+ break;
+ case GL_DEPTH_STENCIL_ATTACHMENT:
+ if (framebuffer->getDepthbufferHandle() != framebuffer->getStencilbufferHandle())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ attachmentType = framebuffer->getDepthStencilbufferType();
+ attachmentHandle = framebuffer->getDepthStencilbufferHandle();
+ attachmentLevel = framebuffer->getDepthStencilbufferMipLevel();
+ attachmentLayer = framebuffer->getDepthStencilbufferLayer();
+ attachmentObject = framebuffer->getDepthStencilBuffer();
+ break;
+ default:
+ return gl::error(GL_INVALID_OPERATION);
+ }
}
}
GLenum attachmentObjectType; // Type category
- if (attachmentType == GL_NONE || attachmentType == GL_RENDERBUFFER)
+ if (framebufferHandle == 0)
+ {
+ attachmentObjectType = GL_FRAMEBUFFER_DEFAULT;
+ }
+ else if (attachmentType == GL_NONE || attachmentType == GL_RENDERBUFFER)
{
attachmentObjectType = attachmentType;
}
- else if (gl::IsInternalTextureTarget(attachmentType))
+ else if (gl::IsInternalTextureTarget(attachmentType, context->getClientVersion()))
{
attachmentObjectType = GL_TEXTURE;
}
@@ -3279,54 +2793,128 @@ void __stdcall glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attac
return;
}
- switch (pname)
+ if (attachmentObjectType == GL_NONE)
{
- case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
- *params = attachmentObjectType;
- break;
- case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
- if (attachmentObjectType == GL_RENDERBUFFER || attachmentObjectType == GL_TEXTURE)
- {
- *params = attachmentHandle;
- }
- else
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
- if (attachmentObjectType == GL_TEXTURE)
- {
- *params = 0; // FramebufferTexture2D will not allow level to be set to anything else in GL ES 2.0
- }
- else
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
- if (attachmentObjectType == GL_TEXTURE)
+ // ES 2.0.25 spec pg 127 states that if the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
+ // is NONE, then querying any other pname will generate INVALID_ENUM.
+
+ // ES 3.0.2 spec pg 235 states that if the attachment type is none,
+ // GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME will return zero and be an
+ // INVALID_OPERATION for all other pnames
+
+ switch (pname)
{
- if (gl::IsCubemapTextureTarget(attachmentType))
+ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
+ *params = attachmentObjectType;
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = 0;
+ break;
+
+ default:
+ if (context->getClientVersion() < 3)
{
- *params = attachmentType;
+ return gl::error(GL_INVALID_ENUM);
}
else
{
- *params = 0;
+ gl::error(GL_INVALID_OPERATION);
}
}
- else
+ }
+ else
+ {
+ ASSERT(attachmentObjectType == GL_RENDERBUFFER || attachmentObjectType == GL_TEXTURE ||
+ attachmentObjectType == GL_FRAMEBUFFER_DEFAULT);
+ ASSERT(attachmentObject != NULL);
+
+ switch (pname)
{
- return gl::error(GL_INVALID_ENUM);
+ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
+ *params = attachmentObjectType;
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
+ if (attachmentObjectType != GL_RENDERBUFFER && attachmentObjectType != GL_TEXTURE)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = attachmentHandle;
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
+ if (attachmentObjectType != GL_TEXTURE)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = attachmentLevel;
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
+ if (attachmentObjectType != GL_TEXTURE)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = gl::IsCubemapTextureTarget(attachmentType) ? attachmentType : 0;
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE:
+ *params = attachmentObject->getRedSize();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
+ *params = attachmentObject->getGreenSize();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
+ *params = attachmentObject->getBlueSize();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
+ *params = attachmentObject->getAlphaSize();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:
+ *params = attachmentObject->getDepthSize();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
+ *params = attachmentObject->getStencilSize();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:
+ if (attachment == GL_DEPTH_STENCIL)
+ {
+ gl::error(GL_INVALID_OPERATION);
+ }
+ *params = attachmentObject->getComponentType();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:
+ *params = attachmentObject->getColorEncoding();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:
+ if (attachmentObjectType != GL_TEXTURE)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = attachmentLayer;
+ break;
+
+ default:
+ UNREACHABLE();
+ break;
}
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -3347,7 +2935,7 @@ GLenum __stdcall glGetGraphicsResetStatusEXT(void)
return GL_NO_ERROR;
}
- catch(std::bad_alloc&)
+ catch (...)
{
return GL_OUT_OF_MEMORY;
}
@@ -3363,56 +2951,25 @@ void __stdcall glGetIntegerv(GLenum pname, GLint* params)
if (context)
{
- if (!(context->getIntegerv(pname, params)))
- {
- GLenum nativeType;
- unsigned int numParams = 0;
- if (!context->getQueryParameterInfo(pname, &nativeType, &numParams))
- return gl::error(GL_INVALID_ENUM);
-
- if (numParams == 0)
- return; // it is known that pname is valid, but there are no parameters to return
-
- if (nativeType == GL_BOOL)
- {
- GLboolean *boolParams = NULL;
- boolParams = new GLboolean[numParams];
-
- context->getBooleanv(pname, boolParams);
-
- for (unsigned int i = 0; i < numParams; ++i)
- {
- if (boolParams[i] == GL_FALSE)
- params[i] = 0;
- else
- params[i] = 1;
- }
+ GLenum nativeType;
+ unsigned int numParams = 0;
- delete [] boolParams;
- }
- else if (nativeType == GL_FLOAT)
- {
- GLfloat *floatParams = NULL;
- floatParams = new GLfloat[numParams];
-
- context->getFloatv(pname, floatParams);
-
- for (unsigned int i = 0; i < numParams; ++i)
- {
- if (pname == GL_DEPTH_RANGE || pname == GL_COLOR_CLEAR_VALUE || pname == GL_DEPTH_CLEAR_VALUE || pname == GL_BLEND_COLOR)
- {
- params[i] = (GLint)(((GLfloat)(0xFFFFFFFF) * floatParams[i] - 1.0f) / 2.0f);
- }
- else
- params[i] = (GLint)(floatParams[i] > 0.0f ? floor(floatParams[i] + 0.5) : ceil(floatParams[i] - 0.5));
- }
+ if (!ValidateStateQuery(context, pname, &nativeType, &numParams))
+ {
+ return;
+ }
- delete [] floatParams;
- }
+ if (nativeType == GL_INT)
+ {
+ context->getIntegerv(pname, params);
+ }
+ else
+ {
+ CastStateValues(context, nativeType, pname, numParams, params);
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -3435,6 +2992,19 @@ void __stdcall glGetProgramiv(GLuint program, GLenum pname, GLint* params)
return gl::error(GL_INVALID_VALUE);
}
+ if (context->getClientVersion() < 3)
+ {
+ switch (pname)
+ {
+ case GL_ACTIVE_UNIFORM_BLOCKS:
+ case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH:
+ case GL_TRANSFORM_FEEDBACK_BUFFER_MODE:
+ case GL_TRANSFORM_FEEDBACK_VARYINGS:
+ case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH:
+ return gl::error(GL_INVALID_ENUM);
+ }
+ }
+
switch (pname)
{
case GL_DELETE_STATUS:
@@ -3467,12 +3037,27 @@ void __stdcall glGetProgramiv(GLuint program, GLenum pname, GLint* params)
case GL_PROGRAM_BINARY_LENGTH_OES:
*params = programObject->getProgramBinaryLength();
return;
+ case GL_ACTIVE_UNIFORM_BLOCKS:
+ *params = programObject->getActiveUniformBlockCount();
+ return;
+ case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH:
+ *params = programObject->getActiveUniformBlockMaxLength();
+ break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER_MODE:
+ *params = programObject->getTransformFeedbackBufferMode();
+ break;
+ case GL_TRANSFORM_FEEDBACK_VARYINGS:
+ *params = programObject->getTransformFeedbackVaryingCount();
+ break;
+ case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH:
+ *params = programObject->getTransformFeedbackVaryingMaxLength();
+ break;
default:
return gl::error(GL_INVALID_ENUM);
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -3504,7 +3089,7 @@ void __stdcall glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* len
programObject->getInfoLog(bufsize, length, infolog);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -3516,22 +3101,27 @@ void __stdcall glGetQueryivEXT(GLenum target, GLenum pname, GLint *params)
try
{
- switch (pname)
- {
- case GL_CURRENT_QUERY_EXT:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
gl::Context *context = gl::getNonLostContext();
if (context)
{
- params[0] = context->getActiveQuery(target);
+ if (!ValidQueryType(context, target))
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ switch (pname)
+ {
+ case GL_CURRENT_QUERY_EXT:
+ params[0] = context->getActiveQueryId(target);
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -3543,14 +3133,6 @@ void __stdcall glGetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params)
try
{
- switch (pname)
- {
- case GL_QUERY_RESULT_EXT:
- case GL_QUERY_RESULT_AVAILABLE_EXT:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
gl::Context *context = gl::getNonLostContext();
if (context)
@@ -3562,7 +3144,7 @@ void __stdcall glGetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params)
return gl::error(GL_INVALID_OPERATION);
}
- if (context->getActiveQuery(queryObject->getType()) == id)
+ if (context->getActiveQueryId(queryObject->getType()) == id)
{
return gl::error(GL_INVALID_OPERATION);
}
@@ -3576,11 +3158,11 @@ void __stdcall glGetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params)
params[0] = queryObject->isResultAvailable();
break;
default:
- ASSERT(false);
+ return gl::error(GL_INVALID_ENUM);
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -3606,23 +3188,23 @@ void __stdcall glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint*
return gl::error(GL_INVALID_OPERATION);
}
- gl::Renderbuffer *renderbuffer = context->getRenderbuffer(context->getRenderbufferHandle());
+ gl::FramebufferAttachment *attachment = context->getRenderbuffer(context->getRenderbufferHandle());
switch (pname)
{
- case GL_RENDERBUFFER_WIDTH: *params = renderbuffer->getWidth(); break;
- case GL_RENDERBUFFER_HEIGHT: *params = renderbuffer->getHeight(); break;
- case GL_RENDERBUFFER_INTERNAL_FORMAT: *params = renderbuffer->getInternalFormat(); break;
- case GL_RENDERBUFFER_RED_SIZE: *params = renderbuffer->getRedSize(); break;
- case GL_RENDERBUFFER_GREEN_SIZE: *params = renderbuffer->getGreenSize(); break;
- case GL_RENDERBUFFER_BLUE_SIZE: *params = renderbuffer->getBlueSize(); break;
- case GL_RENDERBUFFER_ALPHA_SIZE: *params = renderbuffer->getAlphaSize(); break;
- case GL_RENDERBUFFER_DEPTH_SIZE: *params = renderbuffer->getDepthSize(); break;
- case GL_RENDERBUFFER_STENCIL_SIZE: *params = renderbuffer->getStencilSize(); break;
+ case GL_RENDERBUFFER_WIDTH: *params = attachment->getWidth(); break;
+ case GL_RENDERBUFFER_HEIGHT: *params = attachment->getHeight(); break;
+ case GL_RENDERBUFFER_INTERNAL_FORMAT: *params = attachment->getInternalFormat(); break;
+ case GL_RENDERBUFFER_RED_SIZE: *params = attachment->getRedSize(); break;
+ case GL_RENDERBUFFER_GREEN_SIZE: *params = attachment->getGreenSize(); break;
+ case GL_RENDERBUFFER_BLUE_SIZE: *params = attachment->getBlueSize(); break;
+ case GL_RENDERBUFFER_ALPHA_SIZE: *params = attachment->getAlphaSize(); break;
+ case GL_RENDERBUFFER_DEPTH_SIZE: *params = attachment->getDepthSize(); break;
+ case GL_RENDERBUFFER_STENCIL_SIZE: *params = attachment->getStencilSize(); break;
case GL_RENDERBUFFER_SAMPLES_ANGLE:
if (context->getMaxSupportedSamples() != 0)
{
- *params = renderbuffer->getSamples();
+ *params = attachment->getSamples();
}
else
{
@@ -3634,7 +3216,7 @@ void __stdcall glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint*
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -3682,7 +3264,7 @@ void __stdcall glGetShaderiv(GLuint shader, GLenum pname, GLint* params)
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -3714,7 +3296,7 @@ void __stdcall glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* lengt
shaderObject->getInfoLog(bufsize, length, infolog);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -3759,7 +3341,7 @@ void __stdcall glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontyp
return gl::error(GL_INVALID_ENUM);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -3791,7 +3373,7 @@ void __stdcall glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length
shaderObject->getSource(bufsize, length, source);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -3823,7 +3405,7 @@ void __stdcall glGetTranslatedShaderSourceANGLE(GLuint shader, GLsizei bufsize,
shaderObject->getTranslatedSource(bufsize, length, source);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -3844,16 +3426,30 @@ const GLubyte* __stdcall glGetString(GLenum name)
case GL_RENDERER:
return (GLubyte*)((context != NULL) ? context->getRendererString() : "ANGLE");
case GL_VERSION:
- return (GLubyte*)"OpenGL ES 2.0 (ANGLE " VERSION_STRING ")";
+ if (context->getClientVersion() == 2)
+ {
+ return (GLubyte*)"OpenGL ES 2.0 (ANGLE " ANGLE_VERSION_STRING ")";
+ }
+ else
+ {
+ return (GLubyte*)"OpenGL ES 3.0 (ANGLE " ANGLE_VERSION_STRING ")";
+ }
case GL_SHADING_LANGUAGE_VERSION:
- return (GLubyte*)"OpenGL ES GLSL ES 1.00 (ANGLE " VERSION_STRING ")";
+ if (context->getClientVersion() == 2)
+ {
+ return (GLubyte*)"OpenGL ES GLSL ES 1.00 (ANGLE " ANGLE_VERSION_STRING ")";
+ }
+ else
+ {
+ return (GLubyte*)"OpenGL ES GLSL ES 3.00 (ANGLE " ANGLE_VERSION_STRING ")";
+ }
case GL_EXTENSIONS:
- return (GLubyte*)((context != NULL) ? context->getExtensionString() : "");
+ return (GLubyte*)((context != NULL) ? context->getCombinedExtensionsString() : "");
default:
return gl::error(GL_INVALID_ENUM, (GLubyte*)NULL);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY, (GLubyte*)NULL);
}
@@ -3869,17 +3465,10 @@ void __stdcall glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
if (context)
{
- gl::Texture *texture;
+ gl::Texture *texture = context->getTargetTexture(target);
- switch (target)
+ if (!texture)
{
- case GL_TEXTURE_2D:
- texture = context->getTexture2D();
- break;
- case GL_TEXTURE_CUBE_MAP:
- texture = context->getTextureCubeMap();
- break;
- default:
return gl::error(GL_INVALID_ENUM);
}
@@ -3897,9 +3486,24 @@ void __stdcall glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
case GL_TEXTURE_WRAP_T:
*params = (GLfloat)texture->getWrapT();
break;
- case GL_TEXTURE_IMMUTABLE_FORMAT_EXT:
+ case GL_TEXTURE_WRAP_R:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLfloat)texture->getWrapR();
+ break;
+ case GL_TEXTURE_IMMUTABLE_FORMAT:
+ // Exposed to ES2.0 through EXT_texture_storage, no client version validation.
*params = (GLfloat)(texture->isImmutable() ? GL_TRUE : GL_FALSE);
break;
+ case GL_TEXTURE_IMMUTABLE_LEVELS:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLfloat)texture->immutableLevelCount();
+ break;
case GL_TEXTURE_USAGE_ANGLE:
*params = (GLfloat)texture->getUsage();
break;
@@ -3910,12 +3514,68 @@ void __stdcall glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
}
*params = (GLfloat)texture->getMaxAnisotropy();
break;
+ case GL_TEXTURE_SWIZZLE_R:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLfloat)texture->getSwizzleRed();
+ break;
+ case GL_TEXTURE_SWIZZLE_G:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLfloat)texture->getSwizzleGreen();
+ break;
+ case GL_TEXTURE_SWIZZLE_B:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLfloat)texture->getSwizzleBlue();
+ break;
+ case GL_TEXTURE_SWIZZLE_A:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLfloat)texture->getSwizzleAlpha();
+ break;
+ case GL_TEXTURE_BASE_LEVEL:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLfloat)texture->getBaseLevel();
+ break;
+ case GL_TEXTURE_MAX_LEVEL:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLfloat)texture->getMaxLevel();
+ break;
+ case GL_TEXTURE_MIN_LOD:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = texture->getMinLod();
+ break;
+ case GL_TEXTURE_MAX_LOD:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = texture->getMaxLod();
+ break;
default:
return gl::error(GL_INVALID_ENUM);
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -3931,17 +3591,10 @@ void __stdcall glGetTexParameteriv(GLenum target, GLenum pname, GLint* params)
if (context)
{
- gl::Texture *texture;
+ gl::Texture *texture = context->getTargetTexture(target);
- switch (target)
+ if (!texture)
{
- case GL_TEXTURE_2D:
- texture = context->getTexture2D();
- break;
- case GL_TEXTURE_CUBE_MAP:
- texture = context->getTextureCubeMap();
- break;
- default:
return gl::error(GL_INVALID_ENUM);
}
@@ -3959,9 +3612,24 @@ void __stdcall glGetTexParameteriv(GLenum target, GLenum pname, GLint* params)
case GL_TEXTURE_WRAP_T:
*params = texture->getWrapT();
break;
- case GL_TEXTURE_IMMUTABLE_FORMAT_EXT:
+ case GL_TEXTURE_WRAP_R:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = texture->getWrapR();
+ break;
+ case GL_TEXTURE_IMMUTABLE_FORMAT:
+ // Exposed to ES2.0 through EXT_texture_storage, no client version validation.
*params = texture->isImmutable() ? GL_TRUE : GL_FALSE;
break;
+ case GL_TEXTURE_IMMUTABLE_LEVELS:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = texture->immutableLevelCount();
+ break;
case GL_TEXTURE_USAGE_ANGLE:
*params = texture->getUsage();
break;
@@ -3972,12 +3640,68 @@ void __stdcall glGetTexParameteriv(GLenum target, GLenum pname, GLint* params)
}
*params = (GLint)texture->getMaxAnisotropy();
break;
+ case GL_TEXTURE_SWIZZLE_R:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = texture->getSwizzleRed();
+ break;
+ case GL_TEXTURE_SWIZZLE_G:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = texture->getSwizzleGreen();
+ break;
+ case GL_TEXTURE_SWIZZLE_B:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = texture->getSwizzleBlue();
+ break;
+ case GL_TEXTURE_SWIZZLE_A:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = texture->getSwizzleAlpha();
+ break;
+ case GL_TEXTURE_BASE_LEVEL:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = texture->getBaseLevel();
+ break;
+ case GL_TEXTURE_MAX_LEVEL:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = texture->getMaxLevel();
+ break;
+ case GL_TEXTURE_MIN_LOD:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLint)texture->getMinLod();
+ break;
+ case GL_TEXTURE_MAX_LOD:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLint)texture->getMaxLod();
+ break;
default:
return gl::error(GL_INVALID_ENUM);
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -4023,7 +3747,7 @@ void __stdcall glGetnUniformfvEXT(GLuint program, GLint location, GLsizei bufSiz
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -4063,7 +3787,7 @@ void __stdcall glGetUniformfv(GLuint program, GLint location, GLfloat* params)
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -4109,7 +3833,7 @@ void __stdcall glGetnUniformivEXT(GLuint program, GLint location, GLsizei bufSiz
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -4149,7 +3873,7 @@ void __stdcall glGetUniformiv(GLuint program, GLint location, GLint* params)
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -4193,7 +3917,7 @@ int __stdcall glGetUniformLocation(GLuint program, const GLchar* name)
return programBinary->getUniformLocation(name);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY, -1);
}
@@ -4218,40 +3942,26 @@ void __stdcall glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
const gl::VertexAttribute &attribState = context->getVertexAttribState(index);
- switch (pname)
+ if (!gl::ValidateGetVertexAttribParameters(pname, context->getClientVersion()))
{
- case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
- *params = (GLfloat)(attribState.mArrayEnabled ? GL_TRUE : GL_FALSE);
- break;
- case GL_VERTEX_ATTRIB_ARRAY_SIZE:
- *params = (GLfloat)attribState.mSize;
- break;
- case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
- *params = (GLfloat)attribState.mStride;
- break;
- case GL_VERTEX_ATTRIB_ARRAY_TYPE:
- *params = (GLfloat)attribState.mType;
- break;
- case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
- *params = (GLfloat)(attribState.mNormalized ? GL_TRUE : GL_FALSE);
- break;
- case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
- *params = (GLfloat)attribState.mBoundBuffer.id();
- break;
- case GL_CURRENT_VERTEX_ATTRIB:
+ return;
+ }
+
+ if (pname == GL_CURRENT_VERTEX_ATTRIB)
+ {
+ const gl::VertexAttribCurrentValueData &currentValueData = context->getVertexAttribCurrentValue(index);
for (int i = 0; i < 4; ++i)
{
- params[i] = attribState.mCurrentValue[i];
+ params[i] = currentValueData.FloatValues[i];
}
- break;
- case GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:
- *params = (GLfloat)attribState.mDivisor;
- break;
- default: return gl::error(GL_INVALID_ENUM);
+ }
+ else
+ {
+ *params = attribState.querySingleParameter<GLfloat>(pname);
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -4274,41 +3984,27 @@ void __stdcall glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
const gl::VertexAttribute &attribState = context->getVertexAttribState(index);
- switch (pname)
+ if (!gl::ValidateGetVertexAttribParameters(pname, context->getClientVersion()))
{
- case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
- *params = (attribState.mArrayEnabled ? GL_TRUE : GL_FALSE);
- break;
- case GL_VERTEX_ATTRIB_ARRAY_SIZE:
- *params = attribState.mSize;
- break;
- case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
- *params = attribState.mStride;
- break;
- case GL_VERTEX_ATTRIB_ARRAY_TYPE:
- *params = attribState.mType;
- break;
- case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
- *params = (attribState.mNormalized ? GL_TRUE : GL_FALSE);
- break;
- case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
- *params = attribState.mBoundBuffer.id();
- break;
- case GL_CURRENT_VERTEX_ATTRIB:
+ return;
+ }
+
+ if (pname == GL_CURRENT_VERTEX_ATTRIB)
+ {
+ const gl::VertexAttribCurrentValueData &currentValueData = context->getVertexAttribCurrentValue(index);
for (int i = 0; i < 4; ++i)
{
- float currentValue = attribState.mCurrentValue[i];
- params[i] = (GLint)(currentValue > 0.0f ? floor(currentValue + 0.5f) : ceil(currentValue - 0.5f));
+ float currentValue = currentValueData.FloatValues[i];
+ params[i] = gl::iround<GLint>(currentValue);
}
- break;
- case GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:
- *params = (GLint)attribState.mDivisor;
- break;
- default: return gl::error(GL_INVALID_ENUM);
+ }
+ else
+ {
+ *params = attribState.querySingleParameter<GLint>(pname);
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -4337,7 +4033,7 @@ void __stdcall glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** po
*pointer = const_cast<GLvoid*>(context->getVertexAttribPointer(index));
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -4372,7 +4068,7 @@ void __stdcall glHint(GLenum target, GLenum mode)
return gl::error(GL_INVALID_ENUM);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -4396,7 +4092,7 @@ GLboolean __stdcall glIsBuffer(GLuint buffer)
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
}
@@ -4414,23 +4110,15 @@ GLboolean __stdcall glIsEnabled(GLenum cap)
if (context)
{
- switch (cap)
+ if (!ValidCap(context, cap))
{
- case GL_CULL_FACE: return context->isCullFaceEnabled();
- case GL_POLYGON_OFFSET_FILL: return context->isPolygonOffsetFillEnabled();
- case GL_SAMPLE_ALPHA_TO_COVERAGE: return context->isSampleAlphaToCoverageEnabled();
- case GL_SAMPLE_COVERAGE: return context->isSampleCoverageEnabled();
- case GL_SCISSOR_TEST: return context->isScissorTestEnabled();
- case GL_STENCIL_TEST: return context->isStencilTestEnabled();
- case GL_DEPTH_TEST: return context->isDepthTestEnabled();
- case GL_BLEND: return context->isBlendEnabled();
- case GL_DITHER: return context->isDitherEnabled();
- default:
return gl::error(GL_INVALID_ENUM, false);
}
+
+ return context->getCap(cap);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY, false);
}
@@ -4448,7 +4136,7 @@ GLboolean __stdcall glIsFenceNV(GLuint fence)
if (context)
{
- gl::Fence *fenceObject = context->getFence(fence);
+ gl::FenceNV *fenceObject = context->getFenceNV(fence);
if (fenceObject == NULL)
{
@@ -4458,7 +4146,7 @@ GLboolean __stdcall glIsFenceNV(GLuint fence)
return fenceObject->isFence();
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
}
@@ -4484,7 +4172,7 @@ GLboolean __stdcall glIsFramebuffer(GLuint framebuffer)
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
}
@@ -4510,7 +4198,7 @@ GLboolean __stdcall glIsProgram(GLuint program)
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
}
@@ -4524,24 +4212,14 @@ GLboolean __stdcall glIsQueryEXT(GLuint id)
try
{
- if (id == 0)
- {
- return GL_FALSE;
- }
-
gl::Context *context = gl::getNonLostContext();
if (context)
{
- gl::Query *queryObject = context->getQuery(id, false, GL_NONE);
-
- if (queryObject)
- {
- return GL_TRUE;
- }
+ return (context->getQuery(id, false, GL_NONE) != NULL) ? GL_TRUE : GL_FALSE;
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
}
@@ -4559,7 +4237,7 @@ GLboolean __stdcall glIsRenderbuffer(GLuint renderbuffer)
if (context && renderbuffer)
{
- gl::Renderbuffer *renderbufferObject = context->getRenderbuffer(renderbuffer);
+ gl::FramebufferAttachment *renderbufferObject = context->getRenderbuffer(renderbuffer);
if (renderbufferObject)
{
@@ -4567,7 +4245,7 @@ GLboolean __stdcall glIsRenderbuffer(GLuint renderbuffer)
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
}
@@ -4593,7 +4271,7 @@ GLboolean __stdcall glIsShader(GLuint shader)
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
}
@@ -4619,7 +4297,7 @@ GLboolean __stdcall glIsTexture(GLuint texture)
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
}
@@ -4645,7 +4323,7 @@ void __stdcall glLineWidth(GLfloat width)
context->setLineWidth(width);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -4678,7 +4356,7 @@ void __stdcall glLinkProgram(GLuint program)
context->linkProgram(program);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -4718,12 +4396,27 @@ void __stdcall glPixelStorei(GLenum pname, GLint param)
context->setPackReverseRowOrder(param != 0);
break;
+ case GL_UNPACK_IMAGE_HEIGHT:
+ case GL_UNPACK_SKIP_IMAGES:
+ case GL_UNPACK_ROW_LENGTH:
+ case GL_UNPACK_SKIP_ROWS:
+ case GL_UNPACK_SKIP_PIXELS:
+ case GL_PACK_ROW_LENGTH:
+ case GL_PACK_SKIP_ROWS:
+ case GL_PACK_SKIP_PIXELS:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ UNIMPLEMENTED();
+ break;
+
default:
return gl::error(GL_INVALID_ENUM);
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -4742,7 +4435,7 @@ void __stdcall glPolygonOffset(GLfloat factor, GLfloat units)
context->setPolygonOffsetParams(factor, units);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -4767,23 +4460,16 @@ void __stdcall glReadnPixelsEXT(GLint x, GLint y, GLsizei width, GLsizei height,
if (context)
{
- GLenum currentFormat, currentType;
-
- // Failure in getCurrentReadFormatType indicates that no color attachment is currently bound,
- // and attempting to read back if that's the case is an error. The error will be registered
- // by getCurrentReadFormat.
- if (!context->getCurrentReadFormatType(&currentFormat, &currentType))
- return;
-
- if (!(currentFormat == format && currentType == type) && !validReadFormatType(format, type))
+ if (!gl::ValidateReadPixelsParameters(context, x, y, width, height,
+ format, type, &bufSize, data))
{
- return gl::error(GL_INVALID_OPERATION);
+ return;
}
context->readPixels(x, y, width, height, format, type, &bufSize, data);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -4807,23 +4493,16 @@ void __stdcall glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
if (context)
{
- GLenum currentFormat, currentType;
-
- // Failure in getCurrentReadFormatType indicates that no color attachment is currently bound,
- // and attempting to read back if that's the case is an error. The error will be registered
- // by getCurrentReadFormat.
- if (!context->getCurrentReadFormatType(&currentFormat, &currentType))
- return;
-
- if (!(currentFormat == format && currentType == type) && !validReadFormatType(format, type))
+ if (!gl::ValidateReadPixelsParameters(context, x, y, width, height,
+ format, type, NULL, pixels))
{
- return gl::error(GL_INVALID_OPERATION);
+ return;
}
context->readPixels(x, y, width, height, format, type, NULL, pixels);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -4837,7 +4516,7 @@ void __stdcall glReleaseShaderCompiler(void)
{
gl::Shader::releaseCompiler();
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -4850,59 +4529,20 @@ void __stdcall glRenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samp
try
{
- switch (target)
- {
- case GL_RENDERBUFFER:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- if (!gl::IsColorRenderable(internalformat) && !gl::IsDepthRenderable(internalformat) && !gl::IsStencilRenderable(internalformat))
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- if (width < 0 || height < 0 || samples < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
gl::Context *context = gl::getNonLostContext();
if (context)
{
- if (width > context->getMaximumRenderbufferDimension() ||
- height > context->getMaximumRenderbufferDimension() ||
- samples > context->getMaxSupportedSamples())
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- GLuint handle = context->getRenderbufferHandle();
- if (handle == 0)
+ if (!ValidateRenderbufferStorageParameters(context, target, samples, internalformat,
+ width, height, true))
{
- return gl::error(GL_INVALID_OPERATION);
+ return;
}
- switch (internalformat)
- {
- case GL_DEPTH_COMPONENT16:
- case GL_RGBA4:
- case GL_RGB5_A1:
- case GL_RGB565:
- case GL_RGB8_OES:
- case GL_RGBA8_OES:
- case GL_STENCIL_INDEX8:
- case GL_DEPTH24_STENCIL8_OES:
- context->setRenderbufferStorage(width, height, internalformat, samples);
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
+ context->setRenderbufferStorage(width, height, internalformat, samples);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -4915,7 +4555,7 @@ void __stdcall glRenderbufferStorage(GLenum target, GLenum internalformat, GLsiz
void __stdcall glSampleCoverage(GLclampf value, GLboolean invert)
{
- EVENT("(GLclampf value = %f, GLboolean invert = %d)", value, invert);
+ EVENT("(GLclampf value = %f, GLboolean invert = %u)", value, invert);
try
{
@@ -4926,7 +4566,7 @@ void __stdcall glSampleCoverage(GLclampf value, GLboolean invert)
context->setSampleCoverageParams(gl::clamp01(value), invert == GL_TRUE);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -4947,7 +4587,7 @@ void __stdcall glSetFenceNV(GLuint fence, GLenum condition)
if (context)
{
- gl::Fence *fenceObject = context->getFence(fence);
+ gl::FenceNV *fenceObject = context->getFenceNV(fence);
if (fenceObject == NULL)
{
@@ -4957,7 +4597,7 @@ void __stdcall glSetFenceNV(GLuint fence, GLenum condition)
fenceObject->setFence(condition);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -4981,7 +4621,7 @@ void __stdcall glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
context->setScissorParams(x, y, width, height);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -4998,13 +4638,13 @@ void __stdcall glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryfor
// No binary shader formats are supported.
return gl::error(GL_INVALID_ENUM);
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
}
-void __stdcall glShaderSource(GLuint shader, GLsizei count, const GLchar** string, const GLint* length)
+void __stdcall glShaderSource(GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length)
{
EVENT("(GLuint shader = %d, GLsizei count = %d, const GLchar** string = 0x%0.8p, const GLint* length = 0x%0.8p)",
shader, count, string, length);
@@ -5037,7 +4677,7 @@ void __stdcall glShaderSource(GLuint shader, GLsizei count, const GLchar** strin
shaderObject->setSource(count, string, length);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -5094,7 +4734,7 @@ void __stdcall glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -5136,7 +4776,7 @@ void __stdcall glStencilMaskSeparate(GLenum face, GLuint mask)
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -5224,7 +4864,7 @@ void __stdcall glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenu
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -5240,17 +4880,22 @@ GLboolean __stdcall glTestFenceNV(GLuint fence)
if (context)
{
- gl::Fence *fenceObject = context->getFence(fence);
+ gl::FenceNV *fenceObject = context->getFenceNV(fence);
if (fenceObject == NULL)
{
return gl::error(GL_INVALID_OPERATION, GL_TRUE);
}
+ if (fenceObject->isFence() != GL_TRUE)
+ {
+ return gl::error(GL_INVALID_OPERATION, GL_TRUE);
+ }
+
return fenceObject->testFence();
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
gl::error(GL_OUT_OF_MEMORY);
}
@@ -5262,294 +4907,477 @@ void __stdcall glTexImage2D(GLenum target, GLint level, GLint internalformat, GL
GLint border, GLenum format, GLenum type, const GLvoid* pixels)
{
EVENT("(GLenum target = 0x%X, GLint level = %d, GLint internalformat = %d, GLsizei width = %d, GLsizei height = %d, "
- "GLint border = %d, GLenum format = 0x%X, GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)",
+ "GLint border = %d, GLenum format = 0x%X, GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)",
target, level, internalformat, width, height, border, format, type, pixels);
try
{
- if (!validImageSize(level, width, height))
- {
- return gl::error(GL_INVALID_VALUE);
- }
+ gl::Context *context = gl::getNonLostContext();
- if (internalformat != GLint(format))
+ if (context)
{
- return gl::error(GL_INVALID_OPERATION);
- }
+ if (context->getClientVersion() < 3 &&
+ !ValidateES2TexImageParameters(context, target, level, internalformat, false, false,
+ 0, 0, width, height, border, format, type, pixels))
+ {
+ return;
+ }
- // validate <type> by itself (used as secondary key below)
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT:
- case GL_UNSIGNED_INT:
- case GL_UNSIGNED_INT_24_8_OES:
- case GL_HALF_FLOAT_OES:
- case GL_FLOAT:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
+ if (context->getClientVersion() >= 3 &&
+ !ValidateES3TexImageParameters(context, target, level, internalformat, false, false,
+ 0, 0, 0, width, height, 1, border, format, type, pixels))
+ {
+ return;
+ }
+
+ switch (target)
+ {
+ case GL_TEXTURE_2D:
+ {
+ gl::Texture2D *texture = context->getTexture2D();
+ texture->setImage(level, width, height, internalformat, format, type, context->getUnpackState(), pixels);
+ }
+ break;
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ {
+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ texture->setImagePosX(level, width, height, internalformat, format, type, context->getUnpackState(), pixels);
+ }
+ break;
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ {
+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ texture->setImageNegX(level, width, height, internalformat, format, type, context->getUnpackState(), pixels);
+ }
+ break;
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ {
+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ texture->setImagePosY(level, width, height, internalformat, format, type, context->getUnpackState(), pixels);
+ }
+ break;
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ {
+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ texture->setImageNegY(level, width, height, internalformat, format, type, context->getUnpackState(), pixels);
+ }
+ break;
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ {
+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ texture->setImagePosZ(level, width, height, internalformat, format, type, context->getUnpackState(), pixels);
+ }
+ break;
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ {
+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ texture->setImageNegZ(level, width, height, internalformat, format, type, context->getUnpackState(), pixels);
+ }
+ break;
+ default: UNREACHABLE();
+ }
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
- // validate <format> + <type> combinations
- // - invalid <format> -> sets INVALID_ENUM
- // - invalid <format>+<type> combination -> sets INVALID_OPERATION
- switch (format)
+void __stdcall glTexParameterf(GLenum target, GLenum pname, GLfloat param)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %f)", target, pname, param);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- case GL_ALPHA:
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- switch (type)
+ if (!ValidateTexParamParameters(context, pname, static_cast<GLint>(param)))
{
- case GL_UNSIGNED_BYTE:
- case GL_FLOAT:
- case GL_HALF_FLOAT_OES:
- break;
- default:
- return gl::error(GL_INVALID_OPERATION);
+ return;
}
- break;
- case GL_RGB:
- switch (type)
+
+ gl::Texture *texture = context->getTargetTexture(target);
+
+ if (!texture)
{
- case GL_UNSIGNED_BYTE:
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_FLOAT:
- case GL_HALF_FLOAT_OES:
- break;
- default:
- return gl::error(GL_INVALID_OPERATION);
+ return gl::error(GL_INVALID_ENUM);
}
- break;
- case GL_RGBA:
- switch (type)
+
+ switch (pname)
{
- case GL_UNSIGNED_BYTE:
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_FLOAT:
- case GL_HALF_FLOAT_OES:
- break;
- default:
- return gl::error(GL_INVALID_OPERATION);
+ case GL_TEXTURE_WRAP_S: texture->setWrapS(gl::uiround<GLenum>(param)); break;
+ case GL_TEXTURE_WRAP_T: texture->setWrapT(gl::uiround<GLenum>(param)); break;
+ case GL_TEXTURE_WRAP_R: texture->setWrapR(gl::uiround<GLenum>(param)); break;
+ case GL_TEXTURE_MIN_FILTER: texture->setMinFilter(gl::uiround<GLenum>(param)); break;
+ case GL_TEXTURE_MAG_FILTER: texture->setMagFilter(gl::uiround<GLenum>(param)); break;
+ case GL_TEXTURE_USAGE_ANGLE: texture->setUsage(gl::uiround<GLenum>(param)); break;
+ case GL_TEXTURE_MAX_ANISOTROPY_EXT: texture->setMaxAnisotropy(param, context->getTextureMaxAnisotropy()); break;
+ case GL_TEXTURE_COMPARE_MODE: texture->setCompareMode(gl::uiround<GLenum>(param)); break;
+ case GL_TEXTURE_COMPARE_FUNC: texture->setCompareFunc(gl::uiround<GLenum>(param)); break;
+ case GL_TEXTURE_SWIZZLE_R: texture->setSwizzleRed(gl::uiround<GLenum>(param)); break;
+ case GL_TEXTURE_SWIZZLE_G: texture->setSwizzleGreen(gl::uiround<GLenum>(param)); break;
+ case GL_TEXTURE_SWIZZLE_B: texture->setSwizzleBlue(gl::uiround<GLenum>(param)); break;
+ case GL_TEXTURE_SWIZZLE_A: texture->setSwizzleAlpha(gl::uiround<GLenum>(param)); break;
+ case GL_TEXTURE_BASE_LEVEL: texture->setBaseLevel(gl::iround<GLint>(param)); break;
+ case GL_TEXTURE_MAX_LEVEL: texture->setMaxLevel(gl::iround<GLint>(param)); break;
+ case GL_TEXTURE_MIN_LOD: texture->setMinLod(param); break;
+ case GL_TEXTURE_MAX_LOD: texture->setMaxLod(param); break;
+ default: UNREACHABLE(); break;
}
- break;
- case GL_BGRA_EXT:
- switch (type)
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
+{
+ glTexParameterf(target, pname, (GLfloat)*params);
+}
+
+void __stdcall glTexParameteri(GLenum target, GLenum pname, GLint param)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %d)", target, pname, param);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (!ValidateTexParamParameters(context, pname, param))
{
- case GL_UNSIGNED_BYTE:
- break;
- default:
- return gl::error(GL_INVALID_OPERATION);
+ return;
}
- break;
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: // error cases for compressed textures are handled below
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
- break;
- case GL_DEPTH_COMPONENT:
- switch (type)
+
+ gl::Texture *texture = context->getTargetTexture(target);
+
+ if (!texture)
{
- case GL_UNSIGNED_SHORT:
- case GL_UNSIGNED_INT:
- break;
- default:
- return gl::error(GL_INVALID_OPERATION);
+ return gl::error(GL_INVALID_ENUM);
}
- break;
- case GL_DEPTH_STENCIL_OES:
- switch (type)
+
+ switch (pname)
{
- case GL_UNSIGNED_INT_24_8_OES:
- break;
- default:
- return gl::error(GL_INVALID_OPERATION);
+ case GL_TEXTURE_WRAP_S: texture->setWrapS((GLenum)param); break;
+ case GL_TEXTURE_WRAP_T: texture->setWrapT((GLenum)param); break;
+ case GL_TEXTURE_WRAP_R: texture->setWrapR((GLenum)param); break;
+ case GL_TEXTURE_MIN_FILTER: texture->setMinFilter((GLenum)param); break;
+ case GL_TEXTURE_MAG_FILTER: texture->setMagFilter((GLenum)param); break;
+ case GL_TEXTURE_USAGE_ANGLE: texture->setUsage((GLenum)param); break;
+ case GL_TEXTURE_MAX_ANISOTROPY_EXT: texture->setMaxAnisotropy((float)param, context->getTextureMaxAnisotropy()); break;
+ case GL_TEXTURE_COMPARE_MODE: texture->setCompareMode((GLenum)param); break;
+ case GL_TEXTURE_COMPARE_FUNC: texture->setCompareFunc((GLenum)param); break;
+ case GL_TEXTURE_SWIZZLE_R: texture->setSwizzleRed((GLenum)param); break;
+ case GL_TEXTURE_SWIZZLE_G: texture->setSwizzleGreen((GLenum)param); break;
+ case GL_TEXTURE_SWIZZLE_B: texture->setSwizzleBlue((GLenum)param); break;
+ case GL_TEXTURE_SWIZZLE_A: texture->setSwizzleAlpha((GLenum)param); break;
+ case GL_TEXTURE_BASE_LEVEL: texture->setBaseLevel(param); break;
+ case GL_TEXTURE_MAX_LEVEL: texture->setMaxLevel(param); break;
+ case GL_TEXTURE_MIN_LOD: texture->setMinLod((GLfloat)param); break;
+ case GL_TEXTURE_MAX_LOD: texture->setMaxLod((GLfloat)param); break;
+ default: UNREACHABLE(); break;
}
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
- if (border != 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
+void __stdcall glTexParameteriv(GLenum target, GLenum pname, const GLint* params)
+{
+ glTexParameteri(target, pname, *params);
+}
+void __stdcall glTexStorage2DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
+{
+ EVENT("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)",
+ target, levels, internalformat, width, height);
+
+ try
+ {
gl::Context *context = gl::getNonLostContext();
if (context)
{
- if (level > context->getMaximumTextureLevel())
+ if (context->getClientVersion() < 3 &&
+ !ValidateES2TexStorageParameters(context, target, levels, internalformat, width, height))
{
- return gl::error(GL_INVALID_VALUE);
+ return;
+ }
+
+ if (context->getClientVersion() >= 3 &&
+ !ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, 1))
+ {
+ return;
}
switch (target)
{
case GL_TEXTURE_2D:
- if (width > (context->getMaximumTextureDimension() >> level) ||
- height > (context->getMaximumTextureDimension() >> level))
{
- return gl::error(GL_INVALID_VALUE);
+ gl::Texture2D *texture2d = context->getTexture2D();
+ texture2d->storage(levels, internalformat, width, height);
}
break;
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- if (width != height)
- {
- return gl::error(GL_INVALID_VALUE);
- }
- if (width > (context->getMaximumCubeTextureDimension() >> level) ||
- height > (context->getMaximumCubeTextureDimension() >> level))
+ case GL_TEXTURE_CUBE_MAP:
{
- return gl::error(GL_INVALID_VALUE);
+ gl::TextureCubeMap *textureCube = context->getTextureCubeMap();
+ textureCube->storage(levels, internalformat, width);
}
break;
+
default:
return gl::error(GL_INVALID_ENUM);
}
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
- switch (format) {
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- if (context->supportsDXT1Textures())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- else
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
- if (context->supportsDXT3Textures())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- else
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
- if (context->supportsDXT5Textures())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- else
+void __stdcall glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ GLenum format, GLenum type, const GLvoid* pixels)
+{
+ EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, "
+ "GLsizei width = %d, GLsizei height = %d, GLenum format = 0x%X, GLenum type = 0x%X, "
+ "const GLvoid* pixels = 0x%0.8p)",
+ target, level, xoffset, yoffset, width, height, format, type, pixels);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3 &&
+ !ValidateES2TexImageParameters(context, target, level, GL_NONE, false, true,
+ xoffset, yoffset, width, height, 0, format, type, pixels))
+ {
+ return;
+ }
+
+ if (context->getClientVersion() >= 3 &&
+ !ValidateES3TexImageParameters(context, target, level, GL_NONE, false, true,
+ xoffset, yoffset, 0, width, height, 1, 0, format, type, pixels))
+ {
+ return;
+ }
+
+ // Zero sized uploads are valid but no-ops
+ if (width == 0 || height == 0)
+ {
+ return;
+ }
+
+ switch (target)
+ {
+ case GL_TEXTURE_2D:
{
- return gl::error(GL_INVALID_ENUM);
+ gl::Texture2D *texture = context->getTexture2D();
+ texture->subImage(level, xoffset, yoffset, width, height, format, type, context->getUnpackState(), pixels);
}
break;
- case GL_DEPTH_COMPONENT:
- case GL_DEPTH_STENCIL_OES:
- if (!context->supportsDepthTextures())
- {
- return gl::error(GL_INVALID_VALUE);
- }
- if (target != GL_TEXTURE_2D)
+
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
{
- return gl::error(GL_INVALID_OPERATION);
- }
- // OES_depth_texture supports loading depth data and multiple levels,
- // but ANGLE_depth_texture does not
- if (pixels != NULL || level != 0)
- {
- return gl::error(GL_INVALID_OPERATION);
+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ texture->subImage(target, level, xoffset, yoffset, width, height, format, type, context->getUnpackState(), pixels);
}
break;
+
default:
- break;
+ UNREACHABLE();
}
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
- if (type == GL_FLOAT)
+void __stdcall glUniform1f(GLint location, GLfloat x)
+{
+ glUniform1fv(location, 1, &x);
+}
+
+void __stdcall glUniform1fv(GLint location, GLsizei count, const GLfloat* v)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)", location, count, v);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (!ValidateUniform(context, GL_FLOAT, location, count))
{
- if (!context->supportsFloat32Textures())
- {
- return gl::error(GL_INVALID_ENUM);
- }
+ return;
}
- else if (type == GL_HALF_FLOAT_OES)
+
+ gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ programBinary->setUniform1fv(location, count, v);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glUniform1i(GLint location, GLint x)
+{
+ glUniform1iv(location, 1, &x);
+}
+
+void __stdcall glUniform1iv(GLint location, GLsizei count, const GLint* v)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)", location, count, v);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (!ValidateUniform(context, GL_INT, location, count))
{
- if (!context->supportsFloat16Textures())
- {
- return gl::error(GL_INVALID_ENUM);
- }
+ return;
}
- if (target == GL_TEXTURE_2D)
- {
- gl::Texture2D *texture = context->getTexture2D();
+ gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ programBinary->setUniform1iv(location, count, v);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
- if (!texture)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
+void __stdcall glUniform2f(GLint location, GLfloat x, GLfloat y)
+{
+ GLfloat xy[2] = {x, y};
- if (texture->isImmutable())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
+ glUniform2fv(location, 1, xy);
+}
+
+void __stdcall glUniform2fv(GLint location, GLsizei count, const GLfloat* v)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)", location, count, v);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
- texture->setImage(level, width, height, format, type, context->getUnpackAlignment(), pixels);
+ if (context)
+ {
+ if (!ValidateUniform(context, GL_FLOAT_VEC2, location, count))
+ {
+ return;
}
- else
+
+ gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ programBinary->setUniform2fv(location, count, v);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glUniform2i(GLint location, GLint x, GLint y)
+{
+ GLint xy[2] = {x, y};
+
+ glUniform2iv(location, 1, xy);
+}
+
+void __stdcall glUniform2iv(GLint location, GLsizei count, const GLint* v)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)", location, count, v);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (!ValidateUniform(context, GL_INT_VEC2, location, count))
{
- gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ return;
+ }
- if (!texture)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
+ gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ programBinary->setUniform2iv(location, count, v);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
- if (texture->isImmutable())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
+void __stdcall glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
+{
+ GLfloat xyz[3] = {x, y, z};
- switch (target)
- {
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- texture->setImagePosX(level, width, height, format, type, context->getUnpackAlignment(), pixels);
- break;
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- texture->setImageNegX(level, width, height, format, type, context->getUnpackAlignment(), pixels);
- break;
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- texture->setImagePosY(level, width, height, format, type, context->getUnpackAlignment(), pixels);
- break;
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- texture->setImageNegY(level, width, height, format, type, context->getUnpackAlignment(), pixels);
- break;
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- texture->setImagePosZ(level, width, height, format, type, context->getUnpackAlignment(), pixels);
- break;
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- texture->setImageNegZ(level, width, height, format, type, context->getUnpackAlignment(), pixels);
- break;
- default: UNREACHABLE();
- }
+ glUniform3fv(location, 1, xyz);
+}
+
+void __stdcall glUniform3fv(GLint location, GLsizei count, const GLfloat* v)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)", location, count, v);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (!ValidateUniform(context, GL_FLOAT_VEC3, location, count))
+ {
+ return;
}
+
+ gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ programBinary->setUniform3fv(location, count, v);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
}
-void __stdcall glTexParameterf(GLenum target, GLenum pname, GLfloat param)
+void __stdcall glUniform3i(GLint location, GLint x, GLint y, GLint z)
{
- EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %f)", target, pname, param);
+ GLint xyz[3] = {x, y, z};
+
+ glUniform3iv(location, 1, xyz);
+}
+
+void __stdcall glUniform3iv(GLint location, GLsizei count, const GLint* v)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)", location, count, v);
try
{
@@ -5557,81 +5385,115 @@ void __stdcall glTexParameterf(GLenum target, GLenum pname, GLfloat param)
if (context)
{
- gl::Texture *texture;
+ if (!ValidateUniform(context, GL_INT_VEC3, location, count))
+ {
+ return;
+ }
- switch (target)
+ gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ programBinary->setUniform3iv(location, count, v);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ GLfloat xyzw[4] = {x, y, z, w};
+
+ glUniform4fv(location, 1, xyzw);
+}
+
+void __stdcall glUniform4fv(GLint location, GLsizei count, const GLfloat* v)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)", location, count, v);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (!ValidateUniform(context, GL_FLOAT_VEC4, location, count))
{
- case GL_TEXTURE_2D:
- texture = context->getTexture2D();
- break;
- case GL_TEXTURE_CUBE_MAP:
- texture = context->getTextureCubeMap();
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
+ return;
}
- switch (pname)
+ gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ programBinary->setUniform4fv(location, count, v);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
+{
+ GLint xyzw[4] = {x, y, z, w};
+
+ glUniform4iv(location, 1, xyzw);
+}
+
+void __stdcall glUniform4iv(GLint location, GLsizei count, const GLint* v)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)", location, count, v);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (!ValidateUniform(context, GL_INT_VEC4, location, count))
{
- case GL_TEXTURE_WRAP_S:
- if (!texture->setWrapS((GLenum)param))
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_TEXTURE_WRAP_T:
- if (!texture->setWrapT((GLenum)param))
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_TEXTURE_MIN_FILTER:
- if (!texture->setMinFilter((GLenum)param))
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_TEXTURE_MAG_FILTER:
- if (!texture->setMagFilter((GLenum)param))
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_TEXTURE_USAGE_ANGLE:
- if (!texture->setUsage((GLenum)param))
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- if (!context->supportsTextureFilterAnisotropy())
- {
- return gl::error(GL_INVALID_ENUM);
- }
- if (!texture->setMaxAnisotropy((float)param, context->getTextureMaxAnisotropy()))
- {
- return gl::error(GL_INVALID_VALUE);
- }
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
+ return;
}
+
+ gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ programBinary->setUniform4iv(location, count, v);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
}
-void __stdcall glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
+void __stdcall glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
{
- glTexParameterf(target, pname, (GLfloat)*params);
+ EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)",
+ location, count, transpose, value);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (!ValidateUniformMatrix(context, GL_FLOAT_MAT2, location, count, transpose))
+ {
+ return;
+ }
+
+ gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ programBinary->setUniformMatrix2fv(location, count, transpose, value);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
}
-void __stdcall glTexParameteri(GLenum target, GLenum pname, GLint param)
+void __stdcall glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
{
- EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %d)", target, pname, param);
+ EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)",
+ location, count, transpose, value);
try
{
@@ -5639,824 +5501,2937 @@ void __stdcall glTexParameteri(GLenum target, GLenum pname, GLint param)
if (context)
{
- gl::Texture *texture;
+ if (!ValidateUniformMatrix(context, GL_FLOAT_MAT3, location, count, transpose))
+ {
+ return;
+ }
- switch (target)
+ gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ programBinary->setUniformMatrix3fv(location, count, transpose, value);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)",
+ location, count, transpose, value);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (!ValidateUniformMatrix(context, GL_FLOAT_MAT4, location, count, transpose))
{
- case GL_TEXTURE_2D:
- texture = context->getTexture2D();
- break;
- case GL_TEXTURE_CUBE_MAP:
- texture = context->getTextureCubeMap();
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
+ return;
}
- switch (pname)
+ gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ programBinary->setUniformMatrix4fv(location, count, transpose, value);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glUseProgram(GLuint program)
+{
+ EVENT("(GLuint program = %d)", program);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject && program != 0)
{
- case GL_TEXTURE_WRAP_S:
- if (!texture->setWrapS((GLenum)param))
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_TEXTURE_WRAP_T:
- if (!texture->setWrapT((GLenum)param))
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_TEXTURE_MIN_FILTER:
- if (!texture->setMinFilter((GLenum)param))
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_TEXTURE_MAG_FILTER:
- if (!texture->setMagFilter((GLenum)param))
+ if (context->getShader(program))
{
- return gl::error(GL_INVALID_ENUM);
+ return gl::error(GL_INVALID_OPERATION);
}
- break;
- case GL_TEXTURE_USAGE_ANGLE:
- if (!texture->setUsage((GLenum)param))
+ else
{
- return gl::error(GL_INVALID_ENUM);
+ return gl::error(GL_INVALID_VALUE);
}
- break;
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- if (!context->supportsTextureFilterAnisotropy())
+ }
+
+ if (program != 0 && !programObject->isLinked())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ context->useProgram(program);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glValidateProgram(GLuint program)
+{
+ EVENT("(GLuint program = %d)", program);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
+ {
+ if (context->getShader(program))
{
- return gl::error(GL_INVALID_ENUM);
+ return gl::error(GL_INVALID_OPERATION);
}
- if (!texture->setMaxAnisotropy((float)param, context->getTextureMaxAnisotropy()))
+ else
{
return gl::error(GL_INVALID_VALUE);
}
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
}
+
+ programObject->validate();
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
}
-void __stdcall glTexParameteriv(GLenum target, GLenum pname, const GLint* params)
+void __stdcall glVertexAttrib1f(GLuint index, GLfloat x)
{
- glTexParameteri(target, pname, *params);
+ EVENT("(GLuint index = %d, GLfloat x = %f)", index, x);
+
+ try
+ {
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ GLfloat vals[4] = { x, 0, 0, 1 };
+ context->setVertexAttribf(index, vals);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
}
-void __stdcall glTexStorage2DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
+void __stdcall glVertexAttrib1fv(GLuint index, const GLfloat* values)
{
- EVENT("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)",
- target, levels, internalformat, width, height);
+ EVENT("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values);
try
{
- if (target != GL_TEXTURE_2D && target != GL_TEXTURE_CUBE_MAP)
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
{
- return gl::error(GL_INVALID_ENUM);
+ return gl::error(GL_INVALID_VALUE);
}
- if (width < 1 || height < 1 || levels < 1)
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ GLfloat vals[4] = { values[0], 0, 0, 1 };
+ context->setVertexAttribf(index, vals);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
+{
+ EVENT("(GLuint index = %d, GLfloat x = %f, GLfloat y = %f)", index, x, y);
+
+ try
+ {
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
{
return gl::error(GL_INVALID_VALUE);
}
- if (target == GL_TEXTURE_CUBE_MAP && width != height)
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ GLfloat vals[4] = { x, y, 0, 1 };
+ context->setVertexAttribf(index, vals);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glVertexAttrib2fv(GLuint index, const GLfloat* values)
+{
+ EVENT("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values);
+
+ try
+ {
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
{
return gl::error(GL_INVALID_VALUE);
}
- if (levels != 1 && levels != gl::log2(std::max(width, height)) + 1)
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_INVALID_OPERATION);
+ GLfloat vals[4] = { values[0], values[1], 0, 1 };
+ context->setVertexAttribf(index, vals);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
+{
+ EVENT("(GLuint index = %d, GLfloat x = %f, GLfloat y = %f, GLfloat z = %f)", index, x, y, z);
+
+ try
+ {
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return gl::error(GL_INVALID_VALUE);
}
- GLenum format = gl::ExtractFormat(internalformat);
- GLenum type = gl::ExtractType(internalformat);
+ gl::Context *context = gl::getNonLostContext();
- if (format == GL_NONE || type == GL_NONE)
+ if (context)
{
+ GLfloat vals[4] = { x, y, z, 1 };
+ context->setVertexAttribf(index, vals);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glVertexAttrib3fv(GLuint index, const GLfloat* values)
+{
+ EVENT("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values);
+
+ try
+ {
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ GLfloat vals[4] = { values[0], values[1], values[2], 1 };
+ context->setVertexAttribf(index, vals);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ EVENT("(GLuint index = %d, GLfloat x = %f, GLfloat y = %f, GLfloat z = %f, GLfloat w = %f)", index, x, y, z, w);
+
+ try
+ {
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ GLfloat vals[4] = { x, y, z, w };
+ context->setVertexAttribf(index, vals);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glVertexAttrib4fv(GLuint index, const GLfloat* values)
+{
+ EVENT("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values);
+
+ try
+ {
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ context->setVertexAttribf(index, values);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glVertexAttribDivisorANGLE(GLuint index, GLuint divisor)
+{
+ EVENT("(GLuint index = %d, GLuint divisor = %d)", index, divisor);
+
+ try
+ {
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ context->setVertexAttribDivisor(index, divisor);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr)
+{
+ EVENT("(GLuint index = %d, GLint size = %d, GLenum type = 0x%X, "
+ "GLboolean normalized = %u, GLsizei stride = %d, const GLvoid* ptr = 0x%0.8p)",
+ index, size, type, normalized, stride, ptr);
+
+ try
+ {
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ if (size < 1 || size > 4)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getNonLostContext();
+
+ switch (type)
+ {
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ case GL_FIXED:
+ case GL_FLOAT:
+ break;
+ case GL_HALF_FLOAT:
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_INT_2_10_10_10_REV:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ if (context && context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ else
+ {
+ break;
+ }
+ default:
return gl::error(GL_INVALID_ENUM);
}
+ if (stride < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ if ((type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV) && size != 4)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (context)
+ {
+ // [OpenGL ES 3.0.2] Section 2.8 page 24:
+ // An INVALID_OPERATION error is generated when a non-zero vertex array object
+ // is bound, zero is bound to the ARRAY_BUFFER buffer object binding point,
+ // and the pointer argument is not NULL.
+ if (context->getVertexArrayHandle() != 0 && context->getArrayBufferHandle() == 0 && ptr != NULL)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ context->setVertexAttribState(index, context->getArrayBuffer(), size, type,
+ normalized == GL_TRUE, false, stride, ptr);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ EVENT("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", x, y, width, height);
+
+ try
+ {
+ if (width < 0 || height < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
gl::Context *context = gl::getNonLostContext();
if (context)
{
- switch (target)
+ context->setViewportParams(x, y, width, height);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+// OpenGL ES 3.0 functions
+
+void __stdcall glReadBuffer(GLenum mode)
+{
+ EVENT("(GLenum mode = 0x%X)", mode);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- case GL_TEXTURE_2D:
- if (width > context->getMaximumTextureDimension() ||
- height > context->getMaximumTextureDimension())
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ // glReadBuffer
+ UNIMPLEMENTED();
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices)
+{
+ EVENT("(GLenum mode = 0x%X, GLuint start = %u, GLuint end = %u, GLsizei count = %d, GLenum type = 0x%X, "
+ "const GLvoid* indices = 0x%0.8p)", mode, start, end, count, type, indices);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ // glDrawRangeElements
+ UNIMPLEMENTED();
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
+{
+ EVENT("(GLenum target = 0x%X, GLint level = %d, GLint internalformat = %d, GLsizei width = %d, "
+ "GLsizei height = %d, GLsizei depth = %d, GLint border = %d, GLenum format = 0x%X, "
+ "GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)",
+ target, level, internalformat, width, height, depth, border, format, type, pixels);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ // validateES3TexImageFormat sets the error code if there is an error
+ if (!ValidateES3TexImageParameters(context, target, level, internalformat, false, false,
+ 0, 0, 0, width, height, depth, border, format, type, pixels))
+ {
+ return;
+ }
+
+ switch(target)
+ {
+ case GL_TEXTURE_3D:
{
- return gl::error(GL_INVALID_VALUE);
+ gl::Texture3D *texture = context->getTexture3D();
+ texture->setImage(level, width, height, depth, internalformat, format, type, context->getUnpackState(), pixels);
}
break;
- case GL_TEXTURE_CUBE_MAP:
- if (width > context->getMaximumCubeTextureDimension() ||
- height > context->getMaximumCubeTextureDimension())
+
+ case GL_TEXTURE_2D_ARRAY:
{
- return gl::error(GL_INVALID_VALUE);
+ gl::Texture2DArray *texture = context->getTexture2DArray();
+ texture->setImage(level, width, height, depth, internalformat, format, type, context->getUnpackState(), pixels);
}
break;
+
default:
return gl::error(GL_INVALID_ENUM);
}
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels)
+{
+ EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, "
+ "GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, "
+ "GLenum format = 0x%X, GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)",
+ target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
- if (levels != 1 && !context->supportsNonPower2Texture())
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (!gl::isPow2(width) || !gl::isPow2(height))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ // validateES3TexImageFormat sets the error code if there is an error
+ if (!ValidateES3TexImageParameters(context, target, level, GL_NONE, false, true,
+ xoffset, yoffset, zoffset, width, height, depth, 0,
+ format, type, pixels))
+ {
+ return;
+ }
+
+ // Zero sized uploads are valid but no-ops
+ if (width == 0 || height == 0 || depth == 0)
+ {
+ return;
}
- switch (internalformat)
+ switch(target)
{
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- if (!context->supportsDXT1Textures())
+ case GL_TEXTURE_3D:
{
- return gl::error(GL_INVALID_ENUM);
+ gl::Texture3D *texture = context->getTexture3D();
+ texture->subImage(level, xoffset, yoffset, zoffset, width, height, depth, format, type, context->getUnpackState(), pixels);
}
break;
- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
- if (!context->supportsDXT3Textures())
+
+ case GL_TEXTURE_2D_ARRAY:
{
- return gl::error(GL_INVALID_ENUM);
+ gl::Texture2DArray *texture = context->getTexture2DArray();
+ texture->subImage(level, xoffset, yoffset, zoffset, width, height, depth, format, type, context->getUnpackState(), pixels);
}
break;
- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
- if (!context->supportsDXT5Textures())
- {
- return gl::error(GL_INVALID_ENUM);
- }
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, "
+ "GLint zoffset = %d, GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)",
+ target, level, xoffset, yoffset, zoffset, x, y, width, height);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!ValidateES3CopyTexImageParameters(context, target, level, GL_NONE, true, xoffset, yoffset, zoffset,
+ x, y, width, height, 0))
+ {
+ return;
+ }
+
+ gl::Framebuffer *framebuffer = context->getReadFramebuffer();
+ gl::Texture *texture = NULL;
+ switch (target)
+ {
+ case GL_TEXTURE_3D:
+ texture = context->getTexture3D();
break;
- case GL_RGBA32F_EXT:
- case GL_RGB32F_EXT:
- case GL_ALPHA32F_EXT:
- case GL_LUMINANCE32F_EXT:
- case GL_LUMINANCE_ALPHA32F_EXT:
- if (!context->supportsFloat32Textures())
- {
- return gl::error(GL_INVALID_ENUM);
- }
+
+ case GL_TEXTURE_2D_ARRAY:
+ texture = context->getTexture2DArray();
break;
- case GL_RGBA16F_EXT:
- case GL_RGB16F_EXT:
- case GL_ALPHA16F_EXT:
- case GL_LUMINANCE16F_EXT:
- case GL_LUMINANCE_ALPHA16F_EXT:
- if (!context->supportsFloat16Textures())
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ texture->copySubImage(target, level, xoffset, yoffset, zoffset, x, y, width, height, framebuffer);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data)
+{
+ EVENT("(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLsizei width = %d, "
+ "GLsizei height = %d, GLsizei depth = %d, GLint border = %d, GLsizei imageSize = %d, "
+ "const GLvoid* data = 0x%0.8p)",
+ target, level, internalformat, width, height, depth, border, imageSize, data);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (imageSize < 0 || imageSize != (GLsizei)gl::GetBlockSize(internalformat, GL_UNSIGNED_BYTE, context->getClientVersion(), width, height))
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ // validateES3TexImageFormat sets the error code if there is an error
+ if (!ValidateES3TexImageParameters(context, target, level, internalformat, true, false,
+ 0, 0, 0, width, height, depth, border, GL_NONE, GL_NONE, data))
+ {
+ return;
+ }
+
+ switch(target)
+ {
+ case GL_TEXTURE_3D:
{
- return gl::error(GL_INVALID_ENUM);
+ gl::Texture3D *texture = context->getTexture3D();
+ texture->setCompressedImage(level, internalformat, width, height, depth, imageSize, data);
}
break;
- case GL_DEPTH_COMPONENT16:
- case GL_DEPTH_COMPONENT32_OES:
- case GL_DEPTH24_STENCIL8_OES:
- if (!context->supportsDepthTextures())
- {
- return gl::error(GL_INVALID_ENUM);
- }
- if (target != GL_TEXTURE_2D)
+
+ case GL_TEXTURE_2D_ARRAY:
{
- return gl::error(GL_INVALID_OPERATION);
- }
- // ANGLE_depth_texture only supports 1-level textures
- if (levels != 1)
- {
- return gl::error(GL_INVALID_OPERATION);
+ gl::Texture2DArray *texture = context->getTexture2DArray();
+ texture->setCompressedImage(level, internalformat, width, height, depth, imageSize, data);
}
break;
+
default:
- break;
+ return gl::error(GL_INVALID_ENUM);
}
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
- if (target == GL_TEXTURE_2D)
+void __stdcall glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data)
+{
+ EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, "
+ "GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, "
+ "GLenum format = 0x%X, GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)",
+ target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- gl::Texture2D *texture = context->getTexture2D();
+ return gl::error(GL_INVALID_OPERATION);
+ }
- if (!texture || texture->id() == 0)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
+ if (imageSize < 0 || imageSize != (GLsizei)gl::GetBlockSize(format, GL_UNSIGNED_BYTE, context->getClientVersion(), width, height))
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
- if (texture->isImmutable())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
+ if (!data)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
- texture->storage(levels, internalformat, width, height);
+ // validateES3TexImageFormat sets the error code if there is an error
+ if (!ValidateES3TexImageParameters(context, target, level, GL_NONE, true, true,
+ 0, 0, 0, width, height, depth, 0, GL_NONE, GL_NONE, data))
+ {
+ return;
}
- else if (target == GL_TEXTURE_CUBE_MAP)
+
+ // Zero sized uploads are valid but no-ops
+ if (width == 0 || height == 0)
{
- gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ return;
+ }
- if (!texture || texture->id() == 0)
+ switch(target)
+ {
+ case GL_TEXTURE_3D:
{
- return gl::error(GL_INVALID_OPERATION);
+ gl::Texture3D *texture = context->getTexture3D();
+ texture->subImageCompressed(level, xoffset, yoffset, zoffset, width, height, depth,
+ format, imageSize, data);
}
+ break;
- if (texture->isImmutable())
+ case GL_TEXTURE_2D_ARRAY:
{
- return gl::error(GL_INVALID_OPERATION);
+ gl::Texture2DArray *texture = context->getTexture2DArray();
+ texture->subImageCompressed(level, xoffset, yoffset, zoffset, width, height, depth,
+ format, imageSize, data);
}
+ break;
- texture->storage(levels, internalformat, width);
+ default:
+ return gl::error(GL_INVALID_ENUM);
}
- else UNREACHABLE();
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
}
-void __stdcall glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
- GLenum format, GLenum type, const GLvoid* pixels)
+void __stdcall glGenQueries(GLsizei n, GLuint* ids)
{
- EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, "
- "GLsizei width = %d, GLsizei height = %d, GLenum format = 0x%X, GLenum type = 0x%X, "
- "const GLvoid* pixels = 0x%0.8p)",
- target, level, xoffset, yoffset, width, height, format, type, pixels);
+ EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids);
try
{
- if (!gl::IsInternalTextureTarget(target))
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_INVALID_ENUM);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (n < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ for (GLsizei i = 0; i < n; i++)
+ {
+ ids[i] = context->createQuery();
+ }
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glDeleteQueries(GLsizei n, const GLuint* ids)
+{
+ EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
- if (level < 0 || xoffset < 0 || yoffset < 0 || width < 0 || height < 0)
+ if (context)
{
- return gl::error(GL_INVALID_VALUE);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (n < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ for (GLsizei i = 0; i < n; i++)
+ {
+ context->deleteQuery(ids[i]);
+ }
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
- if (std::numeric_limits<GLsizei>::max() - xoffset < width || std::numeric_limits<GLsizei>::max() - yoffset < height)
+GLboolean __stdcall glIsQuery(GLuint id)
+{
+ EVENT("(GLuint id = %u)", id);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_INVALID_VALUE);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION, GL_FALSE);
+ }
+
+ return (context->getQuery(id, false, GL_NONE) != NULL) ? GL_TRUE : GL_FALSE;
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
+ }
+
+ return GL_FALSE;
+}
+
+void __stdcall glBeginQuery(GLenum target, GLuint id)
+{
+ EVENT("(GLenum target = 0x%X, GLuint id = %u)", target, id);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
- if (!checkTextureFormatType(format, type))
+ if (context)
{
- return; // error is set by helper function
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!ValidateBeginQuery(context, target, id))
+ {
+ return;
+ }
+ context->beginQuery(target, id);
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+void __stdcall glEndQuery(GLenum target)
+{
+ EVENT("(GLenum target = 0x%X)", target);
+
+ try
+ {
gl::Context *context = gl::getNonLostContext();
if (context)
{
- if (level > context->getMaximumTextureLevel())
+ if (context->getClientVersion() < 3)
{
- return gl::error(GL_INVALID_VALUE);
+ return gl::error(GL_INVALID_OPERATION);
}
- if (format == GL_FLOAT)
+ if (!ValidateEndQuery(context, target))
{
- if (!context->supportsFloat32Textures())
- {
- return gl::error(GL_INVALID_ENUM);
- }
+ return;
}
- else if (format == GL_HALF_FLOAT_OES)
+
+ context->endQuery(target);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetQueryiv(GLenum target, GLenum pname, GLint* params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", target, pname, params);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (!context->supportsFloat16Textures())
- {
- return gl::error(GL_INVALID_ENUM);
- }
+ return gl::error(GL_INVALID_OPERATION);
}
- else if (gl::IsDepthTexture(format))
+
+ if (!ValidQueryType(context, target))
{
- if (!context->supportsDepthTextures())
- {
- return gl::error(GL_INVALID_ENUM);
- }
- if (target != GL_TEXTURE_2D)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- // OES_depth_texture supports loading depth data, but ANGLE_depth_texture does not
- return gl::error(GL_INVALID_OPERATION);
+ return gl::error(GL_INVALID_ENUM);
}
- if (width == 0 || height == 0 || pixels == NULL)
+ switch (pname)
{
- return;
+ case GL_CURRENT_QUERY:
+ params[0] = static_cast<GLint>(context->getActiveQueryId(target));
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
}
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params)
+{
+ EVENT("(GLuint id = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", id, pname, params);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
- if (target == GL_TEXTURE_2D)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- gl::Texture2D *texture = context->getTexture2D();
- if (validateSubImageParams2D(false, width, height, xoffset, yoffset, level, format, type, texture))
- {
- texture->subImage(level, xoffset, yoffset, width, height, format, type, context->getUnpackAlignment(), pixels);
- }
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ gl::Query *queryObject = context->getQuery(id, false, GL_NONE);
+
+ if (!queryObject)
+ {
+ return gl::error(GL_INVALID_OPERATION);
}
- else if (gl::IsCubemapTextureTarget(target))
+
+ if (context->getActiveQueryId(queryObject->getType()) == id)
{
- gl::TextureCubeMap *texture = context->getTextureCubeMap();
- if (validateSubImageParamsCube(false, width, height, xoffset, yoffset, target, level, format, type, texture))
- {
- texture->subImage(target, level, xoffset, yoffset, width, height, format, type, context->getUnpackAlignment(), pixels);
- }
+ return gl::error(GL_INVALID_OPERATION);
}
- else
+
+ switch(pname)
{
- UNREACHABLE();
+ case GL_QUERY_RESULT:
+ params[0] = queryObject->getResult();
+ break;
+ case GL_QUERY_RESULT_AVAILABLE:
+ params[0] = queryObject->isResultAvailable();
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
}
-void __stdcall glUniform1f(GLint location, GLfloat x)
+GLboolean __stdcall glUnmapBuffer(GLenum target)
{
- glUniform1fv(location, 1, &x);
+ EVENT("(GLenum target = 0x%X)", target);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION, GL_FALSE);
+ }
+
+ return glUnmapBufferOES(target);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
+ }
+
+ return GL_FALSE;
}
-void __stdcall glUniform1fv(GLint location, GLsizei count, const GLfloat* v)
+void __stdcall glGetBufferPointerv(GLenum target, GLenum pname, GLvoid** params)
{
- EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)", location, count, v);
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLvoid** params = 0x%0.8p)", target, pname, params);
try
{
- if (count < 0)
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_INVALID_VALUE);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ glGetBufferPointervOES(target, pname, params);
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
- if (location == -1)
+void __stdcall glDrawBuffers(GLsizei n, const GLenum* bufs)
+{
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return;
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ glDrawBuffersEXT(n, bufs);
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+void __stdcall glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)",
+ location, count, transpose, value);
+
+ try
+ {
gl::Context *context = gl::getNonLostContext();
if (context)
{
- gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
- if (!programBinary)
+ if (!ValidateUniformMatrix(context, GL_FLOAT_MAT2x3, location, count, transpose))
{
- return gl::error(GL_INVALID_OPERATION);
+ return;
}
- if (!programBinary->setUniform1fv(location, count, v))
+ gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ programBinary->setUniformMatrix2x3fv(location, count, transpose, value);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)",
+ location, count, transpose, value);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (!ValidateUniformMatrix(context, GL_FLOAT_MAT3x2, location, count, transpose))
{
- return gl::error(GL_INVALID_OPERATION);
+ return;
}
+
+ gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ programBinary->setUniformMatrix3x2fv(location, count, transpose, value);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
}
-void __stdcall glUniform1i(GLint location, GLint x)
+void __stdcall glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
{
- glUniform1iv(location, 1, &x);
+ EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)",
+ location, count, transpose, value);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (!ValidateUniformMatrix(context, GL_FLOAT_MAT2x4, location, count, transpose))
+ {
+ return;
+ }
+
+ gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ programBinary->setUniformMatrix2x4fv(location, count, transpose, value);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
}
-void __stdcall glUniform1iv(GLint location, GLsizei count, const GLint* v)
+void __stdcall glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
{
- EVENT("(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)", location, count, v);
+ EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)",
+ location, count, transpose, value);
try
{
- if (count < 0)
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_INVALID_VALUE);
+ if (!ValidateUniformMatrix(context, GL_FLOAT_MAT4x2, location, count, transpose))
+ {
+ return;
+ }
+
+ gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ programBinary->setUniformMatrix4x2fv(location, count, transpose, value);
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)",
+ location, count, transpose, value);
- if (location == -1)
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return;
+ if (!ValidateUniformMatrix(context, GL_FLOAT_MAT3x4, location, count, transpose))
+ {
+ return;
+ }
+
+ gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ programBinary->setUniformMatrix3x4fv(location, count, transpose, value);
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+void __stdcall glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)",
+ location, count, transpose, value);
+
+ try
+ {
gl::Context *context = gl::getNonLostContext();
if (context)
{
+ if (!ValidateUniformMatrix(context, GL_FLOAT_MAT4x3, location, count, transpose))
+ {
+ return;
+ }
+
gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
- if (!programBinary)
+ programBinary->setUniformMatrix4x3fv(location, count, transpose, value);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
+{
+ EVENT("(GLint srcX0 = %d, GLint srcY0 = %d, GLint srcX1 = %d, GLint srcY1 = %d, GLint dstX0 = %d, "
+ "GLint dstY0 = %d, GLint dstX1 = %d, GLint dstY1 = %d, GLbitfield mask = 0x%X, GLenum filter = 0x%X)",
+ srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
return gl::error(GL_INVALID_OPERATION);
}
- if (!programBinary->setUniform1iv(location, count, v))
+ if (!ValidateBlitFramebufferParameters(context, srcX0, srcY0, srcX1, srcY1,
+ dstX0, dstY0, dstX1, dstY1, mask, filter,
+ false))
+ {
+ return;
+ }
+
+ context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1,
+ mask, filter);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
+{
+ EVENT("(GLenum target = 0x%X, GLsizei samples = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)",
+ target, samples, internalformat, width, height);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
return gl::error(GL_INVALID_OPERATION);
}
+
+ if (!ValidateRenderbufferStorageParameters(context, target, samples, internalformat,
+ width, height, false))
+ {
+ return;
+ }
+
+ context->setRenderbufferStorage(width, height, internalformat, samples);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
}
-void __stdcall glUniform2f(GLint location, GLfloat x, GLfloat y)
+void __stdcall glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
{
- GLfloat xy[2] = {x, y};
+ EVENT("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLuint texture = %u, GLint level = %d, GLint layer = %d)",
+ target, attachment, texture, level, layer);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!ValidateES3FramebufferTextureParameters(context, target, attachment, GL_NONE, texture, level, layer, true))
+ {
+ return;
+ }
+
+ gl::Framebuffer *framebuffer = context->getTargetFramebuffer(target);
+ ASSERT(framebuffer);
- glUniform2fv(location, 1, (GLfloat*)&xy);
+ gl::Texture *textureObject = context->getTexture(texture);
+ GLenum textarget = textureObject ? textureObject->getTarget() : GL_NONE;
+
+ if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT)
+ {
+ const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT);
+ framebuffer->setColorbuffer(colorAttachment, textarget, texture, level, layer);
+ }
+ else
+ {
+ switch (attachment)
+ {
+ case GL_DEPTH_ATTACHMENT: framebuffer->setDepthbuffer(textarget, texture, level, layer); break;
+ case GL_STENCIL_ATTACHMENT: framebuffer->setStencilbuffer(textarget, texture, level, layer); break;
+ case GL_DEPTH_STENCIL_ATTACHMENT: framebuffer->setDepthStencilBuffer(textarget, texture, level, layer); break;
+ }
+ }
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
}
-void __stdcall glUniform2fv(GLint location, GLsizei count, const GLfloat* v)
+GLvoid* __stdcall glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
{
- EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)", location, count, v);
+ EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d, GLbitfield access = 0x%X)",
+ target, offset, length, access);
try
{
- if (count < 0)
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_INVALID_VALUE);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ return glMapBufferRangeEXT(target, offset, length, access);
}
-
- if (location == -1)
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ return NULL;
+}
+
+void __stdcall glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
+{
+ EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d)", target, offset, length);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return;
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ glFlushMappedBufferRangeEXT(target, offset, length);
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glBindVertexArray(GLuint array)
+{
+ EVENT("(GLuint array = %u)", array);
+ try
+ {
gl::Context *context = gl::getNonLostContext();
if (context)
{
- gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
- if (!programBinary)
+ if (context->getClientVersion() < 3)
{
return gl::error(GL_INVALID_OPERATION);
}
- if (!programBinary->setUniform2fv(location, count, v))
+ gl::VertexArray *vao = context->getVertexArray(array);
+
+ if (!vao)
{
+ // The default VAO should always exist
+ ASSERT(array != 0);
return gl::error(GL_INVALID_OPERATION);
}
+
+ context->bindVertexArray(array);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
}
-void __stdcall glUniform2i(GLint location, GLint x, GLint y)
+void __stdcall glDeleteVertexArrays(GLsizei n, const GLuint* arrays)
{
- GLint xy[4] = {x, y};
+ EVENT("(GLsizei n = %d, const GLuint* arrays = 0x%0.8p)", n, arrays);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
- glUniform2iv(location, 1, (GLint*)&xy);
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (n < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ for (int arrayIndex = 0; arrayIndex < n; arrayIndex++)
+ {
+ if (arrays[arrayIndex] != 0)
+ {
+ context->deleteVertexArray(arrays[arrayIndex]);
+ }
+ }
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
}
-void __stdcall glUniform2iv(GLint location, GLsizei count, const GLint* v)
+void __stdcall glGenVertexArrays(GLsizei n, GLuint* arrays)
{
- EVENT("(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)", location, count, v);
+ EVENT("(GLsizei n = %d, GLuint* arrays = 0x%0.8p)", n, arrays);
try
{
- if (count < 0)
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_INVALID_VALUE);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (n < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ for (int arrayIndex = 0; arrayIndex < n; arrayIndex++)
+ {
+ arrays[arrayIndex] = context->createVertexArray();
+ }
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+GLboolean __stdcall glIsVertexArray(GLuint array)
+{
+ EVENT("(GLuint array = %u)", array);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
- if (location == -1)
+ if (context)
{
- return;
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION, GL_FALSE);
+ }
+
+ if (array == 0)
+ {
+ return GL_FALSE;
+ }
+
+ gl::VertexArray *vao = context->getVertexArray(array);
+
+ return (vao != NULL ? GL_TRUE : GL_FALSE);
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
+ }
+ return GL_FALSE;
+}
+
+void __stdcall glGetIntegeri_v(GLenum target, GLuint index, GLint* data)
+{
+ EVENT("(GLenum target = 0x%X, GLuint index = %u, GLint* data = 0x%0.8p)",
+ target, index, data);
+
+ try
+ {
gl::Context *context = gl::getNonLostContext();
if (context)
{
- gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
- if (!programBinary)
+ if (context->getClientVersion() < 3)
{
return gl::error(GL_INVALID_OPERATION);
}
- if (!programBinary->setUniform2iv(location, count, v))
+ switch (target)
{
- return gl::error(GL_INVALID_OPERATION);
+ case GL_TRANSFORM_FEEDBACK_BUFFER_START:
+ case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
+ case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
+ if (index >= context->getMaxTransformFeedbackBufferBindings())
+ return gl::error(GL_INVALID_VALUE);
+ break;
+ case GL_UNIFORM_BUFFER_START:
+ case GL_UNIFORM_BUFFER_SIZE:
+ case GL_UNIFORM_BUFFER_BINDING:
+ if (index >= context->getMaximumCombinedUniformBufferBindings())
+ return gl::error(GL_INVALID_VALUE);
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ if (!(context->getIndexedIntegerv(target, index, data)))
+ {
+ GLenum nativeType;
+ unsigned int numParams = 0;
+ if (!context->getIndexedQueryParameterInfo(target, &nativeType, &numParams))
+ return gl::error(GL_INVALID_ENUM);
+
+ if (numParams == 0)
+ return; // it is known that pname is valid, but there are no parameters to return
+
+ if (nativeType == GL_INT_64_ANGLEX)
+ {
+ GLint64 minIntValue = static_cast<GLint64>(std::numeric_limits<int>::min());
+ GLint64 maxIntValue = static_cast<GLint64>(std::numeric_limits<int>::max());
+ GLint64 *int64Params = new GLint64[numParams];
+
+ context->getIndexedInteger64v(target, index, int64Params);
+
+ for (unsigned int i = 0; i < numParams; ++i)
+ {
+ GLint64 clampedValue = std::max(std::min(int64Params[i], maxIntValue), minIntValue);
+ data[i] = static_cast<GLint>(clampedValue);
+ }
+
+ delete [] int64Params;
+ }
+ else
+ {
+ UNREACHABLE();
+ }
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
}
-void __stdcall glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
+void __stdcall glBeginTransformFeedback(GLenum primitiveMode)
{
- GLfloat xyz[3] = {x, y, z};
+ EVENT("(GLenum primitiveMode = 0x%X)", primitiveMode);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ switch (primitiveMode)
+ {
+ case GL_TRIANGLES:
+ case GL_LINES:
+ case GL_POINTS:
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ gl::TransformFeedback *transformFeedback = context->getCurrentTransformFeedback();
+ ASSERT(transformFeedback != NULL);
- glUniform3fv(location, 1, (GLfloat*)&xyz);
+ if (transformFeedback->isStarted())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (transformFeedback->isPaused())
+ {
+ transformFeedback->resume();
+ }
+ else
+ {
+ transformFeedback->start(primitiveMode);
+ }
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
}
-void __stdcall glUniform3fv(GLint location, GLsizei count, const GLfloat* v)
+void __stdcall glEndTransformFeedback(void)
{
- EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)", location, count, v);
+ EVENT("(void)");
try
{
- if (count < 0)
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_INVALID_VALUE);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ gl::TransformFeedback *transformFeedback = context->getCurrentTransformFeedback();
+ ASSERT(transformFeedback != NULL);
+
+ if (!transformFeedback->isStarted())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ transformFeedback->stop();
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
+{
+ EVENT("(GLenum target = 0x%X, GLuint index = %u, GLuint buffer = %u, GLintptr offset = %d, GLsizeiptr size = %d)",
+ target, index, buffer, offset, size);
- if (location == -1)
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return;
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ switch (target)
+ {
+ case GL_TRANSFORM_FEEDBACK_BUFFER:
+ if (index >= context->getMaxTransformFeedbackBufferBindings())
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ break;
+
+ case GL_UNIFORM_BUFFER:
+ if (index >= context->getMaximumCombinedUniformBufferBindings())
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ if (buffer != 0 && size <= 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ switch (target)
+ {
+ case GL_TRANSFORM_FEEDBACK_BUFFER:
+
+ // size and offset must be a multiple of 4
+ if (buffer != 0 && ((offset % 4) != 0 || (size % 4) != 0))
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ context->bindIndexedTransformFeedbackBuffer(buffer, index, offset, size);
+ context->bindGenericTransformFeedbackBuffer(buffer);
+ break;
+
+ case GL_UNIFORM_BUFFER:
+
+ // it is an error to bind an offset not a multiple of the alignment
+ if (buffer != 0 && (offset % context->getUniformBufferOffsetAlignment()) != 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ context->bindIndexedUniformBuffer(buffer, index, offset, size);
+ context->bindGenericUniformBuffer(buffer);
+ break;
+
+ default:
+ UNREACHABLE();
+ }
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+void __stdcall glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
+{
+ EVENT("(GLenum target = 0x%X, GLuint index = %u, GLuint buffer = %u)",
+ target, index, buffer);
+
+ try
+ {
gl::Context *context = gl::getNonLostContext();
if (context)
{
- gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
- if (!programBinary)
+ if (context->getClientVersion() < 3)
{
return gl::error(GL_INVALID_OPERATION);
}
- if (!programBinary->setUniform3fv(location, count, v))
+ switch (target)
+ {
+ case GL_TRANSFORM_FEEDBACK_BUFFER:
+ if (index >= context->getMaxTransformFeedbackBufferBindings())
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ break;
+
+ case GL_UNIFORM_BUFFER:
+ if (index >= context->getMaximumCombinedUniformBufferBindings())
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ switch (target)
+ {
+ case GL_TRANSFORM_FEEDBACK_BUFFER:
+ context->bindIndexedTransformFeedbackBuffer(buffer, index, 0, 0);
+ context->bindGenericTransformFeedbackBuffer(buffer);
+ break;
+
+ case GL_UNIFORM_BUFFER:
+ context->bindIndexedUniformBuffer(buffer, index, 0, 0);
+ context->bindGenericUniformBuffer(buffer);
+ break;
+
+ default:
+ UNREACHABLE();
+ }
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode)
+{
+ EVENT("(GLuint program = %u, GLsizei count = %d, const GLchar* const* varyings = 0x%0.8p, GLenum bufferMode = 0x%X)",
+ program, count, varyings, bufferMode);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
return gl::error(GL_INVALID_OPERATION);
}
+
+ if (count < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ switch (bufferMode)
+ {
+ case GL_INTERLEAVED_ATTRIBS:
+ break;
+ case GL_SEPARATE_ATTRIBS:
+ if (static_cast<GLuint>(count) > context->getMaxTransformFeedbackBufferBindings())
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ if (!gl::ValidProgram(context, program))
+ {
+ return;
+ }
+
+ gl::Program *programObject = context->getProgram(program);
+ ASSERT(programObject);
+
+ programObject->setTransformFeedbackVaryings(count, varyings, bufferMode);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
}
-void __stdcall glUniform3i(GLint location, GLint x, GLint y, GLint z)
+void __stdcall glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name)
{
- GLint xyz[3] = {x, y, z};
+ EVENT("(GLuint program = %u, GLuint index = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, "
+ "GLsizei* size = 0x%0.8p, GLenum* type = 0x%0.8p, GLchar* name = 0x%0.8p)",
+ program, index, bufSize, length, size, type, name);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (bufSize < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ if (!gl::ValidProgram(context, program))
+ {
+ return;
+ }
+
+ gl::Program *programObject = context->getProgram(program);
+ ASSERT(programObject);
+
+ if (index >= static_cast<GLuint>(programObject->getTransformFeedbackVaryingCount()))
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
- glUniform3iv(location, 1, (GLint*)&xyz);
+ programObject->getTransformFeedbackVarying(index, bufSize, length, size, type, name);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
}
-void __stdcall glUniform3iv(GLint location, GLsizei count, const GLint* v)
+void __stdcall glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer)
{
- EVENT("(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)", location, count, v);
+ EVENT("(GLuint index = %u, GLint size = %d, GLenum type = 0x%X, GLsizei stride = %d, const GLvoid* pointer = 0x%0.8p)",
+ index, size, type, stride, pointer);
try
{
- if (count < 0)
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ }
+
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
{
return gl::error(GL_INVALID_VALUE);
}
- if (location == -1)
+ if (size < 1 || size > 4)
{
- return;
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ switch (type)
+ {
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_INT_2_10_10_10_REV:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
}
+ if (stride < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ if ((type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV) && size != 4)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (context)
+ {
+ // [OpenGL ES 3.0.2] Section 2.8 page 24:
+ // An INVALID_OPERATION error is generated when a non-zero vertex array object
+ // is bound, zero is bound to the ARRAY_BUFFER buffer object binding point,
+ // and the pointer argument is not NULL.
+ if (context->getVertexArrayHandle() != 0 && context->getArrayBufferHandle() == 0 && pointer != NULL)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ context->setVertexAttribState(index, context->getArrayBuffer(), size, type, false, true,
+ stride, pointer);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetVertexAttribIiv(GLuint index, GLenum pname, GLint* params)
+{
+ EVENT("(GLuint index = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)",
+ index, pname, params);
+
+ try
+ {
gl::Context *context = gl::getNonLostContext();
if (context)
{
- gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
- if (!programBinary)
+ if (context->getClientVersion() < 3)
{
return gl::error(GL_INVALID_OPERATION);
}
- if (!programBinary->setUniform3iv(location, count, v))
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ const gl::VertexAttribute &attribState = context->getVertexAttribState(index);
+
+ if (!gl::ValidateGetVertexAttribParameters(pname, context->getClientVersion()))
+ {
+ return;
+ }
+
+ if (pname == GL_CURRENT_VERTEX_ATTRIB)
+ {
+ const gl::VertexAttribCurrentValueData &currentValueData = context->getVertexAttribCurrentValue(index);
+ for (int i = 0; i < 4; ++i)
+ {
+ params[i] = currentValueData.IntValues[i];
+ }
+ }
+ else
+ {
+ *params = attribState.querySingleParameter<GLint>(pname);
+ }
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params)
+{
+ EVENT("(GLuint index = %u, GLenum pname = 0x%X, GLuint* params = 0x%0.8p)",
+ index, pname, params);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
return gl::error(GL_INVALID_OPERATION);
}
+
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ const gl::VertexAttribute &attribState = context->getVertexAttribState(index);
+
+ if (!gl::ValidateGetVertexAttribParameters(pname, context->getClientVersion()))
+ {
+ return;
+ }
+
+ if (pname == GL_CURRENT_VERTEX_ATTRIB)
+ {
+ const gl::VertexAttribCurrentValueData &currentValueData = context->getVertexAttribCurrentValue(index);
+ for (int i = 0; i < 4; ++i)
+ {
+ params[i] = currentValueData.UnsignedIntValues[i];
+ }
+ }
+ else
+ {
+ *params = attribState.querySingleParameter<GLuint>(pname);
+ }
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
}
-void __stdcall glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+void __stdcall glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
{
- GLfloat xyzw[4] = {x, y, z, w};
+ EVENT("(GLuint index = %u, GLint x = %d, GLint y = %d, GLint z = %d, GLint w = %d)",
+ index, x, y, z, w);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
- glUniform4fv(location, 1, (GLfloat*)&xyzw);
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ GLint vals[4] = { x, y, z, w };
+ context->setVertexAttribi(index, vals);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
}
-void __stdcall glUniform4fv(GLint location, GLsizei count, const GLfloat* v)
+void __stdcall glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
{
- EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)", location, count, v);
+ EVENT("(GLuint index = %u, GLuint x = %u, GLuint y = %u, GLuint z = %u, GLuint w = %u)",
+ index, x, y, z, w);
try
{
- if (count < 0)
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_INVALID_VALUE);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ GLuint vals[4] = { x, y, z, w };
+ context->setVertexAttribu(index, vals);
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glVertexAttribI4iv(GLuint index, const GLint* v)
+{
+ EVENT("(GLuint index = %u, const GLint* v = 0x%0.8p)", index, v);
- if (location == -1)
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return;
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ context->setVertexAttribi(index, v);
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+void __stdcall glVertexAttribI4uiv(GLuint index, const GLuint* v)
+{
+ EVENT("(GLuint index = %u, const GLuint* v = 0x%0.8p)", index, v);
+
+ try
+ {
gl::Context *context = gl::getNonLostContext();
if (context)
{
- gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ context->setVertexAttribu(index, v);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetUniformuiv(GLuint program, GLint location, GLuint* params)
+{
+ EVENT("(GLuint program = %u, GLint location = %d, GLuint* params = 0x%0.8p)",
+ program, location, params);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (program == 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject || !programObject->isLinked())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ gl::ProgramBinary *programBinary = programObject->getProgramBinary();
if (!programBinary)
{
return gl::error(GL_INVALID_OPERATION);
}
- if (!programBinary->setUniform4fv(location, count, v))
+ if (!programBinary->getUniformuiv(location, NULL, params))
{
return gl::error(GL_INVALID_OPERATION);
}
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
}
-void __stdcall glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
+GLint __stdcall glGetFragDataLocation(GLuint program, const GLchar *name)
{
- GLint xyzw[4] = {x, y, z, w};
+ EVENT("(GLuint program = %u, const GLchar *name = 0x%0.8p)",
+ program, name);
- glUniform4iv(location, 1, (GLint*)&xyzw);
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION, -1);
+ }
+
+ if (program == 0)
+ {
+ return gl::error(GL_INVALID_VALUE, -1);
+ }
+
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject || !programObject->isLinked())
+ {
+ return gl::error(GL_INVALID_OPERATION, -1);
+ }
+
+ gl::ProgramBinary *programBinary = programObject->getProgramBinary();
+ if (!programBinary)
+ {
+ return gl::error(GL_INVALID_OPERATION, -1);
+ }
+
+ return programBinary->getFragDataLocation(name);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, 0);
+ }
+
+ return 0;
}
-void __stdcall glUniform4iv(GLint location, GLsizei count, const GLint* v)
+void __stdcall glUniform1ui(GLint location, GLuint v0)
{
- EVENT("(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)", location, count, v);
+ glUniform1uiv(location, 1, &v0);
+}
+
+void __stdcall glUniform2ui(GLint location, GLuint v0, GLuint v1)
+{
+ const GLuint xy[] = { v0, v1 };
+ glUniform2uiv(location, 1, xy);
+}
+
+void __stdcall glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
+{
+ const GLuint xyz[] = { v0, v1, v2 };
+ glUniform3uiv(location, 1, xyz);
+}
+
+void __stdcall glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
+{
+ const GLuint xyzw[] = { v0, v1, v2, v3 };
+ glUniform4uiv(location, 1, xyzw);
+}
+
+void __stdcall glUniform1uiv(GLint location, GLsizei count, const GLuint* value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)",
+ location, count, value);
try
{
- if (count < 0)
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_INVALID_VALUE);
+ if (!ValidateUniform(context, GL_UNSIGNED_INT, location, count))
+ {
+ return;
+ }
+
+ gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ programBinary->setUniform1uiv(location, count, value);
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
- if (location == -1)
+void __stdcall glUniform2uiv(GLint location, GLsizei count, const GLuint* value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)",
+ location, count, value);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return;
+ if (!ValidateUniform(context, GL_UNSIGNED_INT_VEC2, location, count))
+ {
+ return;
+ }
+
+ gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ programBinary->setUniform2uiv(location, count, value);
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+void __stdcall glUniform3uiv(GLint location, GLsizei count, const GLuint* value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value)",
+ location, count, value);
+
+ try
+ {
gl::Context *context = gl::getNonLostContext();
if (context)
{
- gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
- if (!programBinary)
+ if (!ValidateUniform(context, GL_UNSIGNED_INT_VEC3, location, count))
{
- return gl::error(GL_INVALID_OPERATION);
+ return;
}
- if (!programBinary->setUniform4iv(location, count, v))
+ gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ programBinary->setUniform3uiv(location, count, value);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glUniform4uiv(GLint location, GLsizei count, const GLuint* value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)",
+ location, count, value);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (!ValidateUniform(context, GL_UNSIGNED_INT_VEC4, location, count))
{
- return gl::error(GL_INVALID_OPERATION);
+ return;
}
+
+ gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ programBinary->setUniform4uiv(location, count, value);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
}
-void __stdcall glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+void __stdcall glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint* value)
{
- EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %d, const GLfloat* value = 0x%0.8p)",
- location, count, transpose, value);
+ EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLint* value = 0x%0.8p)",
+ buffer, drawbuffer, value);
try
{
- if (count < 0 || transpose != GL_FALSE)
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_INVALID_VALUE);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ switch (buffer)
+ {
+ case GL_COLOR:
+ if (drawbuffer < 0 || drawbuffer >= static_cast<GLint>(context->getMaximumRenderTargets()))
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ break;
+ case GL_STENCIL:
+ if (drawbuffer != 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ context->clearBufferiv(buffer, drawbuffer, value);
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint* value)
+{
+ EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLuint* value = 0x%0.8p)",
+ buffer, drawbuffer, value);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
- if (location == -1)
+ if (context)
{
- return;
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ switch (buffer)
+ {
+ case GL_COLOR:
+ if (drawbuffer < 0 || drawbuffer >= static_cast<GLint>(context->getMaximumRenderTargets()))
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ context->clearBufferuiv(buffer, drawbuffer, value);
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+void __stdcall glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat* value)
+{
+ EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLfloat* value = 0x%0.8p)",
+ buffer, drawbuffer, value);
+
+ try
+ {
gl::Context *context = gl::getNonLostContext();
if (context)
{
- gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
- if (!programBinary)
+ if (context->getClientVersion() < 3)
{
return gl::error(GL_INVALID_OPERATION);
}
- if (!programBinary->setUniformMatrix2fv(location, count, value))
+ switch (buffer)
{
- return gl::error(GL_INVALID_OPERATION);
+ case GL_COLOR:
+ if (drawbuffer < 0 || drawbuffer >= static_cast<GLint>(context->getMaximumRenderTargets()))
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ break;
+ case GL_DEPTH:
+ if (drawbuffer != 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
}
+
+ context->clearBufferfv(buffer, drawbuffer, value);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
}
-void __stdcall glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+void __stdcall glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
{
- EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %d, const GLfloat* value = 0x%0.8p)",
- location, count, transpose, value);
+ EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, GLfloat depth, GLint stencil = %d)",
+ buffer, drawbuffer, depth, stencil);
try
{
- if (count < 0 || transpose != GL_FALSE)
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_INVALID_VALUE);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ switch (buffer)
+ {
+ case GL_DEPTH_STENCIL:
+ if (drawbuffer != 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ context->clearBufferfi(buffer, drawbuffer, depth, stencil);
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
- if (location == -1)
+const GLubyte* __stdcall glGetStringi(GLenum name, GLuint index)
+{
+ EVENT("(GLenum name = 0x%X, GLuint index = %u)", name, index);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return;
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLubyte*>(NULL));
+ }
+
+ if (name != GL_EXTENSIONS)
+ {
+ return gl::error(GL_INVALID_ENUM, reinterpret_cast<GLubyte*>(NULL));
+ }
+
+ if (index >= context->getNumExtensions())
+ {
+ return gl::error(GL_INVALID_VALUE, reinterpret_cast<GLubyte*>(NULL));
+ }
+
+ return reinterpret_cast<const GLubyte*>(context->getExtensionString(index));
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, reinterpret_cast<GLubyte*>(NULL));
+ }
+
+ return NULL;
+}
+void __stdcall glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
+{
+ EVENT("(GLenum readTarget = 0x%X, GLenum writeTarget = 0x%X, GLintptr readOffset = %d, GLintptr writeOffset = %d, GLsizeiptr size = %d)",
+ readTarget, writeTarget, readOffset, writeOffset, size);
+
+ try
+ {
gl::Context *context = gl::getNonLostContext();
if (context)
{
- gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
- if (!programBinary)
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!gl::ValidBufferTarget(context, readTarget) || !gl::ValidBufferTarget(context, readTarget))
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ gl::Buffer *readBuffer = context->getTargetBuffer(readTarget);
+ gl::Buffer *writeBuffer = context->getTargetBuffer(writeTarget);
+
+ if (!readBuffer || !writeBuffer)
{
return gl::error(GL_INVALID_OPERATION);
}
- if (!programBinary->setUniformMatrix3fv(location, count, value))
+ if (readBuffer->mapped() || writeBuffer->mapped())
{
return gl::error(GL_INVALID_OPERATION);
}
+
+ if (readOffset < 0 || writeOffset < 0 || size < 0 ||
+ static_cast<unsigned int>(readOffset + size) > readBuffer->size() ||
+ static_cast<unsigned int>(writeOffset + size) > writeBuffer->size())
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ if (readBuffer == writeBuffer && abs(readOffset - writeOffset) < size)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ // TODO: Verify that readBuffer and writeBuffer are not currently mapped (GL_INVALID_OPERATION)
+
+ // if size is zero, the copy is a successful no-op
+ if (size > 0)
+ {
+ writeBuffer->copyBufferSubData(readBuffer, readOffset, writeOffset, size);
+ }
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
}
-void __stdcall glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+void __stdcall glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices)
{
- EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %d, const GLfloat* value = 0x%0.8p)",
- location, count, transpose, value);
+ EVENT("(GLuint program = %u, GLsizei uniformCount = %d, const GLchar* const* uniformNames = 0x%0.8p, GLuint* uniformIndices = 0x%0.8p)",
+ program, uniformCount, uniformNames, uniformIndices);
try
{
- if (count < 0 || transpose != GL_FALSE)
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_INVALID_VALUE);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (uniformCount < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
+ {
+ if (context->getShader(program))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ else
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ }
+
+ gl::ProgramBinary *programBinary = programObject->getProgramBinary();
+ if (!programObject->isLinked() || !programBinary)
+ {
+ for (int uniformId = 0; uniformId < uniformCount; uniformId++)
+ {
+ uniformIndices[uniformId] = GL_INVALID_INDEX;
+ }
+ }
+ else
+ {
+ for (int uniformId = 0; uniformId < uniformCount; uniformId++)
+ {
+ uniformIndices[uniformId] = programBinary->getUniformIndex(uniformNames[uniformId]);
+ }
+ }
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
- if (location == -1)
+void __stdcall glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params)
+{
+ EVENT("(GLuint program = %u, GLsizei uniformCount = %d, const GLuint* uniformIndices = 0x%0.8p, GLenum pname = 0x%X, GLint* params = 0x%0.8p)",
+ program, uniformCount, uniformIndices, pname, params);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return;
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (uniformCount < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
+ {
+ if (context->getShader(program))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ else
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ }
+
+ switch (pname)
+ {
+ case GL_UNIFORM_TYPE:
+ case GL_UNIFORM_SIZE:
+ case GL_UNIFORM_NAME_LENGTH:
+ case GL_UNIFORM_BLOCK_INDEX:
+ case GL_UNIFORM_OFFSET:
+ case GL_UNIFORM_ARRAY_STRIDE:
+ case GL_UNIFORM_MATRIX_STRIDE:
+ case GL_UNIFORM_IS_ROW_MAJOR:
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ gl::ProgramBinary *programBinary = programObject->getProgramBinary();
+
+ if (!programBinary && uniformCount > 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ for (int uniformId = 0; uniformId < uniformCount; uniformId++)
+ {
+ const GLuint index = uniformIndices[uniformId];
+
+ if (index >= (GLuint)programBinary->getActiveUniformCount())
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ }
+
+ for (int uniformId = 0; uniformId < uniformCount; uniformId++)
+ {
+ const GLuint index = uniformIndices[uniformId];
+ params[uniformId] = programBinary->getActiveUniformi(index, pname);
+ }
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+GLuint __stdcall glGetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName)
+{
+ EVENT("(GLuint program = %u, const GLchar* uniformBlockName = 0x%0.8p)", program, uniformBlockName);
+
+ try
+ {
gl::Context *context = gl::getNonLostContext();
if (context)
{
- gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION, GL_INVALID_INDEX);
+ }
+
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
+ {
+ if (context->getShader(program))
+ {
+ return gl::error(GL_INVALID_OPERATION, GL_INVALID_INDEX);
+ }
+ else
+ {
+ return gl::error(GL_INVALID_VALUE, GL_INVALID_INDEX);
+ }
+ }
+
+ gl::ProgramBinary *programBinary = programObject->getProgramBinary();
if (!programBinary)
{
- return gl::error(GL_INVALID_OPERATION);
+ return GL_INVALID_INDEX;
}
- if (!programBinary->setUniformMatrix4fv(location, count, value))
+ return programBinary->getUniformBlockIndex(uniformBlockName);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, 0);
+ }
+
+ return 0;
+}
+
+void __stdcall glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params)
+{
+ EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)",
+ program, uniformBlockIndex, pname, params);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
return gl::error(GL_INVALID_OPERATION);
}
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
+ {
+ if (context->getShader(program))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ else
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ }
+
+ gl::ProgramBinary *programBinary = programObject->getProgramBinary();
+
+ if (!programBinary || uniformBlockIndex >= programBinary->getActiveUniformBlockCount())
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ switch (pname)
+ {
+ case GL_UNIFORM_BLOCK_BINDING:
+ *params = static_cast<GLint>(programObject->getUniformBlockBinding(uniformBlockIndex));
+ break;
+
+ case GL_UNIFORM_BLOCK_DATA_SIZE:
+ case GL_UNIFORM_BLOCK_NAME_LENGTH:
+ case GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS:
+ case GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:
+ case GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:
+ case GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:
+ programBinary->getActiveUniformBlockiv(uniformBlockIndex, pname, params);
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
}
-void __stdcall glUseProgram(GLuint program)
+void __stdcall glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName)
{
- EVENT("(GLuint program = %d)", program);
+ EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLchar* uniformBlockName = 0x%0.8p)",
+ program, uniformBlockIndex, bufSize, length, uniformBlockName);
try
{
@@ -6464,9 +8439,14 @@ void __stdcall glUseProgram(GLuint program)
if (context)
{
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
gl::Program *programObject = context->getProgram(program);
- if (!programObject && program != 0)
+ if (!programObject)
{
if (context->getShader(program))
{
@@ -6478,23 +8458,26 @@ void __stdcall glUseProgram(GLuint program)
}
}
- if (program != 0 && !programObject->isLinked())
+ gl::ProgramBinary *programBinary = programObject->getProgramBinary();
+
+ if (!programBinary || uniformBlockIndex >= programBinary->getActiveUniformBlockCount())
{
- return gl::error(GL_INVALID_OPERATION);
+ return gl::error(GL_INVALID_VALUE);
}
- context->useProgram(program);
+ programBinary->getActiveUniformBlockName(uniformBlockIndex, bufSize, length, uniformBlockName);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
}
-void __stdcall glValidateProgram(GLuint program)
+void __stdcall glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
{
- EVENT("(GLuint program = %d)", program);
+ EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLuint uniformBlockBinding = %u)",
+ program, uniformBlockIndex, uniformBlockBinding);
try
{
@@ -6502,6 +8485,16 @@ void __stdcall glValidateProgram(GLuint program)
if (context)
{
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (uniformBlockBinding >= context->getMaximumCombinedUniformBufferBindings())
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
gl::Program *programObject = context->getProgram(program);
if (!programObject)
@@ -6516,217 +8509,749 @@ void __stdcall glValidateProgram(GLuint program)
}
}
- programObject->validate();
+ gl::ProgramBinary *programBinary = programObject->getProgramBinary();
+
+ // if never linked, there won't be any uniform blocks
+ if (!programBinary || uniformBlockIndex >= programBinary->getActiveUniformBlockCount())
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ programObject->bindUniformBlock(uniformBlockIndex, uniformBlockBinding);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
}
-void __stdcall glVertexAttrib1f(GLuint index, GLfloat x)
+void __stdcall glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount)
{
- EVENT("(GLuint index = %d, GLfloat x = %f)", index, x);
+ EVENT("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d, GLsizei instanceCount = %d)",
+ mode, first, count, instanceCount);
try
{
- if (index >= gl::MAX_VERTEX_ATTRIBS)
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_INVALID_VALUE);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ // glDrawArraysInstanced
+ UNIMPLEMENTED();
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+void __stdcall glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount)
+{
+ EVENT("(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const GLvoid* indices = 0x%0.8p, GLsizei instanceCount = %d)",
+ mode, count, type, indices, instanceCount);
+
+ try
+ {
gl::Context *context = gl::getNonLostContext();
if (context)
{
- GLfloat vals[4] = { x, 0, 0, 1 };
- context->setVertexAttrib(index, vals);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ // glDrawElementsInstanced
+ UNIMPLEMENTED();
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
}
-void __stdcall glVertexAttrib1fv(GLuint index, const GLfloat* values)
+GLsync __stdcall glFenceSync(GLenum condition, GLbitfield flags)
{
- EVENT("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values);
+ EVENT("(GLenum condition = 0x%X, GLbitfield flags = 0x%X)", condition, flags);
try
{
- if (index >= gl::MAX_VERTEX_ATTRIBS)
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_INVALID_VALUE);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLsync>(0));
+ }
+
+ if (condition != GL_SYNC_GPU_COMMANDS_COMPLETE)
+ {
+ return gl::error(GL_INVALID_ENUM, reinterpret_cast<GLsync>(0));
+ }
+
+ if (flags != 0)
+ {
+ return gl::error(GL_INVALID_VALUE, reinterpret_cast<GLsync>(0));
+ }
+
+ return context->createFenceSync(condition);
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, reinterpret_cast<GLsync>(NULL));
+ }
+
+ return NULL;
+}
+GLboolean __stdcall glIsSync(GLsync sync)
+{
+ EVENT("(GLsync sync = 0x%0.8p)", sync);
+
+ try
+ {
gl::Context *context = gl::getNonLostContext();
if (context)
{
- GLfloat vals[4] = { values[0], 0, 0, 1 };
- context->setVertexAttrib(index, vals);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION, GL_FALSE);
+ }
+
+ return (context->getFenceSync(sync) != NULL);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
+ }
+
+ return GL_FALSE;
+}
+
+void __stdcall glDeleteSync(GLsync sync)
+{
+ EVENT("(GLsync sync = 0x%0.8p)", sync);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (sync != static_cast<GLsync>(0) && !context->getFenceSync(sync))
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ context->deleteFenceSync(sync);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
}
-void __stdcall glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
+GLenum __stdcall glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
{
- EVENT("(GLuint index = %d, GLfloat x = %f, GLfloat y = %f)", index, x, y);
+ EVENT("(GLsync sync = 0x%0.8p, GLbitfield flags = 0x%X, GLuint64 timeout = %llu)",
+ sync, flags, timeout);
try
{
- if (index >= gl::MAX_VERTEX_ATTRIBS)
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_INVALID_VALUE);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION, GL_WAIT_FAILED);
+ }
+
+ if ((flags & ~(GL_SYNC_FLUSH_COMMANDS_BIT)) != 0)
+ {
+ return gl::error(GL_INVALID_VALUE, GL_WAIT_FAILED);
+ }
+
+ gl::FenceSync *fenceSync = context->getFenceSync(sync);
+
+ if (!fenceSync)
+ {
+ return gl::error(GL_INVALID_VALUE, GL_WAIT_FAILED);
+ }
+
+ return fenceSync->clientWait(flags, timeout);
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
+ }
+ return GL_FALSE;
+}
+
+void __stdcall glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
+{
+ EVENT("(GLsync sync = 0x%0.8p, GLbitfield flags = 0x%X, GLuint64 timeout = %llu)",
+ sync, flags, timeout);
+
+ try
+ {
gl::Context *context = gl::getNonLostContext();
if (context)
{
- GLfloat vals[4] = { x, y, 0, 1 };
- context->setVertexAttrib(index, vals);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (flags != 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ if (timeout != GL_TIMEOUT_IGNORED)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ gl::FenceSync *fenceSync = context->getFenceSync(sync);
+
+ if (!fenceSync)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ fenceSync->serverWait();
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
}
-void __stdcall glVertexAttrib2fv(GLuint index, const GLfloat* values)
+void __stdcall glGetInteger64v(GLenum pname, GLint64* params)
{
- EVENT("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values);
+ EVENT("(GLenum pname = 0x%X, GLint64* params = 0x%0.8p)",
+ pname, params);
try
{
- if (index >= gl::MAX_VERTEX_ATTRIBS)
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_INVALID_VALUE);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ GLenum nativeType;
+ unsigned int numParams = 0;
+ if (!ValidateStateQuery(context, pname, &nativeType, &numParams))
+ {
+ return;
+ }
+
+ if (nativeType == GL_INT_64_ANGLEX)
+ {
+ context->getInteger64v(pname, params);
+ }
+ else
+ {
+ CastStateValues(context, nativeType, pname, numParams, params);
+ }
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+void __stdcall glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values)
+{
+ EVENT("(GLsync sync = 0x%0.8p, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLint* values = 0x%0.8p)",
+ sync, pname, bufSize, length, values);
+
+ try
+ {
gl::Context *context = gl::getNonLostContext();
if (context)
{
- GLfloat vals[4] = { values[0], values[1], 0, 1 };
- context->setVertexAttrib(index, vals);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (bufSize < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ gl::FenceSync *fenceSync = context->getFenceSync(sync);
+
+ if (!fenceSync)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ switch (pname)
+ {
+ case GL_OBJECT_TYPE: values[0] = static_cast<GLint>(GL_SYNC_FENCE); break;
+ case GL_SYNC_STATUS: values[0] = static_cast<GLint>(fenceSync->getStatus()); break;
+ case GL_SYNC_CONDITION: values[0] = static_cast<GLint>(fenceSync->getCondition()); break;
+ case GL_SYNC_FLAGS: values[0] = 0; break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
}
-void __stdcall glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
+void __stdcall glGetInteger64i_v(GLenum target, GLuint index, GLint64* data)
{
- EVENT("(GLuint index = %d, GLfloat x = %f, GLfloat y = %f, GLfloat z = %f)", index, x, y, z);
+ EVENT("(GLenum target = 0x%X, GLuint index = %u, GLint64* data = 0x%0.8p)",
+ target, index, data);
try
{
- if (index >= gl::MAX_VERTEX_ATTRIBS)
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_INVALID_VALUE);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ switch (target)
+ {
+ case GL_TRANSFORM_FEEDBACK_BUFFER_START:
+ case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
+ case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
+ if (index >= context->getMaxTransformFeedbackBufferBindings())
+ return gl::error(GL_INVALID_VALUE);
+ break;
+ case GL_UNIFORM_BUFFER_START:
+ case GL_UNIFORM_BUFFER_SIZE:
+ case GL_UNIFORM_BUFFER_BINDING:
+ if (index >= context->getMaximumCombinedUniformBufferBindings())
+ return gl::error(GL_INVALID_VALUE);
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ if (!(context->getIndexedInteger64v(target, index, data)))
+ {
+ GLenum nativeType;
+ unsigned int numParams = 0;
+ if (!context->getIndexedQueryParameterInfo(target, &nativeType, &numParams))
+ return gl::error(GL_INVALID_ENUM);
+
+ if (numParams == 0)
+ return; // it is known that pname is valid, but there are no parameters to return
+
+ if (nativeType == GL_INT)
+ {
+ GLint *intParams = new GLint[numParams];
+
+ context->getIndexedIntegerv(target, index, intParams);
+
+ for (unsigned int i = 0; i < numParams; ++i)
+ {
+ data[i] = static_cast<GLint64>(intParams[i]);
+ }
+
+ delete [] intParams;
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+ }
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint64* params = 0x%0.8p)",
+ target, pname, params);
+ try
+ {
gl::Context *context = gl::getNonLostContext();
if (context)
{
- GLfloat vals[4] = { x, y, z, 1 };
- context->setVertexAttrib(index, vals);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!gl::ValidBufferTarget(context, target))
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ if (!gl::ValidBufferParameter(context, pname))
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ gl::Buffer *buffer = context->getTargetBuffer(target);
+
+ if (!buffer)
+ {
+ // A null buffer means that "0" is bound to the requested buffer target
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ switch (pname)
+ {
+ case GL_BUFFER_USAGE:
+ *params = static_cast<GLint64>(buffer->usage());
+ break;
+ case GL_BUFFER_SIZE:
+ *params = buffer->size();
+ break;
+ case GL_BUFFER_ACCESS_FLAGS:
+ *params = static_cast<GLint64>(buffer->accessFlags());
+ break;
+ case GL_BUFFER_MAPPED:
+ *params = static_cast<GLint64>(buffer->mapped());
+ break;
+ case GL_BUFFER_MAP_OFFSET:
+ *params = buffer->mapOffset();
+ break;
+ case GL_BUFFER_MAP_LENGTH:
+ *params = buffer->mapLength();
+ break;
+ default: UNREACHABLE(); break;
+ }
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
}
-void __stdcall glVertexAttrib3fv(GLuint index, const GLfloat* values)
+void __stdcall glGenSamplers(GLsizei count, GLuint* samplers)
{
- EVENT("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values);
+ EVENT("(GLsizei count = %d, GLuint* samplers = 0x%0.8p)", count, samplers);
try
{
- if (index >= gl::MAX_VERTEX_ATTRIBS)
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_INVALID_VALUE);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (count < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ for (int i = 0; i < count; i++)
+ {
+ samplers[i] = context->createSampler();
+ }
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glDeleteSamplers(GLsizei count, const GLuint* samplers)
+{
+ EVENT("(GLsizei count = %d, const GLuint* samplers = 0x%0.8p)", count, samplers);
+ try
+ {
gl::Context *context = gl::getNonLostContext();
if (context)
{
- GLfloat vals[4] = { values[0], values[1], values[2], 1 };
- context->setVertexAttrib(index, vals);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (count < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ for (int i = 0; i < count; i++)
+ {
+ context->deleteSampler(samplers[i]);
+ }
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
}
-void __stdcall glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+GLboolean __stdcall glIsSampler(GLuint sampler)
{
- EVENT("(GLuint index = %d, GLfloat x = %f, GLfloat y = %f, GLfloat z = %f, GLfloat w = %f)", index, x, y, z, w);
+ EVENT("(GLuint sampler = %u)", sampler);
try
{
- if (index >= gl::MAX_VERTEX_ATTRIBS)
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_INVALID_VALUE);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION, GL_FALSE);
+ }
+
+ return context->isSampler(sampler);
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
+ }
+ return GL_FALSE;
+}
+
+void __stdcall glBindSampler(GLuint unit, GLuint sampler)
+{
+ EVENT("(GLuint unit = %u, GLuint sampler = %u)", unit, sampler);
+
+ try
+ {
gl::Context *context = gl::getNonLostContext();
if (context)
{
- GLfloat vals[4] = { x, y, z, w };
- context->setVertexAttrib(index, vals);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (sampler != 0 && !context->isSampler(sampler))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (unit >= context->getMaximumCombinedTextureImageUnits())
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ context->bindSampler(unit, sampler);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
}
-void __stdcall glVertexAttrib4fv(GLuint index, const GLfloat* values)
+void __stdcall glSamplerParameteri(GLuint sampler, GLenum pname, GLint param)
{
- EVENT("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values);
+ EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLint param = %d)", sampler, pname, param);
try
{
- if (index >= gl::MAX_VERTEX_ATTRIBS)
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_INVALID_VALUE);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!gl::ValidateSamplerObjectParameter(pname))
+ {
+ return;
+ }
+
+ if (!gl::ValidateTexParamParameters(context, pname, param))
+ {
+ return;
+ }
+
+ if (!context->isSampler(sampler))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ context->samplerParameteri(sampler, pname, param);
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+void __stdcall glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param)
+{
+ glSamplerParameteri(sampler, pname, *param);
+}
+
+void __stdcall glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
+{
+ EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLfloat param = %g)", sampler, pname, param);
+
+ try
+ {
gl::Context *context = gl::getNonLostContext();
if (context)
{
- context->setVertexAttrib(index, values);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!gl::ValidateSamplerObjectParameter(pname))
+ {
+ return;
+ }
+
+ if (!gl::ValidateTexParamParameters(context, pname, static_cast<GLint>(param)))
+ {
+ return;
+ }
+
+ if (!context->isSampler(sampler))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ context->samplerParameterf(sampler, pname, param);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
}
-void __stdcall glVertexAttribDivisorANGLE(GLuint index, GLuint divisor)
+void __stdcall glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param)
{
- EVENT("(GLuint index = %d, GLuint divisor = %d)", index, divisor);
+ glSamplerParameterf(sampler, pname, *param);
+}
+
+void __stdcall glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint* params)
+{
+ EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", sampler, pname, params);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!gl::ValidateSamplerObjectParameter(pname))
+ {
+ return;
+ }
+
+ if (!context->isSampler(sampler))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ *params = context->getSamplerParameteri(sampler, pname);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* params)
+{
+ EVENT("(GLuint sample = %ur, GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)", sampler, pname, params);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!gl::ValidateSamplerObjectParameter(pname))
+ {
+ return;
+ }
+
+ if (!context->isSampler(sampler))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ *params = context->getSamplerParameterf(sampler, pname);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glVertexAttribDivisor(GLuint index, GLuint divisor)
+{
+ EVENT("(GLuint index = %u, GLuint divisor = %u)", index, divisor);
try
{
@@ -6739,131 +9264,532 @@ void __stdcall glVertexAttribDivisorANGLE(GLuint index, GLuint divisor)
if (context)
{
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
context->setVertexAttribDivisor(index, divisor);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
}
-void __stdcall glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr)
+void __stdcall glBindTransformFeedback(GLenum target, GLuint id)
{
- EVENT("(GLuint index = %d, GLint size = %d, GLenum type = 0x%X, "
- "GLboolean normalized = %d, GLsizei stride = %d, const GLvoid* ptr = 0x%0.8p)",
- index, size, type, normalized, stride, ptr);
+ EVENT("(GLenum target = 0x%X, GLuint id = %u)", target, id);
try
{
- if (index >= gl::MAX_VERTEX_ATTRIBS)
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_INVALID_VALUE);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ switch (target)
+ {
+ case GL_TRANSFORM_FEEDBACK:
+ {
+ // Cannot bind a transform feedback object if the current one is started and not paused (3.0.2 pg 85 section 2.14.1)
+ gl::TransformFeedback *curTransformFeedback = context->getCurrentTransformFeedback();
+ if (curTransformFeedback && curTransformFeedback->isStarted() && !curTransformFeedback->isPaused())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ // Cannot bind a transform feedback object that does not exist (3.0.2 pg 85 section 2.14.1)
+ if (context->getTransformFeedback(id) == NULL)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ context->bindTransformFeedback(id);
+ }
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
- if (size < 1 || size > 4)
+void __stdcall glDeleteTransformFeedbacks(GLsizei n, const GLuint* ids)
+{
+ EVENT("(GLsizei n = %d, const GLuint* ids = 0x%0.8p)", n, ids);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_INVALID_VALUE);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ for (int i = 0; i < n; i++)
+ {
+ context->deleteTransformFeedback(ids[i]);
+ }
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
- switch (type)
+void __stdcall glGenTransformFeedbacks(GLsizei n, GLuint* ids)
+{
+ EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- case GL_FIXED:
- case GL_FLOAT:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ for (int i = 0; i < n; i++)
+ {
+ ids[i] = context->createTransformFeedback();
+ }
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
- if (stride < 0)
+GLboolean __stdcall glIsTransformFeedback(GLuint id)
+{
+ EVENT("(GLuint id = %u)", id);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_INVALID_VALUE);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION, GL_FALSE);
+ }
+
+ return ((context->getTransformFeedback(id) != NULL) ? GL_TRUE : GL_FALSE);
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
+ }
+
+ return GL_FALSE;
+}
+void __stdcall glPauseTransformFeedback(void)
+{
+ EVENT("(void)");
+
+ try
+ {
gl::Context *context = gl::getNonLostContext();
if (context)
{
- context->setVertexAttribState(index, context->getArrayBuffer(), size, type, (normalized == GL_TRUE), stride, ptr);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ gl::TransformFeedback *transformFeedback = context->getCurrentTransformFeedback();
+ ASSERT(transformFeedback != NULL);
+
+ // Current transform feedback must be started and not paused in order to pause (3.0.2 pg 86)
+ if (!transformFeedback->isStarted() || transformFeedback->isPaused())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ transformFeedback->pause();
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
}
-void __stdcall glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
+void __stdcall glResumeTransformFeedback(void)
{
- EVENT("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", x, y, width, height);
+ EVENT("(void)");
try
{
- if (width < 0 || height < 0)
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_INVALID_VALUE);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ gl::TransformFeedback *transformFeedback = context->getCurrentTransformFeedback();
+ ASSERT(transformFeedback != NULL);
+
+ // Current transform feedback must be started and paused in order to resume (3.0.2 pg 86)
+ if (!transformFeedback->isStarted() || !transformFeedback->isPaused())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ transformFeedback->resume();
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary)
+{
+ EVENT("(GLuint program = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLenum* binaryFormat = 0x%0.8p, GLvoid* binary = 0x%0.8p)",
+ program, bufSize, length, binaryFormat, binary);
+ try
+ {
gl::Context *context = gl::getNonLostContext();
if (context)
{
- context->setViewportParams(x, y, width, height);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ // glGetProgramBinary
+ UNIMPLEMENTED();
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
}
-void __stdcall glBlitFramebufferANGLE(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
- GLbitfield mask, GLenum filter)
+void __stdcall glProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length)
{
- EVENT("(GLint srcX0 = %d, GLint srcY0 = %d, GLint srcX1 = %d, GLint srcY1 = %d, "
- "GLint dstX0 = %d, GLint dstY0 = %d, GLint dstX1 = %d, GLint dstY1 = %d, "
- "GLbitfield mask = 0x%X, GLenum filter = 0x%X)",
- srcX0, srcY0, srcX1, srcX1, dstX0, dstY0, dstX1, dstY1, mask, filter);
+ EVENT("(GLuint program = %u, GLenum binaryFormat = 0x%X, const GLvoid* binary = 0x%0.8p, GLsizei length = %d)",
+ program, binaryFormat, binary, length);
try
{
- switch (filter)
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- case GL_NEAREST:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ // glProgramBinary
+ UNIMPLEMENTED();
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
- if ((mask & ~(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)) != 0)
+void __stdcall glProgramParameteri(GLuint program, GLenum pname, GLint value)
+{
+ EVENT("(GLuint program = %u, GLenum pname = 0x%X, GLint value = %d)",
+ program, pname, value);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_INVALID_VALUE);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ // glProgramParameteri
+ UNIMPLEMENTED();
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments)
+{
+ EVENT("(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum* attachments = 0x%0.8p)",
+ target, numAttachments, attachments);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
- if (srcX1 - srcX0 != dstX1 - dstX0 || srcY1 - srcY0 != dstY1 - dstY0)
+ if (context)
{
- ERR("Scaling and flipping in BlitFramebufferANGLE not supported by this implementation");
- return gl::error(GL_INVALID_OPERATION);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!ValidateInvalidateFramebufferParameters(context, target, numAttachments, attachments))
+ {
+ return;
+ }
+
+ int maxDimension = context->getMaximumRenderbufferDimension();
+ context->invalidateFrameBuffer(target, numAttachments, attachments, 0, 0, maxDimension, maxDimension);
}
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ EVENT("(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum* attachments = 0x%0.8p, GLint x = %d, "
+ "GLint y = %d, GLsizei width = %d, GLsizei height = %d)",
+ target, numAttachments, attachments, x, y, width, height);
+ try
+ {
gl::Context *context = gl::getNonLostContext();
if (context)
{
- if (context->getReadFramebufferHandle() == context->getDrawFramebufferHandle())
+ if (context->getClientVersion() < 3)
{
- ERR("Blits with the same source and destination framebuffer are not supported by this implementation.");
return gl::error(GL_INVALID_OPERATION);
}
- context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask);
+ if (!ValidateInvalidateFramebufferParameters(context, target, numAttachments, attachments))
+ {
+ return;
+ }
+
+ context->invalidateFrameBuffer(target, numAttachments, attachments, x, y, width, height);
}
}
- catch(std::bad_alloc&)
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
+{
+ EVENT("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)",
+ target, levels, internalformat, width, height);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, 1))
+ {
+ return;
+ }
+
+ switch (target)
+ {
+ case GL_TEXTURE_2D:
+ {
+ gl::Texture2D *texture2d = context->getTexture2D();
+ texture2d->storage(levels, internalformat, width, height);
+ }
+ break;
+
+ case GL_TEXTURE_CUBE_MAP:
+ {
+ gl::TextureCubeMap *textureCube = context->getTextureCubeMap();
+ textureCube->storage(levels, internalformat, width);
+ }
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
+{
+ EVENT("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, "
+ "GLsizei height = %d, GLsizei depth = %d)",
+ target, levels, internalformat, width, height, depth);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, depth))
+ {
+ return;
+ }
+
+ switch (target)
+ {
+ case GL_TEXTURE_3D:
+ {
+ gl::Texture3D *texture3d = context->getTexture3D();
+ texture3d->storage(levels, internalformat, width, height, depth);
+ }
+ break;
+
+ case GL_TEXTURE_2D_ARRAY:
+ {
+ gl::Texture2DArray *texture2darray = context->getTexture2DArray();
+ texture2darray->storage(levels, internalformat, width, height, depth);
+ }
+ break;
+
+ default:
+ UNREACHABLE();
+ }
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum internalformat = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, "
+ "GLint* params = 0x%0.8p)",
+ target, internalformat, pname, bufSize, params);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!gl::IsColorRenderingSupported(internalformat, context) &&
+ !gl::IsDepthRenderingSupported(internalformat, context) &&
+ !gl::IsStencilRenderingSupported(internalformat, context))
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ if (target != GL_RENDERBUFFER)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ if (bufSize < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ switch (pname)
+ {
+ case GL_NUM_SAMPLE_COUNTS:
+ if (bufSize != 0)
+ *params = context->getNumSampleCounts(internalformat);
+ break;
+ case GL_SAMPLES:
+ context->getSampleCounts(internalformat, bufSize, params);
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+// Extension functions
+
+void __stdcall glBlitFramebufferANGLE(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
+ GLbitfield mask, GLenum filter)
+{
+ EVENT("(GLint srcX0 = %d, GLint srcY0 = %d, GLint srcX1 = %d, GLint srcY1 = %d, "
+ "GLint dstX0 = %d, GLint dstY0 = %d, GLint dstX1 = %d, GLint dstY1 = %d, "
+ "GLbitfield mask = 0x%X, GLenum filter = 0x%X)",
+ srcX0, srcY0, srcX1, srcX1, dstX0, dstY0, dstX1, dstY1, mask, filter);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (!ValidateBlitFramebufferParameters(context, srcX0, srcY0, srcX1, srcY1,
+ dstX0, dstY0, dstX1, dstY1, mask, filter,
+ true))
+ {
+ return;
+ }
+
+ context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1,
+ mask, filter);
+ }
+ }
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -6881,7 +9807,7 @@ void __stdcall glTexImage3DOES(GLenum target, GLint level, GLenum internalformat
{
UNIMPLEMENTED(); // FIXME
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -6921,7 +9847,7 @@ void __stdcall glGetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *l
*binaryFormat = GL_PROGRAM_BINARY_ANGLE;
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -6954,7 +9880,7 @@ void __stdcall glProgramBinaryOES(GLuint program, GLenum binaryFormat,
context->setProgramBinary(program, binary, length);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -7012,7 +9938,266 @@ void __stdcall glDrawBuffersEXT(GLsizei n, const GLenum *bufs)
}
}
}
- catch (std::bad_alloc&)
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetBufferPointervOES(GLenum target, GLenum pname, void** params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLvoid** params = 0x%0.8p)", target, pname, params);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (!context->supportsPBOs())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!gl::ValidBufferTarget(context, target))
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ if (pname != GL_BUFFER_MAP_POINTER)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ gl::Buffer *buffer = context->getTargetBuffer(target);
+
+ if (!buffer || !buffer->mapped())
+ {
+ *params = NULL;
+ }
+
+ *params = buffer->mapPointer();
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void * __stdcall glMapBufferOES(GLenum target, GLenum access)
+{
+ EVENT("(GLenum target = 0x%X, GLbitfield access = 0x%X)", target, access);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (!gl::ValidBufferTarget(context, target))
+ {
+ return gl::error(GL_INVALID_ENUM, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ gl::Buffer *buffer = context->getTargetBuffer(target);
+
+ if (buffer == NULL)
+ {
+ return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ if (access != GL_WRITE_ONLY_OES)
+ {
+ return gl::error(GL_INVALID_ENUM, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ if (buffer->mapped())
+ {
+ return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ return buffer->mapRange(0, buffer->size(), GL_MAP_WRITE_BIT);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ return NULL;
+}
+
+GLboolean __stdcall glUnmapBufferOES(GLenum target)
+{
+ EVENT("(GLenum target = 0x%X)", target);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (!gl::ValidBufferTarget(context, target))
+ {
+ return gl::error(GL_INVALID_ENUM, GL_FALSE);
+ }
+
+ gl::Buffer *buffer = context->getTargetBuffer(target);
+
+ if (buffer == NULL || !buffer->mapped())
+ {
+ return gl::error(GL_INVALID_OPERATION, GL_FALSE);
+ }
+
+ // TODO: detect if we had corruption. if so, throw an error and return false.
+
+ buffer->unmap();
+
+ return GL_TRUE;
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
+ }
+
+ return GL_FALSE;
+}
+
+void* __stdcall glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
+{
+ EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d, GLbitfield access = 0x%X)",
+ target, offset, length, access);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (!gl::ValidBufferTarget(context, target))
+ {
+ return gl::error(GL_INVALID_ENUM, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ if (offset < 0 || length < 0)
+ {
+ return gl::error(GL_INVALID_VALUE, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ gl::Buffer *buffer = context->getTargetBuffer(target);
+
+ if (buffer == NULL)
+ {
+ return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ // Check for buffer overflow
+ size_t offsetSize = static_cast<size_t>(offset);
+ size_t lengthSize = static_cast<size_t>(length);
+
+ if (!rx::IsUnsignedAdditionSafe(offsetSize, lengthSize) ||
+ offsetSize + lengthSize > static_cast<size_t>(buffer->size()))
+ {
+ return gl::error(GL_INVALID_VALUE, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ // Check for invalid bits in the mask
+ GLbitfield allAccessBits = GL_MAP_READ_BIT |
+ GL_MAP_WRITE_BIT |
+ GL_MAP_INVALIDATE_RANGE_BIT |
+ GL_MAP_INVALIDATE_BUFFER_BIT |
+ GL_MAP_FLUSH_EXPLICIT_BIT |
+ GL_MAP_UNSYNCHRONIZED_BIT;
+
+ if (access & ~(allAccessBits))
+ {
+ return gl::error(GL_INVALID_VALUE, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ if (length == 0 || buffer->mapped())
+ {
+ return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ // Check for invalid bit combinations
+ if ((access & (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)) == 0)
+ {
+ return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ GLbitfield writeOnlyBits = GL_MAP_INVALIDATE_RANGE_BIT |
+ GL_MAP_INVALIDATE_BUFFER_BIT |
+ GL_MAP_UNSYNCHRONIZED_BIT;
+
+ if ((access & GL_MAP_READ_BIT) != 0 && (access & writeOnlyBits) != 0)
+ {
+ return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ if ((access & GL_MAP_WRITE_BIT) == 0 && (access & GL_MAP_FLUSH_EXPLICIT_BIT) != 0)
+ {
+ return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ return buffer->mapRange(offset, length, access);
+ }
+ }
+ catch (...)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ return NULL;
+}
+
+void __stdcall glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length)
+{
+ EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d)", target, offset, length);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (offset < 0 || length < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ if (!gl::ValidBufferTarget(context, target))
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ gl::Buffer *buffer = context->getTargetBuffer(target);
+
+ if (buffer == NULL)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!buffer->mapped() || (buffer->accessFlags() & GL_MAP_FLUSH_EXPLICIT_BIT) == 0)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ // Check for buffer overflow
+ size_t offsetSize = static_cast<size_t>(offset);
+ size_t lengthSize = static_cast<size_t>(length);
+
+ if (!rx::IsUnsignedAdditionSafe(offsetSize, lengthSize) ||
+ offsetSize + lengthSize > static_cast<size_t>(buffer->mapLength()))
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ // We do not currently support a non-trivial implementation of FlushMappedBufferRange
+ }
+ }
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -7056,7 +10241,12 @@ __eglMustCastToProperFunctionPointerType __stdcall glGetProcAddress(const char *
{"glDrawArraysInstancedANGLE", (__eglMustCastToProperFunctionPointerType)glDrawArraysInstancedANGLE},
{"glDrawElementsInstancedANGLE", (__eglMustCastToProperFunctionPointerType)glDrawElementsInstancedANGLE},
{"glGetProgramBinaryOES", (__eglMustCastToProperFunctionPointerType)glGetProgramBinaryOES},
- {"glProgramBinaryOES", (__eglMustCastToProperFunctionPointerType)glProgramBinaryOES}, };
+ {"glProgramBinaryOES", (__eglMustCastToProperFunctionPointerType)glProgramBinaryOES},
+ {"glGetBufferPointervOES", (__eglMustCastToProperFunctionPointerType)glGetBufferPointervOES},
+ {"glMapBufferOES", (__eglMustCastToProperFunctionPointerType)glMapBufferOES},
+ {"glUnmapBufferOES", (__eglMustCastToProperFunctionPointerType)glUnmapBufferOES},
+ {"glMapBufferRangeEXT", (__eglMustCastToProperFunctionPointerType)glMapBufferRangeEXT},
+ {"glFlushMappedBufferRangeEXT", (__eglMustCastToProperFunctionPointerType)glFlushMappedBufferRangeEXT}, };
for (unsigned int ext = 0; ext < ArraySize(glExtensions); ext++)
{
@@ -7083,19 +10273,17 @@ bool __stdcall glBindTexImage(egl::Surface *surface)
if (context)
{
gl::Texture2D *textureObject = context->getTexture2D();
+ ASSERT(textureObject != NULL);
if (textureObject->isImmutable())
{
return false;
}
- if (textureObject)
- {
- textureObject->bindTexImage(surface);
- }
+ textureObject->bindTexImage(surface);
}
}
- catch(std::bad_alloc&)
+ catch (...)
{
return gl::error(GL_OUT_OF_MEMORY, false);
}
diff --git a/chromium/third_party/angle/src/libGLESv2/libGLESv2.def b/chromium/third_party/angle/src/libGLESv2/libGLESv2.def
index b8320c8f256..88dceb3556b 100644
--- a/chromium/third_party/angle/src/libGLESv2/libGLESv2.def
+++ b/chromium/third_party/angle/src/libGLESv2/libGLESv2.def
@@ -173,6 +173,117 @@ EXPORTS
glProgramBinaryOES @175
glGetProgramBinaryOES @176
glDrawBuffersEXT @179
+ glMapBufferOES @285
+ glUnmapBufferOES @286
+ glGetBufferPointervOES @287
+ glMapBufferRangeEXT @288
+ glFlushMappedBufferRangeEXT @289
+
+ ; GLES 3.0 Functions
+ glReadBuffer @180
+ glDrawRangeElements @181
+ glTexImage3D @182
+ glTexSubImage3D @183
+ glCopyTexSubImage3D @184
+ glCompressedTexImage3D @185
+ glCompressedTexSubImage3D @186
+ glGenQueries @187
+ glDeleteQueries @188
+ glIsQuery @189
+ glBeginQuery @190
+ glEndQuery @191
+ glGetQueryiv @192
+ glGetQueryObjectuiv @193
+ glUnmapBuffer @194
+ glGetBufferPointerv @195
+ glDrawBuffers @196
+ glUniformMatrix2x3fv @197
+ glUniformMatrix3x2fv @198
+ glUniformMatrix2x4fv @199
+ glUniformMatrix4x2fv @200
+ glUniformMatrix3x4fv @201
+ glUniformMatrix4x3fv @202
+ glBlitFramebuffer @203
+ glRenderbufferStorageMultisample @204
+ glFramebufferTextureLayer @205
+ glMapBufferRange @206
+ glFlushMappedBufferRange @207
+ glBindVertexArray @208
+ glDeleteVertexArrays @209
+ glGenVertexArrays @210
+ glIsVertexArray @211
+ glGetIntegeri_v @212
+ glBeginTransformFeedback @213
+ glEndTransformFeedback @214
+ glBindBufferRange @215
+ glBindBufferBase @216
+ glTransformFeedbackVaryings @217
+ glGetTransformFeedbackVarying @218
+ glVertexAttribIPointer @219
+ glGetVertexAttribIiv @220
+ glGetVertexAttribIuiv @221
+ glVertexAttribI4i @222
+ glVertexAttribI4ui @223
+ glVertexAttribI4iv @224
+ glVertexAttribI4uiv @225
+ glGetUniformuiv @226
+ glGetFragDataLocation @227
+ glUniform1ui @228
+ glUniform2ui @229
+ glUniform3ui @230
+ glUniform4ui @231
+ glUniform1uiv @232
+ glUniform2uiv @233
+ glUniform3uiv @234
+ glUniform4uiv @235
+ glClearBufferiv @236
+ glClearBufferuiv @237
+ glClearBufferfv @238
+ glClearBufferfi @239
+ glGetStringi @240
+ glCopyBufferSubData @241
+ glGetUniformIndices @242
+ glGetActiveUniformsiv @243
+ glGetUniformBlockIndex @244
+ glGetActiveUniformBlockiv @245
+ glGetActiveUniformBlockName @246
+ glUniformBlockBinding @247
+ glDrawArraysInstanced @248
+ glDrawElementsInstanced @249
+ glFenceSync @250
+ glIsSync @251
+ glDeleteSync @252
+ glClientWaitSync @253
+ glWaitSync @254
+ glGetInteger64v @255
+ glGetSynciv @256
+ glGetInteger64i_v @257
+ glGetBufferParameteri64v @258
+ glGenSamplers @259
+ glDeleteSamplers @260
+ glIsSampler @261
+ glBindSampler @262
+ glSamplerParameteri @263
+ glSamplerParameteriv @264
+ glSamplerParameterf @265
+ glSamplerParameterfv @266
+ glGetSamplerParameteriv @267
+ glGetSamplerParameterfv @268
+ glVertexAttribDivisor @269
+ glBindTransformFeedback @270
+ glDeleteTransformFeedbacks @271
+ glGenTransformFeedbacks @272
+ glIsTransformFeedback @273
+ glPauseTransformFeedback @274
+ glResumeTransformFeedback @275
+ glGetProgramBinary @276
+ glProgramBinary @277
+ glProgramParameteri @278
+ glInvalidateFramebuffer @279
+ glInvalidateSubFramebuffer @280
+ glTexStorage2D @281
+ glTexStorage3D @282
+ glGetInternalformativ @283
; EGL dependencies
glCreateContext @144 NONAME
@@ -185,4 +296,4 @@ EXPORTS
glDestroyRenderer @178 NONAME
; Setting up TRACE macro callbacks
- SetTraceFunctionPointers @180
+ SetTraceFunctionPointers @284
diff --git a/chromium/third_party/angle/src/libGLESv2/libGLESv2.rc b/chromium/third_party/angle/src/libGLESv2/libGLESv2.rc
index 0ad21e440e7..76cd05566ee 100644
--- a/chromium/third_party/angle/src/libGLESv2/libGLESv2.rc
+++ b/chromium/third_party/angle/src/libGLESv2/libGLESv2.rc
@@ -54,8 +54,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION,BUILD_REVISION
- PRODUCTVERSION MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION,BUILD_REVISION
+ FILEVERSION ANGLE_MAJOR_VERSION,ANGLE_MINOR_VERSION,0,0
+ PRODUCTVERSION ANGLE_MAJOR_VERSION,ANGLE_MINOR_VERSION,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -71,13 +71,14 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "ANGLE libGLESv2 Dynamic Link Library"
- VALUE "FileVersion", VERSION_STRING
+ VALUE "FileVersion", ANGLE_VERSION_STRING
VALUE "InternalName", "libGLESv2"
VALUE "LegalCopyright", "Copyright (C) 2011 Google Inc."
VALUE "OriginalFilename", "libGLESv2.dll"
- VALUE "PrivateBuild", VERSION_STRING
+ VALUE "PrivateBuild", ANGLE_VERSION_STRING
VALUE "ProductName", "ANGLE libGLESv2 Dynamic Link Library"
- VALUE "ProductVersion", VERSION_STRING
+ VALUE "ProductVersion", ANGLE_VERSION_STRING
+ VALUE "Comments", "Build Date: " ANGLE_COMMIT_DATE
END
END
BLOCK "VarFileInfo"
diff --git a/chromium/third_party/angle/src/libGLESv2/libGLESv2.vcxproj b/chromium/third_party/angle/src/libGLESv2/libGLESv2.vcxproj
deleted file mode 100644
index ecb04cffb8b..00000000000
--- a/chromium/third_party/angle/src/libGLESv2/libGLESv2.vcxproj
+++ /dev/null
@@ -1,425 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{B5871A7A-968C-42E3-A33B-981E6F448E78}</ProjectGuid>
- <RootNamespace>libGLESv2</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
- <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IncludePath)</IncludePath>
- <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LibraryPath)</LibraryPath>
- <IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IncludePath)</IncludePath>
- <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LibraryPath)</LibraryPath>
- <IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IncludePath)</IncludePath>
- <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IncludePath)</IncludePath>
- <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LibraryPath)</LibraryPath>
- <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LibraryPath)</LibraryPath>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)/..; $(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGLESV2_EXPORTS;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeader>Use</PrecompiledHeader>
- <WarningLevel>Level4</WarningLevel>
- <TreatWarningAsError>true</TreatWarningAsError>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- <DisableSpecificWarnings>4100;4127;4189;4239;4244;4245;4512;4702;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- <PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
- <AdditionalOptions>$(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
- </ClCompile>
- <Link>
- <AdditionalDependencies>d3d9.lib;dxguid.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <ModuleDefinitionFile>libGLESv2.def</ModuleDefinitionFile>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Windows</SubSystem>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- <PostBuildEvent>
- <Command>%40echo on
-mkdir "$(ProjectDir)..\..\lib\$(Configuration)\"
-copy "$(OutDir)libGLESv2.dll" "$(ProjectDir)..\..\lib\$(Configuration)\"
-copy "$(OutDir)libGLESv2.lib" "$(ProjectDir)..\..\lib\$(Configuration)\"
-%40echo off
-</Command>
- </PostBuildEvent>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <Optimization>MaxSpeed</Optimization>
- <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
- <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)/..; $(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>ANGLE_DISABLE_TRACE;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGLESV2_EXPORTS;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;_SECURE_SCL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <PrecompiledHeader>Use</PrecompiledHeader>
- <WarningLevel>Level4</WarningLevel>
- <TreatWarningAsError>true</TreatWarningAsError>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <DisableSpecificWarnings>4100;4127;4189;4239;4244;4245;4512;4702;4718;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- <PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
- <AdditionalOptions>$(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
- </ClCompile>
- <Link>
- <AdditionalDependencies>d3d9.lib;dxguid.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <ModuleDefinitionFile>libGLESv2.def</ModuleDefinitionFile>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Windows</SubSystem>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- <PostBuildEvent>
- <Command>%40echo on
-mkdir "$(ProjectDir)..\..\lib\$(Configuration)\"
-copy "$(OutDir)libGLESv2.dll" "$(ProjectDir)..\..\lib\$(Configuration)\"
-copy "$(OutDir)libGLESv2.lib" "$(ProjectDir)..\..\lib\$(Configuration)\"
-%40echo off
-</Command>
- </PostBuildEvent>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>$(ProjectDir)/..; $(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGLESV2_EXPORTS;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <PrecompiledHeader>Use</PrecompiledHeader>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>4100;4127;4189;4239;4244;4245;4512;4702;4718;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <TreatWarningAsError>true</TreatWarningAsError>
- <PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
- <AdditionalOptions>$(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
- </ClCompile>
- <Link>
- <AdditionalDependencies>d3d9.lib;dxguid.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <ModuleDefinitionFile>libGLESv2.def</ModuleDefinitionFile>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Windows</SubSystem>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX64</TargetMachine>
- </Link>
- <PostBuildEvent>
- <Command>%40echo on
-mkdir "$(ProjectDir)..\..\lib\$(Configuration)\"
-copy "$(OutDir)libGLESv2.dll" "$(ProjectDir)..\..\lib\$(Configuration)\"
-copy "$(OutDir)libGLESv2.lib" "$(ProjectDir)..\..\lib\$(Configuration)\"
-%40echo off
-</Command>
- </PostBuildEvent>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <Optimization>MaxSpeed</Optimization>
- <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
- <AdditionalIncludeDirectories>$(ProjectDir)/..; $(ProjectDir)/../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGLESV2_EXPORTS;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;_SECURE_SCL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <PrecompiledHeader>Use</PrecompiledHeader>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>4100;4127;4189;4239;4244;4245;4512;4702;4718;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <TreatWarningAsError>true</TreatWarningAsError>
- <PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
- <AdditionalOptions>$(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
- </ClCompile>
- <Link>
- <AdditionalDependencies>d3d9.lib;dxguid.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <ModuleDefinitionFile>libGLESv2.def</ModuleDefinitionFile>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Windows</SubSystem>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX64</TargetMachine>
- </Link>
- <PostBuildEvent>
- <Command>%40echo on
-mkdir "$(ProjectDir)..\..\lib\$(Configuration)\"
-copy "$(OutDir)libGLESv2.dll" "$(ProjectDir)..\..\lib\$(Configuration)\"
-copy "$(OutDir)libGLESv2.lib" "$(ProjectDir)..\..\lib\$(Configuration)\"
-%40echo off
-</Command>
- </PostBuildEvent>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="..\third_party\murmurhash\MurmurHash3.cpp">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
- </ClCompile>
- <ClCompile Include="Buffer.cpp" />
- <ClCompile Include="Context.cpp" />
- <ClCompile Include="..\common\debug.cpp">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
- </ClCompile>
- <ClCompile Include="..\common\event_tracer.cpp">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
- </ClCompile>
- <ClCompile Include="Fence.cpp" />
- <ClCompile Include="Float16ToFloat32.cpp" />
- <ClCompile Include="Framebuffer.cpp" />
- <ClCompile Include="HandleAllocator.cpp" />
- <ClCompile Include="libGLESv2.cpp" />
- <ClCompile Include="main.cpp" />
- <ClCompile Include="precompiled.cpp">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
- </ClCompile>
- <ClCompile Include="Program.cpp" />
- <ClCompile Include="ProgramBinary.cpp" />
- <ClCompile Include="Query.cpp" />
- <ClCompile Include="..\common\RefCountObject.cpp" />
- <ClCompile Include="Renderbuffer.cpp" />
- <ClCompile Include="renderer\Blit.cpp" />
- <ClCompile Include="renderer\Fence11.cpp" />
- <ClCompile Include="renderer\Fence9.cpp" />
- <ClCompile Include="renderer\BufferStorage.cpp" />
- <ClCompile Include="renderer\BufferStorage11.cpp" />
- <ClCompile Include="renderer\BufferStorage9.cpp" />
- <ClCompile Include="renderer\Image.cpp" />
- <ClCompile Include="renderer\Image9.cpp" />
- <ClCompile Include="renderer\IndexBuffer.cpp" />
- <ClCompile Include="renderer\IndexBuffer11.cpp" />
- <ClCompile Include="renderer\IndexBuffer9.cpp" />
- <ClCompile Include="renderer\IndexDataManager.cpp" />
- <ClCompile Include="renderer\ImageSSE2.cpp" />
- <ClCompile Include="renderer\Image11.cpp" />
- <ClCompile Include="renderer\IndexRangeCache.cpp" />
- <ClCompile Include="renderer\InputLayoutCache.cpp" />
- <ClCompile Include="renderer\Query11.cpp" />
- <ClCompile Include="renderer\Query9.cpp" />
- <ClCompile Include="renderer\Renderer.cpp" />
- <ClCompile Include="renderer\Renderer11.cpp" />
- <ClCompile Include="renderer\renderer11_utils.cpp" />
- <ClCompile Include="renderer\Renderer9.cpp" />
- <ClCompile Include="renderer\renderer9_utils.cpp" />
- <ClCompile Include="renderer\RenderTarget11.cpp" />
- <ClCompile Include="renderer\RenderTarget9.cpp" />
- <ClCompile Include="renderer\RenderStateCache.cpp" />
- <ClCompile Include="renderer\ShaderExecutable11.cpp" />
- <ClCompile Include="renderer\ShaderExecutable9.cpp" />
- <ClCompile Include="renderer\SwapChain11.cpp" />
- <ClCompile Include="renderer\SwapChain9.cpp" />
- <ClCompile Include="renderer\TextureStorage.cpp" />
- <ClCompile Include="renderer\TextureStorage11.cpp" />
- <ClCompile Include="renderer\TextureStorage9.cpp" />
- <ClCompile Include="renderer\VertexBuffer.cpp" />
- <ClCompile Include="renderer\VertexBuffer11.cpp" />
- <ClCompile Include="renderer\VertexBuffer9.cpp" />
- <ClCompile Include="renderer\VertexDataManager.cpp" />
- <ClCompile Include="renderer\VertexDeclarationCache.cpp" />
- <ClCompile Include="ResourceManager.cpp" />
- <ClCompile Include="Shader.cpp" />
- <ClCompile Include="Texture.cpp" />
- <ClCompile Include="Uniform.cpp" />
- <ClCompile Include="utilities.cpp" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\common\debug.h" />
- <ClInclude Include="..\common\event_tracer.h" />
- <ClInclude Include="..\common\system.h" />
- <ClInclude Include="..\third_party\murmurhash\MurmurHash3.h" />
- <ClInclude Include="..\third_party\trace_event\trace_event.h" />
- <ClInclude Include="angletypes.h" />
- <ClInclude Include="BinaryStream.h" />
- <ClInclude Include="Buffer.h" />
- <ClInclude Include="constants.h" />
- <ClInclude Include="Context.h" />
- <ClInclude Include="Fence.h" />
- <ClInclude Include="Framebuffer.h" />
- <ClInclude Include="..\..\include\GLES2\gl2.h" />
- <ClInclude Include="..\..\include\GLES2\gl2ext.h" />
- <ClInclude Include="..\..\include\GLES2\gl2platform.h" />
- <ClInclude Include="HandleAllocator.h" />
- <ClInclude Include="main.h" />
- <ClInclude Include="mathutil.h" />
- <ClInclude Include="precompiled.h" />
- <ClInclude Include="Program.h" />
- <ClInclude Include="ProgramBinary.h" />
- <ClInclude Include="Query.h" />
- <ClInclude Include="..\common\RefCountObject.h" />
- <ClInclude Include="Renderbuffer.h" />
- <ClInclude Include="renderer\Blit.h" />
- <ClInclude Include="renderer\Fence11.h" />
- <ClInclude Include="renderer\Fence9.h" />
- <ClInclude Include="renderer\FenceImpl.h" />
- <ClInclude Include="renderer\BufferStorage.h" />
- <ClInclude Include="renderer\BufferStorage11.h" />
- <ClInclude Include="renderer\BufferStorage9.h" />
- <ClInclude Include="renderer\generatemip.h" />
- <ClInclude Include="renderer\Image.h" />
- <ClInclude Include="renderer\Image11.h" />
- <ClInclude Include="renderer\Image9.h" />
- <ClInclude Include="renderer\IndexBuffer.h" />
- <ClInclude Include="renderer\IndexBuffer11.h" />
- <ClInclude Include="renderer\IndexBuffer9.h" />
- <ClInclude Include="renderer\IndexDataManager.h" />
- <ClInclude Include="renderer\IndexRangeCache.h" />
- <ClInclude Include="renderer\InputLayoutCache.h" />
- <ClInclude Include="renderer\Query11.h" />
- <ClInclude Include="renderer\QueryImpl.h" />
- <ClInclude Include="renderer\Query9.h" />
- <ClInclude Include="renderer\Renderer.h" />
- <ClInclude Include="renderer\Renderer11.h" />
- <ClInclude Include="renderer\renderer11_utils.h" />
- <ClInclude Include="renderer\Renderer9.h" />
- <ClInclude Include="renderer\renderer9_utils.h" />
- <ClInclude Include="renderer\RenderTarget.h" />
- <ClInclude Include="renderer\RenderTarget11.h" />
- <ClInclude Include="renderer\RenderTarget9.h" />
- <ClInclude Include="renderer\RenderStateCache.h" />
- <ClInclude Include="renderer\ShaderCache.h" />
- <ClInclude Include="renderer\ShaderExecutable.h" />
- <ClInclude Include="renderer\ShaderExecutable11.h" />
- <ClInclude Include="renderer\ShaderExecutable9.h" />
- <ClInclude Include="renderer\shaders\compiled\clear11vs.h" />
- <ClInclude Include="renderer\shaders\compiled\clearmultiple11ps.h" />
- <ClInclude Include="renderer\shaders\compiled\clearsingle11ps.h" />
- <ClInclude Include="renderer\shaders\compiled\componentmaskps.h" />
- <ClInclude Include="renderer\shaders\compiled\flipyvs.h" />
- <ClInclude Include="renderer\shaders\compiled\luminanceps.h" />
- <ClInclude Include="renderer\shaders\compiled\passthrough11vs.h" />
- <ClInclude Include="renderer\shaders\compiled\passthroughlum11ps.h" />
- <ClInclude Include="renderer\shaders\compiled\passthroughlumalpha11ps.h" />
- <ClInclude Include="renderer\shaders\compiled\passthroughps.h" />
- <ClInclude Include="renderer\shaders\compiled\passthroughrgb11ps.h" />
- <ClInclude Include="renderer\shaders\compiled\passthroughrgba11ps.h" />
- <ClInclude Include="renderer\shaders\compiled\standardvs.h" />
- <ClInclude Include="renderer\SwapChain.h" />
- <ClInclude Include="renderer\SwapChain11.h" />
- <ClInclude Include="renderer\SwapChain9.h" />
- <ClInclude Include="renderer\TextureStorage.h" />
- <ClInclude Include="renderer\TextureStorage11.h" />
- <ClInclude Include="renderer\TextureStorage9.h" />
- <ClInclude Include="renderer\VertexBuffer.h" />
- <ClInclude Include="renderer\VertexBuffer11.h" />
- <ClInclude Include="renderer\VertexBuffer9.h" />
- <ClInclude Include="renderer\vertexconversion.h" />
- <ClInclude Include="renderer\VertexDataManager.h" />
- <ClInclude Include="renderer\VertexDeclarationCache.h" />
- <ClInclude Include="resource.h" />
- <ClInclude Include="ResourceManager.h" />
- <ClInclude Include="Shader.h" />
- <ClInclude Include="Texture.h" />
- <ClInclude Include="Uniform.h" />
- <ClInclude Include="utilities.h" />
- <ClInclude Include="..\common\version.h" />
- </ItemGroup>
- <ItemGroup>
- <None Include="libGLESv2.def" />
- <None Include="renderer\shaders\Blit.ps" />
- <None Include="renderer\shaders\Blit.vs" />
- <None Include="renderer\shaders\Clear11.hlsl" />
- <None Include="renderer\shaders\generate_shaders.bat" />
- <None Include="renderer\shaders\Passthrough11.hlsl" />
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="libGLESv2.rc" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\compiler\preprocessor\preprocessor.vcxproj">
- <Project>{fbe32df3-0fb0-4f2f-a424-2c21bd7bc325}</Project>
- </ProjectReference>
- <ProjectReference Include="..\compiler\translator.vcxproj">
- <Project>{5b3a6db8-1e7e-40d7-92b9-da8aae619fad}</Project>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/chromium/third_party/angle/src/libGLESv2/libGLESv2.vcxproj.filters b/chromium/third_party/angle/src/libGLESv2/libGLESv2.vcxproj.filters
deleted file mode 100644
index 131fd6f2aef..00000000000
--- a/chromium/third_party/angle/src/libGLESv2/libGLESv2.vcxproj.filters
+++ /dev/null
@@ -1,527 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="Header Files">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="Third Party">
- <UniqueIdentifier>{dc1dac40-3563-41be-9e2d-c2588d8670fb}</UniqueIdentifier>
- </Filter>
- <Filter Include="Third Party\MurmurHash">
- <UniqueIdentifier>{b0005d2f-9b4a-4659-a270-138811174f73}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files\Renderer">
- <UniqueIdentifier>{562e469d-1abb-44bc-b7fa-55eefbf75acc}</UniqueIdentifier>
- </Filter>
- <Filter Include="Shaders">
- <UniqueIdentifier>{6dc0306f-6396-4e80-9ef9-09b58aa53c4d}</UniqueIdentifier>
- </Filter>
- <Filter Include="Shaders\Compiled">
- <UniqueIdentifier>{6332705b-1999-4292-a38b-dd47329734aa}</UniqueIdentifier>
- </Filter>
- <Filter Include="Source Files\Renderer">
- <UniqueIdentifier>{93a76964-77a3-4b20-a6f5-e14e762d4e14}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files\Renderer9">
- <UniqueIdentifier>{3877f35e-845c-4e95-b9a5-c7d8b9f307c5}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files\Renderer11">
- <UniqueIdentifier>{2d70fd60-6dea-489f-ac09-16890d325669}</UniqueIdentifier>
- </Filter>
- <Filter Include="Source Files\Renderer9">
- <UniqueIdentifier>{60e14f04-2cf2-4a07-b3ef-7c68a82ba2d9}</UniqueIdentifier>
- </Filter>
- <Filter Include="Source Files\Renderer11">
- <UniqueIdentifier>{72db61d3-e081-4b58-bc63-a04a8a70585f}</UniqueIdentifier>
- </Filter>
- <Filter Include="Third Party\trace_event">
- <UniqueIdentifier>{ebfc1614-8f0b-48c7-b6bd-295bf91ef85c}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="Buffer.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Context.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\common\debug.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Fence.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Float16ToFloat32.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Framebuffer.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="HandleAllocator.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="libGLESv2.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="main.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Program.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="ProgramBinary.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Query.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\common\RefCountObject.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Renderbuffer.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="ResourceManager.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Shader.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Texture.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="utilities.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="renderer\Image.cpp">
- <Filter>Source Files\Renderer</Filter>
- </ClCompile>
- <ClCompile Include="renderer\TextureStorage.cpp">
- <Filter>Source Files\Renderer</Filter>
- </ClCompile>
- <ClCompile Include="renderer\Renderer.cpp">
- <Filter>Source Files\Renderer</Filter>
- </ClCompile>
- <ClCompile Include="..\third_party\murmurhash\MurmurHash3.cpp">
- <Filter>Third Party\MurmurHash</Filter>
- </ClCompile>
- <ClCompile Include="renderer\IndexDataManager.cpp">
- <Filter>Source Files\Renderer</Filter>
- </ClCompile>
- <ClCompile Include="renderer\VertexDataManager.cpp">
- <Filter>Source Files\Renderer</Filter>
- </ClCompile>
- <ClCompile Include="renderer\Image.cpp">
- <Filter>Renderer</Filter>
- </ClCompile>
- <ClCompile Include="renderer\ImageSSE2.cpp">
- <Filter>Source Files\Renderer</Filter>
- </ClCompile>
- <ClCompile Include="renderer\VertexBuffer.cpp">
- <Filter>Source Files\Renderer</Filter>
- </ClCompile>
- <ClCompile Include="renderer\IndexBuffer.cpp">
- <Filter>Source Files\Renderer</Filter>
- </ClCompile>
- <ClCompile Include="Uniform.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="renderer\BufferStorage.cpp">
- <Filter>Source Files\Renderer</Filter>
- </ClCompile>
- <ClCompile Include="renderer\BufferStorage11.cpp">
- <Filter>Source Files\Renderer11</Filter>
- </ClCompile>
- <ClCompile Include="renderer\Fence11.cpp">
- <Filter>Source Files\Renderer11</Filter>
- </ClCompile>
- <ClCompile Include="renderer\Image11.cpp">
- <Filter>Source Files\Renderer11</Filter>
- </ClCompile>
- <ClCompile Include="renderer\IndexBuffer11.cpp">
- <Filter>Source Files\Renderer11</Filter>
- </ClCompile>
- <ClCompile Include="renderer\Query11.cpp">
- <Filter>Source Files\Renderer11</Filter>
- </ClCompile>
- <ClCompile Include="renderer\Renderer11.cpp">
- <Filter>Source Files\Renderer11</Filter>
- </ClCompile>
- <ClCompile Include="renderer\renderer11_utils.cpp">
- <Filter>Source Files\Renderer11</Filter>
- </ClCompile>
- <ClCompile Include="renderer\RenderTarget11.cpp">
- <Filter>Source Files\Renderer11</Filter>
- </ClCompile>
- <ClCompile Include="renderer\ShaderExecutable11.cpp">
- <Filter>Source Files\Renderer11</Filter>
- </ClCompile>
- <ClCompile Include="renderer\SwapChain11.cpp">
- <Filter>Source Files\Renderer11</Filter>
- </ClCompile>
- <ClCompile Include="renderer\TextureStorage11.cpp">
- <Filter>Source Files\Renderer11</Filter>
- </ClCompile>
- <ClCompile Include="renderer\VertexBuffer11.cpp">
- <Filter>Source Files\Renderer11</Filter>
- </ClCompile>
- <ClCompile Include="renderer\BufferStorage9.cpp">
- <Filter>Source Files\Renderer9</Filter>
- </ClCompile>
- <ClCompile Include="renderer\Fence9.cpp">
- <Filter>Source Files\Renderer9</Filter>
- </ClCompile>
- <ClCompile Include="renderer\Image9.cpp">
- <Filter>Source Files\Renderer9</Filter>
- </ClCompile>
- <ClCompile Include="renderer\IndexBuffer9.cpp">
- <Filter>Source Files\Renderer9</Filter>
- </ClCompile>
- <ClCompile Include="renderer\Query9.cpp">
- <Filter>Source Files\Renderer9</Filter>
- </ClCompile>
- <ClCompile Include="renderer\Renderer9.cpp">
- <Filter>Source Files\Renderer9</Filter>
- </ClCompile>
- <ClCompile Include="renderer\renderer9_utils.cpp">
- <Filter>Source Files\Renderer9</Filter>
- </ClCompile>
- <ClCompile Include="renderer\RenderTarget9.cpp">
- <Filter>Source Files\Renderer9</Filter>
- </ClCompile>
- <ClCompile Include="renderer\ShaderExecutable9.cpp">
- <Filter>Source Files\Renderer9</Filter>
- </ClCompile>
- <ClCompile Include="renderer\SwapChain9.cpp">
- <Filter>Source Files\Renderer9</Filter>
- </ClCompile>
- <ClCompile Include="renderer\TextureStorage9.cpp">
- <Filter>Source Files\Renderer9</Filter>
- </ClCompile>
- <ClCompile Include="renderer\VertexBuffer9.cpp">
- <Filter>Source Files\Renderer9</Filter>
- </ClCompile>
- <ClCompile Include="renderer\Blit.cpp">
- <Filter>Source Files\Renderer9</Filter>
- </ClCompile>
- <ClCompile Include="renderer\InputLayoutCache.cpp">
- <Filter>Source Files\Renderer11</Filter>
- </ClCompile>
- <ClCompile Include="renderer\RenderStateCache.cpp">
- <Filter>Source Files\Renderer11</Filter>
- </ClCompile>
- <ClCompile Include="renderer\VertexDeclarationCache.cpp">
- <Filter>Source Files\Renderer9</Filter>
- </ClCompile>
- <ClCompile Include="precompiled.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="renderer\IndexRangeCache.cpp">
- <Filter>Source Files\Renderer</Filter>
- </ClCompile>
- <ClCompile Include="..\common\event_tracer.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="BinaryStream.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="Buffer.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="Context.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="Fence.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="Framebuffer.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\GLES2\gl2.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\GLES2\gl2ext.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\GLES2\gl2platform.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="HandleAllocator.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="main.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="mathutil.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="Program.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="ProgramBinary.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="Query.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\common\RefCountObject.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="Renderbuffer.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="resource.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="ResourceManager.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="Shader.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="Texture.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="utilities.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\common\version.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="angletypes.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\third_party\murmurhash\MurmurHash3.h">
- <Filter>Third Party\MurmurHash</Filter>
- </ClInclude>
- <ClInclude Include="Uniform.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="renderer\shaders\compiled\passthrough11vs.h">
- <Filter>Shaders\Compiled</Filter>
- </ClInclude>
- <ClInclude Include="renderer\shaders\compiled\passthroughps.h">
- <Filter>Shaders\Compiled</Filter>
- </ClInclude>
- <ClInclude Include="renderer\shaders\compiled\standardvs.h">
- <Filter>Shaders\Compiled</Filter>
- </ClInclude>
- <ClInclude Include="renderer\shaders\compiled\componentmaskps.h">
- <Filter>Shaders\Compiled</Filter>
- </ClInclude>
- <ClInclude Include="renderer\shaders\compiled\flipyvs.h">
- <Filter>Shaders\Compiled</Filter>
- </ClInclude>
- <ClInclude Include="renderer\shaders\compiled\luminanceps.h">
- <Filter>Shaders\Compiled</Filter>
- </ClInclude>
- <ClInclude Include="renderer\shaders\compiled\passthroughrgba11ps.h">
- <Filter>Shaders\Compiled</Filter>
- </ClInclude>
- <ClInclude Include="renderer\shaders\compiled\passthroughrgb11ps.h">
- <Filter>Shaders\Compiled</Filter>
- </ClInclude>
- <ClInclude Include="renderer\shaders\compiled\passthroughlum11ps.h">
- <Filter>Shaders\Compiled</Filter>
- </ClInclude>
- <ClInclude Include="renderer\shaders\compiled\passthroughlumalpha11ps.h">
- <Filter>Shaders\Compiled</Filter>
- </ClInclude>
- <ClInclude Include="renderer\shaders\compiled\clear11vs.h">
- <Filter>Shaders\Compiled</Filter>
- </ClInclude>
- <ClInclude Include="renderer\shaders\compiled\clearmultiple11ps.h">
- <Filter>Shaders\Compiled</Filter>
- </ClInclude>
- <ClInclude Include="renderer\shaders\compiled\clearsingle11ps.h">
- <Filter>Shaders\Compiled</Filter>
- </ClInclude>
- <ClInclude Include="..\common\system.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\common\debug.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="renderer\BufferStorage.h">
- <Filter>Header Files\Renderer</Filter>
- </ClInclude>
- <ClInclude Include="renderer\FenceImpl.h">
- <Filter>Header Files\Renderer</Filter>
- </ClInclude>
- <ClInclude Include="renderer\generatemip.h">
- <Filter>Header Files\Renderer</Filter>
- </ClInclude>
- <ClInclude Include="renderer\Image.h">
- <Filter>Header Files\Renderer</Filter>
- </ClInclude>
- <ClInclude Include="renderer\IndexBuffer.h">
- <Filter>Header Files\Renderer</Filter>
- </ClInclude>
- <ClInclude Include="renderer\IndexDataManager.h">
- <Filter>Header Files\Renderer</Filter>
- </ClInclude>
- <ClInclude Include="renderer\QueryImpl.h">
- <Filter>Header Files\Renderer</Filter>
- </ClInclude>
- <ClInclude Include="renderer\Renderer.h">
- <Filter>Header Files\Renderer</Filter>
- </ClInclude>
- <ClInclude Include="renderer\RenderTarget.h">
- <Filter>Header Files\Renderer</Filter>
- </ClInclude>
- <ClInclude Include="renderer\ShaderExecutable.h">
- <Filter>Header Files\Renderer</Filter>
- </ClInclude>
- <ClInclude Include="renderer\SwapChain.h">
- <Filter>Header Files\Renderer</Filter>
- </ClInclude>
- <ClInclude Include="renderer\TextureStorage.h">
- <Filter>Header Files\Renderer</Filter>
- </ClInclude>
- <ClInclude Include="renderer\VertexBuffer.h">
- <Filter>Header Files\Renderer</Filter>
- </ClInclude>
- <ClInclude Include="renderer\vertexconversion.h">
- <Filter>Header Files\Renderer</Filter>
- </ClInclude>
- <ClInclude Include="renderer\VertexDataManager.h">
- <Filter>Header Files\Renderer</Filter>
- </ClInclude>
- <ClInclude Include="renderer\BufferStorage11.h">
- <Filter>Header Files\Renderer11</Filter>
- </ClInclude>
- <ClInclude Include="renderer\IndexBuffer11.h">
- <Filter>Header Files\Renderer11</Filter>
- </ClInclude>
- <ClInclude Include="renderer\Query11.h">
- <Filter>Header Files\Renderer11</Filter>
- </ClInclude>
- <ClInclude Include="renderer\Renderer11.h">
- <Filter>Header Files\Renderer11</Filter>
- </ClInclude>
- <ClInclude Include="renderer\RenderTarget11.h">
- <Filter>Header Files\Renderer11</Filter>
- </ClInclude>
- <ClInclude Include="renderer\ShaderExecutable11.h">
- <Filter>Header Files\Renderer11</Filter>
- </ClInclude>
- <ClInclude Include="renderer\SwapChain11.h">
- <Filter>Header Files\Renderer11</Filter>
- </ClInclude>
- <ClInclude Include="renderer\TextureStorage11.h">
- <Filter>Header Files\Renderer11</Filter>
- </ClInclude>
- <ClInclude Include="renderer\VertexBuffer11.h">
- <Filter>Header Files\Renderer11</Filter>
- </ClInclude>
- <ClInclude Include="renderer\BufferStorage9.h">
- <Filter>Header Files\Renderer9</Filter>
- </ClInclude>
- <ClInclude Include="renderer\Fence9.h">
- <Filter>Header Files\Renderer9</Filter>
- </ClInclude>
- <ClInclude Include="renderer\Image9.h">
- <Filter>Header Files\Renderer9</Filter>
- </ClInclude>
- <ClInclude Include="renderer\IndexBuffer9.h">
- <Filter>Header Files\Renderer9</Filter>
- </ClInclude>
- <ClInclude Include="renderer\Query9.h">
- <Filter>Header Files\Renderer9</Filter>
- </ClInclude>
- <ClInclude Include="renderer\Renderer9.h">
- <Filter>Header Files\Renderer9</Filter>
- </ClInclude>
- <ClInclude Include="renderer\renderer9_utils.h">
- <Filter>Header Files\Renderer9</Filter>
- </ClInclude>
- <ClInclude Include="renderer\RenderTarget9.h">
- <Filter>Header Files\Renderer9</Filter>
- </ClInclude>
- <ClInclude Include="renderer\ShaderExecutable9.h">
- <Filter>Header Files\Renderer9</Filter>
- </ClInclude>
- <ClInclude Include="renderer\SwapChain9.h">
- <Filter>Header Files\Renderer9</Filter>
- </ClInclude>
- <ClInclude Include="renderer\TextureStorage9.h">
- <Filter>Header Files\Renderer9</Filter>
- </ClInclude>
- <ClInclude Include="renderer\VertexBuffer9.h">
- <Filter>Header Files\Renderer9</Filter>
- </ClInclude>
- <ClInclude Include="renderer\Fence11.h">
- <Filter>Header Files\Renderer11</Filter>
- </ClInclude>
- <ClInclude Include="renderer\Image11.h">
- <Filter>Header Files\Renderer11</Filter>
- </ClInclude>
- <ClInclude Include="renderer\renderer11_utils.h">
- <Filter>Header Files\Renderer11</Filter>
- </ClInclude>
- <ClInclude Include="renderer\Fence9.h">
- <Filter>Header Files\Renderer\Renderer9</Filter>
- </ClInclude>
- <ClInclude Include="renderer\Query11.h">
- <Filter>Header Files\Renderer\Renderer11</Filter>
- </ClInclude>
- <ClInclude Include="renderer\Blit.h">
- <Filter>Header Files\Renderer9</Filter>
- </ClInclude>
- <ClInclude Include="renderer\ShaderCache.h">
- <Filter>Header Files\Renderer9</Filter>
- </ClInclude>
- <ClInclude Include="renderer\InputLayoutCache.h">
- <Filter>Header Files\Renderer11</Filter>
- </ClInclude>
- <ClInclude Include="renderer\RenderStateCache.h">
- <Filter>Header Files\Renderer11</Filter>
- </ClInclude>
- <ClInclude Include="renderer\VertexDeclarationCache.h">
- <Filter>Header Files\Renderer9</Filter>
- </ClInclude>
- <ClInclude Include="constants.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="precompiled.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="renderer\IndexRangeCache.h">
- <Filter>Header Files\Renderer</Filter>
- </ClInclude>
- <ClInclude Include="..\common\event_tracer.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\third_party\trace_event\trace_event.h">
- <Filter>Third Party\trace_event</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <None Include="renderer\shaders\Blit.ps">
- <Filter>Shaders</Filter>
- </None>
- <None Include="renderer\shaders\Blit.vs">
- <Filter>Shaders</Filter>
- </None>
- <None Include="renderer\shaders\generate_shaders.bat">
- <Filter>Shaders</Filter>
- </None>
- <None Include="renderer\shaders\Passthrough11.hlsl">
- <Filter>Shaders</Filter>
- </None>
- <None Include="renderer\shaders\Clear11.hlsl">
- <Filter>Shaders</Filter>
- </None>
- <None Include="libGLESv2.def" />
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="libGLESv2.rc" />
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/chromium/third_party/angle/src/libGLESv2/main.cpp b/chromium/third_party/angle/src/libGLESv2/main.cpp
index 6d7a241340f..50e2593328d 100644
--- a/chromium/third_party/angle/src/libGLESv2/main.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/main.cpp
@@ -13,6 +13,40 @@
static DWORD currentTLS = TLS_OUT_OF_INDEXES;
+namespace gl
+{
+
+Current *AllocateCurrent()
+{
+ Current *current = (Current*)LocalAlloc(LPTR, sizeof(Current));
+
+ if (!current)
+ {
+ ERR("Could not allocate thread local storage.");
+ return NULL;
+ }
+
+ ASSERT(currentTLS != TLS_OUT_OF_INDEXES);
+ TlsSetValue(currentTLS, current);
+
+ current->context = NULL;
+ current->display = NULL;
+
+ return current;
+}
+
+void DeallocateCurrent()
+{
+ void *current = TlsGetValue(currentTLS);
+
+ if (current)
+ {
+ LocalFree((HLOCAL)current);
+ }
+}
+
+}
+
extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
{
switch (reason)
@@ -29,36 +63,17 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
// Fall throught to initialize index
case DLL_THREAD_ATTACH:
{
- gl::Current *current = (gl::Current*)LocalAlloc(LPTR, sizeof(gl::Current));
-
- if (current)
- {
- TlsSetValue(currentTLS, current);
-
- current->context = NULL;
- current->display = NULL;
- }
+ gl::AllocateCurrent();
}
break;
case DLL_THREAD_DETACH:
{
- void *current = TlsGetValue(currentTLS);
-
- if (current)
- {
- LocalFree((HLOCAL)current);
- }
+ gl::DeallocateCurrent();
}
break;
case DLL_PROCESS_DETACH:
{
- void *current = TlsGetValue(currentTLS);
-
- if (current)
- {
- LocalFree((HLOCAL)current);
- }
-
+ gl::DeallocateCurrent();
TlsFree(currentTLS);
}
break;
@@ -71,10 +86,20 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
namespace gl
{
-void makeCurrent(Context *context, egl::Display *display, egl::Surface *surface)
+
+Current *GetCurrentData()
{
Current *current = (Current*)TlsGetValue(currentTLS);
+ // ANGLE issue 488: when the dll is loaded after thread initialization,
+ // thread local storage (current) might not exist yet.
+ return (current ? current : AllocateCurrent());
+}
+
+void makeCurrent(Context *context, egl::Display *display, egl::Surface *surface)
+{
+ Current *current = GetCurrentData();
+
current->context = context;
current->display = display;
@@ -86,7 +111,7 @@ void makeCurrent(Context *context, egl::Display *display, egl::Surface *surface)
Context *getContext()
{
- Current *current = (Current*)TlsGetValue(currentTLS);
+ Current *current = GetCurrentData();
return current->context;
}
@@ -112,7 +137,7 @@ Context *getNonLostContext()
egl::Display *getDisplay()
{
- Current *current = (Current*)TlsGetValue(currentTLS);
+ Current *current = GetCurrentData();
return current->display;
}
diff --git a/chromium/third_party/angle/src/libGLESv2/main.h b/chromium/third_party/angle/src/libGLESv2/main.h
index 196afaeab67..d17facf20dc 100644
--- a/chromium/third_party/angle/src/libGLESv2/main.h
+++ b/chromium/third_party/angle/src/libGLESv2/main.h
@@ -10,7 +10,6 @@
#define LIBGLESV2_MAIN_H_
#include "common/debug.h"
-#include "common/system.h"
namespace egl
{
@@ -54,7 +53,7 @@ class Renderer;
extern "C"
{
// Exported functions for use by EGL
-gl::Context *glCreateContext(const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess);
+gl::Context *glCreateContext(int clientVersion, const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess);
void glDestroyContext(gl::Context *context);
void glMakeCurrent(gl::Context *context, egl::Display *display, egl::Surface *surface);
gl::Context *glGetCurrentContext();
diff --git a/chromium/third_party/angle/src/libGLESv2/mathutil.h b/chromium/third_party/angle/src/libGLESv2/mathutil.h
deleted file mode 100644
index bb48b94eaf7..00000000000
--- a/chromium/third_party/angle/src/libGLESv2/mathutil.h
+++ /dev/null
@@ -1,161 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// mathutil.h: Math and bit manipulation functions.
-
-#ifndef LIBGLESV2_MATHUTIL_H_
-#define LIBGLESV2_MATHUTIL_H_
-
-#include <intrin.h>
-
-#include "common/system.h"
-#include "common/debug.h"
-
-namespace gl
-{
-struct Vector4
-{
- Vector4() {}
- Vector4(float x, float y, float z, float w) : x(x), y(y), z(z), w(w) {}
-
- float x;
- float y;
- float z;
- float w;
-};
-
-inline bool isPow2(int x)
-{
- return (x & (x - 1)) == 0 && (x != 0);
-}
-
-inline int log2(int x)
-{
- int r = 0;
- while ((x >> r) > 1) r++;
- return r;
-}
-
-inline unsigned int ceilPow2(unsigned int x)
-{
- if (x != 0) x--;
- x |= x >> 1;
- x |= x >> 2;
- x |= x >> 4;
- x |= x >> 8;
- x |= x >> 16;
- x++;
-
- return x;
-}
-
-template<typename T, typename MIN, typename MAX>
-inline T clamp(T x, MIN min, MAX max)
-{
- // Since NaNs fail all comparison tests, a NaN value will default to min
- return x > min ? (x > max ? max : x) : min;
-}
-
-inline float clamp01(float x)
-{
- return clamp(x, 0.0f, 1.0f);
-}
-
-template<const int n>
-inline unsigned int unorm(float x)
-{
- const unsigned int max = 0xFFFFFFFF >> (32 - n);
-
- if (x > 1)
- {
- return max;
- }
- else if (x < 0)
- {
- return 0;
- }
- else
- {
- return (unsigned int)(max * x + 0.5f);
- }
-}
-
-inline bool supportsSSE2()
-{
- static bool checked = false;
- static bool supports = false;
-
- if (checked)
- {
- return supports;
- }
-
- int info[4];
- __cpuid(info, 0);
-
- if (info[0] >= 1)
- {
- __cpuid(info, 1);
-
- supports = (info[3] >> 26) & 1;
- }
-
- checked = true;
-
- return supports;
-}
-
-inline unsigned short float32ToFloat16(float fp32)
-{
- unsigned int fp32i = (unsigned int&)fp32;
- unsigned int sign = (fp32i & 0x80000000) >> 16;
- unsigned int abs = fp32i & 0x7FFFFFFF;
-
- if(abs > 0x47FFEFFF) // Infinity
- {
- return sign | 0x7FFF;
- }
- else if(abs < 0x38800000) // Denormal
- {
- unsigned int mantissa = (abs & 0x007FFFFF) | 0x00800000;
- int e = 113 - (abs >> 23);
-
- if(e < 24)
- {
- abs = mantissa >> e;
- }
- else
- {
- abs = 0;
- }
-
- return sign | (abs + 0x00000FFF + ((abs >> 13) & 1)) >> 13;
- }
- else
- {
- return sign | (abs + 0xC8000000 + 0x00000FFF + ((abs >> 13) & 1)) >> 13;
- }
-}
-
-float float16ToFloat32(unsigned short h);
-
-}
-
-namespace rx
-{
-
-struct Range
-{
- Range() {}
- Range(int lo, int hi) : start(lo), end(hi) { ASSERT(lo <= hi); }
-
- int start;
- int end;
-};
-
-}
-
-#endif // LIBGLESV2_MATHUTIL_H_
diff --git a/chromium/third_party/angle/src/libGLESv2/precompiled.h b/chromium/third_party/angle/src/libGLESv2/precompiled.h
index 58ad181874b..3bc66a1d41e 100644
--- a/chromium/third_party/angle/src/libGLESv2/precompiled.h
+++ b/chromium/third_party/angle/src/libGLESv2/precompiled.h
@@ -6,16 +6,18 @@
// precompiled.h: Precompiled header file for libGLESv2.
-#define GL_APICALL
+#include <GLES3/gl3.h>
+#include <GLES3/gl3ext.h>
#include <GLES2/gl2.h>
+
#include <GLES2/gl2ext.h>
-#define EGLAPI
#include <EGL/egl.h>
#include <assert.h>
#include <cstddef>
#include <float.h>
+#include <stdint.h>
#include <intrin.h>
#include <math.h>
#include <stdarg.h>
@@ -32,11 +34,15 @@
#include <unordered_map>
#include <vector>
+#if defined(ANGLE_ENABLE_D3D9)
#include <d3d9.h>
+#include <d3dcompiler.h>
+#endif // ANGLE_ENABLE_D3D9
+
+#if defined(ANGLE_ENABLE_D3D11)
+#include <d3d10_1.h>
#include <d3d11.h>
#include <dxgi.h>
+#include <dxgi1_2.h>
#include <d3dcompiler.h>
-
-#ifdef _MSC_VER
-#include <hash_map>
-#endif
+#endif // ANGLE_ENABLE_D3D11
diff --git a/chromium/third_party/angle/src/libGLESv2/queryconversions.cpp b/chromium/third_party/angle/src/libGLESv2/queryconversions.cpp
new file mode 100644
index 00000000000..67578efe3a2
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/queryconversions.cpp
@@ -0,0 +1,148 @@
+#include "precompiled.h"
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// queryconversions.cpp: Implementation of state query cast conversions
+
+#include "libGLESv2/Context.h"
+#include "common/utilities.h"
+
+namespace gl
+{
+
+// Helper class for converting a GL type to a GLenum:
+// We can't use CastStateValueEnum generally, because of GLboolean + GLubyte overlap.
+// We restrict our use to CastStateValue, where it eliminates duplicate parameters.
+
+template <typename GLType>
+struct CastStateValueEnum { static GLenum mEnumForType; };
+
+template <> GLenum CastStateValueEnum<GLint>::mEnumForType = GL_INT;
+template <> GLenum CastStateValueEnum<GLuint>::mEnumForType = GL_UNSIGNED_INT;
+template <> GLenum CastStateValueEnum<GLboolean>::mEnumForType = GL_BOOL;
+template <> GLenum CastStateValueEnum<GLint64>::mEnumForType = GL_INT_64_ANGLEX;
+template <> GLenum CastStateValueEnum<GLfloat>::mEnumForType = GL_FLOAT;
+
+template <typename QueryT, typename NativeT>
+QueryT CastStateValueToInt(GLenum pname, NativeT value)
+{
+ GLenum queryType = CastStateValueEnum<QueryT>::mEnumForType;
+ GLenum nativeType = CastStateValueEnum<NativeT>::mEnumForType;
+
+ if (nativeType == GL_FLOAT)
+ {
+ // RGBA color values and DepthRangeF values are converted to integer using Equation 2.4 from Table 4.5
+ if (pname == GL_DEPTH_RANGE || pname == GL_COLOR_CLEAR_VALUE || pname == GL_DEPTH_CLEAR_VALUE || pname == GL_BLEND_COLOR)
+ {
+ return static_cast<QueryT>((static_cast<GLfloat>(0xFFFFFFFF) * value - 1.0f) / 2.0f);
+ }
+ else
+ {
+ return gl::iround<QueryT>(value);
+ }
+ }
+
+ // Clamp 64-bit int values when casting to int
+ if (nativeType == GL_INT_64_ANGLEX && queryType == GL_INT)
+ {
+ GLint64 minIntValue = static_cast<GLint64>(std::numeric_limits<GLint>::min());
+ GLint64 maxIntValue = static_cast<GLint64>(std::numeric_limits<GLint>::max());
+ GLint64 clampedValue = std::max(std::min(static_cast<GLint64>(value), maxIntValue), minIntValue);
+ return static_cast<QueryT>(clampedValue);
+ }
+
+ return static_cast<QueryT>(value);
+}
+
+template <typename QueryT, typename NativeT>
+QueryT CastStateValue(GLenum pname, NativeT value)
+{
+ GLenum queryType = CastStateValueEnum<QueryT>::mEnumForType;
+
+ switch (queryType)
+ {
+ case GL_INT: return CastStateValueToInt<QueryT, NativeT>(pname, value);
+ case GL_INT_64_ANGLEX: return CastStateValueToInt<QueryT, NativeT>(pname, value);
+ case GL_FLOAT: return static_cast<QueryT>(value);
+ case GL_BOOL: return (value == static_cast<NativeT>(0) ? GL_FALSE : GL_TRUE);
+ default: UNREACHABLE(); return 0;
+ }
+}
+
+template <typename QueryT>
+void CastStateValues(Context *context, GLenum nativeType, GLenum pname,
+ unsigned int numParams, QueryT *outParams)
+{
+ if (nativeType == GL_INT)
+ {
+ GLint *intParams = NULL;
+ intParams = new GLint[numParams];
+
+ context->getIntegerv(pname, intParams);
+
+ for (unsigned int i = 0; i < numParams; ++i)
+ {
+ outParams[i] = CastStateValue<QueryT>(pname, intParams[i]);
+ }
+
+ delete [] intParams;
+ }
+ else if (nativeType == GL_BOOL)
+ {
+ GLboolean *boolParams = NULL;
+ boolParams = new GLboolean[numParams];
+
+ context->getBooleanv(pname, boolParams);
+
+ for (unsigned int i = 0; i < numParams; ++i)
+ {
+ outParams[i] = (boolParams[i] == GL_FALSE ? static_cast<QueryT>(0) : static_cast<QueryT>(1));
+ }
+
+ delete [] boolParams;
+ }
+ else if (nativeType == GL_FLOAT)
+ {
+ GLfloat *floatParams = NULL;
+ floatParams = new GLfloat[numParams];
+
+ context->getFloatv(pname, floatParams);
+
+ for (unsigned int i = 0; i < numParams; ++i)
+ {
+ outParams[i] = CastStateValue<QueryT>(pname, floatParams[i]);
+ }
+
+ delete [] floatParams;
+ }
+ else if (nativeType == GL_INT_64_ANGLEX)
+ {
+ GLint64 *int64Params = NULL;
+ int64Params = new GLint64[numParams];
+
+ context->getInteger64v(pname, int64Params);
+
+ for (unsigned int i = 0; i < numParams; ++i)
+ {
+ outParams[i] = CastStateValue<QueryT>(pname, int64Params[i]);
+ }
+
+ delete [] int64Params;
+ }
+ else UNREACHABLE();
+}
+
+// Explicit template instantiation (how we export template functions in different files)
+// The calls below will make CastStateValues successfully link with the GL state query types
+// The GL state query API types are: bool, int, uint, float, int64
+
+template void CastStateValues<GLboolean>(Context *, GLenum, GLenum, unsigned int, GLboolean *);
+template void CastStateValues<GLint>(Context *, GLenum, GLenum, unsigned int, GLint *);
+template void CastStateValues<GLuint>(Context *, GLenum, GLenum, unsigned int, GLuint *);
+template void CastStateValues<GLfloat>(Context *, GLenum, GLenum, unsigned int, GLfloat *);
+template void CastStateValues<GLint64>(Context *, GLenum, GLenum, unsigned int, GLint64 *);
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/queryconversions.h b/chromium/third_party/angle/src/libGLESv2/queryconversions.h
new file mode 100644
index 00000000000..da7047f730e
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/queryconversions.h
@@ -0,0 +1,17 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// queryconversions.h: Declaration of state query cast conversions
+
+namespace gl
+{
+
+// The GL state query API types are: bool, int, uint, float, int64
+template <typename QueryT>
+void CastStateValues(Context *context, GLenum nativeType, GLenum pname,
+ unsigned int numParams, QueryT *outParams);
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/BufferStorage.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/BufferStorage.cpp
index a49b7bab842..4d245f89daa 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/BufferStorage.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/BufferStorage.cpp
@@ -33,8 +33,4 @@ void BufferStorage::updateSerial()
mSerial = mNextSerial++;
}
-void BufferStorage::markBufferUsage()
-{
-}
-
}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/BufferStorage.h b/chromium/third_party/angle/src/libGLESv2/renderer/BufferStorage.h
index ace1a11bae0..a5f95d1eb79 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/BufferStorage.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/BufferStorage.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -22,13 +22,18 @@ class BufferStorage
// The data returned is only guaranteed valid until next non-const method.
virtual void *getData() = 0;
- virtual void setData(const void* data, unsigned int size, unsigned int offset) = 0;
+ virtual void setData(const void* data, size_t size, size_t offset) = 0;
+ virtual void copyData(BufferStorage* sourceStorage, size_t size, size_t sourceOffset, size_t destOffset) = 0;
virtual void clear() = 0;
- virtual unsigned int getSize() const = 0;
+ virtual void markTransformFeedbackUsage() = 0;
+ virtual size_t getSize() const = 0;
virtual bool supportsDirectBinding() const = 0;
- virtual void markBufferUsage();
unsigned int getSerial() const;
+ virtual bool isMapped() const = 0;
+ virtual void *map(GLbitfield access) = 0;
+ virtual void unmap() = 0;
+
protected:
void updateSerial();
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/BufferStorage11.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/BufferStorage11.cpp
deleted file mode 100644
index 3647d8a8985..00000000000
--- a/chromium/third_party/angle/src/libGLESv2/renderer/BufferStorage11.cpp
+++ /dev/null
@@ -1,358 +0,0 @@
-#include "precompiled.h"
-//
-// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// BufferStorage11.cpp Defines the BufferStorage11 class.
-
-#include "libGLESv2/renderer/BufferStorage11.h"
-#include "libGLESv2/main.h"
-#include "libGLESv2/renderer/Renderer11.h"
-
-namespace rx
-{
-
-BufferStorage11::BufferStorage11(Renderer11 *renderer)
-{
- mRenderer = renderer;
-
- mStagingBuffer = NULL;
- mStagingBufferSize = 0;
-
- mBuffer = NULL;
- mBufferSize = 0;
-
- mSize = 0;
-
- mResolvedData = NULL;
- mResolvedDataSize = 0;
- mResolvedDataValid = false;
-
- mReadUsageCount = 0;
- mWriteUsageCount = 0;
-}
-
-BufferStorage11::~BufferStorage11()
-{
- if (mStagingBuffer)
- {
- mStagingBuffer->Release();
- mStagingBuffer = NULL;
- }
-
- if (mBuffer)
- {
- mBuffer->Release();
- mBuffer = NULL;
- }
-
- if (mResolvedData)
- {
- free(mResolvedData);
- mResolvedData = NULL;
- }
-}
-
-BufferStorage11 *BufferStorage11::makeBufferStorage11(BufferStorage *bufferStorage)
-{
- ASSERT(HAS_DYNAMIC_TYPE(BufferStorage11*, bufferStorage));
- return static_cast<BufferStorage11*>(bufferStorage);
-}
-
-void *BufferStorage11::getData()
-{
- if (!mResolvedDataValid)
- {
- ID3D11Device *device = mRenderer->getDevice();
- ID3D11DeviceContext *context = mRenderer->getDeviceContext();
- HRESULT result;
-
- if (!mStagingBuffer || mStagingBufferSize < mBufferSize)
- {
- if (mStagingBuffer)
- {
- mStagingBuffer->Release();
- mStagingBuffer = NULL;
- mStagingBufferSize = 0;
- }
-
- D3D11_BUFFER_DESC bufferDesc;
- bufferDesc.ByteWidth = mSize;
- bufferDesc.Usage = D3D11_USAGE_STAGING;
- bufferDesc.BindFlags = 0;
- bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
- bufferDesc.MiscFlags = 0;
- bufferDesc.StructureByteStride = 0;
-
- result = device->CreateBuffer(&bufferDesc, NULL, &mStagingBuffer);
- if (FAILED(result))
- {
- return gl::error(GL_OUT_OF_MEMORY, (void*)NULL);
- }
-
- mStagingBufferSize = bufferDesc.ByteWidth;
- }
-
- if (!mResolvedData || mResolvedDataSize < mBufferSize)
- {
- free(mResolvedData);
- mResolvedData = malloc(mSize);
- mResolvedDataSize = mSize;
- }
-
- D3D11_BOX srcBox;
- srcBox.left = 0;
- srcBox.right = mSize;
- srcBox.top = 0;
- srcBox.bottom = 1;
- srcBox.front = 0;
- srcBox.back = 1;
-
- context->CopySubresourceRegion(mStagingBuffer, 0, 0, 0, 0, mBuffer, 0, &srcBox);
-
- D3D11_MAPPED_SUBRESOURCE mappedResource;
- result = context->Map(mStagingBuffer, 0, D3D11_MAP_READ, 0, &mappedResource);
- if (FAILED(result))
- {
- return gl::error(GL_OUT_OF_MEMORY, (void*)NULL);
- }
-
- memcpy(mResolvedData, mappedResource.pData, mSize);
-
- context->Unmap(mStagingBuffer, 0);
-
- mResolvedDataValid = true;
- }
-
- mReadUsageCount = 0;
-
- return mResolvedData;
-}
-
-void BufferStorage11::setData(const void* data, unsigned int size, unsigned int offset)
-{
- ID3D11Device *device = mRenderer->getDevice();
- ID3D11DeviceContext *context = mRenderer->getDeviceContext();
- HRESULT result;
-
- unsigned int requiredBufferSize = size + offset;
- unsigned int requiredStagingSize = size;
- bool directInitialization = offset == 0 && (!mBuffer || mBufferSize < size + offset);
-
- if (!directInitialization)
- {
- if (!mStagingBuffer || mStagingBufferSize < requiredStagingSize)
- {
- if (mStagingBuffer)
- {
- mStagingBuffer->Release();
- mStagingBuffer = NULL;
- mStagingBufferSize = 0;
- }
-
- D3D11_BUFFER_DESC bufferDesc;
- bufferDesc.ByteWidth = size;
- bufferDesc.Usage = D3D11_USAGE_STAGING;
- bufferDesc.BindFlags = 0;
- bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
- bufferDesc.MiscFlags = 0;
- bufferDesc.StructureByteStride = 0;
-
- if (data)
- {
- D3D11_SUBRESOURCE_DATA initialData;
- initialData.pSysMem = data;
- initialData.SysMemPitch = size;
- initialData.SysMemSlicePitch = 0;
-
- result = device->CreateBuffer(&bufferDesc, &initialData, &mStagingBuffer);
- }
- else
- {
- result = device->CreateBuffer(&bufferDesc, NULL, &mStagingBuffer);
- }
-
- if (FAILED(result))
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
-
- mStagingBufferSize = size;
- }
- else if (data)
- {
- D3D11_MAPPED_SUBRESOURCE mappedResource;
- result = context->Map(mStagingBuffer, 0, D3D11_MAP_WRITE, 0, &mappedResource);
- if (FAILED(result))
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
-
- memcpy(mappedResource.pData, data, size);
-
- context->Unmap(mStagingBuffer, 0);
- }
- }
-
- if (!mBuffer || mBufferSize < size + offset)
- {
- D3D11_BUFFER_DESC bufferDesc;
- bufferDesc.ByteWidth = requiredBufferSize;
- bufferDesc.Usage = D3D11_USAGE_DEFAULT;
- bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER | D3D11_BIND_INDEX_BUFFER;
- bufferDesc.CPUAccessFlags = 0;
- bufferDesc.MiscFlags = 0;
- bufferDesc.StructureByteStride = 0;
-
- if (directInitialization)
- {
- // Since the data will fill the entire buffer (being larger than the initial size and having
- // no offset), the buffer can be initialized with the data so no staging buffer is required
-
- // No longer need the old buffer
- if (mBuffer)
- {
- mBuffer->Release();
- mBuffer = NULL;
- mBufferSize = 0;
- }
-
- if (data)
- {
- D3D11_SUBRESOURCE_DATA initialData;
- initialData.pSysMem = data;
- initialData.SysMemPitch = size;
- initialData.SysMemSlicePitch = 0;
-
- result = device->CreateBuffer(&bufferDesc, &initialData, &mBuffer);
- }
- else
- {
- result = device->CreateBuffer(&bufferDesc, NULL, &mBuffer);
- }
-
- if (FAILED(result))
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
- }
- else if (mBuffer && offset > 0)
- {
- // If offset is greater than zero and the buffer is non-null, need to preserve the data from
- // the old buffer up to offset
- ID3D11Buffer *newBuffer = NULL;
-
- result = device->CreateBuffer(&bufferDesc, NULL, &newBuffer);
- if (FAILED(result))
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
-
- D3D11_BOX srcBox;
- srcBox.left = 0;
- srcBox.right = std::min(offset, mBufferSize);
- srcBox.top = 0;
- srcBox.bottom = 1;
- srcBox.front = 0;
- srcBox.back = 1;
-
- context->CopySubresourceRegion(newBuffer, 0, 0, 0, 0, mBuffer, 0, &srcBox);
-
- mBuffer->Release();
- mBuffer = newBuffer;
- }
- else
- {
- // Simple case, nothing needs to be copied from the old buffer to the new one, just create
- // a new buffer
-
- // No longer need the old buffer
- if (mBuffer)
- {
- mBuffer->Release();
- mBuffer = NULL;
- mBufferSize = 0;
- }
-
- // Create a new buffer for data storage
- result = device->CreateBuffer(&bufferDesc, NULL, &mBuffer);
- if (FAILED(result))
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
- }
-
- updateSerial();
- mBufferSize = bufferDesc.ByteWidth;
- }
-
- if (!directInitialization)
- {
- ASSERT(mStagingBuffer && mStagingBufferSize >= requiredStagingSize);
-
- // Data is already put into the staging buffer, copy it over to the data buffer
- D3D11_BOX srcBox;
- srcBox.left = 0;
- srcBox.right = size;
- srcBox.top = 0;
- srcBox.bottom = 1;
- srcBox.front = 0;
- srcBox.back = 1;
-
- context->CopySubresourceRegion(mBuffer, 0, offset, 0, 0, mStagingBuffer, 0, &srcBox);
- }
-
- mSize = std::max(mSize, offset + size);
-
- mWriteUsageCount = 0;
-
- mResolvedDataValid = false;
-}
-
-void BufferStorage11::clear()
-{
- mResolvedDataValid = false;
- mSize = 0;
-}
-
-unsigned int BufferStorage11::getSize() const
-{
- return mSize;
-}
-
-bool BufferStorage11::supportsDirectBinding() const
-{
- return true;
-}
-
-void BufferStorage11::markBufferUsage()
-{
- mReadUsageCount++;
- mWriteUsageCount++;
-
- static const unsigned int usageLimit = 5;
-
- if (mReadUsageCount > usageLimit && mResolvedData)
- {
- free(mResolvedData);
- mResolvedData = NULL;
- mResolvedDataSize = 0;
- mResolvedDataValid = false;
- }
-
- if (mReadUsageCount > usageLimit && mWriteUsageCount > usageLimit && mStagingBuffer)
- {
- mStagingBuffer->Release();
- mStagingBuffer = NULL;
- mStagingBufferSize = 0;
- }
-}
-
-ID3D11Buffer *BufferStorage11::getBuffer() const
-{
- return mBuffer;
-}
-
-}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/BufferStorage11.h b/chromium/third_party/angle/src/libGLESv2/renderer/BufferStorage11.h
deleted file mode 100644
index b62348b0c93..00000000000
--- a/chromium/third_party/angle/src/libGLESv2/renderer/BufferStorage11.h
+++ /dev/null
@@ -1,56 +0,0 @@
-//
-// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// BufferStorage11.h Defines the BufferStorage11 class.
-
-#ifndef LIBGLESV2_RENDERER_BUFFERSTORAGE11_H_
-#define LIBGLESV2_RENDERER_BUFFERSTORAGE11_H_
-
-#include "libGLESv2/renderer/BufferStorage.h"
-
-namespace rx
-{
-class Renderer11;
-
-class BufferStorage11 : public BufferStorage
-{
- public:
- explicit BufferStorage11(Renderer11 *renderer);
- virtual ~BufferStorage11();
-
- static BufferStorage11 *makeBufferStorage11(BufferStorage *bufferStorage);
-
- virtual void *getData();
- virtual void setData(const void* data, unsigned int size, unsigned int offset);
- virtual void clear();
- virtual unsigned int getSize() const;
- virtual bool supportsDirectBinding() const;
- virtual void markBufferUsage();
-
- ID3D11Buffer *getBuffer() const;
-
- private:
- Renderer11 *mRenderer;
-
- ID3D11Buffer *mStagingBuffer;
- unsigned int mStagingBufferSize;
-
- ID3D11Buffer *mBuffer;
- unsigned int mBufferSize;
-
- unsigned int mSize;
-
- void *mResolvedData;
- unsigned int mResolvedDataSize;
- bool mResolvedDataValid;
-
- unsigned int mReadUsageCount;
- unsigned int mWriteUsageCount;
-};
-
-}
-
-#endif // LIBGLESV2_RENDERER_BUFFERSTORAGE11_H_
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/BufferStorage9.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/BufferStorage9.cpp
deleted file mode 100644
index e69e7a8921e..00000000000
--- a/chromium/third_party/angle/src/libGLESv2/renderer/BufferStorage9.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-#include "precompiled.h"
-//
-// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// BufferStorage9.cpp Defines the BufferStorage9 class.
-
-#include "libGLESv2/renderer/BufferStorage9.h"
-#include "common/debug.h"
-
-namespace rx
-{
-
-BufferStorage9::BufferStorage9()
-{
- mMemory = NULL;
- mAllocatedSize = 0;
- mSize = 0;
-}
-
-BufferStorage9::~BufferStorage9()
-{
- delete[] mMemory;
-}
-
-BufferStorage9 *BufferStorage9::makeBufferStorage9(BufferStorage *bufferStorage)
-{
- ASSERT(HAS_DYNAMIC_TYPE(BufferStorage9*, bufferStorage));
- return static_cast<BufferStorage9*>(bufferStorage);
-}
-
-void *BufferStorage9::getData()
-{
- return mMemory;
-}
-
-void BufferStorage9::setData(const void* data, unsigned int size, unsigned int offset)
-{
- if (!mMemory || offset + size > mAllocatedSize)
- {
- unsigned int newAllocatedSize = offset + size;
- void *newMemory = new char[newAllocatedSize];
-
- if (offset > 0 && mMemory && mAllocatedSize > 0)
- {
- memcpy(newMemory, mMemory, std::min(offset, mAllocatedSize));
- }
-
- delete[] mMemory;
- mMemory = newMemory;
- mAllocatedSize = newAllocatedSize;
- }
-
- mSize = std::max(mSize, offset + size);
- if (data)
- {
- memcpy(reinterpret_cast<char*>(mMemory) + offset, data, size);
- }
-}
-
-void BufferStorage9::clear()
-{
- mSize = 0;
-}
-
-unsigned int BufferStorage9::getSize() const
-{
- return mSize;
-}
-
-bool BufferStorage9::supportsDirectBinding() const
-{
- return false;
-}
-
-}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/Fence11.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/Fence11.cpp
deleted file mode 100644
index 9d11c9a0fc8..00000000000
--- a/chromium/third_party/angle/src/libGLESv2/renderer/Fence11.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-#include "precompiled.h"
-//
-// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// Fence11.cpp: Defines the rx::Fence11 class which implements rx::FenceImpl.
-
-#include "libGLESv2/renderer/Fence11.h"
-#include "libGLESv2/main.h"
-#include "libGLESv2/renderer/Renderer11.h"
-
-namespace rx
-{
-
-Fence11::Fence11(rx::Renderer11 *renderer)
-{
- mRenderer = renderer;
- mQuery = NULL;
-}
-
-Fence11::~Fence11()
-{
- if (mQuery)
- {
- mQuery->Release();
- mQuery = NULL;
- }
-}
-
-GLboolean Fence11::isFence()
-{
- // GL_NV_fence spec:
- // A name returned by GenFencesNV, but not yet set via SetFenceNV, is not the name of an existing fence.
- return mQuery != NULL;
-}
-
-void Fence11::setFence(GLenum condition)
-{
- if (!mQuery)
- {
- D3D11_QUERY_DESC queryDesc;
- queryDesc.Query = D3D11_QUERY_EVENT;
- queryDesc.MiscFlags = 0;
-
- if (FAILED(mRenderer->getDevice()->CreateQuery(&queryDesc, &mQuery)))
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
- }
-
- mRenderer->getDeviceContext()->End(mQuery);
-
- setCondition(condition);
- setStatus(GL_FALSE);
-}
-
-GLboolean Fence11::testFence()
-{
- if (mQuery == NULL)
- {
- return gl::error(GL_INVALID_OPERATION, GL_TRUE);
- }
-
- HRESULT result = mRenderer->getDeviceContext()->GetData(mQuery, NULL, 0, 0);
-
- if (mRenderer->isDeviceLost())
- {
- return gl::error(GL_OUT_OF_MEMORY, GL_TRUE);
- }
-
- ASSERT(result == S_OK || result == S_FALSE);
- setStatus(result == S_OK);
- return getStatus();
-}
-
-void Fence11::finishFence()
-{
- if (mQuery == NULL)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- while (!testFence())
- {
- Sleep(0);
- }
-}
-
-void Fence11::getFenceiv(GLenum pname, GLint *params)
-{
- if (mQuery == NULL)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- switch (pname)
- {
- case GL_FENCE_STATUS_NV:
- {
- // GL_NV_fence spec:
- // Once the status of a fence has been finished (via FinishFenceNV) or tested and the returned status is TRUE (via either TestFenceNV
- // or GetFenceivNV querying the FENCE_STATUS_NV), the status remains TRUE until the next SetFenceNV of the fence.
- if (getStatus())
- {
- params[0] = GL_TRUE;
- return;
- }
-
- HRESULT result = mRenderer->getDeviceContext()->GetData(mQuery, NULL, 0, D3D11_ASYNC_GETDATA_DONOTFLUSH);
-
- if (mRenderer->isDeviceLost())
- {
- params[0] = GL_TRUE;
- return gl::error(GL_OUT_OF_MEMORY);
- }
-
- ASSERT(result == S_OK || result == S_FALSE);
- setStatus(result == S_OK);
- params[0] = getStatus();
-
- break;
- }
- case GL_FENCE_CONDITION_NV:
- params[0] = getCondition();
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- break;
- }
-}
-
-}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/Fence9.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/Fence9.cpp
deleted file mode 100644
index 86064d7e52b..00000000000
--- a/chromium/third_party/angle/src/libGLESv2/renderer/Fence9.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-#include "precompiled.h"
-//
-// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// Fence9.cpp: Defines the rx::Fence9 class.
-
-#include "libGLESv2/renderer/Fence9.h"
-#include "libGLESv2/main.h"
-#include "libGLESv2/renderer/renderer9_utils.h"
-#include "libGLESv2/renderer/Renderer9.h"
-
-namespace rx
-{
-
-Fence9::Fence9(rx::Renderer9 *renderer)
-{
- mRenderer = renderer;
- mQuery = NULL;
-}
-
-Fence9::~Fence9()
-{
- if (mQuery)
- {
- mRenderer->freeEventQuery(mQuery);
- mQuery = NULL;
- }
-}
-
-GLboolean Fence9::isFence()
-{
- // GL_NV_fence spec:
- // A name returned by GenFencesNV, but not yet set via SetFenceNV, is not the name of an existing fence.
- return mQuery != NULL;
-}
-
-void Fence9::setFence(GLenum condition)
-{
- if (!mQuery)
- {
- mQuery = mRenderer->allocateEventQuery();
- if (!mQuery)
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
- }
-
- HRESULT result = mQuery->Issue(D3DISSUE_END);
- ASSERT(SUCCEEDED(result));
-
- setCondition(condition);
- setStatus(GL_FALSE);
-}
-
-GLboolean Fence9::testFence()
-{
- if (mQuery == NULL)
- {
- return gl::error(GL_INVALID_OPERATION, GL_TRUE);
- }
-
- HRESULT result = mQuery->GetData(NULL, 0, D3DGETDATA_FLUSH);
-
- if (d3d9::isDeviceLostError(result))
- {
- mRenderer->notifyDeviceLost();
- return gl::error(GL_OUT_OF_MEMORY, GL_TRUE);
- }
-
- ASSERT(result == S_OK || result == S_FALSE);
- setStatus(result == S_OK);
- return getStatus();
-}
-
-void Fence9::finishFence()
-{
- if (mQuery == NULL)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- while (!testFence())
- {
- Sleep(0);
- }
-}
-
-void Fence9::getFenceiv(GLenum pname, GLint *params)
-{
- if (mQuery == NULL)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- switch (pname)
- {
- case GL_FENCE_STATUS_NV:
- {
- // GL_NV_fence spec:
- // Once the status of a fence has been finished (via FinishFenceNV) or tested and the returned status is TRUE (via either TestFenceNV
- // or GetFenceivNV querying the FENCE_STATUS_NV), the status remains TRUE until the next SetFenceNV of the fence.
- if (getStatus())
- {
- params[0] = GL_TRUE;
- return;
- }
-
- HRESULT result = mQuery->GetData(NULL, 0, 0);
-
- if (d3d9::isDeviceLostError(result))
- {
- params[0] = GL_TRUE;
- mRenderer->notifyDeviceLost();
- return gl::error(GL_OUT_OF_MEMORY);
- }
-
- ASSERT(result == S_OK || result == S_FALSE);
- setStatus(result == S_OK);
- params[0] = getStatus();
-
- break;
- }
- case GL_FENCE_CONDITION_NV:
- params[0] = getCondition();
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- break;
- }
-}
-
-}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/FenceImpl.h b/chromium/third_party/angle/src/libGLESv2/renderer/FenceImpl.h
index d7f2102a2e9..d54e6becd3e 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/FenceImpl.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/FenceImpl.h
@@ -17,27 +17,16 @@ namespace rx
class FenceImpl
{
public:
- FenceImpl() : mStatus(GL_FALSE), mCondition(GL_NONE) { };
+ FenceImpl() { };
virtual ~FenceImpl() { };
- virtual GLboolean isFence() = 0;
- virtual void setFence(GLenum condition) = 0;
- virtual GLboolean testFence() = 0;
- virtual void finishFence() = 0;
- virtual void getFenceiv(GLenum pname, GLint *params) = 0;
-
- protected:
- void setStatus(GLboolean status) { mStatus = status; }
- GLboolean getStatus() const { return mStatus; }
-
- void setCondition(GLuint condition) { mCondition = condition; }
- GLuint getCondition() const { return mCondition; }
+ virtual bool isSet() const = 0;
+ virtual void set() = 0;
+ virtual bool test(bool flushCommandBuffer) = 0;
+ virtual bool hasError() const = 0;
private:
DISALLOW_COPY_AND_ASSIGN(FenceImpl);
-
- GLboolean mStatus;
- GLenum mCondition;
};
}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/Image.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/Image.cpp
index 57239ef74ff..5963534e03c 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/Image.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/Image.cpp
@@ -18,531 +18,12 @@ Image::Image()
{
mWidth = 0;
mHeight = 0;
+ mDepth = 0;
mInternalFormat = GL_NONE;
mActualFormat = GL_NONE;
-}
-
-void Image::loadAlphaDataToBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned char *source = NULL;
- unsigned char *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = static_cast<const unsigned char*>(input) + y * inputPitch;
- dest = static_cast<unsigned char*>(output) + y * outputPitch;
- for (int x = 0; x < width; x++)
- {
- dest[4 * x + 0] = 0;
- dest[4 * x + 1] = 0;
- dest[4 * x + 2] = 0;
- dest[4 * x + 3] = source[x];
- }
- }
-}
-
-void Image::loadAlphaDataToNative(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned char *source = NULL;
- unsigned char *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = static_cast<const unsigned char*>(input) + y * inputPitch;
- dest = static_cast<unsigned char*>(output) + y * outputPitch;
- memcpy(dest, source, width);
- }
-}
-
-void Image::loadAlphaFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const float *source = NULL;
- float *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const float*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = reinterpret_cast<float*>(static_cast<unsigned char*>(output) + y * outputPitch);
- for (int x = 0; x < width; x++)
- {
- dest[4 * x + 0] = 0;
- dest[4 * x + 1] = 0;
- dest[4 * x + 2] = 0;
- dest[4 * x + 3] = source[x];
- }
- }
-}
-
-void Image::loadAlphaHalfFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned short *source = NULL;
- unsigned short *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = reinterpret_cast<unsigned short*>(static_cast<unsigned char*>(output) + y * outputPitch);
- for (int x = 0; x < width; x++)
- {
- dest[4 * x + 0] = 0;
- dest[4 * x + 1] = 0;
- dest[4 * x + 2] = 0;
- dest[4 * x + 3] = source[x];
- }
- }
-}
-
-void Image::loadLuminanceDataToNativeOrBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output, bool native)
-{
- const unsigned char *source = NULL;
- unsigned char *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = static_cast<const unsigned char*>(input) + y * inputPitch;
- dest = static_cast<unsigned char*>(output) + y * outputPitch;
-
- if (!native) // BGRA8 destination format
- {
- for (int x = 0; x < width; x++)
- {
- dest[4 * x + 0] = source[x];
- dest[4 * x + 1] = source[x];
- dest[4 * x + 2] = source[x];
- dest[4 * x + 3] = 0xFF;
- }
- }
- else // L8 destination format
- {
- memcpy(dest, source, width);
- }
- }
-}
-
-void Image::loadLuminanceFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const float *source = NULL;
- float *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const float*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = reinterpret_cast<float*>(static_cast<unsigned char*>(output) + y * outputPitch);
- for (int x = 0; x < width; x++)
- {
- dest[4 * x + 0] = source[x];
- dest[4 * x + 1] = source[x];
- dest[4 * x + 2] = source[x];
- dest[4 * x + 3] = 1.0f;
- }
- }
-}
-
-void Image::loadLuminanceFloatDataToRGB(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const float *source = NULL;
- float *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const float*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = reinterpret_cast<float*>(static_cast<unsigned char*>(output) + y * outputPitch);
- for (int x = 0; x < width; x++)
- {
- dest[3 * x + 0] = source[x];
- dest[3 * x + 1] = source[x];
- dest[3 * x + 2] = source[x];
- }
- }
-}
-
-void Image::loadLuminanceHalfFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned short *source = NULL;
- unsigned short *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = reinterpret_cast<unsigned short*>(static_cast<unsigned char*>(output) + y * outputPitch);
- for (int x = 0; x < width; x++)
- {
- dest[4 * x + 0] = source[x];
- dest[4 * x + 1] = source[x];
- dest[4 * x + 2] = source[x];
- dest[4 * x + 3] = 0x3C00; // SEEEEEMMMMMMMMMM, S = 0, E = 15, M = 0: 16bit flpt representation of 1
- }
- }
-}
-
-void Image::loadLuminanceAlphaDataToNativeOrBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output, bool native)
-{
- const unsigned char *source = NULL;
- unsigned char *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = static_cast<const unsigned char*>(input) + y * inputPitch;
- dest = static_cast<unsigned char*>(output) + y * outputPitch;
-
- if (!native) // BGRA8 destination format
- {
- for (int x = 0; x < width; x++)
- {
- dest[4 * x + 0] = source[2*x+0];
- dest[4 * x + 1] = source[2*x+0];
- dest[4 * x + 2] = source[2*x+0];
- dest[4 * x + 3] = source[2*x+1];
- }
- }
- else
- {
- memcpy(dest, source, width * 2);
- }
- }
-}
-
-void Image::loadLuminanceAlphaFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const float *source = NULL;
- float *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const float*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = reinterpret_cast<float*>(static_cast<unsigned char*>(output) + y * outputPitch);
- for (int x = 0; x < width; x++)
- {
- dest[4 * x + 0] = source[2*x+0];
- dest[4 * x + 1] = source[2*x+0];
- dest[4 * x + 2] = source[2*x+0];
- dest[4 * x + 3] = source[2*x+1];
- }
- }
-}
-
-void Image::loadLuminanceAlphaHalfFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned short *source = NULL;
- unsigned short *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = reinterpret_cast<unsigned short*>(static_cast<unsigned char*>(output) + y * outputPitch);
- for (int x = 0; x < width; x++)
- {
- dest[4 * x + 0] = source[2*x+0];
- dest[4 * x + 1] = source[2*x+0];
- dest[4 * x + 2] = source[2*x+0];
- dest[4 * x + 3] = source[2*x+1];
- }
- }
-}
-
-void Image::loadRGBUByteDataToBGRX(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned char *source = NULL;
- unsigned char *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = static_cast<const unsigned char*>(input) + y * inputPitch;
- dest = static_cast<unsigned char*>(output) + y * outputPitch;
- for (int x = 0; x < width; x++)
- {
- dest[4 * x + 0] = source[x * 3 + 2];
- dest[4 * x + 1] = source[x * 3 + 1];
- dest[4 * x + 2] = source[x * 3 + 0];
- dest[4 * x + 3] = 0xFF;
- }
- }
-}
-
-void Image::loadRGBUByteDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned char *source = NULL;
- unsigned char *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = static_cast<const unsigned char*>(input) + y * inputPitch;
- dest = static_cast<unsigned char*>(output) + y * outputPitch;
- for (int x = 0; x < width; x++)
- {
- dest[4 * x + 0] = source[x * 3 + 0];
- dest[4 * x + 1] = source[x * 3 + 1];
- dest[4 * x + 2] = source[x * 3 + 2];
- dest[4 * x + 3] = 0xFF;
- }
- }
-}
-
-void Image::loadRGB565DataToBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned short *source = NULL;
- unsigned char *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = static_cast<unsigned char*>(output) + y * outputPitch;
- for (int x = 0; x < width; x++)
- {
- unsigned short rgba = source[x];
- dest[4 * x + 0] = ((rgba & 0x001F) << 3) | ((rgba & 0x001F) >> 2);
- dest[4 * x + 1] = ((rgba & 0x07E0) >> 3) | ((rgba & 0x07E0) >> 9);
- dest[4 * x + 2] = ((rgba & 0xF800) >> 8) | ((rgba & 0xF800) >> 13);
- dest[4 * x + 3] = 0xFF;
- }
- }
-}
-
-void Image::loadRGB565DataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned short *source = NULL;
- unsigned char *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = static_cast<unsigned char*>(output) + y * outputPitch;
- for (int x = 0; x < width; x++)
- {
- unsigned short rgba = source[x];
- dest[4 * x + 0] = ((rgba & 0xF800) >> 8) | ((rgba & 0xF800) >> 13);
- dest[4 * x + 1] = ((rgba & 0x07E0) >> 3) | ((rgba & 0x07E0) >> 9);
- dest[4 * x + 2] = ((rgba & 0x001F) << 3) | ((rgba & 0x001F) >> 2);
- dest[4 * x + 3] = 0xFF;
- }
- }
-}
-
-void Image::loadRGBFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const float *source = NULL;
- float *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const float*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = reinterpret_cast<float*>(static_cast<unsigned char*>(output) + y * outputPitch);
- for (int x = 0; x < width; x++)
- {
- dest[4 * x + 0] = source[x * 3 + 0];
- dest[4 * x + 1] = source[x * 3 + 1];
- dest[4 * x + 2] = source[x * 3 + 2];
- dest[4 * x + 3] = 1.0f;
- }
- }
-}
-
-void Image::loadRGBFloatDataToNative(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const float *source = NULL;
- float *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const float*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = reinterpret_cast<float*>(static_cast<unsigned char*>(output) + y * outputPitch);
- memcpy(dest, source, width * 12);
- }
-}
-
-void Image::loadRGBHalfFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned short *source = NULL;
- unsigned short *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = reinterpret_cast<unsigned short*>(static_cast<unsigned char*>(output) + y * outputPitch);
- for (int x = 0; x < width; x++)
- {
- dest[4 * x + 0] = source[x * 3 + 0];
- dest[4 * x + 1] = source[x * 3 + 1];
- dest[4 * x + 2] = source[x * 3 + 2];
- dest[4 * x + 3] = 0x3C00; // SEEEEEMMMMMMMMMM, S = 0, E = 15, M = 0: 16bit flpt representation of 1
- }
- }
-}
-
-void Image::loadRGBAUByteDataToBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned int *source = NULL;
- unsigned int *dest = NULL;
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const unsigned int*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = reinterpret_cast<unsigned int*>(static_cast<unsigned char*>(output) + y * outputPitch);
-
- for (int x = 0; x < width; x++)
- {
- unsigned int rgba = source[x];
- dest[x] = (_rotl(rgba, 16) & 0x00ff00ff) | (rgba & 0xff00ff00);
- }
- }
-}
-
-void Image::loadRGBAUByteDataToNative(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned int *source = NULL;
- unsigned int *dest = NULL;
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const unsigned int*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = reinterpret_cast<unsigned int*>(static_cast<unsigned char*>(output) + y * outputPitch);
-
- memcpy(dest, source, width * 4);
- }
-}
-
-void Image::loadRGBA4444DataToBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned short *source = NULL;
- unsigned char *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = static_cast<unsigned char*>(output) + y * outputPitch;
- for (int x = 0; x < width; x++)
- {
- unsigned short rgba = source[x];
- dest[4 * x + 0] = ((rgba & 0x00F0) << 0) | ((rgba & 0x00F0) >> 4);
- dest[4 * x + 1] = ((rgba & 0x0F00) >> 4) | ((rgba & 0x0F00) >> 8);
- dest[4 * x + 2] = ((rgba & 0xF000) >> 8) | ((rgba & 0xF000) >> 12);
- dest[4 * x + 3] = ((rgba & 0x000F) << 4) | ((rgba & 0x000F) >> 0);
- }
- }
-}
-
-void Image::loadRGBA4444DataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned short *source = NULL;
- unsigned char *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = static_cast<unsigned char*>(output) + y * outputPitch;
- for (int x = 0; x < width; x++)
- {
- unsigned short rgba = source[x];
- dest[4 * x + 0] = ((rgba & 0xF000) >> 8) | ((rgba & 0xF000) >> 12);
- dest[4 * x + 1] = ((rgba & 0x0F00) >> 4) | ((rgba & 0x0F00) >> 8);
- dest[4 * x + 2] = ((rgba & 0x00F0) << 0) | ((rgba & 0x00F0) >> 4);
- dest[4 * x + 3] = ((rgba & 0x000F) << 4) | ((rgba & 0x000F) >> 0);
- }
- }
-}
-
-void Image::loadRGBA5551DataToBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned short *source = NULL;
- unsigned char *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = static_cast<unsigned char*>(output) + y * outputPitch;
- for (int x = 0; x < width; x++)
- {
- unsigned short rgba = source[x];
- dest[4 * x + 0] = ((rgba & 0x003E) << 2) | ((rgba & 0x003E) >> 3);
- dest[4 * x + 1] = ((rgba & 0x07C0) >> 3) | ((rgba & 0x07C0) >> 8);
- dest[4 * x + 2] = ((rgba & 0xF800) >> 8) | ((rgba & 0xF800) >> 13);
- dest[4 * x + 3] = (rgba & 0x0001) ? 0xFF : 0;
- }
- }
-}
-
-void Image::loadRGBA5551DataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned short *source = NULL;
- unsigned char *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = static_cast<unsigned char*>(output) + y * outputPitch;
- for (int x = 0; x < width; x++)
- {
- unsigned short rgba = source[x];
- dest[4 * x + 0] = ((rgba & 0xF800) >> 8) | ((rgba & 0xF800) >> 13);
- dest[4 * x + 1] = ((rgba & 0x07C0) >> 3) | ((rgba & 0x07C0) >> 8);
- dest[4 * x + 2] = ((rgba & 0x003E) << 2) | ((rgba & 0x003E) >> 3);
- dest[4 * x + 3] = (rgba & 0x0001) ? 0xFF : 0;
- }
- }
-}
-
-void Image::loadRGBAFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const float *source = NULL;
- float *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const float*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = reinterpret_cast<float*>(static_cast<unsigned char*>(output) + y * outputPitch);
- memcpy(dest, source, width * 16);
- }
-}
-
-void Image::loadRGBAHalfFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned char *source = NULL;
- unsigned char *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = static_cast<const unsigned char*>(input) + y * inputPitch;
- dest = static_cast<unsigned char*>(output) + y * outputPitch;
- memcpy(dest, source, width * 8);
- }
-}
-
-void Image::loadBGRADataToBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned char *source = NULL;
- unsigned char *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = static_cast<const unsigned char*>(input) + y * inputPitch;
- dest = static_cast<unsigned char*>(output) + y * outputPitch;
- memcpy(dest, source, width*4);
- }
+ mTarget = GL_NONE;
+ mRenderable = false;
+ mDirty = false;
}
}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/Image.h b/chromium/third_party/angle/src/libGLESv2/renderer/Image.h
index 454e83e21e6..73e4e843d7d 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/Image.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/Image.h
@@ -23,6 +23,8 @@ namespace rx
class Renderer;
class TextureStorageInterface2D;
class TextureStorageInterfaceCube;
+class TextureStorageInterface3D;
+class TextureStorageInterface2DArray;
class Image
{
@@ -32,8 +34,11 @@ class Image
GLsizei getWidth() const { return mWidth; }
GLsizei getHeight() const { return mHeight; }
+ GLsizei getDepth() const { return mDepth; }
GLenum getInternalFormat() const { return mInternalFormat; }
GLenum getActualFormat() const { return mActualFormat; }
+ GLenum getTarget() const { return mTarget; }
+ bool isRenderableFormat() const { return mRenderable; }
void markDirty() {mDirty = true;}
void markClean() {mDirty = false;}
@@ -41,84 +46,30 @@ class Image
virtual void setManagedSurface(TextureStorageInterface2D *storage, int level) {};
virtual void setManagedSurface(TextureStorageInterfaceCube *storage, int face, int level) {};
- virtual bool updateSurface(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) = 0;
- virtual bool updateSurface(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) = 0;
-
- virtual bool redefine(Renderer *renderer, GLint internalformat, GLsizei width, GLsizei height, bool forceRelease) = 0;
-
- virtual bool isRenderableFormat() const = 0;
-
- virtual void loadData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
- GLint unpackAlignment, const void *input) = 0;
- virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ virtual void setManagedSurface(TextureStorageInterface3D *storage, int level) {};
+ virtual void setManagedSurface(TextureStorageInterface2DArray *storage, int layer, int level) {};
+ virtual bool copyToStorage(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) = 0;
+ virtual bool copyToStorage(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) = 0;
+ virtual bool copyToStorage(TextureStorageInterface3D *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth) = 0;
+ virtual bool copyToStorage(TextureStorageInterface2DArray *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height) = 0;
+
+ virtual bool redefine(Renderer *renderer, GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, bool forceRelease) = 0;
+
+ virtual void loadData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
+ GLint unpackAlignment, GLenum type, const void *input) = 0;
+ virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
const void *input) = 0;
- virtual void copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source) = 0;
-
- static void loadAlphaDataToBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadAlphaDataToNative(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadAlphaDataToBGRASSE2(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadAlphaFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadAlphaHalfFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadLuminanceDataToNativeOrBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output, bool native);
- static void loadLuminanceFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadLuminanceFloatDataToRGB(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadLuminanceHalfFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadLuminanceAlphaDataToNativeOrBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output, bool native);
- static void loadLuminanceAlphaFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadLuminanceAlphaHalfFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGBUByteDataToBGRX(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGBUByteDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGB565DataToBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGB565DataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGBFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGBFloatDataToNative(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGBHalfFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGBAUByteDataToBGRASSE2(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGBAUByteDataToBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGBAUByteDataToNative(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGBA4444DataToBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGBA4444DataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGBA5551DataToBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGBA5551DataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGBAFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGBAHalfFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadBGRADataToBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
+ virtual void copy(GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source) = 0;
protected:
GLsizei mWidth;
GLsizei mHeight;
- GLint mInternalFormat;
+ GLsizei mDepth;
+ GLenum mInternalFormat;
GLenum mActualFormat;
+ bool mRenderable;
+ GLenum mTarget;
bool mDirty;
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/Image11.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/Image11.cpp
deleted file mode 100644
index 09c8922d073..00000000000
--- a/chromium/third_party/angle/src/libGLESv2/renderer/Image11.cpp
+++ /dev/null
@@ -1,457 +0,0 @@
-#include "precompiled.h"
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// Image11.h: Implements the rx::Image11 class, which acts as the interface to
-// the actual underlying resources of a Texture
-
-#include "libGLESv2/renderer/Renderer11.h"
-#include "libGLESv2/renderer/Image11.h"
-#include "libGLESv2/renderer/TextureStorage11.h"
-#include "libGLESv2/Framebuffer.h"
-#include "libGLESv2/Renderbuffer.h"
-
-#include "libGLESv2/main.h"
-#include "libGLESv2/utilities.h"
-#include "libGLESv2/renderer/renderer11_utils.h"
-#include "libGLESv2/renderer/generatemip.h"
-
-namespace rx
-{
-
-Image11::Image11()
-{
- mStagingTexture = NULL;
- mRenderer = NULL;
- mDXGIFormat = DXGI_FORMAT_UNKNOWN;
-}
-
-Image11::~Image11()
-{
- if (mStagingTexture)
- {
- mStagingTexture->Release();
- }
-}
-
-Image11 *Image11::makeImage11(Image *img)
-{
- ASSERT(HAS_DYNAMIC_TYPE(rx::Image11*, img));
- return static_cast<rx::Image11*>(img);
-}
-
-void Image11::generateMipmap(Image11 *dest, Image11 *src)
-{
- ASSERT(src->getDXGIFormat() == dest->getDXGIFormat());
- ASSERT(src->getWidth() == 1 || src->getWidth() / 2 == dest->getWidth());
- ASSERT(src->getHeight() == 1 || src->getHeight() / 2 == dest->getHeight());
-
- D3D11_MAPPED_SUBRESOURCE destMapped, srcMapped;
- dest->map(D3D11_MAP_WRITE, &destMapped);
- src->map(D3D11_MAP_READ, &srcMapped);
-
- const unsigned char *sourceData = reinterpret_cast<const unsigned char*>(srcMapped.pData);
- unsigned char *destData = reinterpret_cast<unsigned char*>(destMapped.pData);
-
- if (sourceData && destData)
- {
- switch (src->getDXGIFormat())
- {
- case DXGI_FORMAT_R8G8B8A8_UNORM:
- case DXGI_FORMAT_B8G8R8A8_UNORM:
- GenerateMip<R8G8B8A8>(src->getWidth(), src->getHeight(), sourceData, srcMapped.RowPitch, destData, destMapped.RowPitch);
- break;
- case DXGI_FORMAT_A8_UNORM:
- GenerateMip<A8>(src->getWidth(), src->getHeight(), sourceData, srcMapped.RowPitch, destData, destMapped.RowPitch);
- break;
- case DXGI_FORMAT_R8_UNORM:
- GenerateMip<R8>(src->getWidth(), src->getHeight(), sourceData, srcMapped.RowPitch, destData, destMapped.RowPitch);
- break;
- case DXGI_FORMAT_R32G32B32A32_FLOAT:
- GenerateMip<A32B32G32R32F>(src->getWidth(), src->getHeight(), sourceData, srcMapped.RowPitch, destData, destMapped.RowPitch);
- break;
- case DXGI_FORMAT_R32G32B32_FLOAT:
- GenerateMip<R32G32B32F>(src->getWidth(), src->getHeight(), sourceData, srcMapped.RowPitch, destData, destMapped.RowPitch);
- break;
- case DXGI_FORMAT_R16G16B16A16_FLOAT:
- GenerateMip<A16B16G16R16F>(src->getWidth(), src->getHeight(), sourceData, srcMapped.RowPitch, destData, destMapped.RowPitch);
- break;
- case DXGI_FORMAT_R8G8_UNORM:
- GenerateMip<R8G8>(src->getWidth(), src->getHeight(), sourceData, srcMapped.RowPitch, destData, destMapped.RowPitch);
- break;
- case DXGI_FORMAT_R16_FLOAT:
- GenerateMip<R16F>(src->getWidth(), src->getHeight(), sourceData, srcMapped.RowPitch, destData, destMapped.RowPitch);
- break;
- case DXGI_FORMAT_R16G16_FLOAT:
- GenerateMip<R16G16F>(src->getWidth(), src->getHeight(), sourceData, srcMapped.RowPitch, destData, destMapped.RowPitch);
- break;
- case DXGI_FORMAT_R32_FLOAT:
- GenerateMip<R32F>(src->getWidth(), src->getHeight(), sourceData, srcMapped.RowPitch, destData, destMapped.RowPitch);
- break;
- case DXGI_FORMAT_R32G32_FLOAT:
- GenerateMip<R32G32F>(src->getWidth(), src->getHeight(), sourceData, srcMapped.RowPitch, destData, destMapped.RowPitch);
- break;
- default:
- UNREACHABLE();
- break;
- }
-
- dest->unmap();
- src->unmap();
- }
-
- dest->markDirty();
-}
-
-bool Image11::isDirty() const
-{
- return (mStagingTexture && mDirty);
-}
-
-bool Image11::updateSurface(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
-{
- TextureStorage11_2D *storage11 = TextureStorage11_2D::makeTextureStorage11_2D(storage->getStorageInstance());
- return storage11->updateSubresourceLevel(getStagingTexture(), getStagingSubresource(), level, 0, xoffset, yoffset, width, height);
-}
-
-bool Image11::updateSurface(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
-{
- TextureStorage11_Cube *storage11 = TextureStorage11_Cube::makeTextureStorage11_Cube(storage->getStorageInstance());
- return storage11->updateSubresourceLevel(getStagingTexture(), getStagingSubresource(), level, face, xoffset, yoffset, width, height);
-}
-
-bool Image11::redefine(Renderer *renderer, GLint internalformat, GLsizei width, GLsizei height, bool forceRelease)
-{
- if (mWidth != width ||
- mHeight != height ||
- mInternalFormat != internalformat ||
- forceRelease)
- {
- mRenderer = Renderer11::makeRenderer11(renderer);
-
- mWidth = width;
- mHeight = height;
- mInternalFormat = internalformat;
- // compute the d3d format that will be used
- mDXGIFormat = gl_d3d11::ConvertTextureFormat(internalformat);
- mActualFormat = d3d11_gl::ConvertTextureInternalFormat(mDXGIFormat);
-
- if (mStagingTexture)
- {
- mStagingTexture->Release();
- mStagingTexture = NULL;
- }
-
- return true;
- }
-
- return false;
-}
-
-bool Image11::isRenderableFormat() const
-{
- return TextureStorage11::IsTextureFormatRenderable(mDXGIFormat);
-}
-
-DXGI_FORMAT Image11::getDXGIFormat() const
-{
- // this should only happen if the image hasn't been redefined first
- // which would be a bug by the caller
- ASSERT(mDXGIFormat != DXGI_FORMAT_UNKNOWN);
-
- return mDXGIFormat;
-}
-
-// Store the pixel rectangle designated by xoffset,yoffset,width,height with pixels stored as format/type at input
-// into the target pixel rectangle.
-void Image11::loadData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
- GLint unpackAlignment, const void *input)
-{
- D3D11_MAPPED_SUBRESOURCE mappedImage;
- HRESULT result = map(D3D11_MAP_WRITE, &mappedImage);
- if (FAILED(result))
- {
- ERR("Could not map image for loading.");
- return;
- }
-
- GLsizei inputPitch = gl::ComputePitch(width, mInternalFormat, unpackAlignment);
- size_t pixelSize = d3d11::ComputePixelSizeBits(mDXGIFormat) / 8;
- void* offsetMappedData = (void*)((BYTE *)mappedImage.pData + (yoffset * mappedImage.RowPitch + xoffset * pixelSize));
-
- switch (mInternalFormat)
- {
- case GL_ALPHA8_EXT:
- loadAlphaDataToNative(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_LUMINANCE8_EXT:
- loadLuminanceDataToNativeOrBGRA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData, false);
- break;
- case GL_ALPHA32F_EXT:
- loadAlphaFloatDataToRGBA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_LUMINANCE32F_EXT:
- loadLuminanceFloatDataToRGBA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_ALPHA16F_EXT:
- loadAlphaHalfFloatDataToRGBA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_LUMINANCE16F_EXT:
- loadLuminanceHalfFloatDataToRGBA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_LUMINANCE8_ALPHA8_EXT:
- loadLuminanceAlphaDataToNativeOrBGRA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData, false);
- break;
- case GL_LUMINANCE_ALPHA32F_EXT:
- loadLuminanceAlphaFloatDataToRGBA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_LUMINANCE_ALPHA16F_EXT:
- loadLuminanceAlphaHalfFloatDataToRGBA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_RGB8_OES:
- loadRGBUByteDataToRGBA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_RGB565:
- loadRGB565DataToRGBA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_RGBA8_OES:
- loadRGBAUByteDataToNative(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_RGBA4:
- loadRGBA4444DataToRGBA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_RGB5_A1:
- loadRGBA5551DataToRGBA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_BGRA8_EXT:
- loadBGRADataToBGRA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_RGB32F_EXT:
- loadRGBFloatDataToRGBA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_RGB16F_EXT:
- loadRGBHalfFloatDataToRGBA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_RGBA32F_EXT:
- loadRGBAFloatDataToRGBA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_RGBA16F_EXT:
- loadRGBAHalfFloatDataToRGBA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- default: UNREACHABLE();
- }
-
- unmap();
-}
-
-void Image11::loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
- const void *input)
-{
- ASSERT(xoffset % 4 == 0);
- ASSERT(yoffset % 4 == 0);
-
- D3D11_MAPPED_SUBRESOURCE mappedImage;
- HRESULT result = map(D3D11_MAP_WRITE, &mappedImage);
- if (FAILED(result))
- {
- ERR("Could not map image for loading.");
- return;
- }
-
- // Size computation assumes a 4x4 block compressed texture format
- size_t blockSize = d3d11::ComputeBlockSizeBits(mDXGIFormat) / 8;
- void* offsetMappedData = (void*)((BYTE *)mappedImage.pData + ((yoffset / 4) * mappedImage.RowPitch + (xoffset / 4) * blockSize));
-
- GLsizei inputSize = gl::ComputeCompressedSize(width, height, mInternalFormat);
- GLsizei inputPitch = gl::ComputeCompressedPitch(width, mInternalFormat);
- int rows = inputSize / inputPitch;
- for (int i = 0; i < rows; ++i)
- {
- memcpy((void*)((BYTE*)offsetMappedData + i * mappedImage.RowPitch), (void*)((BYTE*)input + i * inputPitch), inputPitch);
- }
-
- unmap();
-}
-
-void Image11::copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source)
-{
- gl::Renderbuffer *colorbuffer = source->getReadColorbuffer();
-
- if (colorbuffer && colorbuffer->getActualFormat() == (GLuint)mActualFormat)
- {
- // No conversion needed-- use copyback fastpath
- ID3D11Texture2D *colorBufferTexture = NULL;
- unsigned int subresourceIndex = 0;
-
- if (mRenderer->getRenderTargetResource(colorbuffer, &subresourceIndex, &colorBufferTexture))
- {
- D3D11_TEXTURE2D_DESC textureDesc;
- colorBufferTexture->GetDesc(&textureDesc);
-
- ID3D11Device *device = mRenderer->getDevice();
- ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
-
- ID3D11Texture2D* srcTex = NULL;
- if (textureDesc.SampleDesc.Count > 1)
- {
- D3D11_TEXTURE2D_DESC resolveDesc;
- resolveDesc.Width = textureDesc.Width;
- resolveDesc.Height = textureDesc.Height;
- resolveDesc.MipLevels = 1;
- resolveDesc.ArraySize = 1;
- resolveDesc.Format = textureDesc.Format;
- resolveDesc.SampleDesc.Count = 1;
- resolveDesc.SampleDesc.Quality = 0;
- resolveDesc.Usage = D3D11_USAGE_DEFAULT;
- resolveDesc.BindFlags = 0;
- resolveDesc.CPUAccessFlags = 0;
- resolveDesc.MiscFlags = 0;
-
- HRESULT result = device->CreateTexture2D(&resolveDesc, NULL, &srcTex);
- if (FAILED(result))
- {
- ERR("Failed to create resolve texture for Image11::copy, HRESULT: 0x%X.", result);
- return;
- }
-
- deviceContext->ResolveSubresource(srcTex, 0, colorBufferTexture, subresourceIndex, textureDesc.Format);
- subresourceIndex = 0;
- }
- else
- {
- srcTex = colorBufferTexture;
- srcTex->AddRef();
- }
-
- D3D11_BOX srcBox;
- srcBox.left = x;
- srcBox.right = x + width;
- srcBox.top = y;
- srcBox.bottom = y + height;
- srcBox.front = 0;
- srcBox.back = 1;
-
- deviceContext->CopySubresourceRegion(mStagingTexture, 0, xoffset, yoffset, 0, srcTex, subresourceIndex, &srcBox);
-
- srcTex->Release();
- colorBufferTexture->Release();
- }
- }
- else
- {
- // This format requires conversion, so we must copy the texture to staging and manually convert via readPixels
- D3D11_MAPPED_SUBRESOURCE mappedImage;
- HRESULT result = map(D3D11_MAP_WRITE, &mappedImage);
-
- // determine the offset coordinate into the destination buffer
- GLsizei rowOffset = gl::ComputePixelSize(mActualFormat) * xoffset;
- void *dataOffset = static_cast<unsigned char*>(mappedImage.pData) + mappedImage.RowPitch * yoffset + rowOffset;
-
- mRenderer->readPixels(source, x, y, width, height, gl::ExtractFormat(mInternalFormat),
- gl::ExtractType(mInternalFormat), mappedImage.RowPitch, false, 4, dataOffset);
-
- unmap();
- }
-}
-
-ID3D11Texture2D *Image11::getStagingTexture()
-{
- createStagingTexture();
-
- return mStagingTexture;
-}
-
-unsigned int Image11::getStagingSubresource()
-{
- createStagingTexture();
-
- return mStagingSubresource;
-}
-
-void Image11::createStagingTexture()
-{
- if (mStagingTexture)
- {
- return;
- }
-
- ID3D11Texture2D *newTexture = NULL;
- int lodOffset = 1;
- const DXGI_FORMAT dxgiFormat = getDXGIFormat();
- ASSERT(!d3d11::IsDepthStencilFormat(dxgiFormat)); // We should never get here for depth textures
-
- if (mWidth != 0 && mHeight != 0)
- {
- GLsizei width = mWidth;
- GLsizei height = mHeight;
-
- // adjust size if needed for compressed textures
- gl::MakeValidSize(false, d3d11::IsCompressed(dxgiFormat), &width, &height, &lodOffset);
- ID3D11Device *device = mRenderer->getDevice();
-
- D3D11_TEXTURE2D_DESC desc;
- desc.Width = width;
- desc.Height = height;
- desc.MipLevels = lodOffset + 1;
- desc.ArraySize = 1;
- desc.Format = dxgiFormat;
- desc.SampleDesc.Count = 1;
- desc.SampleDesc.Quality = 0;
- desc.Usage = D3D11_USAGE_STAGING;
- desc.BindFlags = 0;
- desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
- desc.MiscFlags = 0;
-
- HRESULT result = device->CreateTexture2D(&desc, NULL, &newTexture);
-
- if (FAILED(result))
- {
- ASSERT(result == E_OUTOFMEMORY);
- ERR("Creating image failed.");
- return gl::error(GL_OUT_OF_MEMORY);
- }
- }
-
- mStagingTexture = newTexture;
- mStagingSubresource = D3D11CalcSubresource(lodOffset, 0, lodOffset + 1);
- mDirty = false;
-}
-
-HRESULT Image11::map(D3D11_MAP mapType, D3D11_MAPPED_SUBRESOURCE *map)
-{
- createStagingTexture();
-
- HRESULT result = E_FAIL;
-
- if (mStagingTexture)
- {
- ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
- result = deviceContext->Map(mStagingTexture, mStagingSubresource, mapType, 0, map);
-
- // this can fail if the device is removed (from TDR)
- if (d3d11::isDeviceLostError(result))
- {
- mRenderer->notifyDeviceLost();
- }
- else if (SUCCEEDED(result))
- {
- mDirty = true;
- }
- }
-
- return result;
-}
-
-void Image11::unmap()
-{
- if (mStagingTexture)
- {
- ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
- deviceContext->Unmap(mStagingTexture, mStagingSubresource);
- }
-}
-
-}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/ImageSSE2.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/ImageSSE2.cpp
deleted file mode 100644
index b2a90ca9611..00000000000
--- a/chromium/third_party/angle/src/libGLESv2/renderer/ImageSSE2.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-#include "precompiled.h"
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// ImageSSE2.cpp: Implements SSE2-based functions of rx::Image class. It's
-// in a separated file for GCC, which can enable SSE usage only per-file,
-// not for code blocks that use SSE2 explicitly.
-
-#include "libGLESv2/Texture.h"
-#include "libGLESv2/renderer/Image.h"
-
-namespace rx
-{
-
-void Image::loadRGBAUByteDataToBGRASSE2(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned int *source = NULL;
- unsigned int *dest = NULL;
- __m128i brMask = _mm_set1_epi32(0x00ff00ff);
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const unsigned int*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = reinterpret_cast<unsigned int*>(static_cast<unsigned char*>(output) + y * outputPitch);
- int x = 0;
-
- // Make output writes aligned
- for (x = 0; ((reinterpret_cast<intptr_t>(&dest[x]) & 15) != 0) && x < width; x++)
- {
- unsigned int rgba = source[x];
- dest[x] = (_rotl(rgba, 16) & 0x00ff00ff) | (rgba & 0xff00ff00);
- }
-
- for (; x + 3 < width; x += 4)
- {
- __m128i sourceData = _mm_loadu_si128(reinterpret_cast<const __m128i*>(&source[x]));
- // Mask out g and a, which don't change
- __m128i gaComponents = _mm_andnot_si128(brMask, sourceData);
- // Mask out b and r
- __m128i brComponents = _mm_and_si128(sourceData, brMask);
- // Swap b and r
- __m128i brSwapped = _mm_shufflehi_epi16(_mm_shufflelo_epi16(brComponents, _MM_SHUFFLE(2, 3, 0, 1)), _MM_SHUFFLE(2, 3, 0, 1));
- __m128i result = _mm_or_si128(gaComponents, brSwapped);
- _mm_store_si128(reinterpret_cast<__m128i*>(&dest[x]), result);
- }
-
- // Perform leftover writes
- for (; x < width; x++)
- {
- unsigned int rgba = source[x];
- dest[x] = (_rotl(rgba, 16) & 0x00ff00ff) | (rgba & 0xff00ff00);
- }
- }
-}
-
-void Image::loadAlphaDataToBGRASSE2(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned char *source = NULL;
- unsigned int *dest = NULL;
- __m128i zeroWide = _mm_setzero_si128();
-
- for (int y = 0; y < height; y++)
- {
- source = static_cast<const unsigned char*>(input) + y * inputPitch;
- dest = reinterpret_cast<unsigned int*>(static_cast<unsigned char*>(output) + y * outputPitch);
-
- int x;
- // Make output writes aligned
- for (x = 0; ((reinterpret_cast<intptr_t>(&dest[x]) & 0xF) != 0 && x < width); x++)
- {
- dest[x] = static_cast<unsigned int>(source[x]) << 24;
- }
-
- for (; x + 7 < width; x += 8)
- {
- __m128i sourceData = _mm_loadl_epi64(reinterpret_cast<const __m128i*>(&source[x]));
- // Interleave each byte to 16bit, make the lower byte to zero
- sourceData = _mm_unpacklo_epi8(zeroWide, sourceData);
- // Interleave each 16bit to 32bit, make the lower 16bit to zero
- __m128i lo = _mm_unpacklo_epi16(zeroWide, sourceData);
- __m128i hi = _mm_unpackhi_epi16(zeroWide, sourceData);
-
- _mm_store_si128(reinterpret_cast<__m128i*>(&dest[x]), lo);
- _mm_store_si128(reinterpret_cast<__m128i*>(&dest[x + 4]), hi);
- }
-
- // Handle the remainder
- for (; x < width; x++)
- {
- dest[x] = static_cast<unsigned int>(source[x]) << 24;
- }
- }
-}
-
-}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/IndexBuffer.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/IndexBuffer.cpp
index 37dbd3e1952..7fe2a3abe7c 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/IndexBuffer.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/IndexBuffer.cpp
@@ -194,4 +194,3 @@ IndexRangeCache *StaticIndexBufferInterface::getIndexRangeCache()
}
}
-
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/IndexDataManager.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/IndexDataManager.cpp
index 49bace81932..b8c7fa977c0 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/IndexDataManager.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/IndexDataManager.cpp
@@ -13,7 +13,7 @@
#include "libGLESv2/Buffer.h"
#include "libGLESv2/main.h"
-#include "libGLESv2/utilities.h"
+#include "libGLESv2/formatutils.h"
#include "libGLESv2/renderer/IndexBuffer.h"
namespace rx
@@ -138,7 +138,7 @@ GLenum IndexDataManager::prepareIndexData(GLenum type, GLsizei count, gl::Buffer
default: UNREACHABLE(); alignedOffset = false;
}
- unsigned int typeSize = gl::ComputeTypeSize(type);
+ unsigned int typeSize = gl::GetTypeBytes(type);
// check for integer overflows
if (static_cast<unsigned int>(count) > (std::numeric_limits<unsigned int>::max() / typeSize) ||
@@ -167,7 +167,6 @@ GLenum IndexDataManager::prepareIndexData(GLenum type, GLsizei count, gl::Buffer
{
indexBuffer = streamingBuffer;
streamOffset = offset;
- storage->markBufferUsage();
if (!buffer->getIndexRangeCache()->findRange(type, offset, count, &translated->minIndex,
&translated->maxIndex, NULL))
@@ -180,10 +179,11 @@ GLenum IndexDataManager::prepareIndexData(GLenum type, GLsizei count, gl::Buffer
else if (staticBuffer && staticBuffer->getBufferSize() != 0 && staticBuffer->getIndexType() == type && alignedOffset)
{
indexBuffer = staticBuffer;
+
if (!staticBuffer->getIndexRangeCache()->findRange(type, offset, count, &translated->minIndex,
&translated->maxIndex, &streamOffset))
{
- streamOffset = (offset / gl::ComputeTypeSize(type)) * gl::ComputeTypeSize(destinationIndexType);
+ streamOffset = (offset / gl::GetTypeBytes(type)) * gl::GetTypeBytes(destinationIndexType);
computeRange(type, indices, count, &translated->minIndex, &translated->maxIndex);
staticBuffer->getIndexRangeCache()->addRange(type, offset, count, translated->minIndex,
translated->maxIndex, streamOffset);
@@ -198,7 +198,7 @@ GLenum IndexDataManager::prepareIndexData(GLenum type, GLsizei count, gl::Buffer
if (staticBuffer->getBufferSize() == 0 && alignedOffset)
{
indexBuffer = staticBuffer;
- convertCount = storage->getSize() / gl::ComputeTypeSize(type);
+ convertCount = storage->getSize() / gl::GetTypeBytes(type);
}
else
{
@@ -213,7 +213,7 @@ GLenum IndexDataManager::prepareIndexData(GLenum type, GLsizei count, gl::Buffer
return GL_INVALID_OPERATION;
}
- unsigned int indexTypeSize = gl::ComputeTypeSize(destinationIndexType);
+ unsigned int indexTypeSize = gl::GetTypeBytes(destinationIndexType);
if (convertCount > std::numeric_limits<unsigned int>::max() / indexTypeSize)
{
ERR("Reserving %u indicies of %u bytes each exceeds the maximum buffer size.", convertCount, indexTypeSize);
@@ -246,7 +246,7 @@ GLenum IndexDataManager::prepareIndexData(GLenum type, GLsizei count, gl::Buffer
if (staticBuffer)
{
- streamOffset = (offset / gl::ComputeTypeSize(type)) * gl::ComputeTypeSize(destinationIndexType);
+ streamOffset = (offset / gl::GetTypeBytes(type)) * gl::GetTypeBytes(destinationIndexType);
staticBuffer->getIndexRangeCache()->addRange(type, offset, count, translated->minIndex,
translated->maxIndex, streamOffset);
}
@@ -255,12 +255,12 @@ GLenum IndexDataManager::prepareIndexData(GLenum type, GLsizei count, gl::Buffer
translated->storage = directStorage ? storage : NULL;
translated->indexBuffer = indexBuffer->getIndexBuffer();
translated->serial = directStorage ? storage->getSerial() : indexBuffer->getSerial();
- translated->startIndex = streamOffset / gl::ComputeTypeSize(destinationIndexType);
+ translated->startIndex = streamOffset / gl::GetTypeBytes(destinationIndexType);
translated->startOffset = streamOffset;
if (buffer)
{
- buffer->promoteStaticUsage(count * gl::ComputeTypeSize(type));
+ buffer->promoteStaticUsage(count * gl::GetTypeBytes(type));
}
return GL_NO_ERROR;
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/IndexRangeCache.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/IndexRangeCache.cpp
index 610a5efb9c4..14410d0245e 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/IndexRangeCache.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/IndexRangeCache.cpp
@@ -9,8 +9,8 @@
// ranges of indices.
#include "libGLESv2/renderer/IndexRangeCache.h"
+#include "libGLESv2/formatutils.h"
#include "common/debug.h"
-#include "libGLESv2/utilities.h"
#include <tuple>
namespace rx
@@ -31,7 +31,7 @@ void IndexRangeCache::invalidateRange(unsigned int offset, unsigned int size)
while (i != mIndexRangeCache.end())
{
unsigned int rangeStart = i->second.streamOffset;
- unsigned int rangeEnd = i->second.streamOffset + (gl::ComputeTypeSize(i->first.type) * i->first.count);
+ unsigned int rangeEnd = i->second.streamOffset + (gl::GetTypeBytes(i->first.type) * i->first.count);
if (invalidateEnd < rangeStart || invalidateStart > rangeEnd)
{
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/IndexRangeCache.h b/chromium/third_party/angle/src/libGLESv2/renderer/IndexRangeCache.h
index 56834306f22..4318e2b7a43 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/IndexRangeCache.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/IndexRangeCache.h
@@ -11,6 +11,7 @@
#define LIBGLESV2_RENDERER_INDEXRANGECACHE_H_
#include "common/angleutils.h"
+#include <map>
namespace rx
{
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/Query11.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/Query11.cpp
deleted file mode 100644
index 13210fc9291..00000000000
--- a/chromium/third_party/angle/src/libGLESv2/renderer/Query11.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-#include "precompiled.h"
-//
-// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// Query11.cpp: Defines the rx::Query11 class which implements rx::QueryImpl.
-
-#include "libGLESv2/renderer/Query11.h"
-#include "libGLESv2/renderer/Renderer11.h"
-#include "libGLESv2/main.h"
-
-namespace rx
-{
-
-Query11::Query11(rx::Renderer11 *renderer, GLenum type) : QueryImpl(type)
-{
- mRenderer = renderer;
- mQuery = NULL;
-}
-
-Query11::~Query11()
-{
- if (mQuery)
- {
- mQuery->Release();
- mQuery = NULL;
- }
-}
-
-void Query11::begin()
-{
- if (mQuery == NULL)
- {
- D3D11_QUERY_DESC queryDesc;
- queryDesc.Query = D3D11_QUERY_OCCLUSION;
- queryDesc.MiscFlags = 0;
-
- if (FAILED(mRenderer->getDevice()->CreateQuery(&queryDesc, &mQuery)))
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
- }
-
- mRenderer->getDeviceContext()->Begin(mQuery);
-}
-
-void Query11::end()
-{
- if (mQuery == NULL)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- mRenderer->getDeviceContext()->End(mQuery);
-
- mStatus = GL_FALSE;
- mResult = GL_FALSE;
-}
-
-GLuint Query11::getResult()
-{
- if (mQuery != NULL)
- {
- while (!testQuery())
- {
- Sleep(0);
- // explicitly check for device loss, some drivers seem to return S_FALSE
- // if the device is lost
- if (mRenderer->testDeviceLost(true))
- {
- return gl::error(GL_OUT_OF_MEMORY, 0);
- }
- }
- }
-
- return mResult;
-}
-
-GLboolean Query11::isResultAvailable()
-{
- if (mQuery != NULL)
- {
- testQuery();
- }
-
- return mStatus;
-}
-
-GLboolean Query11::testQuery()
-{
- if (mQuery != NULL && mStatus != GL_TRUE)
- {
- UINT64 numPixels = 0;
- HRESULT result = mRenderer->getDeviceContext()->GetData(mQuery, &numPixels, sizeof(UINT64), 0);
- if (result == S_OK)
- {
- mStatus = GL_TRUE;
-
- switch (getType())
- {
- case GL_ANY_SAMPLES_PASSED_EXT:
- case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
- mResult = (numPixels > 0) ? GL_TRUE : GL_FALSE;
- break;
- default:
- UNREACHABLE();
- }
- }
- else if (mRenderer->testDeviceLost(true))
- {
- return gl::error(GL_OUT_OF_MEMORY, GL_TRUE);
- }
-
- return mStatus;
- }
-
- return GL_TRUE; // prevent blocking when query is null
-}
-
-}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/QueryImpl.h b/chromium/third_party/angle/src/libGLESv2/renderer/QueryImpl.h
index a874047b0c2..a6750a204b7 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/QueryImpl.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/QueryImpl.h
@@ -24,6 +24,7 @@ class QueryImpl
virtual void end() = 0;
virtual GLuint getResult() = 0;
virtual GLboolean isResultAvailable() = 0;
+ virtual bool isStarted() const = 0;
GLenum getType() const { return mType; }
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/RenderTarget.h b/chromium/third_party/angle/src/libGLESv2/renderer/RenderTarget.h
index 80de39f4f76..44637ec7de9 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/RenderTarget.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/RenderTarget.h
@@ -11,6 +11,7 @@
#define LIBGLESV2_RENDERER_RENDERTARGET_H_
#include "common/angleutils.h"
+#include "libGLESv2/angletypes.h"
namespace rx
{
@@ -21,6 +22,7 @@ class RenderTarget
{
mWidth = 0;
mHeight = 0;
+ mDepth = 0;
mInternalFormat = GL_NONE;
mActualFormat = GL_NONE;
mSamples = 0;
@@ -28,21 +30,27 @@ class RenderTarget
virtual ~RenderTarget() {};
- GLsizei getWidth() { return mWidth; }
- GLsizei getHeight() { return mHeight; }
- GLenum getInternalFormat() { return mInternalFormat; }
- GLenum getActualFormat() { return mActualFormat; }
- GLsizei getSamples() { return mSamples; }
-
+ GLsizei getWidth() const { return mWidth; }
+ GLsizei getHeight() const { return mHeight; }
+ GLsizei getDepth() const { return mDepth; }
+ GLenum getInternalFormat() const { return mInternalFormat; }
+ GLenum getActualFormat() const { return mActualFormat; }
+ GLsizei getSamples() const { return mSamples; }
+ gl::Extents getExtents() const { return gl::Extents(mWidth, mHeight, mDepth); }
+
+ virtual void invalidate(GLint x, GLint y, GLsizei width, GLsizei height) = 0;
+
struct Desc {
GLsizei width;
GLsizei height;
+ GLsizei depth;
GLenum format;
};
protected:
GLsizei mWidth;
GLsizei mHeight;
+ GLsizei mDepth;
GLenum mInternalFormat;
GLenum mActualFormat;
GLsizei mSamples;
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/RenderTarget9.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/RenderTarget9.cpp
deleted file mode 100644
index a84c7090599..00000000000
--- a/chromium/third_party/angle/src/libGLESv2/renderer/RenderTarget9.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-#include "precompiled.h"
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// RenderTarget9.cpp: Implements a D3D9-specific wrapper for IDirect3DSurface9
-// pointers retained by renderbuffers.
-
-#include "libGLESv2/renderer/RenderTarget9.h"
-#include "libGLESv2/renderer/Renderer9.h"
-
-#include "libGLESv2/renderer/renderer9_utils.h"
-#include "libGLESv2/main.h"
-
-namespace rx
-{
-
-RenderTarget9::RenderTarget9(Renderer *renderer, IDirect3DSurface9 *surface)
-{
- mRenderer = Renderer9::makeRenderer9(renderer);
- mRenderTarget = surface;
-
- if (mRenderTarget)
- {
- D3DSURFACE_DESC description;
- mRenderTarget->GetDesc(&description);
-
- mWidth = description.Width;
- mHeight = description.Height;
-
- mInternalFormat = d3d9_gl::GetEquivalentFormat(description.Format);
- mActualFormat = d3d9_gl::GetEquivalentFormat(description.Format);
- mSamples = d3d9_gl::GetSamplesFromMultisampleType(description.MultiSampleType);
- }
-}
-
-RenderTarget9::RenderTarget9(Renderer *renderer, GLsizei width, GLsizei height, GLenum format, GLsizei samples)
-{
- mRenderer = Renderer9::makeRenderer9(renderer);
- mRenderTarget = NULL;
-
- D3DFORMAT requestedFormat = gl_d3d9::ConvertRenderbufferFormat(format);
- int supportedSamples = mRenderer->getNearestSupportedSamples(requestedFormat, samples);
-
- if (supportedSamples == -1)
- {
- gl::error(GL_OUT_OF_MEMORY);
-
- return;
- }
-
- HRESULT result = D3DERR_INVALIDCALL;
-
- if (width > 0 && height > 0)
- {
- if (requestedFormat == D3DFMT_D24S8)
- {
- result = mRenderer->getDevice()->CreateDepthStencilSurface(width, height, requestedFormat,
- gl_d3d9::GetMultisampleTypeFromSamples(supportedSamples),
- 0, FALSE, &mRenderTarget, NULL);
- }
- else
- {
- result = mRenderer->getDevice()->CreateRenderTarget(width, height, requestedFormat,
- gl_d3d9::GetMultisampleTypeFromSamples(supportedSamples),
- 0, FALSE, &mRenderTarget, NULL);
- }
-
- if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY)
- {
- gl::error(GL_OUT_OF_MEMORY);
-
- return;
- }
-
- ASSERT(SUCCEEDED(result));
- }
-
- mWidth = width;
- mHeight = height;
- mInternalFormat = format;
- mSamples = supportedSamples;
- mActualFormat = d3d9_gl::GetEquivalentFormat(requestedFormat);
-}
-
-RenderTarget9::~RenderTarget9()
-{
- if (mRenderTarget)
- {
- mRenderTarget->Release();
- }
-}
-
-RenderTarget9 *RenderTarget9::makeRenderTarget9(RenderTarget *target)
-{
- ASSERT(HAS_DYNAMIC_TYPE(rx::RenderTarget9*, target));
- return static_cast<rx::RenderTarget9*>(target);
-}
-
-IDirect3DSurface9 *RenderTarget9::getSurface()
-{
- // Caller is responsible for releasing the returned surface reference.
- if (mRenderTarget)
- {
- mRenderTarget->AddRef();
- }
-
- return mRenderTarget;
-}
-
-} \ No newline at end of file
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/Renderer.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/Renderer.cpp
index e0b3abcf879..92594a4d566 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/Renderer.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/Renderer.cpp
@@ -11,14 +11,21 @@
#include "libGLESv2/main.h"
#include "libGLESv2/Program.h"
#include "libGLESv2/renderer/Renderer.h"
-#include "libGLESv2/renderer/Renderer9.h"
-#include "libGLESv2/renderer/Renderer11.h"
-#include "libGLESv2/utilities.h"
+#include "common/utilities.h"
#include "third_party/trace_event/trace_event.h"
+#include "libGLESv2/Shader.h"
-#if !defined(ANGLE_ENABLE_D3D11)
+#if defined (ANGLE_ENABLE_D3D9)
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
+#endif // ANGLE_ENABLE_D3D9
+
+#if defined (ANGLE_ENABLE_D3D11)
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
+#endif // ANGLE_ENABLE_D3D11
+
+#if !defined(ANGLE_DEFAULT_D3D11)
// Enables use of the Direct3D 11 API for a default display, when available
-#define ANGLE_ENABLE_D3D11 0
+#define ANGLE_DEFAULT_D3D11 0
#endif
namespace rx
@@ -26,145 +33,12 @@ namespace rx
Renderer::Renderer(egl::Display *display) : mDisplay(display)
{
- mD3dCompilerModule = NULL;
- mD3DCompileFunc = NULL;
+ mCurrentClientVersion = 2;
}
Renderer::~Renderer()
{
- if (mD3dCompilerModule)
- {
- FreeLibrary(mD3dCompilerModule);
- mD3dCompilerModule = NULL;
- }
-}
-
-bool Renderer::initializeCompiler()
-{
- TRACE_EVENT0("gpu", "initializeCompiler");
-#if defined(ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES)
- // Find a D3DCompiler module that had already been loaded based on a predefined list of versions.
- static TCHAR* d3dCompilerNames[] = ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES;
-
- for (size_t i = 0; i < ArraySize(d3dCompilerNames); ++i)
- {
- if (GetModuleHandleEx(0, d3dCompilerNames[i], &mD3dCompilerModule))
- {
- break;
- }
- }
-#endif // ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES
-
- if (!mD3dCompilerModule)
- {
- // Load the version of the D3DCompiler DLL associated with the Direct3D version ANGLE was built with.
- mD3dCompilerModule = LoadLibrary(D3DCOMPILER_DLL);
- }
-
- if (!mD3dCompilerModule)
- {
- ERR("No D3D compiler module found - aborting!\n");
- return false;
- }
-
- mD3DCompileFunc = reinterpret_cast<pCompileFunc>(GetProcAddress(mD3dCompilerModule, "D3DCompile"));
- ASSERT(mD3DCompileFunc);
-
- return mD3DCompileFunc != NULL;
-}
-
-// Compiles HLSL code into executable binaries
-ShaderBlob *Renderer::compileToBinary(gl::InfoLog &infoLog, const char *hlsl, const char *profile, UINT optimizationFlags, bool alternateFlags)
-{
- if (!hlsl)
- {
- return NULL;
- }
-
- HRESULT result = S_OK;
- UINT flags = 0;
- std::string sourceText;
- if (gl::perfActive())
- {
- flags |= D3DCOMPILE_DEBUG;
-
-#ifdef NDEBUG
- flags |= optimizationFlags;
-#else
- flags |= D3DCOMPILE_SKIP_OPTIMIZATION;
-#endif
-
- std::string sourcePath = getTempPath();
- sourceText = std::string("#line 2 \"") + sourcePath + std::string("\"\n\n") + std::string(hlsl);
- writeFile(sourcePath.c_str(), sourceText.c_str(), sourceText.size());
- }
- else
- {
- flags |= optimizationFlags;
- sourceText = hlsl;
- }
-
- // Sometimes D3DCompile will fail with the default compilation flags for complicated shaders when it would otherwise pass with alternative options.
- // Try the default flags first and if compilation fails, try some alternatives.
- const static UINT extraFlags[] =
- {
- 0,
- D3DCOMPILE_AVOID_FLOW_CONTROL,
- D3DCOMPILE_PREFER_FLOW_CONTROL
- };
-
- const static char * const extraFlagNames[] =
- {
- "default",
- "avoid flow control",
- "prefer flow control"
- };
-
- int attempts = alternateFlags ? ArraySize(extraFlags) : 1;
- pD3DCompile compileFunc = reinterpret_cast<pD3DCompile>(mD3DCompileFunc);
- for (int i = 0; i < attempts; ++i)
- {
- ID3DBlob *errorMessage = NULL;
- ID3DBlob *binary = NULL;
-
- result = compileFunc(hlsl, strlen(hlsl), gl::g_fakepath, NULL, NULL,
- "main", profile, flags | extraFlags[i], 0, &binary, &errorMessage);
- if (errorMessage)
- {
- const char *message = (const char*)errorMessage->GetBufferPointer();
-
- infoLog.appendSanitized(message);
- TRACE("\n%s", hlsl);
- TRACE("\n%s", message);
-
- errorMessage->Release();
- errorMessage = NULL;
- }
-
- if (SUCCEEDED(result))
- {
- return (ShaderBlob*)binary;
- }
- else
- {
- if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY)
- {
- return gl::error(GL_OUT_OF_MEMORY, (ShaderBlob*) NULL);
- }
-
- infoLog.append("Warning: D3D shader compilation failed with ");
- infoLog.append(extraFlagNames[i]);
- infoLog.append(" flags.");
- if (i + 1 < attempts)
- {
- infoLog.append(" Retrying with ");
- infoLog.append(extraFlagNames[i + 1]);
- infoLog.append(".\n");
- }
- }
- }
-
- return NULL;
+ gl::Shader::releaseCompiler();
}
}
@@ -174,45 +48,38 @@ extern "C"
rx::Renderer *glCreateRenderer(egl::Display *display, HDC hDc, EGLNativeDisplayType displayId)
{
- rx::Renderer *renderer = NULL;
- EGLint status = EGL_BAD_ALLOC;
-
- if (ANGLE_ENABLE_D3D11 ||
+#if defined(ANGLE_ENABLE_D3D11)
+ if (ANGLE_DEFAULT_D3D11 ||
displayId == EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE ||
displayId == EGL_D3D11_ONLY_DISPLAY_ANGLE)
{
- renderer = new rx::Renderer11(display, hDc);
-
- if (renderer)
- {
- status = renderer->initialize();
- }
-
- if (status == EGL_SUCCESS)
+ rx::Renderer11 *renderer = new rx::Renderer11(display, hDc);
+ if (renderer->initialize() == EGL_SUCCESS)
{
return renderer;
}
- else if (displayId == EGL_D3D11_ONLY_DISPLAY_ANGLE)
+ else
{
- return NULL;
+ // Failed to create a D3D11 renderer, try D3D9
+ SafeDelete(renderer);
}
-
- // Failed to create a D3D11 renderer, try creating a D3D9 renderer
- delete renderer;
- }
-
- bool softwareDevice = (displayId == EGL_SOFTWARE_DISPLAY_ANGLE);
- renderer = new rx::Renderer9(display, hDc, softwareDevice);
-
- if (renderer)
- {
- status = renderer->initialize();
}
+#endif
- if (status == EGL_SUCCESS)
+#if defined(ANGLE_ENABLE_D3D9)
+ if (displayId != EGL_D3D11_ONLY_DISPLAY_ANGLE)
{
- return renderer;
+ rx::Renderer9 *renderer = new rx::Renderer9(display, hDc);
+ if (renderer->initialize() == EGL_SUCCESS)
+ {
+ return renderer;
+ }
+ else
+ {
+ SafeDelete(renderer);
+ }
}
+#endif
return NULL;
}
@@ -222,4 +89,4 @@ void glDestroyRenderer(rx::Renderer *renderer)
delete renderer;
}
-} \ No newline at end of file
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/Renderer.h b/chromium/third_party/angle/src/libGLESv2/renderer/Renderer.h
index e1861f01eb1..b2a05d92d2c 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/Renderer.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/Renderer.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2012-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -14,22 +14,11 @@
#include "libGLESv2/angletypes.h"
#if !defined(ANGLE_COMPILE_OPTIMIZATION_LEVEL)
-#define ANGLE_COMPILE_OPTIMIZATION_LEVEL D3DCOMPILE_OPTIMIZATION_LEVEL3
+// WARNING: D3DCOMPILE_OPTIMIZATION_LEVEL3 may lead to a DX9 shader compiler hang.
+// It should only be used selectively to work around specific bugs.
+#define ANGLE_COMPILE_OPTIMIZATION_LEVEL D3DCOMPILE_OPTIMIZATION_LEVEL1
#endif
-const int versionWindowsVista = MAKEWORD(0x00, 0x06);
-const int versionWindows7 = MAKEWORD(0x01, 0x06);
-
-// Return the version of the operating system in a format suitable for ordering
-// comparison.
-inline int getComparableOSVersion()
-{
- DWORD version = GetVersion();
- int majorVersion = LOBYTE(LOWORD(version));
- int minorVersion = HIBYTE(LOWORD(version));
- return MAKEWORD(minorVersion, majorVersion);
-}
-
namespace egl
{
class Display;
@@ -39,31 +28,32 @@ namespace gl
{
class InfoLog;
class ProgramBinary;
+struct LinkedVarying;
class VertexAttribute;
class Buffer;
class Texture;
class Framebuffer;
+struct VertexAttribCurrentValueData;
}
namespace rx
{
class TextureStorageInterface2D;
class TextureStorageInterfaceCube;
+class TextureStorageInterface3D;
+class TextureStorageInterface2DArray;
class VertexBuffer;
class IndexBuffer;
class QueryImpl;
class FenceImpl;
class BufferStorage;
-class Blit;
struct TranslatedIndexData;
class ShaderExecutable;
class SwapChain;
class RenderTarget;
class Image;
class TextureStorage;
-
-typedef void * ShaderBlob;
-typedef void (*pCompileFunc)();
+class UniformStorage;
struct ConfigDesc
{
@@ -71,6 +61,7 @@ struct ConfigDesc
GLenum depthStencilFormat;
GLint multiSample;
bool fastConfig;
+ bool es3Capable;
};
struct dx_VertexConstants
@@ -93,12 +84,6 @@ enum ShaderType
SHADER_GEOMETRY
};
-enum D3DWorkaroundType
-{
- ANGLE_D3D_WORKAROUND_NONE,
- ANGLE_D3D_WORKAROUND_SM3_OPTIMIZER
-};
-
class Renderer
{
public:
@@ -115,11 +100,14 @@ class Renderer
virtual SwapChain *createSwapChain(HWND window, HANDLE shareHandle, GLenum backBufferFormat, GLenum depthBufferFormat) = 0;
+ virtual void generateSwizzle(gl::Texture *texture) = 0;
virtual void setSamplerState(gl::SamplerType type, int index, const gl::SamplerState &sampler) = 0;
virtual void setTexture(gl::SamplerType type, int index, gl::Texture *texture) = 0;
+ virtual bool setUniformBuffers(const gl::Buffer *vertexUniformBuffers[], const gl::Buffer *fragmentUniformBuffers[]) = 0;
+
virtual void setRasterizerState(const gl::RasterizerState &rasterState) = 0;
- virtual void setBlendState(const gl::BlendState &blendState, const gl::Color &blendColor,
+ virtual void setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState, const gl::ColorF &blendColor,
unsigned int sampleMask) = 0;
virtual void setDepthStencilState(const gl::DepthStencilState &depthStencilState, int stencilRef,
int stencilBackRef, bool frontFaceCCW) = 0;
@@ -129,14 +117,17 @@ class Renderer
bool ignoreViewport) = 0;
virtual bool applyRenderTarget(gl::Framebuffer *frameBuffer) = 0;
- virtual void applyShaders(gl::ProgramBinary *programBinary) = 0;
- virtual void applyUniforms(gl::ProgramBinary *programBinary, gl::UniformArray *uniformArray) = 0;
+ virtual void applyShaders(gl::ProgramBinary *programBinary, bool rasterizerDiscard, bool transformFeedbackActive, const gl::VertexFormat inputLayout[]) = 0;
+ virtual void applyUniforms(const gl::ProgramBinary &programBinary) = 0;
virtual bool applyPrimitiveType(GLenum primitiveType, GLsizei elementCount) = 0;
- virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances) = 0;
+ virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, const gl::VertexAttribute vertexAttributes[], gl::VertexAttribCurrentValueData currentValues[],
+ GLint first, GLsizei count, GLsizei instances) = 0;
virtual GLenum applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo) = 0;
+ virtual void applyTransformFeedbackBuffers(gl::Buffer *transformFeedbackBuffers[], GLintptr offsets[]) = 0;
- virtual void drawArrays(GLenum mode, GLsizei count, GLsizei instances) = 0;
- virtual void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo, GLsizei instances) = 0;
+ virtual void drawArrays(GLenum mode, GLsizei count, GLsizei instances, bool transformFeedbackActive) = 0;
+ virtual void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices,
+ gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo, GLsizei instances) = 0;
virtual void clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer) = 0;
@@ -154,14 +145,20 @@ class Renderer
virtual GUID getAdapterIdentifier() const = 0;
virtual bool getBGRATextureSupport() const = 0;
- virtual bool getDXT1TextureSupport() = 0;
- virtual bool getDXT3TextureSupport() = 0;
- virtual bool getDXT5TextureSupport() = 0;
- virtual bool getEventQuerySupport() = 0;
- virtual bool getFloat32TextureSupport(bool *filtering, bool *renderable) = 0;
- virtual bool getFloat16TextureSupport(bool *filtering, bool *renderable) = 0;
- virtual bool getLuminanceTextureSupport() = 0;
- virtual bool getLuminanceAlphaTextureSupport() = 0;
+ virtual bool getDXT1TextureSupport() const = 0;
+ virtual bool getDXT3TextureSupport() const = 0;
+ virtual bool getDXT5TextureSupport() const = 0;
+ virtual bool getEventQuerySupport() const = 0;
+ virtual bool getFloat32TextureSupport() const = 0;
+ virtual bool getFloat32TextureFilteringSupport() const= 0;
+ virtual bool getFloat32TextureRenderingSupport() const= 0;
+ virtual bool getFloat16TextureSupport() const= 0;
+ virtual bool getFloat16TextureFilteringSupport() const= 0;
+ virtual bool getFloat16TextureRenderingSupport() const = 0;
+ virtual bool getRGB565TextureSupport() const = 0;
+ virtual bool getLuminanceTextureSupport() const = 0;
+ virtual bool getLuminanceAlphaTextureSupport() const = 0;
+ virtual bool getRGTextureSupport() const = 0;
bool getVertexTextureSupport() const { return getMaxVertexTextureImageUnits() > 0; }
virtual unsigned int getMaxVertexTextureImageUnits() const = 0;
virtual unsigned int getMaxCombinedTextureImageUnits() const = 0;
@@ -170,57 +167,86 @@ class Renderer
virtual unsigned int getMaxVertexUniformVectors() const = 0;
virtual unsigned int getMaxFragmentUniformVectors() const = 0;
virtual unsigned int getMaxVaryingVectors() const = 0;
+ virtual unsigned int getMaxVertexShaderUniformBuffers() const = 0;
+ virtual unsigned int getMaxFragmentShaderUniformBuffers() const = 0;
+ virtual unsigned int getReservedVertexUniformBuffers() const = 0;
+ virtual unsigned int getReservedFragmentUniformBuffers() const = 0;
+ virtual unsigned int getMaxTransformFeedbackBuffers() const = 0;
+ virtual unsigned int getMaxTransformFeedbackSeparateComponents() const = 0;
+ virtual unsigned int getMaxTransformFeedbackInterleavedComponents() const = 0;
+ virtual unsigned int getMaxUniformBufferSize() const = 0;
virtual bool getNonPower2TextureSupport() const = 0;
virtual bool getDepthTextureSupport() const = 0;
virtual bool getOcclusionQuerySupport() const = 0;
virtual bool getInstancingSupport() const = 0;
virtual bool getTextureFilterAnisotropySupport() const = 0;
+ virtual bool getPBOSupport() const = 0;
virtual float getTextureMaxAnisotropy() const = 0;
virtual bool getShareHandleSupport() const = 0;
virtual bool getDerivativeInstructionSupport() const = 0;
virtual bool getPostSubBufferSupport() const = 0;
+ virtual int getMaxRecommendedElementsIndices() const = 0;
+ virtual int getMaxRecommendedElementsVertices() const = 0;
virtual int getMajorShaderModel() const = 0;
virtual float getMaxPointSize() const = 0;
virtual int getMaxViewportDimension() const = 0;
virtual int getMaxTextureWidth() const = 0;
virtual int getMaxTextureHeight() const = 0;
+ virtual int getMaxTextureDepth() const = 0;
+ virtual int getMaxTextureArrayLayers() const = 0;
virtual bool get32BitIndexSupport() const = 0;
virtual int getMinSwapInterval() const = 0;
virtual int getMaxSwapInterval() const = 0;
virtual GLsizei getMaxSupportedSamples() const = 0;
+ virtual GLsizei getMaxSupportedFormatSamples(GLenum internalFormat) const = 0;
+ virtual GLsizei getNumSampleCounts(GLenum internalFormat) const = 0;
+ virtual void getSampleCounts(GLenum internalFormat, GLsizei bufSize, GLint *params) const = 0;
virtual unsigned int getMaxRenderTargets() const = 0;
// Pixel operations
virtual bool copyToRenderTarget(TextureStorageInterface2D *dest, TextureStorageInterface2D *source) = 0;
virtual bool copyToRenderTarget(TextureStorageInterfaceCube *dest, TextureStorageInterfaceCube *source) = 0;
+ virtual bool copyToRenderTarget(TextureStorageInterface3D *dest, TextureStorageInterface3D *source) = 0;
+ virtual bool copyToRenderTarget(TextureStorageInterface2DArray *dest, TextureStorageInterface2DArray *source) = 0;
virtual bool copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, TextureStorageInterface2D *storage, GLint level) = 0;
virtual bool copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, TextureStorageInterfaceCube *storage, GLenum target, GLint level) = 0;
+ virtual bool copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
+ GLint xoffset, GLint yoffset, GLint zOffset, TextureStorageInterface3D *storage, GLint level) = 0;
+ virtual bool copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
+ GLint xoffset, GLint yoffset, GLint zOffset, TextureStorageInterface2DArray *storage, GLint level) = 0;
virtual bool blitRect(gl::Framebuffer *readTarget, const gl::Rectangle &readRect, gl::Framebuffer *drawTarget, const gl::Rectangle &drawRect,
- bool blitRenderTarget, bool blitDepthStencil) = 0;
- virtual void readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
- GLsizei outputPitch, bool packReverseRowOrder, GLint packAlignment, void* pixels) = 0;
+ const gl::Rectangle *scissor, bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter) = 0;
+ virtual void readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format,
+ GLenum type, GLuint outputPitch, const gl::PixelPackState &pack, void* pixels) = 0;
// RenderTarget creation
virtual RenderTarget *createRenderTarget(SwapChain *swapChain, bool depth) = 0;
- virtual RenderTarget *createRenderTarget(int width, int height, GLenum format, GLsizei samples, bool depth) = 0;
+ virtual RenderTarget *createRenderTarget(int width, int height, GLenum format, GLsizei samples) = 0;
// Shader operations
- virtual ShaderExecutable *loadExecutable(const void *function, size_t length, rx::ShaderType type) = 0;
- virtual ShaderExecutable *compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type, D3DWorkaroundType workaround) = 0;
+ virtual ShaderExecutable *loadExecutable(const void *function, size_t length, rx::ShaderType type,
+ const std::vector<gl::LinkedVarying> &transformFeedbackVaryings,
+ bool separatedOutputBuffers) = 0;
+ virtual ShaderExecutable *compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type,
+ const std::vector<gl::LinkedVarying> &transformFeedbackVaryings,
+ bool separatedOutputBuffers, D3DWorkaroundType workaround) = 0;
+ virtual UniformStorage *createUniformStorage(size_t storageSize) = 0;
// Image operations
virtual Image *createImage() = 0;
virtual void generateMipmap(Image *dest, Image *source) = 0;
virtual TextureStorage *createTextureStorage2D(SwapChain *swapChain) = 0;
- virtual TextureStorage *createTextureStorage2D(int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height) = 0;
- virtual TextureStorage *createTextureStorageCube(int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size) = 0;
+ virtual TextureStorage *createTextureStorage2D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels) = 0;
+ virtual TextureStorage *createTextureStorageCube(GLenum internalformat, bool renderTarget, int size, int levels) = 0;
+ virtual TextureStorage *createTextureStorage3D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, GLsizei depth, int levels) = 0;
+ virtual TextureStorage *createTextureStorage2DArray(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, GLsizei depth, int levels) = 0;
// Buffer creation
virtual VertexBuffer *createVertexBuffer() = 0;
@@ -231,19 +257,27 @@ class Renderer
virtual QueryImpl *createQuery(GLenum type) = 0;
virtual FenceImpl *createFence() = 0;
+ // Current GLES client version
+ void setCurrentClientVersion(int clientVersion) { mCurrentClientVersion = clientVersion; }
+ int getCurrentClientVersion() const { return mCurrentClientVersion; }
+
+ // Buffer-to-texture and Texture-to-buffer copies
+ virtual bool supportsFastCopyBufferToTexture(GLenum internalFormat) const = 0;
+ virtual bool fastCopyBufferToTexture(const gl::PixelUnpackState &unpack, unsigned int offset, RenderTarget *destRenderTarget,
+ GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &destArea) = 0;
+
virtual bool getLUID(LUID *adapterLuid) const = 0;
+ virtual GLenum getNativeTextureFormat(GLenum internalFormat) const = 0;
+ virtual rx::VertexConversionType getVertexConversionType(const gl::VertexFormat &vertexFormat) const = 0;
+ virtual GLenum getVertexComponentType(const gl::VertexFormat &vertexFormat) const = 0;
protected:
- bool initializeCompiler();
- ShaderBlob *compileToBinary(gl::InfoLog &infoLog, const char *hlsl, const char *profile, UINT optimizationFlags, bool alternateFlags);
-
egl::Display *mDisplay;
private:
DISALLOW_COPY_AND_ASSIGN(Renderer);
- HMODULE mD3dCompilerModule;
- pCompileFunc mD3DCompileFunc;
+ int mCurrentClientVersion;
};
}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/ShaderExecutable.h b/chromium/third_party/angle/src/libGLESv2/renderer/ShaderExecutable.h
index 293e340845e..5e229d7d5e8 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/ShaderExecutable.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/ShaderExecutable.h
@@ -11,6 +11,7 @@
#define LIBGLESV2_RENDERER_SHADEREXECUTABLE_H_
#include "common/angleutils.h"
+#include "common/debug.h"
namespace rx
{
@@ -46,6 +47,22 @@ class ShaderExecutable
const size_t mLength;
};
+class UniformStorage
+{
+ public:
+ UniformStorage(size_t initialSize)
+ : mSize(initialSize)
+ {
+ }
+
+ virtual ~UniformStorage() {}
+
+ size_t size() const { return mSize; }
+
+ private:
+ size_t mSize;
+};
+
}
#endif // LIBGLESV2_RENDERER_SHADEREXECUTABLE9_H_
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/TextureStorage.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/TextureStorage.cpp
index 00b316f1cc5..650f368a1d8 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/TextureStorage.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/TextureStorage.cpp
@@ -1,6 +1,6 @@
#include "precompiled.h"
//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -15,6 +15,7 @@
#include "libGLESv2/Texture.h"
#include "common/debug.h"
+#include "common/mathutil.h"
namespace rx
{
@@ -36,7 +37,6 @@ bool TextureStorageInterface::isRenderTarget() const
return mInstance->isRenderTarget();
}
-
bool TextureStorageInterface::isManaged() const
{
return mInstance->isManaged();
@@ -52,36 +52,36 @@ unsigned int TextureStorageInterface::issueTextureSerial()
return mCurrentTextureSerial++;
}
-int TextureStorageInterface::getLodOffset() const
+int TextureStorageInterface::getTopLevel() const
{
- return mInstance->getLodOffset();
+ return mInstance->getTopLevel();
}
-
-int TextureStorageInterface::levelCount()
+int TextureStorageInterface::getLevelCount() const
{
- return mInstance->levelCount();
+ return mInstance->getLevelCount();
}
-TextureStorageInterface2D::TextureStorageInterface2D(Renderer *renderer, SwapChain *swapchain)
- : mRenderTargetSerial(gl::RenderbufferStorage::issueSerial())
+TextureStorageInterface2D::TextureStorageInterface2D(Renderer *renderer, SwapChain *swapchain)
{
+ mFirstRenderTargetSerial = gl::RenderbufferStorage::issueSerials(1);
+
mInstance = renderer->createTextureStorage2D(swapchain);
}
-TextureStorageInterface2D::TextureStorageInterface2D(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height)
- : mRenderTargetSerial(gl::RenderbufferStorage::issueSerial())
+TextureStorageInterface2D::TextureStorageInterface2D(Renderer *renderer, GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels)
{
- mInstance = renderer->createTextureStorage2D(levels, internalformat, usage, forceRenderable, width, height);
+ mInstance = renderer->createTextureStorage2D(internalformat, renderTarget, width, height, levels);
+ mFirstRenderTargetSerial = gl::RenderbufferStorage::issueSerials(static_cast<GLuint>(mInstance->getLevelCount()));
}
TextureStorageInterface2D::~TextureStorageInterface2D()
{
}
-RenderTarget *TextureStorageInterface2D::getRenderTarget() const
+RenderTarget *TextureStorageInterface2D::getRenderTarget(GLint level) const
{
- return mInstance->getRenderTarget();
+ return mInstance->getRenderTarget(level);
}
void TextureStorageInterface2D::generateMipmap(int level)
@@ -89,34 +89,92 @@ void TextureStorageInterface2D::generateMipmap(int level)
mInstance->generateMipmap(level);
}
-unsigned int TextureStorageInterface2D::getRenderTargetSerial(GLenum target) const
+unsigned int TextureStorageInterface2D::getRenderTargetSerial(GLint level) const
{
- return mRenderTargetSerial;
+ return mFirstRenderTargetSerial + level;
}
-TextureStorageInterfaceCube::TextureStorageInterfaceCube(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size)
- : mFirstRenderTargetSerial(gl::RenderbufferStorage::issueCubeSerials())
+TextureStorageInterfaceCube::TextureStorageInterfaceCube(Renderer *renderer, GLenum internalformat, bool renderTarget, int size, int levels)
{
- mInstance = renderer->createTextureStorageCube(levels, internalformat, usage, forceRenderable, size);
+ mInstance = renderer->createTextureStorageCube(internalformat, renderTarget, size, levels);
+ mFirstRenderTargetSerial = gl::RenderbufferStorage::issueSerials(static_cast<GLuint>(mInstance->getLevelCount() * 6));
}
TextureStorageInterfaceCube::~TextureStorageInterfaceCube()
{
}
-RenderTarget *TextureStorageInterfaceCube::getRenderTarget(GLenum faceTarget) const
+RenderTarget *TextureStorageInterfaceCube::getRenderTarget(GLenum faceTarget, GLint level) const
+{
+ return mInstance->getRenderTargetFace(faceTarget, level);
+}
+
+void TextureStorageInterfaceCube::generateMipmap(int faceIndex, int level)
+{
+ mInstance->generateMipmap(faceIndex, level);
+}
+
+unsigned int TextureStorageInterfaceCube::getRenderTargetSerial(GLenum target, GLint level) const
+{
+ return mFirstRenderTargetSerial + (level * 6) + gl::TextureCubeMap::targetToIndex(target);
+}
+
+TextureStorageInterface3D::TextureStorageInterface3D(Renderer *renderer, GLenum internalformat, bool renderTarget,
+ GLsizei width, GLsizei height, GLsizei depth, int levels)
+{
+
+ mInstance = renderer->createTextureStorage3D(internalformat, renderTarget, width, height, depth, levels);
+ mFirstRenderTargetSerial = gl::RenderbufferStorage::issueSerials(static_cast<GLuint>(mInstance->getLevelCount() * depth));
+}
+
+TextureStorageInterface3D::~TextureStorageInterface3D()
+{
+}
+
+void TextureStorageInterface3D::generateMipmap(int level)
+{
+ mInstance->generateMipmap(level);
+}
+
+RenderTarget *TextureStorageInterface3D::getRenderTarget(GLint level) const
+{
+ return mInstance->getRenderTarget(level);
+}
+
+RenderTarget *TextureStorageInterface3D::getRenderTarget(GLint level, GLint layer) const
+{
+ return mInstance->getRenderTargetLayer(level, layer);
+}
+
+unsigned int TextureStorageInterface3D::getRenderTargetSerial(GLint level, GLint layer) const
+{
+ return mFirstRenderTargetSerial + static_cast<unsigned int>((layer * mInstance->getLevelCount()) + level);
+}
+
+TextureStorageInterface2DArray::TextureStorageInterface2DArray(Renderer *renderer, GLenum internalformat, bool renderTarget,
+ GLsizei width, GLsizei height, GLsizei depth, int levels)
+{
+ mInstance = renderer->createTextureStorage2DArray(internalformat, renderTarget, width, height, depth, levels);
+ mFirstRenderTargetSerial = gl::RenderbufferStorage::issueSerials(static_cast<GLuint>(mInstance->getLevelCount() * depth));
+}
+
+TextureStorageInterface2DArray::~TextureStorageInterface2DArray()
{
- return mInstance->getRenderTarget(faceTarget);
}
-void TextureStorageInterfaceCube::generateMipmap(int face, int level)
+void TextureStorageInterface2DArray::generateMipmap(int level)
{
- mInstance->generateMipmap(face, level);
+ mInstance->generateMipmap(level);
}
-unsigned int TextureStorageInterfaceCube::getRenderTargetSerial(GLenum target) const
+RenderTarget *TextureStorageInterface2DArray::getRenderTarget(GLint level, GLint layer) const
{
- return mFirstRenderTargetSerial + gl::TextureCubeMap::faceIndex(target);
+ return mInstance->getRenderTargetLayer(level, layer);
}
-} \ No newline at end of file
+unsigned int TextureStorageInterface2DArray::getRenderTargetSerial(GLint level, GLint layer) const
+{
+ return mFirstRenderTargetSerial + static_cast<unsigned int>((layer * mInstance->getLevelCount()) + level);
+}
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/TextureStorage.h b/chromium/third_party/angle/src/libGLESv2/renderer/TextureStorage.h
index edddb75f3fc..0a212e16f27 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/TextureStorage.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/TextureStorage.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -18,7 +18,6 @@ namespace rx
class Renderer;
class SwapChain;
class RenderTarget;
-class Blit;
class TextureStorage
{
@@ -26,13 +25,14 @@ class TextureStorage
TextureStorage() {};
virtual ~TextureStorage() {};
- virtual int getLodOffset() const = 0;
+ virtual int getTopLevel() const = 0;
virtual bool isRenderTarget() const = 0;
virtual bool isManaged() const = 0;
- virtual int levelCount() = 0;
+ virtual int getLevelCount() const = 0;
- virtual RenderTarget *getRenderTarget() = 0;
- virtual RenderTarget *getRenderTarget(GLenum faceTarget) = 0;
+ virtual RenderTarget *getRenderTarget(int level) = 0;
+ virtual RenderTarget *getRenderTargetFace(GLenum faceTarget, int level) = 0;
+ virtual RenderTarget *getRenderTargetLayer(int mipLevel, int layer) = 0;
virtual void generateMipmap(int level) = 0;
virtual void generateMipmap(int face, int level) = 0;
@@ -50,12 +50,11 @@ class TextureStorageInterface
TextureStorage *getStorageInstance() { return mInstance; }
unsigned int getTextureSerial() const;
- virtual unsigned int getRenderTargetSerial(GLenum target) const = 0;
- virtual int getLodOffset() const;
+ virtual int getTopLevel() const;
virtual bool isRenderTarget() const;
virtual bool isManaged() const;
- virtual int levelCount();
+ virtual int getLevelCount() const;
protected:
TextureStorage *mInstance;
@@ -73,38 +72,74 @@ class TextureStorageInterface2D : public TextureStorageInterface
{
public:
TextureStorageInterface2D(Renderer *renderer, SwapChain *swapchain);
- TextureStorageInterface2D(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height);
+ TextureStorageInterface2D(Renderer *renderer, GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels);
virtual ~TextureStorageInterface2D();
void generateMipmap(int level);
- RenderTarget *getRenderTarget() const;
+ RenderTarget *getRenderTarget(GLint level) const;
- virtual unsigned int getRenderTargetSerial(GLenum target) const;
+ unsigned int getRenderTargetSerial(GLint level) const;
private:
DISALLOW_COPY_AND_ASSIGN(TextureStorageInterface2D);
- const unsigned int mRenderTargetSerial;
+ unsigned int mFirstRenderTargetSerial;
};
class TextureStorageInterfaceCube : public TextureStorageInterface
{
public:
- TextureStorageInterfaceCube(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size);
+ TextureStorageInterfaceCube(Renderer *renderer, GLenum internalformat, bool renderTarget, int size, int levels);
virtual ~TextureStorageInterfaceCube();
- void generateMipmap(int face, int level);
- RenderTarget *getRenderTarget(GLenum faceTarget) const;
+ void generateMipmap(int faceIndex, int level);
+ RenderTarget *getRenderTarget(GLenum faceTarget, GLint level) const;
- virtual unsigned int getRenderTargetSerial(GLenum target) const;
+ virtual unsigned int getRenderTargetSerial(GLenum target, GLint level) const;
private:
DISALLOW_COPY_AND_ASSIGN(TextureStorageInterfaceCube);
- const unsigned int mFirstRenderTargetSerial;
+ unsigned int mFirstRenderTargetSerial;
+};
+
+class TextureStorageInterface3D : public TextureStorageInterface
+{
+ public:
+ TextureStorageInterface3D(Renderer *renderer, GLenum internalformat, bool renderTarget,
+ GLsizei width, GLsizei height, GLsizei depth, int levels);
+ virtual ~TextureStorageInterface3D();
+
+ void generateMipmap(int level);
+ RenderTarget *getRenderTarget(GLint level) const;
+ RenderTarget *getRenderTarget(GLint level, GLint layer) const;
+
+ virtual unsigned int getRenderTargetSerial(GLint level, GLint layer) const;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TextureStorageInterface3D);
+
+ unsigned int mFirstRenderTargetSerial;
+};
+
+class TextureStorageInterface2DArray : public TextureStorageInterface
+{
+ public:
+ TextureStorageInterface2DArray(Renderer *renderer, GLenum internalformat, bool renderTarget,
+ GLsizei width, GLsizei height, GLsizei depth, int levels);
+ virtual ~TextureStorageInterface2DArray();
+
+ void generateMipmap(int level);
+ RenderTarget *getRenderTarget(GLint level, GLint layer) const;
+
+ virtual unsigned int getRenderTargetSerial(GLint level, GLint layer) const;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TextureStorageInterface2DArray);
+
+ unsigned int mFirstRenderTargetSerial;
};
}
#endif // LIBGLESV2_RENDERER_TEXTURESTORAGE_H_
-
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/TextureStorage11.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/TextureStorage11.cpp
deleted file mode 100644
index 41515ed7696..00000000000
--- a/chromium/third_party/angle/src/libGLESv2/renderer/TextureStorage11.cpp
+++ /dev/null
@@ -1,667 +0,0 @@
-#include "precompiled.h"
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// TextureStorage11.cpp: Implements the abstract rx::TextureStorage11 class and its concrete derived
-// classes TextureStorage11_2D and TextureStorage11_Cube, which act as the interface to the D3D11 texture.
-
-#include "libGLESv2/renderer/TextureStorage11.h"
-
-#include "libGLESv2/renderer/Renderer11.h"
-#include "libGLESv2/renderer/RenderTarget11.h"
-#include "libGLESv2/renderer/SwapChain11.h"
-#include "libGLESv2/renderer/renderer11_utils.h"
-
-#include "libGLESv2/utilities.h"
-#include "libGLESv2/main.h"
-
-namespace rx
-{
-
-TextureStorage11::TextureStorage11(Renderer *renderer, UINT bindFlags)
- : mBindFlags(bindFlags),
- mLodOffset(0),
- mMipLevels(0),
- mTexture(NULL),
- mTextureFormat(DXGI_FORMAT_UNKNOWN),
- mShaderResourceFormat(DXGI_FORMAT_UNKNOWN),
- mRenderTargetFormat(DXGI_FORMAT_UNKNOWN),
- mDepthStencilFormat(DXGI_FORMAT_UNKNOWN),
- mSRV(NULL),
- mTextureWidth(0),
- mTextureHeight(0)
-{
- mRenderer = Renderer11::makeRenderer11(renderer);
-}
-
-TextureStorage11::~TextureStorage11()
-{
-}
-
-TextureStorage11 *TextureStorage11::makeTextureStorage11(TextureStorage *storage)
-{
- ASSERT(HAS_DYNAMIC_TYPE(TextureStorage11*, storage));
- return static_cast<TextureStorage11*>(storage);
-}
-
-DWORD TextureStorage11::GetTextureBindFlags(DXGI_FORMAT format, GLenum glusage, bool forceRenderable)
-{
- UINT bindFlags = D3D11_BIND_SHADER_RESOURCE;
-
- if (d3d11::IsDepthStencilFormat(format))
- {
- bindFlags |= D3D11_BIND_DEPTH_STENCIL;
- }
- else if(forceRenderable || (TextureStorage11::IsTextureFormatRenderable(format) && (glusage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE)))
- {
- bindFlags |= D3D11_BIND_RENDER_TARGET;
- }
- return bindFlags;
-}
-
-bool TextureStorage11::IsTextureFormatRenderable(DXGI_FORMAT format)
-{
- switch(format)
- {
- case DXGI_FORMAT_R8G8B8A8_UNORM:
- case DXGI_FORMAT_A8_UNORM:
- case DXGI_FORMAT_R32G32B32A32_FLOAT:
- case DXGI_FORMAT_R16G16B16A16_FLOAT:
- case DXGI_FORMAT_B8G8R8A8_UNORM:
- case DXGI_FORMAT_R8_UNORM:
- case DXGI_FORMAT_R8G8_UNORM:
- case DXGI_FORMAT_R16_FLOAT:
- case DXGI_FORMAT_R16G16_FLOAT:
- return true;
- case DXGI_FORMAT_BC1_UNORM:
- case DXGI_FORMAT_BC2_UNORM:
- case DXGI_FORMAT_BC3_UNORM:
- case DXGI_FORMAT_R32G32B32_FLOAT: // not renderable on all devices
- return false;
- default:
- UNREACHABLE();
- return false;
- }
-}
-
-UINT TextureStorage11::getBindFlags() const
-{
- return mBindFlags;
-}
-
-ID3D11Texture2D *TextureStorage11::getBaseTexture() const
-{
- return mTexture;
-}
-
-int TextureStorage11::getLodOffset() const
-{
- return mLodOffset;
-}
-
-bool TextureStorage11::isRenderTarget() const
-{
- return (mBindFlags & (D3D11_BIND_RENDER_TARGET | D3D11_BIND_DEPTH_STENCIL)) != 0;
-}
-
-bool TextureStorage11::isManaged() const
-{
- return false;
-}
-
-int TextureStorage11::levelCount()
-{
- int levels = 0;
- if (getBaseTexture())
- {
- levels = mMipLevels - getLodOffset();
- }
- return levels;
-}
-
-UINT TextureStorage11::getSubresourceIndex(int level, int faceIndex)
-{
- UINT index = 0;
- if (getBaseTexture())
- {
- index = D3D11CalcSubresource(level, faceIndex, mMipLevels);
- }
- return index;
-}
-
-bool TextureStorage11::updateSubresourceLevel(ID3D11Texture2D *srcTexture, unsigned int sourceSubresource,
- int level, int face, GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height)
-{
- if (srcTexture)
- {
- // Round up the width and height to the nearest multiple of dimension alignment
- unsigned int dimensionAlignment = d3d11::GetTextureFormatDimensionAlignment(mTextureFormat);
- width = width + dimensionAlignment - 1 - (width - 1) % dimensionAlignment;
- height = height + dimensionAlignment - 1 - (height - 1) % dimensionAlignment;
-
- D3D11_BOX srcBox;
- srcBox.left = xoffset;
- srcBox.top = yoffset;
- srcBox.right = xoffset + width;
- srcBox.bottom = yoffset + height;
- srcBox.front = 0;
- srcBox.back = 1;
-
- ID3D11DeviceContext *context = mRenderer->getDeviceContext();
-
- ASSERT(getBaseTexture());
- context->CopySubresourceRegion(getBaseTexture(), getSubresourceIndex(level + mLodOffset, face),
- xoffset, yoffset, 0, srcTexture, sourceSubresource, &srcBox);
- return true;
- }
-
- return false;
-}
-
-void TextureStorage11::generateMipmapLayer(RenderTarget11 *source, RenderTarget11 *dest)
-{
- if (source && dest)
- {
- ID3D11ShaderResourceView *sourceSRV = source->getShaderResourceView();
- ID3D11RenderTargetView *destRTV = dest->getRenderTargetView();
-
- if (sourceSRV && destRTV)
- {
- gl::Rectangle sourceArea;
- sourceArea.x = 0;
- sourceArea.y = 0;
- sourceArea.width = source->getWidth();
- sourceArea.height = source->getHeight();
-
- gl::Rectangle destArea;
- destArea.x = 0;
- destArea.y = 0;
- destArea.width = dest->getWidth();
- destArea.height = dest->getHeight();
-
- mRenderer->copyTexture(sourceSRV, sourceArea, source->getWidth(), source->getHeight(),
- destRTV, destArea, dest->getWidth(), dest->getHeight(),
- GL_RGBA);
- }
- }
-}
-
-TextureStorage11_2D::TextureStorage11_2D(Renderer *renderer, SwapChain11 *swapchain)
- : TextureStorage11(renderer, D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE)
-{
- mTexture = swapchain->getOffscreenTexture();
- mSRV = swapchain->getRenderTargetShaderResource();
-
- for (unsigned int i = 0; i < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
- {
- mRenderTarget[i] = NULL;
- }
-
- D3D11_TEXTURE2D_DESC texDesc;
- mTexture->GetDesc(&texDesc);
- mMipLevels = texDesc.MipLevels;
- mTextureFormat = texDesc.Format;
- mTextureWidth = texDesc.Width;
- mTextureHeight = texDesc.Height;
-
- D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
- mSRV->GetDesc(&srvDesc);
- mShaderResourceFormat = srvDesc.Format;
-
- ID3D11RenderTargetView* offscreenRTV = swapchain->getRenderTarget();
- D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
- offscreenRTV->GetDesc(&rtvDesc);
- mRenderTargetFormat = rtvDesc.Format;
- offscreenRTV->Release();
-
- mDepthStencilFormat = DXGI_FORMAT_UNKNOWN;
-}
-
-TextureStorage11_2D::TextureStorage11_2D(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height)
- : TextureStorage11(renderer, GetTextureBindFlags(gl_d3d11::ConvertTextureFormat(internalformat), usage, forceRenderable))
-{
- for (unsigned int i = 0; i < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
- {
- mRenderTarget[i] = NULL;
- }
-
- DXGI_FORMAT convertedFormat = gl_d3d11::ConvertTextureFormat(internalformat);
- if (d3d11::IsDepthStencilFormat(convertedFormat))
- {
- mTextureFormat = d3d11::GetDepthTextureFormat(convertedFormat);
- mShaderResourceFormat = d3d11::GetDepthShaderResourceFormat(convertedFormat);
- mDepthStencilFormat = convertedFormat;
- mRenderTargetFormat = DXGI_FORMAT_UNKNOWN;
- }
- else
- {
- mTextureFormat = convertedFormat;
- mShaderResourceFormat = convertedFormat;
- mDepthStencilFormat = DXGI_FORMAT_UNKNOWN;
- mRenderTargetFormat = convertedFormat;
- }
-
- // if the width or height is not positive this should be treated as an incomplete texture
- // we handle that here by skipping the d3d texture creation
- if (width > 0 && height > 0)
- {
- // adjust size if needed for compressed textures
- gl::MakeValidSize(false, gl::IsCompressed(internalformat), &width, &height, &mLodOffset);
-
- ID3D11Device *device = mRenderer->getDevice();
-
- D3D11_TEXTURE2D_DESC desc;
- desc.Width = width; // Compressed texture size constraints?
- desc.Height = height;
- desc.MipLevels = (levels > 0) ? levels + mLodOffset : 0;
- desc.ArraySize = 1;
- desc.Format = mTextureFormat;
- desc.SampleDesc.Count = 1;
- desc.SampleDesc.Quality = 0;
- desc.Usage = D3D11_USAGE_DEFAULT;
- desc.BindFlags = getBindFlags();
- desc.CPUAccessFlags = 0;
- desc.MiscFlags = 0;
-
- HRESULT result = device->CreateTexture2D(&desc, NULL, &mTexture);
-
- // this can happen from windows TDR
- if (d3d11::isDeviceLostError(result))
- {
- mRenderer->notifyDeviceLost();
- gl::error(GL_OUT_OF_MEMORY);
- }
- else if (FAILED(result))
- {
- ASSERT(result == E_OUTOFMEMORY);
- ERR("Creating image failed.");
- gl::error(GL_OUT_OF_MEMORY);
- }
- else
- {
- mTexture->GetDesc(&desc);
- mMipLevels = desc.MipLevels;
- mTextureWidth = desc.Width;
- mTextureHeight = desc.Height;
- }
- }
-}
-
-TextureStorage11_2D::~TextureStorage11_2D()
-{
- if (mTexture)
- {
- mTexture->Release();
- mTexture = NULL;
- }
-
- if (mSRV)
- {
- mSRV->Release();
- mSRV = NULL;
- }
-
- for (unsigned int i = 0; i < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
- {
- delete mRenderTarget[i];
- mRenderTarget[i] = NULL;
- }
-}
-
-TextureStorage11_2D *TextureStorage11_2D::makeTextureStorage11_2D(TextureStorage *storage)
-{
- ASSERT(HAS_DYNAMIC_TYPE(TextureStorage11_2D*, storage));
- return static_cast<TextureStorage11_2D*>(storage);
-}
-
-RenderTarget *TextureStorage11_2D::getRenderTarget(int level)
-{
- if (level >= 0 && level < static_cast<int>(mMipLevels))
- {
- if (!mRenderTarget[level])
- {
- ID3D11Device *device = mRenderer->getDevice();
- HRESULT result;
-
- D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
- srvDesc.Format = mShaderResourceFormat;
- srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
- srvDesc.Texture2D.MostDetailedMip = level;
- srvDesc.Texture2D.MipLevels = 1;
-
- ID3D11ShaderResourceView *srv;
- result = device->CreateShaderResourceView(mTexture, &srvDesc, &srv);
-
- if (result == E_OUTOFMEMORY)
- {
- return gl::error(GL_OUT_OF_MEMORY, static_cast<RenderTarget*>(NULL));
- }
- ASSERT(SUCCEEDED(result));
-
- if (mRenderTargetFormat != DXGI_FORMAT_UNKNOWN)
- {
- D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
- rtvDesc.Format = mRenderTargetFormat;
- rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
- rtvDesc.Texture2D.MipSlice = level;
-
- ID3D11RenderTargetView *rtv;
- result = device->CreateRenderTargetView(mTexture, &rtvDesc, &rtv);
-
- if (result == E_OUTOFMEMORY)
- {
- srv->Release();
- return gl::error(GL_OUT_OF_MEMORY, static_cast<RenderTarget*>(NULL));
- }
- ASSERT(SUCCEEDED(result));
-
- // RenderTarget11 expects to be the owner of the resources it is given but TextureStorage11
- // also needs to keep a reference to the texture.
- mTexture->AddRef();
-
- mRenderTarget[level] = new RenderTarget11(mRenderer, rtv, mTexture, srv,
- std::max(mTextureWidth >> level, 1U),
- std::max(mTextureHeight >> level, 1U));
- }
- else if (mDepthStencilFormat != DXGI_FORMAT_UNKNOWN)
- {
- D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
- dsvDesc.Format = mDepthStencilFormat;
- dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
- dsvDesc.Texture2D.MipSlice = level;
- dsvDesc.Flags = 0;
-
- ID3D11DepthStencilView *dsv;
- result = device->CreateDepthStencilView(mTexture, &dsvDesc, &dsv);
-
- if (result == E_OUTOFMEMORY)
- {
- srv->Release();
- return gl::error(GL_OUT_OF_MEMORY, static_cast<RenderTarget*>(NULL));
- }
- ASSERT(SUCCEEDED(result));
-
- // RenderTarget11 expects to be the owner of the resources it is given but TextureStorage11
- // also needs to keep a reference to the texture.
- mTexture->AddRef();
-
- mRenderTarget[level] = new RenderTarget11(mRenderer, dsv, mTexture, srv,
- std::max(mTextureWidth >> level, 1U),
- std::max(mTextureHeight >> level, 1U));
- }
- else
- {
- UNREACHABLE();
- }
- }
-
- return mRenderTarget[level];
- }
- else
- {
- return NULL;
- }
-}
-
-ID3D11ShaderResourceView *TextureStorage11_2D::getSRV()
-{
- if (!mSRV)
- {
- ID3D11Device *device = mRenderer->getDevice();
-
- D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
- srvDesc.Format = mShaderResourceFormat;
- srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
- srvDesc.Texture2D.MipLevels = (mMipLevels == 0 ? -1 : mMipLevels);
- srvDesc.Texture2D.MostDetailedMip = 0;
-
- HRESULT result = device->CreateShaderResourceView(mTexture, &srvDesc, &mSRV);
-
- if (result == E_OUTOFMEMORY)
- {
- return gl::error(GL_OUT_OF_MEMORY, static_cast<ID3D11ShaderResourceView*>(NULL));
- }
- ASSERT(SUCCEEDED(result));
- }
-
- return mSRV;
-}
-
-void TextureStorage11_2D::generateMipmap(int level)
-{
- RenderTarget11 *source = RenderTarget11::makeRenderTarget11(getRenderTarget(level - 1));
- RenderTarget11 *dest = RenderTarget11::makeRenderTarget11(getRenderTarget(level));
-
- generateMipmapLayer(source, dest);
-}
-
-TextureStorage11_Cube::TextureStorage11_Cube(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size)
- : TextureStorage11(renderer, GetTextureBindFlags(gl_d3d11::ConvertTextureFormat(internalformat), usage, forceRenderable))
-{
- for (unsigned int i = 0; i < 6; i++)
- {
- for (unsigned int j = 0; j < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; j++)
- {
- mRenderTarget[i][j] = NULL;
- }
- }
-
- DXGI_FORMAT convertedFormat = gl_d3d11::ConvertTextureFormat(internalformat);
- if (d3d11::IsDepthStencilFormat(convertedFormat))
- {
- mTextureFormat = d3d11::GetDepthTextureFormat(convertedFormat);
- mShaderResourceFormat = d3d11::GetDepthShaderResourceFormat(convertedFormat);
- mDepthStencilFormat = convertedFormat;
- mRenderTargetFormat = DXGI_FORMAT_UNKNOWN;
- }
- else
- {
- mTextureFormat = convertedFormat;
- mShaderResourceFormat = convertedFormat;
- mDepthStencilFormat = DXGI_FORMAT_UNKNOWN;
- mRenderTargetFormat = convertedFormat;
- }
-
- // if the size is not positive this should be treated as an incomplete texture
- // we handle that here by skipping the d3d texture creation
- if (size > 0)
- {
- // adjust size if needed for compressed textures
- int height = size;
- gl::MakeValidSize(false, gl::IsCompressed(internalformat), &size, &height, &mLodOffset);
-
- ID3D11Device *device = mRenderer->getDevice();
-
- D3D11_TEXTURE2D_DESC desc;
- desc.Width = size;
- desc.Height = size;
- desc.MipLevels = (levels > 0) ? levels + mLodOffset : 0;
- desc.ArraySize = 6;
- desc.Format = mTextureFormat;
- desc.SampleDesc.Count = 1;
- desc.SampleDesc.Quality = 0;
- desc.Usage = D3D11_USAGE_DEFAULT;
- desc.BindFlags = getBindFlags();
- desc.CPUAccessFlags = 0;
- desc.MiscFlags = D3D11_RESOURCE_MISC_TEXTURECUBE;
-
- HRESULT result = device->CreateTexture2D(&desc, NULL, &mTexture);
-
- if (FAILED(result))
- {
- ASSERT(result == E_OUTOFMEMORY);
- ERR("Creating image failed.");
- gl::error(GL_OUT_OF_MEMORY);
- }
- else
- {
- mTexture->GetDesc(&desc);
- mMipLevels = desc.MipLevels;
- mTextureWidth = desc.Width;
- mTextureHeight = desc.Height;
- }
- }
-}
-
-TextureStorage11_Cube::~TextureStorage11_Cube()
-{
- if (mTexture)
- {
- mTexture->Release();
- mTexture = NULL;
- }
-
- if (mSRV)
- {
- mSRV->Release();
- mSRV = NULL;
- }
-
- for (unsigned int i = 0; i < 6; i++)
- {
- for (unsigned int j = 0; j < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; j++)
- {
- delete mRenderTarget[i][j];
- mRenderTarget[i][j] = NULL;
- }
- }
-}
-
-TextureStorage11_Cube *TextureStorage11_Cube::makeTextureStorage11_Cube(TextureStorage *storage)
-{
- ASSERT(HAS_DYNAMIC_TYPE(TextureStorage11_Cube*, storage));
- return static_cast<TextureStorage11_Cube*>(storage);
-}
-
-RenderTarget *TextureStorage11_Cube::getRenderTarget(GLenum faceTarget, int level)
-{
- unsigned int faceIdx = gl::TextureCubeMap::faceIndex(faceTarget);
- if (level >= 0 && level < static_cast<int>(mMipLevels))
- {
- if (!mRenderTarget[faceIdx][level])
- {
- ID3D11Device *device = mRenderer->getDevice();
- HRESULT result;
-
- D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
- srvDesc.Format = mShaderResourceFormat;
- srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY; // Will be used with Texture2D sampler, not TextureCube
- srvDesc.Texture2DArray.MostDetailedMip = level;
- srvDesc.Texture2DArray.MipLevels = 1;
- srvDesc.Texture2DArray.FirstArraySlice = faceIdx;
- srvDesc.Texture2DArray.ArraySize = 1;
-
- ID3D11ShaderResourceView *srv;
- result = device->CreateShaderResourceView(mTexture, &srvDesc, &srv);
-
- if (result == E_OUTOFMEMORY)
- {
- return gl::error(GL_OUT_OF_MEMORY, static_cast<RenderTarget*>(NULL));
- }
- ASSERT(SUCCEEDED(result));
-
- if (mRenderTargetFormat != DXGI_FORMAT_UNKNOWN)
- {
- D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
- rtvDesc.Format = mRenderTargetFormat;
- rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
- rtvDesc.Texture2DArray.MipSlice = level;
- rtvDesc.Texture2DArray.FirstArraySlice = faceIdx;
- rtvDesc.Texture2DArray.ArraySize = 1;
-
- ID3D11RenderTargetView *rtv;
- result = device->CreateRenderTargetView(mTexture, &rtvDesc, &rtv);
-
- if (result == E_OUTOFMEMORY)
- {
- srv->Release();
- return gl::error(GL_OUT_OF_MEMORY, static_cast<RenderTarget*>(NULL));
- }
- ASSERT(SUCCEEDED(result));
-
- // RenderTarget11 expects to be the owner of the resources it is given but TextureStorage11
- // also needs to keep a reference to the texture.
- mTexture->AddRef();
-
- mRenderTarget[faceIdx][level] = new RenderTarget11(mRenderer, rtv, mTexture, srv,
- std::max(mTextureWidth >> level, 1U),
- std::max(mTextureHeight >> level, 1U));
- }
- else if (mDepthStencilFormat != DXGI_FORMAT_UNKNOWN)
- {
- D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
- dsvDesc.Format = mRenderTargetFormat;
- dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DARRAY;
- dsvDesc.Texture2DArray.MipSlice = level;
- dsvDesc.Texture2DArray.FirstArraySlice = faceIdx;
- dsvDesc.Texture2DArray.ArraySize = 1;
-
- ID3D11DepthStencilView *dsv;
- result = device->CreateDepthStencilView(mTexture, &dsvDesc, &dsv);
-
- if (result == E_OUTOFMEMORY)
- {
- srv->Release();
- return gl::error(GL_OUT_OF_MEMORY, static_cast<RenderTarget*>(NULL));
- }
- ASSERT(SUCCEEDED(result));
-
- // RenderTarget11 expects to be the owner of the resources it is given but TextureStorage11
- // also needs to keep a reference to the texture.
- mTexture->AddRef();
-
- mRenderTarget[faceIdx][level] = new RenderTarget11(mRenderer, dsv, mTexture, srv,
- std::max(mTextureWidth >> level, 1U),
- std::max(mTextureHeight >> level, 1U));
- }
- else
- {
- UNREACHABLE();
- }
- }
-
- return mRenderTarget[faceIdx][level];
- }
- else
- {
- return NULL;
- }
-}
-
-ID3D11ShaderResourceView *TextureStorage11_Cube::getSRV()
-{
- if (!mSRV)
- {
- ID3D11Device *device = mRenderer->getDevice();
-
- D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
- srvDesc.Format = mShaderResourceFormat;
- srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE;
- srvDesc.TextureCube.MipLevels = (mMipLevels == 0 ? -1 : mMipLevels);
- srvDesc.TextureCube.MostDetailedMip = 0;
-
- HRESULT result = device->CreateShaderResourceView(mTexture, &srvDesc, &mSRV);
-
- if (result == E_OUTOFMEMORY)
- {
- return gl::error(GL_OUT_OF_MEMORY, static_cast<ID3D11ShaderResourceView*>(NULL));
- }
- ASSERT(SUCCEEDED(result));
- }
-
- return mSRV;
-}
-
-void TextureStorage11_Cube::generateMipmap(int face, int level)
-{
- RenderTarget11 *source = RenderTarget11::makeRenderTarget11(getRenderTarget(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level - 1));
- RenderTarget11 *dest = RenderTarget11::makeRenderTarget11(getRenderTarget(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level));
-
- generateMipmapLayer(source, dest);
-}
-
-}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/TextureStorage11.h b/chromium/third_party/angle/src/libGLESv2/renderer/TextureStorage11.h
deleted file mode 100644
index 3c5ded05b88..00000000000
--- a/chromium/third_party/angle/src/libGLESv2/renderer/TextureStorage11.h
+++ /dev/null
@@ -1,120 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// TextureStorage11.h: Defines the abstract rx::TextureStorage11 class and its concrete derived
-// classes TextureStorage11_2D and TextureStorage11_Cube, which act as the interface to the D3D11 texture.
-
-#ifndef LIBGLESV2_RENDERER_TEXTURESTORAGE11_H_
-#define LIBGLESV2_RENDERER_TEXTURESTORAGE11_H_
-
-#include "libGLESv2/Texture.h"
-#include "libGLESv2/renderer/TextureStorage.h"
-
-namespace rx
-{
-class RenderTarget;
-class RenderTarget11;
-class Renderer;
-class Renderer11;
-class SwapChain11;
-
-class TextureStorage11 : public TextureStorage
-{
- public:
- TextureStorage11(Renderer *renderer, UINT bindFlags);
- virtual ~TextureStorage11();
-
- static TextureStorage11 *makeTextureStorage11(TextureStorage *storage);
-
- static DWORD GetTextureBindFlags(DXGI_FORMAT d3dfmt, GLenum glusage, bool forceRenderable);
- static bool IsTextureFormatRenderable(DXGI_FORMAT format);
-
- UINT getBindFlags() const;
-
- virtual ID3D11Texture2D *getBaseTexture() const;
- virtual ID3D11ShaderResourceView *getSRV() = 0;
- virtual RenderTarget *getRenderTarget() { return getRenderTarget(0); }
- virtual RenderTarget *getRenderTarget(int level) { return NULL; }
- virtual RenderTarget *getRenderTarget(GLenum faceTarget) { return getRenderTarget(faceTarget, 0); }
- virtual RenderTarget *getRenderTarget(GLenum faceTarget, int level) { return NULL; }
-
- virtual void generateMipmap(int level) {};
- virtual void generateMipmap(int face, int level) {};
-
- virtual int getLodOffset() const;
- virtual bool isRenderTarget() const;
- virtual bool isManaged() const;
- virtual int levelCount();
- UINT getSubresourceIndex(int level, int faceTarget);
-
- bool updateSubresourceLevel(ID3D11Texture2D *texture, unsigned int sourceSubresource, int level,
- int faceTarget, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
-
- protected:
- void generateMipmapLayer(RenderTarget11 *source, RenderTarget11 *dest);
-
- Renderer11 *mRenderer;
- int mLodOffset;
- unsigned int mMipLevels;
-
- ID3D11Texture2D *mTexture;
- DXGI_FORMAT mTextureFormat;
- DXGI_FORMAT mShaderResourceFormat;
- DXGI_FORMAT mRenderTargetFormat;
- DXGI_FORMAT mDepthStencilFormat;
- unsigned int mTextureWidth;
- unsigned int mTextureHeight;
-
- ID3D11ShaderResourceView *mSRV;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(TextureStorage11);
-
- const UINT mBindFlags;
-};
-
-class TextureStorage11_2D : public TextureStorage11
-{
- public:
- TextureStorage11_2D(Renderer *renderer, SwapChain11 *swapchain);
- TextureStorage11_2D(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height);
- virtual ~TextureStorage11_2D();
-
- static TextureStorage11_2D *makeTextureStorage11_2D(TextureStorage *storage);
-
- virtual ID3D11ShaderResourceView *getSRV();
- virtual RenderTarget *getRenderTarget(int level);
-
- virtual void generateMipmap(int level);
-
- private:
- DISALLOW_COPY_AND_ASSIGN(TextureStorage11_2D);
-
- RenderTarget11 *mRenderTarget[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
-};
-
-class TextureStorage11_Cube : public TextureStorage11
-{
- public:
- TextureStorage11_Cube(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size);
- virtual ~TextureStorage11_Cube();
-
- static TextureStorage11_Cube *makeTextureStorage11_Cube(TextureStorage *storage);
-
- virtual ID3D11ShaderResourceView *getSRV();
- virtual RenderTarget *getRenderTarget(GLenum faceTarget, int level);
-
- virtual void generateMipmap(int face, int level);
-
- private:
- DISALLOW_COPY_AND_ASSIGN(TextureStorage11_Cube);
-
- RenderTarget11 *mRenderTarget[6][gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
-};
-
-}
-
-#endif // LIBGLESV2_RENDERER_TEXTURESTORAGE11_H_
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/VertexBuffer.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/VertexBuffer.cpp
index a073d95033f..8adfb5bfa74 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/VertexBuffer.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/VertexBuffer.cpp
@@ -10,7 +10,9 @@
#include "libGLESv2/renderer/VertexBuffer.h"
#include "libGLESv2/renderer/Renderer.h"
-#include "libGLESv2/Context.h"
+#include "libGLESv2/VertexAttribute.h"
+#include "libGLESv2/renderer/BufferStorage.h"
+#include "common/mathutil.h"
namespace rx
{
@@ -87,8 +89,8 @@ bool VertexBufferInterface::discard()
return mVertexBuffer->discard();
}
-bool VertexBufferInterface::storeVertexAttributes(const gl::VertexAttribute &attrib, GLint start, GLsizei count, GLsizei instances,
- unsigned int *outStreamOffset)
+bool VertexBufferInterface::storeVertexAttributes(const gl::VertexAttribute &attrib, const gl::VertexAttribCurrentValueData &currentValue,
+ GLint start, GLsizei count, GLsizei instances, unsigned int *outStreamOffset)
{
unsigned int spaceRequired;
if (!mVertexBuffer->getSpaceRequired(attrib, count, instances, &spaceRequired))
@@ -107,7 +109,7 @@ bool VertexBufferInterface::storeVertexAttributes(const gl::VertexAttribute &att
}
mReservedSpace = 0;
- if (!mVertexBuffer->storeVertexAttributes(attrib, start, count, instances, mWritePosition))
+ if (!mVertexBuffer->storeVertexAttributes(attrib, currentValue, start, count, instances, mWritePosition))
{
return false;
}
@@ -119,33 +121,8 @@ bool VertexBufferInterface::storeVertexAttributes(const gl::VertexAttribute &att
mWritePosition += spaceRequired;
- return true;
-}
-
-bool VertexBufferInterface::storeRawData(const void* data, unsigned int size, unsigned int *outStreamOffset)
-{
- if (mWritePosition + size < mWritePosition)
- {
- return false;
- }
-
- if (!reserveSpace(mReservedSpace))
- {
- return false;
- }
- mReservedSpace = 0;
-
- if (!mVertexBuffer->storeRawData(data, size, mWritePosition))
- {
- return false;
- }
-
- if (outStreamOffset)
- {
- *outStreamOffset = mWritePosition;
- }
-
- mWritePosition += size;
+ // Align to 16-byte boundary
+ mWritePosition = rx::roundUp(mWritePosition, 16u);
return true;
}
@@ -165,18 +142,10 @@ bool VertexBufferInterface::reserveVertexSpace(const gl::VertexAttribute &attrib
}
mReservedSpace += requiredSpace;
- return true;
-}
-bool VertexBufferInterface::reserveRawDataSpace(unsigned int size)
-{
- // Protect against integer overflow
- if (mReservedSpace + size < mReservedSpace)
- {
- return false;
- }
+ // Align to 16-byte boundary
+ mReservedSpace = rx::roundUp(mReservedSpace, 16u);
- mReservedSpace += size;
return true;
}
@@ -185,6 +154,39 @@ VertexBuffer* VertexBufferInterface::getVertexBuffer() const
return mVertexBuffer;
}
+bool VertexBufferInterface::directStoragePossible(const gl::VertexAttribute &attrib,
+ const gl::VertexAttribCurrentValueData &currentValue) const
+{
+ gl::Buffer *buffer = attrib.mBoundBuffer.get();
+ BufferStorage *storage = buffer ? buffer->getStorage() : NULL;
+
+ if (!storage || !storage->supportsDirectBinding())
+ {
+ return false;
+ }
+
+ // Alignment restrictions: In D3D, vertex data must be aligned to
+ // the format stride, or to a 4-byte boundary, whichever is smaller.
+ // (Undocumented, and experimentally confirmed)
+ size_t alignment = 4;
+ bool requiresConversion = false;
+
+ if (attrib.mType != GL_FLOAT)
+ {
+ gl::VertexFormat vertexFormat(attrib, currentValue.Type);
+
+ unsigned int outputElementSize;
+ getVertexBuffer()->getSpaceRequired(attrib, 1, 0, &outputElementSize);
+ alignment = std::min<size_t>(outputElementSize, 4);
+
+ requiresConversion = (mRenderer->getVertexConversionType(vertexFormat) & VERTEX_CONVERT_CPU) != 0;
+ }
+
+ bool isAligned = (static_cast<size_t>(attrib.stride()) % alignment == 0) &&
+ (static_cast<size_t>(attrib.mOffset) % alignment == 0);
+
+ return !requiresConversion && isAligned;
+}
StreamingVertexBufferInterface::StreamingVertexBufferInterface(rx::Renderer *renderer, std::size_t initialSize) : VertexBufferInterface(renderer, true)
{
@@ -231,7 +233,8 @@ bool StaticVertexBufferInterface::lookupAttribute(const gl::VertexAttribute &att
if (mCache[element].type == attribute.mType &&
mCache[element].size == attribute.mSize &&
mCache[element].stride == attribute.stride() &&
- mCache[element].normalized == attribute.mNormalized)
+ mCache[element].normalized == attribute.mNormalized &&
+ mCache[element].pureInteger == attribute.mPureInteger)
{
if (mCache[element].attributeOffset == attribute.mOffset % attribute.stride())
{
@@ -266,14 +269,14 @@ bool StaticVertexBufferInterface::reserveSpace(unsigned int size)
}
}
-bool StaticVertexBufferInterface::storeVertexAttributes(const gl::VertexAttribute &attrib, GLint start, GLsizei count, GLsizei instances,
- unsigned int *outStreamOffset)
+bool StaticVertexBufferInterface::storeVertexAttributes(const gl::VertexAttribute &attrib, const gl::VertexAttribCurrentValueData &currentValue,
+ GLint start, GLsizei count, GLsizei instances, unsigned int *outStreamOffset)
{
unsigned int streamOffset;
- if (VertexBufferInterface::storeVertexAttributes(attrib, start, count, instances, &streamOffset))
+ if (VertexBufferInterface::storeVertexAttributes(attrib, currentValue, start, count, instances, &streamOffset))
{
int attributeOffset = attrib.mOffset % attrib.stride();
- VertexElement element = { attrib.mType, attrib.mSize, attrib.stride(), attrib.mNormalized, attributeOffset, streamOffset };
+ VertexElement element = { attrib.mType, attrib.mSize, attrib.stride(), attrib.mNormalized, attrib.mPureInteger, attributeOffset, streamOffset };
mCache.push_back(element);
if (outStreamOffset)
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/VertexBuffer.h b/chromium/third_party/angle/src/libGLESv2/renderer/VertexBuffer.h
index cbafdd20f60..d4cdf9ee852 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/VertexBuffer.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/VertexBuffer.h
@@ -15,6 +15,7 @@
namespace gl
{
class VertexAttribute;
+struct VertexAttribCurrentValueData;
}
namespace rx
@@ -29,15 +30,11 @@ class VertexBuffer
virtual bool initialize(unsigned int size, bool dynamicUsage) = 0;
- virtual bool storeVertexAttributes(const gl::VertexAttribute &attrib, GLint start, GLsizei count,
- GLsizei instances, unsigned int offset) = 0;
- virtual bool storeRawData(const void* data, unsigned int size, unsigned int offset) = 0;
-
+ virtual bool storeVertexAttributes(const gl::VertexAttribute &attrib, const gl::VertexAttribCurrentValueData &currentValue,
+ GLint start, GLsizei count, GLsizei instances, unsigned int offset) = 0;
virtual bool getSpaceRequired(const gl::VertexAttribute &attrib, GLsizei count, GLsizei instances,
unsigned int *outSpaceRequired) const = 0;
- virtual bool requiresConversion(const gl::VertexAttribute &attrib) const = 0;
-
virtual unsigned int getBufferSize() const = 0;
virtual bool setBufferSize(unsigned int size) = 0;
virtual bool discard() = 0;
@@ -61,15 +58,16 @@ class VertexBufferInterface
virtual ~VertexBufferInterface();
bool reserveVertexSpace(const gl::VertexAttribute &attribute, GLsizei count, GLsizei instances);
- bool reserveRawDataSpace(unsigned int size);
unsigned int getBufferSize() const;
unsigned int getSerial() const;
- virtual bool storeVertexAttributes(const gl::VertexAttribute &attrib, GLint start, GLsizei count, GLsizei instances,
- unsigned int *outStreamOffset);
- virtual bool storeRawData(const void* data, unsigned int size, unsigned int *outStreamOffset);
+ virtual bool storeVertexAttributes(const gl::VertexAttribute &attrib, const gl::VertexAttribCurrentValueData &currentValue,
+ GLint start, GLsizei count, GLsizei instances, unsigned int *outStreamOffset);
+
+ bool directStoragePossible(const gl::VertexAttribute &attrib,
+ const gl::VertexAttribCurrentValueData &currentValue) const;
VertexBuffer* getVertexBuffer() const;
@@ -111,10 +109,10 @@ class StaticVertexBufferInterface : public VertexBufferInterface
explicit StaticVertexBufferInterface(rx::Renderer *renderer);
~StaticVertexBufferInterface();
- bool storeVertexAttributes(const gl::VertexAttribute &attrib, GLint start, GLsizei count, GLsizei instances,
- unsigned int *outStreamOffset);
+ bool storeVertexAttributes(const gl::VertexAttribute &attrib, const gl::VertexAttribCurrentValueData &currentValue,
+ GLint start, GLsizei count, GLsizei instances, unsigned int *outStreamOffset);
- bool lookupAttribute(const gl::VertexAttribute &attribute, unsigned int* outStreamOffset);
+ bool lookupAttribute(const gl::VertexAttribute &attribute, unsigned int* outStreamFffset);
protected:
bool reserveSpace(unsigned int size);
@@ -126,6 +124,7 @@ class StaticVertexBufferInterface : public VertexBufferInterface
GLint size;
GLsizei stride;
bool normalized;
+ bool pureInteger;
int attributeOffset;
unsigned int streamOffset;
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/VertexBuffer11.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/VertexBuffer11.cpp
deleted file mode 100644
index 521da80c3d7..00000000000
--- a/chromium/third_party/angle/src/libGLESv2/renderer/VertexBuffer11.cpp
+++ /dev/null
@@ -1,440 +0,0 @@
-#include "precompiled.h"
-//
-// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// VertexBuffer11.cpp: Defines the D3D11 VertexBuffer implementation.
-
-#include "libGLESv2/renderer/VertexBuffer11.h"
-#include "libGLESv2/renderer/BufferStorage.h"
-
-#include "libGLESv2/Buffer.h"
-#include "libGLESv2/renderer/Renderer11.h"
-#include "libGLESv2/Context.h"
-
-namespace rx
-{
-
-VertexBuffer11::VertexBuffer11(rx::Renderer11 *const renderer) : mRenderer(renderer)
-{
- mBuffer = NULL;
- mBufferSize = 0;
- mDynamicUsage = false;
-}
-
-VertexBuffer11::~VertexBuffer11()
-{
- if (mBuffer)
- {
- mBuffer->Release();
- mBuffer = NULL;
- }
-}
-
-bool VertexBuffer11::initialize(unsigned int size, bool dynamicUsage)
-{
- if (mBuffer)
- {
- mBuffer->Release();
- mBuffer = NULL;
- }
-
- updateSerial();
-
- if (size > 0)
- {
- ID3D11Device* dxDevice = mRenderer->getDevice();
-
- D3D11_BUFFER_DESC bufferDesc;
- bufferDesc.ByteWidth = size;
- bufferDesc.Usage = D3D11_USAGE_DYNAMIC;
- bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
- bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
- bufferDesc.MiscFlags = 0;
- bufferDesc.StructureByteStride = 0;
-
- HRESULT result = dxDevice->CreateBuffer(&bufferDesc, NULL, &mBuffer);
- if (FAILED(result))
- {
- return false;
- }
- }
-
- mBufferSize = size;
- mDynamicUsage = dynamicUsage;
- return true;
-}
-
-VertexBuffer11 *VertexBuffer11::makeVertexBuffer11(VertexBuffer *vetexBuffer)
-{
- ASSERT(HAS_DYNAMIC_TYPE(VertexBuffer11*, vetexBuffer));
- return static_cast<VertexBuffer11*>(vetexBuffer);
-}
-
-bool VertexBuffer11::storeVertexAttributes(const gl::VertexAttribute &attrib, GLint start, GLsizei count,
- GLsizei instances, unsigned int offset)
-{
- if (mBuffer)
- {
- gl::Buffer *buffer = attrib.mBoundBuffer.get();
-
- int inputStride = attrib.stride();
- const VertexConverter &converter = getVertexConversion(attrib);
-
- ID3D11DeviceContext *dxContext = mRenderer->getDeviceContext();
-
- D3D11_MAPPED_SUBRESOURCE mappedResource;
- HRESULT result = dxContext->Map(mBuffer, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &mappedResource);
- if (FAILED(result))
- {
- ERR("Vertex buffer map failed with error 0x%08x", result);
- return false;
- }
-
- char* output = reinterpret_cast<char*>(mappedResource.pData) + offset;
-
- const char *input = NULL;
- if (buffer)
- {
- BufferStorage *storage = buffer->getStorage();
- input = static_cast<const char*>(storage->getData()) + static_cast<int>(attrib.mOffset);
- }
- else
- {
- input = static_cast<const char*>(attrib.mPointer);
- }
-
- if (instances == 0 || attrib.mDivisor == 0)
- {
- input += inputStride * start;
- }
-
- converter.conversionFunc(input, inputStride, count, output);
-
- dxContext->Unmap(mBuffer, 0);
-
- return true;
- }
- else
- {
- ERR("Vertex buffer not initialized.");
- return false;
- }
-}
-
-bool VertexBuffer11::storeRawData(const void* data, unsigned int size, unsigned int offset)
-{
- if (mBuffer)
- {
- ID3D11DeviceContext *dxContext = mRenderer->getDeviceContext();
-
- D3D11_MAPPED_SUBRESOURCE mappedResource;
- HRESULT result = dxContext->Map(mBuffer, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &mappedResource);
- if (FAILED(result))
- {
- ERR("Vertex buffer map failed with error 0x%08x", result);
- return false;
- }
-
- char* bufferData = static_cast<char*>(mappedResource.pData);
- memcpy(bufferData + offset, data, size);
-
- dxContext->Unmap(mBuffer, 0);
-
- return true;
- }
- else
- {
- ERR("Vertex buffer not initialized.");
- return false;
- }
-}
-
-bool VertexBuffer11::getSpaceRequired(const gl::VertexAttribute &attrib, GLsizei count,
- GLsizei instances, unsigned int *outSpaceRequired) const
-{
- unsigned int elementSize = getVertexConversion(attrib).outputElementSize;
-
- unsigned int elementCount = 0;
- if (instances == 0 || attrib.mDivisor == 0)
- {
- elementCount = count;
- }
- else
- {
- if (static_cast<unsigned int>(instances) < std::numeric_limits<unsigned int>::max() - (attrib.mDivisor - 1))
- {
- // Round up
- elementCount = (static_cast<unsigned int>(instances) + (attrib.mDivisor - 1)) / attrib.mDivisor;
- }
- else
- {
- elementCount = instances / attrib.mDivisor;
- }
- }
-
- if (elementSize <= std::numeric_limits<unsigned int>::max() / elementCount)
- {
- if (outSpaceRequired)
- {
- *outSpaceRequired = elementSize * elementCount;
- }
- return true;
- }
- else
- {
- return false;
- }
-}
-
-bool VertexBuffer11::requiresConversion(const gl::VertexAttribute &attrib) const
-{
- return !getVertexConversion(attrib).identity;
-}
-
-unsigned int VertexBuffer11::getBufferSize() const
-{
- return mBufferSize;
-}
-
-bool VertexBuffer11::setBufferSize(unsigned int size)
-{
- if (size > mBufferSize)
- {
- return initialize(size, mDynamicUsage);
- }
- else
- {
- return true;
- }
-}
-
-bool VertexBuffer11::discard()
-{
- if (mBuffer)
- {
- ID3D11DeviceContext *dxContext = mRenderer->getDeviceContext();
-
- D3D11_MAPPED_SUBRESOURCE mappedResource;
- HRESULT result = dxContext->Map(mBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
- if (FAILED(result))
- {
- ERR("Vertex buffer map failed with error 0x%08x", result);
- return false;
- }
-
- dxContext->Unmap(mBuffer, 0);
-
- return true;
- }
- else
- {
- ERR("Vertex buffer not initialized.");
- return false;
- }
-}
-
-unsigned int VertexBuffer11::getVertexSize(const gl::VertexAttribute &attrib) const
-{
- return getVertexConversion(attrib).outputElementSize;
-}
-
-DXGI_FORMAT VertexBuffer11::getDXGIFormat(const gl::VertexAttribute &attrib) const
-{
- return getVertexConversion(attrib).dxgiFormat;
-}
-
-ID3D11Buffer *VertexBuffer11::getBuffer() const
-{
- return mBuffer;
-}
-
-template <typename T, unsigned int componentCount, bool widen, bool normalized>
-static void copyVertexData(const void *input, unsigned int stride, unsigned int count, void *output)
-{
- unsigned int attribSize = sizeof(T) * componentCount;
-
- if (attribSize == stride && !widen)
- {
- memcpy(output, input, count * attribSize);
- }
- else
- {
- unsigned int outputStride = widen ? 4 : componentCount;
- T defaultVal = normalized ? std::numeric_limits<T>::max() : T(1);
-
- for (unsigned int i = 0; i < count; i++)
- {
- const T *offsetInput = reinterpret_cast<const T*>(reinterpret_cast<const char*>(input) + i * stride);
- T *offsetOutput = reinterpret_cast<T*>(output) + i * outputStride;
-
- for (unsigned int j = 0; j < componentCount; j++)
- {
- offsetOutput[j] = offsetInput[j];
- }
-
- if (widen)
- {
- offsetOutput[3] = defaultVal;
- }
- }
- }
-}
-
-template <unsigned int componentCount>
-static void copyFixedVertexData(const void* input, unsigned int stride, unsigned int count, void* output)
-{
- static const float divisor = 1.0f / (1 << 16);
-
- for (unsigned int i = 0; i < count; i++)
- {
- const GLfixed* offsetInput = reinterpret_cast<const GLfixed*>(reinterpret_cast<const char*>(input) + stride * i);
- float* offsetOutput = reinterpret_cast<float*>(output) + i * componentCount;
-
- for (unsigned int j = 0; j < componentCount; j++)
- {
- offsetOutput[j] = static_cast<float>(offsetInput[j]) * divisor;
- }
- }
-}
-
-template <typename T, unsigned int componentCount, bool normalized>
-static void copyToFloatVertexData(const void* input, unsigned int stride, unsigned int count, void* output)
-{
- typedef std::numeric_limits<T> NL;
-
- for (unsigned int i = 0; i < count; i++)
- {
- const T *offsetInput = reinterpret_cast<const T*>(reinterpret_cast<const char*>(input) + stride * i);
- float *offsetOutput = reinterpret_cast<float*>(output) + i * componentCount;
-
- for (unsigned int j = 0; j < componentCount; j++)
- {
- if (normalized)
- {
- if (NL::is_signed)
- {
- const float divisor = 1.0f / (2 * static_cast<float>(NL::max()) + 1);
- offsetOutput[j] = (2 * static_cast<float>(offsetInput[j]) + 1) * divisor;
- }
- else
- {
- offsetOutput[j] = static_cast<float>(offsetInput[j]) / NL::max();
- }
- }
- else
- {
- offsetOutput[j] = static_cast<float>(offsetInput[j]);
- }
- }
- }
-}
-
-const VertexBuffer11::VertexConverter VertexBuffer11::mPossibleTranslations[NUM_GL_VERTEX_ATTRIB_TYPES][2][4] =
-{
- { // GL_BYTE
- { // unnormalized
- { &copyToFloatVertexData<GLbyte, 1, false>, false, DXGI_FORMAT_R32_FLOAT, 4 },
- { &copyToFloatVertexData<GLbyte, 2, false>, false, DXGI_FORMAT_R32G32_FLOAT, 8 },
- { &copyToFloatVertexData<GLbyte, 3, false>, false, DXGI_FORMAT_R32G32B32_FLOAT, 12 },
- { &copyToFloatVertexData<GLbyte, 4, false>, false, DXGI_FORMAT_R32G32B32A32_FLOAT, 16 },
- },
- { // normalized
- { &copyVertexData<GLbyte, 1, false, true>, true, DXGI_FORMAT_R8_SNORM, 1 },
- { &copyVertexData<GLbyte, 2, false, true>, true, DXGI_FORMAT_R8G8_SNORM, 2 },
- { &copyVertexData<GLbyte, 3, true, true>, false, DXGI_FORMAT_R8G8B8A8_SNORM, 4 },
- { &copyVertexData<GLbyte, 4, false, true>, true, DXGI_FORMAT_R8G8B8A8_SNORM, 4 },
- },
- },
- { // GL_UNSIGNED_BYTE
- { // unnormalized
- { &copyToFloatVertexData<GLubyte, 1, false>, false, DXGI_FORMAT_R32_FLOAT, 4 },
- { &copyToFloatVertexData<GLubyte, 2, false>, false, DXGI_FORMAT_R32G32_FLOAT, 8 },
- { &copyToFloatVertexData<GLubyte, 3, false>, false, DXGI_FORMAT_R32G32B32_FLOAT, 12 },
- { &copyToFloatVertexData<GLubyte, 4, false>, false, DXGI_FORMAT_R32G32B32A32_FLOAT, 16 },
- },
- { // normalized
- { &copyVertexData<GLubyte, 1, false, true>, true, DXGI_FORMAT_R8_UNORM, 1 },
- { &copyVertexData<GLubyte, 2, false, true>, true, DXGI_FORMAT_R8G8_UNORM, 2 },
- { &copyVertexData<GLubyte, 3, true, true>, false, DXGI_FORMAT_R8G8B8A8_UNORM, 4 },
- { &copyVertexData<GLubyte, 4, false, true>, true, DXGI_FORMAT_R8G8B8A8_UNORM, 4 },
- },
- },
- { // GL_SHORT
- { // unnormalized
- { &copyToFloatVertexData<GLshort, 1, false>, false, DXGI_FORMAT_R32_FLOAT, 4 },
- { &copyToFloatVertexData<GLshort, 2, false>, false, DXGI_FORMAT_R32G32_FLOAT, 8 },
- { &copyToFloatVertexData<GLshort, 3, false>, false, DXGI_FORMAT_R32G32B32_FLOAT, 12 },
- { &copyToFloatVertexData<GLshort, 4, false>, false, DXGI_FORMAT_R32G32B32A32_FLOAT, 16 },
- },
- { // normalized
- { &copyVertexData<GLshort, 1, false, true>, true, DXGI_FORMAT_R16_SNORM, 2 },
- { &copyVertexData<GLshort, 2, false, true>, true, DXGI_FORMAT_R16G16_SNORM, 4 },
- { &copyVertexData<GLshort, 3, true, true>, false, DXGI_FORMAT_R16G16B16A16_SNORM, 8 },
- { &copyVertexData<GLshort, 4, false, true>, true, DXGI_FORMAT_R16G16B16A16_SNORM, 8 },
- },
- },
- { // GL_UNSIGNED_SHORT
- { // unnormalized
- { &copyToFloatVertexData<GLushort, 1, false>, false, DXGI_FORMAT_R32_FLOAT, 4 },
- { &copyToFloatVertexData<GLushort, 2, false>, false, DXGI_FORMAT_R32G32_FLOAT, 8 },
- { &copyToFloatVertexData<GLushort, 3, false>, false, DXGI_FORMAT_R32G32B32_FLOAT, 12 },
- { &copyToFloatVertexData<GLushort, 4, false>, false, DXGI_FORMAT_R32G32B32A32_FLOAT, 16 },
- },
- { // normalized
- { &copyVertexData<GLushort, 1, false, true>, true, DXGI_FORMAT_R16_UNORM, 2 },
- { &copyVertexData<GLushort, 2, false, true>, true, DXGI_FORMAT_R16G16_UNORM, 4 },
- { &copyVertexData<GLushort, 3, true, true>, false, DXGI_FORMAT_R16G16B16A16_UNORM, 8 },
- { &copyVertexData<GLushort, 4, false, true>, true, DXGI_FORMAT_R16G16B16A16_UNORM, 8 },
- },
- },
- { // GL_FIXED
- { // unnormalized
- { &copyFixedVertexData<1>, false, DXGI_FORMAT_R32_FLOAT, 4 },
- { &copyFixedVertexData<2>, false, DXGI_FORMAT_R32G32_FLOAT, 8 },
- { &copyFixedVertexData<3>, false, DXGI_FORMAT_R32G32B32_FLOAT, 12 },
- { &copyFixedVertexData<4>, false, DXGI_FORMAT_R32G32B32A32_FLOAT, 16 },
- },
- { // normalized
- { &copyFixedVertexData<1>, false, DXGI_FORMAT_R32_FLOAT, 4 },
- { &copyFixedVertexData<2>, false, DXGI_FORMAT_R32G32_FLOAT, 8 },
- { &copyFixedVertexData<3>, false, DXGI_FORMAT_R32G32B32_FLOAT, 12 },
- { &copyFixedVertexData<4>, false, DXGI_FORMAT_R32G32B32A32_FLOAT, 16 },
- },
- },
- { // GL_FLOAT
- { // unnormalized
- { &copyVertexData<GLfloat, 1, false, false>, true, DXGI_FORMAT_R32_FLOAT, 4 },
- { &copyVertexData<GLfloat, 2, false, false>, true, DXGI_FORMAT_R32G32_FLOAT, 8 },
- { &copyVertexData<GLfloat, 3, false, false>, true, DXGI_FORMAT_R32G32B32_FLOAT, 12 },
- { &copyVertexData<GLfloat, 4, false, false>, true, DXGI_FORMAT_R32G32B32A32_FLOAT, 16 },
- },
- { // normalized
- { &copyVertexData<GLfloat, 1, false, false>, true, DXGI_FORMAT_R32_FLOAT, 4 },
- { &copyVertexData<GLfloat, 2, false, false>, true, DXGI_FORMAT_R32G32_FLOAT, 8 },
- { &copyVertexData<GLfloat, 3, false, false>, true, DXGI_FORMAT_R32G32B32_FLOAT, 12 },
- { &copyVertexData<GLfloat, 4, false, false>, true, DXGI_FORMAT_R32G32B32A32_FLOAT, 16 },
- },
- },
-};
-
-const VertexBuffer11::VertexConverter &VertexBuffer11::getVertexConversion(const gl::VertexAttribute &attribute)
-{
- unsigned int typeIndex = 0;
- switch (attribute.mType)
- {
- case GL_BYTE: typeIndex = 0; break;
- case GL_UNSIGNED_BYTE: typeIndex = 1; break;
- case GL_SHORT: typeIndex = 2; break;
- case GL_UNSIGNED_SHORT: typeIndex = 3; break;
- case GL_FIXED: typeIndex = 4; break;
- case GL_FLOAT: typeIndex = 5; break;
- default: UNREACHABLE(); break;
- }
-
- return mPossibleTranslations[typeIndex][attribute.mNormalized ? 1 : 0][attribute.mSize - 1];
-}
-
-}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/VertexBuffer9.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/VertexBuffer9.cpp
deleted file mode 100644
index 5a792b97f25..00000000000
--- a/chromium/third_party/angle/src/libGLESv2/renderer/VertexBuffer9.cpp
+++ /dev/null
@@ -1,530 +0,0 @@
-#include "precompiled.h"
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// VertexBuffer9.cpp: Defines the D3D9 VertexBuffer implementation.
-
-#include "libGLESv2/renderer/VertexBuffer9.h"
-#include "libGLESv2/renderer/vertexconversion.h"
-#include "libGLESv2/renderer/BufferStorage.h"
-#include "libGLESv2/Context.h"
-#include "libGLESv2/renderer/Renderer9.h"
-
-#include "libGLESv2/Buffer.h"
-
-namespace rx
-{
-
-bool VertexBuffer9::mTranslationsInitialized = false;
-VertexBuffer9::FormatConverter VertexBuffer9::mFormatConverters[NUM_GL_VERTEX_ATTRIB_TYPES][2][4];
-
-VertexBuffer9::VertexBuffer9(rx::Renderer9 *const renderer) : mRenderer(renderer)
-{
- mVertexBuffer = NULL;
- mBufferSize = 0;
- mDynamicUsage = false;
-
- if (!mTranslationsInitialized)
- {
- initializeTranslations(renderer->getCapsDeclTypes());
- mTranslationsInitialized = true;
- }
-}
-
-VertexBuffer9::~VertexBuffer9()
-{
- if (mVertexBuffer)
- {
- mVertexBuffer->Release();
- mVertexBuffer = NULL;
- }
-}
-
-bool VertexBuffer9::initialize(unsigned int size, bool dynamicUsage)
-{
- if (mVertexBuffer)
- {
- mVertexBuffer->Release();
- mVertexBuffer = NULL;
- }
-
- updateSerial();
-
- if (size > 0)
- {
- DWORD flags = D3DUSAGE_WRITEONLY;
- if (dynamicUsage)
- {
- flags |= D3DUSAGE_DYNAMIC;
- }
-
- HRESULT result = mRenderer->createVertexBuffer(size, flags, &mVertexBuffer);
-
- if (FAILED(result))
- {
- ERR("Out of memory allocating a vertex buffer of size %lu.", size);
- return false;
- }
- }
-
- mBufferSize = size;
- mDynamicUsage = dynamicUsage;
- return true;
-}
-
-VertexBuffer9 *VertexBuffer9::makeVertexBuffer9(VertexBuffer *vertexBuffer)
-{
- ASSERT(HAS_DYNAMIC_TYPE(VertexBuffer9*, vertexBuffer));
- return static_cast<VertexBuffer9*>(vertexBuffer);
-}
-
-bool VertexBuffer9::storeVertexAttributes(const gl::VertexAttribute &attrib, GLint start, GLsizei count,
- GLsizei instances, unsigned int offset)
-{
- if (mVertexBuffer)
- {
- gl::Buffer *buffer = attrib.mBoundBuffer.get();
-
- int inputStride = attrib.stride();
- int elementSize = attrib.typeSize();
- const FormatConverter &converter = formatConverter(attrib);
-
- DWORD lockFlags = mDynamicUsage ? D3DLOCK_NOOVERWRITE : 0;
-
- void *mapPtr = NULL;
-
- unsigned int mapSize;
- if (!spaceRequired(attrib, count, instances, &mapSize))
- {
- return false;
- }
-
- HRESULT result = mVertexBuffer->Lock(offset, mapSize, &mapPtr, lockFlags);
-
- if (FAILED(result))
- {
- ERR("Lock failed with error 0x%08x", result);
- return false;
- }
-
- const char *input = NULL;
- if (buffer)
- {
- BufferStorage *storage = buffer->getStorage();
- input = static_cast<const char*>(storage->getData()) + static_cast<int>(attrib.mOffset);
- }
- else
- {
- input = static_cast<const char*>(attrib.mPointer);
- }
-
- if (instances == 0 || attrib.mDivisor == 0)
- {
- input += inputStride * start;
- }
-
- if (converter.identity && inputStride == elementSize)
- {
- memcpy(mapPtr, input, count * inputStride);
- }
- else
- {
- converter.convertArray(input, inputStride, count, mapPtr);
- }
-
- mVertexBuffer->Unlock();
-
- return true;
- }
- else
- {
- ERR("Vertex buffer not initialized.");
- return false;
- }
-}
-
-bool VertexBuffer9::storeRawData(const void* data, unsigned int size, unsigned int offset)
-{
- if (mVertexBuffer)
- {
- DWORD lockFlags = mDynamicUsage ? D3DLOCK_NOOVERWRITE : 0;
-
- void *mapPtr = NULL;
- HRESULT result = mVertexBuffer->Lock(offset, size, &mapPtr, lockFlags);
-
- if (FAILED(result))
- {
- ERR("Lock failed with error 0x%08x", result);
- return false;
- }
-
- memcpy(mapPtr, data, size);
-
- mVertexBuffer->Unlock();
-
- return true;
- }
- else
- {
- ERR("Vertex buffer not initialized.");
- return false;
- }
-}
-
-bool VertexBuffer9::getSpaceRequired(const gl::VertexAttribute &attrib, GLsizei count, GLsizei instances,
- unsigned int *outSpaceRequired) const
-{
- return spaceRequired(attrib, count, instances, outSpaceRequired);
-}
-
-bool VertexBuffer9::requiresConversion(const gl::VertexAttribute &attrib) const
-{
- return !formatConverter(attrib).identity;
-}
-
-unsigned int VertexBuffer9::getVertexSize(const gl::VertexAttribute &attrib) const
-{
- unsigned int spaceRequired;
- return getSpaceRequired(attrib, 1, 0, &spaceRequired) ? spaceRequired : 0;
-}
-
-D3DDECLTYPE VertexBuffer9::getDeclType(const gl::VertexAttribute &attrib) const
-{
- return formatConverter(attrib).d3dDeclType;
-}
-
-unsigned int VertexBuffer9::getBufferSize() const
-{
- return mBufferSize;
-}
-
-bool VertexBuffer9::setBufferSize(unsigned int size)
-{
- if (size > mBufferSize)
- {
- return initialize(size, mDynamicUsage);
- }
- else
- {
- return true;
- }
-}
-
-bool VertexBuffer9::discard()
-{
- if (mVertexBuffer)
- {
- void *dummy;
- HRESULT result;
-
- result = mVertexBuffer->Lock(0, 1, &dummy, D3DLOCK_DISCARD);
- if (FAILED(result))
- {
- ERR("Discard lock failed with error 0x%08x", result);
- return false;
- }
-
- result = mVertexBuffer->Unlock();
- if (FAILED(result))
- {
- ERR("Discard unlock failed with error 0x%08x", result);
- return false;
- }
-
- return true;
- }
- else
- {
- ERR("Vertex buffer not initialized.");
- return false;
- }
-}
-
-IDirect3DVertexBuffer9 * VertexBuffer9::getBuffer() const
-{
- return mVertexBuffer;
-}
-
-// Mapping from OpenGL-ES vertex attrib type to D3D decl type:
-//
-// BYTE SHORT (Cast)
-// BYTE-norm FLOAT (Normalize) (can't be exactly represented as SHORT-norm)
-// UNSIGNED_BYTE UBYTE4 (Identity) or SHORT (Cast)
-// UNSIGNED_BYTE-norm UBYTE4N (Identity) or FLOAT (Normalize)
-// SHORT SHORT (Identity)
-// SHORT-norm SHORT-norm (Identity) or FLOAT (Normalize)
-// UNSIGNED_SHORT FLOAT (Cast)
-// UNSIGNED_SHORT-norm USHORT-norm (Identity) or FLOAT (Normalize)
-// FIXED (not in WebGL) FLOAT (FixedToFloat)
-// FLOAT FLOAT (Identity)
-
-// GLToCType maps from GL type (as GLenum) to the C typedef.
-template <GLenum GLType> struct GLToCType { };
-
-template <> struct GLToCType<GL_BYTE> { typedef GLbyte type; };
-template <> struct GLToCType<GL_UNSIGNED_BYTE> { typedef GLubyte type; };
-template <> struct GLToCType<GL_SHORT> { typedef GLshort type; };
-template <> struct GLToCType<GL_UNSIGNED_SHORT> { typedef GLushort type; };
-template <> struct GLToCType<GL_FIXED> { typedef GLuint type; };
-template <> struct GLToCType<GL_FLOAT> { typedef GLfloat type; };
-
-// This differs from D3DDECLTYPE in that it is unsized. (Size expansion is applied last.)
-enum D3DVertexType
-{
- D3DVT_FLOAT,
- D3DVT_SHORT,
- D3DVT_SHORT_NORM,
- D3DVT_UBYTE,
- D3DVT_UBYTE_NORM,
- D3DVT_USHORT_NORM
-};
-
-// D3DToCType maps from D3D vertex type (as enum D3DVertexType) to the corresponding C type.
-template <unsigned int D3DType> struct D3DToCType { };
-
-template <> struct D3DToCType<D3DVT_FLOAT> { typedef float type; };
-template <> struct D3DToCType<D3DVT_SHORT> { typedef short type; };
-template <> struct D3DToCType<D3DVT_SHORT_NORM> { typedef short type; };
-template <> struct D3DToCType<D3DVT_UBYTE> { typedef unsigned char type; };
-template <> struct D3DToCType<D3DVT_UBYTE_NORM> { typedef unsigned char type; };
-template <> struct D3DToCType<D3DVT_USHORT_NORM> { typedef unsigned short type; };
-
-// Encode the type/size combinations that D3D permits. For each type/size it expands to a widener that will provide the appropriate final size.
-template <unsigned int type, int size> struct WidenRule { };
-
-template <int size> struct WidenRule<D3DVT_FLOAT, size> : NoWiden<size> { };
-template <int size> struct WidenRule<D3DVT_SHORT, size> : WidenToEven<size> { };
-template <int size> struct WidenRule<D3DVT_SHORT_NORM, size> : WidenToEven<size> { };
-template <int size> struct WidenRule<D3DVT_UBYTE, size> : WidenToFour<size> { };
-template <int size> struct WidenRule<D3DVT_UBYTE_NORM, size> : WidenToFour<size> { };
-template <int size> struct WidenRule<D3DVT_USHORT_NORM, size> : WidenToEven<size> { };
-
-// VertexTypeFlags encodes the D3DCAPS9::DeclType flag and vertex declaration flag for each D3D vertex type & size combination.
-template <unsigned int d3dtype, int size> struct VertexTypeFlags { };
-
-template <unsigned int _capflag, unsigned int _declflag>
-struct VertexTypeFlagsHelper
-{
- enum { capflag = _capflag };
- enum { declflag = _declflag };
-};
-
-template <> struct VertexTypeFlags<D3DVT_FLOAT, 1> : VertexTypeFlagsHelper<0, D3DDECLTYPE_FLOAT1> { };
-template <> struct VertexTypeFlags<D3DVT_FLOAT, 2> : VertexTypeFlagsHelper<0, D3DDECLTYPE_FLOAT2> { };
-template <> struct VertexTypeFlags<D3DVT_FLOAT, 3> : VertexTypeFlagsHelper<0, D3DDECLTYPE_FLOAT3> { };
-template <> struct VertexTypeFlags<D3DVT_FLOAT, 4> : VertexTypeFlagsHelper<0, D3DDECLTYPE_FLOAT4> { };
-template <> struct VertexTypeFlags<D3DVT_SHORT, 2> : VertexTypeFlagsHelper<0, D3DDECLTYPE_SHORT2> { };
-template <> struct VertexTypeFlags<D3DVT_SHORT, 4> : VertexTypeFlagsHelper<0, D3DDECLTYPE_SHORT4> { };
-template <> struct VertexTypeFlags<D3DVT_SHORT_NORM, 2> : VertexTypeFlagsHelper<D3DDTCAPS_SHORT2N, D3DDECLTYPE_SHORT2N> { };
-template <> struct VertexTypeFlags<D3DVT_SHORT_NORM, 4> : VertexTypeFlagsHelper<D3DDTCAPS_SHORT4N, D3DDECLTYPE_SHORT4N> { };
-template <> struct VertexTypeFlags<D3DVT_UBYTE, 4> : VertexTypeFlagsHelper<D3DDTCAPS_UBYTE4, D3DDECLTYPE_UBYTE4> { };
-template <> struct VertexTypeFlags<D3DVT_UBYTE_NORM, 4> : VertexTypeFlagsHelper<D3DDTCAPS_UBYTE4N, D3DDECLTYPE_UBYTE4N> { };
-template <> struct VertexTypeFlags<D3DVT_USHORT_NORM, 2> : VertexTypeFlagsHelper<D3DDTCAPS_USHORT2N, D3DDECLTYPE_USHORT2N> { };
-template <> struct VertexTypeFlags<D3DVT_USHORT_NORM, 4> : VertexTypeFlagsHelper<D3DDTCAPS_USHORT4N, D3DDECLTYPE_USHORT4N> { };
-
-
-// VertexTypeMapping maps GL type & normalized flag to preferred and fallback D3D vertex types (as D3DVertexType enums).
-template <GLenum GLtype, bool normalized> struct VertexTypeMapping { };
-
-template <D3DVertexType Preferred, D3DVertexType Fallback = Preferred>
-struct VertexTypeMappingBase
-{
- enum { preferred = Preferred };
- enum { fallback = Fallback };
-};
-
-template <> struct VertexTypeMapping<GL_BYTE, false> : VertexTypeMappingBase<D3DVT_SHORT> { }; // Cast
-template <> struct VertexTypeMapping<GL_BYTE, true> : VertexTypeMappingBase<D3DVT_FLOAT> { }; // Normalize
-template <> struct VertexTypeMapping<GL_UNSIGNED_BYTE, false> : VertexTypeMappingBase<D3DVT_UBYTE, D3DVT_FLOAT> { }; // Identity, Cast
-template <> struct VertexTypeMapping<GL_UNSIGNED_BYTE, true> : VertexTypeMappingBase<D3DVT_UBYTE_NORM, D3DVT_FLOAT> { }; // Identity, Normalize
-template <> struct VertexTypeMapping<GL_SHORT, false> : VertexTypeMappingBase<D3DVT_SHORT> { }; // Identity
-template <> struct VertexTypeMapping<GL_SHORT, true> : VertexTypeMappingBase<D3DVT_SHORT_NORM, D3DVT_FLOAT> { }; // Cast, Normalize
-template <> struct VertexTypeMapping<GL_UNSIGNED_SHORT, false> : VertexTypeMappingBase<D3DVT_FLOAT> { }; // Cast
-template <> struct VertexTypeMapping<GL_UNSIGNED_SHORT, true> : VertexTypeMappingBase<D3DVT_USHORT_NORM, D3DVT_FLOAT> { }; // Cast, Normalize
-template <bool normalized> struct VertexTypeMapping<GL_FIXED, normalized> : VertexTypeMappingBase<D3DVT_FLOAT> { }; // FixedToFloat
-template <bool normalized> struct VertexTypeMapping<GL_FLOAT, normalized> : VertexTypeMappingBase<D3DVT_FLOAT> { }; // Identity
-
-
-// Given a GL type & norm flag and a D3D type, ConversionRule provides the type conversion rule (Cast, Normalize, Identity, FixedToFloat).
-// The conversion rules themselves are defined in vertexconversion.h.
-
-// Almost all cases are covered by Cast (including those that are actually Identity since Cast<T,T> knows it's an identity mapping).
-template <GLenum fromType, bool normalized, unsigned int toType>
-struct ConversionRule : Cast<typename GLToCType<fromType>::type, typename D3DToCType<toType>::type> { };
-
-// All conversions from normalized types to float use the Normalize operator.
-template <GLenum fromType> struct ConversionRule<fromType, true, D3DVT_FLOAT> : Normalize<typename GLToCType<fromType>::type> { };
-
-// Use a full specialization for this so that it preferentially matches ahead of the generic normalize-to-float rules.
-template <> struct ConversionRule<GL_FIXED, true, D3DVT_FLOAT> : FixedToFloat<GLint, 16> { };
-template <> struct ConversionRule<GL_FIXED, false, D3DVT_FLOAT> : FixedToFloat<GLint, 16> { };
-
-// A 2-stage construction is used for DefaultVertexValues because float must use SimpleDefaultValues (i.e. 0/1)
-// whether it is normalized or not.
-template <class T, bool normalized> struct DefaultVertexValuesStage2 { };
-
-template <class T> struct DefaultVertexValuesStage2<T, true> : NormalizedDefaultValues<T> { };
-template <class T> struct DefaultVertexValuesStage2<T, false> : SimpleDefaultValues<T> { };
-
-// Work out the default value rule for a D3D type (expressed as the C type) and
-template <class T, bool normalized> struct DefaultVertexValues : DefaultVertexValuesStage2<T, normalized> { };
-template <bool normalized> struct DefaultVertexValues<float, normalized> : SimpleDefaultValues<float> { };
-
-// Policy rules for use with Converter, to choose whether to use the preferred or fallback conversion.
-// The fallback conversion produces an output that all D3D9 devices must support.
-template <class T> struct UsePreferred { enum { type = T::preferred }; };
-template <class T> struct UseFallback { enum { type = T::fallback }; };
-
-// Converter ties it all together. Given an OpenGL type/norm/size and choice of preferred/fallback conversion,
-// it provides all the members of the appropriate VertexDataConverter, the D3DCAPS9::DeclTypes flag in cap flag
-// and the D3DDECLTYPE member needed for the vertex declaration in declflag.
-template <GLenum fromType, bool normalized, int size, template <class T> class PreferenceRule>
-struct Converter
- : VertexDataConverter<typename GLToCType<fromType>::type,
- WidenRule<PreferenceRule< VertexTypeMapping<fromType, normalized> >::type, size>,
- ConversionRule<fromType,
- normalized,
- PreferenceRule< VertexTypeMapping<fromType, normalized> >::type>,
- DefaultVertexValues<typename D3DToCType<PreferenceRule< VertexTypeMapping<fromType, normalized> >::type>::type, normalized > >
-{
-private:
- enum { d3dtype = PreferenceRule< VertexTypeMapping<fromType, normalized> >::type };
- enum { d3dsize = WidenRule<d3dtype, size>::finalWidth };
-
-public:
- enum { capflag = VertexTypeFlags<d3dtype, d3dsize>::capflag };
- enum { declflag = VertexTypeFlags<d3dtype, d3dsize>::declflag };
-};
-
-// Initialize a TranslationInfo
-#define TRANSLATION(type, norm, size, preferred) \
- { \
- Converter<type, norm, size, preferred>::identity, \
- Converter<type, norm, size, preferred>::finalSize, \
- Converter<type, norm, size, preferred>::convertArray, \
- static_cast<D3DDECLTYPE>(Converter<type, norm, size, preferred>::declflag) \
- }
-
-#define TRANSLATION_FOR_TYPE_NORM_SIZE(type, norm, size) \
- { \
- Converter<type, norm, size, UsePreferred>::capflag, \
- TRANSLATION(type, norm, size, UsePreferred), \
- TRANSLATION(type, norm, size, UseFallback) \
- }
-
-#define TRANSLATIONS_FOR_TYPE(type) \
- { \
- { TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 1), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 2), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 3), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 4) }, \
- { TRANSLATION_FOR_TYPE_NORM_SIZE(type, true, 1), TRANSLATION_FOR_TYPE_NORM_SIZE(type, true, 2), TRANSLATION_FOR_TYPE_NORM_SIZE(type, true, 3), TRANSLATION_FOR_TYPE_NORM_SIZE(type, true, 4) }, \
- }
-
-#define TRANSLATIONS_FOR_TYPE_NO_NORM(type) \
- { \
- { TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 1), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 2), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 3), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 4) }, \
- { TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 1), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 2), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 3), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 4) }, \
- }
-
-const VertexBuffer9::TranslationDescription VertexBuffer9::mPossibleTranslations[NUM_GL_VERTEX_ATTRIB_TYPES][2][4] = // [GL types as enumerated by typeIndex()][normalized][size-1]
-{
- TRANSLATIONS_FOR_TYPE(GL_BYTE),
- TRANSLATIONS_FOR_TYPE(GL_UNSIGNED_BYTE),
- TRANSLATIONS_FOR_TYPE(GL_SHORT),
- TRANSLATIONS_FOR_TYPE(GL_UNSIGNED_SHORT),
- TRANSLATIONS_FOR_TYPE_NO_NORM(GL_FIXED),
- TRANSLATIONS_FOR_TYPE_NO_NORM(GL_FLOAT)
-};
-
-void VertexBuffer9::initializeTranslations(DWORD declTypes)
-{
- for (unsigned int i = 0; i < NUM_GL_VERTEX_ATTRIB_TYPES; i++)
- {
- for (unsigned int j = 0; j < 2; j++)
- {
- for (unsigned int k = 0; k < 4; k++)
- {
- if (mPossibleTranslations[i][j][k].capsFlag == 0 || (declTypes & mPossibleTranslations[i][j][k].capsFlag) != 0)
- {
- mFormatConverters[i][j][k] = mPossibleTranslations[i][j][k].preferredConversion;
- }
- else
- {
- mFormatConverters[i][j][k] = mPossibleTranslations[i][j][k].fallbackConversion;
- }
- }
- }
- }
-}
-
-unsigned int VertexBuffer9::typeIndex(GLenum type)
-{
- switch (type)
- {
- case GL_BYTE: return 0;
- case GL_UNSIGNED_BYTE: return 1;
- case GL_SHORT: return 2;
- case GL_UNSIGNED_SHORT: return 3;
- case GL_FIXED: return 4;
- case GL_FLOAT: return 5;
-
- default: UNREACHABLE(); return 5;
- }
-}
-
-const VertexBuffer9::FormatConverter &VertexBuffer9::formatConverter(const gl::VertexAttribute &attribute)
-{
- return mFormatConverters[typeIndex(attribute.mType)][attribute.mNormalized][attribute.mSize - 1];
-}
-
-bool VertexBuffer9::spaceRequired(const gl::VertexAttribute &attrib, std::size_t count, GLsizei instances,
- unsigned int *outSpaceRequired)
-{
- unsigned int elementSize = formatConverter(attrib).outputElementSize;
-
- if (attrib.mArrayEnabled)
- {
- unsigned int elementCount = 0;
- if (instances == 0 || attrib.mDivisor == 0)
- {
- elementCount = count;
- }
- else
- {
- if (static_cast<unsigned int>(instances) < std::numeric_limits<unsigned int>::max() - (attrib.mDivisor - 1))
- {
- // Round up
- elementCount = (static_cast<unsigned int>(instances) + (attrib.mDivisor - 1)) / attrib.mDivisor;
- }
- else
- {
- elementCount = static_cast<unsigned int>(instances) / attrib.mDivisor;
- }
- }
-
- if (elementSize <= std::numeric_limits<unsigned int>::max() / elementCount)
- {
- if (outSpaceRequired)
- {
- *outSpaceRequired = elementSize * elementCount;
- }
- return true;
- }
- else
- {
- return false;
- }
- }
- else
- {
- const unsigned int elementSize = 4;
- if (outSpaceRequired)
- {
- *outSpaceRequired = elementSize * 4;
- }
- return true;
- }
-}
-
-}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/VertexBuffer9.h b/chromium/third_party/angle/src/libGLESv2/renderer/VertexBuffer9.h
deleted file mode 100644
index 2f88117bda2..00000000000
--- a/chromium/third_party/angle/src/libGLESv2/renderer/VertexBuffer9.h
+++ /dev/null
@@ -1,91 +0,0 @@
-//
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// VertexBuffer9.h: Defines the D3D9 VertexBuffer implementation.
-
-#ifndef LIBGLESV2_RENDERER_VERTEXBUFFER9_H_
-#define LIBGLESV2_RENDERER_VERTEXBUFFER9_H_
-
-#include "libGLESv2/renderer/VertexBuffer.h"
-
-namespace rx
-{
-class Renderer9;
-
-class VertexBuffer9 : public VertexBuffer
-{
- public:
- explicit VertexBuffer9(rx::Renderer9 *const renderer);
- virtual ~VertexBuffer9();
-
- virtual bool initialize(unsigned int size, bool dynamicUsage);
-
- static VertexBuffer9 *makeVertexBuffer9(VertexBuffer *vertexBuffer);
-
- virtual bool storeVertexAttributes(const gl::VertexAttribute &attrib, GLint start, GLsizei count, GLsizei instances,
- unsigned int offset);
- virtual bool storeRawData(const void* data, unsigned int size, unsigned int offset);
-
- virtual bool getSpaceRequired(const gl::VertexAttribute &attrib, GLsizei count, GLsizei instances, unsigned int *outSpaceRequired) const;
-
- virtual bool requiresConversion(const gl::VertexAttribute &attrib) const;
-
- unsigned int getVertexSize(const gl::VertexAttribute &attrib) const;
- D3DDECLTYPE getDeclType(const gl::VertexAttribute &attrib) const;
-
- virtual unsigned int getBufferSize() const;
- virtual bool setBufferSize(unsigned int size);
- virtual bool discard();
-
- IDirect3DVertexBuffer9 *getBuffer() const;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(VertexBuffer9);
-
- rx::Renderer9 *const mRenderer;
-
- IDirect3DVertexBuffer9 *mVertexBuffer;
- unsigned int mBufferSize;
- bool mDynamicUsage;
-
- // Attribute format conversion
- enum { NUM_GL_VERTEX_ATTRIB_TYPES = 6 };
-
- struct FormatConverter
- {
- bool identity;
- std::size_t outputElementSize;
- void (*convertArray)(const void *in, std::size_t stride, std::size_t n, void *out);
- D3DDECLTYPE d3dDeclType;
- };
-
- static bool mTranslationsInitialized;
- static void initializeTranslations(DWORD declTypes);
-
- // [GL types as enumerated by typeIndex()][normalized][size - 1]
- static FormatConverter mFormatConverters[NUM_GL_VERTEX_ATTRIB_TYPES][2][4];
-
- struct TranslationDescription
- {
- DWORD capsFlag;
- FormatConverter preferredConversion;
- FormatConverter fallbackConversion;
- };
-
- // This table is used to generate mFormatConverters.
- // [GL types as enumerated by typeIndex()][normalized][size - 1]
- static const TranslationDescription mPossibleTranslations[NUM_GL_VERTEX_ATTRIB_TYPES][2][4];
-
- static unsigned int typeIndex(GLenum type);
- static const FormatConverter &formatConverter(const gl::VertexAttribute &attribute);
-
- static bool spaceRequired(const gl::VertexAttribute &attrib, std::size_t count, GLsizei instances,
- unsigned int *outSpaceRequired);
-};
-
-}
-
-#endif // LIBGLESV2_RENDERER_VERTEXBUFFER9_H_
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/VertexDataManager.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/VertexDataManager.cpp
index 8034aed8c95..6aad5ebb826 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/VertexDataManager.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/VertexDataManager.cpp
@@ -13,8 +13,9 @@
#include "libGLESv2/Buffer.h"
#include "libGLESv2/ProgramBinary.h"
-#include "libGLESv2/Context.h"
+#include "libGLESv2/VertexAttribute.h"
#include "libGLESv2/renderer/VertexBuffer.h"
+#include "libGLESv2/renderer/Renderer.h"
namespace
{
@@ -26,7 +27,7 @@ namespace
namespace rx
{
-static int elementsInBuffer(const gl::VertexAttribute &attribute, unsigned int size)
+static int ElementsInBuffer(const gl::VertexAttribute &attribute, unsigned int size)
{
// Size cannot be larger than a GLsizei
if (size > static_cast<unsigned int>(std::numeric_limits<int>::max()))
@@ -56,10 +57,11 @@ VertexDataManager::VertexDataManager(Renderer *renderer) : mRenderer(renderer)
{
for (int i = 0; i < gl::MAX_VERTEX_ATTRIBS; i++)
{
- mCurrentValue[i][0] = std::numeric_limits<float>::quiet_NaN();
- mCurrentValue[i][1] = std::numeric_limits<float>::quiet_NaN();
- mCurrentValue[i][2] = std::numeric_limits<float>::quiet_NaN();
- mCurrentValue[i][3] = std::numeric_limits<float>::quiet_NaN();
+ mCurrentValue[i].FloatValues[0] = std::numeric_limits<float>::quiet_NaN();
+ mCurrentValue[i].FloatValues[1] = std::numeric_limits<float>::quiet_NaN();
+ mCurrentValue[i].FloatValues[2] = std::numeric_limits<float>::quiet_NaN();
+ mCurrentValue[i].FloatValues[3] = std::numeric_limits<float>::quiet_NaN();
+ mCurrentValue[i].Type = GL_FLOAT;
mCurrentValueBuffer[i] = NULL;
mCurrentValueOffsets[i] = 0;
}
@@ -82,17 +84,8 @@ VertexDataManager::~VertexDataManager()
}
}
-static bool directStoragePossible(VertexBufferInterface* vb, const gl::VertexAttribute& attrib)
-{
- gl::Buffer *buffer = attrib.mBoundBuffer.get();
- BufferStorage *storage = buffer ? buffer->getStorage() : NULL;
-
- const bool isAligned = (attrib.stride() % 4 == 0) && (attrib.mOffset % 4 == 0);
-
- return storage && storage->supportsDirectBinding() && !vb->getVertexBuffer()->requiresConversion(attrib) && isAligned;
-}
-
-GLenum VertexDataManager::prepareVertexData(const gl::VertexAttribute attribs[], gl::ProgramBinary *programBinary, GLint start, GLsizei count, TranslatedAttribute *translated, GLsizei instances)
+GLenum VertexDataManager::prepareVertexData(const gl::VertexAttribute attribs[], const gl::VertexAttribCurrentValueData currentValues[],
+ gl::ProgramBinary *programBinary, GLint start, GLsizei count, TranslatedAttribute *translated, GLsizei instances)
{
if (!mStreamingBuffer)
{
@@ -113,7 +106,7 @@ GLenum VertexDataManager::prepareVertexData(const gl::VertexAttribute attribs[],
StaticVertexBufferInterface *staticBuffer = buffer ? buffer->getStaticVertexBuffer() : NULL;
if (staticBuffer && staticBuffer->getBufferSize() > 0 && !staticBuffer->lookupAttribute(attribs[i], NULL) &&
- !directStoragePossible(staticBuffer, attribs[i]))
+ !staticBuffer->directStoragePossible(attribs[i], currentValues[i]))
{
buffer->invalidateStaticData();
}
@@ -129,13 +122,13 @@ GLenum VertexDataManager::prepareVertexData(const gl::VertexAttribute attribs[],
StaticVertexBufferInterface *staticBuffer = buffer ? buffer->getStaticVertexBuffer() : NULL;
VertexBufferInterface *vertexBuffer = staticBuffer ? staticBuffer : static_cast<VertexBufferInterface*>(mStreamingBuffer);
- if (!directStoragePossible(vertexBuffer, attribs[i]))
+ if (!vertexBuffer->directStoragePossible(attribs[i], currentValues[i]))
{
if (staticBuffer)
{
if (staticBuffer->getBufferSize() == 0)
{
- int totalCount = elementsInBuffer(attribs[i], buffer->size());
+ int totalCount = ElementsInBuffer(attribs[i], buffer->size());
if (!staticBuffer->reserveVertexSpace(attribs[i], totalCount, 0))
{
return GL_OUT_OF_MEMORY;
@@ -146,9 +139,9 @@ GLenum VertexDataManager::prepareVertexData(const gl::VertexAttribute attribs[],
{
int totalCount = StreamingBufferElementCount(attribs[i], count, instances);
- // Undefined behaviour:
+ // [OpenGL ES 3.0.2] section 2.9.4 page 40:
// We can return INVALID_OPERATION if our vertex attribute does not have enough backing data.
- if (buffer && elementsInBuffer(attribs[i], buffer->size()) < totalCount)
+ if (buffer && ElementsInBuffer(attribs[i], buffer->size()) < totalCount)
{
return GL_INVALID_OPERATION;
}
@@ -182,7 +175,7 @@ GLenum VertexDataManager::prepareVertexData(const gl::VertexAttribute attribs[],
VertexBufferInterface *vertexBuffer = staticBuffer ? staticBuffer : static_cast<VertexBufferInterface*>(mStreamingBuffer);
BufferStorage *storage = buffer ? buffer->getStorage() : NULL;
- bool directStorage = directStoragePossible(vertexBuffer, attribs[i]);
+ bool directStorage = vertexBuffer->directStoragePossible(attribs[i], currentValues[i]);
unsigned int streamOffset = 0;
unsigned int outputElementSize = 0;
@@ -191,7 +184,6 @@ GLenum VertexDataManager::prepareVertexData(const gl::VertexAttribute attribs[],
{
outputElementSize = attribs[i].stride();
streamOffset = attribs[i].mOffset + outputElementSize * start;
- storage->markBufferUsage();
}
else if (staticBuffer)
{
@@ -203,10 +195,11 @@ GLenum VertexDataManager::prepareVertexData(const gl::VertexAttribute attribs[],
if (!staticBuffer->lookupAttribute(attribs[i], &streamOffset))
{
// Convert the entire buffer
- int totalCount = elementsInBuffer(attribs[i], storage->getSize());
+ int totalCount = ElementsInBuffer(attribs[i], storage->getSize());
int startIndex = attribs[i].mOffset / attribs[i].stride();
- if (!staticBuffer->storeVertexAttributes(attribs[i], -startIndex, totalCount, 0, &streamOffset))
+ if (!staticBuffer->storeVertexAttributes(attribs[i], currentValues[i], -startIndex, totalCount,
+ 0, &streamOffset))
{
return GL_OUT_OF_MEMORY;
}
@@ -225,7 +218,8 @@ GLenum VertexDataManager::prepareVertexData(const gl::VertexAttribute attribs[],
{
int totalCount = StreamingBufferElementCount(attribs[i], count, instances);
if (!mStreamingBuffer->getVertexBuffer()->getSpaceRequired(attribs[i], 1, 0, &outputElementSize) ||
- !mStreamingBuffer->storeVertexAttributes(attribs[i], start, totalCount, instances, &streamOffset))
+ !mStreamingBuffer->storeVertexAttributes(attribs[i], currentValues[i], start, totalCount, instances,
+ &streamOffset))
{
return GL_OUT_OF_MEMORY;
}
@@ -237,6 +231,7 @@ GLenum VertexDataManager::prepareVertexData(const gl::VertexAttribute attribs[],
translated[i].divisor = attribs[i].mDivisor;
translated[i].attribute = &attribs[i];
+ translated[i].currentValueType = currentValues[i].Type;
translated[i].stride = outputElementSize;
translated[i].offset = streamOffset;
}
@@ -249,27 +244,20 @@ GLenum VertexDataManager::prepareVertexData(const gl::VertexAttribute attribs[],
StreamingVertexBufferInterface *buffer = mCurrentValueBuffer[i];
- if (mCurrentValue[i][0] != attribs[i].mCurrentValue[0] ||
- mCurrentValue[i][1] != attribs[i].mCurrentValue[1] ||
- mCurrentValue[i][2] != attribs[i].mCurrentValue[2] ||
- mCurrentValue[i][3] != attribs[i].mCurrentValue[3])
+ if (mCurrentValue[i] != currentValues[i])
{
- unsigned int requiredSpace = sizeof(float) * 4;
- if (!buffer->reserveRawDataSpace(requiredSpace))
+ if (!buffer->reserveVertexSpace(attribs[i], 1, 0))
{
return GL_OUT_OF_MEMORY;
}
unsigned int streamOffset;
- if (!buffer->storeRawData(attribs[i].mCurrentValue, requiredSpace, &streamOffset))
+ if (!buffer->storeVertexAttributes(attribs[i], currentValues[i], 0, 1, 0, &streamOffset))
{
return GL_OUT_OF_MEMORY;
}
- mCurrentValue[i][0] = attribs[i].mCurrentValue[0];
- mCurrentValue[i][1] = attribs[i].mCurrentValue[1];
- mCurrentValue[i][2] = attribs[i].mCurrentValue[2];
- mCurrentValue[i][3] = attribs[i].mCurrentValue[3];
+ mCurrentValue[i] = currentValues[i];
mCurrentValueOffsets[i] = streamOffset;
}
@@ -279,6 +267,7 @@ GLenum VertexDataManager::prepareVertexData(const gl::VertexAttribute attribs[],
translated[i].divisor = 0;
translated[i].attribute = &attribs[i];
+ translated[i].currentValueType = currentValues[i].Type;
translated[i].stride = 0;
translated[i].offset = mCurrentValueOffsets[i];
}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/VertexDataManager.h b/chromium/third_party/angle/src/libGLESv2/renderer/VertexDataManager.h
index 1a8786552a5..1a69245b945 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/VertexDataManager.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/VertexDataManager.h
@@ -11,12 +11,14 @@
#define LIBGLESV2_RENDERER_VERTEXDATAMANAGER_H_
#include "libGLESv2/Constants.h"
+#include "libGLESv2/VertexAttribute.h"
#include "common/angleutils.h"
namespace gl
{
class VertexAttribute;
class ProgramBinary;
+struct VertexAttribCurrentValueData;
}
namespace rx
@@ -31,6 +33,7 @@ struct TranslatedAttribute
bool active;
const gl::VertexAttribute *attribute;
+ GLenum currentValueType;
unsigned int offset;
unsigned int stride; // 0 means not to advance the read pointer at all
@@ -46,7 +49,8 @@ class VertexDataManager
VertexDataManager(rx::Renderer *renderer);
virtual ~VertexDataManager();
- GLenum prepareVertexData(const gl::VertexAttribute attribs[], gl::ProgramBinary *programBinary, GLint start, GLsizei count, TranslatedAttribute *outAttribs, GLsizei instances);
+ GLenum prepareVertexData(const gl::VertexAttribute attribs[], const gl::VertexAttribCurrentValueData currentValues[],
+ gl::ProgramBinary *programBinary, GLint start, GLsizei count, TranslatedAttribute *outAttribs, GLsizei instances);
private:
DISALLOW_COPY_AND_ASSIGN(VertexDataManager);
@@ -55,7 +59,8 @@ class VertexDataManager
StreamingVertexBufferInterface *mStreamingBuffer;
- float mCurrentValue[gl::MAX_VERTEX_ATTRIBS][4];
+ gl::VertexAttribCurrentValueData mCurrentValue[gl::MAX_VERTEX_ATTRIBS];
+
StreamingVertexBufferInterface *mCurrentValueBuffer[gl::MAX_VERTEX_ATTRIBS];
std::size_t mCurrentValueOffsets[gl::MAX_VERTEX_ATTRIBS];
};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/copyimage.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/copyimage.cpp
new file mode 100644
index 00000000000..765089cc969
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/copyimage.cpp
@@ -0,0 +1,23 @@
+#include "precompiled.h"
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// copyimage.cpp: Defines image copying functions
+
+#include "libGLESv2/renderer/copyImage.h"
+
+namespace rx
+{
+
+void CopyBGRAUByteToRGBAUByte(const void *source, void *dest)
+{
+ unsigned int argb = *(unsigned int*)source;
+ *(unsigned int*)dest = (argb & 0xFF00FF00) | // Keep alpha and green
+ (argb & 0x00FF0000) >> 16 | // Move red to blue
+ (argb & 0x000000FF) << 16; // Move blue to red
+}
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/copyimage.h b/chromium/third_party/angle/src/libGLESv2/renderer/copyimage.h
new file mode 100644
index 00000000000..2f37e1cedd0
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/copyimage.h
@@ -0,0 +1,42 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// copyimage.h: Defines image copying functions
+
+#ifndef LIBGLESV2_RENDERER_COPYIMAGE_H_
+#define LIBGLESV2_RENDERER_COPYIMAGE_H_
+
+#include "common/mathutil.h"
+#include "libGLESv2/angletypes.h"
+
+namespace rx
+{
+
+template <typename sourceType, typename colorDataType>
+void ReadColor(const void *source, void *dest)
+{
+ sourceType::readColor(reinterpret_cast<gl::Color<colorDataType>*>(dest), reinterpret_cast<const sourceType*>(source));
+}
+
+template <typename destType, typename colorDataType>
+void WriteColor(const void *source, void *dest)
+{
+ destType::writeColor(reinterpret_cast<destType*>(dest), reinterpret_cast<const gl::Color<colorDataType>*>(source));
+}
+
+template <typename sourceType, typename destType, typename colorDataType>
+void CopyPixel(const void *source, void *dest)
+{
+ colorType temp;
+ ReadColor<sourceType, colorDataType>(source, &temp);
+ WriteColor<destType, colorDataType>(&temp, dest);
+}
+
+void CopyBGRAUByteToRGBAUByte(const void *source, void *dest);
+
+}
+
+#endif // LIBGLESV2_RENDERER_COPYIMAGE_H_
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/copyvertex.h b/chromium/third_party/angle/src/libGLESv2/renderer/copyvertex.h
new file mode 100644
index 00000000000..aca031701eb
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/copyvertex.h
@@ -0,0 +1,309 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// copyvertex.h: Defines vertex buffer copying and conversion functions
+
+#ifndef LIBGLESV2_RENDERER_COPYVERTEX_H_
+#define LIBGLESV2_RENDERER_COPYVERTEX_H_
+
+#include "common/mathutil.h"
+
+// 'widenDefaultValueBits' gives the default value for the alpha channel (4th component)
+// the sentinel value 0 means we do not want to widen the input or add an alpha channel
+template <typename T, unsigned int componentCount, unsigned int widenDefaultValueBits>
+inline void copyVertexData(const void *input, size_t stride, size_t count, void *output)
+{
+ const unsigned int attribSize = sizeof(T) * componentCount;
+ const T defaultValue = gl::bitCast<T>(widenDefaultValueBits);
+ const bool widen = (widenDefaultValueBits != 0);
+
+ if (attribSize == stride && !widen)
+ {
+ memcpy(output, input, count * attribSize);
+ }
+ else
+ {
+ unsigned int outputStride = widen ? 4 : componentCount;
+
+ for (unsigned int i = 0; i < count; i++)
+ {
+ const T *offsetInput = reinterpret_cast<const T*>(reinterpret_cast<const char*>(input) + i * stride);
+ T *offsetOutput = reinterpret_cast<T*>(output) + i * outputStride;
+
+ for (unsigned int j = 0; j < componentCount; j++)
+ {
+ offsetOutput[j] = offsetInput[j];
+ }
+
+ if (widen)
+ {
+ offsetOutput[3] = defaultValue;
+ }
+ }
+ }
+}
+
+template <unsigned int componentCount>
+inline void copyFixedVertexData(const void* input, size_t stride, size_t count, void* output)
+{
+ static const float divisor = 1.0f / (1 << 16);
+
+ for (unsigned int i = 0; i < count; i++)
+ {
+ const GLfixed* offsetInput = reinterpret_cast<const GLfixed*>(reinterpret_cast<const char*>(input) + stride * i);
+ float* offsetOutput = reinterpret_cast<float*>(output) + i * componentCount;
+
+ for (unsigned int j = 0; j < componentCount; j++)
+ {
+ offsetOutput[j] = static_cast<float>(offsetInput[j]) * divisor;
+ }
+ }
+}
+
+template <typename T, unsigned int componentCount, bool normalized>
+inline void copyToFloatVertexData(const void* input, size_t stride, size_t count, void* output)
+{
+ typedef std::numeric_limits<T> NL;
+
+ for (unsigned int i = 0; i < count; i++)
+ {
+ const T *offsetInput = reinterpret_cast<const T*>(reinterpret_cast<const char*>(input) + stride * i);
+ float *offsetOutput = reinterpret_cast<float*>(output) + i * componentCount;
+
+ for (unsigned int j = 0; j < componentCount; j++)
+ {
+ if (normalized)
+ {
+ if (NL::is_signed)
+ {
+ const float divisor = 1.0f / (2 * static_cast<float>(NL::max()) + 1);
+ offsetOutput[j] = (2 * static_cast<float>(offsetInput[j]) + 1) * divisor;
+ }
+ else
+ {
+ offsetOutput[j] = static_cast<float>(offsetInput[j]) / NL::max();
+ }
+ }
+ else
+ {
+ offsetOutput[j] = static_cast<float>(offsetInput[j]);
+ }
+ }
+ }
+}
+
+inline void copyPackedUnsignedVertexData(const void* input, size_t stride, size_t count, void* output)
+{
+ const unsigned int attribSize = 4;
+
+ if (attribSize == stride)
+ {
+ memcpy(output, input, count * attribSize);
+ }
+ else
+ {
+ for (unsigned int i = 0; i < count; i++)
+ {
+ const GLuint *offsetInput = reinterpret_cast<const GLuint*>(reinterpret_cast<const char*>(input) + (i * stride));
+ GLuint *offsetOutput = reinterpret_cast<GLuint*>(output) + (i * attribSize);
+
+ offsetOutput[i] = offsetInput[i];
+ }
+ }
+}
+
+template <bool isSigned, bool normalized, bool toFloat>
+static inline void copyPackedRGB(unsigned int data, void *output)
+{
+ const unsigned int rgbSignMask = 0x200; // 1 set at the 9 bit
+ const unsigned int negativeMask = 0xFFFFFC00; // All bits from 10 to 31 set to 1
+
+ if (toFloat)
+ {
+ GLfloat *floatOutput = reinterpret_cast<GLfloat*>(output);
+ if (isSigned)
+ {
+ GLfloat finalValue = 0;
+ if (data & rgbSignMask)
+ {
+ int negativeNumber = data | negativeMask;
+ finalValue = static_cast<GLfloat>(negativeNumber);
+ }
+ else
+ {
+ finalValue = static_cast<GLfloat>(data);
+ }
+
+ if (normalized)
+ {
+ const int maxValue = 0x1FF; // 1 set in bits 0 through 8
+ const int minValue = 0xFFFFFE01; // Inverse of maxValue
+
+ // A 10-bit two's complement number has the possibility of being minValue - 1 but
+ // OpenGL's normalization rules dictate that it should be clamped to minValue in this
+ // case.
+ if (finalValue < minValue)
+ {
+ finalValue = minValue;
+ }
+
+ const int halfRange = (maxValue - minValue) >> 1;
+ *floatOutput = ((finalValue - minValue) / halfRange) - 1.0f;
+ }
+ else
+ {
+ *floatOutput = finalValue;
+ }
+ }
+ else
+ {
+ if (normalized)
+ {
+ const unsigned int maxValue = 0x3FF; // 1 set in bits 0 through 9
+ *floatOutput = static_cast<GLfloat>(data) / static_cast<GLfloat>(maxValue);
+ }
+ else
+ {
+ *floatOutput = static_cast<GLfloat>(data);
+ }
+ }
+ }
+ else
+ {
+ if (isSigned)
+ {
+ GLshort *intOutput = reinterpret_cast<GLshort*>(output);
+
+ if (data & rgbSignMask)
+ {
+ *intOutput = data | negativeMask;
+ }
+ else
+ {
+ *intOutput = data;
+ }
+ }
+ else
+ {
+ GLushort *uintOutput = reinterpret_cast<GLushort*>(output);
+ *uintOutput = data;
+ }
+ }
+}
+
+template <bool isSigned, bool normalized, bool toFloat>
+inline void copyPackedAlpha(unsigned int data, void *output)
+{
+ if (toFloat)
+ {
+ GLfloat *floatOutput = reinterpret_cast<GLfloat*>(output);
+ if (isSigned)
+ {
+ if (normalized)
+ {
+ switch (data)
+ {
+ case 0x0: *floatOutput = 0.0f; break;
+ case 0x1: *floatOutput = 1.0f; break;
+ case 0x2: *floatOutput = -1.0f; break;
+ case 0x3: *floatOutput = -1.0f; break;
+ default: UNREACHABLE();
+ }
+ }
+ else
+ {
+ switch (data)
+ {
+ case 0x0: *floatOutput = 0.0f; break;
+ case 0x1: *floatOutput = 1.0f; break;
+ case 0x2: *floatOutput = -2.0f; break;
+ case 0x3: *floatOutput = -1.0f; break;
+ default: UNREACHABLE();
+ }
+ }
+ }
+ else
+ {
+ if (normalized)
+ {
+ switch (data)
+ {
+ case 0x0: *floatOutput = 0.0f / 3.0f; break;
+ case 0x1: *floatOutput = 1.0f / 3.0f; break;
+ case 0x2: *floatOutput = 2.0f / 3.0f; break;
+ case 0x3: *floatOutput = 3.0f / 3.0f; break;
+ default: UNREACHABLE();
+ }
+ }
+ else
+ {
+ switch (data)
+ {
+ case 0x0: *floatOutput = 0.0f; break;
+ case 0x1: *floatOutput = 1.0f; break;
+ case 0x2: *floatOutput = 2.0f; break;
+ case 0x3: *floatOutput = 3.0f; break;
+ default: UNREACHABLE();
+ }
+ }
+ }
+ }
+ else
+ {
+ if (isSigned)
+ {
+ GLshort *intOutput = reinterpret_cast<GLshort*>(output);
+ switch (data)
+ {
+ case 0x0: *intOutput = 0; break;
+ case 0x1: *intOutput = 1; break;
+ case 0x2: *intOutput = -2; break;
+ case 0x3: *intOutput = -1; break;
+ default: UNREACHABLE();
+ }
+ }
+ else
+ {
+ GLushort *uintOutput = reinterpret_cast<GLushort*>(output);
+ switch (data)
+ {
+ case 0x0: *uintOutput = 0; break;
+ case 0x1: *uintOutput = 1; break;
+ case 0x2: *uintOutput = 2; break;
+ case 0x3: *uintOutput = 3; break;
+ default: UNREACHABLE();
+ }
+ }
+ }
+}
+
+template <bool isSigned, bool normalized, bool toFloat>
+inline void copyPackedVertexData(const void* input, size_t stride, size_t count, void* output)
+{
+ const unsigned int outputComponentSize = toFloat ? 4 : 2;
+ const unsigned int componentCount = 4;
+
+ const unsigned int rgbMask = 0x3FF; // 1 set in bits 0 through 9
+ const unsigned int redShift = 0; // red is bits 0 through 9
+ const unsigned int greenShift = 10; // green is bits 10 through 19
+ const unsigned int blueShift = 20; // blue is bits 20 through 29
+
+ const unsigned int alphaMask = 0x3; // 1 set in bits 0 and 1
+ const unsigned int alphaShift = 30; // Alpha is the 30 and 31 bits
+
+ for (unsigned int i = 0; i < count; i++)
+ {
+ GLuint packedValue = *reinterpret_cast<const GLuint*>(reinterpret_cast<const char*>(input) + (i * stride));
+ GLbyte *offsetOutput = reinterpret_cast<GLbyte*>(output) + (i * outputComponentSize * componentCount);
+
+ copyPackedRGB<isSigned, normalized, toFloat>( (packedValue >> redShift) & rgbMask, offsetOutput + (0 * outputComponentSize));
+ copyPackedRGB<isSigned, normalized, toFloat>( (packedValue >> greenShift) & rgbMask, offsetOutput + (1 * outputComponentSize));
+ copyPackedRGB<isSigned, normalized, toFloat>( (packedValue >> blueShift) & rgbMask, offsetOutput + (2 * outputComponentSize));
+ copyPackedAlpha<isSigned, normalized, toFloat>((packedValue >> alphaShift) & alphaMask, offsetOutput + (3* outputComponentSize));
+ }
+}
+
+#endif // LIBGLESV2_RENDERER_COPYVERTEX_H_
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d/HLSLCompiler.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d/HLSLCompiler.cpp
new file mode 100644
index 00000000000..d3ddd98eea3
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d/HLSLCompiler.cpp
@@ -0,0 +1,123 @@
+#include "precompiled.h"
+#include "libGLESv2/renderer/d3d/HLSLCompiler.h"
+#include "libGLESv2/Program.h"
+#include "libGLESv2/main.h"
+
+#include "common/utilities.h"
+
+#include "third_party/trace_event/trace_event.h"
+
+namespace rx
+{
+
+HLSLCompiler::HLSLCompiler()
+ : mD3DCompilerModule(NULL),
+ mD3DCompileFunc(NULL)
+{
+}
+
+HLSLCompiler::~HLSLCompiler()
+{
+ release();
+}
+
+bool HLSLCompiler::initialize()
+{
+ TRACE_EVENT0("gpu", "initializeCompiler");
+#if defined(ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES)
+ // Find a D3DCompiler module that had already been loaded based on a predefined list of versions.
+ static TCHAR* d3dCompilerNames[] = ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES;
+
+ for (size_t i = 0; i < ArraySize(d3dCompilerNames); ++i)
+ {
+ if (GetModuleHandleEx(0, d3dCompilerNames[i], &mD3DCompilerModule))
+ {
+ break;
+ }
+ }
+#endif // ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES
+
+ if (!mD3DCompilerModule)
+ {
+ // Load the version of the D3DCompiler DLL associated with the Direct3D version ANGLE was built with.
+ mD3DCompilerModule = LoadLibrary(D3DCOMPILER_DLL);
+ }
+
+ if (!mD3DCompilerModule)
+ {
+ ERR("No D3D compiler module found - aborting!\n");
+ return false;
+ }
+
+ mD3DCompileFunc = reinterpret_cast<CompileFuncPtr>(GetProcAddress(mD3DCompilerModule, "D3DCompile"));
+ ASSERT(mD3DCompileFunc);
+
+ return mD3DCompileFunc != NULL;
+}
+
+void HLSLCompiler::release()
+{
+ if (mD3DCompilerModule)
+ {
+ FreeLibrary(mD3DCompilerModule);
+ mD3DCompilerModule = NULL;
+ mD3DCompileFunc = NULL;
+ }
+}
+
+ShaderBlob *HLSLCompiler::compileToBinary(gl::InfoLog &infoLog, const char *hlsl, const char *profile,
+ const UINT optimizationFlags[], const char *flagNames[], int attempts) const
+{
+ ASSERT(mD3DCompilerModule && mD3DCompileFunc);
+
+ if (!hlsl)
+ {
+ return NULL;
+ }
+
+ pD3DCompile compileFunc = reinterpret_cast<pD3DCompile>(mD3DCompileFunc);
+ for (int i = 0; i < attempts; ++i)
+ {
+ ID3DBlob *errorMessage = NULL;
+ ID3DBlob *binary = NULL;
+
+ HRESULT result = compileFunc(hlsl, strlen(hlsl), gl::g_fakepath, NULL, NULL, "main", profile, optimizationFlags[i], 0, &binary, &errorMessage);
+
+ if (errorMessage)
+ {
+ const char *message = (const char*)errorMessage->GetBufferPointer();
+
+ infoLog.appendSanitized(message);
+ TRACE("\n%s", hlsl);
+ TRACE("\n%s", message);
+
+ SafeRelease(errorMessage);
+ }
+
+ if (SUCCEEDED(result))
+ {
+ return (ShaderBlob*)binary;
+ }
+ else
+ {
+ if (result == E_OUTOFMEMORY)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, (ShaderBlob*)NULL);
+ }
+
+ infoLog.append("Warning: D3D shader compilation failed with ");
+ infoLog.append(flagNames[i]);
+ infoLog.append(" flags.");
+ if (i + 1 < attempts)
+ {
+ infoLog.append(" Retrying with ");
+ infoLog.append(flagNames[i + 1]);
+ infoLog.append(".\n");
+ }
+ }
+ }
+
+ return NULL;
+}
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d/HLSLCompiler.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d/HLSLCompiler.h
new file mode 100644
index 00000000000..ab685f1f44a
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d/HLSLCompiler.h
@@ -0,0 +1,40 @@
+#ifndef LIBGLESV2_RENDERER_HLSL_D3DCOMPILER_H_
+#define LIBGLESV2_RENDERER_HLSL_D3DCOMPILER_H_
+
+#include "common/angleutils.h"
+
+#include <windows.h>
+
+namespace gl
+{
+class InfoLog;
+}
+
+namespace rx
+{
+
+typedef void* ShaderBlob;
+typedef void(*CompileFuncPtr)();
+
+class HLSLCompiler
+{
+ public:
+ HLSLCompiler();
+ ~HLSLCompiler();
+
+ bool initialize();
+ void release();
+
+ ShaderBlob *compileToBinary(gl::InfoLog &infoLog, const char *hlsl, const char *profile,
+ const UINT optimizationFlags[], const char *flagNames[], int attempts) const;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(HLSLCompiler);
+
+ HMODULE mD3DCompilerModule;
+ CompileFuncPtr mD3DCompileFunc;
+};
+
+}
+
+#endif // LIBGLESV2_RENDERER_HLSL_D3DCOMPILER_H_
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Blit11.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Blit11.cpp
new file mode 100644
index 00000000000..9a417139301
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Blit11.cpp
@@ -0,0 +1,1040 @@
+#include "precompiled.h"
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Blit11.cpp: Texture copy utility class.
+
+#include "libGLESv2/main.h"
+#include "libGLESv2/formatutils.h"
+#include "libGLESv2/renderer/d3d11/Blit11.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
+#include "libGLESv2/renderer/d3d11/renderer11_utils.h"
+#include "libGLESv2/renderer/d3d11/formatutils11.h"
+
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthrough2d11vs.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughdepth2d11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba2d11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba2dui11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba2di11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb2d11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb2dui11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb2di11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg2d11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg2dui11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg2di11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughr2d11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughr2dui11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughr2di11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughlum2d11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughlumalpha2d11ps.h"
+
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthrough3d11vs.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthrough3d11gs.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba3d11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba3dui11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba3di11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb3d11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb3dui11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb3di11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg3d11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg3dui11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg3di11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughr3d11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughr3dui11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughr3di11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughlum3d11ps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughlumalpha3d11ps.h"
+
+#include "libGLESv2/renderer/d3d11/shaders/compiled/swizzlef2dps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/swizzlei2dps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/swizzleui2dps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/swizzlef3dps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/swizzlei3dps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/swizzleui3dps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/swizzlef2darrayps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/swizzlei2darrayps.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/swizzleui2darrayps.h"
+
+namespace rx
+{
+
+static DXGI_FORMAT GetTextureFormat(ID3D11Resource *resource)
+{
+ ID3D11Texture2D *texture = d3d11::DynamicCastComObject<ID3D11Texture2D>(resource);
+ if (!texture)
+ {
+ return DXGI_FORMAT_UNKNOWN;
+ }
+
+ D3D11_TEXTURE2D_DESC desc;
+ texture->GetDesc(&desc);
+
+ SafeRelease(texture);
+
+ return desc.Format;
+}
+
+static ID3D11Resource *CreateStagingTexture(ID3D11Device *device, ID3D11DeviceContext *context,
+ ID3D11Resource *source, unsigned int subresource,
+ const gl::Extents &size, unsigned int cpuAccessFlags)
+{
+ D3D11_TEXTURE2D_DESC stagingDesc;
+ stagingDesc.Width = size.width;
+ stagingDesc.Height = size.height;
+ stagingDesc.MipLevels = 1;
+ stagingDesc.ArraySize = 1;
+ stagingDesc.Format = GetTextureFormat(source);
+ stagingDesc.SampleDesc.Count = 1;
+ stagingDesc.SampleDesc.Quality = 0;
+ stagingDesc.Usage = D3D11_USAGE_STAGING;
+ stagingDesc.CPUAccessFlags = cpuAccessFlags;
+ stagingDesc.MiscFlags = 0;
+ stagingDesc.BindFlags = 0;
+
+ ID3D11Texture2D *stagingTexture = NULL;
+ HRESULT result = device->CreateTexture2D(&stagingDesc, NULL, &stagingTexture);
+ if (FAILED(result))
+ {
+ ERR("Failed to create staging texture for depth stencil blit. HRESULT: 0x%X.", result);
+ return NULL;
+ }
+
+ context->CopySubresourceRegion(stagingTexture, 0, 0, 0, 0, source, subresource, NULL);
+
+ return stagingTexture;
+}
+
+inline static void GenerateVertexCoords(const gl::Box &sourceArea, const gl::Extents &sourceSize,
+ const gl::Box &destArea, const gl::Extents &destSize,
+ float *x1, float *y1, float *x2, float *y2,
+ float *u1, float *v1, float *u2, float *v2)
+{
+ *x1 = (destArea.x / float(destSize.width)) * 2.0f - 1.0f;
+ *y1 = ((destSize.height - destArea.y - destArea.height) / float(destSize.height)) * 2.0f - 1.0f;
+ *x2 = ((destArea.x + destArea.width) / float(destSize.width)) * 2.0f - 1.0f;
+ *y2 = ((destSize.height - destArea.y) / float(destSize.height)) * 2.0f - 1.0f;
+
+ *u1 = sourceArea.x / float(sourceSize.width);
+ *v1 = sourceArea.y / float(sourceSize.height);
+ *u2 = (sourceArea.x + sourceArea.width) / float(sourceSize.width);
+ *v2 = (sourceArea.y + sourceArea.height) / float(sourceSize.height);
+}
+
+static void Write2DVertices(const gl::Box &sourceArea, const gl::Extents &sourceSize,
+ const gl::Box &destArea, const gl::Extents &destSize,
+ void *outVertices, unsigned int *outStride, unsigned int *outVertexCount,
+ D3D11_PRIMITIVE_TOPOLOGY *outTopology)
+{
+ float x1, y1, x2, y2, u1, v1, u2, v2;
+ GenerateVertexCoords(sourceArea, sourceSize, destArea, destSize, &x1, &y1, &x2, &y2, &u1, &v1, &u2, &v2);
+
+ d3d11::PositionTexCoordVertex *vertices = static_cast<d3d11::PositionTexCoordVertex*>(outVertices);
+
+ d3d11::SetPositionTexCoordVertex(&vertices[0], x1, y1, u1, v2);
+ d3d11::SetPositionTexCoordVertex(&vertices[1], x1, y2, u1, v1);
+ d3d11::SetPositionTexCoordVertex(&vertices[2], x2, y1, u2, v2);
+ d3d11::SetPositionTexCoordVertex(&vertices[3], x2, y2, u2, v1);
+
+ *outStride = sizeof(d3d11::PositionTexCoordVertex);
+ *outVertexCount = 4;
+ *outTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP;
+}
+
+static void Write3DVertices(const gl::Box &sourceArea, const gl::Extents &sourceSize,
+ const gl::Box &destArea, const gl::Extents &destSize,
+ void *outVertices, unsigned int *outStride, unsigned int *outVertexCount,
+ D3D11_PRIMITIVE_TOPOLOGY *outTopology)
+{
+ ASSERT(sourceSize.depth > 0 && destSize.depth > 0);
+
+ float x1, y1, x2, y2, u1, v1, u2, v2;
+ GenerateVertexCoords(sourceArea, sourceSize, destArea, destSize, &x1, &y1, &x2, &y2, &u1, &v1, &u2, &v2);
+
+ d3d11::PositionLayerTexCoord3DVertex *vertices = static_cast<d3d11::PositionLayerTexCoord3DVertex*>(outVertices);
+
+ for (int i = 0; i < destSize.depth; i++)
+ {
+ float readDepth = (float)i / std::max(destSize.depth - 1, 1);
+
+ d3d11::SetPositionLayerTexCoord3DVertex(&vertices[i * 6 + 0], x1, y1, i, u1, v2, readDepth);
+ d3d11::SetPositionLayerTexCoord3DVertex(&vertices[i * 6 + 1], x1, y2, i, u1, v1, readDepth);
+ d3d11::SetPositionLayerTexCoord3DVertex(&vertices[i * 6 + 2], x2, y1, i, u2, v2, readDepth);
+
+ d3d11::SetPositionLayerTexCoord3DVertex(&vertices[i * 6 + 3], x1, y2, i, u1, v1, readDepth);
+ d3d11::SetPositionLayerTexCoord3DVertex(&vertices[i * 6 + 4], x2, y2, i, u2, v1, readDepth);
+ d3d11::SetPositionLayerTexCoord3DVertex(&vertices[i * 6 + 5], x2, y1, i, u2, v2, readDepth);
+ }
+
+ *outStride = sizeof(d3d11::PositionLayerTexCoord3DVertex);
+ *outVertexCount = destSize.depth * 6;
+ *outTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
+}
+
+Blit11::Blit11(rx::Renderer11 *renderer)
+ : mRenderer(renderer), mBlitShaderMap(compareBlitParameters), mSwizzleShaderMap(compareSwizzleParameters),
+ mVertexBuffer(NULL), mPointSampler(NULL), mLinearSampler(NULL), mScissorEnabledRasterizerState(NULL),
+ mScissorDisabledRasterizerState(NULL), mDepthStencilState(NULL),
+ mQuad2DIL(NULL), mQuad2DVS(NULL), mDepthPS(NULL),
+ mQuad3DIL(NULL), mQuad3DVS(NULL), mQuad3DGS(NULL),
+ mSwizzleCB(NULL)
+{
+ HRESULT result;
+ ID3D11Device *device = mRenderer->getDevice();
+
+ D3D11_BUFFER_DESC vbDesc;
+ vbDesc.ByteWidth = std::max(sizeof(d3d11::PositionLayerTexCoord3DVertex), sizeof(d3d11::PositionTexCoordVertex)) *
+ 6 * renderer->getMaxTextureDepth();
+ vbDesc.Usage = D3D11_USAGE_DYNAMIC;
+ vbDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
+ vbDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ vbDesc.MiscFlags = 0;
+ vbDesc.StructureByteStride = 0;
+
+ result = device->CreateBuffer(&vbDesc, NULL, &mVertexBuffer);
+ ASSERT(SUCCEEDED(result));
+ d3d11::SetDebugName(mVertexBuffer, "Blit11 vertex buffer");
+
+ D3D11_SAMPLER_DESC pointSamplerDesc;
+ pointSamplerDesc.Filter = D3D11_FILTER_MIN_MAG_POINT_MIP_LINEAR;
+ pointSamplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
+ pointSamplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
+ pointSamplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
+ pointSamplerDesc.MipLODBias = 0.0f;
+ pointSamplerDesc.MaxAnisotropy = 0;
+ pointSamplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER;
+ pointSamplerDesc.BorderColor[0] = 0.0f;
+ pointSamplerDesc.BorderColor[1] = 0.0f;
+ pointSamplerDesc.BorderColor[2] = 0.0f;
+ pointSamplerDesc.BorderColor[3] = 0.0f;
+ pointSamplerDesc.MinLOD = 0.0f;
+ pointSamplerDesc.MaxLOD = 0.0f;
+
+ result = device->CreateSamplerState(&pointSamplerDesc, &mPointSampler);
+ ASSERT(SUCCEEDED(result));
+ d3d11::SetDebugName(mPointSampler, "Blit11 point sampler");
+
+ D3D11_SAMPLER_DESC linearSamplerDesc;
+ linearSamplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
+ linearSamplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
+ linearSamplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
+ linearSamplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
+ linearSamplerDesc.MipLODBias = 0.0f;
+ linearSamplerDesc.MaxAnisotropy = 0;
+ linearSamplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER;
+ linearSamplerDesc.BorderColor[0] = 0.0f;
+ linearSamplerDesc.BorderColor[1] = 0.0f;
+ linearSamplerDesc.BorderColor[2] = 0.0f;
+ linearSamplerDesc.BorderColor[3] = 0.0f;
+ linearSamplerDesc.MinLOD = 0.0f;
+ linearSamplerDesc.MaxLOD = 0.0f;
+
+ result = device->CreateSamplerState(&linearSamplerDesc, &mLinearSampler);
+ ASSERT(SUCCEEDED(result));
+ d3d11::SetDebugName(mLinearSampler, "Blit11 linear sampler");
+
+ // Use a rasterizer state that will not cull so that inverted quads will not be culled
+ D3D11_RASTERIZER_DESC rasterDesc;
+ rasterDesc.FillMode = D3D11_FILL_SOLID;
+ rasterDesc.CullMode = D3D11_CULL_NONE;
+ rasterDesc.FrontCounterClockwise = FALSE;
+ rasterDesc.DepthBias = 0;
+ rasterDesc.SlopeScaledDepthBias = 0.0f;
+ rasterDesc.DepthBiasClamp = 0.0f;
+ rasterDesc.DepthClipEnable = TRUE;
+ rasterDesc.MultisampleEnable = FALSE;
+ rasterDesc.AntialiasedLineEnable = FALSE;
+
+ rasterDesc.ScissorEnable = TRUE;
+ result = device->CreateRasterizerState(&rasterDesc, &mScissorEnabledRasterizerState);
+ ASSERT(SUCCEEDED(result));
+ d3d11::SetDebugName(mScissorEnabledRasterizerState, "Blit11 scissoring rasterizer state");
+
+ rasterDesc.ScissorEnable = FALSE;
+ result = device->CreateRasterizerState(&rasterDesc, &mScissorDisabledRasterizerState);
+ ASSERT(SUCCEEDED(result));
+ d3d11::SetDebugName(mScissorDisabledRasterizerState, "Blit11 no scissoring rasterizer state");
+
+ D3D11_DEPTH_STENCIL_DESC depthStencilDesc;
+ depthStencilDesc.DepthEnable = true;
+ depthStencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
+ depthStencilDesc.DepthFunc = D3D11_COMPARISON_ALWAYS;
+ depthStencilDesc.StencilEnable = FALSE;
+ depthStencilDesc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK;
+ depthStencilDesc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK;
+ depthStencilDesc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
+ depthStencilDesc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP;
+ depthStencilDesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
+ depthStencilDesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
+ depthStencilDesc.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
+ depthStencilDesc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP;
+ depthStencilDesc.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
+ depthStencilDesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
+
+ result = device->CreateDepthStencilState(&depthStencilDesc, &mDepthStencilState);
+ ASSERT(SUCCEEDED(result));
+ d3d11::SetDebugName(mDepthStencilState, "Blit11 depth stencil state");
+
+ D3D11_INPUT_ELEMENT_DESC quad2DLayout[] =
+ {
+ { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 8, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ };
+
+ result = device->CreateInputLayout(quad2DLayout, ArraySize(quad2DLayout), g_VS_Passthrough2D, ArraySize(g_VS_Passthrough2D), &mQuad2DIL);
+ ASSERT(SUCCEEDED(result));
+ d3d11::SetDebugName(mQuad2DIL, "Blit11 2D input layout");
+
+ result = device->CreateVertexShader(g_VS_Passthrough2D, ArraySize(g_VS_Passthrough2D), NULL, &mQuad2DVS);
+ ASSERT(SUCCEEDED(result));
+ d3d11::SetDebugName(mQuad2DVS, "Blit11 2D vertex shader");
+
+ result = device->CreatePixelShader(g_PS_PassthroughDepth2D, ArraySize(g_PS_PassthroughDepth2D), NULL, &mDepthPS);
+ ASSERT(SUCCEEDED(result));
+ d3d11::SetDebugName(mDepthPS, "Blit11 2D depth pixel shader");
+
+ D3D11_INPUT_ELEMENT_DESC quad3DLayout[] =
+ {
+ { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ { "LAYER", 0, DXGI_FORMAT_R32_UINT, 0, 8, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ { "TEXCOORD", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ };
+
+ result = device->CreateInputLayout(quad3DLayout, ArraySize(quad3DLayout), g_VS_Passthrough3D, ArraySize(g_VS_Passthrough3D), &mQuad3DIL);
+ ASSERT(SUCCEEDED(result));
+ d3d11::SetDebugName(mQuad3DIL, "Blit11 3D input layout");
+
+ result = device->CreateVertexShader(g_VS_Passthrough3D, ArraySize(g_VS_Passthrough3D), NULL, &mQuad3DVS);
+ ASSERT(SUCCEEDED(result));
+ d3d11::SetDebugName(mQuad3DVS, "Blit11 3D vertex shader");
+
+ result = device->CreateGeometryShader(g_GS_Passthrough3D, ArraySize(g_GS_Passthrough3D), NULL, &mQuad3DGS);
+ ASSERT(SUCCEEDED(result));
+ d3d11::SetDebugName(mQuad3DGS, "Renderer11 copy 3D texture geometry shader");
+
+ buildShaderMap();
+
+ D3D11_BUFFER_DESC swizzleBufferDesc;
+ swizzleBufferDesc.ByteWidth = sizeof(unsigned int) * 4;
+ swizzleBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
+ swizzleBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
+ swizzleBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ swizzleBufferDesc.MiscFlags = 0;
+ swizzleBufferDesc.StructureByteStride = 0;
+
+ result = device->CreateBuffer(&swizzleBufferDesc, NULL, &mSwizzleCB);
+ ASSERT(SUCCEEDED(result));
+ d3d11::SetDebugName(mSwizzleCB, "Blit11 swizzle constant buffer");
+}
+
+Blit11::~Blit11()
+{
+ SafeRelease(mVertexBuffer);
+ SafeRelease(mPointSampler);
+ SafeRelease(mLinearSampler);
+ SafeRelease(mScissorEnabledRasterizerState);
+ SafeRelease(mScissorDisabledRasterizerState);
+ SafeRelease(mDepthStencilState);
+
+ SafeRelease(mQuad2DIL);
+ SafeRelease(mQuad2DVS);
+ SafeRelease(mDepthPS);
+
+ SafeRelease(mQuad3DIL);
+ SafeRelease(mQuad3DVS);
+ SafeRelease(mQuad3DGS);
+
+ SafeRelease(mSwizzleCB);
+
+ clearShaderMap();
+}
+
+static inline unsigned int GetSwizzleIndex(GLenum swizzle)
+{
+ unsigned int colorIndex = 0;
+
+ switch (swizzle)
+ {
+ case GL_RED: colorIndex = 0; break;
+ case GL_GREEN: colorIndex = 1; break;
+ case GL_BLUE: colorIndex = 2; break;
+ case GL_ALPHA: colorIndex = 3; break;
+ case GL_ZERO: colorIndex = 4; break;
+ case GL_ONE: colorIndex = 5; break;
+ default: UNREACHABLE(); break;
+ }
+
+ return colorIndex;
+}
+
+bool Blit11::swizzleTexture(ID3D11ShaderResourceView *source, ID3D11RenderTargetView *dest, const gl::Extents &size,
+ GLenum swizzleRed, GLenum swizzleGreen, GLenum swizzleBlue, GLenum swizzleAlpha)
+{
+ HRESULT result;
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+
+ D3D11_SHADER_RESOURCE_VIEW_DESC sourceSRVDesc;
+ source->GetDesc(&sourceSRVDesc);
+ GLenum sourceInternalFormat = d3d11_gl::GetInternalFormat(sourceSRVDesc.Format, mRenderer->getCurrentClientVersion());
+
+ GLenum shaderType = GL_NONE;
+ switch (gl::GetComponentType(sourceInternalFormat, mRenderer->getCurrentClientVersion()))
+ {
+ case GL_UNSIGNED_NORMALIZED:
+ case GL_SIGNED_NORMALIZED:
+ case GL_FLOAT:
+ shaderType = GL_FLOAT;
+ break;
+ case GL_INT:
+ shaderType = GL_INT;
+ break;
+ case GL_UNSIGNED_INT:
+ shaderType = GL_UNSIGNED_INT;
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ SwizzleParameters parameters = { 0 };
+ parameters.mDestinationType = shaderType;
+ parameters.mViewDimension = sourceSRVDesc.ViewDimension;
+
+ SwizzleShaderMap::const_iterator i = mSwizzleShaderMap.find(parameters);
+ if (i == mSwizzleShaderMap.end())
+ {
+ UNREACHABLE();
+ return false;
+ }
+
+ const Shader &shader = i->second;
+
+ // Set vertices
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
+ result = deviceContext->Map(mVertexBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
+ if (FAILED(result))
+ {
+ ERR("Failed to map vertex buffer for texture swizzle, HRESULT: 0x%X.", result);
+ return false;
+ }
+
+ UINT stride = 0;
+ UINT startIdx = 0;
+ UINT drawCount = 0;
+ D3D11_PRIMITIVE_TOPOLOGY topology;
+
+ gl::Box area(0, 0, 0, size.width, size.height, size.depth);
+ shader.mVertexWriteFunction(area, size, area, size, mappedResource.pData, &stride, &drawCount, &topology);
+
+ deviceContext->Unmap(mVertexBuffer, 0);
+
+ // Set constant buffer
+ result = deviceContext->Map(mSwizzleCB, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
+ if (FAILED(result))
+ {
+ ERR("Failed to map constant buffer for texture swizzle, HRESULT: 0x%X.", result);
+ return false;
+ }
+
+ unsigned int *swizzleIndices = reinterpret_cast<unsigned int*>(mappedResource.pData);
+ swizzleIndices[0] = GetSwizzleIndex(swizzleRed);
+ swizzleIndices[1] = GetSwizzleIndex(swizzleGreen);
+ swizzleIndices[2] = GetSwizzleIndex(swizzleBlue);
+ swizzleIndices[3] = GetSwizzleIndex(swizzleAlpha);
+
+ deviceContext->Unmap(mSwizzleCB, 0);
+
+ // Apply vertex buffer
+ deviceContext->IASetVertexBuffers(0, 1, &mVertexBuffer, &stride, &startIdx);
+
+ // Apply constant buffer
+ deviceContext->PSSetConstantBuffers(0, 1, &mSwizzleCB);
+
+ // Apply state
+ deviceContext->OMSetBlendState(NULL, NULL, 0xFFFFFFF);
+ deviceContext->OMSetDepthStencilState(NULL, 0xFFFFFFFF);
+ deviceContext->RSSetState(mScissorDisabledRasterizerState);
+
+ // Apply shaders
+ deviceContext->IASetInputLayout(shader.mInputLayout);
+ deviceContext->IASetPrimitiveTopology(topology);
+ deviceContext->VSSetShader(shader.mVertexShader, NULL, 0);
+
+ deviceContext->PSSetShader(shader.mPixelShader, NULL, 0);
+ deviceContext->GSSetShader(shader.mGeometryShader, NULL, 0);
+
+ // Unset the currently bound shader resource to avoid conflicts
+ ID3D11ShaderResourceView *const nullSRV = NULL;
+ deviceContext->PSSetShaderResources(0, 1, &nullSRV);
+
+ // Apply render target
+ mRenderer->setOneTimeRenderTarget(dest);
+
+ // Set the viewport
+ D3D11_VIEWPORT viewport;
+ viewport.TopLeftX = 0;
+ viewport.TopLeftY = 0;
+ viewport.Width = size.width;
+ viewport.Height = size.height;
+ viewport.MinDepth = 0.0f;
+ viewport.MaxDepth = 1.0f;
+ deviceContext->RSSetViewports(1, &viewport);
+
+ // Apply textures
+ deviceContext->PSSetShaderResources(0, 1, &source);
+
+ // Apply samplers
+ deviceContext->PSSetSamplers(0, 1, &mPointSampler);
+
+ // Draw the quad
+ deviceContext->Draw(drawCount, 0);
+
+ // Unbind textures and render targets and vertex buffer
+ deviceContext->PSSetShaderResources(0, 1, &nullSRV);
+
+ mRenderer->unapplyRenderTargets();
+
+ UINT zero = 0;
+ ID3D11Buffer *const nullBuffer = NULL;
+ deviceContext->IASetVertexBuffers(0, 1, &nullBuffer, &zero, &zero);
+
+ mRenderer->markAllStateDirty();
+
+ return true;
+}
+
+bool Blit11::copyTexture(ID3D11ShaderResourceView *source, const gl::Box &sourceArea, const gl::Extents &sourceSize,
+ ID3D11RenderTargetView *dest, const gl::Box &destArea, const gl::Extents &destSize,
+ const gl::Rectangle *scissor, GLenum destFormat, GLenum filter)
+{
+ HRESULT result;
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+
+ // Determine if the source format is a signed integer format, the destFormat will already
+ // be GL_XXXX_INTEGER but it does not tell us if it is signed or unsigned.
+ D3D11_SHADER_RESOURCE_VIEW_DESC sourceSRVDesc;
+ source->GetDesc(&sourceSRVDesc);
+ GLenum sourceInternalFormat = d3d11_gl::GetInternalFormat(sourceSRVDesc.Format, mRenderer->getCurrentClientVersion());
+
+ BlitParameters parameters = { 0 };
+ parameters.mDestinationFormat = destFormat;
+ parameters.mSignedInteger = gl::GetComponentType(sourceInternalFormat, mRenderer->getCurrentClientVersion()) == GL_INT;
+ parameters.m3DBlit = sourceArea.depth > 1;
+
+ BlitShaderMap::const_iterator i = mBlitShaderMap.find(parameters);
+ if (i == mBlitShaderMap.end())
+ {
+ UNREACHABLE();
+ return false;
+ }
+
+ const Shader& shader = i->second;
+
+ // Set vertices
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
+ result = deviceContext->Map(mVertexBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
+ if (FAILED(result))
+ {
+ ERR("Failed to map vertex buffer for texture copy, HRESULT: 0x%X.", result);
+ return false;
+ }
+
+ UINT stride = 0;
+ UINT startIdx = 0;
+ UINT drawCount = 0;
+ D3D11_PRIMITIVE_TOPOLOGY topology;
+
+ shader.mVertexWriteFunction(sourceArea, sourceSize, destArea, destSize, mappedResource.pData,
+ &stride, &drawCount, &topology);
+
+ deviceContext->Unmap(mVertexBuffer, 0);
+
+ // Apply vertex buffer
+ deviceContext->IASetVertexBuffers(0, 1, &mVertexBuffer, &stride, &startIdx);
+
+ // Apply state
+ deviceContext->OMSetBlendState(NULL, NULL, 0xFFFFFFF);
+ deviceContext->OMSetDepthStencilState(NULL, 0xFFFFFFFF);
+
+ if (scissor)
+ {
+ D3D11_RECT scissorRect;
+ scissorRect.left = scissor->x;
+ scissorRect.right = scissor->x + scissor->width;
+ scissorRect.top = scissor->y;
+ scissorRect.bottom = scissor->y + scissor->height;
+
+ deviceContext->RSSetScissorRects(1, &scissorRect);
+ deviceContext->RSSetState(mScissorEnabledRasterizerState);
+ }
+ else
+ {
+ deviceContext->RSSetState(mScissorDisabledRasterizerState);
+ }
+
+ // Apply shaders
+ deviceContext->IASetInputLayout(shader.mInputLayout);
+ deviceContext->IASetPrimitiveTopology(topology);
+ deviceContext->VSSetShader(shader.mVertexShader, NULL, 0);
+
+ deviceContext->PSSetShader(shader.mPixelShader, NULL, 0);
+ deviceContext->GSSetShader(shader.mGeometryShader, NULL, 0);
+
+ // Unset the currently bound shader resource to avoid conflicts
+ ID3D11ShaderResourceView *const nullSRV = NULL;
+ deviceContext->PSSetShaderResources(0, 1, &nullSRV);
+
+ // Apply render target
+ mRenderer->setOneTimeRenderTarget(dest);
+
+ // Set the viewport
+ D3D11_VIEWPORT viewport;
+ viewport.TopLeftX = 0;
+ viewport.TopLeftY = 0;
+ viewport.Width = destSize.width;
+ viewport.Height = destSize.height;
+ viewport.MinDepth = 0.0f;
+ viewport.MaxDepth = 1.0f;
+ deviceContext->RSSetViewports(1, &viewport);
+
+ // Apply textures
+ deviceContext->PSSetShaderResources(0, 1, &source);
+
+ // Apply samplers
+ ID3D11SamplerState *sampler = NULL;
+ switch (filter)
+ {
+ case GL_NEAREST: sampler = mPointSampler; break;
+ case GL_LINEAR: sampler = mLinearSampler; break;
+ default: UNREACHABLE(); return false;
+ }
+ deviceContext->PSSetSamplers(0, 1, &sampler);
+
+ // Draw the quad
+ deviceContext->Draw(drawCount, 0);
+
+ // Unbind textures and render targets and vertex buffer
+ deviceContext->PSSetShaderResources(0, 1, &nullSRV);
+
+ mRenderer->unapplyRenderTargets();
+
+ UINT zero = 0;
+ ID3D11Buffer *const nullBuffer = NULL;
+ deviceContext->IASetVertexBuffers(0, 1, &nullBuffer, &zero, &zero);
+
+ mRenderer->markAllStateDirty();
+
+ return true;
+}
+
+bool Blit11::copyStencil(ID3D11Resource *source, unsigned int sourceSubresource, const gl::Box &sourceArea, const gl::Extents &sourceSize,
+ ID3D11Resource *dest, unsigned int destSubresource, const gl::Box &destArea, const gl::Extents &destSize,
+ const gl::Rectangle *scissor)
+{
+ return copyDepthStencil(source, sourceSubresource, sourceArea, sourceSize,
+ dest, destSubresource, destArea, destSize,
+ scissor, true);
+}
+
+bool Blit11::copyDepth(ID3D11ShaderResourceView *source, const gl::Box &sourceArea, const gl::Extents &sourceSize,
+ ID3D11DepthStencilView *dest, const gl::Box &destArea, const gl::Extents &destSize,
+ const gl::Rectangle *scissor)
+{
+ HRESULT result;
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+
+ // Set vertices
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
+ result = deviceContext->Map(mVertexBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
+ if (FAILED(result))
+ {
+ ERR("Failed to map vertex buffer for texture copy, HRESULT: 0x%X.", result);
+ return false;
+ }
+
+ UINT stride = 0;
+ UINT startIdx = 0;
+ UINT drawCount = 0;
+ D3D11_PRIMITIVE_TOPOLOGY topology;
+
+ Write2DVertices(sourceArea, sourceSize, destArea, destSize, mappedResource.pData,
+ &stride, &drawCount, &topology);
+
+ deviceContext->Unmap(mVertexBuffer, 0);
+
+ // Apply vertex buffer
+ deviceContext->IASetVertexBuffers(0, 1, &mVertexBuffer, &stride, &startIdx);
+
+ // Apply state
+ deviceContext->OMSetBlendState(NULL, NULL, 0xFFFFFFF);
+ deviceContext->OMSetDepthStencilState(mDepthStencilState, 0xFFFFFFFF);
+
+ if (scissor)
+ {
+ D3D11_RECT scissorRect;
+ scissorRect.left = scissor->x;
+ scissorRect.right = scissor->x + scissor->width;
+ scissorRect.top = scissor->y;
+ scissorRect.bottom = scissor->y + scissor->height;
+
+ deviceContext->RSSetScissorRects(1, &scissorRect);
+ deviceContext->RSSetState(mScissorEnabledRasterizerState);
+ }
+ else
+ {
+ deviceContext->RSSetState(mScissorDisabledRasterizerState);
+ }
+
+ // Apply shaders
+ deviceContext->IASetInputLayout(mQuad2DIL);
+ deviceContext->IASetPrimitiveTopology(topology);
+ deviceContext->VSSetShader(mQuad2DVS, NULL, 0);
+
+ deviceContext->PSSetShader(mDepthPS, NULL, 0);
+ deviceContext->GSSetShader(NULL, NULL, 0);
+
+ // Unset the currently bound shader resource to avoid conflicts
+ ID3D11ShaderResourceView *const nullSRV = NULL;
+ deviceContext->PSSetShaderResources(0, 1, &nullSRV);
+
+ // Apply render target
+ deviceContext->OMSetRenderTargets(0, NULL, dest);
+
+ // Set the viewport
+ D3D11_VIEWPORT viewport;
+ viewport.TopLeftX = 0;
+ viewport.TopLeftY = 0;
+ viewport.Width = destSize.width;
+ viewport.Height = destSize.height;
+ viewport.MinDepth = 0.0f;
+ viewport.MaxDepth = 1.0f;
+ deviceContext->RSSetViewports(1, &viewport);
+
+ // Apply textures
+ deviceContext->PSSetShaderResources(0, 1, &source);
+
+ // Apply samplers
+ deviceContext->PSSetSamplers(0, 1, &mPointSampler);
+
+ // Draw the quad
+ deviceContext->Draw(drawCount, 0);
+
+ // Unbind textures and render targets and vertex buffer
+ deviceContext->PSSetShaderResources(0, 1, &nullSRV);
+
+ mRenderer->unapplyRenderTargets();
+
+ UINT zero = 0;
+ ID3D11Buffer *const nullBuffer = NULL;
+ deviceContext->IASetVertexBuffers(0, 1, &nullBuffer, &zero, &zero);
+
+ mRenderer->markAllStateDirty();
+
+ return true;
+}
+
+bool Blit11::copyDepthStencil(ID3D11Resource *source, unsigned int sourceSubresource, const gl::Box &sourceArea, const gl::Extents &sourceSize,
+ ID3D11Resource *dest, unsigned int destSubresource, const gl::Box &destArea, const gl::Extents &destSize,
+ const gl::Rectangle *scissor)
+{
+ return copyDepthStencil(source, sourceSubresource, sourceArea, sourceSize,
+ dest, destSubresource, destArea, destSize,
+ scissor, false);
+}
+
+bool Blit11::copyDepthStencil(ID3D11Resource *source, unsigned int sourceSubresource, const gl::Box &sourceArea, const gl::Extents &sourceSize,
+ ID3D11Resource *dest, unsigned int destSubresource, const gl::Box &destArea, const gl::Extents &destSize,
+ const gl::Rectangle *scissor, bool stencilOnly)
+{
+ ID3D11Device *device = mRenderer->getDevice();
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+
+ ID3D11Resource *sourceStaging = CreateStagingTexture(device, deviceContext, source, sourceSubresource, sourceSize, D3D11_CPU_ACCESS_READ);
+ // HACK: Create the destination staging buffer as a read/write texture so ID3D11DevicContext::UpdateSubresource can be called
+ // using it's mapped data as a source
+ ID3D11Resource *destStaging = CreateStagingTexture(device, deviceContext, dest, destSubresource, destSize, D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE);
+
+ if (!sourceStaging || !destStaging)
+ {
+ SafeRelease(sourceStaging);
+ SafeRelease(destStaging);
+ return false;
+ }
+
+ DXGI_FORMAT format = GetTextureFormat(source);
+ ASSERT(format == GetTextureFormat(dest));
+
+ unsigned int pixelSize = d3d11::GetFormatPixelBytes(format);
+ unsigned int copyOffset = 0;
+ unsigned int copySize = pixelSize;
+ if (stencilOnly)
+ {
+ copyOffset = d3d11::GetStencilOffset(format) / 8;
+ copySize = d3d11::GetStencilBits(format) / 8;
+
+ // It would be expensive to have non-byte sized stencil sizes since it would
+ // require reading from the destination, currently there aren't any though.
+ ASSERT(d3d11::GetStencilBits(format) % 8 == 0 &&
+ d3d11::GetStencilOffset(format) % 8 == 0);
+ }
+
+ D3D11_MAPPED_SUBRESOURCE sourceMapping, destMapping;
+ deviceContext->Map(sourceStaging, 0, D3D11_MAP_READ, 0, &sourceMapping);
+ deviceContext->Map(destStaging, 0, D3D11_MAP_WRITE, 0, &destMapping);
+
+ if (!sourceMapping.pData || !destMapping.pData)
+ {
+ if (!sourceMapping.pData)
+ {
+ deviceContext->Unmap(sourceStaging, 0);
+ }
+ if (!destMapping.pData)
+ {
+ deviceContext->Unmap(destStaging, 0);
+ }
+ SafeRelease(sourceStaging);
+ SafeRelease(destStaging);
+ return false;
+ }
+
+ gl::Rectangle clippedDestArea(destArea.x, destArea.y, destArea.width, destArea.height);
+
+ // Clip dest area to the destination size
+ gl::ClipRectangle(clippedDestArea, gl::Rectangle(0, 0, destSize.width, destSize.height), &clippedDestArea);
+
+ // Clip dest area to the scissor
+ if (scissor)
+ {
+ gl::ClipRectangle(clippedDestArea, *scissor, &clippedDestArea);
+ }
+
+ // Determine if entire rows can be copied at once instead of each individual pixel, requires that there is
+ // no out of bounds lookups required, the entire pixel is copied and no stretching
+ bool wholeRowCopy = sourceArea.width == clippedDestArea.width &&
+ sourceArea.x >= 0 && sourceArea.x + sourceArea.width <= sourceSize.width &&
+ copySize == pixelSize;
+
+ for (int y = clippedDestArea.y; y < clippedDestArea.y + clippedDestArea.height; y++)
+ {
+ float yPerc = static_cast<float>(y - destArea.y) / (destArea.height - 1);
+
+ // Interpolate using the original source rectangle to determine which row to sample from while clamping to the edges
+ unsigned int readRow = gl::clamp(sourceArea.y + floor(yPerc * (sourceArea.height - 1) + 0.5f), 0, sourceSize.height - 1);
+ unsigned int writeRow = y;
+
+ if (wholeRowCopy)
+ {
+ void *sourceRow = reinterpret_cast<char*>(sourceMapping.pData) +
+ readRow * sourceMapping.RowPitch +
+ sourceArea.x * pixelSize;
+
+ void *destRow = reinterpret_cast<char*>(destMapping.pData) +
+ writeRow * destMapping.RowPitch +
+ destArea.x * pixelSize;
+
+ memcpy(destRow, sourceRow, pixelSize * destArea.width);
+ }
+ else
+ {
+ for (int x = clippedDestArea.x; x < clippedDestArea.x + clippedDestArea.width; x++)
+ {
+ float xPerc = static_cast<float>(x - destArea.x) / (destArea.width - 1);
+
+ // Interpolate the original source rectangle to determine which column to sample from while clamping to the edges
+ unsigned int readColumn = gl::clamp(sourceArea.x + floor(xPerc * (sourceArea.width - 1) + 0.5f), 0, sourceSize.width - 1);
+ unsigned int writeColumn = x;
+
+ void *sourcePixel = reinterpret_cast<char*>(sourceMapping.pData) +
+ readRow * sourceMapping.RowPitch +
+ readColumn * pixelSize +
+ copyOffset;
+
+ void *destPixel = reinterpret_cast<char*>(destMapping.pData) +
+ writeRow * destMapping.RowPitch +
+ writeColumn * pixelSize +
+ copyOffset;
+
+ memcpy(destPixel, sourcePixel, copySize);
+ }
+ }
+ }
+
+ // HACK: Use ID3D11DevicContext::UpdateSubresource which causes an extra copy compared to ID3D11DevicContext::CopySubresourceRegion
+ // according to MSDN.
+ deviceContext->UpdateSubresource(dest, destSubresource, NULL, destMapping.pData, destMapping.RowPitch, destMapping.DepthPitch);
+
+ deviceContext->Unmap(sourceStaging, 0);
+ deviceContext->Unmap(destStaging, 0);
+
+ // TODO: Determine why this call to ID3D11DevicContext::CopySubresourceRegion causes a TDR timeout on some
+ // systems when called repeatedly.
+ // deviceContext->CopySubresourceRegion(dest, destSubresource, 0, 0, 0, destStaging, 0, NULL);
+
+ SafeRelease(sourceStaging);
+ SafeRelease(destStaging);
+
+ return true;
+}
+
+bool Blit11::compareBlitParameters(const Blit11::BlitParameters &a, const Blit11::BlitParameters &b)
+{
+ return memcmp(&a, &b, sizeof(Blit11::BlitParameters)) < 0;
+}
+
+bool Blit11::compareSwizzleParameters(const SwizzleParameters &a, const SwizzleParameters &b)
+{
+ return memcmp(&a, &b, sizeof(Blit11::SwizzleParameters)) < 0;
+}
+
+void Blit11::add2DBlitShaderToMap(GLenum destFormat, bool signedInteger, ID3D11PixelShader *ps)
+{
+ BlitParameters params = { 0 };
+ params.mDestinationFormat = destFormat;
+ params.mSignedInteger = signedInteger;
+ params.m3DBlit = false;
+
+ ASSERT(mBlitShaderMap.find(params) == mBlitShaderMap.end());
+ ASSERT(ps);
+
+ Shader shader;
+ shader.mVertexWriteFunction = Write2DVertices;
+ shader.mInputLayout = mQuad2DIL;
+ shader.mVertexShader = mQuad2DVS;
+ shader.mGeometryShader = NULL;
+ shader.mPixelShader = ps;
+
+ mBlitShaderMap[params] = shader;
+}
+
+void Blit11::add3DBlitShaderToMap(GLenum destFormat, bool signedInteger, ID3D11PixelShader *ps)
+{
+ BlitParameters params = { 0 };
+ params.mDestinationFormat = destFormat;
+ params.mSignedInteger = signedInteger;
+ params.m3DBlit = true;
+
+ ASSERT(mBlitShaderMap.find(params) == mBlitShaderMap.end());
+ ASSERT(ps);
+
+ Shader shader;
+ shader.mVertexWriteFunction = Write3DVertices;
+ shader.mInputLayout = mQuad3DIL;
+ shader.mVertexShader = mQuad3DVS;
+ shader.mGeometryShader = mQuad3DGS;
+ shader.mPixelShader = ps;
+
+ mBlitShaderMap[params] = shader;
+}
+
+void Blit11::addSwizzleShaderToMap(GLenum destType, D3D11_SRV_DIMENSION viewDimension, ID3D11PixelShader *ps)
+{
+ SwizzleParameters params = { 0 };
+ params.mDestinationType = destType;
+ params.mViewDimension = viewDimension;
+
+ ASSERT(mSwizzleShaderMap.find(params) == mSwizzleShaderMap.end());
+ ASSERT(ps);
+
+ Shader shader;
+ switch (viewDimension)
+ {
+ case D3D_SRV_DIMENSION_TEXTURE2D:
+ shader.mVertexWriteFunction = Write2DVertices;
+ shader.mInputLayout = mQuad2DIL;
+ shader.mVertexShader = mQuad2DVS;
+ shader.mGeometryShader = NULL;
+ break;
+
+ case D3D_SRV_DIMENSION_TEXTURE3D:
+ case D3D_SRV_DIMENSION_TEXTURE2DARRAY:
+ case D3D_SRV_DIMENSION_TEXTURECUBE:
+ shader.mVertexWriteFunction = Write3DVertices;
+ shader.mInputLayout = mQuad3DIL;
+ shader.mVertexShader = mQuad3DVS;
+ shader.mGeometryShader = mQuad3DGS;
+ break;
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+ shader.mPixelShader = ps;
+
+ mSwizzleShaderMap[params] = shader;
+}
+
+void Blit11::buildShaderMap()
+{
+ ID3D11Device *device = mRenderer->getDevice();
+
+ add2DBlitShaderToMap(GL_RGBA, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA2D, "Blit11 2D RGBA pixel shader" ));
+ add2DBlitShaderToMap(GL_RGBA_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA2DUI, "Blit11 2D RGBA UI pixel shader" ));
+ add2DBlitShaderToMap(GL_RGBA_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughRGBA2DI, "Blit11 2D RGBA I pixel shader" ));
+ add2DBlitShaderToMap(GL_BGRA_EXT, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA2D, "Blit11 2D BGRA pixel shader" ));
+ add2DBlitShaderToMap(GL_RGB, false, d3d11::CompilePS(device, g_PS_PassthroughRGB2D, "Blit11 2D RGB pixel shader" ));
+ add2DBlitShaderToMap(GL_RGB_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughRGB2DUI, "Blit11 2D RGB UI pixel shader" ));
+ add2DBlitShaderToMap(GL_RGB_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughRGB2DI, "Blit11 2D RGB I pixel shader" ));
+ add2DBlitShaderToMap(GL_RG, false, d3d11::CompilePS(device, g_PS_PassthroughRG2D, "Blit11 2D RG pixel shader" ));
+ add2DBlitShaderToMap(GL_RG_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughRG2DUI, "Blit11 2D RG UI pixel shader" ));
+ add2DBlitShaderToMap(GL_RG_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughRG2DI, "Blit11 2D RG I pixel shader" ));
+ add2DBlitShaderToMap(GL_RED, false, d3d11::CompilePS(device, g_PS_PassthroughR2D, "Blit11 2D R pixel shader" ));
+ add2DBlitShaderToMap(GL_RED_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughR2DUI, "Blit11 2D R UI pixel shader" ));
+ add2DBlitShaderToMap(GL_RED_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughR2DI, "Blit11 2D R I pixel shader" ));
+ add2DBlitShaderToMap(GL_ALPHA, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA2D, "Blit11 2D alpha pixel shader" ));
+ add2DBlitShaderToMap(GL_LUMINANCE, false, d3d11::CompilePS(device, g_PS_PassthroughLum2D, "Blit11 2D lum pixel shader" ));
+ add2DBlitShaderToMap(GL_LUMINANCE_ALPHA, false, d3d11::CompilePS(device, g_PS_PassthroughLumAlpha2D, "Blit11 2D luminance alpha pixel shader"));
+
+ add3DBlitShaderToMap(GL_RGBA, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA3D, "Blit11 3D RGBA pixel shader" ));
+ add3DBlitShaderToMap(GL_RGBA_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA3DUI, "Blit11 3D UI RGBA pixel shader" ));
+ add3DBlitShaderToMap(GL_RGBA_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughRGBA3DI, "Blit11 3D I RGBA pixel shader" ));
+ add3DBlitShaderToMap(GL_BGRA_EXT, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA3D, "Blit11 3D BGRA pixel shader" ));
+ add3DBlitShaderToMap(GL_RGB, false, d3d11::CompilePS(device, g_PS_PassthroughRGB3D, "Blit11 3D RGB pixel shader" ));
+ add3DBlitShaderToMap(GL_RGB_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughRGB3DUI, "Blit11 3D RGB UI pixel shader" ));
+ add3DBlitShaderToMap(GL_RGB_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughRGB3DI, "Blit11 3D RGB I pixel shader" ));
+ add3DBlitShaderToMap(GL_RG, false, d3d11::CompilePS(device, g_PS_PassthroughRG3D, "Blit11 3D RG pixel shader" ));
+ add3DBlitShaderToMap(GL_RG_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughRG3DUI, "Blit11 3D RG UI pixel shader" ));
+ add3DBlitShaderToMap(GL_RG_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughRG3DI, "Blit11 3D RG I pixel shader" ));
+ add3DBlitShaderToMap(GL_RED, false, d3d11::CompilePS(device, g_PS_PassthroughR3D, "Blit11 3D R pixel shader" ));
+ add3DBlitShaderToMap(GL_RED_INTEGER, false, d3d11::CompilePS(device, g_PS_PassthroughR3DUI, "Blit11 3D R UI pixel shader" ));
+ add3DBlitShaderToMap(GL_RED_INTEGER, true, d3d11::CompilePS(device, g_PS_PassthroughR3DI, "Blit11 3D R I pixel shader" ));
+ add3DBlitShaderToMap(GL_ALPHA, false, d3d11::CompilePS(device, g_PS_PassthroughRGBA3D, "Blit11 3D alpha pixel shader" ));
+ add3DBlitShaderToMap(GL_LUMINANCE, false, d3d11::CompilePS(device, g_PS_PassthroughLum3D, "Blit11 3D luminance pixel shader" ));
+ add3DBlitShaderToMap(GL_LUMINANCE_ALPHA, false, d3d11::CompilePS(device, g_PS_PassthroughLumAlpha3D, "Blit11 3D luminance alpha pixel shader"));
+
+ addSwizzleShaderToMap(GL_FLOAT, D3D_SRV_DIMENSION_TEXTURE2D, d3d11::CompilePS(device, g_PS_SwizzleF2D, "Blit11 2D F swizzle pixel shader" ));
+ addSwizzleShaderToMap(GL_UNSIGNED_INT, D3D_SRV_DIMENSION_TEXTURE2D, d3d11::CompilePS(device, g_PS_SwizzleUI2D, "Blit11 2D UI swizzle pixel shader"));
+ addSwizzleShaderToMap(GL_INT, D3D_SRV_DIMENSION_TEXTURE2D, d3d11::CompilePS(device, g_PS_SwizzleI2D, "Blit11 2D I swizzle pixel shader" ));
+
+ addSwizzleShaderToMap(GL_FLOAT, D3D_SRV_DIMENSION_TEXTURECUBE, d3d11::CompilePS(device, g_PS_SwizzleF2DArray, "Blit11 2D Cube F swizzle pixel shader" ));
+ addSwizzleShaderToMap(GL_UNSIGNED_INT, D3D_SRV_DIMENSION_TEXTURECUBE, d3d11::CompilePS(device, g_PS_SwizzleUI2DArray, "Blit11 2D Cube UI swizzle pixel shader"));
+ addSwizzleShaderToMap(GL_INT, D3D_SRV_DIMENSION_TEXTURECUBE, d3d11::CompilePS(device, g_PS_SwizzleI2DArray, "Blit11 2D Cube I swizzle pixel shader" ));
+
+ addSwizzleShaderToMap(GL_FLOAT, D3D_SRV_DIMENSION_TEXTURE3D, d3d11::CompilePS(device, g_PS_SwizzleF3D, "Blit11 3D F swizzle pixel shader" ));
+ addSwizzleShaderToMap(GL_UNSIGNED_INT, D3D_SRV_DIMENSION_TEXTURE3D, d3d11::CompilePS(device, g_PS_SwizzleUI3D, "Blit11 3D UI swizzle pixel shader"));
+ addSwizzleShaderToMap(GL_INT, D3D_SRV_DIMENSION_TEXTURE3D, d3d11::CompilePS(device, g_PS_SwizzleI3D, "Blit11 3D I swizzle pixel shader" ));
+
+ addSwizzleShaderToMap(GL_FLOAT, D3D_SRV_DIMENSION_TEXTURE2DARRAY, d3d11::CompilePS(device, g_PS_SwizzleF2DArray, "Blit11 2D Array F swizzle pixel shader" ));
+ addSwizzleShaderToMap(GL_UNSIGNED_INT, D3D_SRV_DIMENSION_TEXTURE2DARRAY, d3d11::CompilePS(device, g_PS_SwizzleUI2DArray, "Blit11 2D Array UI swizzle pixel shader"));
+ addSwizzleShaderToMap(GL_INT, D3D_SRV_DIMENSION_TEXTURE2DARRAY, d3d11::CompilePS(device, g_PS_SwizzleI2DArray, "Blit11 2D Array I swizzle pixel shader" ));
+}
+
+void Blit11::clearShaderMap()
+{
+ for (BlitShaderMap::iterator i = mBlitShaderMap.begin(); i != mBlitShaderMap.end(); ++i)
+ {
+ Shader &shader = i->second;
+ SafeRelease(shader.mPixelShader);
+ }
+ mBlitShaderMap.clear();
+
+ for (SwizzleShaderMap::iterator i = mSwizzleShaderMap.begin(); i != mSwizzleShaderMap.end(); ++i)
+ {
+ Shader &shader = i->second;
+ SafeRelease(shader.mPixelShader);
+ }
+ mSwizzleShaderMap.clear();
+}
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Blit11.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Blit11.h
new file mode 100644
index 00000000000..fba89e20ba8
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Blit11.h
@@ -0,0 +1,126 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Blit11.cpp: Texture copy utility class.
+
+#ifndef LIBGLESV2_BLIT11_H_
+#define LIBGLESV2_BLIT11_H_
+
+#include "common/angleutils.h"
+#include "libGLESv2/angletypes.h"
+
+namespace rx
+{
+class Renderer11;
+
+enum Filter
+{
+ Point,
+ Linear,
+};
+
+class Blit11
+{
+ public:
+ explicit Blit11(Renderer11 *renderer);
+ ~Blit11();
+
+ bool swizzleTexture(ID3D11ShaderResourceView *source, ID3D11RenderTargetView *dest, const gl::Extents &size,
+ GLenum swizzleRed, GLenum swizzleGreen, GLenum swizzleBlue, GLenum swizzleAlpha);
+
+ bool copyTexture(ID3D11ShaderResourceView *source, const gl::Box &sourceArea, const gl::Extents &sourceSize,
+ ID3D11RenderTargetView *dest, const gl::Box &destArea, const gl::Extents &destSize,
+ const gl::Rectangle *scissor, GLenum destFormat, GLenum filter);
+
+ bool copyStencil(ID3D11Resource *source, unsigned int sourceSubresource, const gl::Box &sourceArea, const gl::Extents &sourceSize,
+ ID3D11Resource *dest, unsigned int destSubresource, const gl::Box &destArea, const gl::Extents &destSize,
+ const gl::Rectangle *scissor);
+
+ bool copyDepth(ID3D11ShaderResourceView *source, const gl::Box &sourceArea, const gl::Extents &sourceSize,
+ ID3D11DepthStencilView *dest, const gl::Box &destArea, const gl::Extents &destSize,
+ const gl::Rectangle *scissor);
+
+ bool copyDepthStencil(ID3D11Resource *source, unsigned int sourceSubresource, const gl::Box &sourceArea, const gl::Extents &sourceSize,
+ ID3D11Resource *dest, unsigned int destSubresource, const gl::Box &destArea, const gl::Extents &destSize,
+ const gl::Rectangle *scissor);
+
+ private:
+ rx::Renderer11 *mRenderer;
+
+ struct BlitParameters
+ {
+ GLenum mDestinationFormat;
+ bool mSignedInteger;
+ bool m3DBlit;
+ };
+
+ bool copyDepthStencil(ID3D11Resource *source, unsigned int sourceSubresource, const gl::Box &sourceArea, const gl::Extents &sourceSize,
+ ID3D11Resource *dest, unsigned int destSubresource, const gl::Box &destArea, const gl::Extents &destSize,
+ const gl::Rectangle *scissor, bool stencilOnly);
+
+ static bool compareBlitParameters(const BlitParameters &a, const BlitParameters &b);
+
+ typedef void (*WriteVertexFunction)(const gl::Box &sourceArea, const gl::Extents &sourceSize,
+ const gl::Box &destArea, const gl::Extents &destSize,
+ void *outVertices, unsigned int *outStride, unsigned int *outVertexCount,
+ D3D11_PRIMITIVE_TOPOLOGY *outTopology);
+
+ struct Shader
+ {
+ WriteVertexFunction mVertexWriteFunction;
+ ID3D11InputLayout *mInputLayout;
+ ID3D11VertexShader *mVertexShader;
+ ID3D11GeometryShader *mGeometryShader;
+ ID3D11PixelShader *mPixelShader;
+ };
+
+ typedef bool (*BlitParametersComparisonFunction)(const BlitParameters&, const BlitParameters &);
+ typedef std::map<BlitParameters, Shader, BlitParametersComparisonFunction> BlitShaderMap;
+ BlitShaderMap mBlitShaderMap;
+
+ void add2DBlitShaderToMap(GLenum destFormat, bool signedInteger, ID3D11PixelShader *ps);
+ void add3DBlitShaderToMap(GLenum destFormat, bool signedInteger, ID3D11PixelShader *ps);
+
+ struct SwizzleParameters
+ {
+ GLenum mDestinationType;
+ D3D11_SRV_DIMENSION mViewDimension;
+ };
+
+ static bool compareSwizzleParameters(const SwizzleParameters &a, const SwizzleParameters &b);
+
+ typedef bool (*SwizzleParametersComparisonFunction)(const SwizzleParameters&, const SwizzleParameters &);
+ typedef std::map<SwizzleParameters, Shader, SwizzleParametersComparisonFunction> SwizzleShaderMap;
+ SwizzleShaderMap mSwizzleShaderMap;
+
+ void addSwizzleShaderToMap(GLenum destType, D3D11_SRV_DIMENSION viewDimension, ID3D11PixelShader *ps);
+
+ void buildShaderMap();
+ void clearShaderMap();
+
+ ID3D11Buffer *mVertexBuffer;
+ ID3D11SamplerState *mPointSampler;
+ ID3D11SamplerState *mLinearSampler;
+ ID3D11RasterizerState *mScissorEnabledRasterizerState;
+ ID3D11RasterizerState *mScissorDisabledRasterizerState;
+ ID3D11DepthStencilState *mDepthStencilState;
+
+ ID3D11InputLayout *mQuad2DIL;
+ ID3D11VertexShader *mQuad2DVS;
+ ID3D11PixelShader *mDepthPS;
+
+ ID3D11InputLayout *mQuad3DIL;
+ ID3D11VertexShader *mQuad3DVS;
+ ID3D11GeometryShader *mQuad3DGS;
+
+ ID3D11Buffer *mSwizzleCB;
+
+ DISALLOW_COPY_AND_ASSIGN(Blit11);
+};
+
+}
+
+#endif // LIBGLESV2_BLIT11_H_
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/BufferStorage11.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/BufferStorage11.cpp
new file mode 100644
index 00000000000..5109779eab0
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/BufferStorage11.cpp
@@ -0,0 +1,869 @@
+#include "precompiled.h"
+//
+// Copyright (c) 2013-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// BufferStorage11.cpp Defines the BufferStorage11 class.
+
+#include "libGLESv2/renderer/d3d11/BufferStorage11.h"
+#include "libGLESv2/main.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
+#include "libGLESv2/renderer/d3d11/formatutils11.h"
+#include "libGLESv2/Buffer.h"
+
+namespace rx
+{
+
+PackPixelsParams::PackPixelsParams()
+ : format(GL_NONE),
+ type(GL_NONE),
+ outputPitch(0),
+ packBuffer(NULL),
+ offset(0)
+{}
+
+PackPixelsParams::PackPixelsParams(const gl::Rectangle &areaIn, GLenum formatIn, GLenum typeIn, GLuint outputPitchIn,
+ const gl::PixelPackState &packIn, ptrdiff_t offsetIn)
+ : area(areaIn),
+ format(formatIn),
+ type(typeIn),
+ outputPitch(outputPitchIn),
+ packBuffer(packIn.pixelBuffer.get()),
+ pack(packIn.alignment, packIn.reverseRowOrder),
+ offset(offsetIn)
+{}
+
+namespace gl_d3d11
+{
+
+D3D11_MAP GetD3DMapTypeFromBits(GLbitfield access)
+{
+ bool readBit = ((access & GL_MAP_READ_BIT) != 0);
+ bool writeBit = ((access & GL_MAP_WRITE_BIT) != 0);
+
+ ASSERT(readBit || writeBit);
+
+ // Note : we ignore the discard bit, because in D3D11, staging buffers
+ // don't accept the map-discard flag (discard only works for DYNAMIC usage)
+
+ if (readBit && !writeBit)
+ {
+ return D3D11_MAP_READ;
+ }
+ else if (writeBit && !readBit)
+ {
+ return D3D11_MAP_WRITE;
+ }
+ else if (writeBit && readBit)
+ {
+ return D3D11_MAP_READ_WRITE;
+ }
+ else
+ {
+ UNREACHABLE();
+ return D3D11_MAP_READ;
+ }
+}
+
+}
+
+// Each instance of BufferStorageD3DBuffer11 is specialized for a class of D3D binding points
+// - vertex/transform feedback buffers
+// - index buffers
+// - pixel unpack buffers
+// - uniform buffers
+class BufferStorage11::TypedBufferStorage11
+{
+ public:
+ virtual ~TypedBufferStorage11() {}
+
+ DataRevision getDataRevision() const { return mRevision; }
+ BufferUsage getUsage() const { return mUsage; }
+ size_t getSize() const { return mBufferSize; }
+ bool isMappable() const { return (mUsage == BUFFER_USAGE_STAGING || mUsage == BUFFER_USAGE_PIXEL_PACK); }
+
+ void setDataRevision(DataRevision rev) { mRevision = rev; }
+
+ virtual bool copyFromStorage(TypedBufferStorage11 *source, size_t sourceOffset,
+ size_t size, size_t destOffset) = 0;
+ virtual bool resize(size_t size, bool preserveData) = 0;
+
+ virtual void *map(GLbitfield access) = 0;
+ virtual void unmap() = 0;
+
+ protected:
+ TypedBufferStorage11(Renderer11 *renderer, BufferUsage usage);
+
+ Renderer11 *mRenderer;
+ DataRevision mRevision;
+ const BufferUsage mUsage;
+ size_t mBufferSize;
+};
+
+// A native buffer storage represents an underlying D3D11 buffer for a particular
+// type of storage.
+class BufferStorage11::NativeBuffer11 : public BufferStorage11::TypedBufferStorage11
+{
+ public:
+ NativeBuffer11(Renderer11 *renderer, BufferUsage usage);
+ ~NativeBuffer11();
+
+ ID3D11Buffer *getNativeBuffer() const { return mNativeBuffer; }
+
+ virtual bool copyFromStorage(TypedBufferStorage11 *source, size_t sourceOffset,
+ size_t size, size_t destOffset);
+ virtual bool resize(size_t size, bool preserveData);
+
+ virtual void *map(GLbitfield access);
+ virtual void unmap();
+
+ private:
+ ID3D11Buffer *mNativeBuffer;
+
+ static void fillBufferDesc(D3D11_BUFFER_DESC* bufferDesc, Renderer *renderer, BufferUsage usage, unsigned int bufferSize);
+};
+
+// Pack storage represents internal storage for pack buffers. We implement pack buffers
+// as CPU memory, tied to a staging texture, for asynchronous texture readback.
+class BufferStorage11::PackStorage11 : public BufferStorage11::TypedBufferStorage11
+{
+ public:
+ PackStorage11(Renderer11 *renderer);
+ ~PackStorage11();
+
+ virtual bool copyFromStorage(TypedBufferStorage11 *source, size_t sourceOffset,
+ size_t size, size_t destOffset);
+ virtual bool resize(size_t size, bool preserveData);
+
+ virtual void *map(GLbitfield access);
+ virtual void unmap();
+
+ void packPixels(ID3D11Texture2D *srcTexure, UINT srcSubresource, const PackPixelsParams &params);
+
+ private:
+
+ void flushQueuedPackCommand();
+
+ ID3D11Texture2D *mStagingTexture;
+ DXGI_FORMAT mTextureFormat;
+ gl::Extents mTextureSize;
+ std::vector<unsigned char> mMemoryBuffer;
+ PackPixelsParams *mQueuedPackCommand;
+ PackPixelsParams mPackParams;
+ bool mDataModified;
+};
+
+BufferStorage11::BufferStorage11(Renderer11 *renderer)
+ : mRenderer(renderer),
+ mMappedStorage(NULL),
+ mResolvedDataRevision(0),
+ mReadUsageCount(0),
+ mSize(0)
+{
+}
+
+BufferStorage11::~BufferStorage11()
+{
+ for (auto it = mTypedBuffers.begin(); it != mTypedBuffers.end(); it++)
+ {
+ SafeDelete(it->second);
+ }
+}
+
+BufferStorage11 *BufferStorage11::makeBufferStorage11(BufferStorage *bufferStorage)
+{
+ ASSERT(HAS_DYNAMIC_TYPE(BufferStorage11*, bufferStorage));
+ return static_cast<BufferStorage11*>(bufferStorage);
+}
+
+void *BufferStorage11::getData()
+{
+ NativeBuffer11 *stagingBuffer = getStagingBuffer();
+
+ if (!stagingBuffer)
+ {
+ // Out-of-memory
+ return NULL;
+ }
+
+ if (stagingBuffer->getDataRevision() > mResolvedDataRevision)
+ {
+ if (stagingBuffer->getSize() > mResolvedData.size())
+ {
+ mResolvedData.resize(stagingBuffer->getSize());
+ }
+
+ ID3D11DeviceContext *context = mRenderer->getDeviceContext();
+
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
+ HRESULT result = context->Map(stagingBuffer->getNativeBuffer(), 0, D3D11_MAP_READ, 0, &mappedResource);
+ if (FAILED(result))
+ {
+ return gl::error(GL_OUT_OF_MEMORY, (void*)NULL);
+ }
+
+ memcpy(mResolvedData.data(), mappedResource.pData, stagingBuffer->getSize());
+
+ context->Unmap(stagingBuffer->getNativeBuffer(), 0);
+
+ mResolvedDataRevision = stagingBuffer->getDataRevision();
+ }
+
+ mReadUsageCount = 0;
+
+ return mResolvedData.data();
+}
+
+void BufferStorage11::setData(const void* data, size_t size, size_t offset)
+{
+ size_t requiredSize = size + offset;
+ mSize = std::max(mSize, requiredSize);
+
+ if (data)
+ {
+ NativeBuffer11 *stagingBuffer = getStagingBuffer();
+
+ if (!stagingBuffer)
+ {
+ // Out-of-memory
+ return;
+ }
+
+ // Explicitly resize the staging buffer, preserving data if the new data will not
+ // completely fill the buffer
+ if (stagingBuffer->getSize() < requiredSize)
+ {
+ bool preserveData = (offset > 0);
+ if (!stagingBuffer->resize(requiredSize, preserveData))
+ {
+ // Out-of-memory
+ return;
+ }
+ }
+
+ ID3D11DeviceContext *context = mRenderer->getDeviceContext();
+
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
+ HRESULT result = context->Map(stagingBuffer->getNativeBuffer(), 0, D3D11_MAP_WRITE, 0, &mappedResource);
+ if (FAILED(result))
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+
+ unsigned char *offsetBufferPointer = reinterpret_cast<unsigned char *>(mappedResource.pData) + offset;
+ memcpy(offsetBufferPointer, data, size);
+
+ context->Unmap(stagingBuffer->getNativeBuffer(), 0);
+
+ stagingBuffer->setDataRevision(stagingBuffer->getDataRevision() + 1);
+ }
+}
+
+void BufferStorage11::copyData(BufferStorage* sourceStorage, size_t size, size_t sourceOffset, size_t destOffset)
+{
+ BufferStorage11* sourceStorage11 = makeBufferStorage11(sourceStorage);
+ if (sourceStorage11)
+ {
+ TypedBufferStorage11 *dest = getLatestStorage();
+ if (!dest)
+ {
+ dest = getStagingBuffer();
+ }
+
+ TypedBufferStorage11 *source = sourceStorage11->getLatestStorage();
+ if (source && dest)
+ {
+ // If copying to/from a pixel pack buffer, we must have a staging or
+ // pack buffer partner, because other native buffers can't be mapped
+ if (dest->getUsage() == BUFFER_USAGE_PIXEL_PACK && !source->isMappable())
+ {
+ source = sourceStorage11->getStagingBuffer();
+ }
+ else if (source->getUsage() == BUFFER_USAGE_PIXEL_PACK && !dest->isMappable())
+ {
+ dest = getStagingBuffer();
+ }
+
+ dest->copyFromStorage(source, sourceOffset, size, destOffset);
+ dest->setDataRevision(dest->getDataRevision() + 1);
+ }
+
+ mSize = std::max<size_t>(mSize, destOffset + size);
+ }
+}
+
+void BufferStorage11::clear()
+{
+ mSize = 0;
+ mResolvedDataRevision = 0;
+}
+
+void BufferStorage11::markTransformFeedbackUsage()
+{
+ TypedBufferStorage11 *transformFeedbackStorage = getStorage(BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK);
+
+ if (transformFeedbackStorage)
+ {
+ transformFeedbackStorage->setDataRevision(transformFeedbackStorage->getDataRevision() + 1);
+ }
+}
+
+size_t BufferStorage11::getSize() const
+{
+ return mSize;
+}
+
+bool BufferStorage11::supportsDirectBinding() const
+{
+ return true;
+}
+
+void BufferStorage11::markBufferUsage()
+{
+ mReadUsageCount++;
+
+ const unsigned int usageLimit = 5;
+
+ if (mReadUsageCount > usageLimit && mResolvedData.size() > 0)
+ {
+ mResolvedData.resize(0);
+ mResolvedDataRevision = 0;
+ }
+}
+
+ID3D11Buffer *BufferStorage11::getBuffer(BufferUsage usage)
+{
+ markBufferUsage();
+
+ TypedBufferStorage11 *typedBuffer = getStorage(usage);
+
+ if (!typedBuffer)
+ {
+ // Storage out-of-memory
+ return NULL;
+ }
+
+ ASSERT(HAS_DYNAMIC_TYPE(NativeBuffer11*, typedBuffer));
+
+ return static_cast<NativeBuffer11*>(typedBuffer)->getNativeBuffer();
+}
+
+ID3D11ShaderResourceView *BufferStorage11::getSRV(DXGI_FORMAT srvFormat)
+{
+ TypedBufferStorage11 *storage = getStorage(BUFFER_USAGE_PIXEL_UNPACK);
+
+ if (!storage)
+ {
+ // Storage out-of-memory
+ return NULL;
+ }
+
+ ASSERT(HAS_DYNAMIC_TYPE(NativeBuffer11*, storage));
+ ID3D11Buffer *buffer = static_cast<NativeBuffer11*>(storage)->getNativeBuffer();
+
+ auto bufferSRVIt = mBufferResourceViews.find(srvFormat);
+
+ if (bufferSRVIt != mBufferResourceViews.end())
+ {
+ if (bufferSRVIt->second.first == buffer)
+ {
+ return bufferSRVIt->second.second;
+ }
+ else
+ {
+ // The underlying buffer has changed since the SRV was created: recreate the SRV.
+ SafeRelease(bufferSRVIt->second.second);
+ }
+ }
+
+ ID3D11Device *device = mRenderer->getDevice();
+ ID3D11ShaderResourceView *bufferSRV = NULL;
+
+ D3D11_SHADER_RESOURCE_VIEW_DESC bufferSRVDesc;
+ bufferSRVDesc.Buffer.ElementOffset = 0;
+ bufferSRVDesc.Buffer.ElementWidth = mSize / d3d11::GetFormatPixelBytes(srvFormat);
+ bufferSRVDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
+ bufferSRVDesc.Format = srvFormat;
+
+ HRESULT result = device->CreateShaderResourceView(buffer, &bufferSRVDesc, &bufferSRV);
+ UNUSED_ASSERTION_VARIABLE(result);
+ ASSERT(SUCCEEDED(result));
+
+ mBufferResourceViews[srvFormat] = BufferSRVPair(buffer, bufferSRV);
+
+ return bufferSRV;
+}
+
+void BufferStorage11::packPixels(ID3D11Texture2D *srcTexture, UINT srcSubresource, const PackPixelsParams &params)
+{
+ PackStorage11 *packStorage = getPackStorage();
+
+ TypedBufferStorage11 *latestStorage = getLatestStorage();
+
+ if (packStorage)
+ {
+ packStorage->packPixels(srcTexture, srcSubresource, params);
+ packStorage->setDataRevision(latestStorage ? latestStorage->getDataRevision() + 1 : 1);
+ }
+}
+
+BufferStorage11::TypedBufferStorage11 *BufferStorage11::getStorage(BufferUsage usage)
+{
+ TypedBufferStorage11 *directBuffer = NULL;
+ auto directBufferIt = mTypedBuffers.find(usage);
+ if (directBufferIt != mTypedBuffers.end())
+ {
+ directBuffer = directBufferIt->second;
+ }
+
+ if (!directBuffer)
+ {
+ if (usage == BUFFER_USAGE_PIXEL_PACK)
+ {
+ directBuffer = new PackStorage11(mRenderer);
+ }
+ else
+ {
+ // buffer is not allocated, create it
+ directBuffer = new NativeBuffer11(mRenderer, usage);
+ }
+
+ mTypedBuffers.insert(std::make_pair(usage, directBuffer));
+ }
+
+ // resize buffer
+ if (directBuffer->getSize() < mSize)
+ {
+ if (!directBuffer->resize(mSize, true))
+ {
+ // Out of memory error
+ return NULL;
+ }
+ }
+
+ TypedBufferStorage11 *latestBuffer = getLatestStorage();
+ if (latestBuffer && latestBuffer->getDataRevision() > directBuffer->getDataRevision())
+ {
+ // if copying from a pack buffer to a non-staging native buffer, we must first
+ // copy through the staging buffer, because other native buffers can't be mapped
+ if (latestBuffer->getUsage() == BUFFER_USAGE_PIXEL_PACK && !directBuffer->isMappable())
+ {
+ NativeBuffer11 *stagingBuffer = getStagingBuffer();
+
+ stagingBuffer->copyFromStorage(latestBuffer, 0, latestBuffer->getSize(), 0);
+ directBuffer->setDataRevision(latestBuffer->getDataRevision());
+
+ latestBuffer = stagingBuffer;
+ }
+
+ // if copyFromStorage returns true, the D3D buffer has been recreated
+ // and we should update our serial
+ if (directBuffer->copyFromStorage(latestBuffer, 0, latestBuffer->getSize(), 0))
+ {
+ updateSerial();
+ }
+ directBuffer->setDataRevision(latestBuffer->getDataRevision());
+ }
+
+ return directBuffer;
+}
+
+BufferStorage11::TypedBufferStorage11 *BufferStorage11::getLatestStorage() const
+{
+ // Even though we iterate over all the direct buffers, it is expected that only
+ // 1 or 2 will be present.
+ TypedBufferStorage11 *latestStorage = NULL;
+ DataRevision latestRevision = 0;
+ for (auto it = mTypedBuffers.begin(); it != mTypedBuffers.end(); it++)
+ {
+ TypedBufferStorage11 *storage = it->second;
+ if (!latestStorage || storage->getDataRevision() > latestRevision)
+ {
+ latestStorage = storage;
+ latestRevision = storage->getDataRevision();
+ }
+ }
+
+ return latestStorage;
+}
+
+bool BufferStorage11::isMapped() const
+{
+ return mMappedStorage != NULL;
+}
+
+void *BufferStorage11::map(GLbitfield access)
+{
+ ASSERT(!mMappedStorage);
+
+ TypedBufferStorage11 *latestStorage = getLatestStorage();
+ ASSERT(latestStorage);
+
+ if (latestStorage->getUsage() == BUFFER_USAGE_PIXEL_PACK ||
+ latestStorage->getUsage() == BUFFER_USAGE_STAGING)
+ {
+ mMappedStorage = latestStorage;
+ }
+ else
+ {
+ mMappedStorage = getStagingBuffer();
+ }
+
+ if (!mMappedStorage)
+ {
+ // Out-of-memory
+ return NULL;
+ }
+
+ return mMappedStorage->map(access);
+}
+
+void BufferStorage11::unmap()
+{
+ ASSERT(mMappedStorage);
+ mMappedStorage->unmap();
+ mMappedStorage = NULL;
+}
+
+BufferStorage11::NativeBuffer11 *BufferStorage11::getStagingBuffer()
+{
+ TypedBufferStorage11 *stagingStorage = getStorage(BUFFER_USAGE_STAGING);
+
+ if (!stagingStorage)
+ {
+ // Out-of-memory
+ return NULL;
+ }
+
+ ASSERT(HAS_DYNAMIC_TYPE(NativeBuffer11*, stagingStorage));
+ return static_cast<NativeBuffer11*>(stagingStorage);
+}
+
+BufferStorage11::PackStorage11 *BufferStorage11::getPackStorage()
+{
+ TypedBufferStorage11 *packStorage = getStorage(BUFFER_USAGE_PIXEL_PACK);
+
+ if (!packStorage)
+ {
+ // Out-of-memory
+ return NULL;
+ }
+
+ ASSERT(HAS_DYNAMIC_TYPE(PackStorage11*, packStorage));
+ return static_cast<PackStorage11*>(packStorage);
+}
+
+BufferStorage11::TypedBufferStorage11::TypedBufferStorage11(Renderer11 *renderer, BufferUsage usage)
+ : mRenderer(renderer),
+ mUsage(usage),
+ mRevision(0),
+ mBufferSize(0)
+{
+}
+
+BufferStorage11::NativeBuffer11::NativeBuffer11(Renderer11 *renderer, BufferUsage usage)
+ : TypedBufferStorage11(renderer, usage),
+ mNativeBuffer(NULL)
+{
+}
+
+BufferStorage11::NativeBuffer11::~NativeBuffer11()
+{
+ SafeRelease(mNativeBuffer);
+}
+
+// Returns true if it recreates the direct buffer
+bool BufferStorage11::NativeBuffer11::copyFromStorage(TypedBufferStorage11 *source, size_t sourceOffset,
+ size_t size, size_t destOffset)
+{
+ ID3D11DeviceContext *context = mRenderer->getDeviceContext();
+
+ size_t requiredSize = sourceOffset + size;
+ bool createBuffer = !mNativeBuffer || mBufferSize < requiredSize;
+
+ // (Re)initialize D3D buffer if needed
+ if (createBuffer)
+ {
+ bool preserveData = (destOffset > 0);
+ resize(source->getSize(), preserveData);
+ }
+
+ if (source->getUsage() == BUFFER_USAGE_PIXEL_PACK)
+ {
+ ASSERT(HAS_DYNAMIC_TYPE(PackStorage11*, source));
+
+ unsigned char *sourcePointer = static_cast<unsigned char *>(source->map(GL_MAP_READ_BIT)) + sourceOffset;
+
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
+ HRESULT hr = context->Map(mNativeBuffer, 0, D3D11_MAP_WRITE, 0, &mappedResource);
+ UNUSED_ASSERTION_VARIABLE(hr);
+ ASSERT(SUCCEEDED(hr));
+
+ unsigned char *destPointer = static_cast<unsigned char *>(mappedResource.pData) + destOffset;
+
+ // Offset bounds are validated at the API layer
+ ASSERT(sourceOffset + size <= destOffset + mBufferSize);
+ memcpy(destPointer, sourcePointer, size);
+ }
+ else
+ {
+ ASSERT(HAS_DYNAMIC_TYPE(NativeBuffer11*, source));
+
+ D3D11_BOX srcBox;
+ srcBox.left = sourceOffset;
+ srcBox.right = sourceOffset + size;
+ srcBox.top = 0;
+ srcBox.bottom = 1;
+ srcBox.front = 0;
+ srcBox.back = 1;
+
+ ASSERT(HAS_DYNAMIC_TYPE(NativeBuffer11*, source));
+ ID3D11Buffer *sourceBuffer = static_cast<NativeBuffer11*>(source)->getNativeBuffer();
+
+ context->CopySubresourceRegion(mNativeBuffer, 0, destOffset, 0, 0, sourceBuffer, 0, &srcBox);
+ }
+
+ return createBuffer;
+}
+
+bool BufferStorage11::NativeBuffer11::resize(size_t size, bool preserveData)
+{
+ ID3D11Device *device = mRenderer->getDevice();
+ ID3D11DeviceContext *context = mRenderer->getDeviceContext();
+
+ D3D11_BUFFER_DESC bufferDesc;
+ fillBufferDesc(&bufferDesc, mRenderer, mUsage, size);
+
+ ID3D11Buffer *newBuffer;
+ HRESULT result = device->CreateBuffer(&bufferDesc, NULL, &newBuffer);
+
+ if (FAILED(result))
+ {
+ return gl::error(GL_OUT_OF_MEMORY, false);
+ }
+
+ if (mNativeBuffer && preserveData)
+ {
+ // We don't call resize if the buffer is big enough already.
+ ASSERT(mBufferSize <= size);
+
+ D3D11_BOX srcBox;
+ srcBox.left = 0;
+ srcBox.right = mBufferSize;
+ srcBox.top = 0;
+ srcBox.bottom = 1;
+ srcBox.front = 0;
+ srcBox.back = 1;
+
+ context->CopySubresourceRegion(newBuffer, 0, 0, 0, 0, mNativeBuffer, 0, &srcBox);
+ }
+
+ // No longer need the old buffer
+ SafeRelease(mNativeBuffer);
+ mNativeBuffer = newBuffer;
+
+ mBufferSize = bufferDesc.ByteWidth;
+
+ return true;
+}
+
+void BufferStorage11::NativeBuffer11::fillBufferDesc(D3D11_BUFFER_DESC* bufferDesc, Renderer *renderer,
+ BufferUsage usage, unsigned int bufferSize)
+{
+ bufferDesc->ByteWidth = bufferSize;
+ bufferDesc->MiscFlags = 0;
+ bufferDesc->StructureByteStride = 0;
+
+ switch (usage)
+ {
+ case BUFFER_USAGE_STAGING:
+ bufferDesc->Usage = D3D11_USAGE_STAGING;
+ bufferDesc->BindFlags = 0;
+ bufferDesc->CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
+ break;
+
+ case BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK:
+ bufferDesc->Usage = D3D11_USAGE_DEFAULT;
+ bufferDesc->BindFlags = D3D11_BIND_VERTEX_BUFFER | D3D11_BIND_STREAM_OUTPUT;
+ bufferDesc->CPUAccessFlags = 0;
+ break;
+
+ case BUFFER_USAGE_INDEX:
+ bufferDesc->Usage = D3D11_USAGE_DEFAULT;
+ bufferDesc->BindFlags = D3D11_BIND_INDEX_BUFFER;
+ bufferDesc->CPUAccessFlags = 0;
+ break;
+
+ case BUFFER_USAGE_PIXEL_UNPACK:
+ bufferDesc->Usage = D3D11_USAGE_DEFAULT;
+ bufferDesc->BindFlags = D3D11_BIND_SHADER_RESOURCE;
+ bufferDesc->CPUAccessFlags = 0;
+ break;
+
+ case BUFFER_USAGE_UNIFORM:
+ bufferDesc->Usage = D3D11_USAGE_DYNAMIC;
+ bufferDesc->BindFlags = D3D11_BIND_CONSTANT_BUFFER;
+ bufferDesc->CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+
+ // Constant buffers must be of a limited size, and aligned to 16 byte boundaries
+ // For our purposes we ignore any buffer data past the maximum constant buffer size
+ bufferDesc->ByteWidth = roundUp(bufferDesc->ByteWidth, 16u);
+ bufferDesc->ByteWidth = std::min(bufferDesc->ByteWidth, renderer->getMaxUniformBufferSize());
+ break;
+
+ default:
+ UNREACHABLE();
+ }
+}
+
+void *BufferStorage11::NativeBuffer11::map(GLbitfield access)
+{
+ ASSERT(mUsage == BUFFER_USAGE_STAGING);
+
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
+ ID3D11DeviceContext *context = mRenderer->getDeviceContext();
+ D3D11_MAP d3dMapType = gl_d3d11::GetD3DMapTypeFromBits(access);
+ UINT d3dMapFlag = ((access & GL_MAP_UNSYNCHRONIZED_BIT) != 0 ? D3D11_MAP_FLAG_DO_NOT_WAIT : 0);
+
+ HRESULT result = context->Map(mNativeBuffer, 0, d3dMapType, d3dMapFlag, &mappedResource);
+ UNUSED_ASSERTION_VARIABLE(result);
+ ASSERT(SUCCEEDED(result));
+
+ return mappedResource.pData;
+}
+
+void BufferStorage11::NativeBuffer11::unmap()
+{
+ ASSERT(mUsage == BUFFER_USAGE_STAGING);
+ ID3D11DeviceContext *context = mRenderer->getDeviceContext();
+ context->Unmap(mNativeBuffer, 0);
+}
+
+BufferStorage11::PackStorage11::PackStorage11(Renderer11 *renderer)
+ : TypedBufferStorage11(renderer, BUFFER_USAGE_PIXEL_PACK),
+ mStagingTexture(NULL),
+ mTextureFormat(DXGI_FORMAT_UNKNOWN),
+ mQueuedPackCommand(NULL),
+ mDataModified(false)
+{
+}
+
+BufferStorage11::PackStorage11::~PackStorage11()
+{
+ SafeRelease(mStagingTexture);
+ SafeDelete(mQueuedPackCommand);
+}
+
+bool BufferStorage11::PackStorage11::copyFromStorage(TypedBufferStorage11 *source, size_t sourceOffset,
+ size_t size, size_t destOffset)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool BufferStorage11::PackStorage11::resize(size_t size, bool preserveData)
+{
+ if (size != mBufferSize)
+ {
+ mMemoryBuffer.resize(size, 0);
+ mBufferSize = size;
+ }
+
+ return true;
+}
+
+void *BufferStorage11::PackStorage11::map(GLbitfield access)
+{
+ // TODO: fast path
+ // We might be able to optimize out one or more memcpy calls by detecting when
+ // and if D3D packs the staging texture memory identically to how we would fill
+ // the pack buffer according to the current pack state.
+
+ flushQueuedPackCommand();
+ mDataModified = (mDataModified || (access & GL_MAP_WRITE_BIT) != 0);
+
+ return &mMemoryBuffer[0];
+}
+
+void BufferStorage11::PackStorage11::unmap()
+{
+ // No-op
+}
+
+void BufferStorage11::PackStorage11::packPixels(ID3D11Texture2D *srcTexure, UINT srcSubresource, const PackPixelsParams &params)
+{
+ flushQueuedPackCommand();
+ mQueuedPackCommand = new PackPixelsParams(params);
+
+ D3D11_TEXTURE2D_DESC textureDesc;
+ srcTexure->GetDesc(&textureDesc);
+
+ if (mStagingTexture != NULL &&
+ (mTextureFormat != textureDesc.Format ||
+ mTextureSize.width != params.area.width ||
+ mTextureSize.height != params.area.height))
+ {
+ SafeRelease(mStagingTexture);
+ mTextureSize.width = 0;
+ mTextureSize.height = 0;
+ mTextureFormat = DXGI_FORMAT_UNKNOWN;
+ }
+
+ if (mStagingTexture == NULL)
+ {
+ ID3D11Device *device = mRenderer->getDevice();
+ HRESULT hr;
+
+ mTextureSize.width = params.area.width;
+ mTextureSize.height = params.area.height;
+ mTextureFormat = textureDesc.Format;
+
+ D3D11_TEXTURE2D_DESC stagingDesc;
+ stagingDesc.Width = params.area.width;
+ stagingDesc.Height = params.area.height;
+ stagingDesc.MipLevels = 1;
+ stagingDesc.ArraySize = 1;
+ stagingDesc.Format = mTextureFormat;
+ stagingDesc.SampleDesc.Count = 1;
+ stagingDesc.SampleDesc.Quality = 0;
+ stagingDesc.Usage = D3D11_USAGE_STAGING;
+ stagingDesc.BindFlags = 0;
+ stagingDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
+ stagingDesc.MiscFlags = 0;
+
+ hr = device->CreateTexture2D(&stagingDesc, NULL, &mStagingTexture);
+ ASSERT(SUCCEEDED(hr));
+ }
+
+ if (textureDesc.SampleDesc.Count > 1)
+ {
+ UNIMPLEMENTED();
+ }
+
+ ID3D11DeviceContext *immediateContext = mRenderer->getDeviceContext();
+ D3D11_BOX srcBox;
+ srcBox.left = params.area.x;
+ srcBox.right = params.area.x + params.area.width;
+ srcBox.top = params.area.y;
+ srcBox.bottom = params.area.y + params.area.height;
+ srcBox.front = 0;
+ srcBox.back = 1;
+
+ // Asynchronous copy
+ immediateContext->CopySubresourceRegion(mStagingTexture, 0, 0, 0, 0, srcTexure, srcSubresource, &srcBox);
+}
+
+void BufferStorage11::PackStorage11::flushQueuedPackCommand()
+{
+ ASSERT(!mMemoryBuffer.empty());
+
+ if (mQueuedPackCommand)
+ {
+ mRenderer->packPixels(mStagingTexture, *mQueuedPackCommand, &mMemoryBuffer[0]);
+ SafeDelete(mQueuedPackCommand);
+ }
+}
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/BufferStorage11.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/BufferStorage11.h
new file mode 100644
index 00000000000..7934de192c1
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/BufferStorage11.h
@@ -0,0 +1,100 @@
+//
+// Copyright (c) 2013-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// BufferStorage11.h Defines the BufferStorage11 class.
+
+#ifndef LIBGLESV2_RENDERER_BUFFERSTORAGE11_H_
+#define LIBGLESV2_RENDERER_BUFFERSTORAGE11_H_
+
+#include "libGLESv2/renderer/BufferStorage.h"
+#include "libGLESv2/angletypes.h"
+
+namespace rx
+{
+class Renderer;
+class Renderer11;
+
+enum BufferUsage
+{
+ BUFFER_USAGE_STAGING,
+ BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK,
+ BUFFER_USAGE_INDEX,
+ BUFFER_USAGE_PIXEL_UNPACK,
+ BUFFER_USAGE_PIXEL_PACK,
+ BUFFER_USAGE_UNIFORM,
+};
+
+struct PackPixelsParams
+{
+ PackPixelsParams();
+ PackPixelsParams(const gl::Rectangle &area, GLenum format, GLenum type, GLuint outputPitch,
+ const gl::PixelPackState &pack, ptrdiff_t offset);
+
+ gl::Rectangle area;
+ GLenum format;
+ GLenum type;
+ GLuint outputPitch;
+ gl::Buffer *packBuffer;
+ gl::PixelPackState pack;
+ ptrdiff_t offset;
+};
+
+typedef size_t DataRevision;
+
+class BufferStorage11 : public BufferStorage
+{
+ public:
+ explicit BufferStorage11(Renderer11 *renderer);
+ virtual ~BufferStorage11();
+
+ static BufferStorage11 *makeBufferStorage11(BufferStorage *bufferStorage);
+
+ virtual void *getData();
+ virtual void setData(const void* data, size_t size, size_t offset);
+ virtual void copyData(BufferStorage* sourceStorage, size_t size, size_t sourceOffset, size_t destOffset);
+ virtual void clear();
+ virtual void markTransformFeedbackUsage();
+ virtual size_t getSize() const;
+ virtual bool supportsDirectBinding() const;
+
+ ID3D11Buffer *getBuffer(BufferUsage usage);
+ ID3D11ShaderResourceView *getSRV(DXGI_FORMAT srvFormat);
+ void packPixels(ID3D11Texture2D *srcTexure, UINT srcSubresource, const PackPixelsParams &params);
+
+ virtual bool isMapped() const;
+ virtual void *map(GLbitfield access);
+ virtual void unmap();
+
+ private:
+ class TypedBufferStorage11;
+ class NativeBuffer11;
+ class PackStorage11;
+
+ Renderer11 *mRenderer;
+ TypedBufferStorage11 *mMappedStorage;
+
+ std::map<BufferUsage, TypedBufferStorage11*> mTypedBuffers;
+
+ typedef std::pair<ID3D11Buffer *, ID3D11ShaderResourceView *> BufferSRVPair;
+ std::map<DXGI_FORMAT, BufferSRVPair> mBufferResourceViews;
+
+ std::vector<unsigned char> mResolvedData;
+ DataRevision mResolvedDataRevision;
+ unsigned int mReadUsageCount;
+
+ size_t mSize;
+
+ void markBufferUsage();
+ NativeBuffer11 *getStagingBuffer();
+ PackStorage11 *getPackStorage();
+
+ TypedBufferStorage11 *getStorage(BufferUsage usage);
+ TypedBufferStorage11 *getLatestStorage() const;
+};
+
+}
+
+#endif // LIBGLESV2_RENDERER_BUFFERSTORAGE11_H_
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Clear11.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Clear11.cpp
new file mode 100644
index 00000000000..bb73241378e
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Clear11.cpp
@@ -0,0 +1,557 @@
+#include "precompiled.h"
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Clear11.cpp: Framebuffer clear utility class.
+
+#include "libGLESv2/renderer/d3d11/Clear11.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
+#include "libGLESv2/renderer/d3d11/renderer11_utils.h"
+#include "libGLESv2/renderer/d3d11/RenderTarget11.h"
+
+#include "libGLESv2/formatutils.h"
+#include "libGLESv2/Framebuffer.h"
+#include "libGLESv2/Renderbuffer.h"
+
+#include "libGLESv2/renderer/d3d11/shaders/compiled/clearfloat11vs.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/clearfloat11ps.h"
+
+#include "libGLESv2/renderer/d3d11/shaders/compiled/clearuint11vs.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/clearuint11ps.h"
+
+#include "libGLESv2/renderer/d3d11/shaders/compiled/clearsint11vs.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/clearsint11ps.h"
+
+namespace rx
+{
+
+template <typename T>
+static void ApplyVertices(const gl::Extents &framebufferSize, const gl::Rectangle *scissor, const gl::Color<T> &color, float depth, void *buffer)
+{
+ d3d11::PositionDepthColorVertex<T> *vertices = reinterpret_cast<d3d11::PositionDepthColorVertex<T>*>(buffer);
+
+ float depthClear = gl::clamp01(depth);
+ float left = -1.0f;
+ float right = 1.0f;
+ float top = -1.0f;
+ float bottom = 1.0f;
+
+ // Clip the quad coordinates to the scissor if needed
+ if (scissor != NULL)
+ {
+ left = std::max(left, (scissor->x / float(framebufferSize.width)) * 2.0f - 1.0f);
+ right = std::min(right, ((scissor->x + scissor->width) / float(framebufferSize.width)) * 2.0f - 1.0f);
+ top = std::max(top, ((framebufferSize.height - scissor->y - scissor->height) / float(framebufferSize.height)) * 2.0f - 1.0f);
+ bottom = std::min(bottom, ((framebufferSize.height - scissor->y) / float(framebufferSize.height)) * 2.0f - 1.0f);
+ }
+
+ d3d11::SetPositionDepthColorVertex<T>(vertices + 0, left, bottom, depthClear, color);
+ d3d11::SetPositionDepthColorVertex<T>(vertices + 1, left, top, depthClear, color);
+ d3d11::SetPositionDepthColorVertex<T>(vertices + 2, right, bottom, depthClear, color);
+ d3d11::SetPositionDepthColorVertex<T>(vertices + 3, right, top, depthClear, color);
+}
+
+template <unsigned int vsSize, unsigned int psSize>
+Clear11::ClearShader Clear11::CreateClearShader(ID3D11Device *device, DXGI_FORMAT colorType, const BYTE (&vsByteCode)[vsSize], const BYTE (&psByteCode)[psSize])
+{
+ HRESULT result;
+
+ ClearShader shader = { 0 };
+
+ D3D11_INPUT_ELEMENT_DESC quadLayout[] =
+ {
+ { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ { "COLOR", 0, colorType, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ };
+
+ result = device->CreateInputLayout(quadLayout, ArraySize(quadLayout), vsByteCode, vsSize, &shader.inputLayout);
+ ASSERT(SUCCEEDED(result));
+
+ result = device->CreateVertexShader(vsByteCode, vsSize, NULL, &shader.vertexShader);
+ ASSERT(SUCCEEDED(result));
+
+ result = device->CreatePixelShader(psByteCode, psSize, NULL, &shader.pixelShader);
+ ASSERT(SUCCEEDED(result));
+
+ return shader;
+}
+
+Clear11::Clear11(Renderer11 *renderer)
+ : mRenderer(renderer), mClearBlendStates(StructLessThan<ClearBlendInfo>), mClearDepthStencilStates(StructLessThan<ClearDepthStencilInfo>),
+ mVertexBuffer(NULL), mRasterizerState(NULL)
+{
+ HRESULT result;
+ ID3D11Device *device = renderer->getDevice();
+
+ D3D11_BUFFER_DESC vbDesc;
+ vbDesc.ByteWidth = sizeof(d3d11::PositionDepthColorVertex<float>) * 4;
+ vbDesc.Usage = D3D11_USAGE_DYNAMIC;
+ vbDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
+ vbDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ vbDesc.MiscFlags = 0;
+ vbDesc.StructureByteStride = 0;
+
+ result = device->CreateBuffer(&vbDesc, NULL, &mVertexBuffer);
+ ASSERT(SUCCEEDED(result));
+ d3d11::SetDebugName(mVertexBuffer, "Clear11 masked clear vertex buffer");
+
+ D3D11_RASTERIZER_DESC rsDesc;
+ rsDesc.FillMode = D3D11_FILL_SOLID;
+ rsDesc.CullMode = D3D11_CULL_NONE;
+ rsDesc.FrontCounterClockwise = FALSE;
+ rsDesc.DepthBias = 0;
+ rsDesc.DepthBiasClamp = 0.0f;
+ rsDesc.SlopeScaledDepthBias = 0.0f;
+ rsDesc.DepthClipEnable = FALSE;
+ rsDesc.ScissorEnable = FALSE;
+ rsDesc.MultisampleEnable = FALSE;
+ rsDesc.AntialiasedLineEnable = FALSE;
+
+ result = device->CreateRasterizerState(&rsDesc, &mRasterizerState);
+ ASSERT(SUCCEEDED(result));
+ d3d11::SetDebugName(mRasterizerState, "Clear11 masked clear rasterizer state");
+
+ mFloatClearShader = CreateClearShader(device, DXGI_FORMAT_R32G32B32A32_FLOAT, g_VS_ClearFloat, g_PS_ClearFloat);
+ mUintClearShader = CreateClearShader(device, DXGI_FORMAT_R32G32B32A32_UINT, g_VS_ClearUint, g_PS_ClearUint );
+ mIntClearShader = CreateClearShader(device, DXGI_FORMAT_R32G32B32A32_SINT, g_VS_ClearSint, g_PS_ClearSint );
+}
+
+Clear11::~Clear11()
+{
+ for (ClearBlendStateMap::iterator i = mClearBlendStates.begin(); i != mClearBlendStates.end(); i++)
+ {
+ SafeRelease(i->second);
+ }
+ mClearBlendStates.clear();
+
+ SafeRelease(mFloatClearShader.inputLayout);
+ SafeRelease(mFloatClearShader.vertexShader);
+ SafeRelease(mFloatClearShader.pixelShader);
+
+ SafeRelease(mUintClearShader.inputLayout);
+ SafeRelease(mUintClearShader.vertexShader);
+ SafeRelease(mUintClearShader.pixelShader);
+
+ SafeRelease(mIntClearShader.inputLayout);
+ SafeRelease(mIntClearShader.vertexShader);
+ SafeRelease(mIntClearShader.pixelShader);
+
+ for (ClearDepthStencilStateMap::iterator i = mClearDepthStencilStates.begin(); i != mClearDepthStencilStates.end(); i++)
+ {
+ SafeRelease(i->second);
+ }
+ mClearDepthStencilStates.clear();
+
+ SafeRelease(mVertexBuffer);
+ SafeRelease(mRasterizerState);
+}
+
+void Clear11::clearFramebuffer(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer)
+{
+ // First determine if a scissored clear is needed, this will always require drawing a quad.
+ //
+ // Otherwise, iterate over the color buffers which require clearing and determine if they can be
+ // cleared with ID3D11DeviceContext::ClearRenderTargetView... This requires:
+ // 1) The render target is being cleared to a float value (will be cast to integer when clearing integer
+ // render targets as expected but does not work the other way around)
+ // 2) The format of the render target has no color channels that are currently masked out.
+ // Clear the easy-to-clear buffers on the spot and accumulate the ones that require special work.
+ //
+ // Also determine if the depth stencil can be cleared with ID3D11DeviceContext::ClearDepthStencilView
+ // by checking if the stencil write mask covers the entire stencil.
+ //
+ // To clear the remaining buffers, quads must be drawn containing an int, uint or float vertex color
+ // attribute.
+
+ gl::Extents framebufferSize;
+ if (frameBuffer->getFirstColorbuffer() != NULL)
+ {
+ gl::FramebufferAttachment *attachment = frameBuffer->getFirstColorbuffer();
+ framebufferSize.width = attachment->getWidth();
+ framebufferSize.height = attachment->getHeight();
+ framebufferSize.depth = 1;
+ }
+ else if (frameBuffer->getDepthOrStencilbuffer() != NULL)
+ {
+ gl::FramebufferAttachment *attachment = frameBuffer->getDepthOrStencilbuffer();
+ framebufferSize.width = attachment->getWidth();
+ framebufferSize.height = attachment->getHeight();
+ framebufferSize.depth = 1;
+ }
+ else
+ {
+ UNREACHABLE();
+ return;
+ }
+
+ if (clearParams.scissorEnabled && (clearParams.scissor.x >= framebufferSize.width ||
+ clearParams.scissor.y >= framebufferSize.height ||
+ clearParams.scissor.x + clearParams.scissor.width <= 0 ||
+ clearParams.scissor.y + clearParams.scissor.height <= 0))
+ {
+ // Scissor is enabled and the scissor rectangle is outside the renderbuffer
+ return;
+ }
+
+ bool needScissoredClear = clearParams.scissorEnabled && (clearParams.scissor.x > 0 || clearParams.scissor.y > 0 ||
+ clearParams.scissor.x + clearParams.scissor.width < framebufferSize.width ||
+ clearParams.scissor.y + clearParams.scissor.height < framebufferSize.height);
+
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+
+ std::vector<RenderTarget11*> maskedClearRenderTargets;
+ RenderTarget11* maskedClearDepthStencil = NULL;
+
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+
+ for (unsigned int colorAttachment = 0; colorAttachment < gl::IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
+ {
+ if (clearParams.clearColor[colorAttachment] && frameBuffer->isEnabledColorAttachment(colorAttachment))
+ {
+ gl::FramebufferAttachment *attachment = frameBuffer->getColorbuffer(colorAttachment);
+ if (attachment)
+ {
+ RenderTarget11 *renderTarget = RenderTarget11::makeRenderTarget11(attachment->getRenderTarget());
+ if (!renderTarget)
+ {
+ ERR("Render target pointer unexpectedly null.");
+ return;
+ }
+
+ GLenum internalFormat = attachment->getInternalFormat();
+ GLenum actualFormat = attachment->getActualFormat();
+ GLenum componentType = gl::GetComponentType(internalFormat, clientVersion);
+ if (clearParams.colorClearType == GL_FLOAT &&
+ !(componentType == GL_FLOAT || componentType == GL_UNSIGNED_NORMALIZED || componentType == GL_SIGNED_NORMALIZED))
+ {
+ ERR("It is undefined behaviour to clear a render buffer which is not normalized fixed point or floating-"
+ "point to floating point values (color attachment %u has internal format 0x%X).", colorAttachment, internalFormat);
+ }
+
+ GLuint internalRedBits = gl::GetRedBits(internalFormat, clientVersion);
+ GLuint internalGreenBits = gl::GetGreenBits(internalFormat, clientVersion);
+ GLuint internalBlueBits = gl::GetBlueBits(internalFormat, clientVersion);
+ GLuint internalAlphaBits = gl::GetAlphaBits(internalFormat, clientVersion);
+
+ if ((internalRedBits == 0 || !clearParams.colorMaskRed) &&
+ (internalGreenBits == 0 || !clearParams.colorMaskGreen) &&
+ (internalBlueBits == 0 || !clearParams.colorMaskBlue) &&
+ (internalAlphaBits == 0 || !clearParams.colorMaskAlpha))
+ {
+ // Every channel either does not exist in the render target or is masked out
+ continue;
+ }
+ else if (needScissoredClear || clearParams.colorClearType != GL_FLOAT ||
+ (internalRedBits > 0 && !clearParams.colorMaskRed) ||
+ (internalGreenBits > 0 && !clearParams.colorMaskGreen) ||
+ (internalBlueBits > 0 && !clearParams.colorMaskBlue) ||
+ (internalAlphaBits > 0 && !clearParams.colorMaskAlpha))
+ {
+ // A scissored or masked clear is required
+ maskedClearRenderTargets.push_back(renderTarget);
+ }
+ else
+ {
+ // ID3D11DeviceContext::ClearRenderTargetView is possible
+
+ ID3D11RenderTargetView *framebufferRTV = renderTarget->getRenderTargetView();
+ if (!framebufferRTV)
+ {
+ ERR("Render target view pointer unexpectedly null.");
+ return;
+ }
+
+ // Check if the actual format has a channel that the internal format does not and set them to the
+ // default values
+ GLuint actualRedBits = gl::GetRedBits(actualFormat, clientVersion);
+ GLuint actualGreenBits = gl::GetGreenBits(actualFormat, clientVersion);
+ GLuint actualBlueBits = gl::GetBlueBits(actualFormat, clientVersion);
+ GLuint actualAlphaBits = gl::GetAlphaBits(actualFormat, clientVersion);
+
+ const float clearValues[4] =
+ {
+ ((internalRedBits == 0 && actualRedBits > 0) ? 0.0f : clearParams.colorFClearValue.red),
+ ((internalGreenBits == 0 && actualGreenBits > 0) ? 0.0f : clearParams.colorFClearValue.green),
+ ((internalBlueBits == 0 && actualBlueBits > 0) ? 0.0f : clearParams.colorFClearValue.blue),
+ ((internalAlphaBits == 0 && actualAlphaBits > 0) ? 1.0f : clearParams.colorFClearValue.alpha),
+ };
+
+ deviceContext->ClearRenderTargetView(framebufferRTV, clearValues);
+ }
+ }
+ }
+ }
+
+ if (clearParams.clearDepth || clearParams.clearStencil)
+ {
+ gl::FramebufferAttachment *attachment = frameBuffer->getDepthOrStencilbuffer();
+ if (attachment)
+ {
+ RenderTarget11 *renderTarget = RenderTarget11::makeRenderTarget11(attachment->getDepthStencil());
+ if (!renderTarget)
+ {
+ ERR("Depth stencil render target pointer unexpectedly null.");
+ return;
+ }
+
+ GLenum actualFormat = attachment->getActualFormat();
+
+ unsigned int stencilUnmasked = frameBuffer->hasStencil() ? (1 << gl::GetStencilBits(actualFormat, clientVersion)) - 1 : 0;
+ bool needMaskedStencilClear = clearParams.clearStencil && (clearParams.stencilWriteMask & stencilUnmasked) != stencilUnmasked;
+
+ if (needScissoredClear || needMaskedStencilClear)
+ {
+ maskedClearDepthStencil = renderTarget;
+ }
+ else
+ {
+ ID3D11DepthStencilView *framebufferDSV = renderTarget->getDepthStencilView();
+ if (!framebufferDSV)
+ {
+ ERR("Depth stencil view pointer unexpectedly null.");
+ return;
+ }
+
+ UINT clearFlags = (clearParams.clearDepth ? D3D11_CLEAR_DEPTH : 0) |
+ (clearParams.clearStencil ? D3D11_CLEAR_STENCIL : 0);
+ FLOAT depthClear = gl::clamp01(clearParams.depthClearValue);
+ UINT8 stencilClear = clearParams.stencilClearValue & 0xFF;
+
+ deviceContext->ClearDepthStencilView(framebufferDSV, clearFlags, depthClear, stencilClear);
+ }
+ }
+ }
+
+ if (maskedClearRenderTargets.size() > 0 || maskedClearDepthStencil)
+ {
+ // To clear the render targets and depth stencil in one pass:
+ //
+ // Render a quad clipped to the scissor rectangle which draws the clear color and a blend
+ // state that will perform the required color masking.
+ //
+ // The quad's depth is equal to the depth clear value with a depth stencil state that
+ // will enable or disable depth test/writes if the depth buffer should be cleared or not.
+ //
+ // The rasterizer state's stencil is set to always pass or fail based on if the stencil
+ // should be cleared or not with a stencil write mask of the stencil clear value.
+ //
+ // ======================================================================================
+ //
+ // Luckily, the gl spec (ES 3.0.2 pg 183) states that the results of clearing a render-
+ // buffer that is not normalized fixed point or floating point with floating point values
+ // are undefined so we can just write floats to them and D3D11 will bit cast them to
+ // integers.
+ //
+ // Also, we don't have to worry about attempting to clear a normalized fixed/floating point
+ // buffer with integer values because there is no gl API call which would allow it,
+ // glClearBuffer* calls only clear a single renderbuffer at a time which is verified to
+ // be a compatible clear type.
+
+ // Bind all the render targets which need clearing
+ ASSERT(maskedClearRenderTargets.size() <= mRenderer->getMaxRenderTargets());
+ std::vector<ID3D11RenderTargetView*> rtvs(maskedClearRenderTargets.size());
+ for (unsigned int i = 0; i < maskedClearRenderTargets.size(); i++)
+ {
+ ID3D11RenderTargetView *renderTarget = maskedClearRenderTargets[i]->getRenderTargetView();
+ if (!renderTarget)
+ {
+ ERR("Render target pointer unexpectedly null.");
+ return;
+ }
+
+ rtvs[i] = renderTarget;
+ }
+ ID3D11DepthStencilView *dsv = maskedClearDepthStencil ? maskedClearDepthStencil->getDepthStencilView() : NULL;
+
+ ID3D11BlendState *blendState = getBlendState(clearParams, maskedClearRenderTargets);
+ const FLOAT blendFactors[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
+ const UINT sampleMask = 0xFFFFFFFF;
+
+ ID3D11DepthStencilState *dsState = getDepthStencilState(clearParams);
+ const UINT stencilClear = clearParams.stencilClearValue & 0xFF;
+
+ // Set the vertices
+ UINT vertexStride = 0;
+ const UINT startIdx = 0;
+ const ClearShader* shader = NULL;
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
+ HRESULT result = deviceContext->Map(mVertexBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
+ if (FAILED(result))
+ {
+ ERR("Failed to map masked clear vertex buffer, HRESULT: 0x%X.", result);
+ return;
+ }
+
+ const gl::Rectangle *scissorPtr = clearParams.scissorEnabled ? &clearParams.scissor : NULL;
+ switch (clearParams.colorClearType)
+ {
+ case GL_FLOAT:
+ ApplyVertices(framebufferSize, scissorPtr, clearParams.colorFClearValue, clearParams.depthClearValue, mappedResource.pData);
+ vertexStride = sizeof(d3d11::PositionDepthColorVertex<float>);
+ shader = &mFloatClearShader;
+ break;
+
+ case GL_UNSIGNED_INT:
+ ApplyVertices(framebufferSize, scissorPtr, clearParams.colorUIClearValue, clearParams.depthClearValue, mappedResource.pData);
+ vertexStride = sizeof(d3d11::PositionDepthColorVertex<unsigned int>);
+ shader = &mUintClearShader;
+ break;
+
+ case GL_INT:
+ ApplyVertices(framebufferSize, scissorPtr, clearParams.colorIClearValue, clearParams.depthClearValue, mappedResource.pData);
+ vertexStride = sizeof(d3d11::PositionDepthColorVertex<int>);
+ shader = &mIntClearShader;
+ break;
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ deviceContext->Unmap(mVertexBuffer, 0);
+
+ // Set the viewport to be the same size as the framebuffer
+ D3D11_VIEWPORT viewport;
+ viewport.TopLeftX = 0;
+ viewport.TopLeftY = 0;
+ viewport.Width = framebufferSize.width;
+ viewport.Height = framebufferSize.height;
+ viewport.MinDepth = 0;
+ viewport.MaxDepth = 1;
+ deviceContext->RSSetViewports(1, &viewport);
+
+ // Apply state
+ deviceContext->OMSetBlendState(blendState, blendFactors, sampleMask);
+ deviceContext->OMSetDepthStencilState(dsState, stencilClear);
+ deviceContext->RSSetState(mRasterizerState);
+
+ // Apply shaders
+ deviceContext->IASetInputLayout(shader->inputLayout);
+ deviceContext->VSSetShader(shader->vertexShader, NULL, 0);
+ deviceContext->PSSetShader(shader->pixelShader, NULL, 0);
+ deviceContext->GSSetShader(NULL, NULL, 0);
+
+ // Apply vertex buffer
+ deviceContext->IASetVertexBuffers(0, 1, &mVertexBuffer, &vertexStride, &startIdx);
+ deviceContext->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
+
+ // Apply render targets
+ deviceContext->OMSetRenderTargets(rtvs.size(), (rtvs.empty() ? NULL : &rtvs[0]), dsv);
+
+ // Draw the clear quad
+ deviceContext->Draw(4, 0);
+
+ // Clean up
+ mRenderer->markAllStateDirty();
+ }
+}
+
+ID3D11BlendState *Clear11::getBlendState(const gl::ClearParameters &clearParams, const std::vector<RenderTarget11*>& rts)
+{
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+
+ ClearBlendInfo blendKey = { 0 };
+ for (unsigned int i = 0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
+ {
+ if (i < rts.size())
+ {
+ GLint internalFormat = rts[i]->getInternalFormat();
+
+ blendKey.maskChannels[i][0] = clearParams.clearColor ? (clearParams.colorMaskRed && gl::GetRedBits(internalFormat, clientVersion) > 0) : false;
+ blendKey.maskChannels[i][1] = clearParams.clearColor ? (clearParams.colorMaskGreen && gl::GetGreenBits(internalFormat, clientVersion) > 0) : false;
+ blendKey.maskChannels[i][2] = clearParams.clearColor ? (clearParams.colorMaskBlue && gl::GetBlueBits(internalFormat, clientVersion) > 0) : false;
+ blendKey.maskChannels[i][3] = clearParams.clearColor ? (clearParams.colorMaskAlpha && gl::GetAlphaBits(internalFormat, clientVersion) > 0) : false;
+ }
+ else
+ {
+ blendKey.maskChannels[i][0] = false;
+ blendKey.maskChannels[i][1] = false;
+ blendKey.maskChannels[i][2] = false;
+ blendKey.maskChannels[i][3] = false;
+ }
+ }
+
+ ClearBlendStateMap::const_iterator i = mClearBlendStates.find(blendKey);
+ if (i != mClearBlendStates.end())
+ {
+ return i->second;
+ }
+ else
+ {
+ D3D11_BLEND_DESC blendDesc = { 0 };
+ blendDesc.AlphaToCoverageEnable = FALSE;
+ blendDesc.IndependentBlendEnable = (rts.size() > 1) ? TRUE : FALSE;
+
+ for (unsigned int i = 0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
+ {
+ blendDesc.RenderTarget[i].BlendEnable = FALSE;
+ blendDesc.RenderTarget[i].RenderTargetWriteMask = gl_d3d11::ConvertColorMask(blendKey.maskChannels[i][0],
+ blendKey.maskChannels[i][1],
+ blendKey.maskChannels[i][2],
+ blendKey.maskChannels[i][3]);
+ }
+
+ ID3D11Device *device = mRenderer->getDevice();
+ ID3D11BlendState* blendState = NULL;
+ HRESULT result = device->CreateBlendState(&blendDesc, &blendState);
+ if (FAILED(result) || !blendState)
+ {
+ ERR("Unable to create a ID3D11BlendState, HRESULT: 0x%X.", result);
+ return NULL;
+ }
+
+ mClearBlendStates[blendKey] = blendState;
+
+ return blendState;
+ }
+}
+
+ID3D11DepthStencilState *Clear11::getDepthStencilState(const gl::ClearParameters &clearParams)
+{
+ ClearDepthStencilInfo dsKey = { 0 };
+ dsKey.clearDepth = clearParams.clearDepth;
+ dsKey.clearStencil = clearParams.clearStencil;
+ dsKey.stencilWriteMask = clearParams.stencilWriteMask & 0xFF;
+
+ ClearDepthStencilStateMap::const_iterator i = mClearDepthStencilStates.find(dsKey);
+ if (i != mClearDepthStencilStates.end())
+ {
+ return i->second;
+ }
+ else
+ {
+ D3D11_DEPTH_STENCIL_DESC dsDesc = { 0 };
+ dsDesc.DepthEnable = dsKey.clearDepth ? TRUE : FALSE;
+ dsDesc.DepthWriteMask = dsKey.clearDepth ? D3D11_DEPTH_WRITE_MASK_ALL : D3D11_DEPTH_WRITE_MASK_ZERO;
+ dsDesc.DepthFunc = D3D11_COMPARISON_ALWAYS;
+ dsDesc.StencilEnable = dsKey.clearStencil ? TRUE : FALSE;
+ dsDesc.StencilReadMask = 0;
+ dsDesc.StencilWriteMask = dsKey.stencilWriteMask;
+ dsDesc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_REPLACE;
+ dsDesc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_REPLACE;
+ dsDesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_REPLACE;
+ dsDesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
+ dsDesc.BackFace.StencilFailOp = D3D11_STENCIL_OP_REPLACE;
+ dsDesc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_REPLACE;
+ dsDesc.BackFace.StencilPassOp = D3D11_STENCIL_OP_REPLACE;
+ dsDesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
+
+ ID3D11Device *device = mRenderer->getDevice();
+ ID3D11DepthStencilState* dsState = NULL;
+ HRESULT result = device->CreateDepthStencilState(&dsDesc, &dsState);
+ if (FAILED(result) || !dsState)
+ {
+ ERR("Unable to create a ID3D11DepthStencilState, HRESULT: 0x%X.", result);
+ return NULL;
+ }
+
+ mClearDepthStencilStates[dsKey] = dsState;
+
+ return dsState;
+ }
+}
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Clear11.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Clear11.h
new file mode 100644
index 00000000000..e8e4c9ea2f1
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Clear11.h
@@ -0,0 +1,77 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Clear11.h: Framebuffer clear utility class.
+
+#ifndef LIBGLESV2_RENDERER_CLEAR11_H_
+#define LIBGLESV2_RENDERER_CLEAR11_H_
+
+#include "libGLESv2/angletypes.h"
+
+namespace gl
+{
+class Framebuffer;
+}
+
+namespace rx
+{
+class Renderer11;
+class RenderTarget11;
+
+class Clear11
+{
+ public:
+ explicit Clear11(Renderer11 *renderer);
+ ~Clear11();
+
+ // Clears the framebuffer with the supplied clear parameters, assumes that the framebuffer is currently applied.
+ void clearFramebuffer(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer);
+
+ private:
+ Renderer11 *mRenderer;
+
+ struct ClearBlendInfo
+ {
+ bool maskChannels[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT][4];
+ };
+ typedef bool (*ClearBlendInfoComparisonFunction)(const ClearBlendInfo&, const ClearBlendInfo &);
+ typedef std::map<ClearBlendInfo, ID3D11BlendState*, ClearBlendInfoComparisonFunction> ClearBlendStateMap;
+ ClearBlendStateMap mClearBlendStates;
+
+ ID3D11BlendState *getBlendState(const gl::ClearParameters &clearParams, const std::vector<RenderTarget11*>& rts);
+
+ struct ClearShader
+ {
+ ID3D11InputLayout *inputLayout;
+ ID3D11VertexShader *vertexShader;
+ ID3D11PixelShader *pixelShader;
+ };
+ ClearShader mFloatClearShader;
+ ClearShader mUintClearShader;
+ ClearShader mIntClearShader;
+
+ template <unsigned int vsSize, unsigned int psSize>
+ static ClearShader CreateClearShader(ID3D11Device *device, DXGI_FORMAT colorType, const BYTE (&vsByteCode)[vsSize], const BYTE (&psByteCode)[psSize]);
+
+ struct ClearDepthStencilInfo
+ {
+ bool clearDepth;
+ bool clearStencil;
+ UINT8 stencilWriteMask;
+ };
+ typedef bool (*ClearDepthStencilInfoComparisonFunction)(const ClearDepthStencilInfo&, const ClearDepthStencilInfo &);
+ typedef std::map<ClearDepthStencilInfo, ID3D11DepthStencilState*, ClearDepthStencilInfoComparisonFunction> ClearDepthStencilStateMap;
+ ClearDepthStencilStateMap mClearDepthStencilStates;
+
+ ID3D11DepthStencilState *getDepthStencilState(const gl::ClearParameters &clearParams);
+
+ ID3D11Buffer *mVertexBuffer;
+ ID3D11RasterizerState *mRasterizerState;
+};
+
+}
+
+#endif // LIBGLESV2_RENDERER_CLEAR11_H_
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Fence11.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Fence11.cpp
new file mode 100644
index 00000000000..f2a75438fba
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Fence11.cpp
@@ -0,0 +1,71 @@
+#include "precompiled.h"
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Fence11.cpp: Defines the rx::Fence11 class which implements rx::FenceImpl.
+
+#include "libGLESv2/renderer/d3d11/Fence11.h"
+#include "libGLESv2/main.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
+
+namespace rx
+{
+
+Fence11::Fence11(rx::Renderer11 *renderer)
+{
+ mRenderer = renderer;
+ mQuery = NULL;
+}
+
+Fence11::~Fence11()
+{
+ SafeRelease(mQuery);
+}
+
+bool Fence11::isSet() const
+{
+ return mQuery != NULL;
+}
+
+void Fence11::set()
+{
+ if (!mQuery)
+ {
+ D3D11_QUERY_DESC queryDesc;
+ queryDesc.Query = D3D11_QUERY_EVENT;
+ queryDesc.MiscFlags = 0;
+
+ if (FAILED(mRenderer->getDevice()->CreateQuery(&queryDesc, &mQuery)))
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+ }
+
+ mRenderer->getDeviceContext()->End(mQuery);
+}
+
+bool Fence11::test(bool flushCommandBuffer)
+{
+ ASSERT(mQuery);
+
+ UINT getDataFlags = (flushCommandBuffer ? 0 : D3D11_ASYNC_GETDATA_DONOTFLUSH);
+ HRESULT result = mRenderer->getDeviceContext()->GetData(mQuery, NULL, 0, getDataFlags);
+
+ if (mRenderer->isDeviceLost())
+ {
+ return gl::error(GL_OUT_OF_MEMORY, true);
+ }
+
+ ASSERT(result == S_OK || result == S_FALSE);
+ return (result == S_OK);
+}
+
+bool Fence11::hasError() const
+{
+ return mRenderer->isDeviceLost();
+}
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/Fence11.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Fence11.h
index a5398bca149..50c76217764 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/Fence11.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Fence11.h
@@ -21,11 +21,10 @@ class Fence11 : public FenceImpl
explicit Fence11(rx::Renderer11 *renderer);
virtual ~Fence11();
- GLboolean isFence();
- void setFence(GLenum condition);
- GLboolean testFence();
- void finishFence();
- void getFenceiv(GLenum pname, GLint *params);
+ bool isSet() const;
+ void set();
+ bool test(bool flushCommandBuffer);
+ bool hasError() const;
private:
DISALLOW_COPY_AND_ASSIGN(Fence11);
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Image11.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Image11.cpp
new file mode 100644
index 00000000000..aa9260d678a
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Image11.cpp
@@ -0,0 +1,461 @@
+#include "precompiled.h"
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Image11.h: Implements the rx::Image11 class, which acts as the interface to
+// the actual underlying resources of a Texture
+
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
+#include "libGLESv2/renderer/d3d11/Image11.h"
+#include "libGLESv2/renderer/d3d11/TextureStorage11.h"
+#include "libGLESv2/Framebuffer.h"
+#include "libGLESv2/Renderbuffer.h"
+
+#include "libGLESv2/main.h"
+#include "common/utilities.h"
+#include "libGLESv2/renderer/d3d11/formatutils11.h"
+#include "libGLESv2/renderer/d3d11/renderer11_utils.h"
+
+namespace rx
+{
+
+Image11::Image11()
+{
+ mStagingTexture = NULL;
+ mRenderer = NULL;
+ mDXGIFormat = DXGI_FORMAT_UNKNOWN;
+}
+
+Image11::~Image11()
+{
+ SafeRelease(mStagingTexture);
+}
+
+Image11 *Image11::makeImage11(Image *img)
+{
+ ASSERT(HAS_DYNAMIC_TYPE(rx::Image11*, img));
+ return static_cast<rx::Image11*>(img);
+}
+
+void Image11::generateMipmap(GLuint clientVersion, Image11 *dest, Image11 *src)
+{
+ ASSERT(src->getDXGIFormat() == dest->getDXGIFormat());
+ ASSERT(src->getWidth() == 1 || src->getWidth() / 2 == dest->getWidth());
+ ASSERT(src->getHeight() == 1 || src->getHeight() / 2 == dest->getHeight());
+
+ MipGenerationFunction mipFunction = d3d11::GetMipGenerationFunction(src->getDXGIFormat());
+ ASSERT(mipFunction != NULL);
+
+ D3D11_MAPPED_SUBRESOURCE destMapped;
+ HRESULT destMapResult = dest->map(D3D11_MAP_WRITE, &destMapped);
+ if (FAILED(destMapResult))
+ {
+ ERR("Failed to map destination image for mip map generation. HRESULT:0x%X", destMapResult);
+ return;
+ }
+
+ D3D11_MAPPED_SUBRESOURCE srcMapped;
+ HRESULT srcMapResult = src->map(D3D11_MAP_READ, &srcMapped);
+ if (FAILED(srcMapResult))
+ {
+ ERR("Failed to map source image for mip map generation. HRESULT:0x%X", srcMapResult);
+
+ dest->unmap();
+ return;
+ }
+
+ const unsigned char *sourceData = reinterpret_cast<const unsigned char*>(srcMapped.pData);
+ unsigned char *destData = reinterpret_cast<unsigned char*>(destMapped.pData);
+
+ mipFunction(src->getWidth(), src->getHeight(), src->getDepth(), sourceData, srcMapped.RowPitch, srcMapped.DepthPitch,
+ destData, destMapped.RowPitch, destMapped.DepthPitch);
+
+ dest->unmap();
+ src->unmap();
+
+ dest->markDirty();
+}
+
+bool Image11::isDirty() const
+{
+ // Make sure that this image is marked as dirty even if the staging texture hasn't been created yet
+ // if initialization is required before use.
+ return (mDirty && (mStagingTexture || gl_d3d11::RequiresTextureDataInitialization(mInternalFormat)));
+}
+
+bool Image11::copyToStorage(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
+{
+ TextureStorage11_2D *storage11 = TextureStorage11_2D::makeTextureStorage11_2D(storage->getStorageInstance());
+ return storage11->updateSubresourceLevel(getStagingTexture(), getStagingSubresource(), level, 0, xoffset, yoffset, 0, width, height, 1);
+}
+
+bool Image11::copyToStorage(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
+{
+ TextureStorage11_Cube *storage11 = TextureStorage11_Cube::makeTextureStorage11_Cube(storage->getStorageInstance());
+ return storage11->updateSubresourceLevel(getStagingTexture(), getStagingSubresource(), level, face, xoffset, yoffset, 0, width, height, 1);
+}
+
+bool Image11::copyToStorage(TextureStorageInterface3D *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth)
+{
+ TextureStorage11_3D *storage11 = TextureStorage11_3D::makeTextureStorage11_3D(storage->getStorageInstance());
+ return storage11->updateSubresourceLevel(getStagingTexture(), getStagingSubresource(), level, 0, xoffset, yoffset, zoffset, width, height, depth);
+}
+
+bool Image11::copyToStorage(TextureStorageInterface2DArray *storage, int level, GLint xoffset, GLint yoffset, GLint arrayLayer, GLsizei width, GLsizei height)
+{
+ TextureStorage11_2DArray *storage11 = TextureStorage11_2DArray::makeTextureStorage11_2DArray(storage->getStorageInstance());
+ return storage11->updateSubresourceLevel(getStagingTexture(), getStagingSubresource(), level, arrayLayer, xoffset, yoffset, 0, width, height, 1);
+}
+
+bool Image11::redefine(Renderer *renderer, GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, bool forceRelease)
+{
+ if (mWidth != width ||
+ mHeight != height ||
+ mInternalFormat != internalformat ||
+ forceRelease)
+ {
+ mRenderer = Renderer11::makeRenderer11(renderer);
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+
+ mWidth = width;
+ mHeight = height;
+ mDepth = depth;
+ mInternalFormat = internalformat;
+ mTarget = target;
+
+ // compute the d3d format that will be used
+ mDXGIFormat = gl_d3d11::GetTexFormat(internalformat, clientVersion);
+ mActualFormat = d3d11_gl::GetInternalFormat(mDXGIFormat, clientVersion);
+ mRenderable = gl_d3d11::GetRTVFormat(internalformat, clientVersion) != DXGI_FORMAT_UNKNOWN;
+
+ SafeRelease(mStagingTexture);
+ mDirty = gl_d3d11::RequiresTextureDataInitialization(mInternalFormat);
+
+ return true;
+ }
+
+ return false;
+}
+
+DXGI_FORMAT Image11::getDXGIFormat() const
+{
+ // this should only happen if the image hasn't been redefined first
+ // which would be a bug by the caller
+ ASSERT(mDXGIFormat != DXGI_FORMAT_UNKNOWN);
+
+ return mDXGIFormat;
+}
+
+// Store the pixel rectangle designated by xoffset,yoffset,width,height with pixels stored as format/type at input
+// into the target pixel rectangle.
+void Image11::loadData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
+ GLint unpackAlignment, GLenum type, const void *input)
+{
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+ GLsizei inputRowPitch = gl::GetRowPitch(mInternalFormat, type, clientVersion, width, unpackAlignment);
+ GLsizei inputDepthPitch = gl::GetDepthPitch(mInternalFormat, type, clientVersion, width, height, unpackAlignment);
+ GLuint outputPixelSize = d3d11::GetFormatPixelBytes(mDXGIFormat);
+
+ LoadImageFunction loadFunction = d3d11::GetImageLoadFunction(mInternalFormat, type, clientVersion);
+ ASSERT(loadFunction != NULL);
+
+ D3D11_MAPPED_SUBRESOURCE mappedImage;
+ HRESULT result = map(D3D11_MAP_WRITE, &mappedImage);
+ if (FAILED(result))
+ {
+ ERR("Could not map image for loading.");
+ return;
+ }
+
+ void* offsetMappedData = (void*)((BYTE *)mappedImage.pData + (yoffset * mappedImage.RowPitch + xoffset * outputPixelSize + zoffset * mappedImage.DepthPitch));
+ loadFunction(width, height, depth, input, inputRowPitch, inputDepthPitch, offsetMappedData, mappedImage.RowPitch, mappedImage.DepthPitch);
+
+ unmap();
+}
+
+void Image11::loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
+ const void *input)
+{
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+ GLsizei inputRowPitch = gl::GetRowPitch(mInternalFormat, GL_UNSIGNED_BYTE, clientVersion, width, 1);
+ GLsizei inputDepthPitch = gl::GetDepthPitch(mInternalFormat, GL_UNSIGNED_BYTE, clientVersion, width, height, 1);
+
+ GLuint outputPixelSize = d3d11::GetFormatPixelBytes(mDXGIFormat);
+ GLuint outputBlockWidth = d3d11::GetBlockWidth(mDXGIFormat);
+ GLuint outputBlockHeight = d3d11::GetBlockHeight(mDXGIFormat);
+
+ ASSERT(xoffset % outputBlockWidth == 0);
+ ASSERT(yoffset % outputBlockHeight == 0);
+
+ LoadImageFunction loadFunction = d3d11::GetImageLoadFunction(mInternalFormat, GL_UNSIGNED_BYTE, clientVersion);
+ ASSERT(loadFunction != NULL);
+
+ D3D11_MAPPED_SUBRESOURCE mappedImage;
+ HRESULT result = map(D3D11_MAP_WRITE, &mappedImage);
+ if (FAILED(result))
+ {
+ ERR("Could not map image for loading.");
+ return;
+ }
+
+ void* offsetMappedData = (void*)((BYTE*)mappedImage.pData + ((yoffset / outputBlockHeight) * mappedImage.RowPitch +
+ (xoffset / outputBlockWidth) * outputPixelSize +
+ zoffset * mappedImage.DepthPitch));
+
+ loadFunction(width, height, depth, input, inputRowPitch, inputDepthPitch,
+ offsetMappedData, mappedImage.RowPitch, mappedImage.DepthPitch);
+
+ unmap();
+}
+
+void Image11::copy(GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source)
+{
+ gl::FramebufferAttachment *colorbuffer = source->getReadColorbuffer();
+
+ if (colorbuffer && colorbuffer->getActualFormat() == mActualFormat)
+ {
+ // No conversion needed-- use copyback fastpath
+ ID3D11Texture2D *colorBufferTexture = NULL;
+ unsigned int subresourceIndex = 0;
+
+ if (mRenderer->getRenderTargetResource(colorbuffer, &subresourceIndex, &colorBufferTexture))
+ {
+ D3D11_TEXTURE2D_DESC textureDesc;
+ colorBufferTexture->GetDesc(&textureDesc);
+
+ ID3D11Device *device = mRenderer->getDevice();
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+
+ ID3D11Texture2D* srcTex = NULL;
+ if (textureDesc.SampleDesc.Count > 1)
+ {
+ D3D11_TEXTURE2D_DESC resolveDesc;
+ resolveDesc.Width = textureDesc.Width;
+ resolveDesc.Height = textureDesc.Height;
+ resolveDesc.MipLevels = 1;
+ resolveDesc.ArraySize = 1;
+ resolveDesc.Format = textureDesc.Format;
+ resolveDesc.SampleDesc.Count = 1;
+ resolveDesc.SampleDesc.Quality = 0;
+ resolveDesc.Usage = D3D11_USAGE_DEFAULT;
+ resolveDesc.BindFlags = 0;
+ resolveDesc.CPUAccessFlags = 0;
+ resolveDesc.MiscFlags = 0;
+
+ HRESULT result = device->CreateTexture2D(&resolveDesc, NULL, &srcTex);
+ if (FAILED(result))
+ {
+ ERR("Failed to create resolve texture for Image11::copy, HRESULT: 0x%X.", result);
+ return;
+ }
+
+ deviceContext->ResolveSubresource(srcTex, 0, colorBufferTexture, subresourceIndex, textureDesc.Format);
+ subresourceIndex = 0;
+ }
+ else
+ {
+ srcTex = colorBufferTexture;
+ srcTex->AddRef();
+ }
+
+ D3D11_BOX srcBox;
+ srcBox.left = x;
+ srcBox.right = x + width;
+ srcBox.top = y;
+ srcBox.bottom = y + height;
+ srcBox.front = 0;
+ srcBox.back = 1;
+
+ deviceContext->CopySubresourceRegion(mStagingTexture, 0, xoffset, yoffset, zoffset, srcTex, subresourceIndex, &srcBox);
+
+ SafeRelease(srcTex);
+ SafeRelease(colorBufferTexture);
+ }
+ }
+ else
+ {
+ // This format requires conversion, so we must copy the texture to staging and manually convert via readPixels
+ D3D11_MAPPED_SUBRESOURCE mappedImage;
+ HRESULT result = map(D3D11_MAP_WRITE, &mappedImage);
+ if (FAILED(result))
+ {
+ ERR("Failed to map texture for Image11::copy, HRESULT: 0x%X.", result);
+ return;
+ }
+
+ // determine the offset coordinate into the destination buffer
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+ GLsizei rowOffset = gl::GetPixelBytes(mActualFormat, clientVersion) * xoffset;
+ void *dataOffset = static_cast<unsigned char*>(mappedImage.pData) + mappedImage.RowPitch * yoffset + rowOffset + zoffset * mappedImage.DepthPitch;
+
+ GLenum format = gl::GetFormat(mInternalFormat, clientVersion);
+ GLenum type = gl::GetType(mInternalFormat, clientVersion);
+
+ mRenderer->readPixels(source, x, y, width, height, format, type, mappedImage.RowPitch, gl::PixelPackState(), dataOffset);
+
+ unmap();
+ }
+}
+
+ID3D11Resource *Image11::getStagingTexture()
+{
+ createStagingTexture();
+
+ return mStagingTexture;
+}
+
+unsigned int Image11::getStagingSubresource()
+{
+ createStagingTexture();
+
+ return mStagingSubresource;
+}
+
+void Image11::createStagingTexture()
+{
+ if (mStagingTexture)
+ {
+ return;
+ }
+
+ const DXGI_FORMAT dxgiFormat = getDXGIFormat();
+
+ if (mWidth > 0 && mHeight > 0 && mDepth > 0)
+ {
+ ID3D11Device *device = mRenderer->getDevice();
+ HRESULT result;
+
+ int lodOffset = 1;
+ GLsizei width = mWidth;
+ GLsizei height = mHeight;
+
+ // adjust size if needed for compressed textures
+ d3d11::MakeValidSize(false, dxgiFormat, &width, &height, &lodOffset);
+
+ if (mTarget == GL_TEXTURE_3D)
+ {
+ ID3D11Texture3D *newTexture = NULL;
+
+ D3D11_TEXTURE3D_DESC desc;
+ desc.Width = width;
+ desc.Height = height;
+ desc.Depth = mDepth;
+ desc.MipLevels = lodOffset + 1;
+ desc.Format = dxgiFormat;
+ desc.Usage = D3D11_USAGE_STAGING;
+ desc.BindFlags = 0;
+ desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
+ desc.MiscFlags = 0;
+
+ if (gl_d3d11::RequiresTextureDataInitialization(mInternalFormat))
+ {
+ std::vector<D3D11_SUBRESOURCE_DATA> initialData;
+ std::vector< std::vector<BYTE> > textureData;
+ d3d11::GenerateInitialTextureData(mInternalFormat, mRenderer->getCurrentClientVersion(), width, height,
+ mDepth, lodOffset + 1, &initialData, &textureData);
+
+ result = device->CreateTexture3D(&desc, initialData.data(), &newTexture);
+ }
+ else
+ {
+ result = device->CreateTexture3D(&desc, NULL, &newTexture);
+ }
+
+ if (FAILED(result))
+ {
+ ASSERT(result == E_OUTOFMEMORY);
+ ERR("Creating image failed.");
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+
+ mStagingTexture = newTexture;
+ mStagingSubresource = D3D11CalcSubresource(lodOffset, 0, lodOffset + 1);
+ }
+ else if (mTarget == GL_TEXTURE_2D || mTarget == GL_TEXTURE_2D_ARRAY || mTarget == GL_TEXTURE_CUBE_MAP)
+ {
+ ID3D11Texture2D *newTexture = NULL;
+
+ D3D11_TEXTURE2D_DESC desc;
+ desc.Width = width;
+ desc.Height = height;
+ desc.MipLevels = lodOffset + 1;
+ desc.ArraySize = 1;
+ desc.Format = dxgiFormat;
+ desc.SampleDesc.Count = 1;
+ desc.SampleDesc.Quality = 0;
+ desc.Usage = D3D11_USAGE_STAGING;
+ desc.BindFlags = 0;
+ desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
+ desc.MiscFlags = 0;
+
+ if (gl_d3d11::RequiresTextureDataInitialization(mInternalFormat))
+ {
+ std::vector<D3D11_SUBRESOURCE_DATA> initialData;
+ std::vector< std::vector<BYTE> > textureData;
+ d3d11::GenerateInitialTextureData(mInternalFormat, mRenderer->getCurrentClientVersion(), width, height,
+ 1, lodOffset + 1, &initialData, &textureData);
+
+ result = device->CreateTexture2D(&desc, initialData.data(), &newTexture);
+ }
+ else
+ {
+ result = device->CreateTexture2D(&desc, NULL, &newTexture);
+ }
+
+ if (FAILED(result))
+ {
+ ASSERT(result == E_OUTOFMEMORY);
+ ERR("Creating image failed.");
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+
+ mStagingTexture = newTexture;
+ mStagingSubresource = D3D11CalcSubresource(lodOffset, 0, lodOffset + 1);
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+ }
+
+ mDirty = false;
+}
+
+HRESULT Image11::map(D3D11_MAP mapType, D3D11_MAPPED_SUBRESOURCE *map)
+{
+ createStagingTexture();
+
+ HRESULT result = E_FAIL;
+
+ if (mStagingTexture)
+ {
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+ result = deviceContext->Map(mStagingTexture, mStagingSubresource, mapType, 0, map);
+
+ // this can fail if the device is removed (from TDR)
+ if (d3d11::isDeviceLostError(result))
+ {
+ mRenderer->notifyDeviceLost();
+ }
+ else if (SUCCEEDED(result))
+ {
+ mDirty = true;
+ }
+ }
+
+ return result;
+}
+
+void Image11::unmap()
+{
+ if (mStagingTexture)
+ {
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+ deviceContext->Unmap(mStagingTexture, mStagingSubresource);
+ }
+}
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/Image11.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Image11.h
index 11a6492dc86..300774cf231 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/Image11.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Image11.h
@@ -34,24 +34,25 @@ class Image11 : public Image
static Image11 *makeImage11(Image *img);
- static void generateMipmap(Image11 *dest, Image11 *src);
+ static void generateMipmap(GLuint clientVersion, Image11 *dest, Image11 *src);
virtual bool isDirty() const;
- virtual bool updateSurface(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
- virtual bool updateSurface(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
+ virtual bool copyToStorage(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
+ virtual bool copyToStorage(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
+ virtual bool copyToStorage(TextureStorageInterface3D *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);
+ virtual bool copyToStorage(TextureStorageInterface2DArray *storage, int level, GLint xoffset, GLint yoffset, GLint arrayLayer, GLsizei width, GLsizei height);
- virtual bool redefine(Renderer *renderer, GLint internalformat, GLsizei width, GLsizei height, bool forceRelease);
+ virtual bool redefine(Renderer *renderer, GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, bool forceRelease);
- virtual bool isRenderableFormat() const;
DXGI_FORMAT getDXGIFormat() const;
- virtual void loadData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
- GLint unpackAlignment, const void *input);
- virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ virtual void loadData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
+ GLint unpackAlignment, GLenum type, const void *input);
+ virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
const void *input);
- virtual void copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source);
+ virtual void copy(GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source);
protected:
HRESULT map(D3D11_MAP mapType, D3D11_MAPPED_SUBRESOURCE *map);
@@ -60,14 +61,14 @@ class Image11 : public Image
private:
DISALLOW_COPY_AND_ASSIGN(Image11);
- ID3D11Texture2D *getStagingTexture();
+ ID3D11Resource *getStagingTexture();
unsigned int getStagingSubresource();
void createStagingTexture();
Renderer11 *mRenderer;
DXGI_FORMAT mDXGIFormat;
- ID3D11Texture2D *mStagingTexture;
+ ID3D11Resource *mStagingTexture;
unsigned int mStagingSubresource;
};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/IndexBuffer11.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/IndexBuffer11.cpp
index 66604c45582..afceac7012b 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/IndexBuffer11.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/IndexBuffer11.cpp
@@ -7,8 +7,8 @@
// IndexBuffer11.cpp: Defines the D3D11 IndexBuffer implementation.
-#include "libGLESv2/renderer/IndexBuffer11.h"
-#include "libGLESv2/renderer/Renderer11.h"
+#include "libGLESv2/renderer/d3d11/IndexBuffer11.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
namespace rx
{
@@ -22,20 +22,12 @@ IndexBuffer11::IndexBuffer11(Renderer11 *const renderer) : mRenderer(renderer)
IndexBuffer11::~IndexBuffer11()
{
- if (mBuffer)
- {
- mBuffer->Release();
- mBuffer = NULL;
- }
+ SafeRelease(mBuffer);
}
bool IndexBuffer11::initialize(unsigned int bufferSize, GLenum indexType, bool dynamic)
{
- if (mBuffer)
- {
- mBuffer->Release();
- mBuffer = NULL;
- }
+ SafeRelease(mBuffer);
updateSerial();
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/IndexBuffer11.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/IndexBuffer11.h
index 39a61946ad6..39a61946ad6 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/IndexBuffer11.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/IndexBuffer11.h
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/InputLayoutCache.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/InputLayoutCache.cpp
index 1552f3a326e..7092dc5ddd4 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/InputLayoutCache.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/InputLayoutCache.cpp
@@ -8,19 +8,35 @@
// InputLayoutCache.cpp: Defines InputLayoutCache, a class that builds and caches
// D3D11 input layouts.
-#include "libGLESv2/renderer/InputLayoutCache.h"
-#include "libGLESv2/renderer/VertexBuffer11.h"
-#include "libGLESv2/renderer/BufferStorage11.h"
-#include "libGLESv2/renderer/ShaderExecutable11.h"
+#include "libGLESv2/renderer/d3d11/InputLayoutCache.h"
+#include "libGLESv2/renderer/d3d11/VertexBuffer11.h"
+#include "libGLESv2/renderer/d3d11/BufferStorage11.h"
+#include "libGLESv2/renderer/d3d11/ShaderExecutable11.h"
#include "libGLESv2/ProgramBinary.h"
-#include "libGLESv2/Context.h"
+#include "libGLESv2/VertexAttribute.h"
#include "libGLESv2/renderer/VertexDataManager.h"
+#include "libGLESv2/renderer/d3d11/formatutils11.h"
#include "third_party/murmurhash/MurmurHash3.h"
namespace rx
{
+static void GetInputLayout(const TranslatedAttribute translatedAttributes[gl::MAX_VERTEX_ATTRIBS],
+ gl::VertexFormat inputLayout[gl::MAX_VERTEX_ATTRIBS])
+{
+ for (unsigned int attributeIndex = 0; attributeIndex < gl::MAX_VERTEX_ATTRIBS; attributeIndex++)
+ {
+ const TranslatedAttribute &translatedAttribute = translatedAttributes[attributeIndex];
+
+ if (translatedAttributes[attributeIndex].active)
+ {
+ inputLayout[attributeIndex] = gl::VertexFormat(*translatedAttribute.attribute,
+ translatedAttribute.currentValueType);
+ }
+ }
+}
+
const unsigned int InputLayoutCache::kMaxInputLayouts = 1024;
InputLayoutCache::InputLayoutCache() : mInputLayoutMap(kMaxInputLayouts, hashInputLayout, compareInputLayouts)
@@ -31,7 +47,7 @@ InputLayoutCache::InputLayoutCache() : mInputLayoutMap(kMaxInputLayouts, hashInp
mCurrentIL = NULL;
for (unsigned int i = 0; i < gl::MAX_VERTEX_ATTRIBS; i++)
{
- mCurrentBuffers[i] = -1;
+ mCurrentBuffers[i] = NULL;
mCurrentVertexStrides[i] = -1;
mCurrentVertexOffsets[i] = -1;
}
@@ -53,7 +69,7 @@ void InputLayoutCache::clear()
{
for (InputLayoutMap::iterator i = mInputLayoutMap.begin(); i != mInputLayoutMap.end(); i++)
{
- i->second.inputLayout->Release();
+ SafeRelease(i->second.inputLayout);
}
mInputLayoutMap.clear();
markDirty();
@@ -64,7 +80,7 @@ void InputLayoutCache::markDirty()
mCurrentIL = NULL;
for (unsigned int i = 0; i < gl::MAX_VERTEX_ATTRIBS; i++)
{
- mCurrentBuffers[i] = -1;
+ mCurrentBuffers[i] = NULL;
mCurrentVertexStrides[i] = -1;
mCurrentVertexOffsets[i] = -1;
}
@@ -84,22 +100,17 @@ GLenum InputLayoutCache::applyVertexBuffers(TranslatedAttribute attributes[gl::M
InputLayoutKey ilKey = { 0 };
- ID3D11Buffer *vertexBuffers[gl::MAX_VERTEX_ATTRIBS] = { NULL };
- unsigned int vertexBufferSerials[gl::MAX_VERTEX_ATTRIBS] = { 0 };
- UINT vertexStrides[gl::MAX_VERTEX_ATTRIBS] = { 0 };
- UINT vertexOffsets[gl::MAX_VERTEX_ATTRIBS] = { 0 };
-
static const char* semanticName = "TEXCOORD";
for (unsigned int i = 0; i < gl::MAX_VERTEX_ATTRIBS; i++)
{
if (attributes[i].active)
{
- VertexBuffer11 *vertexBuffer = VertexBuffer11::makeVertexBuffer11(attributes[i].vertexBuffer);
- BufferStorage11 *bufferStorage = attributes[i].storage ? BufferStorage11::makeBufferStorage11(attributes[i].storage) : NULL;
-
D3D11_INPUT_CLASSIFICATION inputClass = attributes[i].divisor > 0 ? D3D11_INPUT_PER_INSTANCE_DATA : D3D11_INPUT_PER_VERTEX_DATA;
+ gl::VertexFormat vertexFormat(*attributes[i].attribute, attributes[i].currentValueType);
+ DXGI_FORMAT dxgiFormat = gl_d3d11::GetNativeVertexFormat(vertexFormat);
+
// Record the type of the associated vertex shader vector in our key
// This will prevent mismatched vertex shaders from using the same input layout
GLint attributeSize;
@@ -107,31 +118,28 @@ GLenum InputLayoutCache::applyVertexBuffers(TranslatedAttribute attributes[gl::M
ilKey.elements[ilKey.elementCount].desc.SemanticName = semanticName;
ilKey.elements[ilKey.elementCount].desc.SemanticIndex = sortedSemanticIndices[i];
- ilKey.elements[ilKey.elementCount].desc.Format = attributes[i].attribute->mArrayEnabled ? vertexBuffer->getDXGIFormat(*attributes[i].attribute) : DXGI_FORMAT_R32G32B32A32_FLOAT;
+ ilKey.elements[ilKey.elementCount].desc.Format = dxgiFormat;
ilKey.elements[ilKey.elementCount].desc.InputSlot = i;
ilKey.elements[ilKey.elementCount].desc.AlignedByteOffset = 0;
ilKey.elements[ilKey.elementCount].desc.InputSlotClass = inputClass;
ilKey.elements[ilKey.elementCount].desc.InstanceDataStepRate = attributes[i].divisor;
ilKey.elementCount++;
-
- vertexBuffers[i] = bufferStorage ? bufferStorage->getBuffer() : vertexBuffer->getBuffer();
- vertexBufferSerials[i] = bufferStorage ? bufferStorage->getSerial() : vertexBuffer->getSerial();
- vertexStrides[i] = attributes[i].stride;
- vertexOffsets[i] = attributes[i].offset;
}
}
ID3D11InputLayout *inputLayout = NULL;
- InputLayoutMap::iterator i = mInputLayoutMap.find(ilKey);
- if (i != mInputLayoutMap.end())
+ InputLayoutMap::iterator keyIter = mInputLayoutMap.find(ilKey);
+ if (keyIter != mInputLayoutMap.end())
{
- inputLayout = i->second.inputLayout;
- i->second.lastUsedTime = mCounter++;
+ inputLayout = keyIter->second.inputLayout;
+ keyIter->second.lastUsedTime = mCounter++;
}
else
{
- ShaderExecutable11 *shader = ShaderExecutable11::makeShaderExecutable11(programBinary->getVertexExecutable());
+ gl::VertexFormat shaderInputLayout[gl::MAX_VERTEX_ATTRIBS];
+ GetInputLayout(attributes, shaderInputLayout);
+ ShaderExecutable11 *shader = ShaderExecutable11::makeShaderExecutable11(programBinary->getVertexExecutableForInputLayout(shaderInputLayout));
D3D11_INPUT_ELEMENT_DESC descs[gl::MAX_VERTEX_ATTRIBS];
for (unsigned int j = 0; j < ilKey.elementCount; ++j)
@@ -159,7 +167,7 @@ GLenum InputLayoutCache::applyVertexBuffers(TranslatedAttribute attributes[gl::M
leastRecentlyUsed = i;
}
}
- leastRecentlyUsed->second.inputLayout->Release();
+ SafeRelease(leastRecentlyUsed->second.inputLayout);
mInputLayoutMap.erase(leastRecentlyUsed);
}
@@ -176,16 +184,43 @@ GLenum InputLayoutCache::applyVertexBuffers(TranslatedAttribute attributes[gl::M
mCurrentIL = inputLayout;
}
+ bool dirtyBuffers = false;
+ size_t minDiff = gl::MAX_VERTEX_ATTRIBS;
+ size_t maxDiff = 0;
for (unsigned int i = 0; i < gl::MAX_VERTEX_ATTRIBS; i++)
{
- if (vertexBufferSerials[i] != mCurrentBuffers[i] || vertexStrides[i] != mCurrentVertexStrides[i] ||
- vertexOffsets[i] != mCurrentVertexOffsets[i])
+ ID3D11Buffer *buffer = NULL;
+
+ if (attributes[i].active)
{
- mDeviceContext->IASetVertexBuffers(i, 1, &vertexBuffers[i], &vertexStrides[i], &vertexOffsets[i]);
- mCurrentBuffers[i] = vertexBufferSerials[i];
- mCurrentVertexStrides[i] = vertexStrides[i];
- mCurrentVertexOffsets[i] = vertexOffsets[i];
+ VertexBuffer11 *vertexBuffer = VertexBuffer11::makeVertexBuffer11(attributes[i].vertexBuffer);
+ BufferStorage11 *bufferStorage = attributes[i].storage ? BufferStorage11::makeBufferStorage11(attributes[i].storage) : NULL;
+
+ buffer = bufferStorage ? bufferStorage->getBuffer(BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK)
+ : vertexBuffer->getBuffer();
}
+
+ UINT vertexStride = attributes[i].stride;
+ UINT vertexOffset = attributes[i].offset;
+
+ if (buffer != mCurrentBuffers[i] || vertexStride != mCurrentVertexStrides[i] ||
+ vertexOffset != mCurrentVertexOffsets[i])
+ {
+ dirtyBuffers = true;
+ minDiff = std::min(minDiff, static_cast<size_t>(i));
+ maxDiff = std::max(maxDiff, static_cast<size_t>(i));
+
+ mCurrentBuffers[i] = buffer;
+ mCurrentVertexStrides[i] = vertexStride;
+ mCurrentVertexOffsets[i] = vertexOffset;
+ }
+ }
+
+ if (dirtyBuffers)
+ {
+ ASSERT(minDiff <= maxDiff && maxDiff < gl::MAX_VERTEX_ATTRIBS);
+ mDeviceContext->IASetVertexBuffers(minDiff, maxDiff - minDiff + 1, mCurrentBuffers + minDiff,
+ mCurrentVertexStrides + minDiff, mCurrentVertexOffsets + minDiff);
}
return GL_NO_ERROR;
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/InputLayoutCache.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/InputLayoutCache.h
index bb1a8eebcf7..5d0ac60537d 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/InputLayoutCache.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/InputLayoutCache.h
@@ -67,7 +67,7 @@ class InputLayoutCache
};
ID3D11InputLayout *mCurrentIL;
- unsigned int mCurrentBuffers[gl::MAX_VERTEX_ATTRIBS];
+ ID3D11Buffer *mCurrentBuffers[gl::MAX_VERTEX_ATTRIBS];
UINT mCurrentVertexStrides[gl::MAX_VERTEX_ATTRIBS];
UINT mCurrentVertexOffsets[gl::MAX_VERTEX_ATTRIBS];
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/PixelTransfer11.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/PixelTransfer11.cpp
new file mode 100644
index 00000000000..dcd1f99ab95
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/PixelTransfer11.cpp
@@ -0,0 +1,252 @@
+#include "precompiled.h"
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// PixelTransfer11.cpp:
+// Implementation for buffer-to-texture and texture-to-buffer copies.
+// Used to implement pixel transfers from unpack and to pack buffers.
+//
+
+#include "libGLESv2/renderer/d3d11/PixelTransfer11.h"
+#include "libGLESv2/formatutils.h"
+#include "libGLESv2/Texture.h"
+#include "libGLESv2/Buffer.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
+#include "libGLESv2/renderer/d3d11/renderer11_utils.h"
+#include "libGLESv2/renderer/d3d11/formatutils11.h"
+#include "libGLESv2/renderer/d3d11/BufferStorage11.h"
+#include "libGLESv2/renderer/d3d11/TextureStorage11.h"
+#include "libGLESv2/renderer/d3d11/RenderTarget11.h"
+#include "libGLESv2/Context.h"
+
+// Precompiled shaders
+#include "libGLESv2/renderer/d3d11/shaders/compiled/buffertotexture11_vs.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/buffertotexture11_gs.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/buffertotexture11_ps_4f.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/buffertotexture11_ps_4i.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/buffertotexture11_ps_4ui.h"
+
+namespace rx
+{
+
+PixelTransfer11::PixelTransfer11(Renderer11 *renderer)
+ : mRenderer(renderer),
+ mBufferToTextureVS(NULL),
+ mBufferToTextureGS(NULL),
+ mParamsConstantBuffer(NULL),
+ mCopyRasterizerState(NULL),
+ mCopyDepthStencilState(NULL)
+{
+ HRESULT result = S_OK;
+ ID3D11Device *device = mRenderer->getDevice();
+
+ D3D11_RASTERIZER_DESC rasterDesc;
+ rasterDesc.FillMode = D3D11_FILL_SOLID;
+ rasterDesc.CullMode = D3D11_CULL_NONE;
+ rasterDesc.FrontCounterClockwise = FALSE;
+ rasterDesc.DepthBias = 0;
+ rasterDesc.SlopeScaledDepthBias = 0.0f;
+ rasterDesc.DepthBiasClamp = 0.0f;
+ rasterDesc.DepthClipEnable = TRUE;
+ rasterDesc.ScissorEnable = FALSE;
+ rasterDesc.MultisampleEnable = FALSE;
+ rasterDesc.AntialiasedLineEnable = FALSE;
+
+ result = device->CreateRasterizerState(&rasterDesc, &mCopyRasterizerState);
+ ASSERT(SUCCEEDED(result));
+
+ D3D11_DEPTH_STENCIL_DESC depthStencilDesc;
+ depthStencilDesc.DepthEnable = true;
+ depthStencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
+ depthStencilDesc.DepthFunc = D3D11_COMPARISON_ALWAYS;
+ depthStencilDesc.StencilEnable = FALSE;
+ depthStencilDesc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK;
+ depthStencilDesc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK;
+ depthStencilDesc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
+ depthStencilDesc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP;
+ depthStencilDesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
+ depthStencilDesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
+ depthStencilDesc.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
+ depthStencilDesc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP;
+ depthStencilDesc.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
+ depthStencilDesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
+
+ result = device->CreateDepthStencilState(&depthStencilDesc, &mCopyDepthStencilState);
+ ASSERT(SUCCEEDED(result));
+
+ D3D11_BUFFER_DESC constantBufferDesc = { 0 };
+ constantBufferDesc.ByteWidth = rx::roundUp<UINT>(sizeof(CopyShaderParams), 32u);
+ constantBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
+ constantBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
+ constantBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ constantBufferDesc.MiscFlags = 0;
+ constantBufferDesc.StructureByteStride = 0;
+
+ result = device->CreateBuffer(&constantBufferDesc, NULL, &mParamsConstantBuffer);
+ ASSERT(SUCCEEDED(result));
+ d3d11::SetDebugName(mParamsConstantBuffer, "PixelTransfer11 constant buffer");
+
+ // init shaders
+ mBufferToTextureVS = d3d11::CompileVS(device, g_VS_BufferToTexture, "BufferToTexture VS");
+ mBufferToTextureGS = d3d11::CompileGS(device, g_GS_BufferToTexture, "BufferToTexture GS");
+
+ buildShaderMap();
+
+ StructZero(&mParamsData);
+}
+
+PixelTransfer11::~PixelTransfer11()
+{
+ for (auto shaderMapIt = mBufferToTexturePSMap.begin(); shaderMapIt != mBufferToTexturePSMap.end(); shaderMapIt++)
+ {
+ SafeRelease(shaderMapIt->second);
+ }
+
+ mBufferToTexturePSMap.clear();
+
+ SafeRelease(mBufferToTextureVS);
+ SafeRelease(mBufferToTextureGS);
+ SafeRelease(mParamsConstantBuffer);
+ SafeRelease(mCopyRasterizerState);
+ SafeRelease(mCopyDepthStencilState);
+}
+
+void PixelTransfer11::setBufferToTextureCopyParams(const gl::Box &destArea, const gl::Extents &destSize, GLenum internalFormat,
+ const gl::PixelUnpackState &unpack, unsigned int offset, CopyShaderParams *parametersOut)
+{
+ StructZero(parametersOut);
+
+ float texelCenterX = 0.5f / static_cast<float>(destSize.width - 1);
+ float texelCenterY = 0.5f / static_cast<float>(destSize.height - 1);
+
+ unsigned int bytesPerPixel = gl::GetPixelBytes(internalFormat, 3);
+ unsigned int alignmentBytes = static_cast<unsigned int>(unpack.alignment);
+ unsigned int alignmentPixels = (alignmentBytes <= bytesPerPixel ? 1 : alignmentBytes / bytesPerPixel);
+
+ parametersOut->FirstPixelOffset = offset;
+ parametersOut->PixelsPerRow = static_cast<unsigned int>(destArea.width);
+ parametersOut->RowStride = roundUp(parametersOut->PixelsPerRow, alignmentPixels);
+ parametersOut->RowsPerSlice = static_cast<unsigned int>(destArea.height);
+ parametersOut->PositionOffset[0] = texelCenterX + (destArea.x / float(destSize.width)) * 2.0f - 1.0f;
+ parametersOut->PositionOffset[1] = texelCenterY + ((destSize.height - destArea.y - 1) / float(destSize.height)) * 2.0f - 1.0f;
+ parametersOut->PositionScale[0] = 2.0f / static_cast<float>(destSize.width);
+ parametersOut->PositionScale[1] = -2.0f / static_cast<float>(destSize.height);
+}
+
+bool PixelTransfer11::copyBufferToTexture(const gl::PixelUnpackState &unpack, unsigned int offset, RenderTarget *destRenderTarget,
+ GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &destArea)
+{
+ gl::Extents destSize = destRenderTarget->getExtents();
+
+ if (destArea.x < 0 || destArea.x + destArea.width > destSize.width ||
+ destArea.y < 0 || destArea.y + destArea.height > destSize.height ||
+ destArea.z < 0 || destArea.z + destArea.depth > destSize.depth )
+ {
+ return false;
+ }
+
+ int clientVersion = mRenderer->getCurrentClientVersion();
+ const gl::Buffer &sourceBuffer = *unpack.pixelBuffer.get();
+
+ ASSERT(mRenderer->supportsFastCopyBufferToTexture(destinationFormat));
+
+ ID3D11PixelShader *pixelShader = findBufferToTexturePS(destinationFormat);
+ ASSERT(pixelShader);
+
+ // The SRV must be in the proper read format, which may be different from the destination format
+ // EG: for half float data, we can load full precision floats with implicit conversion
+ GLenum unsizedFormat = gl::GetFormat(destinationFormat, clientVersion);
+ GLenum sourceFormat = gl::GetSizedInternalFormat(unsizedFormat, sourcePixelsType, clientVersion);
+
+ DXGI_FORMAT srvFormat = gl_d3d11::GetSRVFormat(sourceFormat, clientVersion);
+ ASSERT(srvFormat != DXGI_FORMAT_UNKNOWN);
+ BufferStorage11 *bufferStorage11 = BufferStorage11::makeBufferStorage11(sourceBuffer.getStorage());
+ ID3D11ShaderResourceView *bufferSRV = bufferStorage11->getSRV(srvFormat);
+ ASSERT(bufferSRV != NULL);
+
+ ID3D11RenderTargetView *textureRTV = RenderTarget11::makeRenderTarget11(destRenderTarget)->getRenderTargetView();
+ ASSERT(textureRTV != NULL);
+
+ CopyShaderParams shaderParams;
+ setBufferToTextureCopyParams(destArea, destSize, sourceFormat, unpack, offset, &shaderParams);
+
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+
+ ID3D11ShaderResourceView *nullSRV = NULL;
+ ID3D11Buffer *nullBuffer = NULL;
+ UINT zero = 0;
+
+ // Are we doing a 2D or 3D copy?
+ ID3D11GeometryShader *geometryShader = ((destSize.depth > 1) ? mBufferToTextureGS : NULL);
+
+ deviceContext->VSSetShader(mBufferToTextureVS, NULL, 0);
+ deviceContext->GSSetShader(geometryShader, NULL, 0);
+ deviceContext->PSSetShader(pixelShader, NULL, 0);
+ deviceContext->PSSetShaderResources(0, 1, &bufferSRV);
+ deviceContext->IASetInputLayout(NULL);
+ deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST);
+
+ deviceContext->IASetVertexBuffers(0, 1, &nullBuffer, &zero, &zero);
+ deviceContext->OMSetBlendState(NULL, NULL, 0xFFFFFFF);
+ deviceContext->OMSetDepthStencilState(mCopyDepthStencilState, 0xFFFFFFFF);
+ deviceContext->RSSetState(mCopyRasterizerState);
+
+ mRenderer->setOneTimeRenderTarget(textureRTV);
+
+ if (!StructEquals(mParamsData, shaderParams))
+ {
+ d3d11::SetBufferData(deviceContext, mParamsConstantBuffer, shaderParams);
+ mParamsData = shaderParams;
+ }
+
+ deviceContext->VSSetConstantBuffers(0, 1, &mParamsConstantBuffer);
+
+ // Set the viewport
+ D3D11_VIEWPORT viewport;
+ viewport.TopLeftX = 0;
+ viewport.TopLeftY = 0;
+ viewport.Width = destSize.width;
+ viewport.Height = destSize.height;
+ viewport.MinDepth = 0.0f;
+ viewport.MaxDepth = 1.0f;
+ deviceContext->RSSetViewports(1, &viewport);
+
+ UINT numPixels = (destArea.width * destArea.height * destArea.depth);
+ deviceContext->Draw(numPixels, 0);
+
+ // Unbind textures and render targets and vertex buffer
+ deviceContext->PSSetShaderResources(0, 1, &nullSRV);
+ deviceContext->VSSetConstantBuffers(0, 1, &nullBuffer);
+
+ mRenderer->markAllStateDirty();
+
+ return true;
+}
+
+void PixelTransfer11::buildShaderMap()
+{
+ ID3D11Device *device = mRenderer->getDevice();
+
+ mBufferToTexturePSMap[GL_FLOAT] = d3d11::CompilePS(device, g_PS_BufferToTexture_4F, "BufferToTexture RGBA ps");
+ mBufferToTexturePSMap[GL_INT] = d3d11::CompilePS(device, g_PS_BufferToTexture_4I, "BufferToTexture RGBA-I ps");
+ mBufferToTexturePSMap[GL_UNSIGNED_INT] = d3d11::CompilePS(device, g_PS_BufferToTexture_4UI, "BufferToTexture RGBA-UI ps");
+}
+
+ID3D11PixelShader *PixelTransfer11::findBufferToTexturePS(GLenum internalFormat) const
+{
+ int clientVersion = mRenderer->getCurrentClientVersion();
+ GLenum componentType = gl::GetComponentType(internalFormat, clientVersion);
+
+ if (componentType == GL_SIGNED_NORMALIZED || componentType == GL_UNSIGNED_NORMALIZED)
+ {
+ componentType = GL_FLOAT;
+ }
+
+ auto shaderMapIt = mBufferToTexturePSMap.find(componentType);
+ return (shaderMapIt == mBufferToTexturePSMap.end() ? NULL : shaderMapIt->second);
+}
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/PixelTransfer11.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/PixelTransfer11.h
new file mode 100644
index 00000000000..574140d1984
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/PixelTransfer11.h
@@ -0,0 +1,80 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// PixelTransfer11.h:
+// Buffer-to-Texture and Texture-to-Buffer data transfers.
+// Used to implement pixel unpack and pixel pack buffers in ES3.
+
+#ifndef LIBGLESV2_PIXELTRANSFER11_H_
+#define LIBGLESV2_PIXELTRANSFER11_H_
+
+namespace gl
+{
+
+class Buffer;
+struct Box;
+struct Extents;
+struct PixelUnpackState;
+
+}
+
+namespace rx
+{
+class Renderer11;
+class RenderTarget;
+
+class PixelTransfer11
+{
+ public:
+ explicit PixelTransfer11(Renderer11 *renderer);
+ ~PixelTransfer11();
+
+ static bool supportsBufferToTextureCopy(GLenum internalFormat);
+
+ // unpack: the source buffer is stored in the unpack state, and buffer strides
+ // offset: the start of the data within the unpack buffer
+ // destRenderTarget: individual slice/layer of a target texture
+ // destinationFormat/sourcePixelsType: determines shaders + shader parameters
+ // destArea: the sub-section of destRenderTarget to copy to
+ bool copyBufferToTexture(const gl::PixelUnpackState &unpack, unsigned int offset, RenderTarget *destRenderTarget,
+ GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &destArea);
+
+ private:
+
+ struct CopyShaderParams
+ {
+ unsigned int FirstPixelOffset;
+ unsigned int PixelsPerRow;
+ unsigned int RowStride;
+ unsigned int RowsPerSlice;
+ float PositionOffset[2];
+ float PositionScale[2];
+ int TexLocationOffset[2];
+ int TexLocationScale[2];
+ };
+
+ static void setBufferToTextureCopyParams(const gl::Box &destArea, const gl::Extents &destSize, GLenum internalFormat,
+ const gl::PixelUnpackState &unpack, unsigned int offset, CopyShaderParams *parametersOut);
+
+ void buildShaderMap();
+ ID3D11PixelShader *findBufferToTexturePS(GLenum internalFormat) const;
+
+ Renderer11 *mRenderer;
+
+ std::map<GLenum, ID3D11PixelShader *> mBufferToTexturePSMap;
+ ID3D11VertexShader *mBufferToTextureVS;
+ ID3D11GeometryShader *mBufferToTextureGS;
+ ID3D11Buffer *mParamsConstantBuffer;
+ CopyShaderParams mParamsData;
+
+ ID3D11RasterizerState *mCopyRasterizerState;
+ ID3D11DepthStencilState *mCopyDepthStencilState;
+
+};
+
+}
+
+#endif // LIBGLESV2_PIXELTRANSFER11_H_
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Query11.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Query11.cpp
new file mode 100644
index 00000000000..203f61f9f0a
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Query11.cpp
@@ -0,0 +1,155 @@
+#include "precompiled.h"
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Query11.cpp: Defines the rx::Query11 class which implements rx::QueryImpl.
+
+#include "libGLESv2/renderer/d3d11/Query11.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
+#include "libGLESv2/renderer/d3d11/renderer11_utils.h"
+#include "libGLESv2/main.h"
+
+namespace rx
+{
+
+static bool checkOcclusionQuery(ID3D11DeviceContext *context, ID3D11Query *query, UINT64 *numPixels)
+{
+ HRESULT result = context->GetData(query, numPixels, sizeof(UINT64), 0);
+ return (result == S_OK);
+}
+
+static bool checkStreamOutPrimitivesWritten(ID3D11DeviceContext *context, ID3D11Query *query, UINT64 *numPrimitives)
+{
+ D3D11_QUERY_DATA_SO_STATISTICS soStats = { 0 };
+ HRESULT result = context->GetData(query, &soStats, sizeof(D3D11_QUERY_DATA_SO_STATISTICS), 0);
+ *numPrimitives = soStats.NumPrimitivesWritten;
+ return (result == S_OK);
+}
+
+Query11::Query11(rx::Renderer11 *renderer, GLenum type) : QueryImpl(type)
+{
+ mRenderer = renderer;
+ mQuery = NULL;
+}
+
+Query11::~Query11()
+{
+ SafeRelease(mQuery);
+}
+
+void Query11::begin()
+{
+ if (mQuery == NULL)
+ {
+ D3D11_QUERY_DESC queryDesc;
+ queryDesc.Query = gl_d3d11::ConvertQueryType(getType());
+ queryDesc.MiscFlags = 0;
+
+ if (FAILED(mRenderer->getDevice()->CreateQuery(&queryDesc, &mQuery)))
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+ }
+
+ mRenderer->getDeviceContext()->Begin(mQuery);
+}
+
+void Query11::end()
+{
+ ASSERT(mQuery);
+ mRenderer->getDeviceContext()->End(mQuery);
+
+ mStatus = GL_FALSE;
+ mResult = GL_FALSE;
+}
+
+GLuint Query11::getResult()
+{
+ if (mQuery != NULL)
+ {
+ while (!testQuery())
+ {
+ Sleep(0);
+ // explicitly check for device loss, some drivers seem to return S_FALSE
+ // if the device is lost
+ if (mRenderer->testDeviceLost(true))
+ {
+ return gl::error(GL_OUT_OF_MEMORY, 0);
+ }
+ }
+ }
+
+ return mResult;
+}
+
+GLboolean Query11::isResultAvailable()
+{
+ if (mQuery != NULL)
+ {
+ testQuery();
+ }
+
+ return mStatus;
+}
+
+GLboolean Query11::testQuery()
+{
+ if (mQuery != NULL && mStatus != GL_TRUE)
+ {
+ ID3D11DeviceContext *context = mRenderer->getDeviceContext();
+
+ bool queryFinished = false;
+ switch (getType())
+ {
+ case GL_ANY_SAMPLES_PASSED_EXT:
+ case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
+ {
+ UINT64 numPixels = 0;
+ queryFinished = checkOcclusionQuery(context, mQuery, &numPixels);
+ if (queryFinished)
+ {
+ mResult = (numPixels > 0) ? GL_TRUE : GL_FALSE;
+ }
+ }
+ break;
+
+ case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
+ {
+ UINT64 numPrimitives = 0;
+ queryFinished = checkStreamOutPrimitivesWritten(context, mQuery, &numPrimitives);
+ if (queryFinished)
+ {
+ mResult = static_cast<GLuint>(numPrimitives);
+ }
+ }
+ break;
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ if (queryFinished)
+ {
+ mStatus = GL_TRUE;
+ }
+ else if (mRenderer->testDeviceLost(true))
+ {
+ return gl::error(GL_OUT_OF_MEMORY, GL_TRUE);
+ }
+
+ return mStatus;
+ }
+
+ return GL_TRUE; // prevent blocking when query is null
+}
+
+bool Query11::isStarted() const
+{
+ return (mQuery != NULL);
+}
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/Query11.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Query11.h
index 0a03de77ca3..7a3df46d4f7 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/Query11.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Query11.h
@@ -21,10 +21,11 @@ class Query11 : public QueryImpl
Query11(rx::Renderer11 *renderer, GLenum type);
virtual ~Query11();
- void begin();
- void end();
- GLuint getResult();
- GLboolean isResultAvailable();
+ virtual void begin();
+ virtual void end();
+ virtual GLuint getResult();
+ virtual GLboolean isResultAvailable();
+ virtual bool isStarted() const;
private:
DISALLOW_COPY_AND_ASSIGN(Query11);
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/RenderStateCache.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/RenderStateCache.cpp
index b3111af72be..b58569ad1fb 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/RenderStateCache.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/RenderStateCache.cpp
@@ -1,6 +1,6 @@
#include "precompiled.h"
//
-// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2012-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -8,8 +8,11 @@
// RenderStateCache.cpp: Defines rx::RenderStateCache, a cache of Direct3D render
// state objects.
-#include "libGLESv2/renderer/RenderStateCache.h"
-#include "libGLESv2/renderer/renderer11_utils.h"
+#include "libGLESv2/renderer/d3d11/RenderStateCache.h"
+#include "libGLESv2/renderer/d3d11/renderer11_utils.h"
+#include "libGLESv2/renderer/Renderer.h"
+#include "libGLESv2/Framebuffer.h"
+#include "libGLESv2/Renderbuffer.h"
#include "common/debug.h"
#include "third_party/murmurhash/MurmurHash3.h"
@@ -17,6 +20,16 @@
namespace rx
{
+template <typename mapType>
+static void ClearStateMap(mapType &map)
+{
+ for (mapType::iterator i = map.begin(); i != map.end(); i++)
+ {
+ SafeRelease(i->second.first);
+ }
+ map.clear();
+}
+
// MSDN's documentation of ID3D11Device::CreateBlendState, ID3D11Device::CreateRasterizerState,
// ID3D11Device::CreateDepthStencilState and ID3D11Device::CreateSamplerState claims the maximum
// number of unique states of each type an application can create is 4096
@@ -46,32 +59,13 @@ void RenderStateCache::initialize(ID3D11Device *device)
void RenderStateCache::clear()
{
- for (BlendStateMap::iterator i = mBlendStateCache.begin(); i != mBlendStateCache.end(); i++)
- {
- i->second.first->Release();
- }
- mBlendStateCache.clear();
-
- for (RasterizerStateMap::iterator i = mRasterizerStateCache.begin(); i != mRasterizerStateCache.end(); i++)
- {
- i->second.first->Release();
- }
- mRasterizerStateCache.clear();
-
- for (DepthStencilStateMap::iterator i = mDepthStencilStateCache.begin(); i != mDepthStencilStateCache.end(); i++)
- {
- i->second.first->Release();
- }
- mDepthStencilStateCache.clear();
-
- for (SamplerStateMap::iterator i = mSamplerStateCache.begin(); i != mSamplerStateCache.end(); i++)
- {
- i->second.first->Release();
- }
- mSamplerStateCache.clear();
+ ClearStateMap(mBlendStateCache);
+ ClearStateMap(mRasterizerStateCache);
+ ClearStateMap(mDepthStencilStateCache);
+ ClearStateMap(mSamplerStateCache);
}
-std::size_t RenderStateCache::hashBlendState(const gl::BlendState &blendState)
+std::size_t RenderStateCache::hashBlendState(const BlendStateKey &blendState)
{
static const unsigned int seed = 0xABCDEF98;
@@ -80,12 +74,12 @@ std::size_t RenderStateCache::hashBlendState(const gl::BlendState &blendState)
return hash;
}
-bool RenderStateCache::compareBlendStates(const gl::BlendState &a, const gl::BlendState &b)
+bool RenderStateCache::compareBlendStates(const BlendStateKey &a, const BlendStateKey &b)
{
- return memcmp(&a, &b, sizeof(gl::BlendState)) == 0;
+ return memcmp(&a, &b, sizeof(BlendStateKey)) == 0;
}
-ID3D11BlendState *RenderStateCache::getBlendState(const gl::BlendState &blendState)
+ID3D11BlendState *RenderStateCache::getBlendState(const gl::Framebuffer *framebuffer, const gl::BlendState &blendState)
{
if (!mDevice)
{
@@ -93,10 +87,38 @@ ID3D11BlendState *RenderStateCache::getBlendState(const gl::BlendState &blendSta
return NULL;
}
- BlendStateMap::iterator i = mBlendStateCache.find(blendState);
- if (i != mBlendStateCache.end())
+ bool mrt = false;
+
+ BlendStateKey key = { 0 };
+ key.blendState = blendState;
+ for (unsigned int i = 0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
{
- BlendStateCounterPair &state = i->second;
+ gl::FramebufferAttachment *attachment = framebuffer->getColorbuffer(i);
+ if (attachment)
+ {
+ if (i > 0)
+ {
+ mrt = true;
+ }
+
+ key.rtChannels[i][0] = attachment->getRedSize() > 0;
+ key.rtChannels[i][1] = attachment->getGreenSize() > 0;
+ key.rtChannels[i][2] = attachment->getBlueSize() > 0;
+ key.rtChannels[i][3] = attachment->getAlphaSize() > 0;
+ }
+ else
+ {
+ key.rtChannels[i][0] = false;
+ key.rtChannels[i][1] = false;
+ key.rtChannels[i][2] = false;
+ key.rtChannels[i][3] = false;
+ }
+ }
+
+ BlendStateMap::iterator keyIter = mBlendStateCache.find(key);
+ if (keyIter != mBlendStateCache.end())
+ {
+ BlendStateCounterPair &state = keyIter->second;
state.second = mCounter++;
return state.first;
}
@@ -115,14 +137,14 @@ ID3D11BlendState *RenderStateCache::getBlendState(const gl::BlendState &blendSta
leastRecentlyUsed = i;
}
}
- leastRecentlyUsed->second.first->Release();
+ SafeRelease(leastRecentlyUsed->second.first);
mBlendStateCache.erase(leastRecentlyUsed);
}
// Create a new blend state and insert it into the cache
D3D11_BLEND_DESC blendDesc = { 0 };
blendDesc.AlphaToCoverageEnable = blendState.sampleAlphaToCoverage;
- blendDesc.IndependentBlendEnable = FALSE;
+ blendDesc.IndependentBlendEnable = mrt ? TRUE : FALSE;
for (unsigned int i = 0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
{
@@ -140,10 +162,10 @@ ID3D11BlendState *RenderStateCache::getBlendState(const gl::BlendState &blendSta
rtBlend.BlendOpAlpha = gl_d3d11::ConvertBlendOp(blendState.blendEquationAlpha);
}
- rtBlend.RenderTargetWriteMask = gl_d3d11::ConvertColorMask(blendState.colorMaskRed,
- blendState.colorMaskGreen,
- blendState.colorMaskBlue,
- blendState.colorMaskAlpha);
+ rtBlend.RenderTargetWriteMask = gl_d3d11::ConvertColorMask(key.rtChannels[i][0] && blendState.colorMaskRed,
+ key.rtChannels[i][1] && blendState.colorMaskGreen,
+ key.rtChannels[i][2] && blendState.colorMaskBlue,
+ key.rtChannels[i][3] && blendState.colorMaskAlpha);
}
ID3D11BlendState *dx11BlendState = NULL;
@@ -154,7 +176,7 @@ ID3D11BlendState *RenderStateCache::getBlendState(const gl::BlendState &blendSta
return NULL;
}
- mBlendStateCache.insert(std::make_pair(blendState, std::make_pair(dx11BlendState, mCounter++)));
+ mBlendStateCache.insert(std::make_pair(key, std::make_pair(dx11BlendState, mCounter++)));
return dx11BlendState;
}
@@ -174,8 +196,7 @@ bool RenderStateCache::compareRasterizerStates(const RasterizerStateKey &a, cons
return memcmp(&a, &b, sizeof(RasterizerStateKey)) == 0;
}
-ID3D11RasterizerState *RenderStateCache::getRasterizerState(const gl::RasterizerState &rasterState,
- bool scissorEnabled, unsigned int depthSize)
+ID3D11RasterizerState *RenderStateCache::getRasterizerState(const gl::RasterizerState &rasterState, bool scissorEnabled)
{
if (!mDevice)
{
@@ -183,15 +204,14 @@ ID3D11RasterizerState *RenderStateCache::getRasterizerState(const gl::Rasterizer
return NULL;
}
- RasterizerStateKey key;
+ RasterizerStateKey key = { 0 };
key.rasterizerState = rasterState;
key.scissorEnabled = scissorEnabled;
- key.depthSize = depthSize;
- RasterizerStateMap::iterator i = mRasterizerStateCache.find(key);
- if (i != mRasterizerStateCache.end())
+ RasterizerStateMap::iterator keyIter = mRasterizerStateCache.find(key);
+ if (keyIter != mRasterizerStateCache.end())
{
- RasterizerStateCounterPair &state = i->second;
+ RasterizerStateCounterPair &state = keyIter->second;
state.second = mCounter++;
return state.first;
}
@@ -210,7 +230,7 @@ ID3D11RasterizerState *RenderStateCache::getRasterizerState(const gl::Rasterizer
leastRecentlyUsed = i;
}
}
- leastRecentlyUsed->second.first->Release();
+ SafeRelease(leastRecentlyUsed->second.first);
mRasterizerStateCache.erase(leastRecentlyUsed);
}
@@ -226,14 +246,23 @@ ID3D11RasterizerState *RenderStateCache::getRasterizerState(const gl::Rasterizer
rasterDesc.FillMode = D3D11_FILL_SOLID;
rasterDesc.CullMode = cullMode;
rasterDesc.FrontCounterClockwise = (rasterState.frontFace == GL_CCW) ? FALSE: TRUE;
- rasterDesc.DepthBias = ldexp(rasterState.polygonOffsetUnits, -static_cast<int>(depthSize));
rasterDesc.DepthBiasClamp = 0.0f; // MSDN documentation of DepthBiasClamp implies a value of zero will preform no clamping, must be tested though.
- rasterDesc.SlopeScaledDepthBias = rasterState.polygonOffsetFactor;
rasterDesc.DepthClipEnable = TRUE;
rasterDesc.ScissorEnable = scissorEnabled ? TRUE : FALSE;
rasterDesc.MultisampleEnable = rasterState.multiSample;
rasterDesc.AntialiasedLineEnable = FALSE;
+ if (rasterState.polygonOffsetFill)
+ {
+ rasterDesc.SlopeScaledDepthBias = rasterState.polygonOffsetFactor;
+ rasterDesc.DepthBias = (INT)rasterState.polygonOffsetUnits;
+ }
+ else
+ {
+ rasterDesc.SlopeScaledDepthBias = 0.0f;
+ rasterDesc.DepthBias = 0;
+ }
+
ID3D11RasterizerState *dx11RasterizerState = NULL;
HRESULT result = mDevice->CreateRasterizerState(&rasterDesc, &dx11RasterizerState);
if (FAILED(result) || !dx11RasterizerState)
@@ -270,10 +299,10 @@ ID3D11DepthStencilState *RenderStateCache::getDepthStencilState(const gl::DepthS
return NULL;
}
- DepthStencilStateMap::iterator i = mDepthStencilStateCache.find(dsState);
- if (i != mDepthStencilStateCache.end())
+ DepthStencilStateMap::iterator keyIter = mDepthStencilStateCache.find(dsState);
+ if (keyIter != mDepthStencilStateCache.end())
{
- DepthStencilStateCounterPair &state = i->second;
+ DepthStencilStateCounterPair &state = keyIter->second;
state.second = mCounter++;
return state.first;
}
@@ -292,7 +321,7 @@ ID3D11DepthStencilState *RenderStateCache::getDepthStencilState(const gl::DepthS
leastRecentlyUsed = i;
}
}
- leastRecentlyUsed->second.first->Release();
+ SafeRelease(leastRecentlyUsed->second.first);
mDepthStencilStateCache.erase(leastRecentlyUsed);
}
@@ -348,10 +377,10 @@ ID3D11SamplerState *RenderStateCache::getSamplerState(const gl::SamplerState &sa
return NULL;
}
- SamplerStateMap::iterator i = mSamplerStateCache.find(samplerState);
- if (i != mSamplerStateCache.end())
+ SamplerStateMap::iterator keyIter = mSamplerStateCache.find(samplerState);
+ if (keyIter != mSamplerStateCache.end())
{
- SamplerStateCounterPair &state = i->second;
+ SamplerStateCounterPair &state = keyIter->second;
state.second = mCounter++;
return state.first;
}
@@ -370,24 +399,25 @@ ID3D11SamplerState *RenderStateCache::getSamplerState(const gl::SamplerState &sa
leastRecentlyUsed = i;
}
}
- leastRecentlyUsed->second.first->Release();
+ SafeRelease(leastRecentlyUsed->second.first);
mSamplerStateCache.erase(leastRecentlyUsed);
}
D3D11_SAMPLER_DESC samplerDesc;
- samplerDesc.Filter = gl_d3d11::ConvertFilter(samplerState.minFilter, samplerState.magFilter, samplerState.maxAnisotropy);
+ samplerDesc.Filter = gl_d3d11::ConvertFilter(samplerState.minFilter, samplerState.magFilter,
+ samplerState.maxAnisotropy, samplerState.compareMode);
samplerDesc.AddressU = gl_d3d11::ConvertTextureWrap(samplerState.wrapS);
samplerDesc.AddressV = gl_d3d11::ConvertTextureWrap(samplerState.wrapT);
- samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
- samplerDesc.MipLODBias = static_cast<float>(samplerState.lodOffset);
+ samplerDesc.AddressW = gl_d3d11::ConvertTextureWrap(samplerState.wrapR);
+ samplerDesc.MipLODBias = 0;
samplerDesc.MaxAnisotropy = samplerState.maxAnisotropy;
- samplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER;
+ samplerDesc.ComparisonFunc = gl_d3d11::ConvertComparison(samplerState.compareFunc);
samplerDesc.BorderColor[0] = 0.0f;
samplerDesc.BorderColor[1] = 0.0f;
samplerDesc.BorderColor[2] = 0.0f;
samplerDesc.BorderColor[3] = 0.0f;
- samplerDesc.MinLOD = gl_d3d11::ConvertMinLOD(samplerState.minFilter, samplerState.lodOffset);
- samplerDesc.MaxLOD = gl_d3d11::ConvertMaxLOD(samplerState.minFilter, samplerState.lodOffset);
+ samplerDesc.MinLOD = samplerState.minLod;
+ samplerDesc.MaxLOD = samplerState.maxLod;
ID3D11SamplerState *dx11SamplerState = NULL;
HRESULT result = mDevice->CreateSamplerState(&samplerDesc, &dx11SamplerState);
@@ -403,4 +433,4 @@ ID3D11SamplerState *RenderStateCache::getSamplerState(const gl::SamplerState &sa
}
}
-} \ No newline at end of file
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/RenderStateCache.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/RenderStateCache.h
index f8b5111de48..7f3349627ae 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/RenderStateCache.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/RenderStateCache.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2012-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -13,6 +13,11 @@
#include "libGLESv2/angletypes.h"
#include "common/angleutils.h"
+namespace gl
+{
+class Framebuffer;
+}
+
namespace rx
{
@@ -25,10 +30,8 @@ class RenderStateCache
void initialize(ID3D11Device *device);
void clear();
- // Increments refcount on the returned blend state, Release() must be called.
- ID3D11BlendState *getBlendState(const gl::BlendState &blendState);
- ID3D11RasterizerState *getRasterizerState(const gl::RasterizerState &rasterState,
- bool scissorEnabled, unsigned int depthSize);
+ ID3D11BlendState *getBlendState(const gl::Framebuffer *framebuffer, const gl::BlendState &blendState);
+ ID3D11RasterizerState *getRasterizerState(const gl::RasterizerState &rasterState, bool scissorEnabled);
ID3D11DepthStencilState *getDepthStencilState(const gl::DepthStencilState &dsState);
ID3D11SamplerState *getSamplerState(const gl::SamplerState &samplerState);
@@ -38,14 +41,19 @@ class RenderStateCache
unsigned long long mCounter;
// Blend state cache
- static std::size_t hashBlendState(const gl::BlendState &blendState);
- static bool compareBlendStates(const gl::BlendState &a, const gl::BlendState &b);
+ struct BlendStateKey
+ {
+ gl::BlendState blendState;
+ bool rtChannels[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT][4];
+ };
+ static std::size_t hashBlendState(const BlendStateKey &blendState);
+ static bool compareBlendStates(const BlendStateKey &a, const BlendStateKey &b);
static const unsigned int kMaxBlendStates;
- typedef std::size_t (*BlendStateHashFunction)(const gl::BlendState &);
- typedef bool (*BlendStateEqualityFunction)(const gl::BlendState &, const gl::BlendState &);
+ typedef std::size_t (*BlendStateHashFunction)(const BlendStateKey &);
+ typedef bool (*BlendStateEqualityFunction)(const BlendStateKey &, const BlendStateKey &);
typedef std::pair<ID3D11BlendState*, unsigned long long> BlendStateCounterPair;
- typedef std::unordered_map<gl::BlendState, BlendStateCounterPair, BlendStateHashFunction, BlendStateEqualityFunction> BlendStateMap;
+ typedef std::unordered_map<BlendStateKey, BlendStateCounterPair, BlendStateHashFunction, BlendStateEqualityFunction> BlendStateMap;
BlendStateMap mBlendStateCache;
// Rasterizer state cache
@@ -53,7 +61,6 @@ class RenderStateCache
{
gl::RasterizerState rasterizerState;
bool scissorEnabled;
- unsigned int depthSize;
};
static std::size_t hashRasterizerState(const RasterizerStateKey &rasterState);
static bool compareRasterizerStates(const RasterizerStateKey &a, const RasterizerStateKey &b);
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/RenderTarget11.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/RenderTarget11.cpp
index 2667cc6fa78..38c55f3b2e2 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/RenderTarget11.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/RenderTarget11.cpp
@@ -8,26 +8,67 @@
// RenderTarget11.cpp: Implements a DX11-specific wrapper for ID3D11View pointers
// retained by Renderbuffers.
-#include "libGLESv2/renderer/RenderTarget11.h"
-#include "libGLESv2/renderer/Renderer11.h"
+#include "libGLESv2/renderer/d3d11/RenderTarget11.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
-#include "libGLESv2/renderer/renderer11_utils.h"
+#include "libGLESv2/renderer/d3d11/renderer11_utils.h"
+#include "libGLESv2/renderer/d3d11/formatutils11.h"
#include "libGLESv2/main.h"
namespace rx
{
-static unsigned int getRTVSubresourceIndex(ID3D11Texture2D *texture, ID3D11RenderTargetView *view)
+static bool getTextureProperties(ID3D11Resource *resource, unsigned int *mipLevels, unsigned int *samples)
+{
+ ID3D11Texture1D *texture1D = d3d11::DynamicCastComObject<ID3D11Texture1D>(resource);
+ if (texture1D)
+ {
+ D3D11_TEXTURE1D_DESC texDesc;
+ texture1D->GetDesc(&texDesc);
+ SafeRelease(texture1D);
+
+ *mipLevels = texDesc.MipLevels;
+ *samples = 0;
+
+ return true;
+ }
+
+ ID3D11Texture2D *texture2D = d3d11::DynamicCastComObject<ID3D11Texture2D>(resource);
+ if (texture2D)
+ {
+ D3D11_TEXTURE2D_DESC texDesc;
+ texture2D->GetDesc(&texDesc);
+ SafeRelease(texture2D);
+
+ *mipLevels = texDesc.MipLevels;
+ *samples = texDesc.SampleDesc.Count > 1 ? texDesc.SampleDesc.Count : 0;
+
+ return true;
+ }
+
+ ID3D11Texture3D *texture3D = d3d11::DynamicCastComObject<ID3D11Texture3D>(resource);
+ if (texture3D)
+ {
+ D3D11_TEXTURE3D_DESC texDesc;
+ texture3D->GetDesc(&texDesc);
+ SafeRelease(texture3D);
+
+ *mipLevels = texDesc.MipLevels;
+ *samples = 0;
+
+ return true;
+ }
+
+ return false;
+}
+
+static unsigned int getRTVSubresourceIndex(ID3D11Resource *resource, ID3D11RenderTargetView *view)
{
D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
view->GetDesc(&rtvDesc);
- D3D11_TEXTURE2D_DESC texDesc;
- texture->GetDesc(&texDesc);
-
unsigned int mipSlice = 0;
unsigned int arraySlice = 0;
- unsigned int mipLevels = texDesc.MipLevels;
switch (rtvDesc.ViewDimension)
{
@@ -76,20 +117,19 @@ static unsigned int getRTVSubresourceIndex(ID3D11Texture2D *texture, ID3D11Rende
break;
}
+ unsigned int mipLevels, samples;
+ getTextureProperties(resource, &mipLevels, &samples);
+
return D3D11CalcSubresource(mipSlice, arraySlice, mipLevels);
}
-static unsigned int getDSVSubresourceIndex(ID3D11Texture2D *texture, ID3D11DepthStencilView *view)
+static unsigned int getDSVSubresourceIndex(ID3D11Resource *resource, ID3D11DepthStencilView *view)
{
D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
view->GetDesc(&dsvDesc);
- D3D11_TEXTURE2D_DESC texDesc;
- texture->GetDesc(&texDesc);
-
unsigned int mipSlice = 0;
unsigned int arraySlice = 0;
- unsigned int mipLevels = texDesc.MipLevels;
switch (dsvDesc.ViewDimension)
{
@@ -123,7 +163,7 @@ static unsigned int getDSVSubresourceIndex(ID3D11Texture2D *texture, ID3D11Depth
arraySlice = dsvDesc.Texture2DMSArray.FirstArraySlice;
break;
- case D3D11_RTV_DIMENSION_UNKNOWN:
+ case D3D11_DSV_DIMENSION_UNKNOWN:
UNIMPLEMENTED();
break;
@@ -132,16 +172,37 @@ static unsigned int getDSVSubresourceIndex(ID3D11Texture2D *texture, ID3D11Depth
break;
}
+ unsigned int mipLevels, samples;
+ getTextureProperties(resource, &mipLevels, &samples);
+
return D3D11CalcSubresource(mipSlice, arraySlice, mipLevels);
}
-RenderTarget11::RenderTarget11(Renderer *renderer, ID3D11RenderTargetView *rtv, ID3D11Texture2D *tex, ID3D11ShaderResourceView *srv, GLsizei width, GLsizei height)
+RenderTarget11::RenderTarget11(Renderer *renderer, ID3D11RenderTargetView *rtv, ID3D11Resource *resource,
+ ID3D11ShaderResourceView *srv, GLsizei width, GLsizei height, GLsizei depth)
{
mRenderer = Renderer11::makeRenderer11(renderer);
- mTexture = tex;
+
+ mTexture = resource;
+ if (mTexture)
+ {
+ mTexture->AddRef();
+ }
+
mRenderTarget = rtv;
+ if (mRenderTarget)
+ {
+ mRenderTarget->AddRef();
+ }
+
mDepthStencil = NULL;
+
mShaderResource = srv;
+ if (mShaderResource)
+ {
+ mShaderResource->AddRef();
+ }
+
mSubresourceIndex = 0;
if (mRenderTarget && mTexture)
@@ -149,26 +210,45 @@ RenderTarget11::RenderTarget11(Renderer *renderer, ID3D11RenderTargetView *rtv,
D3D11_RENDER_TARGET_VIEW_DESC desc;
mRenderTarget->GetDesc(&desc);
- D3D11_TEXTURE2D_DESC texDesc;
- mTexture->GetDesc(&texDesc);
+ unsigned int mipLevels, samples;
+ getTextureProperties(mTexture, &mipLevels, &samples);
mSubresourceIndex = getRTVSubresourceIndex(mTexture, mRenderTarget);
mWidth = width;
mHeight = height;
- mSamples = (texDesc.SampleDesc.Count > 1) ? texDesc.SampleDesc.Count : 0;
+ mDepth = depth;
+ mSamples = samples;
- mInternalFormat = d3d11_gl::ConvertTextureInternalFormat(desc.Format);
- mActualFormat = d3d11_gl::ConvertTextureInternalFormat(desc.Format);
+ mInternalFormat = d3d11_gl::GetInternalFormat(desc.Format, renderer->getCurrentClientVersion());
+ mActualFormat = d3d11_gl::GetInternalFormat(desc.Format, renderer->getCurrentClientVersion());
}
}
-RenderTarget11::RenderTarget11(Renderer *renderer, ID3D11DepthStencilView *dsv, ID3D11Texture2D *tex, ID3D11ShaderResourceView *srv, GLsizei width, GLsizei height)
+RenderTarget11::RenderTarget11(Renderer *renderer, ID3D11DepthStencilView *dsv, ID3D11Resource *resource,
+ ID3D11ShaderResourceView *srv, GLsizei width, GLsizei height, GLsizei depth)
{
mRenderer = Renderer11::makeRenderer11(renderer);
- mTexture = tex;
+
+ mTexture = resource;
+ if (mTexture)
+ {
+ mTexture->AddRef();
+ }
+
mRenderTarget = NULL;
+
mDepthStencil = dsv;
+ if (mDepthStencil)
+ {
+ mDepthStencil->AddRef();
+ }
+
mShaderResource = srv;
+ if (mShaderResource)
+ {
+ mShaderResource->AddRef();
+ }
+
mSubresourceIndex = 0;
if (mDepthStencil && mTexture)
@@ -176,20 +256,21 @@ RenderTarget11::RenderTarget11(Renderer *renderer, ID3D11DepthStencilView *dsv,
D3D11_DEPTH_STENCIL_VIEW_DESC desc;
mDepthStencil->GetDesc(&desc);
- D3D11_TEXTURE2D_DESC texDesc;
- mTexture->GetDesc(&texDesc);
+ unsigned int mipLevels, samples;
+ getTextureProperties(mTexture, &mipLevels, &samples);
mSubresourceIndex = getDSVSubresourceIndex(mTexture, mDepthStencil);
mWidth = width;
mHeight = height;
- mSamples = (texDesc.SampleDesc.Count > 1) ? texDesc.SampleDesc.Count : 0;
+ mDepth = depth;
+ mSamples = samples;
- mInternalFormat = d3d11_gl::ConvertTextureInternalFormat(desc.Format);
- mActualFormat = d3d11_gl::ConvertTextureInternalFormat(desc.Format);
+ mInternalFormat = d3d11_gl::GetInternalFormat(desc.Format, renderer->getCurrentClientVersion());
+ mActualFormat = d3d11_gl::GetInternalFormat(desc.Format, renderer->getCurrentClientVersion());
}
}
-RenderTarget11::RenderTarget11(Renderer *renderer, GLsizei width, GLsizei height, GLenum format, GLsizei samples, bool depth)
+RenderTarget11::RenderTarget11(Renderer *renderer, GLsizei width, GLsizei height, GLenum internalFormat, GLsizei samples)
{
mRenderer = Renderer11::makeRenderer11(renderer);
mTexture = NULL;
@@ -197,9 +278,15 @@ RenderTarget11::RenderTarget11(Renderer *renderer, GLsizei width, GLsizei height
mDepthStencil = NULL;
mShaderResource = NULL;
- DXGI_FORMAT requestedFormat = gl_d3d11::ConvertRenderbufferFormat(format);
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+
+ DXGI_FORMAT texFormat = gl_d3d11::GetTexFormat(internalFormat, clientVersion);
+ DXGI_FORMAT srvFormat = gl_d3d11::GetSRVFormat(internalFormat, clientVersion);
+ DXGI_FORMAT rtvFormat = gl_d3d11::GetRTVFormat(internalFormat, clientVersion);
+ DXGI_FORMAT dsvFormat = gl_d3d11::GetDSVFormat(internalFormat, clientVersion);
- int supportedSamples = mRenderer->getNearestSupportedSamples(requestedFormat, samples);
+ DXGI_FORMAT multisampleFormat = (dsvFormat != DXGI_FORMAT_UNKNOWN ? dsvFormat : rtvFormat);
+ int supportedSamples = mRenderer->getNearestSupportedSamples(multisampleFormat, samples);
if (supportedSamples < 0)
{
gl::error(GL_OUT_OF_MEMORY);
@@ -214,16 +301,35 @@ RenderTarget11::RenderTarget11(Renderer *renderer, GLsizei width, GLsizei height
desc.Height = height;
desc.MipLevels = 1;
desc.ArraySize = 1;
- desc.Format = requestedFormat;
+ desc.Format = texFormat;
desc.SampleDesc.Count = (supportedSamples == 0) ? 1 : supportedSamples;
desc.SampleDesc.Quality = 0;
desc.Usage = D3D11_USAGE_DEFAULT;
desc.CPUAccessFlags = 0;
desc.MiscFlags = 0;
- desc.BindFlags = (depth ? D3D11_BIND_DEPTH_STENCIL : (D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE));
+
+ // If a rendertarget or depthstencil format exists for this texture format,
+ // we'll flag it to allow binding that way. Shader resource views are a little
+ // more complicated.
+ bool bindRTV = false, bindDSV = false, bindSRV = false;
+ bindRTV = (rtvFormat != DXGI_FORMAT_UNKNOWN);
+ bindDSV = (dsvFormat != DXGI_FORMAT_UNKNOWN);
+ if (srvFormat != DXGI_FORMAT_UNKNOWN)
+ {
+ // Multisample targets flagged for binding as depth stencil cannot also be
+ // flagged for binding as SRV, so make certain not to add the SRV flag for
+ // these targets.
+ bindSRV = !(dsvFormat != DXGI_FORMAT_UNKNOWN && desc.SampleDesc.Count > 1);
+ }
+
+ desc.BindFlags = (bindRTV ? D3D11_BIND_RENDER_TARGET : 0) |
+ (bindDSV ? D3D11_BIND_DEPTH_STENCIL : 0) |
+ (bindSRV ? D3D11_BIND_SHADER_RESOURCE : 0);
ID3D11Device *device = mRenderer->getDevice();
- HRESULT result = device->CreateTexture2D(&desc, NULL, &mTexture);
+ ID3D11Texture2D *texture = NULL;
+ HRESULT result = device->CreateTexture2D(&desc, NULL, &texture);
+ mTexture = texture;
if (result == E_OUTOFMEMORY)
{
@@ -232,10 +338,28 @@ RenderTarget11::RenderTarget11(Renderer *renderer, GLsizei width, GLsizei height
}
ASSERT(SUCCEEDED(result));
- if (depth)
+ if (bindSRV)
+ {
+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+ srvDesc.Format = srvFormat;
+ srvDesc.ViewDimension = (supportedSamples == 0) ? D3D11_SRV_DIMENSION_TEXTURE2D : D3D11_SRV_DIMENSION_TEXTURE2DMS;
+ srvDesc.Texture2D.MostDetailedMip = 0;
+ srvDesc.Texture2D.MipLevels = 1;
+ result = device->CreateShaderResourceView(mTexture, &srvDesc, &mShaderResource);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ SafeRelease(mTexture);
+ gl::error(GL_OUT_OF_MEMORY);
+ return;
+ }
+ ASSERT(SUCCEEDED(result));
+ }
+
+ if (bindDSV)
{
D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
- dsvDesc.Format = requestedFormat;
+ dsvDesc.Format = dsvFormat;
dsvDesc.ViewDimension = (supportedSamples == 0) ? D3D11_DSV_DIMENSION_TEXTURE2D : D3D11_DSV_DIMENSION_TEXTURE2DMS;
dsvDesc.Texture2D.MipSlice = 0;
dsvDesc.Flags = 0;
@@ -243,82 +367,57 @@ RenderTarget11::RenderTarget11(Renderer *renderer, GLsizei width, GLsizei height
if (result == E_OUTOFMEMORY)
{
- mTexture->Release();
- mTexture = NULL;
+ SafeRelease(mTexture);
+ SafeRelease(mShaderResource);
gl::error(GL_OUT_OF_MEMORY);
+ return;
}
ASSERT(SUCCEEDED(result));
}
- else
+
+ if (bindRTV)
{
D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
- rtvDesc.Format = requestedFormat;
+ rtvDesc.Format = rtvFormat;
rtvDesc.ViewDimension = (supportedSamples == 0) ? D3D11_RTV_DIMENSION_TEXTURE2D : D3D11_RTV_DIMENSION_TEXTURE2DMS;
rtvDesc.Texture2D.MipSlice = 0;
result = device->CreateRenderTargetView(mTexture, &rtvDesc, &mRenderTarget);
if (result == E_OUTOFMEMORY)
{
- mTexture->Release();
- mTexture = NULL;
+ SafeRelease(mTexture);
+ SafeRelease(mShaderResource);
+ SafeRelease(mDepthStencil);
gl::error(GL_OUT_OF_MEMORY);
return;
}
ASSERT(SUCCEEDED(result));
- D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
- srvDesc.Format = requestedFormat;
- srvDesc.ViewDimension = (supportedSamples == 0) ? D3D11_SRV_DIMENSION_TEXTURE2D : D3D11_SRV_DIMENSION_TEXTURE2DMS;
- srvDesc.Texture2D.MostDetailedMip = 0;
- srvDesc.Texture2D.MipLevels = 1;
- result = device->CreateShaderResourceView(mTexture, &srvDesc, &mShaderResource);
-
- if (result == E_OUTOFMEMORY)
+ if (gl_d3d11::RequiresTextureDataInitialization(internalFormat))
{
- mTexture->Release();
- mTexture = NULL;
- mRenderTarget->Release();
- mRenderTarget = NULL;
- gl::error(GL_OUT_OF_MEMORY);
- return;
+ ID3D11DeviceContext *context = mRenderer->getDeviceContext();
+
+ const float clearValues[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
+ context->ClearRenderTargetView(mRenderTarget, clearValues);
}
- ASSERT(SUCCEEDED(result));
}
}
mWidth = width;
mHeight = height;
- mInternalFormat = format;
+ mDepth = 1;
+ mInternalFormat = internalFormat;
mSamples = supportedSamples;
- mActualFormat = d3d11_gl::ConvertTextureInternalFormat(requestedFormat);
+ mActualFormat = d3d11_gl::GetInternalFormat(texFormat, renderer->getCurrentClientVersion());
mSubresourceIndex = D3D11CalcSubresource(0, 0, 1);
}
RenderTarget11::~RenderTarget11()
{
- if (mTexture)
- {
- mTexture->Release();
- mTexture = NULL;
- }
-
- if (mRenderTarget)
- {
- mRenderTarget->Release();
- mRenderTarget = NULL;
- }
-
- if (mDepthStencil)
- {
- mDepthStencil->Release();
- mDepthStencil = NULL;
- }
-
- if (mShaderResource)
- {
- mShaderResource->Release();
- mShaderResource = NULL;
- }
+ SafeRelease(mTexture);
+ SafeRelease(mRenderTarget);
+ SafeRelease(mDepthStencil);
+ SafeRelease(mShaderResource);
}
RenderTarget11 *RenderTarget11::makeRenderTarget11(RenderTarget *target)
@@ -327,7 +426,12 @@ RenderTarget11 *RenderTarget11::makeRenderTarget11(RenderTarget *target)
return static_cast<rx::RenderTarget11*>(target);
}
-ID3D11Texture2D *RenderTarget11::getTexture() const
+void RenderTarget11::invalidate(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ // Currently a no-op
+}
+
+ID3D11Resource *RenderTarget11::getTexture() const
{
return mTexture;
}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/RenderTarget11.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/RenderTarget11.h
index 97827f26397..ba9f76e5dec 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/RenderTarget11.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/RenderTarget11.h
@@ -20,14 +20,17 @@ class Renderer11;
class RenderTarget11 : public RenderTarget
{
public:
- RenderTarget11(Renderer *renderer, ID3D11RenderTargetView *rtv, ID3D11Texture2D *tex, ID3D11ShaderResourceView *srv, GLsizei width, GLsizei height);
- RenderTarget11(Renderer *renderer, ID3D11DepthStencilView *dsv, ID3D11Texture2D *tex, ID3D11ShaderResourceView *srv, GLsizei width, GLsizei height);
- RenderTarget11(Renderer *renderer, GLsizei width, GLsizei height, GLenum format, GLsizei samples, bool depth);
+ // RenderTarget11 takes ownership of any D3D11 resources it is given and will AddRef them
+ RenderTarget11(Renderer *renderer, ID3D11RenderTargetView *rtv, ID3D11Resource *resource, ID3D11ShaderResourceView *srv, GLsizei width, GLsizei height, GLsizei depth);
+ RenderTarget11(Renderer *renderer, ID3D11DepthStencilView *dsv, ID3D11Resource *resource, ID3D11ShaderResourceView *srv, GLsizei width, GLsizei height, GLsizei depth);
+ RenderTarget11(Renderer *renderer, GLsizei width, GLsizei height, GLenum internalFormat, GLsizei samples);
virtual ~RenderTarget11();
static RenderTarget11 *makeRenderTarget11(RenderTarget *renderTarget);
- ID3D11Texture2D *getTexture() const;
+ virtual void invalidate(GLint x, GLint y, GLsizei width, GLsizei height);
+
+ ID3D11Resource *getTexture() const;
ID3D11RenderTargetView *getRenderTargetView() const;
ID3D11DepthStencilView *getDepthStencilView() const;
ID3D11ShaderResourceView *getShaderResourceView() const;
@@ -38,7 +41,7 @@ class RenderTarget11 : public RenderTarget
DISALLOW_COPY_AND_ASSIGN(RenderTarget11);
unsigned int mSubresourceIndex;
- ID3D11Texture2D *mTexture;
+ ID3D11Resource *mTexture;
ID3D11RenderTargetView *mRenderTarget;
ID3D11DepthStencilView *mDepthStencil;
ID3D11ShaderResourceView *mShaderResource;
@@ -48,4 +51,4 @@ class RenderTarget11 : public RenderTarget
}
-#endif LIBGLESV2_RENDERER_RENDERTARGET11_H_ \ No newline at end of file
+#endif LIBGLESV2_RENDERER_RENDERTARGET11_H_
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/Renderer11.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Renderer11.cpp
index 13ba355d582..c0ad111e8a9 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/Renderer11.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Renderer11.cpp
@@ -1,6 +1,6 @@
#include "precompiled.h"
//
-// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2012-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -8,38 +8,37 @@
// Renderer11.cpp: Implements a back-end specific class for the D3D11 renderer.
#include "libGLESv2/main.h"
-#include "libGLESv2/utilities.h"
+#include "common/utilities.h"
#include "libGLESv2/Buffer.h"
#include "libGLESv2/ProgramBinary.h"
#include "libGLESv2/Framebuffer.h"
-#include "libGLESv2/Renderbuffer.h"
-#include "libGLESv2/renderer/Renderer11.h"
-#include "libGLESv2/renderer/RenderTarget11.h"
-#include "libGLESv2/renderer/renderer11_utils.h"
-#include "libGLESv2/renderer/ShaderExecutable11.h"
-#include "libGLESv2/renderer/SwapChain11.h"
-#include "libGLESv2/renderer/Image11.h"
-#include "libGLESv2/renderer/VertexBuffer11.h"
-#include "libGLESv2/renderer/IndexBuffer11.h"
-#include "libGLESv2/renderer/BufferStorage11.h"
+#include "libGLESv2/RenderBuffer.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
+#include "libGLESv2/renderer/d3d11/RenderTarget11.h"
+#include "libGLESv2/renderer/d3d11/renderer11_utils.h"
+#include "libGLESv2/renderer/d3d11/formatutils11.h"
+#include "libGLESv2/renderer/d3d11/ShaderExecutable11.h"
+#include "libGLESv2/renderer/d3d11/SwapChain11.h"
+#include "libGLESv2/renderer/d3d11/Image11.h"
+#include "libGLESv2/renderer/d3d11/VertexBuffer11.h"
+#include "libGLESv2/renderer/d3d11/IndexBuffer11.h"
+#include "libGLESv2/renderer/d3d11/BufferStorage11.h"
#include "libGLESv2/renderer/VertexDataManager.h"
#include "libGLESv2/renderer/IndexDataManager.h"
-#include "libGLESv2/renderer/TextureStorage11.h"
-#include "libGLESv2/renderer/Query11.h"
-#include "libGLESv2/renderer/Fence11.h"
-
-#include "libGLESv2/renderer/shaders/compiled/passthrough11vs.h"
-#include "libGLESv2/renderer/shaders/compiled/passthroughrgba11ps.h"
-#include "libGLESv2/renderer/shaders/compiled/passthroughrgb11ps.h"
-#include "libGLESv2/renderer/shaders/compiled/passthroughlum11ps.h"
-#include "libGLESv2/renderer/shaders/compiled/passthroughlumalpha11ps.h"
-
-#include "libGLESv2/renderer/shaders/compiled/clear11vs.h"
-#include "libGLESv2/renderer/shaders/compiled/clearsingle11ps.h"
-#include "libGLESv2/renderer/shaders/compiled/clearmultiple11ps.h"
-
+#include "libGLESv2/renderer/d3d11/TextureStorage11.h"
+#include "libGLESv2/renderer/d3d11/Query11.h"
+#include "libGLESv2/renderer/d3d11/Fence11.h"
+#include "libGLESv2/renderer/d3d11/Blit11.h"
+#include "libGLESv2/renderer/d3d11/Clear11.h"
+#include "libGLESv2/renderer/d3d11/PixelTransfer11.h"
#include "libEGL/Display.h"
+// Enable ANGLE_SKIP_DXGI_1_2_CHECK if there is not a possibility of using cross-process
+// HWNDs or the Windows 7 Platform Update (KB2670838) is expected to be installed.
+#ifndef ANGLE_SKIP_DXGI_1_2_CHECK
+#define ANGLE_SKIP_DXGI_1_2_CHECK 0
+#endif
+
#ifdef _DEBUG
// this flag enables suppressing some spurious warnings that pop up in certain WebGL samples
// and conformance tests. to enable all warnings, remove this define.
@@ -74,24 +73,10 @@ Renderer11::Renderer11(egl::Display *display, HDC hDc) : Renderer(display), mDc(
mLineLoopIB = NULL;
mTriangleFanIB = NULL;
- mCopyResourcesInitialized = false;
- mCopyVB = NULL;
- mCopySampler = NULL;
- mCopyIL = NULL;
- mCopyVS = NULL;
- mCopyRGBAPS = NULL;
- mCopyRGBPS = NULL;
- mCopyLumPS = NULL;
- mCopyLumAlphaPS = NULL;
-
- mClearResourcesInitialized = false;
- mClearVB = NULL;
- mClearIL = NULL;
- mClearVS = NULL;
- mClearSinglePS = NULL;
- mClearMultiplePS = NULL;
- mClearScissorRS = NULL;
- mClearNoScissorRS = NULL;
+ mBlit = NULL;
+ mPixelTransfer = NULL;
+
+ mClear = NULL;
mSyncQuery = NULL;
@@ -112,7 +97,10 @@ Renderer11::Renderer11(egl::Display *display, HDC hDc) : Renderer(display), mDc(
mBGRATextureSupport = false;
- mIsGeometryShaderActive = false;
+ mAppliedVertexShader = NULL;
+ mAppliedGeometryShader = NULL;
+ mCurPointGeometryShader = NULL;
+ mAppliedPixelShader = NULL;
}
Renderer11::~Renderer11()
@@ -132,7 +120,7 @@ Renderer11 *Renderer11::makeRenderer11(Renderer *renderer)
EGLint Renderer11::initialize()
{
- if (!initializeCompiler())
+ if (!mCompiler.initialize())
{
return EGL_NOT_INITIALIZED;
}
@@ -203,6 +191,36 @@ EGLint Renderer11::initialize()
}
}
+#if !ANGLE_SKIP_DXGI_1_2_CHECK
+ // In order to create a swap chain for an HWND owned by another process, DXGI 1.2 is required.
+ // The easiest way to check is to query for a IDXGIDevice2.
+ bool requireDXGI1_2 = false;
+ HWND hwnd = WindowFromDC(mDc);
+ if (hwnd)
+ {
+ DWORD currentProcessId = GetCurrentProcessId();
+ DWORD wndProcessId;
+ GetWindowThreadProcessId(hwnd, &wndProcessId);
+ requireDXGI1_2 = (currentProcessId != wndProcessId);
+ }
+ else
+ {
+ requireDXGI1_2 = true;
+ }
+
+ if (requireDXGI1_2)
+ {
+ IDXGIDevice2 *dxgiDevice2 = NULL;
+ result = mDevice->QueryInterface(__uuidof(IDXGIDevice2), (void**)&dxgiDevice2);
+ if (FAILED(result))
+ {
+ ERR("DXGI 1.2 required to present to HWNDs owned by another process.\n");
+ return EGL_NOT_INITIALIZED;
+ }
+ SafeRelease(dxgiDevice2);
+ }
+#endif
+
IDXGIDevice *dxgiDevice = NULL;
result = mDevice->QueryInterface(__uuidof(IDXGIDevice), (void**)&dxgiDevice);
@@ -220,7 +238,7 @@ EGLint Renderer11::initialize()
return EGL_NOT_INITIALIZED;
}
- dxgiDevice->Release();
+ SafeRelease(dxgiDevice);
mDxgiAdapter->GetDesc(&mAdapterDescription);
memset(mDescription, 0, sizeof(mDescription));
@@ -251,43 +269,19 @@ EGLint Renderer11::initialize()
filter.DenyList.pIDList = hideMessages;
infoQueue->AddStorageFilterEntries(&filter);
-
- infoQueue->Release();
+ SafeRelease(infoQueue);
}
#endif
- unsigned int maxSupportedSamples = 0;
- unsigned int rtFormatCount = ArraySize(RenderTargetFormats);
- unsigned int dsFormatCount = ArraySize(DepthStencilFormats);
- for (unsigned int i = 0; i < rtFormatCount + dsFormatCount; ++i)
- {
- DXGI_FORMAT format = (i < rtFormatCount) ? RenderTargetFormats[i] : DepthStencilFormats[i - rtFormatCount];
- if (format != DXGI_FORMAT_UNKNOWN)
- {
- UINT formatSupport;
- result = mDevice->CheckFormatSupport(format, &formatSupport);
- if (SUCCEEDED(result) && (formatSupport & D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET))
- {
- MultisampleSupportInfo supportInfo;
-
- for (unsigned int j = 1; j <= D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT; j++)
- {
- result = mDevice->CheckMultisampleQualityLevels(format, j, &supportInfo.qualityLevels[j - 1]);
- if (SUCCEEDED(result) && supportInfo.qualityLevels[j - 1] > 0)
- {
- maxSupportedSamples = std::max(j, maxSupportedSamples);
- }
- else
- {
- supportInfo.qualityLevels[j - 1] = 0;
- }
- }
+ mMaxSupportedSamples = 0;
- mMultisampleSupportMap.insert(std::make_pair(format, supportInfo));
- }
- }
+ const d3d11::DXGIFormatSet &dxgiFormats = d3d11::GetAllUsedDXGIFormats();
+ for (d3d11::DXGIFormatSet::const_iterator i = dxgiFormats.begin(); i != dxgiFormats.end(); ++i)
+ {
+ MultisampleSupportInfo support = getMultisampleSupportInfo(*i);
+ mMultisampleSupportMap.insert(std::make_pair(*i, support));
+ mMaxSupportedSamples = std::max(mMaxSupportedSamples, support.maxSupportedSamples);
}
- mMaxSupportedSamples = maxSupportedSamples;
initializeDevice();
@@ -361,6 +355,31 @@ EGLint Renderer11::initialize()
}
}
+ DXGI_FORMAT rgTextureFormats[] =
+ {
+ DXGI_FORMAT_R8_UNORM,
+ DXGI_FORMAT_R8G8_UNORM,
+ DXGI_FORMAT_R16_FLOAT,
+ DXGI_FORMAT_R16G16_FLOAT,
+ DXGI_FORMAT_R32_FLOAT,
+ DXGI_FORMAT_R32G32_FLOAT,
+ };
+
+ mRGTextureSupport = true;
+ for (unsigned int i = 0; i < ArraySize(rgTextureFormats); i++)
+ {
+ if (SUCCEEDED(mDevice->CheckFormatSupport(rgTextureFormats[i], &formatSupport)))
+ {
+ mRGTextureSupport = mRGTextureSupport && (formatSupport & requiredTextureFlags) == requiredTextureFlags;
+ mRGTextureSupport = mRGTextureSupport && (formatSupport & requiredFilterFlags) == requiredFilterFlags;
+ mRGTextureSupport = mRGTextureSupport && (formatSupport & requiredRenderableFlags) == requiredRenderableFlags;
+ }
+ else
+ {
+ mRGTextureSupport = false;
+ }
+ }
+
// Check compressed texture support
const unsigned int requiredCompressedTextureFlags = D3D11_FORMAT_SUPPORT_TEXTURE2D;
@@ -429,6 +448,15 @@ void Renderer11::initializeDevice()
mVertexDataManager = new VertexDataManager(this);
mIndexDataManager = new IndexDataManager(this);
+ ASSERT(!mBlit);
+ mBlit = new Blit11(this);
+
+ ASSERT(!mClear);
+ mClear = new Clear11(this);
+
+ ASSERT(!mPixelTransfer);
+ mPixelTransfer = new PixelTransfer11(this);
+
markAllStateDirty();
}
@@ -456,18 +484,23 @@ int Renderer11::generateConfigs(ConfigDesc **configDescList)
if (depthStencilFormat != DXGI_FORMAT_UNKNOWN)
{
- UINT formatSupport = 0;
- result = mDevice->CheckFormatSupport(depthStencilFormat, &formatSupport);
- depthStencilFormatOK = SUCCEEDED(result) && (formatSupport & D3D11_FORMAT_SUPPORT_DEPTH_STENCIL);
+ UINT depthStencilSupport = 0;
+ result = mDevice->CheckFormatSupport(depthStencilFormat, &depthStencilSupport);
+ depthStencilFormatOK = SUCCEEDED(result) && (depthStencilSupport & D3D11_FORMAT_SUPPORT_DEPTH_STENCIL);
}
if (depthStencilFormatOK)
{
+ // FIXME: parse types from context version
+ ASSERT(d3d11_gl::GetInternalFormat(renderTargetFormat, 2) == d3d11_gl::GetInternalFormat(renderTargetFormat, 3));
+ ASSERT(d3d11_gl::GetInternalFormat(depthStencilFormat, 2) == d3d11_gl::GetInternalFormat(depthStencilFormat, 3));
+
ConfigDesc newConfig;
- newConfig.renderTargetFormat = d3d11_gl::ConvertBackBufferFormat(renderTargetFormat);
- newConfig.depthStencilFormat = d3d11_gl::ConvertDepthStencilFormat(depthStencilFormat);
+ newConfig.renderTargetFormat = d3d11_gl::GetInternalFormat(renderTargetFormat, getCurrentClientVersion());
+ newConfig.depthStencilFormat = d3d11_gl::GetInternalFormat(depthStencilFormat, getCurrentClientVersion());
newConfig.multiSample = 0; // FIXME: enumerate multi-sampling
newConfig.fastConfig = true; // Assume all DX11 format conversions to be fast
+ newConfig.es3Capable = true;
(*configDescList)[numConfigs++] = newConfig;
}
@@ -527,6 +560,21 @@ SwapChain *Renderer11::createSwapChain(HWND window, HANDLE shareHandle, GLenum b
return new rx::SwapChain11(this, window, shareHandle, backBufferFormat, depthBufferFormat);
}
+void Renderer11::generateSwizzle(gl::Texture *texture)
+{
+ if (texture)
+ {
+ TextureStorageInterface *texStorage = texture->getNativeTexture();
+ if (texStorage)
+ {
+ TextureStorage11 *storage11 = TextureStorage11::makeTextureStorage11(texStorage->getStorageInstance());
+
+ storage11->generateSwizzles(texture->getSwizzleRed(), texture->getSwizzleGreen(), texture->getSwizzleBlue(),
+ texture->getSwizzleAlpha());
+ }
+ }
+}
+
void Renderer11::setSamplerState(gl::SamplerType type, int index, const gl::SamplerState &samplerState)
{
if (type == gl::SAMPLER_PIXEL)
@@ -585,7 +633,6 @@ void Renderer11::setSamplerState(gl::SamplerType type, int index, const gl::Samp
void Renderer11::setTexture(gl::SamplerType type, int index, gl::Texture *texture)
{
ID3D11ShaderResourceView *textureSRV = NULL;
- unsigned int serial = 0;
bool forceSetTexture = false;
if (texture)
@@ -594,14 +641,15 @@ void Renderer11::setTexture(gl::SamplerType type, int index, gl::Texture *textur
if (texStorage)
{
TextureStorage11 *storage11 = TextureStorage11::makeTextureStorage11(texStorage->getStorageInstance());
- textureSRV = storage11->getSRV();
+ gl::SamplerState samplerState;
+ texture->getSamplerState(&samplerState);
+ textureSRV = storage11->getSRV(samplerState);
}
// If we get NULL back from getSRV here, something went wrong in the texture class and we're unexpectedly
// missing the shader resource view
ASSERT(textureSRV != NULL);
- serial = texture->getTextureSerial();
forceSetTexture = texture->hasDirtyImages();
}
@@ -613,12 +661,12 @@ void Renderer11::setTexture(gl::SamplerType type, int index, gl::Texture *textur
return;
}
- if (forceSetTexture || mCurPixelTextureSerials[index] != serial)
+ if (forceSetTexture || mCurPixelSRVs[index] != textureSRV)
{
mDeviceContext->PSSetShaderResources(index, 1, &textureSRV);
}
- mCurPixelTextureSerials[index] = serial;
+ mCurPixelSRVs[index] = textureSRV;
}
else if (type == gl::SAMPLER_VERTEX)
{
@@ -628,22 +676,70 @@ void Renderer11::setTexture(gl::SamplerType type, int index, gl::Texture *textur
return;
}
- if (forceSetTexture || mCurVertexTextureSerials[index] != serial)
+ if (forceSetTexture || mCurVertexSRVs[index] != textureSRV)
{
mDeviceContext->VSSetShaderResources(index, 1, &textureSRV);
}
- mCurVertexTextureSerials[index] = serial;
+ mCurVertexSRVs[index] = textureSRV;
}
else UNREACHABLE();
}
+bool Renderer11::setUniformBuffers(const gl::Buffer *vertexUniformBuffers[], const gl::Buffer *fragmentUniformBuffers[])
+{
+ for (unsigned int uniformBufferIndex = 0; uniformBufferIndex < gl::IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS; uniformBufferIndex++)
+ {
+ const gl::Buffer *uniformBuffer = vertexUniformBuffers[uniformBufferIndex];
+ if (uniformBuffer)
+ {
+ BufferStorage11 *bufferStorage = BufferStorage11::makeBufferStorage11(uniformBuffer->getStorage());
+ ID3D11Buffer *constantBuffer = bufferStorage->getBuffer(BUFFER_USAGE_UNIFORM);
+
+ if (!constantBuffer)
+ {
+ return false;
+ }
+
+ if (mCurrentConstantBufferVS[uniformBufferIndex] != bufferStorage->getSerial())
+ {
+ mDeviceContext->VSSetConstantBuffers(getReservedVertexUniformBuffers() + uniformBufferIndex,
+ 1, &constantBuffer);
+ mCurrentConstantBufferVS[uniformBufferIndex] = bufferStorage->getSerial();
+ }
+ }
+ }
+
+ for (unsigned int uniformBufferIndex = 0; uniformBufferIndex < gl::IMPLEMENTATION_MAX_FRAGMENT_SHADER_UNIFORM_BUFFERS; uniformBufferIndex++)
+ {
+ const gl::Buffer *uniformBuffer = fragmentUniformBuffers[uniformBufferIndex];
+ if (uniformBuffer)
+ {
+ BufferStorage11 *bufferStorage = BufferStorage11::makeBufferStorage11(uniformBuffer->getStorage());
+ ID3D11Buffer *constantBuffer = bufferStorage->getBuffer(BUFFER_USAGE_UNIFORM);
+
+ if (!constantBuffer)
+ {
+ return false;
+ }
+
+ if (mCurrentConstantBufferPS[uniformBufferIndex] != bufferStorage->getSerial())
+ {
+ mDeviceContext->PSSetConstantBuffers(getReservedFragmentUniformBuffers() + uniformBufferIndex,
+ 1, &constantBuffer);
+ mCurrentConstantBufferPS[uniformBufferIndex] = bufferStorage->getSerial();
+ }
+ }
+ }
+
+ return true;
+}
+
void Renderer11::setRasterizerState(const gl::RasterizerState &rasterState)
{
if (mForceSetRasterState || memcmp(&rasterState, &mCurRasterState, sizeof(gl::RasterizerState)) != 0)
{
- ID3D11RasterizerState *dxRasterState = mStateCache.getRasterizerState(rasterState, mScissorEnabled,
- mCurDepthSize);
+ ID3D11RasterizerState *dxRasterState = mStateCache.getRasterizerState(rasterState, mScissorEnabled);
if (!dxRasterState)
{
ERR("NULL rasterizer state returned by RenderStateCache::getRasterizerState, setting the default"
@@ -658,15 +754,15 @@ void Renderer11::setRasterizerState(const gl::RasterizerState &rasterState)
mForceSetRasterState = false;
}
-void Renderer11::setBlendState(const gl::BlendState &blendState, const gl::Color &blendColor,
+void Renderer11::setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState, const gl::ColorF &blendColor,
unsigned int sampleMask)
{
if (mForceSetBlendState ||
memcmp(&blendState, &mCurBlendState, sizeof(gl::BlendState)) != 0 ||
- memcmp(&blendColor, &mCurBlendColor, sizeof(gl::Color)) != 0 ||
+ memcmp(&blendColor, &mCurBlendColor, sizeof(gl::ColorF)) != 0 ||
sampleMask != mCurSampleMask)
{
- ID3D11BlendState *dxBlendState = mStateCache.getBlendState(blendState);
+ ID3D11BlendState *dxBlendState = mStateCache.getBlendState(framebuffer, blendState);
if (!dxBlendState)
{
ERR("NULL blend state returned by RenderStateCache::getBlendState, setting the default "
@@ -723,7 +819,13 @@ void Renderer11::setDepthStencilState(const gl::DepthStencilState &depthStencilS
"setting the default depth stencil state.");
}
- mDeviceContext->OMSetDepthStencilState(dxDepthStencilState, static_cast<UINT>(stencilRef));
+ // Max D3D11 stencil reference value is 0xFF, corresponding to the max 8 bits in a stencil buffer
+ // GL specifies we should clamp the ref value to the nearest bit depth when doing stencil ops
+ META_ASSERT(D3D11_DEFAULT_STENCIL_READ_MASK == 0xFF);
+ META_ASSERT(D3D11_DEFAULT_STENCIL_WRITE_MASK == 0xFF);
+ UINT dxStencilRef = std::min<UINT>(stencilRef, 0xFFu);
+
+ mDeviceContext->OMSetDepthStencilState(dxDepthStencilState, dxStencilRef);
mCurDepthStencilState = depthStencilState;
mCurStencilRef = stencilRef;
@@ -877,7 +979,7 @@ bool Renderer11::applyRenderTarget(gl::Framebuffer *framebuffer)
// the draw buffer must be either "none", "back" for the default buffer or the same index as this color (in order)
ASSERT(drawBufferState == GL_BACK || drawBufferState == (GL_COLOR_ATTACHMENT0_EXT + colorAttachment));
- gl::Renderbuffer *colorbuffer = framebuffer->getColorbuffer(colorAttachment);
+ gl::FramebufferAttachment *colorbuffer = framebuffer->getColorbuffer(colorAttachment);
if (!colorbuffer)
{
@@ -918,29 +1020,13 @@ bool Renderer11::applyRenderTarget(gl::Framebuffer *framebuffer)
missingColorRenderTarget = false;
}
-#ifdef _DEBUG
- // Workaround for Debug SETSHADERRESOURCES_HAZARD D3D11 warnings
- for (unsigned int vertexSerialIndex = 0; vertexSerialIndex < gl::IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS; vertexSerialIndex++)
- {
- if (colorbuffer->getTextureSerial() != 0 && mCurVertexTextureSerials[vertexSerialIndex] == colorbuffer->getTextureSerial())
- {
- setTexture(gl::SAMPLER_VERTEX, vertexSerialIndex, NULL);
- }
- }
-
- for (unsigned int pixelSerialIndex = 0; pixelSerialIndex < gl::MAX_TEXTURE_IMAGE_UNITS; pixelSerialIndex++)
- {
- if (colorbuffer->getTextureSerial() != 0 && mCurPixelTextureSerials[pixelSerialIndex] == colorbuffer->getTextureSerial())
- {
- setTexture(gl::SAMPLER_PIXEL, pixelSerialIndex, NULL);
- }
- }
-#endif
+ // TODO: Detect if this color buffer is already bound as a texture and unbind it first to prevent
+ // D3D11 warnings.
}
}
// Get the depth stencil render buffer and serials
- gl::Renderbuffer *depthStencil = NULL;
+ gl::FramebufferAttachment *depthStencil = NULL;
unsigned int depthbufferSerial = 0;
unsigned int stencilbufferSerial = 0;
if (framebuffer->getDepthbufferType() != GL_NONE)
@@ -968,9 +1054,6 @@ bool Renderer11::applyRenderTarget(gl::Framebuffer *framebuffer)
stencilbufferSerial = depthStencil->getSerial();
}
- // Extract the depth stencil sizes and view
- unsigned int depthSize = 0;
- unsigned int stencilSize = 0;
ID3D11DepthStencilView* framebufferDSV = NULL;
if (depthStencil)
{
@@ -998,9 +1081,6 @@ bool Renderer11::applyRenderTarget(gl::Framebuffer *framebuffer)
renderTargetHeight = depthStencil->getHeight();
renderTargetFormat = depthStencil->getActualFormat();
}
-
- depthSize = depthStencil->getDepthSize();
- stencilSize = depthStencil->getStencilSize();
}
// Apply the render target and depth stencil
@@ -1016,15 +1096,13 @@ bool Renderer11::applyRenderTarget(gl::Framebuffer *framebuffer)
mRenderTargetDesc.format = renderTargetFormat;
mForceSetViewport = true;
mForceSetScissor = true;
+ mForceSetBlendState = true;
- if (!mDepthStencilInitialized || depthSize != mCurDepthSize)
+ if (!mDepthStencilInitialized)
{
- mCurDepthSize = depthSize;
mForceSetRasterState = true;
}
- mCurStencilSize = stencilSize;
-
for (unsigned int rtIndex = 0; rtIndex < gl::IMPLEMENTATION_MAX_DRAW_BUFFERS; rtIndex++)
{
mAppliedRenderTargetSerials[rtIndex] = renderTargetSerials[rtIndex];
@@ -1035,13 +1113,16 @@ bool Renderer11::applyRenderTarget(gl::Framebuffer *framebuffer)
mDepthStencilInitialized = true;
}
+ invalidateFramebufferSwizzles(framebuffer);
+
return true;
}
-GLenum Renderer11::applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances)
+GLenum Renderer11::applyVertexBuffer(gl::ProgramBinary *programBinary, const gl::VertexAttribute vertexAttributes[], gl::VertexAttribCurrentValueData currentValues[],
+ GLint first, GLsizei count, GLsizei instances)
{
TranslatedAttribute attributes[gl::MAX_VERTEX_ATTRIBS];
- GLenum err = mVertexDataManager->prepareVertexData(vertexAttributes, programBinary, first, count, attributes, instances);
+ GLenum err = mVertexDataManager->prepareVertexData(vertexAttributes, currentValues, programBinary, first, count, attributes, instances);
if (err != GL_NO_ERROR)
{
return err;
@@ -1056,28 +1137,27 @@ GLenum Renderer11::applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementAr
if (err == GL_NO_ERROR)
{
- if (indexInfo->storage)
- {
- if (indexInfo->serial != mAppliedStorageIBSerial || indexInfo->startOffset != mAppliedIBOffset)
- {
- BufferStorage11 *storage = BufferStorage11::makeBufferStorage11(indexInfo->storage);
- IndexBuffer11* indexBuffer = IndexBuffer11::makeIndexBuffer11(indexInfo->indexBuffer);
+ IndexBuffer11* indexBuffer = IndexBuffer11::makeIndexBuffer11(indexInfo->indexBuffer);
- mDeviceContext->IASetIndexBuffer(storage->getBuffer(), indexBuffer->getIndexFormat(), indexInfo->startOffset);
+ ID3D11Buffer *buffer = NULL;
+ DXGI_FORMAT bufferFormat = indexBuffer->getIndexFormat();
- mAppliedIBSerial = 0;
- mAppliedStorageIBSerial = storage->getSerial();
- mAppliedIBOffset = indexInfo->startOffset;
- }
+ if (indexInfo->storage)
+ {
+ BufferStorage11 *storage = BufferStorage11::makeBufferStorage11(indexInfo->storage);
+ buffer = storage->getBuffer(BUFFER_USAGE_INDEX);
}
- else if (indexInfo->serial != mAppliedIBSerial || indexInfo->startOffset != mAppliedIBOffset)
+ else
{
- IndexBuffer11* indexBuffer = IndexBuffer11::makeIndexBuffer11(indexInfo->indexBuffer);
+ buffer = indexBuffer->getBuffer();
+ }
- mDeviceContext->IASetIndexBuffer(indexBuffer->getBuffer(), indexBuffer->getIndexFormat(), indexInfo->startOffset);
+ if (buffer != mAppliedIB || bufferFormat != mAppliedIBFormat || indexInfo->startOffset != mAppliedIBOffset)
+ {
+ mDeviceContext->IASetIndexBuffer(buffer, bufferFormat, indexInfo->startOffset);
- mAppliedIBSerial = indexInfo->serial;
- mAppliedStorageIBSerial = 0;
+ mAppliedIB = buffer;
+ mAppliedIBFormat = bufferFormat;
mAppliedIBOffset = indexInfo->startOffset;
}
}
@@ -1085,9 +1165,79 @@ GLenum Renderer11::applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementAr
return err;
}
-void Renderer11::drawArrays(GLenum mode, GLsizei count, GLsizei instances)
+void Renderer11::applyTransformFeedbackBuffers(gl::Buffer *transformFeedbackBuffers[], GLintptr offsets[])
{
- if (mode == GL_LINE_LOOP)
+ ID3D11Buffer* d3dBuffers[gl::IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS];
+ UINT d3dOffsets[gl::IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS];
+ bool requiresUpdate = false;
+ for (size_t i = 0; i < gl::IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS; i++)
+ {
+ if (transformFeedbackBuffers[i])
+ {
+ BufferStorage11 *storage = BufferStorage11::makeBufferStorage11(transformFeedbackBuffers[i]->getStorage());
+ ID3D11Buffer *buffer = storage->getBuffer(BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK);
+
+ d3dBuffers[i] = buffer;
+ d3dOffsets[i] = (mAppliedTFBuffers[i] != buffer) ? static_cast<UINT>(offsets[i]) : -1;
+ }
+ else
+ {
+ d3dBuffers[i] = NULL;
+ d3dOffsets[i] = 0;
+ }
+
+ if (d3dBuffers[i] != mAppliedTFBuffers[i] || offsets[i] != mAppliedTFOffsets[i])
+ {
+ requiresUpdate = true;
+ }
+ }
+
+ if (requiresUpdate)
+ {
+ mDeviceContext->SOSetTargets(ArraySize(d3dBuffers), d3dBuffers, d3dOffsets);
+ for (size_t i = 0; i < gl::IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS; i++)
+ {
+ mAppliedTFBuffers[i] = d3dBuffers[i];
+ mAppliedTFOffsets[i] = offsets[i];
+ }
+ }
+}
+
+void Renderer11::drawArrays(GLenum mode, GLsizei count, GLsizei instances, bool transformFeedbackActive)
+{
+ if (mode == GL_POINTS && transformFeedbackActive)
+ {
+ // Since point sprites are generated with a geometry shader, too many vertices will
+ // be written if transform feedback is active. To work around this, draw only the points
+ // with the stream out shader and no pixel shader to feed the stream out buffers and then
+ // draw again with the point sprite geometry shader to rasterize the point sprites.
+
+ mDeviceContext->PSSetShader(NULL, NULL, 0);
+
+ if (instances > 0)
+ {
+ mDeviceContext->DrawInstanced(count, instances, 0, 0);
+ }
+ else
+ {
+ mDeviceContext->Draw(count, 0);
+ }
+
+ mDeviceContext->GSSetShader(mCurPointGeometryShader, NULL, 0);
+ mDeviceContext->PSSetShader(mAppliedPixelShader, NULL, 0);
+
+ if (instances > 0)
+ {
+ mDeviceContext->DrawInstanced(count, instances, 0, 0);
+ }
+ else
+ {
+ mDeviceContext->Draw(count, 0);
+ }
+
+ mDeviceContext->GSSetShader(mAppliedGeometryShader, NULL, 0);
+ }
+ else if (mode == GL_LINE_LOOP)
{
drawLineLoop(count, GL_NONE, NULL, 0, NULL);
}
@@ -1105,7 +1255,8 @@ void Renderer11::drawArrays(GLenum mode, GLsizei count, GLsizei instances)
}
}
-void Renderer11::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo, GLsizei instances)
+void Renderer11::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices,
+ gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo, GLsizei instances)
{
if (mode == GL_LINE_LOOP)
{
@@ -1215,13 +1366,15 @@ void Renderer11::drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices,
return gl::error(GL_OUT_OF_MEMORY);
}
- if (mAppliedIBSerial != mLineLoopIB->getSerial() || mAppliedIBOffset != indexBufferOffset)
- {
- IndexBuffer11 *indexBuffer = IndexBuffer11::makeIndexBuffer11(mLineLoopIB->getIndexBuffer());
+ IndexBuffer11 *indexBuffer = IndexBuffer11::makeIndexBuffer11(mLineLoopIB->getIndexBuffer());
+ ID3D11Buffer *d3dIndexBuffer = indexBuffer->getBuffer();
+ DXGI_FORMAT indexFormat = indexBuffer->getIndexFormat();
+ if (mAppliedIB != d3dIndexBuffer || mAppliedIBFormat != indexFormat || mAppliedIBOffset != indexBufferOffset)
+ {
mDeviceContext->IASetIndexBuffer(indexBuffer->getBuffer(), indexBuffer->getIndexFormat(), indexBufferOffset);
- mAppliedIBSerial = mLineLoopIB->getSerial();
- mAppliedStorageIBSerial = 0;
+ mAppliedIB = d3dIndexBuffer;
+ mAppliedIBFormat = indexFormat;
mAppliedIBOffset = indexBufferOffset;
}
@@ -1324,13 +1477,15 @@ void Renderer11::drawTriangleFan(GLsizei count, GLenum type, const GLvoid *indic
return gl::error(GL_OUT_OF_MEMORY);
}
- if (mAppliedIBSerial != mTriangleFanIB->getSerial() || mAppliedIBOffset != indexBufferOffset)
- {
- IndexBuffer11 *indexBuffer = IndexBuffer11::makeIndexBuffer11(mTriangleFanIB->getIndexBuffer());
+ IndexBuffer11 *indexBuffer = IndexBuffer11::makeIndexBuffer11(mTriangleFanIB->getIndexBuffer());
+ ID3D11Buffer *d3dIndexBuffer = indexBuffer->getBuffer();
+ DXGI_FORMAT indexFormat = indexBuffer->getIndexFormat();
+ if (mAppliedIB != d3dIndexBuffer || mAppliedIBFormat != indexFormat || mAppliedIBOffset != indexBufferOffset)
+ {
mDeviceContext->IASetIndexBuffer(indexBuffer->getBuffer(), indexBuffer->getIndexFormat(), indexBufferOffset);
- mAppliedIBSerial = mTriangleFanIB->getSerial();
- mAppliedStorageIBSerial = 0;
+ mAppliedIB = d3dIndexBuffer;
+ mAppliedIBFormat = indexFormat;
mAppliedIBOffset = indexBufferOffset;
}
@@ -1344,54 +1499,72 @@ void Renderer11::drawTriangleFan(GLsizei count, GLenum type, const GLvoid *indic
}
}
-void Renderer11::applyShaders(gl::ProgramBinary *programBinary)
+void Renderer11::applyShaders(gl::ProgramBinary *programBinary, bool rasterizerDiscard, bool transformFeedbackActive, const gl::VertexFormat inputLayout[])
{
- unsigned int programBinarySerial = programBinary->getSerial();
- const bool updateProgramState = (programBinarySerial != mAppliedProgramBinarySerial);
+ ShaderExecutable *vertexExe = programBinary->getVertexExecutableForInputLayout(inputLayout);
+ ShaderExecutable *pixelExe = programBinary->getPixelExecutable();
+ ShaderExecutable *geometryExe = programBinary->getGeometryExecutable();
- if (updateProgramState)
+ ID3D11VertexShader *vertexShader = (vertexExe ? ShaderExecutable11::makeShaderExecutable11(vertexExe)->getVertexShader() : NULL);
+
+ ID3D11PixelShader *pixelShader = NULL;
+ // Skip pixel shader if we're doing rasterizer discard.
+ if (!rasterizerDiscard)
{
- ShaderExecutable *vertexExe = programBinary->getVertexExecutable();
- ShaderExecutable *pixelExe = programBinary->getPixelExecutable();
+ pixelShader = (pixelExe ? ShaderExecutable11::makeShaderExecutable11(pixelExe)->getPixelShader() : NULL);
+ }
- ID3D11VertexShader *vertexShader = NULL;
- if (vertexExe) vertexShader = ShaderExecutable11::makeShaderExecutable11(vertexExe)->getVertexShader();
+ ID3D11GeometryShader *geometryShader = NULL;
+ if (transformFeedbackActive)
+ {
+ geometryShader = (vertexExe ? ShaderExecutable11::makeShaderExecutable11(vertexExe)->getStreamOutShader() : NULL);
+ }
+ else if (mCurRasterState.pointDrawMode)
+ {
+ geometryShader = (geometryExe ? ShaderExecutable11::makeShaderExecutable11(geometryExe)->getGeometryShader() : NULL);
+ }
- ID3D11PixelShader *pixelShader = NULL;
- if (pixelExe) pixelShader = ShaderExecutable11::makeShaderExecutable11(pixelExe)->getPixelShader();
+ bool dirtyUniforms = false;
- mDeviceContext->PSSetShader(pixelShader, NULL, 0);
+ if (vertexShader != mAppliedVertexShader)
+ {
mDeviceContext->VSSetShader(vertexShader, NULL, 0);
+ mAppliedVertexShader = vertexShader;
+ dirtyUniforms = true;
+ }
- programBinary->dirtyAllUniforms();
-
- mAppliedProgramBinarySerial = programBinarySerial;
+ if (geometryShader != mAppliedGeometryShader)
+ {
+ mDeviceContext->GSSetShader(geometryShader, NULL, 0);
+ mAppliedGeometryShader = geometryShader;
+ dirtyUniforms = true;
}
- // Only use the geometry shader currently for point sprite drawing
- const bool usesGeometryShader = (programBinary->usesGeometryShader() && mCurRasterState.pointDrawMode);
+ if (geometryExe && mCurRasterState.pointDrawMode)
+ {
+ mCurPointGeometryShader = ShaderExecutable11::makeShaderExecutable11(geometryExe)->getGeometryShader();
+ }
+ else
+ {
+ mCurPointGeometryShader = NULL;
+ }
- if (updateProgramState || usesGeometryShader != mIsGeometryShaderActive)
+ if (pixelShader != mAppliedPixelShader)
{
- if (usesGeometryShader)
- {
- ShaderExecutable *geometryExe = programBinary->getGeometryExecutable();
- ID3D11GeometryShader *geometryShader = ShaderExecutable11::makeShaderExecutable11(geometryExe)->getGeometryShader();
- mDeviceContext->GSSetShader(geometryShader, NULL, 0);
- }
- else
- {
- mDeviceContext->GSSetShader(NULL, NULL, 0);
- }
+ mDeviceContext->PSSetShader(pixelShader, NULL, 0);
+ mAppliedPixelShader = pixelShader;
+ dirtyUniforms = true;
+ }
- mIsGeometryShaderActive = usesGeometryShader;
+ if (dirtyUniforms)
+ {
+ programBinary->dirtyAllUniforms();
}
}
-void Renderer11::applyUniforms(gl::ProgramBinary *programBinary, gl::UniformArray *uniformArray)
+void Renderer11::applyUniforms(const gl::ProgramBinary &programBinary)
{
- ShaderExecutable11 *vertexExecutable = ShaderExecutable11::makeShaderExecutable11(programBinary->getVertexExecutable());
- ShaderExecutable11 *pixelExecutable = ShaderExecutable11::makeShaderExecutable11(programBinary->getPixelExecutable());
+ const std::vector<gl::LinkedUniform*> &uniformArray = programBinary.getUniforms();
unsigned int totalRegisterCountVS = 0;
unsigned int totalRegisterCountPS = 0;
@@ -1399,25 +1572,30 @@ void Renderer11::applyUniforms(gl::ProgramBinary *programBinary, gl::UniformArra
bool vertexUniformsDirty = false;
bool pixelUniformsDirty = false;
- for (gl::UniformArray::const_iterator uniform_iterator = uniformArray->begin(); uniform_iterator != uniformArray->end(); uniform_iterator++)
+ for (size_t uniformIndex = 0; uniformIndex < uniformArray.size(); uniformIndex++)
{
- const gl::Uniform *uniform = *uniform_iterator;
+ const gl::LinkedUniform &uniform = *uniformArray[uniformIndex];
- if (uniform->vsRegisterIndex >= 0)
+ if (uniform.isReferencedByVertexShader() && !uniform.isSampler())
{
- totalRegisterCountVS += uniform->registerCount;
- vertexUniformsDirty = vertexUniformsDirty || uniform->dirty;
+ totalRegisterCountVS += uniform.registerCount;
+ vertexUniformsDirty = (vertexUniformsDirty || uniform.dirty);
}
- if (uniform->psRegisterIndex >= 0)
+ if (uniform.isReferencedByFragmentShader() && !uniform.isSampler())
{
- totalRegisterCountPS += uniform->registerCount;
- pixelUniformsDirty = pixelUniformsDirty || uniform->dirty;
+ totalRegisterCountPS += uniform.registerCount;
+ pixelUniformsDirty = (pixelUniformsDirty || uniform.dirty);
}
}
- ID3D11Buffer *vertexConstantBuffer = vertexExecutable->getConstantBuffer(mDevice, totalRegisterCountVS);
- ID3D11Buffer *pixelConstantBuffer = pixelExecutable->getConstantBuffer(mDevice, totalRegisterCountPS);
+ const UniformStorage11 *vertexUniformStorage = UniformStorage11::makeUniformStorage11(&programBinary.getVertexUniformStorage());
+ const UniformStorage11 *fragmentUniformStorage = UniformStorage11::makeUniformStorage11(&programBinary.getFragmentUniformStorage());
+ ASSERT(vertexUniformStorage);
+ ASSERT(fragmentUniformStorage);
+
+ ID3D11Buffer *vertexConstantBuffer = vertexUniformStorage->getConstantBuffer();
+ ID3D11Buffer *pixelConstantBuffer = fragmentUniformStorage->getConstantBuffer();
float (*mapVS)[4] = NULL;
float (*mapPS)[4] = NULL;
@@ -1426,6 +1604,7 @@ void Renderer11::applyUniforms(gl::ProgramBinary *programBinary, gl::UniformArra
{
D3D11_MAPPED_SUBRESOURCE map = {0};
HRESULT result = mDeviceContext->Map(vertexConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &map);
+ UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
mapVS = (float(*)[4])map.pData;
}
@@ -1434,28 +1613,32 @@ void Renderer11::applyUniforms(gl::ProgramBinary *programBinary, gl::UniformArra
{
D3D11_MAPPED_SUBRESOURCE map = {0};
HRESULT result = mDeviceContext->Map(pixelConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &map);
+ UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
mapPS = (float(*)[4])map.pData;
}
- for (gl::UniformArray::iterator uniform_iterator = uniformArray->begin(); uniform_iterator != uniformArray->end(); uniform_iterator++)
+ for (size_t uniformIndex = 0; uniformIndex < uniformArray.size(); uniformIndex++)
{
- gl::Uniform *uniform = *uniform_iterator;
+ gl::LinkedUniform *uniform = uniformArray[uniformIndex];
- if (uniform->type != GL_SAMPLER_2D && uniform->type != GL_SAMPLER_CUBE)
+ if (!uniform->isSampler())
{
- if (uniform->vsRegisterIndex >= 0 && mapVS)
+ unsigned int componentCount = (4 - uniform->registerElement);
+
+ // we assume that uniforms from structs are arranged in struct order in our uniforms list. otherwise we would
+ // overwrite previously written regions of memory.
+
+ if (uniform->isReferencedByVertexShader() && mapVS)
{
- memcpy(mapVS + uniform->vsRegisterIndex, uniform->data, uniform->registerCount * sizeof(float[4]));
+ memcpy(&mapVS[uniform->vsRegisterIndex][uniform->registerElement], uniform->data, uniform->registerCount * sizeof(float) * componentCount);
}
- if (uniform->psRegisterIndex >= 0 && mapPS)
+ if (uniform->isReferencedByFragmentShader() && mapPS)
{
- memcpy(mapPS + uniform->psRegisterIndex, uniform->data, uniform->registerCount * sizeof(float[4]));
+ memcpy(&mapPS[uniform->psRegisterIndex][uniform->registerElement], uniform->data, uniform->registerCount * sizeof(float) * componentCount);
}
}
-
- uniform->dirty = false;
}
if (mapVS)
@@ -1492,6 +1675,7 @@ void Renderer11::applyUniforms(gl::ProgramBinary *programBinary, gl::UniformArra
constantBufferDescription.StructureByteStride = 0;
HRESULT result = mDevice->CreateBuffer(&constantBufferDescription, NULL, &mDriverConstantBufferVS);
+ UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
mDeviceContext->VSSetConstantBuffers(1, 1, &mDriverConstantBufferVS);
@@ -1508,6 +1692,7 @@ void Renderer11::applyUniforms(gl::ProgramBinary *programBinary, gl::UniformArra
constantBufferDescription.StructureByteStride = 0;
HRESULT result = mDevice->CreateBuffer(&constantBufferDescription, NULL, &mDriverConstantBufferPS);
+ UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
mDeviceContext->PSSetConstantBuffers(1, 1, &mDriverConstantBufferPS);
@@ -1535,265 +1720,8 @@ void Renderer11::applyUniforms(gl::ProgramBinary *programBinary, gl::UniformArra
void Renderer11::clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer)
{
- bool alphaUnmasked = (gl::GetAlphaSize(mRenderTargetDesc.format) == 0) || clearParams.colorMaskAlpha;
- bool needMaskedColorClear = (clearParams.mask & GL_COLOR_BUFFER_BIT) &&
- !(clearParams.colorMaskRed && clearParams.colorMaskGreen &&
- clearParams.colorMaskBlue && alphaUnmasked);
-
- unsigned int stencilUnmasked = 0x0;
- if (frameBuffer->hasStencil())
- {
- unsigned int stencilSize = gl::GetStencilSize(frameBuffer->getStencilbuffer()->getActualFormat());
- stencilUnmasked = (0x1 << stencilSize) - 1;
- }
- bool needMaskedStencilClear = (clearParams.mask & GL_STENCIL_BUFFER_BIT) &&
- (clearParams.stencilWriteMask & stencilUnmasked) != stencilUnmasked;
-
- bool needScissoredClear = mScissorEnabled && (mCurScissor.x > 0 || mCurScissor.y > 0 ||
- mCurScissor.x + mCurScissor.width < mRenderTargetDesc.width ||
- mCurScissor.y + mCurScissor.height < mRenderTargetDesc.height);
-
- if (needMaskedColorClear || needMaskedStencilClear || needScissoredClear)
- {
- maskedClear(clearParams, frameBuffer->usingExtendedDrawBuffers());
- }
- else
- {
- if (clearParams.mask & GL_COLOR_BUFFER_BIT)
- {
- for (unsigned int colorAttachment = 0; colorAttachment < gl::IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
- {
- if (frameBuffer->isEnabledColorAttachment(colorAttachment))
- {
- gl::Renderbuffer *renderbufferObject = frameBuffer->getColorbuffer(colorAttachment);
- if (renderbufferObject)
- {
- RenderTarget11 *renderTarget = RenderTarget11::makeRenderTarget11(renderbufferObject->getRenderTarget());
- if (!renderTarget)
- {
- ERR("render target pointer unexpectedly null.");
- return;
- }
-
- ID3D11RenderTargetView *framebufferRTV = renderTarget->getRenderTargetView();
- if (!framebufferRTV)
- {
- ERR("render target view pointer unexpectedly null.");
- return;
- }
-
- const float clearValues[4] = { clearParams.colorClearValue.red,
- clearParams.colorClearValue.green,
- clearParams.colorClearValue.blue,
- clearParams.colorClearValue.alpha };
- mDeviceContext->ClearRenderTargetView(framebufferRTV, clearValues);
- }
- }
- }
- }
- if (clearParams.mask & GL_DEPTH_BUFFER_BIT || clearParams.mask & GL_STENCIL_BUFFER_BIT)
- {
- gl::Renderbuffer *renderbufferObject = frameBuffer->getDepthOrStencilbuffer();
- if (renderbufferObject)
- {
- RenderTarget11 *renderTarget = RenderTarget11::makeRenderTarget11(renderbufferObject->getDepthStencil());
- if (!renderTarget)
- {
- ERR("render target pointer unexpectedly null.");
- return;
- }
-
- ID3D11DepthStencilView *framebufferDSV = renderTarget->getDepthStencilView();
- if (!framebufferDSV)
- {
- ERR("depth stencil view pointer unexpectedly null.");
- return;
- }
-
- UINT clearFlags = 0;
- if (clearParams.mask & GL_DEPTH_BUFFER_BIT)
- {
- clearFlags |= D3D11_CLEAR_DEPTH;
- }
- if (clearParams.mask & GL_STENCIL_BUFFER_BIT)
- {
- clearFlags |= D3D11_CLEAR_STENCIL;
- }
-
- float depthClear = gl::clamp01(clearParams.depthClearValue);
- UINT8 stencilClear = clearParams.stencilClearValue & 0x000000FF;
-
- mDeviceContext->ClearDepthStencilView(framebufferDSV, clearFlags, depthClear, stencilClear);
- }
- }
- }
-}
-
-void Renderer11::maskedClear(const gl::ClearParameters &clearParams, bool usingExtendedDrawBuffers)
-{
- HRESULT result;
-
- if (!mClearResourcesInitialized)
- {
- ASSERT(!mClearVB && !mClearVS && !mClearSinglePS && !mClearMultiplePS && !mClearScissorRS && !mClearNoScissorRS);
-
- D3D11_BUFFER_DESC vbDesc;
- vbDesc.ByteWidth = sizeof(d3d11::PositionDepthColorVertex) * 4;
- vbDesc.Usage = D3D11_USAGE_DYNAMIC;
- vbDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
- vbDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
- vbDesc.MiscFlags = 0;
- vbDesc.StructureByteStride = 0;
-
- result = mDevice->CreateBuffer(&vbDesc, NULL, &mClearVB);
- ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mClearVB, "Renderer11 masked clear vertex buffer");
-
- D3D11_INPUT_ELEMENT_DESC quadLayout[] =
- {
- { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
- { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
- };
-
- result = mDevice->CreateInputLayout(quadLayout, 2, g_VS_Clear, sizeof(g_VS_Clear), &mClearIL);
- ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mClearIL, "Renderer11 masked clear input layout");
-
- result = mDevice->CreateVertexShader(g_VS_Clear, sizeof(g_VS_Clear), NULL, &mClearVS);
- ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mClearVS, "Renderer11 masked clear vertex shader");
-
- result = mDevice->CreatePixelShader(g_PS_ClearSingle, sizeof(g_PS_ClearSingle), NULL, &mClearSinglePS);
- ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mClearSinglePS, "Renderer11 masked clear pixel shader (1 RT)");
-
- result = mDevice->CreatePixelShader(g_PS_ClearMultiple, sizeof(g_PS_ClearMultiple), NULL, &mClearMultiplePS);
- ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mClearMultiplePS, "Renderer11 masked clear pixel shader (MRT)");
-
- D3D11_RASTERIZER_DESC rsScissorDesc;
- rsScissorDesc.FillMode = D3D11_FILL_SOLID;
- rsScissorDesc.CullMode = D3D11_CULL_NONE;
- rsScissorDesc.FrontCounterClockwise = FALSE;
- rsScissorDesc.DepthBias = 0;
- rsScissorDesc.DepthBiasClamp = 0.0f;
- rsScissorDesc.SlopeScaledDepthBias = 0.0f;
- rsScissorDesc.DepthClipEnable = FALSE;
- rsScissorDesc.ScissorEnable = TRUE;
- rsScissorDesc.MultisampleEnable = FALSE;
- rsScissorDesc.AntialiasedLineEnable = FALSE;
-
- result = mDevice->CreateRasterizerState(&rsScissorDesc, &mClearScissorRS);
- ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mClearScissorRS, "Renderer11 masked clear scissor rasterizer state");
-
- D3D11_RASTERIZER_DESC rsNoScissorDesc;
- rsNoScissorDesc.FillMode = D3D11_FILL_SOLID;
- rsNoScissorDesc.CullMode = D3D11_CULL_NONE;
- rsNoScissorDesc.FrontCounterClockwise = FALSE;
- rsNoScissorDesc.DepthBias = 0;
- rsNoScissorDesc.DepthBiasClamp = 0.0f;
- rsNoScissorDesc.SlopeScaledDepthBias = 0.0f;
- rsNoScissorDesc.DepthClipEnable = FALSE;
- rsNoScissorDesc.ScissorEnable = FALSE;
- rsNoScissorDesc.MultisampleEnable = FALSE;
- rsNoScissorDesc.AntialiasedLineEnable = FALSE;
-
- result = mDevice->CreateRasterizerState(&rsNoScissorDesc, &mClearNoScissorRS);
- ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mClearNoScissorRS, "Renderer11 masked clear no scissor rasterizer state");
-
- mClearResourcesInitialized = true;
- }
-
- // Prepare the depth stencil state to write depth values if the depth should be cleared
- // and stencil values if the stencil should be cleared
- gl::DepthStencilState glDSState;
- glDSState.depthTest = (clearParams.mask & GL_DEPTH_BUFFER_BIT) != 0;
- glDSState.depthFunc = GL_ALWAYS;
- glDSState.depthMask = (clearParams.mask & GL_DEPTH_BUFFER_BIT) != 0;
- glDSState.stencilTest = (clearParams.mask & GL_STENCIL_BUFFER_BIT) != 0;
- glDSState.stencilFunc = GL_ALWAYS;
- glDSState.stencilMask = 0;
- glDSState.stencilFail = GL_REPLACE;
- glDSState.stencilPassDepthFail = GL_REPLACE;
- glDSState.stencilPassDepthPass = GL_REPLACE;
- glDSState.stencilWritemask = clearParams.stencilWriteMask;
- glDSState.stencilBackFunc = GL_ALWAYS;
- glDSState.stencilBackMask = 0;
- glDSState.stencilBackFail = GL_REPLACE;
- glDSState.stencilBackPassDepthFail = GL_REPLACE;
- glDSState.stencilBackPassDepthPass = GL_REPLACE;
- glDSState.stencilBackWritemask = clearParams.stencilWriteMask;
-
- int stencilClear = clearParams.stencilClearValue & 0x000000FF;
-
- ID3D11DepthStencilState *dsState = mStateCache.getDepthStencilState(glDSState);
-
- // Prepare the blend state to use a write mask if the color buffer should be cleared
- gl::BlendState glBlendState;
- glBlendState.blend = false;
- glBlendState.sourceBlendRGB = GL_ONE;
- glBlendState.destBlendRGB = GL_ZERO;
- glBlendState.sourceBlendAlpha = GL_ONE;
- glBlendState.destBlendAlpha = GL_ZERO;
- glBlendState.blendEquationRGB = GL_FUNC_ADD;
- glBlendState.blendEquationAlpha = GL_FUNC_ADD;
- glBlendState.colorMaskRed = (clearParams.mask & GL_COLOR_BUFFER_BIT) ? clearParams.colorMaskRed : false;
- glBlendState.colorMaskGreen = (clearParams.mask & GL_COLOR_BUFFER_BIT) ? clearParams.colorMaskGreen : false;
- glBlendState.colorMaskBlue = (clearParams.mask & GL_COLOR_BUFFER_BIT) ? clearParams.colorMaskBlue : false;
- glBlendState.colorMaskAlpha = (clearParams.mask & GL_COLOR_BUFFER_BIT) ? clearParams.colorMaskAlpha : false;
- glBlendState.sampleAlphaToCoverage = false;
- glBlendState.dither = false;
-
- static const float blendFactors[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
- static const UINT sampleMask = 0xFFFFFFFF;
-
- ID3D11BlendState *blendState = mStateCache.getBlendState(glBlendState);
-
- // Set the vertices
- D3D11_MAPPED_SUBRESOURCE mappedResource;
- result = mDeviceContext->Map(mClearVB, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
- if (FAILED(result))
- {
- ERR("Failed to map masked clear vertex buffer, HRESULT: 0x%X.", result);
- return;
- }
-
- d3d11::PositionDepthColorVertex *vertices = reinterpret_cast<d3d11::PositionDepthColorVertex*>(mappedResource.pData);
-
- float depthClear = gl::clamp01(clearParams.depthClearValue);
- d3d11::SetPositionDepthColorVertex(&vertices[0], -1.0f, 1.0f, depthClear, clearParams.colorClearValue);
- d3d11::SetPositionDepthColorVertex(&vertices[1], -1.0f, -1.0f, depthClear, clearParams.colorClearValue);
- d3d11::SetPositionDepthColorVertex(&vertices[2], 1.0f, 1.0f, depthClear, clearParams.colorClearValue);
- d3d11::SetPositionDepthColorVertex(&vertices[3], 1.0f, -1.0f, depthClear, clearParams.colorClearValue);
-
- mDeviceContext->Unmap(mClearVB, 0);
-
- // Apply state
- mDeviceContext->OMSetBlendState(blendState, blendFactors, sampleMask);
- mDeviceContext->OMSetDepthStencilState(dsState, stencilClear);
- mDeviceContext->RSSetState(mScissorEnabled ? mClearScissorRS : mClearNoScissorRS);
-
- // Apply shaders
- ID3D11PixelShader *pixelShader = usingExtendedDrawBuffers ? mClearMultiplePS : mClearSinglePS;
-
- mDeviceContext->IASetInputLayout(mClearIL);
- mDeviceContext->VSSetShader(mClearVS, NULL, 0);
- mDeviceContext->PSSetShader(pixelShader, NULL, 0);
- mDeviceContext->GSSetShader(NULL, NULL, 0);
-
- // Apply vertex buffer
- static UINT stride = sizeof(d3d11::PositionDepthColorVertex);
- static UINT startIdx = 0;
- mDeviceContext->IASetVertexBuffers(0, 1, &mClearVB, &stride, &startIdx);
- mDeviceContext->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
-
- // Draw the clear quad
- mDeviceContext->Draw(4, 0);
-
- // Clean up
- markAllStateDirty();
+ mClear->clearFramebuffer(clearParams, frameBuffer);
+ invalidateFramebufferSwizzles(frameBuffer);
}
void Renderer11::markAllStateDirty()
@@ -1810,12 +1738,12 @@ void Renderer11::markAllStateDirty()
for (int i = 0; i < gl::IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS; i++)
{
mForceSetVertexSamplerStates[i] = true;
- mCurVertexTextureSerials[i] = 0;
+ mCurVertexSRVs[i] = NULL;
}
for (int i = 0; i < gl::MAX_TEXTURE_IMAGE_UNITS; i++)
{
mForceSetPixelSamplerStates[i] = true;
- mCurPixelTextureSerials[i] = 0;
+ mCurPixelSRVs[i] = NULL;
}
mForceSetBlendState = true;
@@ -1824,16 +1752,32 @@ void Renderer11::markAllStateDirty()
mForceSetScissor = true;
mForceSetViewport = true;
- mAppliedIBSerial = 0;
- mAppliedStorageIBSerial = 0;
+ mAppliedIB = NULL;
+ mAppliedIBFormat = DXGI_FORMAT_UNKNOWN;
mAppliedIBOffset = 0;
- mAppliedProgramBinarySerial = 0;
+ mAppliedVertexShader = NULL;
+ mAppliedGeometryShader = NULL;
+ mCurPointGeometryShader = NULL;
+ mAppliedPixelShader = NULL;
+
+ for (size_t i = 0; i < gl::IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS; i++)
+ {
+ mAppliedTFBuffers[i] = NULL;
+ mAppliedTFOffsets[i] = 0;
+ }
+
memset(&mAppliedVertexConstants, 0, sizeof(dx_VertexConstants));
memset(&mAppliedPixelConstants, 0, sizeof(dx_PixelConstants));
mInputLayoutCache.markDirty();
+ for (unsigned int i = 0; i < gl::IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS; i++)
+ {
+ mCurrentConstantBufferVS[i] = -1;
+ mCurrentConstantBufferPS[i] = -1;
+ }
+
mCurrentVertexConstantBuffer = NULL;
mCurrentPixelConstantBuffer = NULL;
mCurrentGeometryConstantBuffer = NULL;
@@ -1846,39 +1790,13 @@ void Renderer11::releaseDeviceResources()
mStateCache.clear();
mInputLayoutCache.clear();
- delete mVertexDataManager;
- mVertexDataManager = NULL;
-
- delete mIndexDataManager;
- mIndexDataManager = NULL;
-
- delete mLineLoopIB;
- mLineLoopIB = NULL;
-
- delete mTriangleFanIB;
- mTriangleFanIB = NULL;
-
- SafeRelease(mCopyVB);
- SafeRelease(mCopySampler);
- SafeRelease(mCopyIL);
- SafeRelease(mCopyIL);
- SafeRelease(mCopyVS);
- SafeRelease(mCopyRGBAPS);
- SafeRelease(mCopyRGBPS);
- SafeRelease(mCopyLumPS);
- SafeRelease(mCopyLumAlphaPS);
-
- mCopyResourcesInitialized = false;
-
- SafeRelease(mClearVB);
- SafeRelease(mClearIL);
- SafeRelease(mClearVS);
- SafeRelease(mClearSinglePS);
- SafeRelease(mClearMultiplePS);
- SafeRelease(mClearScissorRS);
- SafeRelease(mClearNoScissorRS);
-
- mClearResourcesInitialized = false;
+ SafeDelete(mVertexDataManager);
+ SafeDelete(mIndexDataManager);
+ SafeDelete(mLineLoopIB);
+ SafeDelete(mTriangleFanIB);
+ SafeDelete(mBlit);
+ SafeDelete(mClear);
+ SafeDelete(mPixelTransfer);
SafeRelease(mDriverConstantBufferVS);
SafeRelease(mDriverConstantBufferPS);
@@ -1969,8 +1887,8 @@ bool Renderer11::testDeviceResettable()
return false;
}
- dummyContext->Release();
- dummyDevice->Release();
+ SafeRelease(dummyContext);
+ SafeRelease(dummyDevice);
return true;
}
@@ -1979,31 +1897,17 @@ void Renderer11::release()
{
releaseDeviceResources();
- if (mDxgiFactory)
- {
- mDxgiFactory->Release();
- mDxgiFactory = NULL;
- }
-
- if (mDxgiAdapter)
- {
- mDxgiAdapter->Release();
- mDxgiAdapter = NULL;
- }
+ SafeRelease(mDxgiFactory);
+ SafeRelease(mDxgiAdapter);
if (mDeviceContext)
{
mDeviceContext->ClearState();
mDeviceContext->Flush();
- mDeviceContext->Release();
- mDeviceContext = NULL;
+ SafeRelease(mDeviceContext);
}
- if (mDevice)
- {
- mDevice->Release();
- mDevice = NULL;
- }
+ SafeRelease(mDevice);
if (mD3d11Module)
{
@@ -2016,6 +1920,8 @@ void Renderer11::release()
FreeLibrary(mDxgiModule);
mDxgiModule = NULL;
}
+
+ mCompiler.release();
}
bool Renderer11::resetDevice()
@@ -2068,17 +1974,17 @@ bool Renderer11::getBGRATextureSupport() const
return mBGRATextureSupport;
}
-bool Renderer11::getDXT1TextureSupport()
+bool Renderer11::getDXT1TextureSupport() const
{
return mDXT1TextureSupport;
}
-bool Renderer11::getDXT3TextureSupport()
+bool Renderer11::getDXT3TextureSupport() const
{
return mDXT3TextureSupport;
}
-bool Renderer11::getDXT5TextureSupport()
+bool Renderer11::getDXT5TextureSupport() const
{
return mDXT5TextureSupport;
}
@@ -2088,35 +1994,66 @@ bool Renderer11::getDepthTextureSupport() const
return mDepthTextureSupport;
}
-bool Renderer11::getFloat32TextureSupport(bool *filtering, bool *renderable)
+bool Renderer11::getFloat32TextureSupport() const
{
- *renderable = mFloat32RenderSupport;
- *filtering = mFloat32FilterSupport;
return mFloat32TextureSupport;
}
-bool Renderer11::getFloat16TextureSupport(bool *filtering, bool *renderable)
+bool Renderer11::getFloat32TextureFilteringSupport() const
+{
+ return mFloat32FilterSupport;
+}
+
+bool Renderer11::getFloat32TextureRenderingSupport() const
+{
+ return mFloat32RenderSupport;
+}
+
+bool Renderer11::getFloat16TextureSupport() const
{
- *renderable = mFloat16RenderSupport;
- *filtering = mFloat16FilterSupport;
return mFloat16TextureSupport;
}
-bool Renderer11::getLuminanceTextureSupport()
+bool Renderer11::getFloat16TextureFilteringSupport() const
+{
+ return mFloat16FilterSupport;
+}
+
+bool Renderer11::getFloat16TextureRenderingSupport() const
+{
+ return mFloat16RenderSupport;
+}
+
+bool Renderer11::getRGB565TextureSupport() const
+{
+ return false;
+}
+
+bool Renderer11::getLuminanceTextureSupport() const
{
return false;
}
-bool Renderer11::getLuminanceAlphaTextureSupport()
+bool Renderer11::getLuminanceAlphaTextureSupport() const
{
return false;
}
+bool Renderer11::getRGTextureSupport() const
+{
+ return mRGTextureSupport;
+}
+
bool Renderer11::getTextureFilterAnisotropySupport() const
{
return true;
}
+bool Renderer11::getPBOSupport() const
+{
+ return true;
+}
+
float Renderer11::getTextureMaxAnisotropy() const
{
switch (mFeatureLevel)
@@ -2131,7 +2068,7 @@ float Renderer11::getTextureMaxAnisotropy() const
}
}
-bool Renderer11::getEventQuerySupport()
+bool Renderer11::getEventQuerySupport() const
{
return true;
}
@@ -2196,13 +2133,125 @@ unsigned int Renderer11::getMaxFragmentUniformVectors() const
unsigned int Renderer11::getMaxVaryingVectors() const
{
META_ASSERT(gl::IMPLEMENTATION_MAX_VARYING_VECTORS == D3D11_VS_OUTPUT_REGISTER_COUNT);
+ META_ASSERT(D3D11_VS_OUTPUT_REGISTER_COUNT <= D3D11_PS_INPUT_REGISTER_COUNT);
+ META_ASSERT(D3D10_VS_OUTPUT_REGISTER_COUNT <= D3D10_PS_INPUT_REGISTER_COUNT);
+ switch (mFeatureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_VS_OUTPUT_REGISTER_COUNT - getReservedVaryings();
+ case D3D_FEATURE_LEVEL_10_1:
+ return D3D10_1_VS_OUTPUT_REGISTER_COUNT - getReservedVaryings();
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D10_VS_OUTPUT_REGISTER_COUNT - getReservedVaryings();
+ default: UNREACHABLE();
+ return 0;
+ }
+}
+
+unsigned int Renderer11::getMaxVertexShaderUniformBuffers() const
+{
+ META_ASSERT(gl::IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS >= D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT &&
+ gl::IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS >= D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT);
+
switch (mFeatureLevel)
{
case D3D_FEATURE_LEVEL_11_0:
- return D3D11_VS_OUTPUT_REGISTER_COUNT;
+ return D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - getReservedVertexUniformBuffers();
case D3D_FEATURE_LEVEL_10_1:
case D3D_FEATURE_LEVEL_10_0:
- return D3D10_VS_OUTPUT_REGISTER_COUNT;
+ return D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - getReservedVertexUniformBuffers();
+ default: UNREACHABLE();
+ return 0;
+ }
+}
+
+unsigned int Renderer11::getMaxFragmentShaderUniformBuffers() const
+{
+ META_ASSERT(gl::IMPLEMENTATION_MAX_FRAGMENT_SHADER_UNIFORM_BUFFERS >= D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT &&
+ gl::IMPLEMENTATION_MAX_FRAGMENT_SHADER_UNIFORM_BUFFERS >= D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT);
+
+ switch (mFeatureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - getReservedFragmentUniformBuffers();
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - getReservedFragmentUniformBuffers();
+ default: UNREACHABLE();
+ return 0;
+ }
+}
+
+unsigned int Renderer11::getReservedVertexUniformBuffers() const
+{
+ // we reserve one buffer for the application uniforms, and one for driver uniforms
+ return 2;
+}
+
+unsigned int Renderer11::getReservedFragmentUniformBuffers() const
+{
+ // we reserve one buffer for the application uniforms, and one for driver uniforms
+ return 2;
+}
+
+unsigned int Renderer11::getReservedVaryings() const
+{
+ // We potentially reserve varyings for gl_Position, _dx_Position, gl_FragCoord and gl_PointSize
+ return 4;
+}
+
+
+unsigned int Renderer11::getMaxTransformFeedbackBuffers() const
+{
+ META_ASSERT(gl::IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS >= D3D11_SO_BUFFER_SLOT_COUNT &&
+ gl::IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS >= D3D10_SO_BUFFER_SLOT_COUNT);
+
+ switch (mFeatureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_SO_BUFFER_SLOT_COUNT;
+ case D3D_FEATURE_LEVEL_10_1:
+ return D3D10_1_SO_BUFFER_SLOT_COUNT;
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D10_SO_BUFFER_SLOT_COUNT;
+ default: UNREACHABLE();
+ return 0;
+ }
+}
+
+unsigned int Renderer11::getMaxTransformFeedbackSeparateComponents() const
+{
+ switch (mFeatureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_0:
+ return getMaxTransformFeedbackInterleavedComponents() / getMaxTransformFeedbackBuffers();
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ // D3D 10 and 10.1 only allow one output per output slot if an output slot other than zero
+ // is used.
+ return 4;
+ default: UNREACHABLE();
+ return 0;
+ }
+}
+
+unsigned int Renderer11::getMaxTransformFeedbackInterleavedComponents() const
+{
+ return (getMaxVaryingVectors() * 4);
+}
+
+unsigned int Renderer11::getMaxUniformBufferSize() const
+{
+ // Each component is a 4-element vector of 4-byte units (floats)
+ const unsigned int bytesPerComponent = 4 * sizeof(float);
+
+ switch (mFeatureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT * bytesPerComponent;
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D10_REQ_CONSTANT_BUFFER_ELEMENT_COUNT * bytesPerComponent;
default: UNREACHABLE();
return 0;
}
@@ -2274,6 +2323,24 @@ bool Renderer11::getPostSubBufferSupport() const
return false;
}
+int Renderer11::getMaxRecommendedElementsIndices() const
+{
+ META_ASSERT(D3D11_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP == 32);
+ META_ASSERT(D3D10_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP == 32);
+
+ // D3D11 allows up to 2^32 elements, but we report max signed int for convenience.
+ return std::numeric_limits<GLint>::max();
+}
+
+int Renderer11::getMaxRecommendedElementsVertices() const
+{
+ META_ASSERT(D3D11_REQ_DRAW_VERTEX_COUNT_2_TO_EXP == 32);
+ META_ASSERT(D3D10_REQ_DRAW_VERTEX_COUNT_2_TO_EXP == 32);
+
+ // D3D11 allows up to 2^32 elements, but we report max signed int for convenience.
+ return std::numeric_limits<GLint>::max();
+}
+
int Renderer11::getMajorShaderModel() const
{
switch (mFeatureLevel)
@@ -2344,6 +2411,28 @@ int Renderer11::getMaxTextureHeight() const
}
}
+int Renderer11::getMaxTextureDepth() const
+{
+ switch (mFeatureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION; // 2048
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_TEXTURE3D_U_V_OR_W_DIMENSION; // 2048
+ default: UNREACHABLE(); return 0;
+ }
+}
+
+int Renderer11::getMaxTextureArrayLayers() const
+{
+ switch (mFeatureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION; // 2048
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION; // 512
+ default: UNREACHABLE(); return 0;
+ }
+}
+
bool Renderer11::get32BitIndexSupport() const
{
switch (mFeatureLevel)
@@ -2370,6 +2459,66 @@ int Renderer11::getMaxSupportedSamples() const
return mMaxSupportedSamples;
}
+GLsizei Renderer11::getMaxSupportedFormatSamples(GLenum internalFormat) const
+{
+ DXGI_FORMAT format = gl_d3d11::GetRenderableFormat(internalFormat, getCurrentClientVersion());
+ MultisampleSupportMap::const_iterator iter = mMultisampleSupportMap.find(format);
+ return (iter != mMultisampleSupportMap.end()) ? iter->second.maxSupportedSamples : 0;
+}
+
+GLsizei Renderer11::getNumSampleCounts(GLenum internalFormat) const
+{
+ unsigned int numCounts = 0;
+
+ // D3D11 supports multisampling for signed and unsigned format, but ES 3.0 does not
+ GLenum componentType = gl::GetComponentType(internalFormat, getCurrentClientVersion());
+ if (componentType != GL_INT && componentType != GL_UNSIGNED_INT)
+ {
+ DXGI_FORMAT format = gl_d3d11::GetRenderableFormat(internalFormat, getCurrentClientVersion());
+ MultisampleSupportMap::const_iterator iter = mMultisampleSupportMap.find(format);
+
+ if (iter != mMultisampleSupportMap.end())
+ {
+ const MultisampleSupportInfo& info = iter->second;
+ for (int i = 0; i < D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT; i++)
+ {
+ if (info.qualityLevels[i] > 0)
+ {
+ numCounts++;
+ }
+ }
+ }
+ }
+
+ return numCounts;
+}
+
+void Renderer11::getSampleCounts(GLenum internalFormat, GLsizei bufSize, GLint *params) const
+{
+ // D3D11 supports multisampling for signed and unsigned format, but ES 3.0 does not
+ GLenum componentType = gl::GetComponentType(internalFormat, getCurrentClientVersion());
+ if (componentType == GL_INT || componentType == GL_UNSIGNED_INT)
+ {
+ return;
+ }
+
+ DXGI_FORMAT format = gl_d3d11::GetRenderableFormat(internalFormat, getCurrentClientVersion());
+ MultisampleSupportMap::const_iterator iter = mMultisampleSupportMap.find(format);
+
+ if (iter != mMultisampleSupportMap.end())
+ {
+ const MultisampleSupportInfo& info = iter->second;
+ int bufPos = 0;
+ for (int i = D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT - 1; i >= 0 && bufPos < bufSize; i--)
+ {
+ if (info.qualityLevels[i] > 0)
+ {
+ params[bufPos++] = i + 1;
+ }
+ }
+ }
+}
+
int Renderer11::getNearestSupportedSamples(DXGI_FORMAT format, unsigned int requested) const
{
if (requested == 0)
@@ -2404,7 +2553,10 @@ unsigned int Renderer11::getMaxRenderTargets() const
return D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; // 8
case D3D_FEATURE_LEVEL_10_1:
case D3D_FEATURE_LEVEL_10_0:
- return D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT; // 8
+ // Feature level 10.0 and 10.1 cards perform very poorly when the pixel shader
+ // outputs to multiple RTs that are not bound.
+ // TODO: Remove pixel shader outputs for render targets that are not bound.
+ return 1;
default:
UNREACHABLE();
return 1;
@@ -2418,7 +2570,10 @@ bool Renderer11::copyToRenderTarget(TextureStorageInterface2D *dest, TextureStor
TextureStorage11_2D *source11 = TextureStorage11_2D::makeTextureStorage11_2D(source->getStorageInstance());
TextureStorage11_2D *dest11 = TextureStorage11_2D::makeTextureStorage11_2D(dest->getStorageInstance());
- mDeviceContext->CopyResource(dest11->getBaseTexture(), source11->getBaseTexture());
+ mDeviceContext->CopyResource(dest11->getResource(), source11->getResource());
+
+ dest11->invalidateSwizzleCache();
+
return true;
}
@@ -2432,7 +2587,44 @@ bool Renderer11::copyToRenderTarget(TextureStorageInterfaceCube *dest, TextureSt
TextureStorage11_Cube *source11 = TextureStorage11_Cube::makeTextureStorage11_Cube(source->getStorageInstance());
TextureStorage11_Cube *dest11 = TextureStorage11_Cube::makeTextureStorage11_Cube(dest->getStorageInstance());
- mDeviceContext->CopyResource(dest11->getBaseTexture(), source11->getBaseTexture());
+ mDeviceContext->CopyResource(dest11->getResource(), source11->getResource());
+
+ dest11->invalidateSwizzleCache();
+
+ return true;
+ }
+
+ return false;
+}
+
+bool Renderer11::copyToRenderTarget(TextureStorageInterface3D *dest, TextureStorageInterface3D *source)
+{
+ if (source && dest)
+ {
+ TextureStorage11_3D *source11 = TextureStorage11_3D::makeTextureStorage11_3D(source->getStorageInstance());
+ TextureStorage11_3D *dest11 = TextureStorage11_3D::makeTextureStorage11_3D(dest->getStorageInstance());
+
+ mDeviceContext->CopyResource(dest11->getResource(), source11->getResource());
+
+ dest11->invalidateSwizzleCache();
+
+ return true;
+ }
+
+ return false;
+}
+
+bool Renderer11::copyToRenderTarget(TextureStorageInterface2DArray *dest, TextureStorageInterface2DArray *source)
+{
+ if (source && dest)
+ {
+ TextureStorage11_2DArray *source11 = TextureStorage11_2DArray::makeTextureStorage11_2DArray(source->getStorageInstance());
+ TextureStorage11_2DArray *dest11 = TextureStorage11_2DArray::makeTextureStorage11_2DArray(dest->getStorageInstance());
+
+ mDeviceContext->CopyResource(dest11->getResource(), source11->getResource());
+
+ dest11->invalidateSwizzleCache();
+
return true;
}
@@ -2442,7 +2634,7 @@ bool Renderer11::copyToRenderTarget(TextureStorageInterfaceCube *dest, TextureSt
bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, TextureStorageInterface2D *storage, GLint level)
{
- gl::Renderbuffer *colorbuffer = framebuffer->getReadColorbuffer();
+ gl::FramebufferAttachment *colorbuffer = framebuffer->getReadColorbuffer();
if (!colorbuffer)
{
ERR("Failed to retrieve the color buffer from the frame buffer.");
@@ -2484,14 +2676,18 @@ bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &so
return gl::error(GL_OUT_OF_MEMORY, false);
}
- gl::Rectangle destRect;
- destRect.x = xoffset;
- destRect.y = yoffset;
- destRect.width = sourceRect.width;
- destRect.height = sourceRect.height;
+ gl::Box sourceArea(sourceRect.x, sourceRect.y, 0, sourceRect.width, sourceRect.height, 1);
+ gl::Extents sourceSize(sourceRenderTarget->getWidth(), sourceRenderTarget->getHeight(), 1);
+
+ gl::Box destArea(xoffset, yoffset, 0, sourceRect.width, sourceRect.height, 1);
+ gl::Extents destSize(destRenderTarget->getWidth(), destRenderTarget->getHeight(), 1);
- bool ret = copyTexture(source, sourceRect, sourceRenderTarget->getWidth(), sourceRenderTarget->getHeight(),
- dest, destRect, destRenderTarget->getWidth(), destRenderTarget->getHeight(), destFormat);
+ // Use nearest filtering because source and destination are the same size for the direct
+ // copy
+ bool ret = mBlit->copyTexture(source, sourceArea, sourceSize, dest, destArea, destSize, NULL,
+ destFormat, GL_NEAREST);
+
+ storage11->invalidateSwizzleCacheLevel(level);
return ret;
}
@@ -2499,7 +2695,7 @@ bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &so
bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, TextureStorageInterfaceCube *storage, GLenum target, GLint level)
{
- gl::Renderbuffer *colorbuffer = framebuffer->getReadColorbuffer();
+ gl::FramebufferAttachment *colorbuffer = framebuffer->getReadColorbuffer();
if (!colorbuffer)
{
ERR("Failed to retrieve the color buffer from the frame buffer.");
@@ -2527,7 +2723,7 @@ bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &so
return gl::error(GL_OUT_OF_MEMORY, false);
}
- RenderTarget11 *destRenderTarget = RenderTarget11::makeRenderTarget11(storage11->getRenderTarget(target, level));
+ RenderTarget11 *destRenderTarget = RenderTarget11::makeRenderTarget11(storage11->getRenderTargetFace(target, level));
if (!destRenderTarget)
{
ERR("Failed to retrieve the render target from the destination storage.");
@@ -2541,194 +2737,144 @@ bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &so
return gl::error(GL_OUT_OF_MEMORY, false);
}
- gl::Rectangle destRect;
- destRect.x = xoffset;
- destRect.y = yoffset;
- destRect.width = sourceRect.width;
- destRect.height = sourceRect.height;
+ gl::Box sourceArea(sourceRect.x, sourceRect.y, 0, sourceRect.width, sourceRect.height, 1);
+ gl::Extents sourceSize(sourceRenderTarget->getWidth(), sourceRenderTarget->getHeight(), 1);
+
+ gl::Box destArea(xoffset, yoffset, 0, sourceRect.width, sourceRect.height, 1);
+ gl::Extents destSize(destRenderTarget->getWidth(), destRenderTarget->getHeight(), 1);
- bool ret = copyTexture(source, sourceRect, sourceRenderTarget->getWidth(), sourceRenderTarget->getHeight(),
- dest, destRect, destRenderTarget->getWidth(), destRenderTarget->getHeight(), destFormat);
+ // Use nearest filtering because source and destination are the same size for the direct
+ // copy
+ bool ret = mBlit->copyTexture(source, sourceArea, sourceSize, dest, destArea, destSize, NULL,
+ destFormat, GL_NEAREST);
+
+ storage11->invalidateSwizzleCacheLevel(level);
return ret;
}
-bool Renderer11::copyTexture(ID3D11ShaderResourceView *source, const gl::Rectangle &sourceArea, unsigned int sourceWidth, unsigned int sourceHeight,
- ID3D11RenderTargetView *dest, const gl::Rectangle &destArea, unsigned int destWidth, unsigned int destHeight, GLenum destFormat)
+bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
+ GLint xoffset, GLint yoffset, GLint zOffset, TextureStorageInterface3D *storage, GLint level)
{
- HRESULT result;
-
- if (!mCopyResourcesInitialized)
+ gl::FramebufferAttachment *colorbuffer = framebuffer->getReadColorbuffer();
+ if (!colorbuffer)
{
- ASSERT(!mCopyVB && !mCopySampler && !mCopyIL && !mCopyVS && !mCopyRGBAPS && !mCopyRGBPS && !mCopyLumPS && !mCopyLumAlphaPS);
-
- D3D11_BUFFER_DESC vbDesc;
- vbDesc.ByteWidth = sizeof(d3d11::PositionTexCoordVertex) * 4;
- vbDesc.Usage = D3D11_USAGE_DYNAMIC;
- vbDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
- vbDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
- vbDesc.MiscFlags = 0;
- vbDesc.StructureByteStride = 0;
-
- result = mDevice->CreateBuffer(&vbDesc, NULL, &mCopyVB);
- ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mCopyVB, "Renderer11 copy texture vertex buffer");
-
- D3D11_SAMPLER_DESC samplerDesc;
- samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
- samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
- samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
- samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
- samplerDesc.MipLODBias = 0.0f;
- samplerDesc.MaxAnisotropy = 0;
- samplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER;
- samplerDesc.BorderColor[0] = 0.0f;
- samplerDesc.BorderColor[1] = 0.0f;
- samplerDesc.BorderColor[2] = 0.0f;
- samplerDesc.BorderColor[3] = 0.0f;
- samplerDesc.MinLOD = 0.0f;
- samplerDesc.MaxLOD = 0.0f;
-
- result = mDevice->CreateSamplerState(&samplerDesc, &mCopySampler);
- ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mCopySampler, "Renderer11 copy sampler");
-
- D3D11_INPUT_ELEMENT_DESC quadLayout[] =
- {
- { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
- { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 8, D3D11_INPUT_PER_VERTEX_DATA, 0 },
- };
-
- result = mDevice->CreateInputLayout(quadLayout, 2, g_VS_Passthrough, sizeof(g_VS_Passthrough), &mCopyIL);
- ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mCopyIL, "Renderer11 copy texture input layout");
-
- result = mDevice->CreateVertexShader(g_VS_Passthrough, sizeof(g_VS_Passthrough), NULL, &mCopyVS);
- ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mCopyVS, "Renderer11 copy texture vertex shader");
-
- result = mDevice->CreatePixelShader(g_PS_PassthroughRGBA, sizeof(g_PS_PassthroughRGBA), NULL, &mCopyRGBAPS);
- ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mCopyRGBAPS, "Renderer11 copy texture RGBA pixel shader");
-
- result = mDevice->CreatePixelShader(g_PS_PassthroughRGB, sizeof(g_PS_PassthroughRGB), NULL, &mCopyRGBPS);
- ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mCopyRGBPS, "Renderer11 copy texture RGB pixel shader");
-
- result = mDevice->CreatePixelShader(g_PS_PassthroughLum, sizeof(g_PS_PassthroughLum), NULL, &mCopyLumPS);
- ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mCopyLumPS, "Renderer11 copy texture luminance pixel shader");
-
- result = mDevice->CreatePixelShader(g_PS_PassthroughLumAlpha, sizeof(g_PS_PassthroughLumAlpha), NULL, &mCopyLumAlphaPS);
- ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mCopyLumAlphaPS, "Renderer11 copy texture luminance alpha pixel shader");
-
- mCopyResourcesInitialized = true;
+ ERR("Failed to retrieve the color buffer from the frame buffer.");
+ return gl::error(GL_OUT_OF_MEMORY, false);
}
- // Verify the source and destination area sizes
- if (sourceArea.x < 0 || sourceArea.x + sourceArea.width > static_cast<int>(sourceWidth) ||
- sourceArea.y < 0 || sourceArea.y + sourceArea.height > static_cast<int>(sourceHeight) ||
- destArea.x < 0 || destArea.x + destArea.width > static_cast<int>(destWidth) ||
- destArea.y < 0 || destArea.y + destArea.height > static_cast<int>(destHeight))
+ RenderTarget11 *sourceRenderTarget = RenderTarget11::makeRenderTarget11(colorbuffer->getRenderTarget());
+ if (!sourceRenderTarget)
{
- return gl::error(GL_INVALID_VALUE, false);
+ ERR("Failed to retrieve the render target from the frame buffer.");
+ return gl::error(GL_OUT_OF_MEMORY, false);
}
- // Set vertices
- D3D11_MAPPED_SUBRESOURCE mappedResource;
- result = mDeviceContext->Map(mCopyVB, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
- if (FAILED(result))
+ ID3D11ShaderResourceView *source = sourceRenderTarget->getShaderResourceView();
+ if (!source)
{
- ERR("Failed to map vertex buffer for texture copy, HRESULT: 0x%X.", result);
+ ERR("Failed to retrieve the render target view from the render target.");
return gl::error(GL_OUT_OF_MEMORY, false);
}
- d3d11::PositionTexCoordVertex *vertices = static_cast<d3d11::PositionTexCoordVertex*>(mappedResource.pData);
+ TextureStorage11_3D *storage11 = TextureStorage11_3D::makeTextureStorage11_3D(storage->getStorageInstance());
+ if (!storage11)
+ {
+ ERR("Failed to retrieve the texture storage from the destination.");
+ return gl::error(GL_OUT_OF_MEMORY, false);
+ }
- // Create a quad in homogeneous coordinates
- float x1 = (destArea.x / float(destWidth)) * 2.0f - 1.0f;
- float y1 = ((destHeight - destArea.y - destArea.height) / float(destHeight)) * 2.0f - 1.0f;
- float x2 = ((destArea.x + destArea.width) / float(destWidth)) * 2.0f - 1.0f;
- float y2 = ((destHeight - destArea.y) / float(destHeight)) * 2.0f - 1.0f;
+ RenderTarget11 *destRenderTarget = RenderTarget11::makeRenderTarget11(storage11->getRenderTargetLayer(level, zOffset));
+ if (!destRenderTarget)
+ {
+ ERR("Failed to retrieve the render target from the destination storage.");
+ return gl::error(GL_OUT_OF_MEMORY, false);
+ }
- float u1 = sourceArea.x / float(sourceWidth);
- float v1 = sourceArea.y / float(sourceHeight);
- float u2 = (sourceArea.x + sourceArea.width) / float(sourceWidth);
- float v2 = (sourceArea.y + sourceArea.height) / float(sourceHeight);
+ ID3D11RenderTargetView *dest = destRenderTarget->getRenderTargetView();
+ if (!dest)
+ {
+ ERR("Failed to retrieve the render target view from the destination render target.");
+ return gl::error(GL_OUT_OF_MEMORY, false);
+ }
- d3d11::SetPositionTexCoordVertex(&vertices[0], x1, y1, u1, v2);
- d3d11::SetPositionTexCoordVertex(&vertices[1], x1, y2, u1, v1);
- d3d11::SetPositionTexCoordVertex(&vertices[2], x2, y1, u2, v2);
- d3d11::SetPositionTexCoordVertex(&vertices[3], x2, y2, u2, v1);
+ gl::Box sourceArea(sourceRect.x, sourceRect.y, 0, sourceRect.width, sourceRect.height, 1);
+ gl::Extents sourceSize(sourceRenderTarget->getWidth(), sourceRenderTarget->getHeight(), 1);
- mDeviceContext->Unmap(mCopyVB, 0);
+ gl::Box destArea(xoffset, yoffset, 0, sourceRect.width, sourceRect.height, 1);
+ gl::Extents destSize(destRenderTarget->getWidth(), destRenderTarget->getHeight(), 1);
- static UINT stride = sizeof(d3d11::PositionTexCoordVertex);
- static UINT startIdx = 0;
- mDeviceContext->IASetVertexBuffers(0, 1, &mCopyVB, &stride, &startIdx);
+ // Use nearest filtering because source and destination are the same size for the direct
+ // copy
+ bool ret = mBlit->copyTexture(source, sourceArea, sourceSize, dest, destArea, destSize, NULL,
+ destFormat, GL_NEAREST);
- // Apply state
- mDeviceContext->OMSetBlendState(NULL, NULL, 0xFFFFFFF);
- mDeviceContext->OMSetDepthStencilState(NULL, 0xFFFFFFFF);
- mDeviceContext->RSSetState(NULL);
+ storage11->invalidateSwizzleCacheLevel(level);
- // Apply shaders
- mDeviceContext->IASetInputLayout(mCopyIL);
- mDeviceContext->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
- mDeviceContext->VSSetShader(mCopyVS, NULL, 0);
+ return ret;
+}
- ID3D11PixelShader *ps = NULL;
- switch(destFormat)
+bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
+ GLint xoffset, GLint yoffset, GLint zOffset, TextureStorageInterface2DArray *storage, GLint level)
+{
+ gl::FramebufferAttachment *colorbuffer = framebuffer->getReadColorbuffer();
+ if (!colorbuffer)
{
- case GL_RGBA: ps = mCopyRGBAPS; break;
- case GL_RGB: ps = mCopyRGBPS; break;
- case GL_ALPHA: ps = mCopyRGBAPS; break;
- case GL_BGRA_EXT: ps = mCopyRGBAPS; break;
- case GL_LUMINANCE: ps = mCopyLumPS; break;
- case GL_LUMINANCE_ALPHA: ps = mCopyLumAlphaPS; break;
- default: UNREACHABLE(); ps = NULL; break;
+ ERR("Failed to retrieve the color buffer from the frame buffer.");
+ return gl::error(GL_OUT_OF_MEMORY, false);
}
- mDeviceContext->PSSetShader(ps, NULL, 0);
- mDeviceContext->GSSetShader(NULL, NULL, 0);
-
- // Unset the currently bound shader resource to avoid conflicts
- static ID3D11ShaderResourceView *const nullSRV = NULL;
- mDeviceContext->PSSetShaderResources(0, 1, &nullSRV);
+ RenderTarget11 *sourceRenderTarget = RenderTarget11::makeRenderTarget11(colorbuffer->getRenderTarget());
+ if (!sourceRenderTarget)
+ {
+ ERR("Failed to retrieve the render target from the frame buffer.");
+ return gl::error(GL_OUT_OF_MEMORY, false);
+ }
- // Apply render target
- setOneTimeRenderTarget(dest);
+ ID3D11ShaderResourceView *source = sourceRenderTarget->getShaderResourceView();
+ if (!source)
+ {
+ ERR("Failed to retrieve the render target view from the render target.");
+ return gl::error(GL_OUT_OF_MEMORY, false);
+ }
- // Set the viewport
- D3D11_VIEWPORT viewport;
- viewport.TopLeftX = 0;
- viewport.TopLeftY = 0;
- viewport.Width = destWidth;
- viewport.Height = destHeight;
- viewport.MinDepth = 0.0f;
- viewport.MaxDepth = 1.0f;
- mDeviceContext->RSSetViewports(1, &viewport);
+ TextureStorage11_2DArray *storage11 = TextureStorage11_2DArray::makeTextureStorage11_2DArray(storage->getStorageInstance());
+ if (!storage11)
+ {
+ SafeRelease(source);
+ ERR("Failed to retrieve the texture storage from the destination.");
+ return gl::error(GL_OUT_OF_MEMORY, false);
+ }
- // Apply textures
- mDeviceContext->PSSetShaderResources(0, 1, &source);
- mDeviceContext->PSSetSamplers(0, 1, &mCopySampler);
+ RenderTarget11 *destRenderTarget = RenderTarget11::makeRenderTarget11(storage11->getRenderTargetLayer(level, zOffset));
+ if (!destRenderTarget)
+ {
+ SafeRelease(source);
+ ERR("Failed to retrieve the render target from the destination storage.");
+ return gl::error(GL_OUT_OF_MEMORY, false);
+ }
- // Draw the quad
- mDeviceContext->Draw(4, 0);
+ ID3D11RenderTargetView *dest = destRenderTarget->getRenderTargetView();
+ if (!dest)
+ {
+ ERR("Failed to retrieve the render target view from the destination render target.");
+ return gl::error(GL_OUT_OF_MEMORY, false);
+ }
- // Unbind textures and render targets and vertex buffer
- mDeviceContext->PSSetShaderResources(0, 1, &nullSRV);
+ gl::Box sourceArea(sourceRect.x, sourceRect.y, 0, sourceRect.width, sourceRect.height, 1);
+ gl::Extents sourceSize(sourceRenderTarget->getWidth(), sourceRenderTarget->getHeight(), 1);
- unapplyRenderTargets();
+ gl::Box destArea(xoffset, yoffset, 0, sourceRect.width, sourceRect.height, 1);
+ gl::Extents destSize(destRenderTarget->getWidth(), destRenderTarget->getHeight(), 1);
- UINT zero = 0;
- ID3D11Buffer *const nullBuffer = NULL;
- mDeviceContext->IASetVertexBuffers(0, 1, &nullBuffer, &zero, &zero);
+ // Use nearest filtering because source and destination are the same size for the direct
+ // copy
+ bool ret = mBlit->copyTexture(source, sourceArea, sourceSize, dest, destArea, destSize, NULL,
+ destFormat, GL_NEAREST);
- markAllStateDirty();
+ storage11->invalidateSwizzleCacheLevel(level);
- return true;
+ return ret;
}
void Renderer11::unapplyRenderTargets()
@@ -2760,8 +2906,9 @@ RenderTarget *Renderer11::createRenderTarget(SwapChain *swapChain, bool depth)
{
// Note: depth stencil may be NULL for 0 sized surfaces
renderTarget = new RenderTarget11(this, swapChain11->getDepthStencil(),
- swapChain11->getDepthStencilTexture(), NULL,
- swapChain11->getWidth(), swapChain11->getHeight());
+ swapChain11->getDepthStencilTexture(),
+ swapChain11->getDepthStencilShaderResource(),
+ swapChain11->getWidth(), swapChain11->getHeight(), 1);
}
else
{
@@ -2769,56 +2916,87 @@ RenderTarget *Renderer11::createRenderTarget(SwapChain *swapChain, bool depth)
renderTarget = new RenderTarget11(this, swapChain11->getRenderTarget(),
swapChain11->getOffscreenTexture(),
swapChain11->getRenderTargetShaderResource(),
- swapChain11->getWidth(), swapChain11->getHeight());
+ swapChain11->getWidth(), swapChain11->getHeight(), 1);
}
return renderTarget;
}
-RenderTarget *Renderer11::createRenderTarget(int width, int height, GLenum format, GLsizei samples, bool depth)
+RenderTarget *Renderer11::createRenderTarget(int width, int height, GLenum format, GLsizei samples)
{
- RenderTarget11 *renderTarget = new RenderTarget11(this, width, height, format, samples, depth);
+ RenderTarget11 *renderTarget = new RenderTarget11(this, width, height, format, samples);
return renderTarget;
}
-ShaderExecutable *Renderer11::loadExecutable(const void *function, size_t length, rx::ShaderType type)
+ShaderExecutable *Renderer11::loadExecutable(const void *function, size_t length, rx::ShaderType type,
+ const std::vector<gl::LinkedVarying> &transformFeedbackVaryings,
+ bool separatedOutputBuffers)
{
ShaderExecutable11 *executable = NULL;
+ HRESULT result;
switch (type)
{
case rx::SHADER_VERTEX:
{
- ID3D11VertexShader *vshader = NULL;
- HRESULT result = mDevice->CreateVertexShader(function, length, NULL, &vshader);
+ ID3D11VertexShader *vertexShader = NULL;
+ ID3D11GeometryShader *streamOutShader = NULL;
+
+ result = mDevice->CreateVertexShader(function, length, NULL, &vertexShader);
ASSERT(SUCCEEDED(result));
- if (vshader)
+ if (transformFeedbackVaryings.size() > 0)
+ {
+ std::vector<D3D11_SO_DECLARATION_ENTRY> soDeclaration;
+ for (size_t i = 0; i < transformFeedbackVaryings.size(); i++)
+ {
+ const gl::LinkedVarying &varying = transformFeedbackVaryings[i];
+ for (size_t j = 0; j < varying.semanticIndexCount; j++)
+ {
+ D3D11_SO_DECLARATION_ENTRY entry = { 0 };
+ entry.Stream = 0;
+ entry.SemanticName = varying.semanticName.c_str();
+ entry.SemanticIndex = varying.semanticIndex + j;
+ entry.StartComponent = 0;
+ entry.ComponentCount = gl::VariableRowCount(type);
+ entry.OutputSlot = (separatedOutputBuffers ? i : 0);
+ soDeclaration.push_back(entry);
+ }
+ }
+
+ result = mDevice->CreateGeometryShaderWithStreamOutput(function, length, soDeclaration.data(), soDeclaration.size(),
+ NULL, 0, 0, NULL, &streamOutShader);
+ ASSERT(SUCCEEDED(result));
+ }
+
+ if (vertexShader)
{
- executable = new ShaderExecutable11(function, length, vshader);
+ executable = new ShaderExecutable11(function, length, vertexShader, streamOutShader);
}
}
break;
case rx::SHADER_PIXEL:
{
- ID3D11PixelShader *pshader = NULL;
- HRESULT result = mDevice->CreatePixelShader(function, length, NULL, &pshader);
+ ID3D11PixelShader *pixelShader = NULL;
+
+ result = mDevice->CreatePixelShader(function, length, NULL, &pixelShader);
ASSERT(SUCCEEDED(result));
- if (pshader)
+ if (pixelShader)
{
- executable = new ShaderExecutable11(function, length, pshader);
+ executable = new ShaderExecutable11(function, length, pixelShader);
}
}
break;
case rx::SHADER_GEOMETRY:
{
- ID3D11GeometryShader *gshader = NULL;
- HRESULT result = mDevice->CreateGeometryShader(function, length, NULL, &gshader);
+ ID3D11GeometryShader *geometryShader = NULL;
+
+ result = mDevice->CreateGeometryShader(function, length, NULL, &geometryShader);
ASSERT(SUCCEEDED(result));
- if (gshader)
+ if (geometryShader)
{
- executable = new ShaderExecutable11(function, length, gshader);
+ executable = new ShaderExecutable11(function, length, geometryShader);
}
}
break;
@@ -2830,36 +3008,98 @@ ShaderExecutable *Renderer11::loadExecutable(const void *function, size_t length
return executable;
}
-ShaderExecutable *Renderer11::compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type, D3DWorkaroundType workaround)
+ShaderExecutable *Renderer11::compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type,
+ const std::vector<gl::LinkedVarying> &transformFeedbackVaryings,
+ bool separatedOutputBuffers, D3DWorkaroundType workaround)
{
- const char *profile = NULL;
-
+ const char *profileType = NULL;
switch (type)
{
case rx::SHADER_VERTEX:
- profile = "vs_4_0";
+ profileType = "vs";
break;
case rx::SHADER_PIXEL:
- profile = "ps_4_0";
+ profileType = "ps";
break;
case rx::SHADER_GEOMETRY:
- profile = "gs_4_0";
+ profileType = "gs";
+ break;
+ default:
+ UNREACHABLE();
+ return NULL;
+ }
+
+ const char *profileVersion = NULL;
+ switch (mFeatureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_0:
+ profileVersion = "5_0";
+ break;
+ case D3D_FEATURE_LEVEL_10_1:
+ profileVersion = "4_1";
+ break;
+ case D3D_FEATURE_LEVEL_10_0:
+ profileVersion = "4_0";
break;
default:
UNREACHABLE();
return NULL;
}
- ID3DBlob *binary = (ID3DBlob*)compileToBinary(infoLog, shaderHLSL, profile, D3DCOMPILE_OPTIMIZATION_LEVEL0, false);
+ char profile[32];
+ snprintf(profile, ArraySize(profile), "%s_%s", profileType, profileVersion);
+
+ UINT flags = D3DCOMPILE_OPTIMIZATION_LEVEL0;
+
+ if (gl::perfActive())
+ {
+#ifndef NDEBUG
+ flags = D3DCOMPILE_SKIP_OPTIMIZATION;
+#endif
+
+ flags |= D3DCOMPILE_DEBUG;
+
+ std::string sourcePath = getTempPath();
+ std::string sourceText = std::string("#line 2 \"") + sourcePath + std::string("\"\n\n") + std::string(shaderHLSL);
+ writeFile(sourcePath.c_str(), sourceText.c_str(), sourceText.size());
+ }
+
+ // Sometimes D3DCompile will fail with the default compilation flags for complicated shaders when it would otherwise pass with alternative options.
+ // Try the default flags first and if compilation fails, try some alternatives.
+ const UINT extraFlags[] =
+ {
+ flags,
+ flags | D3DCOMPILE_SKIP_VALIDATION,
+ flags | D3DCOMPILE_SKIP_OPTIMIZATION
+ };
+
+ const static char *extraFlagNames[] =
+ {
+ "default",
+ "skip validation",
+ "skip optimization"
+ };
+
+ int attempts = ArraySize(extraFlags);
+
+ ID3DBlob *binary = (ID3DBlob*)mCompiler.compileToBinary(infoLog, shaderHLSL, profile, extraFlags, extraFlagNames, attempts);
if (!binary)
+ {
return NULL;
+ }
- ShaderExecutable *executable = loadExecutable((DWORD *)binary->GetBufferPointer(), binary->GetBufferSize(), type);
- binary->Release();
+ ShaderExecutable *executable = loadExecutable((DWORD *)binary->GetBufferPointer(), binary->GetBufferSize(), type,
+ transformFeedbackVaryings, separatedOutputBuffers);
+ SafeRelease(binary);
return executable;
}
+rx::UniformStorage *Renderer11::createUniformStorage(size_t storageSize)
+{
+ return new UniformStorage11(this, storageSize);
+}
+
VertexBuffer *Renderer11::createVertexBuffer()
{
return new VertexBuffer11(this);
@@ -2885,7 +3125,51 @@ FenceImpl *Renderer11::createFence()
return new Fence11(this);
}
-bool Renderer11::getRenderTargetResource(gl::Renderbuffer *colorbuffer, unsigned int *subresourceIndex, ID3D11Texture2D **resource)
+bool Renderer11::supportsFastCopyBufferToTexture(GLenum internalFormat) const
+{
+ int clientVersion = getCurrentClientVersion();
+
+ // We only support buffer to texture copies in ES3
+ if (clientVersion <= 2)
+ {
+ return false;
+ }
+
+ // sRGB formats do not work with D3D11 buffer SRVs
+ if (gl::GetColorEncoding(internalFormat, clientVersion) == GL_SRGB)
+ {
+ return false;
+ }
+
+ // We cannot support direct copies to non-color-renderable formats
+ if (!gl::IsColorRenderingSupported(internalFormat, this))
+ {
+ return false;
+ }
+
+ // We skip all 3-channel formats since sometimes format support is missing
+ if (gl::GetComponentCount(internalFormat, clientVersion) == 3)
+ {
+ return false;
+ }
+
+ // We don't support formats which we can't represent without conversion
+ if (getNativeTextureFormat(internalFormat) != internalFormat)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool Renderer11::fastCopyBufferToTexture(const gl::PixelUnpackState &unpack, unsigned int offset, RenderTarget *destRenderTarget,
+ GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &destArea)
+{
+ ASSERT(supportsFastCopyBufferToTexture(destinationFormat));
+ return mPixelTransfer->copyBufferToTexture(unpack, offset, destRenderTarget, destinationFormat, sourcePixelsType, destArea);
+}
+
+bool Renderer11::getRenderTargetResource(gl::FramebufferAttachment *colorbuffer, unsigned int *subresourceIndex, ID3D11Texture2D **resource)
{
ASSERT(colorbuffer != NULL);
@@ -2902,8 +3186,8 @@ bool Renderer11::getRenderTargetResource(gl::Renderbuffer *colorbuffer, unsigned
if (textureResource)
{
- HRESULT result = textureResource->QueryInterface(IID_ID3D11Texture2D, (void**)resource);
- textureResource->Release();
+ HRESULT result = textureResource->QueryInterface(__uuidof(ID3D11Texture2D), (void**)resource);
+ SafeRelease(textureResource);
if (SUCCEEDED(result))
{
@@ -2922,11 +3206,11 @@ bool Renderer11::getRenderTargetResource(gl::Renderbuffer *colorbuffer, unsigned
}
bool Renderer11::blitRect(gl::Framebuffer *readTarget, const gl::Rectangle &readRect, gl::Framebuffer *drawTarget, const gl::Rectangle &drawRect,
- bool blitRenderTarget, bool blitDepthStencil)
+ const gl::Rectangle *scissor, bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter)
{
if (blitRenderTarget)
{
- gl::Renderbuffer *readBuffer = readTarget->getReadColorbuffer();
+ gl::FramebufferAttachment *readBuffer = readTarget->getReadColorbuffer();
if (!readBuffer)
{
@@ -2940,7 +3224,7 @@ bool Renderer11::blitRect(gl::Framebuffer *readTarget, const gl::Rectangle &read
{
if (drawTarget->isEnabledColorAttachment(colorAttachment))
{
- gl::Renderbuffer *drawBuffer = drawTarget->getColorbuffer(colorAttachment);
+ gl::FramebufferAttachment *drawBuffer = drawTarget->getColorbuffer(colorAttachment);
if (!drawBuffer)
{
@@ -2950,7 +3234,8 @@ bool Renderer11::blitRect(gl::Framebuffer *readTarget, const gl::Rectangle &read
RenderTarget *drawRenderTarget = drawBuffer->getRenderTarget();
- if (!blitRenderbufferRect(readRect, drawRect, readRenderTarget, drawRenderTarget, false))
+ if (!blitRenderbufferRect(readRect, drawRect, readRenderTarget, drawRenderTarget, filter, scissor,
+ blitRenderTarget, false, false))
{
return false;
}
@@ -2958,10 +3243,10 @@ bool Renderer11::blitRect(gl::Framebuffer *readTarget, const gl::Rectangle &read
}
}
- if (blitDepthStencil)
+ if (blitDepth || blitStencil)
{
- gl::Renderbuffer *readBuffer = readTarget->getDepthOrStencilbuffer();
- gl::Renderbuffer *drawBuffer = drawTarget->getDepthOrStencilbuffer();
+ gl::FramebufferAttachment *readBuffer = readTarget->getDepthOrStencilbuffer();
+ gl::FramebufferAttachment *drawBuffer = drawTarget->getDepthOrStencilbuffer();
if (!readBuffer)
{
@@ -2978,22 +3263,25 @@ bool Renderer11::blitRect(gl::Framebuffer *readTarget, const gl::Rectangle &read
RenderTarget *readRenderTarget = readBuffer->getDepthStencil();
RenderTarget *drawRenderTarget = drawBuffer->getDepthStencil();
- if (!blitRenderbufferRect(readRect, drawRect, readRenderTarget, drawRenderTarget, true))
+ if (!blitRenderbufferRect(readRect, drawRect, readRenderTarget, drawRenderTarget, filter, scissor,
+ false, blitDepth, blitStencil))
{
return false;
}
}
+ invalidateFramebufferSwizzles(drawTarget);
+
return true;
}
-void Renderer11::readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
- GLsizei outputPitch, bool packReverseRowOrder, GLint packAlignment, void* pixels)
+void Renderer11::readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format,
+ GLenum type, GLuint outputPitch, const gl::PixelPackState &pack, void* pixels)
{
ID3D11Texture2D *colorBufferTexture = NULL;
unsigned int subresourceIndex = 0;
- gl::Renderbuffer *colorbuffer = framebuffer->getReadColorbuffer();
+ gl::FramebufferAttachment *colorbuffer = framebuffer->getReadColorbuffer();
if (colorbuffer && getRenderTargetResource(colorbuffer, &subresourceIndex, &colorBufferTexture))
{
@@ -3003,11 +3291,18 @@ void Renderer11::readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsi
area.width = width;
area.height = height;
- readTextureData(colorBufferTexture, subresourceIndex, area, format, type, outputPitch,
- packReverseRowOrder, packAlignment, pixels);
+ if (pack.pixelBuffer.get() != NULL)
+ {
+ rx::BufferStorage11 *packBufferStorage = BufferStorage11::makeBufferStorage11(pack.pixelBuffer.get()->getStorage());
+ PackPixelsParams packParams(area, format, type, outputPitch, pack, reinterpret_cast<ptrdiff_t>(pixels));
+ packBufferStorage->packPixels(colorBufferTexture, subresourceIndex, packParams);
+ }
+ else
+ {
+ readTextureData(colorBufferTexture, subresourceIndex, area, format, type, outputPitch, pack, pixels);
+ }
- colorBufferTexture->Release();
- colorBufferTexture = NULL;
+ SafeRelease(colorBufferTexture);
}
}
@@ -3020,7 +3315,7 @@ void Renderer11::generateMipmap(Image *dest, Image *src)
{
Image11 *dest11 = Image11::makeImage11(dest);
Image11 *src11 = Image11::makeImage11(src);
- Image11::generateMipmap(dest11, src11);
+ Image11::generateMipmap(getCurrentClientVersion(), dest11, src11);
}
TextureStorage *Renderer11::createTextureStorage2D(SwapChain *swapChain)
@@ -3029,278 +3324,58 @@ TextureStorage *Renderer11::createTextureStorage2D(SwapChain *swapChain)
return new TextureStorage11_2D(this, swapChain11);
}
-TextureStorage *Renderer11::createTextureStorage2D(int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height)
+TextureStorage *Renderer11::createTextureStorage2D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels)
{
- return new TextureStorage11_2D(this, levels, internalformat, usage, forceRenderable, width, height);
+ return new TextureStorage11_2D(this, internalformat, renderTarget, width, height, levels);
}
-TextureStorage *Renderer11::createTextureStorageCube(int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size)
+TextureStorage *Renderer11::createTextureStorageCube(GLenum internalformat, bool renderTarget, int size, int levels)
{
- return new TextureStorage11_Cube(this, levels, internalformat, usage, forceRenderable, size);
+ return new TextureStorage11_Cube(this, internalformat, renderTarget, size, levels);
}
-static inline unsigned int getFastPixelCopySize(DXGI_FORMAT sourceFormat, GLenum destFormat, GLenum destType)
+TextureStorage *Renderer11::createTextureStorage3D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, GLsizei depth, int levels)
{
- if (sourceFormat == DXGI_FORMAT_A8_UNORM &&
- destFormat == GL_ALPHA &&
- destType == GL_UNSIGNED_BYTE)
- {
- return 1;
- }
- else if (sourceFormat == DXGI_FORMAT_R8G8B8A8_UNORM &&
- destFormat == GL_RGBA &&
- destType == GL_UNSIGNED_BYTE)
- {
- return 4;
- }
- else if (sourceFormat == DXGI_FORMAT_B8G8R8A8_UNORM &&
- destFormat == GL_BGRA_EXT &&
- destType == GL_UNSIGNED_BYTE)
- {
- return 4;
- }
- else if (sourceFormat == DXGI_FORMAT_R16G16B16A16_FLOAT &&
- destFormat == GL_RGBA &&
- destType == GL_HALF_FLOAT_OES)
- {
- return 8;
- }
- else if (sourceFormat == DXGI_FORMAT_R32G32B32_FLOAT &&
- destFormat == GL_RGB &&
- destType == GL_FLOAT)
- {
- return 12;
- }
- else if (sourceFormat == DXGI_FORMAT_R32G32B32A32_FLOAT &&
- destFormat == GL_RGBA &&
- destType == GL_FLOAT)
- {
- return 16;
- }
- else
- {
- return 0;
- }
+ return new TextureStorage11_3D(this, internalformat, renderTarget, width, height, depth, levels);
}
-static inline void readPixelColor(const unsigned char *data, DXGI_FORMAT format, unsigned int x,
- unsigned int y, int inputPitch, gl::Color *outColor)
+TextureStorage *Renderer11::createTextureStorage2DArray(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, GLsizei depth, int levels)
{
- switch (format)
- {
- case DXGI_FORMAT_R8G8B8A8_UNORM:
- {
- unsigned int rgba = *reinterpret_cast<const unsigned int*>(data + 4 * x + y * inputPitch);
- outColor->red = (rgba & 0x000000FF) * (1.0f / 0x000000FF);
- outColor->green = (rgba & 0x0000FF00) * (1.0f / 0x0000FF00);
- outColor->blue = (rgba & 0x00FF0000) * (1.0f / 0x00FF0000);
- outColor->alpha = (rgba & 0xFF000000) * (1.0f / 0xFF000000);
- }
- break;
-
- case DXGI_FORMAT_A8_UNORM:
- {
- outColor->red = 0.0f;
- outColor->green = 0.0f;
- outColor->blue = 0.0f;
- outColor->alpha = *(data + x + y * inputPitch) / 255.0f;
- }
- break;
-
- case DXGI_FORMAT_R32G32B32A32_FLOAT:
- {
- outColor->red = *(reinterpret_cast<const float*>(data + 16 * x + y * inputPitch) + 0);
- outColor->green = *(reinterpret_cast<const float*>(data + 16 * x + y * inputPitch) + 1);
- outColor->blue = *(reinterpret_cast<const float*>(data + 16 * x + y * inputPitch) + 2);
- outColor->alpha = *(reinterpret_cast<const float*>(data + 16 * x + y * inputPitch) + 3);
- }
- break;
-
- case DXGI_FORMAT_R32G32B32_FLOAT:
- {
- outColor->red = *(reinterpret_cast<const float*>(data + 12 * x + y * inputPitch) + 0);
- outColor->green = *(reinterpret_cast<const float*>(data + 12 * x + y * inputPitch) + 1);
- outColor->blue = *(reinterpret_cast<const float*>(data + 12 * x + y * inputPitch) + 2);
- outColor->alpha = 1.0f;
- }
- break;
-
- case DXGI_FORMAT_R16G16B16A16_FLOAT:
- {
- outColor->red = gl::float16ToFloat32(*(reinterpret_cast<const unsigned short*>(data + 8 * x + y * inputPitch) + 0));
- outColor->green = gl::float16ToFloat32(*(reinterpret_cast<const unsigned short*>(data + 8 * x + y * inputPitch) + 1));
- outColor->blue = gl::float16ToFloat32(*(reinterpret_cast<const unsigned short*>(data + 8 * x + y * inputPitch) + 2));
- outColor->alpha = gl::float16ToFloat32(*(reinterpret_cast<const unsigned short*>(data + 8 * x + y * inputPitch) + 3));
- }
- break;
-
- case DXGI_FORMAT_B8G8R8A8_UNORM:
- {
- unsigned int bgra = *reinterpret_cast<const unsigned int*>(data + 4 * x + y * inputPitch);
- outColor->red = (bgra & 0x00FF0000) * (1.0f / 0x00FF0000);
- outColor->blue = (bgra & 0x000000FF) * (1.0f / 0x000000FF);
- outColor->green = (bgra & 0x0000FF00) * (1.0f / 0x0000FF00);
- outColor->alpha = (bgra & 0xFF000000) * (1.0f / 0xFF000000);
- }
- break;
-
- case DXGI_FORMAT_R8_UNORM:
- {
- outColor->red = *(data + x + y * inputPitch) / 255.0f;
- outColor->green = 0.0f;
- outColor->blue = 0.0f;
- outColor->alpha = 1.0f;
- }
- break;
-
- case DXGI_FORMAT_R8G8_UNORM:
- {
- unsigned short rg = *reinterpret_cast<const unsigned short*>(data + 2 * x + y * inputPitch);
-
- outColor->red = (rg & 0xFF00) * (1.0f / 0xFF00);
- outColor->green = (rg & 0x00FF) * (1.0f / 0x00FF);
- outColor->blue = 0.0f;
- outColor->alpha = 1.0f;
- }
- break;
-
- case DXGI_FORMAT_R16_FLOAT:
- {
- outColor->red = gl::float16ToFloat32(*reinterpret_cast<const unsigned short*>(data + 2 * x + y * inputPitch));
- outColor->green = 0.0f;
- outColor->blue = 0.0f;
- outColor->alpha = 1.0f;
- }
- break;
-
- case DXGI_FORMAT_R16G16_FLOAT:
- {
- outColor->red = gl::float16ToFloat32(*(reinterpret_cast<const unsigned short*>(data + 4 * x + y * inputPitch) + 0));
- outColor->green = gl::float16ToFloat32(*(reinterpret_cast<const unsigned short*>(data + 4 * x + y * inputPitch) + 1));
- outColor->blue = 0.0f;
- outColor->alpha = 1.0f;
- }
- break;
-
- default:
- ERR("ReadPixelColor not implemented for DXGI format %u.", format);
- UNIMPLEMENTED();
- break;
- }
+ return new TextureStorage11_2DArray(this, internalformat, renderTarget, width, height, depth, levels);
}
-static inline void writePixelColor(const gl::Color &color, GLenum format, GLenum type, unsigned int x,
- unsigned int y, int outputPitch, void *outData)
+void Renderer11::readTextureData(ID3D11Texture2D *texture, unsigned int subResource, const gl::Rectangle &area, GLenum format,
+ GLenum type, GLuint outputPitch, const gl::PixelPackState &pack, void *pixels)
{
- unsigned char* byteData = reinterpret_cast<unsigned char*>(outData);
- unsigned short* shortData = reinterpret_cast<unsigned short*>(outData);
-
- switch (format)
- {
- case GL_RGBA:
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- byteData[4 * x + y * outputPitch + 0] = static_cast<unsigned char>(255 * color.red + 0.5f);
- byteData[4 * x + y * outputPitch + 1] = static_cast<unsigned char>(255 * color.green + 0.5f);
- byteData[4 * x + y * outputPitch + 2] = static_cast<unsigned char>(255 * color.blue + 0.5f);
- byteData[4 * x + y * outputPitch + 3] = static_cast<unsigned char>(255 * color.alpha + 0.5f);
- break;
-
- default:
- ERR("WritePixelColor not implemented for format GL_RGBA and type 0x%X.", type);
- UNIMPLEMENTED();
- break;
- }
- break;
-
- case GL_BGRA_EXT:
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- byteData[4 * x + y * outputPitch + 0] = static_cast<unsigned char>(255 * color.blue + 0.5f);
- byteData[4 * x + y * outputPitch + 1] = static_cast<unsigned char>(255 * color.green + 0.5f);
- byteData[4 * x + y * outputPitch + 2] = static_cast<unsigned char>(255 * color.red + 0.5f);
- byteData[4 * x + y * outputPitch + 3] = static_cast<unsigned char>(255 * color.alpha + 0.5f);
- break;
-
- case GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT:
- // According to the desktop GL spec in the "Transfer of Pixel Rectangles" section
- // this type is packed as follows:
- // 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
- // --------------------------------------------------------------------------------
- // | 4th | 3rd | 2nd | 1st component |
- // --------------------------------------------------------------------------------
- // in the case of BGRA_EXT, B is the first component, G the second, and so forth.
- shortData[x + y * outputPitch / sizeof(unsigned short)] =
- (static_cast<unsigned short>(15 * color.alpha + 0.5f) << 12) |
- (static_cast<unsigned short>(15 * color.red + 0.5f) << 8) |
- (static_cast<unsigned short>(15 * color.green + 0.5f) << 4) |
- (static_cast<unsigned short>(15 * color.blue + 0.5f) << 0);
- break;
-
- case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT:
- // According to the desktop GL spec in the "Transfer of Pixel Rectangles" section
- // this type is packed as follows:
- // 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
- // --------------------------------------------------------------------------------
- // | 4th | 3rd | 2nd | 1st component |
- // --------------------------------------------------------------------------------
- // in the case of BGRA_EXT, B is the first component, G the second, and so forth.
- shortData[x + y * outputPitch / sizeof(unsigned short)] =
- (static_cast<unsigned short>( color.alpha + 0.5f) << 15) |
- (static_cast<unsigned short>(31 * color.red + 0.5f) << 10) |
- (static_cast<unsigned short>(31 * color.green + 0.5f) << 5) |
- (static_cast<unsigned short>(31 * color.blue + 0.5f) << 0);
- break;
-
- default:
- ERR("WritePixelColor not implemented for format GL_BGRA_EXT and type 0x%X.", type);
- UNIMPLEMENTED();
- break;
- }
- break;
+ ASSERT(area.width >= 0);
+ ASSERT(area.height >= 0);
- case GL_RGB:
- switch (type)
- {
- case GL_UNSIGNED_SHORT_5_6_5:
- shortData[x + y * outputPitch / sizeof(unsigned short)] =
- (static_cast<unsigned short>(31 * color.blue + 0.5f) << 0) |
- (static_cast<unsigned short>(63 * color.green + 0.5f) << 5) |
- (static_cast<unsigned short>(31 * color.red + 0.5f) << 11);
- break;
+ D3D11_TEXTURE2D_DESC textureDesc;
+ texture->GetDesc(&textureDesc);
- case GL_UNSIGNED_BYTE:
- byteData[3 * x + y * outputPitch + 0] = static_cast<unsigned char>(255 * color.red + 0.5f);
- byteData[3 * x + y * outputPitch + 1] = static_cast<unsigned char>(255 * color.green + 0.5f);
- byteData[3 * x + y * outputPitch + 2] = static_cast<unsigned char>(255 * color.blue + 0.5f);
- break;
+ // Clamp read region to the defined texture boundaries, preventing out of bounds reads
+ // and reads of uninitialized data.
+ gl::Rectangle safeArea;
+ safeArea.x = gl::clamp(area.x, 0, static_cast<int>(textureDesc.Width));
+ safeArea.y = gl::clamp(area.y, 0, static_cast<int>(textureDesc.Height));
+ safeArea.width = gl::clamp(area.width + std::min(area.x, 0), 0,
+ static_cast<int>(textureDesc.Width) - safeArea.x);
+ safeArea.height = gl::clamp(area.height + std::min(area.y, 0), 0,
+ static_cast<int>(textureDesc.Height) - safeArea.y);
- default:
- ERR("WritePixelColor not implemented for format GL_RGB and type 0x%X.", type);
- UNIMPLEMENTED();
- break;
- }
- break;
+ ASSERT(safeArea.x >= 0 && safeArea.y >= 0);
+ ASSERT(safeArea.x + safeArea.width <= static_cast<int>(textureDesc.Width));
+ ASSERT(safeArea.y + safeArea.height <= static_cast<int>(textureDesc.Height));
- default:
- ERR("WritePixelColor not implemented for format 0x%X.", format);
- UNIMPLEMENTED();
- break;
+ if (safeArea.width == 0 || safeArea.height == 0)
+ {
+ // no work to do
+ return;
}
-}
-
-void Renderer11::readTextureData(ID3D11Texture2D *texture, unsigned int subResource, const gl::Rectangle &area,
- GLenum format, GLenum type, GLsizei outputPitch, bool packReverseRowOrder,
- GLint packAlignment, void *pixels)
-{
- D3D11_TEXTURE2D_DESC textureDesc;
- texture->GetDesc(&textureDesc);
D3D11_TEXTURE2D_DESC stagingDesc;
- stagingDesc.Width = area.width;
- stagingDesc.Height = area.height;
+ stagingDesc.Width = safeArea.width;
+ stagingDesc.Height = safeArea.height;
stagingDesc.MipLevels = 1;
stagingDesc.ArraySize = 1;
stagingDesc.Format = textureDesc.Format;
@@ -3339,7 +3414,7 @@ void Renderer11::readTextureData(ID3D11Texture2D *texture, unsigned int subResou
if (FAILED(result))
{
ERR("Failed to create resolve texture for readPixels, HRESULT: 0x%X.", result);
- stagingTex->Release();
+ SafeRelease(stagingTex);
return;
}
@@ -3353,26 +3428,38 @@ void Renderer11::readTextureData(ID3D11Texture2D *texture, unsigned int subResou
}
D3D11_BOX srcBox;
- srcBox.left = area.x;
- srcBox.right = area.x + area.width;
- srcBox.top = area.y;
- srcBox.bottom = area.y + area.height;
- srcBox.front = 0;
- srcBox.back = 1;
+ srcBox.left = static_cast<UINT>(safeArea.x);
+ srcBox.right = static_cast<UINT>(safeArea.x + safeArea.width);
+ srcBox.top = static_cast<UINT>(safeArea.y);
+ srcBox.bottom = static_cast<UINT>(safeArea.y + safeArea.height);
+ srcBox.front = 0;
+ srcBox.back = 1;
mDeviceContext->CopySubresourceRegion(stagingTex, 0, 0, 0, 0, srcTex, subResource, &srcBox);
- srcTex->Release();
- srcTex = NULL;
+ SafeRelease(srcTex);
+
+ PackPixelsParams packParams(safeArea, format, type, outputPitch, pack, 0);
+ packPixels(stagingTex, packParams, pixels);
+
+ SafeRelease(stagingTex);
+}
+
+void Renderer11::packPixels(ID3D11Texture2D *readTexture, const PackPixelsParams &params, void *pixelsOut)
+{
+ D3D11_TEXTURE2D_DESC textureDesc;
+ readTexture->GetDesc(&textureDesc);
D3D11_MAPPED_SUBRESOURCE mapping;
- mDeviceContext->Map(stagingTex, 0, D3D11_MAP_READ, 0, &mapping);
+ HRESULT hr = mDeviceContext->Map(readTexture, 0, D3D11_MAP_READ, 0, &mapping);
+ UNUSED_ASSERTION_VARIABLE(hr);
+ ASSERT(SUCCEEDED(hr));
unsigned char *source;
int inputPitch;
- if (packReverseRowOrder)
+ if (params.pack.reverseRowOrder)
{
- source = static_cast<unsigned char*>(mapping.pData) + mapping.RowPitch * (area.height - 1);
+ source = static_cast<unsigned char*>(mapping.pData) + mapping.RowPitch * (params.area.height - 1);
inputPitch = -static_cast<int>(mapping.RowPitch);
}
else
@@ -3381,57 +3468,81 @@ void Renderer11::readTextureData(ID3D11Texture2D *texture, unsigned int subResou
inputPitch = static_cast<int>(mapping.RowPitch);
}
- unsigned int fastPixelSize = getFastPixelCopySize(textureDesc.Format, format, type);
- if (fastPixelSize != 0)
+ GLuint clientVersion = getCurrentClientVersion();
+
+ GLenum sourceInternalFormat = d3d11_gl::GetInternalFormat(textureDesc.Format, clientVersion);
+ GLenum sourceFormat = gl::GetFormat(sourceInternalFormat, clientVersion);
+ GLenum sourceType = gl::GetType(sourceInternalFormat, clientVersion);
+
+ GLuint sourcePixelSize = gl::GetPixelBytes(sourceInternalFormat, clientVersion);
+
+ if (sourceFormat == params.format && sourceType == params.type)
{
- unsigned char *dest = static_cast<unsigned char*>(pixels);
- for (int j = 0; j < area.height; j++)
+ unsigned char *dest = static_cast<unsigned char*>(pixelsOut) + params.offset;
+ for (int y = 0; y < params.area.height; y++)
{
- memcpy(dest + j * outputPitch, source + j * inputPitch, area.width * fastPixelSize);
+ memcpy(dest + y * params.outputPitch, source + y * inputPitch, params.area.width * sourcePixelSize);
}
}
- else if (textureDesc.Format == DXGI_FORMAT_B8G8R8A8_UNORM &&
- format == GL_RGBA &&
- type == GL_UNSIGNED_BYTE)
+ else
{
- // Fast path for swapping red with blue
- unsigned char *dest = static_cast<unsigned char*>(pixels);
+ GLenum destInternalFormat = gl::GetSizedInternalFormat(params.format, params.type, clientVersion);
+ GLuint destPixelSize = gl::GetPixelBytes(destInternalFormat, clientVersion);
- for (int j = 0; j < area.height; j++)
+ ColorCopyFunction fastCopyFunc = d3d11::GetFastCopyFunction(textureDesc.Format, params.format, params.type);
+ if (fastCopyFunc)
{
- for (int i = 0; i < area.width; i++)
+ // Fast copy is possible through some special function
+ for (int y = 0; y < params.area.height; y++)
{
- unsigned int argb = *(unsigned int*)(source + 4 * i + j * inputPitch);
- *(unsigned int*)(dest + 4 * i + j * outputPitch) =
- (argb & 0xFF00FF00) | // Keep alpha and green
- (argb & 0x00FF0000) >> 16 | // Move red to blue
- (argb & 0x000000FF) << 16; // Move blue to red
+ for (int x = 0; x < params.area.width; x++)
+ {
+ void *dest = static_cast<unsigned char*>(pixelsOut) + params.offset + y * params.outputPitch + x * destPixelSize;
+ void *src = static_cast<unsigned char*>(source) + y * inputPitch + x * sourcePixelSize;
+
+ fastCopyFunc(src, dest);
+ }
}
}
- }
- else
- {
- gl::Color pixelColor;
- for (int j = 0; j < area.height; j++)
+ else
{
- for (int i = 0; i < area.width; i++)
+ ColorReadFunction readFunc = d3d11::GetColorReadFunction(textureDesc.Format);
+ ColorWriteFunction writeFunc = gl::GetColorWriteFunction(params.format, params.type, clientVersion);
+
+ unsigned char temp[16]; // Maximum size of any Color<T> type used.
+ META_ASSERT(sizeof(temp) >= sizeof(gl::ColorF) &&
+ sizeof(temp) >= sizeof(gl::ColorUI) &&
+ sizeof(temp) >= sizeof(gl::ColorI));
+
+ for (int y = 0; y < params.area.height; y++)
{
- readPixelColor(source, textureDesc.Format, i, j, inputPitch, &pixelColor);
- writePixelColor(pixelColor, format, type, i, j, outputPitch, pixels);
+ for (int x = 0; x < params.area.width; x++)
+ {
+ void *dest = static_cast<unsigned char*>(pixelsOut) + params.offset + y * params.outputPitch + x * destPixelSize;
+ void *src = static_cast<unsigned char*>(source) + y * inputPitch + x * sourcePixelSize;
+
+ // readFunc and writeFunc will be using the same type of color, CopyTexImage
+ // will not allow the copy otherwise.
+ readFunc(src, temp);
+ writeFunc(temp, dest);
+ }
}
}
}
- mDeviceContext->Unmap(stagingTex, 0);
-
- stagingTex->Release();
- stagingTex = NULL;
+ mDeviceContext->Unmap(readTexture, 0);
}
-bool Renderer11::blitRenderbufferRect(const gl::Rectangle &readRect, const gl::Rectangle &drawRect, RenderTarget *readRenderTarget,
- RenderTarget *drawRenderTarget, bool wholeBufferCopy)
+bool Renderer11::blitRenderbufferRect(const gl::Rectangle &readRect, const gl::Rectangle &drawRect, RenderTarget *readRenderTarget,
+ RenderTarget *drawRenderTarget, GLenum filter, const gl::Rectangle *scissor,
+ bool colorBlit, bool depthBlit, bool stencilBlit)
{
- ASSERT(readRect.width == drawRect.width && readRect.height == drawRect.height);
+ // Since blitRenderbufferRect is called for each render buffer that needs to be blitted,
+ // it should never be the case that both color and depth/stencil need to be blitted at
+ // at the same time.
+ ASSERT(colorBlit != (depthBlit || stencilBlit));
+
+ bool result = true;
RenderTarget11 *drawRenderTarget11 = RenderTarget11::makeRenderTarget11(drawRenderTarget);
if (!drawRenderTarget)
@@ -3440,8 +3551,10 @@ bool Renderer11::blitRenderbufferRect(const gl::Rectangle &readRect, const gl::R
return gl::error(GL_OUT_OF_MEMORY, false);
}
- ID3D11Texture2D *drawTexture = drawRenderTarget11->getTexture();
+ ID3D11Resource *drawTexture = drawRenderTarget11->getTexture();
unsigned int drawSubresource = drawRenderTarget11->getSubresourceIndex();
+ ID3D11RenderTargetView *drawRTV = drawRenderTarget11->getRenderTargetView();
+ ID3D11DepthStencilView *drawDSV = drawRenderTarget11->getDepthStencilView();
RenderTarget11 *readRenderTarget11 = RenderTarget11::makeRenderTarget11(readRenderTarget);
if (!readRenderTarget)
@@ -3450,44 +3563,152 @@ bool Renderer11::blitRenderbufferRect(const gl::Rectangle &readRect, const gl::R
return gl::error(GL_OUT_OF_MEMORY, false);
}
- ID3D11Texture2D *readTexture = NULL;
+ ID3D11Resource *readTexture = NULL;
+ ID3D11ShaderResourceView *readSRV = NULL;
unsigned int readSubresource = 0;
if (readRenderTarget->getSamples() > 0)
{
- readTexture = resolveMultisampledTexture(readRenderTarget11->getTexture(), readRenderTarget11->getSubresourceIndex());
- readSubresource = 0;
+ ID3D11Resource *unresolvedResource = readRenderTarget11->getTexture();
+ ID3D11Texture2D *unresolvedTexture = d3d11::DynamicCastComObject<ID3D11Texture2D>(unresolvedResource);
+
+ if (unresolvedTexture)
+ {
+ readTexture = resolveMultisampledTexture(unresolvedTexture, readRenderTarget11->getSubresourceIndex());
+ readSubresource = 0;
+
+ SafeRelease(unresolvedTexture);
+
+ HRESULT hresult = mDevice->CreateShaderResourceView(readTexture, NULL, &readSRV);
+ if (FAILED(hresult))
+ {
+ SafeRelease(readTexture);
+ return gl::error(GL_OUT_OF_MEMORY, false);
+ }
+ }
}
else
{
readTexture = readRenderTarget11->getTexture();
readTexture->AddRef();
readSubresource = readRenderTarget11->getSubresourceIndex();
+ readSRV = readRenderTarget11->getShaderResourceView();
+ readSRV->AddRef();
}
- if (!readTexture)
+ if (!readTexture || !readSRV)
{
+ SafeRelease(readTexture);
+ SafeRelease(readSRV);
ERR("Failed to retrieve the read render target view from the read render target.");
return gl::error(GL_OUT_OF_MEMORY, false);
}
- D3D11_BOX readBox;
- readBox.left = readRect.x;
- readBox.right = readRect.x + readRect.width;
- readBox.top = readRect.y;
- readBox.bottom = readRect.y + readRect.height;
- readBox.front = 0;
- readBox.back = 1;
+ gl::Extents readSize(readRenderTarget->getWidth(), readRenderTarget->getHeight(), 1);
+ gl::Extents drawSize(drawRenderTarget->getWidth(), drawRenderTarget->getHeight(), 1);
+
+ bool scissorNeeded = scissor && gl::ClipRectangle(drawRect, *scissor, NULL);
+
+ bool wholeBufferCopy = !scissorNeeded &&
+ readRect.x == 0 && readRect.width == readSize.width &&
+ readRect.y == 0 && readRect.height == readSize.height &&
+ drawRect.x == 0 && drawRect.width == drawSize.width &&
+ drawRect.y == 0 && drawRect.height == drawSize.height;
+
+ bool stretchRequired = readRect.width != drawRect.width || readRect.height != drawRect.height;
+
+ bool flipRequired = readRect.width < 0 || readRect.height < 0 || drawRect.width < 0 || drawRect.height < 0;
+
+ bool outOfBounds = readRect.x < 0 || readRect.x + readRect.width > readSize.width ||
+ readRect.y < 0 || readRect.y + readRect.height > readSize.height ||
+ drawRect.x < 0 || drawRect.x + drawRect.width > drawSize.width ||
+ drawRect.y < 0 || drawRect.y + drawRect.height > drawSize.height;
+
+ bool hasDepth = gl::GetDepthBits(drawRenderTarget11->getActualFormat(), getCurrentClientVersion()) > 0;
+ bool hasStencil = gl::GetStencilBits(drawRenderTarget11->getActualFormat(), getCurrentClientVersion()) > 0;
+ bool partialDSBlit = (hasDepth && depthBlit) != (hasStencil && stencilBlit);
+
+ if (readRenderTarget11->getActualFormat() == drawRenderTarget->getActualFormat() &&
+ !stretchRequired && !outOfBounds && !flipRequired && !partialDSBlit &&
+ (!(depthBlit || stencilBlit) || wholeBufferCopy))
+ {
+ UINT dstX = drawRect.x;
+ UINT dstY = drawRect.y;
+
+ D3D11_BOX readBox;
+ readBox.left = readRect.x;
+ readBox.right = readRect.x + readRect.width;
+ readBox.top = readRect.y;
+ readBox.bottom = readRect.y + readRect.height;
+ readBox.front = 0;
+ readBox.back = 1;
+
+ if (scissorNeeded)
+ {
+ // drawRect is guaranteed to have positive width and height because stretchRequired is false.
+ ASSERT(drawRect.width >= 0 || drawRect.height >= 0);
+
+ if (drawRect.x < scissor->x)
+ {
+ dstX = scissor->x;
+ readBox.left += (scissor->x - drawRect.x);
+ }
+ if (drawRect.y < scissor->y)
+ {
+ dstY = scissor->y;
+ readBox.top += (scissor->y - drawRect.y);
+ }
+ if (drawRect.x + drawRect.width > scissor->x + scissor->width)
+ {
+ readBox.right -= ((drawRect.x + drawRect.width) - (scissor->x + scissor->width));
+ }
+ if (drawRect.y + drawRect.height > scissor->y + scissor->height)
+ {
+ readBox.bottom -= ((drawRect.y + drawRect.height) - (scissor->y + scissor->height));
+ }
+ }
- // D3D11 needs depth-stencil CopySubresourceRegions to have a NULL pSrcBox
- // We also require complete framebuffer copies for depth-stencil blit.
- D3D11_BOX *pSrcBox = wholeBufferCopy ? NULL : &readBox;
+ // D3D11 needs depth-stencil CopySubresourceRegions to have a NULL pSrcBox
+ // We also require complete framebuffer copies for depth-stencil blit.
+ D3D11_BOX *pSrcBox = wholeBufferCopy ? NULL : &readBox;
- mDeviceContext->CopySubresourceRegion(drawTexture, drawSubresource, drawRect.x, drawRect.y, 0,
- readTexture, readSubresource, pSrcBox);
+ mDeviceContext->CopySubresourceRegion(drawTexture, drawSubresource, dstX, dstY, 0,
+ readTexture, readSubresource, pSrcBox);
+ result = true;
+ }
+ else
+ {
+ gl::Box readArea(readRect.x, readRect.y, 0, readRect.width, readRect.height, 1);
+ gl::Box drawArea(drawRect.x, drawRect.y, 0, drawRect.width, drawRect.height, 1);
+
+ if (depthBlit && stencilBlit)
+ {
+ result = mBlit->copyDepthStencil(readTexture, readSubresource, readArea, readSize,
+ drawTexture, drawSubresource, drawArea, drawSize,
+ scissor);
+ }
+ else if (depthBlit)
+ {
+ result = mBlit->copyDepth(readSRV, readArea, readSize, drawDSV, drawArea, drawSize,
+ scissor);
+ }
+ else if (stencilBlit)
+ {
+ result = mBlit->copyStencil(readTexture, readSubresource, readArea, readSize,
+ drawTexture, drawSubresource, drawArea, drawSize,
+ scissor);
+ }
+ else
+ {
+ GLenum format = gl::GetFormat(drawRenderTarget->getInternalFormat(), getCurrentClientVersion());
+ result = mBlit->copyTexture(readSRV, readArea, readSize, drawRTV, drawArea, drawSize,
+ scissor, format, filter);
+ }
+ }
SafeRelease(readTexture);
+ SafeRelease(readSRV);
- return true;
+ return result;
}
ID3D11Texture2D *Renderer11::resolveMultisampledTexture(ID3D11Texture2D *source, unsigned int subresource)
@@ -3528,6 +3749,47 @@ ID3D11Texture2D *Renderer11::resolveMultisampledTexture(ID3D11Texture2D *source,
}
}
+void Renderer11::invalidateFBOAttachmentSwizzles(gl::FramebufferAttachment *attachment, int mipLevel)
+{
+ ASSERT(attachment->isTexture());
+ TextureStorage *texStorage = attachment->getTextureStorage();
+ if (texStorage)
+ {
+ TextureStorage11 *texStorage11 = TextureStorage11::makeTextureStorage11(texStorage);
+ if (!texStorage11)
+ {
+ ERR("texture storage pointer unexpectedly null.");
+ return;
+ }
+
+ texStorage11->invalidateSwizzleCacheLevel(mipLevel);
+ }
+}
+
+void Renderer11::invalidateFramebufferSwizzles(gl::Framebuffer *framebuffer)
+{
+ for (unsigned int colorAttachment = 0; colorAttachment < gl::IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
+ {
+ gl::FramebufferAttachment *attachment = framebuffer->getColorbuffer(colorAttachment);
+ if (attachment && attachment->isTexture())
+ {
+ invalidateFBOAttachmentSwizzles(attachment, framebuffer->getColorbufferMipLevel(colorAttachment));
+ }
+ }
+
+ gl::FramebufferAttachment *depthAttachment = framebuffer->getDepthbuffer();
+ if (depthAttachment && depthAttachment->isTexture())
+ {
+ invalidateFBOAttachmentSwizzles(depthAttachment, framebuffer->getDepthbufferMipLevel());
+ }
+
+ gl::FramebufferAttachment *stencilAttachment = framebuffer->getStencilbuffer();
+ if (stencilAttachment && stencilAttachment->isTexture())
+ {
+ invalidateFBOAttachmentSwizzles(stencilAttachment, framebuffer->getStencilbufferMipLevel());
+ }
+}
+
bool Renderer11::getLUID(LUID *adapterLuid) const
{
adapterLuid->HighPart = 0;
@@ -3548,4 +3810,47 @@ bool Renderer11::getLUID(LUID *adapterLuid) const
return true;
}
+GLenum Renderer11::getNativeTextureFormat(GLenum internalFormat) const
+{
+ int clientVersion = getCurrentClientVersion();
+ return d3d11_gl::GetInternalFormat(gl_d3d11::GetTexFormat(internalFormat, clientVersion), clientVersion);
+}
+
+rx::VertexConversionType Renderer11::getVertexConversionType(const gl::VertexFormat &vertexFormat) const
+{
+ return gl_d3d11::GetVertexConversionType(vertexFormat);
+}
+
+GLenum Renderer11::getVertexComponentType(const gl::VertexFormat &vertexFormat) const
+{
+ return d3d11::GetComponentType(gl_d3d11::GetNativeVertexFormat(vertexFormat));
+}
+
+Renderer11::MultisampleSupportInfo Renderer11::getMultisampleSupportInfo(DXGI_FORMAT format)
+{
+ MultisampleSupportInfo supportInfo = { 0 };
+
+ UINT formatSupport;
+ HRESULT result;
+
+ result = mDevice->CheckFormatSupport(format, &formatSupport);
+ if (SUCCEEDED(result) && (formatSupport & D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET))
+ {
+ for (unsigned int i = 1; i <= D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT; i++)
+ {
+ result = mDevice->CheckMultisampleQualityLevels(format, i, &supportInfo.qualityLevels[i - 1]);
+ if (SUCCEEDED(result) && supportInfo.qualityLevels[i - 1] > 0)
+ {
+ supportInfo.maxSupportedSamples = std::max(supportInfo.maxSupportedSamples, i);
+ }
+ else
+ {
+ supportInfo.qualityLevels[i - 1] = 0;
+ }
+ }
+ }
+
+ return supportInfo;
+}
+
}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/Renderer11.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Renderer11.h
index b86f485f40c..bbd0de49bc9 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/Renderer11.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/Renderer11.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2012-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -11,16 +11,17 @@
#include "common/angleutils.h"
#include "libGLESv2/angletypes.h"
-#include "libGLESv2/mathutil.h"
+#include "common/mathutil.h"
#include "libGLESv2/renderer/Renderer.h"
-#include "libGLESv2/renderer/RenderStateCache.h"
-#include "libGLESv2/renderer/InputLayoutCache.h"
+#include "libGLESv2/renderer/d3d/HLSLCompiler.h"
+#include "libGLESv2/renderer/d3d11/RenderStateCache.h"
+#include "libGLESv2/renderer/d3d11/InputLayoutCache.h"
#include "libGLESv2/renderer/RenderTarget.h"
namespace gl
{
-class Renderbuffer;
+class FramebufferAttachment;
}
namespace rx
@@ -29,6 +30,10 @@ namespace rx
class VertexDataManager;
class IndexDataManager;
class StreamingIndexBufferInterface;
+class Blit11;
+class Clear11;
+class PixelTransfer11;
+struct PackPixelsParams;
enum
{
@@ -54,11 +59,14 @@ class Renderer11 : public Renderer
virtual SwapChain *createSwapChain(HWND window, HANDLE shareHandle, GLenum backBufferFormat, GLenum depthBufferFormat);
+ virtual void generateSwizzle(gl::Texture *texture);
virtual void setSamplerState(gl::SamplerType type, int index, const gl::SamplerState &sampler);
virtual void setTexture(gl::SamplerType type, int index, gl::Texture *texture);
+ virtual bool setUniformBuffers(const gl::Buffer *vertexUniformBuffers[], const gl::Buffer *fragmentUniformBuffers[]);
+
virtual void setRasterizerState(const gl::RasterizerState &rasterState);
- virtual void setBlendState(const gl::BlendState &blendState, const gl::Color &blendColor,
+ virtual void setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState, const gl::ColorF &blendColor,
unsigned int sampleMask);
virtual void setDepthStencilState(const gl::DepthStencilState &depthStencilState, int stencilRef,
int stencilBackRef, bool frontFaceCCW);
@@ -69,13 +77,16 @@ class Renderer11 : public Renderer
virtual bool applyPrimitiveType(GLenum mode, GLsizei count);
virtual bool applyRenderTarget(gl::Framebuffer *frameBuffer);
- virtual void applyShaders(gl::ProgramBinary *programBinary);
- virtual void applyUniforms(gl::ProgramBinary *programBinary, gl::UniformArray *uniformArray);
- virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances);
+ virtual void applyShaders(gl::ProgramBinary *programBinary, bool rasterizerDiscard, bool transformFeedbackActive, const gl::VertexFormat inputLayout[]);
+ virtual void applyUniforms(const gl::ProgramBinary &programBinary);
+ virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, const gl::VertexAttribute vertexAttributes[], gl::VertexAttribCurrentValueData currentValues[],
+ GLint first, GLsizei count, GLsizei instances);
virtual GLenum applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo);
+ virtual void applyTransformFeedbackBuffers(gl::Buffer *transformFeedbackBuffers[], GLintptr offsets[]);
- virtual void drawArrays(GLenum mode, GLsizei count, GLsizei instances);
- virtual void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo, GLsizei instances);
+ virtual void drawArrays(GLenum mode, GLsizei count, GLsizei instances, bool transformFeedbackActive);
+ virtual void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices,
+ gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo, GLsizei instances);
virtual void clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer);
@@ -93,14 +104,20 @@ class Renderer11 : public Renderer
virtual GUID getAdapterIdentifier() const;
virtual bool getBGRATextureSupport() const;
- virtual bool getDXT1TextureSupport();
- virtual bool getDXT3TextureSupport();
- virtual bool getDXT5TextureSupport();
- virtual bool getEventQuerySupport();
- virtual bool getFloat32TextureSupport(bool *filtering, bool *renderable);
- virtual bool getFloat16TextureSupport(bool *filtering, bool *renderable);
- virtual bool getLuminanceTextureSupport();
- virtual bool getLuminanceAlphaTextureSupport();
+ virtual bool getDXT1TextureSupport() const;
+ virtual bool getDXT3TextureSupport() const;
+ virtual bool getDXT5TextureSupport() const;
+ virtual bool getEventQuerySupport() const;
+ virtual bool getFloat32TextureSupport() const;
+ virtual bool getFloat32TextureFilteringSupport() const;
+ virtual bool getFloat32TextureRenderingSupport() const;
+ virtual bool getFloat16TextureSupport() const;
+ virtual bool getFloat16TextureFilteringSupport() const;
+ virtual bool getFloat16TextureRenderingSupport() const;
+ virtual bool getRGB565TextureSupport() const;
+ virtual bool getLuminanceTextureSupport() const;
+ virtual bool getLuminanceAlphaTextureSupport() const;
+ virtual bool getRGTextureSupport() const;
virtual unsigned int getMaxVertexTextureImageUnits() const;
virtual unsigned int getMaxCombinedTextureImageUnits() const;
virtual unsigned int getReservedVertexUniformVectors() const;
@@ -108,26 +125,43 @@ class Renderer11 : public Renderer
virtual unsigned int getMaxVertexUniformVectors() const;
virtual unsigned int getMaxFragmentUniformVectors() const;
virtual unsigned int getMaxVaryingVectors() const;
+ virtual unsigned int getMaxVertexShaderUniformBuffers() const;
+ virtual unsigned int getMaxFragmentShaderUniformBuffers() const;
+ virtual unsigned int getReservedVertexUniformBuffers() const;
+ virtual unsigned int getReservedFragmentUniformBuffers() const;
+ unsigned int getReservedVaryings() const;
+ virtual unsigned int getMaxTransformFeedbackBuffers() const;
+ virtual unsigned int getMaxTransformFeedbackSeparateComponents() const;
+ virtual unsigned int getMaxTransformFeedbackInterleavedComponents() const;
+ virtual unsigned int getMaxUniformBufferSize() const;
virtual bool getNonPower2TextureSupport() const;
virtual bool getDepthTextureSupport() const;
virtual bool getOcclusionQuerySupport() const;
virtual bool getInstancingSupport() const;
virtual bool getTextureFilterAnisotropySupport() const;
+ virtual bool getPBOSupport() const;
virtual float getTextureMaxAnisotropy() const;
virtual bool getShareHandleSupport() const;
virtual bool getDerivativeInstructionSupport() const;
virtual bool getPostSubBufferSupport() const;
+ virtual int getMaxRecommendedElementsIndices() const;
+ virtual int getMaxRecommendedElementsVertices() const;
virtual int getMajorShaderModel() const;
virtual float getMaxPointSize() const;
virtual int getMaxViewportDimension() const;
virtual int getMaxTextureWidth() const;
virtual int getMaxTextureHeight() const;
+ virtual int getMaxTextureDepth() const;
+ virtual int getMaxTextureArrayLayers() const;
virtual bool get32BitIndexSupport() const;
virtual int getMinSwapInterval() const;
virtual int getMaxSwapInterval() const;
virtual GLsizei getMaxSupportedSamples() const;
+ virtual GLsizei getMaxSupportedFormatSamples(GLenum internalFormat) const;
+ virtual GLsizei getNumSampleCounts(GLenum internalFormat) const;
+ virtual void getSampleCounts(GLenum internalFormat, GLsizei bufSize, GLint *params) const;
int getNearestSupportedSamples(DXGI_FORMAT format, unsigned int requested) const;
virtual unsigned int getMaxRenderTargets() const;
@@ -135,34 +169,44 @@ class Renderer11 : public Renderer
// Pixel operations
virtual bool copyToRenderTarget(TextureStorageInterface2D *dest, TextureStorageInterface2D *source);
virtual bool copyToRenderTarget(TextureStorageInterfaceCube *dest, TextureStorageInterfaceCube *source);
+ virtual bool copyToRenderTarget(TextureStorageInterface3D *dest, TextureStorageInterface3D *source);
+ virtual bool copyToRenderTarget(TextureStorageInterface2DArray *dest, TextureStorageInterface2DArray *source);
virtual bool copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, TextureStorageInterface2D *storage, GLint level);
virtual bool copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, TextureStorageInterfaceCube *storage, GLenum target, GLint level);
-
- bool copyTexture(ID3D11ShaderResourceView *source, const gl::Rectangle &sourceArea, unsigned int sourceWidth, unsigned int sourceHeight,
- ID3D11RenderTargetView *dest, const gl::Rectangle &destArea, unsigned int destWidth, unsigned int destHeight, GLenum destFormat);
+ virtual bool copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
+ GLint xoffset, GLint yoffset, GLint zOffset, TextureStorageInterface3D *storage, GLint level);
+ virtual bool copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
+ GLint xoffset, GLint yoffset, GLint zOffset, TextureStorageInterface2DArray *storage, GLint level);
virtual bool blitRect(gl::Framebuffer *readTarget, const gl::Rectangle &readRect, gl::Framebuffer *drawTarget, const gl::Rectangle &drawRect,
- bool blitRenderTarget, bool blitDepthStencil);
- virtual void readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
- GLsizei outputPitch, bool packReverseRowOrder, GLint packAlignment, void* pixels);
+ const gl::Rectangle *scissor, bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter);
+ virtual void readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format,
+ GLenum type, GLuint outputPitch, const gl::PixelPackState &pack, void* pixels);
// RenderTarget creation
virtual RenderTarget *createRenderTarget(SwapChain *swapChain, bool depth);
- virtual RenderTarget *createRenderTarget(int width, int height, GLenum format, GLsizei samples, bool depth);
+ virtual RenderTarget *createRenderTarget(int width, int height, GLenum format, GLsizei samples);
// Shader operations
- virtual ShaderExecutable *loadExecutable(const void *function, size_t length, rx::ShaderType type);
- virtual ShaderExecutable *compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type, D3DWorkaroundType workaround);
+ virtual ShaderExecutable *loadExecutable(const void *function, size_t length, rx::ShaderType type,
+ const std::vector<gl::LinkedVarying> &transformFeedbackVaryings,
+ bool separatedOutputBuffers);
+ virtual ShaderExecutable *compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type,
+ const std::vector<gl::LinkedVarying> &transformFeedbackVaryings,
+ bool separatedOutputBuffers, D3DWorkaroundType workaround);
+ virtual UniformStorage *createUniformStorage(size_t storageSize);
// Image operations
virtual Image *createImage();
virtual void generateMipmap(Image *dest, Image *source);
virtual TextureStorage *createTextureStorage2D(SwapChain *swapChain);
- virtual TextureStorage *createTextureStorage2D(int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height);
- virtual TextureStorage *createTextureStorageCube(int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size);
+ virtual TextureStorage *createTextureStorage2D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels);
+ virtual TextureStorage *createTextureStorageCube(GLenum internalformat, bool renderTarget, int size, int levels);
+ virtual TextureStorage *createTextureStorage3D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, GLsizei depth, int levels);
+ virtual TextureStorage *createTextureStorage2DArray(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, GLsizei depth, int levels);
// Buffer creation
virtual VertexBuffer *createVertexBuffer();
@@ -178,11 +222,22 @@ class Renderer11 : public Renderer
ID3D11DeviceContext *getDeviceContext() { return mDeviceContext; };
IDXGIFactory *getDxgiFactory() { return mDxgiFactory; };
- bool getRenderTargetResource(gl::Renderbuffer *colorbuffer, unsigned int *subresourceIndex, ID3D11Texture2D **resource);
+ Blit11 *getBlitter() { return mBlit; }
+
+ // Buffer-to-texture and Texture-to-buffer copies
+ virtual bool supportsFastCopyBufferToTexture(GLenum internalFormat) const;
+ virtual bool fastCopyBufferToTexture(const gl::PixelUnpackState &unpack, unsigned int offset, RenderTarget *destRenderTarget,
+ GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &destArea);
+
+ bool getRenderTargetResource(gl::FramebufferAttachment *colorbuffer, unsigned int *subresourceIndex, ID3D11Texture2D **resource);
void unapplyRenderTargets();
void setOneTimeRenderTarget(ID3D11RenderTargetView *renderTargetView);
+ void packPixels(ID3D11Texture2D *readTexture, const PackPixelsParams &params, void *pixelsOut);
virtual bool getLUID(LUID *adapterLuid) const;
+ virtual GLenum getNativeTextureFormat(GLenum internalFormat) const;
+ virtual rx::VertexConversionType getVertexConversionType(const gl::VertexFormat &vertexFormat) const;
+ virtual GLenum getVertexComponentType(const gl::VertexFormat &vertexFormat) const;
private:
DISALLOW_COPY_AND_ASSIGN(Renderer11);
@@ -190,21 +245,25 @@ class Renderer11 : public Renderer
void drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer);
void drawTriangleFan(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer, int instances);
- void readTextureData(ID3D11Texture2D *texture, unsigned int subResource, const gl::Rectangle &area,
- GLenum format, GLenum type, GLsizei outputPitch, bool packReverseRowOrder,
- GLint packAlignment, void *pixels);
+ void readTextureData(ID3D11Texture2D *texture, unsigned int subResource, const gl::Rectangle &area, GLenum format,
+ GLenum type, GLuint outputPitch, const gl::PixelPackState &pack, void *pixels);
- void maskedClear(const gl::ClearParameters &clearParams, bool usingExtendedDrawBuffers);
rx::Range getViewportBounds() const;
- bool blitRenderbufferRect(const gl::Rectangle &readRect, const gl::Rectangle &drawRect, RenderTarget *readRenderTarget,
- RenderTarget *drawRenderTarget, bool wholeBufferCopy);
+ bool blitRenderbufferRect(const gl::Rectangle &readRect, const gl::Rectangle &drawRect, RenderTarget *readRenderTarget,
+ RenderTarget *drawRenderTarget, GLenum filter, const gl::Rectangle *scissor,
+ bool colorBlit, bool depthBlit, bool stencilBlit);
ID3D11Texture2D *resolveMultisampledTexture(ID3D11Texture2D *source, unsigned int subresource);
+ static void invalidateFBOAttachmentSwizzles(gl::FramebufferAttachment *attachment, int mipLevel);
+ static void invalidateFramebufferSwizzles(gl::Framebuffer *framebuffer);
+
HMODULE mD3d11Module;
HMODULE mDxgiModule;
HDC mDc;
+ HLSLCompiler mCompiler;
+
bool mDeviceLost;
void initializeDevice();
@@ -227,15 +286,19 @@ class Renderer11 : public Renderer
bool mDXT3TextureSupport;
bool mDXT5TextureSupport;
+ bool mRGTextureSupport;
+
bool mDepthTextureSupport;
// Multisample format support
struct MultisampleSupportInfo
{
unsigned int qualityLevels[D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT];
+ unsigned int maxSupportedSamples;
};
+ MultisampleSupportInfo getMultisampleSupportInfo(DXGI_FORMAT format);
- typedef std::unordered_map<DXGI_FORMAT, MultisampleSupportInfo, std::hash<int> > MultisampleSupportMap;
+ typedef std::unordered_map<DXGI_FORMAT, MultisampleSupportInfo> MultisampleSupportMap;
MultisampleSupportMap mMultisampleSupportMap;
unsigned int mMaxSupportedSamples;
@@ -247,8 +310,6 @@ class Renderer11 : public Renderer
bool mDepthStencilInitialized;
bool mRenderTargetDescInitialized;
rx::RenderTarget::Desc mRenderTargetDesc;
- unsigned int mCurDepthSize;
- unsigned int mCurStencilSize;
// Currently applied sampler states
bool mForceSetVertexSamplerStates[gl::IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS];
@@ -258,13 +319,13 @@ class Renderer11 : public Renderer
gl::SamplerState mCurPixelSamplerStates[gl::MAX_TEXTURE_IMAGE_UNITS];
// Currently applied textures
- unsigned int mCurVertexTextureSerials[gl::IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS];
- unsigned int mCurPixelTextureSerials[gl::MAX_TEXTURE_IMAGE_UNITS];
+ ID3D11ShaderResourceView *mCurVertexSRVs[gl::IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS];
+ ID3D11ShaderResourceView *mCurPixelSRVs[gl::MAX_TEXTURE_IMAGE_UNITS];
// Currently applied blend state
bool mForceSetBlendState;
gl::BlendState mCurBlendState;
- gl::Color mCurBlendColor;
+ gl::ColorF mCurBlendColor;
unsigned int mCurSampleMask;
// Currently applied rasterizer state
@@ -291,22 +352,32 @@ class Renderer11 : public Renderer
// Currently applied primitive topology
D3D11_PRIMITIVE_TOPOLOGY mCurrentPrimitiveTopology;
- unsigned int mAppliedIBSerial;
- unsigned int mAppliedStorageIBSerial;
+ // Currently applied index buffer
+ ID3D11Buffer *mAppliedIB;
+ DXGI_FORMAT mAppliedIBFormat;
unsigned int mAppliedIBOffset;
- unsigned int mAppliedProgramBinarySerial;
- bool mIsGeometryShaderActive;
+ // Currently applied transform feedback buffers
+ ID3D11Buffer *mAppliedTFBuffers[gl::IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS];
+ GLintptr mAppliedTFOffsets[gl::IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS];
+
+ // Currently applied shaders
+ ID3D11VertexShader *mAppliedVertexShader;
+ ID3D11GeometryShader *mAppliedGeometryShader;
+ ID3D11GeometryShader *mCurPointGeometryShader;
+ ID3D11PixelShader *mAppliedPixelShader;
dx_VertexConstants mVertexConstants;
dx_VertexConstants mAppliedVertexConstants;
ID3D11Buffer *mDriverConstantBufferVS;
ID3D11Buffer *mCurrentVertexConstantBuffer;
+ unsigned int mCurrentConstantBufferVS[gl::IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS];
dx_PixelConstants mPixelConstants;
dx_PixelConstants mAppliedPixelConstants;
ID3D11Buffer *mDriverConstantBufferPS;
ID3D11Buffer *mCurrentPixelConstantBuffer;
+ unsigned int mCurrentConstantBufferPS[gl::IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS];
ID3D11Buffer *mCurrentGeometryConstantBuffer;
@@ -319,25 +390,11 @@ class Renderer11 : public Renderer
StreamingIndexBufferInterface *mTriangleFanIB;
// Texture copy resources
- bool mCopyResourcesInitialized;
- ID3D11Buffer *mCopyVB;
- ID3D11SamplerState *mCopySampler;
- ID3D11InputLayout *mCopyIL;
- ID3D11VertexShader *mCopyVS;
- ID3D11PixelShader *mCopyRGBAPS;
- ID3D11PixelShader *mCopyRGBPS;
- ID3D11PixelShader *mCopyLumPS;
- ID3D11PixelShader *mCopyLumAlphaPS;
+ Blit11 *mBlit;
+ PixelTransfer11 *mPixelTransfer;
// Masked clear resources
- bool mClearResourcesInitialized;
- ID3D11Buffer *mClearVB;
- ID3D11InputLayout *mClearIL;
- ID3D11VertexShader *mClearVS;
- ID3D11PixelShader *mClearSinglePS;
- ID3D11PixelShader *mClearMultiplePS;
- ID3D11RasterizerState *mClearScissorRS;
- ID3D11RasterizerState *mClearNoScissorRS;
+ Clear11 *mClear;
// Sync query
ID3D11Query *mSyncQuery;
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/ShaderExecutable11.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/ShaderExecutable11.cpp
index e1eb5603348..de2eeda4fc8 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/ShaderExecutable11.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/ShaderExecutable11.cpp
@@ -1,6 +1,6 @@
#include "precompiled.h"
//
-// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2012-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -8,9 +8,9 @@
// ShaderExecutable11.cpp: Implements a D3D11-specific class to contain shader
// executable implementation details.
-#include "libGLESv2/renderer/ShaderExecutable11.h"
+#include "libGLESv2/renderer/d3d11/ShaderExecutable11.h"
-#include "common/debug.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
namespace rx
{
@@ -21,18 +21,16 @@ ShaderExecutable11::ShaderExecutable11(const void *function, size_t length, ID3D
mPixelExecutable = executable;
mVertexExecutable = NULL;
mGeometryExecutable = NULL;
-
- mConstantBuffer = NULL;
+ mStreamOutExecutable = NULL;
}
-ShaderExecutable11::ShaderExecutable11(const void *function, size_t length, ID3D11VertexShader *executable)
+ShaderExecutable11::ShaderExecutable11(const void *function, size_t length, ID3D11VertexShader *executable, ID3D11GeometryShader *streamOut)
: ShaderExecutable(function, length)
{
mVertexExecutable = executable;
mPixelExecutable = NULL;
mGeometryExecutable = NULL;
-
- mConstantBuffer = NULL;
+ mStreamOutExecutable = streamOut;
}
ShaderExecutable11::ShaderExecutable11(const void *function, size_t length, ID3D11GeometryShader *executable)
@@ -41,29 +39,15 @@ ShaderExecutable11::ShaderExecutable11(const void *function, size_t length, ID3D
mGeometryExecutable = executable;
mVertexExecutable = NULL;
mPixelExecutable = NULL;
-
- mConstantBuffer = NULL;
+ mStreamOutExecutable = NULL;
}
ShaderExecutable11::~ShaderExecutable11()
{
- if (mVertexExecutable)
- {
- mVertexExecutable->Release();
- }
- if (mPixelExecutable)
- {
- mPixelExecutable->Release();
- }
- if (mGeometryExecutable)
- {
- mGeometryExecutable->Release();
- }
-
- if (mConstantBuffer)
- {
- mConstantBuffer->Release();
- }
+ SafeRelease(mVertexExecutable);
+ SafeRelease(mPixelExecutable);
+ SafeRelease(mGeometryExecutable);
+ SafeRelease(mStreamOutExecutable);
}
ShaderExecutable11 *ShaderExecutable11::makeShaderExecutable11(ShaderExecutable *executable)
@@ -87,23 +71,42 @@ ID3D11GeometryShader *ShaderExecutable11::getGeometryShader() const
return mGeometryExecutable;
}
-ID3D11Buffer *ShaderExecutable11::getConstantBuffer(ID3D11Device *device, unsigned int registerCount)
+ID3D11GeometryShader *ShaderExecutable11::getStreamOutShader() const
{
- if (!mConstantBuffer && registerCount > 0)
+ return mStreamOutExecutable;
+}
+
+UniformStorage11::UniformStorage11(Renderer11 *renderer, size_t initialSize)
+ : UniformStorage(initialSize),
+ mConstantBuffer(NULL)
+{
+ ID3D11Device *d3d11Device = renderer->getDevice();
+
+ if (initialSize > 0)
{
D3D11_BUFFER_DESC constantBufferDescription = {0};
- constantBufferDescription.ByteWidth = registerCount * sizeof(float[4]);
+ constantBufferDescription.ByteWidth = initialSize;
constantBufferDescription.Usage = D3D11_USAGE_DYNAMIC;
constantBufferDescription.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
constantBufferDescription.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
constantBufferDescription.MiscFlags = 0;
constantBufferDescription.StructureByteStride = 0;
- HRESULT result = device->CreateBuffer(&constantBufferDescription, NULL, &mConstantBuffer);
+ HRESULT result = d3d11Device->CreateBuffer(&constantBufferDescription, NULL, &mConstantBuffer);
+ UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
}
+}
- return mConstantBuffer;
+UniformStorage11::~UniformStorage11()
+{
+ SafeRelease(mConstantBuffer);
}
-} \ No newline at end of file
+const UniformStorage11 *UniformStorage11::makeUniformStorage11(const UniformStorage *uniformStorage)
+{
+ ASSERT(HAS_DYNAMIC_TYPE(const UniformStorage11*, uniformStorage));
+ return static_cast<const UniformStorage11*>(uniformStorage);
+}
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/ShaderExecutable11.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/ShaderExecutable11.h
index c6ec1cf7d2c..74a1e03915e 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/ShaderExecutable11.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/ShaderExecutable11.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2012-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -14,12 +14,14 @@
namespace rx
{
+class Renderer11;
+class UniformStorage11;
class ShaderExecutable11 : public ShaderExecutable
{
public:
ShaderExecutable11(const void *function, size_t length, ID3D11PixelShader *executable);
- ShaderExecutable11(const void *function, size_t length, ID3D11VertexShader *executable);
+ ShaderExecutable11(const void *function, size_t length, ID3D11VertexShader *executable, ID3D11GeometryShader *streamOut);
ShaderExecutable11(const void *function, size_t length, ID3D11GeometryShader *executable);
virtual ~ShaderExecutable11();
@@ -29,8 +31,7 @@ class ShaderExecutable11 : public ShaderExecutable
ID3D11PixelShader *getPixelShader() const;
ID3D11VertexShader *getVertexShader() const;
ID3D11GeometryShader *getGeometryShader() const;
-
- ID3D11Buffer *getConstantBuffer(ID3D11Device *device, unsigned int registerCount);
+ ID3D11GeometryShader *getStreamOutShader() const;
private:
DISALLOW_COPY_AND_ASSIGN(ShaderExecutable11);
@@ -38,7 +39,20 @@ class ShaderExecutable11 : public ShaderExecutable
ID3D11PixelShader *mPixelExecutable;
ID3D11VertexShader *mVertexExecutable;
ID3D11GeometryShader *mGeometryExecutable;
+ ID3D11GeometryShader *mStreamOutExecutable;
+};
+
+class UniformStorage11 : public UniformStorage
+{
+ public:
+ UniformStorage11(Renderer11 *renderer, size_t initialSize);
+ virtual ~UniformStorage11();
+
+ static const UniformStorage11 *makeUniformStorage11(const UniformStorage *uniformStorage);
+ ID3D11Buffer *getConstantBuffer() const { return mConstantBuffer; }
+
+ private:
ID3D11Buffer *mConstantBuffer;
};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/SwapChain11.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/SwapChain11.cpp
index 022cfe430dd..a15d061feaf 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/SwapChain11.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/SwapChain11.cpp
@@ -1,18 +1,19 @@
#include "precompiled.h"
//
-// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2012-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// SwapChain11.cpp: Implements a back-end specific class for the D3D11 swap chain.
-#include "libGLESv2/renderer/SwapChain11.h"
+#include "libGLESv2/renderer/d3d11/SwapChain11.h"
-#include "libGLESv2/renderer/renderer11_utils.h"
-#include "libGLESv2/renderer/Renderer11.h"
-#include "libGLESv2/renderer/shaders/compiled/passthrough11vs.h"
-#include "libGLESv2/renderer/shaders/compiled/passthroughrgba11ps.h"
+#include "libGLESv2/renderer/d3d11/renderer11_utils.h"
+#include "libGLESv2/renderer/d3d11/formatutils11.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthrough2d11vs.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba2d11ps.h"
namespace rx
{
@@ -29,6 +30,7 @@ SwapChain11::SwapChain11(Renderer11 *renderer, HWND window, HANDLE shareHandle,
mOffscreenSRView = NULL;
mDepthStencilTexture = NULL;
mDepthStencilDSView = NULL;
+ mDepthStencilSRView = NULL;
mQuadVB = NULL;
mPassThroughSampler = NULL;
mPassThroughIL = NULL;
@@ -48,83 +50,20 @@ SwapChain11::~SwapChain11()
void SwapChain11::release()
{
- if (mSwapChain)
- {
- mSwapChain->Release();
- mSwapChain = NULL;
- }
-
- if (mBackBufferTexture)
- {
- mBackBufferTexture->Release();
- mBackBufferTexture = NULL;
- }
-
- if (mBackBufferRTView)
- {
- mBackBufferRTView->Release();
- mBackBufferRTView = NULL;
- }
-
- if (mOffscreenTexture)
- {
- mOffscreenTexture->Release();
- mOffscreenTexture = NULL;
- }
-
- if (mOffscreenRTView)
- {
- mOffscreenRTView->Release();
- mOffscreenRTView = NULL;
- }
-
- if (mOffscreenSRView)
- {
- mOffscreenSRView->Release();
- mOffscreenSRView = NULL;
- }
-
- if (mDepthStencilTexture)
- {
- mDepthStencilTexture->Release();
- mDepthStencilTexture = NULL;
- }
-
- if (mDepthStencilDSView)
- {
- mDepthStencilDSView->Release();
- mDepthStencilDSView = NULL;
- }
-
- if (mQuadVB)
- {
- mQuadVB->Release();
- mQuadVB = NULL;
- }
-
- if (mPassThroughSampler)
- {
- mPassThroughSampler->Release();
- mPassThroughSampler = NULL;
- }
-
- if (mPassThroughIL)
- {
- mPassThroughIL->Release();
- mPassThroughIL = NULL;
- }
-
- if (mPassThroughVS)
- {
- mPassThroughVS->Release();
- mPassThroughVS = NULL;
- }
-
- if (mPassThroughPS)
- {
- mPassThroughPS->Release();
- mPassThroughPS = NULL;
- }
+ SafeRelease(mSwapChain);
+ SafeRelease(mBackBufferTexture);
+ SafeRelease(mBackBufferRTView);
+ SafeRelease(mOffscreenTexture);
+ SafeRelease(mOffscreenRTView);
+ SafeRelease(mOffscreenSRView);
+ SafeRelease(mDepthStencilTexture);
+ SafeRelease(mDepthStencilDSView);
+ SafeRelease(mDepthStencilSRView);
+ SafeRelease(mQuadVB);
+ SafeRelease(mPassThroughSampler);
+ SafeRelease(mPassThroughIL);
+ SafeRelease(mPassThroughVS);
+ SafeRelease(mPassThroughPS);
if (!mAppCreatedShareHandle)
{
@@ -134,35 +73,12 @@ void SwapChain11::release()
void SwapChain11::releaseOffscreenTexture()
{
- if (mOffscreenTexture)
- {
- mOffscreenTexture->Release();
- mOffscreenTexture = NULL;
- }
-
- if (mOffscreenRTView)
- {
- mOffscreenRTView->Release();
- mOffscreenRTView = NULL;
- }
-
- if (mOffscreenSRView)
- {
- mOffscreenSRView->Release();
- mOffscreenSRView = NULL;
- }
-
- if (mDepthStencilTexture)
- {
- mDepthStencilTexture->Release();
- mDepthStencilTexture = NULL;
- }
-
- if (mDepthStencilDSView)
- {
- mDepthStencilDSView->Release();
- mDepthStencilDSView = NULL;
- }
+ SafeRelease(mOffscreenTexture);
+ SafeRelease(mOffscreenRTView);
+ SafeRelease(mOffscreenSRView);
+ SafeRelease(mDepthStencilTexture);
+ SafeRelease(mDepthStencilDSView);
+ SafeRelease(mDepthStencilSRView);
}
EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHeight)
@@ -201,7 +117,7 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei
}
result = tempResource11->QueryInterface(__uuidof(ID3D11Texture2D), (void**)&mOffscreenTexture);
- tempResource11->Release();
+ SafeRelease(tempResource11);
if (FAILED(result))
{
@@ -216,7 +132,7 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei
if (offscreenTextureDesc.Width != (UINT)backbufferWidth
|| offscreenTextureDesc.Height != (UINT)backbufferHeight
- || offscreenTextureDesc.Format != gl_d3d11::ConvertRenderbufferFormat(mBackBufferFormat)
+ || offscreenTextureDesc.Format != gl_d3d11::GetTexFormat(mBackBufferFormat, mRenderer->getCurrentClientVersion())
|| offscreenTextureDesc.MipLevels != 1
|| offscreenTextureDesc.ArraySize != 1)
{
@@ -232,7 +148,7 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei
D3D11_TEXTURE2D_DESC offscreenTextureDesc = {0};
offscreenTextureDesc.Width = backbufferWidth;
offscreenTextureDesc.Height = backbufferHeight;
- offscreenTextureDesc.Format = gl_d3d11::ConvertRenderbufferFormat(mBackBufferFormat);
+ offscreenTextureDesc.Format = gl_d3d11::GetTexFormat(mBackBufferFormat, mRenderer->getCurrentClientVersion());
offscreenTextureDesc.MipLevels = 1;
offscreenTextureDesc.ArraySize = 1;
offscreenTextureDesc.SampleDesc.Count = 1;
@@ -259,7 +175,7 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei
}
}
- d3d11::SetDebugName(mOffscreenTexture, "Offscreen texture");
+ d3d11::SetDebugName(mOffscreenTexture, "Offscreen back buffer texture");
// EGL_ANGLE_surface_d3d_texture_2d_share_handle requires that we store a share handle for the client
if (useSharedResource)
@@ -275,7 +191,7 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei
else
{
result = offscreenTextureResource->GetSharedHandle(&mShareHandle);
- offscreenTextureResource->Release();
+ SafeRelease(offscreenTextureResource);
if (FAILED(result))
{
@@ -285,32 +201,43 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei
}
}
}
-
- HRESULT result = device->CreateRenderTargetView(mOffscreenTexture, NULL, &mOffscreenRTView);
+
+ D3D11_RENDER_TARGET_VIEW_DESC offscreenRTVDesc;
+ offscreenRTVDesc.Format = gl_d3d11::GetRTVFormat(mBackBufferFormat, mRenderer->getCurrentClientVersion());
+ offscreenRTVDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
+ offscreenRTVDesc.Texture2D.MipSlice = 0;
+
+ HRESULT result = device->CreateRenderTargetView(mOffscreenTexture, &offscreenRTVDesc, &mOffscreenRTView);
ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mOffscreenRTView, "Offscreen render target");
+ d3d11::SetDebugName(mOffscreenRTView, "Offscreen back buffer render target");
+
+ D3D11_SHADER_RESOURCE_VIEW_DESC offscreenSRVDesc;
+ offscreenSRVDesc.Format = gl_d3d11::GetSRVFormat(mBackBufferFormat, mRenderer->getCurrentClientVersion());
+ offscreenSRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
+ offscreenSRVDesc.Texture2D.MostDetailedMip = 0;
+ offscreenSRVDesc.Texture2D.MipLevels = -1;
- result = device->CreateShaderResourceView(mOffscreenTexture, NULL, &mOffscreenSRView);
+ result = device->CreateShaderResourceView(mOffscreenTexture, &offscreenSRVDesc, &mOffscreenSRView);
ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mOffscreenSRView, "Offscreen shader resource");
+ d3d11::SetDebugName(mOffscreenSRView, "Offscreen back buffer shader resource");
if (mDepthBufferFormat != GL_NONE)
{
- D3D11_TEXTURE2D_DESC depthStencilDesc = {0};
- depthStencilDesc.Width = backbufferWidth;
- depthStencilDesc.Height = backbufferHeight;
- depthStencilDesc.Format = gl_d3d11::ConvertRenderbufferFormat(mDepthBufferFormat);
- depthStencilDesc.MipLevels = 1;
- depthStencilDesc.ArraySize = 1;
- depthStencilDesc.SampleDesc.Count = 1;
- depthStencilDesc.SampleDesc.Quality = 0;
- depthStencilDesc.Usage = D3D11_USAGE_DEFAULT;
- depthStencilDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
- depthStencilDesc.CPUAccessFlags = 0;
- depthStencilDesc.MiscFlags = 0;
-
- result = device->CreateTexture2D(&depthStencilDesc, NULL, &mDepthStencilTexture);
+ D3D11_TEXTURE2D_DESC depthStencilTextureDesc;
+ depthStencilTextureDesc.Width = backbufferWidth;
+ depthStencilTextureDesc.Height = backbufferHeight;
+ depthStencilTextureDesc.Format = gl_d3d11::GetTexFormat(mDepthBufferFormat, mRenderer->getCurrentClientVersion());
+ depthStencilTextureDesc.MipLevels = 1;
+ depthStencilTextureDesc.ArraySize = 1;
+ depthStencilTextureDesc.SampleDesc.Count = 1;
+ depthStencilTextureDesc.SampleDesc.Quality = 0;
+ depthStencilTextureDesc.Usage = D3D11_USAGE_DEFAULT;
+ depthStencilTextureDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL | D3D11_BIND_SHADER_RESOURCE;
+ depthStencilTextureDesc.CPUAccessFlags = 0;
+ depthStencilTextureDesc.MiscFlags = 0;
+
+ result = device->CreateTexture2D(&depthStencilTextureDesc, NULL, &mDepthStencilTexture);
if (FAILED(result))
{
ERR("Could not create depthstencil surface for new swap chain: 0x%08X", result);
@@ -325,11 +252,27 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei
return EGL_BAD_ALLOC;
}
}
- d3d11::SetDebugName(mDepthStencilTexture, "Depth stencil texture");
+ d3d11::SetDebugName(mDepthStencilTexture, "Offscreen depth stencil texture");
+
+ D3D11_DEPTH_STENCIL_VIEW_DESC depthStencilDesc;
+ depthStencilDesc.Format = gl_d3d11::GetDSVFormat(mDepthBufferFormat, mRenderer->getCurrentClientVersion());
+ depthStencilDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
+ depthStencilDesc.Flags = 0;
+ depthStencilDesc.Texture2D.MipSlice = 0;
- result = device->CreateDepthStencilView(mDepthStencilTexture, NULL, &mDepthStencilDSView);
+ result = device->CreateDepthStencilView(mDepthStencilTexture, &depthStencilDesc, &mDepthStencilDSView);
ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mDepthStencilDSView, "Depth stencil view");
+ d3d11::SetDebugName(mDepthStencilDSView, "Offscreen depth stencil view");
+
+ D3D11_SHADER_RESOURCE_VIEW_DESC depthStencilSRVDesc;
+ depthStencilSRVDesc.Format = gl_d3d11::GetSRVFormat(mDepthBufferFormat, mRenderer->getCurrentClientVersion());
+ depthStencilSRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
+ depthStencilSRVDesc.Texture2D.MostDetailedMip = 0;
+ depthStencilSRVDesc.Texture2D.MipLevels = -1;
+
+ result = device->CreateShaderResourceView(mDepthStencilTexture, &depthStencilSRVDesc, &mDepthStencilSRView);
+ ASSERT(SUCCEEDED(result));
+ d3d11::SetDebugName(mDepthStencilSRView, "Offscreen depth stencil shader resource");
}
mWidth = backbufferWidth;
@@ -349,7 +292,7 @@ EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHei
const int yoffset = std::max(mHeight - previousHeight, 0);
deviceContext->CopySubresourceRegion(mOffscreenTexture, 0, 0, yoffset, 0, previousOffscreenTexture, 0, &sourceBox);
- previousOffscreenTexture->Release();
+ SafeRelease(previousOffscreenTexture);
if (mSwapChain)
{
@@ -369,24 +312,21 @@ EGLint SwapChain11::resize(EGLint backbufferWidth, EGLint backbufferHeight)
return EGL_BAD_ACCESS;
}
- // Can only call resize if we have already created our swap buffer and resources
- ASSERT(mSwapChain && mBackBufferTexture && mBackBufferRTView);
-
- if (mBackBufferTexture)
+ // EGL allows creating a surface with 0x0 dimension, however, DXGI does not like 0x0 swapchains
+ if (backbufferWidth < 1 || backbufferHeight < 1)
{
- mBackBufferTexture->Release();
- mBackBufferTexture = NULL;
+ return EGL_SUCCESS;
}
- if (mBackBufferRTView)
- {
- mBackBufferRTView->Release();
- mBackBufferRTView = NULL;
- }
+ // Can only call resize if we have already created our swap buffer and resources
+ ASSERT(mSwapChain && mBackBufferTexture && mBackBufferRTView);
+
+ SafeRelease(mBackBufferTexture);
+ SafeRelease(mBackBufferRTView);
// Resize swap chain
- DXGI_FORMAT backbufferDXGIFormat = gl_d3d11::ConvertRenderbufferFormat(mBackBufferFormat);
- HRESULT result = mSwapChain->ResizeBuffers(2, backbufferWidth, backbufferHeight, backbufferDXGIFormat, 0);
+ DXGI_FORMAT backbufferDXGIFormat = gl_d3d11::GetTexFormat(mBackBufferFormat, mRenderer->getCurrentClientVersion());
+ HRESULT result = mSwapChain->ResizeBuffers(1, backbufferWidth, backbufferHeight, backbufferDXGIFormat, 0);
if (FAILED(result))
{
@@ -431,23 +371,9 @@ EGLint SwapChain11::reset(int backbufferWidth, int backbufferHeight, EGLint swap
// Release specific resources to free up memory for the new render target, while the
// old render target still exists for the purpose of preserving its contents.
- if (mSwapChain)
- {
- mSwapChain->Release();
- mSwapChain = NULL;
- }
-
- if (mBackBufferTexture)
- {
- mBackBufferTexture->Release();
- mBackBufferTexture = NULL;
- }
-
- if (mBackBufferRTView)
- {
- mBackBufferRTView->Release();
- mBackBufferRTView = NULL;
- }
+ SafeRelease(mSwapChain);
+ SafeRelease(mBackBufferTexture);
+ SafeRelease(mBackBufferRTView);
mSwapInterval = static_cast<unsigned int>(swapInterval);
if (mSwapInterval > 4)
@@ -468,20 +394,21 @@ EGLint SwapChain11::reset(int backbufferWidth, int backbufferHeight, EGLint swap
IDXGIFactory *factory = mRenderer->getDxgiFactory();
DXGI_SWAP_CHAIN_DESC swapChainDesc = {0};
- swapChainDesc.BufferCount = 2;
- swapChainDesc.BufferDesc.Format = gl_d3d11::ConvertRenderbufferFormat(mBackBufferFormat);
swapChainDesc.BufferDesc.Width = backbufferWidth;
swapChainDesc.BufferDesc.Height = backbufferHeight;
- swapChainDesc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
- swapChainDesc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
swapChainDesc.BufferDesc.RefreshRate.Numerator = 0;
swapChainDesc.BufferDesc.RefreshRate.Denominator = 1;
- swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
- swapChainDesc.Flags = 0;
- swapChainDesc.OutputWindow = mWindow;
+ swapChainDesc.BufferDesc.Format = gl_d3d11::GetTexFormat(mBackBufferFormat, mRenderer->getCurrentClientVersion());
+ swapChainDesc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
+ swapChainDesc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
swapChainDesc.SampleDesc.Count = 1;
swapChainDesc.SampleDesc.Quality = 0;
+ swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
+ swapChainDesc.BufferCount = 1;
+ swapChainDesc.OutputWindow = mWindow;
swapChainDesc.Windowed = TRUE;
+ swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
+ swapChainDesc.Flags = 0;
HRESULT result = factory->CreateSwapChain(device, &swapChainDesc, &mSwapChain);
@@ -496,21 +423,7 @@ EGLint SwapChain11::reset(int backbufferWidth, int backbufferHeight, EGLint swap
}
else
{
- // We cannot create a swap chain for an HWND that is owned by a different process on some versions of
- // windows
- DWORD currentProcessId = GetCurrentProcessId();
- DWORD wndProcessId;
- GetWindowThreadProcessId(mWindow, &wndProcessId);
-
- if (currentProcessId != wndProcessId)
- {
- ERR("Could not create swap chain, window owned by different process");
- return EGL_BAD_NATIVE_WINDOW;
- }
- else
- {
- return EGL_BAD_ALLOC;
- }
+ return EGL_BAD_ALLOC;
}
}
@@ -580,15 +493,15 @@ void SwapChain11::initPassThroughResources()
{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 8, D3D11_INPUT_PER_VERTEX_DATA, 0 },
};
- result = device->CreateInputLayout(quadLayout, 2, g_VS_Passthrough, sizeof(g_VS_Passthrough), &mPassThroughIL);
+ result = device->CreateInputLayout(quadLayout, 2, g_VS_Passthrough2D, sizeof(g_VS_Passthrough2D), &mPassThroughIL);
ASSERT(SUCCEEDED(result));
d3d11::SetDebugName(mPassThroughIL, "Swap chain pass through layout");
- result = device->CreateVertexShader(g_VS_Passthrough, sizeof(g_VS_Passthrough), NULL, &mPassThroughVS);
+ result = device->CreateVertexShader(g_VS_Passthrough2D, sizeof(g_VS_Passthrough2D), NULL, &mPassThroughVS);
ASSERT(SUCCEEDED(result));
d3d11::SetDebugName(mPassThroughVS, "Swap chain pass through vertex shader");
- result = device->CreatePixelShader(g_PS_PassthroughRGBA, sizeof(g_PS_PassthroughRGBA), NULL, &mPassThroughPS);
+ result = device->CreatePixelShader(g_PS_PassthroughRGBA2D, sizeof(g_PS_PassthroughRGBA2D), NULL, &mPassThroughPS);
ASSERT(SUCCEEDED(result));
d3d11::SetDebugName(mPassThroughPS, "Swap chain pass through pixel shader");
}
@@ -680,6 +593,7 @@ EGLint SwapChain11::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
if (result == DXGI_ERROR_DEVICE_REMOVED)
{
HRESULT removedReason = device->GetDeviceRemovedReason();
+ UNUSED_ASSERTION_VARIABLE(removedReason);
ERR("Present failed: the D3D11 device was removed: 0x%08X", removedReason);
return EGL_CONTEXT_LOST;
}
@@ -703,61 +617,33 @@ EGLint SwapChain11::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
return EGL_SUCCESS;
}
-// Increments refcount on texture.
-// caller must Release() the returned texture
ID3D11Texture2D *SwapChain11::getOffscreenTexture()
{
- if (mOffscreenTexture)
- {
- mOffscreenTexture->AddRef();
- }
-
return mOffscreenTexture;
}
-// Increments refcount on view.
-// caller must Release() the returned view
ID3D11RenderTargetView *SwapChain11::getRenderTarget()
{
- if (mOffscreenRTView)
- {
- mOffscreenRTView->AddRef();
- }
-
return mOffscreenRTView;
}
-// Increments refcount on view.
-// caller must Release() the returned view
ID3D11ShaderResourceView *SwapChain11::getRenderTargetShaderResource()
{
- if (mOffscreenSRView)
- {
- mOffscreenSRView->AddRef();
- }
-
return mOffscreenSRView;
}
-// Increments refcount on view.
-// caller must Release() the returned view
ID3D11DepthStencilView *SwapChain11::getDepthStencil()
{
- if (mDepthStencilDSView)
- {
- mDepthStencilDSView->AddRef();
- }
-
return mDepthStencilDSView;
}
-ID3D11Texture2D *SwapChain11::getDepthStencilTexture()
+ID3D11ShaderResourceView * SwapChain11::getDepthStencilShaderResource()
{
- if (mDepthStencilTexture)
- {
- mDepthStencilTexture->AddRef();
- }
+ return mDepthStencilSRView;
+}
+ID3D11Texture2D *SwapChain11::getDepthStencilTexture()
+{
return mDepthStencilTexture;
}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/SwapChain11.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/SwapChain11.h
index 800104602e3..fb0afd70e34 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/SwapChain11.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/SwapChain11.h
@@ -34,6 +34,7 @@ class SwapChain11 : public SwapChain
virtual ID3D11Texture2D *getDepthStencilTexture();
virtual ID3D11DepthStencilView *getDepthStencil();
+ virtual ID3D11ShaderResourceView *getDepthStencilShaderResource();
EGLint getWidth() const { return mWidth; }
EGLint getHeight() const { return mHeight; }
@@ -66,6 +67,7 @@ class SwapChain11 : public SwapChain
ID3D11Texture2D *mDepthStencilTexture;
ID3D11DepthStencilView *mDepthStencilDSView;
+ ID3D11ShaderResourceView *mDepthStencilSRView;
ID3D11Buffer *mQuadVB;
ID3D11SamplerState *mPassThroughSampler;
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp
new file mode 100644
index 00000000000..7e024accb80
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp
@@ -0,0 +1,1567 @@
+#include "precompiled.h"
+//
+// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// TextureStorage11.cpp: Implements the abstract rx::TextureStorage11 class and its concrete derived
+// classes TextureStorage11_2D and TextureStorage11_Cube, which act as the interface to the D3D11 texture.
+
+#include "libGLESv2/renderer/d3d11/TextureStorage11.h"
+
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
+#include "libGLESv2/renderer/d3d11/RenderTarget11.h"
+#include "libGLESv2/renderer/d3d11/SwapChain11.h"
+#include "libGLESv2/renderer/d3d11/renderer11_utils.h"
+#include "libGLESv2/renderer/d3d11/Blit11.h"
+#include "libGLESv2/renderer/d3d11/formatutils11.h"
+
+#include "common/utilities.h"
+#include "libGLESv2/main.h"
+
+namespace rx
+{
+
+TextureStorage11::SwizzleCacheValue::SwizzleCacheValue()
+ : swizzleRed(GL_NONE), swizzleGreen(GL_NONE), swizzleBlue(GL_NONE), swizzleAlpha(GL_NONE)
+{
+}
+
+TextureStorage11::SwizzleCacheValue::SwizzleCacheValue(GLenum red, GLenum green, GLenum blue, GLenum alpha)
+ : swizzleRed(red), swizzleGreen(green), swizzleBlue(blue), swizzleAlpha(alpha)
+{
+}
+
+bool TextureStorage11::SwizzleCacheValue::operator==(const SwizzleCacheValue &other) const
+{
+ return swizzleRed == other.swizzleRed &&
+ swizzleGreen == other.swizzleGreen &&
+ swizzleBlue == other.swizzleBlue &&
+ swizzleAlpha == other.swizzleAlpha;
+}
+
+bool TextureStorage11::SwizzleCacheValue::operator!=(const SwizzleCacheValue &other) const
+{
+ return !(*this == other);
+}
+
+TextureStorage11::SRVKey::SRVKey(int baseLevel, int mipLevels, bool swizzle)
+ : baseLevel(baseLevel), mipLevels(mipLevels), swizzle(swizzle)
+{
+}
+
+bool TextureStorage11::SRVKey::operator==(const SRVKey &rhs) const
+{
+ return baseLevel == rhs.baseLevel &&
+ mipLevels == rhs.mipLevels &&
+ swizzle == rhs.swizzle;
+}
+
+TextureStorage11::SRVCache::~SRVCache()
+{
+ for (size_t i = 0; i < cache.size(); i++)
+ {
+ SafeRelease(cache[i].srv);
+ }
+}
+
+ID3D11ShaderResourceView *TextureStorage11::SRVCache::find(const SRVKey &key) const
+{
+ for (size_t i = 0; i < cache.size(); i++)
+ {
+ if (cache[i].key == key)
+ {
+ return cache[i].srv;
+ }
+ }
+
+ return NULL;
+}
+
+ID3D11ShaderResourceView *TextureStorage11::SRVCache::add(const SRVKey &key, ID3D11ShaderResourceView *srv)
+{
+ SRVPair pair = {key, srv};
+ cache.push_back(pair);
+
+ return srv;
+}
+
+TextureStorage11::TextureStorage11(Renderer *renderer, UINT bindFlags)
+ : mBindFlags(bindFlags),
+ mTopLevel(0),
+ mMipLevels(0),
+ mTextureFormat(DXGI_FORMAT_UNKNOWN),
+ mShaderResourceFormat(DXGI_FORMAT_UNKNOWN),
+ mRenderTargetFormat(DXGI_FORMAT_UNKNOWN),
+ mDepthStencilFormat(DXGI_FORMAT_UNKNOWN),
+ mTextureWidth(0),
+ mTextureHeight(0),
+ mTextureDepth(0)
+{
+ mRenderer = Renderer11::makeRenderer11(renderer);
+
+ for (unsigned int i = 0; i < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+ {
+ mLevelSRVs[i] = NULL;
+ }
+}
+
+TextureStorage11::~TextureStorage11()
+{
+ for (unsigned int level = 0; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+ {
+ SafeRelease(mLevelSRVs[level]);
+ }
+}
+
+TextureStorage11 *TextureStorage11::makeTextureStorage11(TextureStorage *storage)
+{
+ ASSERT(HAS_DYNAMIC_TYPE(TextureStorage11*, storage));
+ return static_cast<TextureStorage11*>(storage);
+}
+
+DWORD TextureStorage11::GetTextureBindFlags(GLenum internalFormat, GLuint clientVersion, bool renderTarget)
+{
+ UINT bindFlags = 0;
+
+ if (gl_d3d11::GetSRVFormat(internalFormat, clientVersion) != DXGI_FORMAT_UNKNOWN)
+ {
+ bindFlags |= D3D11_BIND_SHADER_RESOURCE;
+ }
+ if (gl_d3d11::GetDSVFormat(internalFormat, clientVersion) != DXGI_FORMAT_UNKNOWN)
+ {
+ bindFlags |= D3D11_BIND_DEPTH_STENCIL;
+ }
+ if (gl_d3d11::GetRTVFormat(internalFormat, clientVersion) != DXGI_FORMAT_UNKNOWN && renderTarget)
+ {
+ bindFlags |= D3D11_BIND_RENDER_TARGET;
+ }
+
+ return bindFlags;
+}
+
+UINT TextureStorage11::getBindFlags() const
+{
+ return mBindFlags;
+}
+
+int TextureStorage11::getTopLevel() const
+{
+ return mTopLevel;
+}
+
+bool TextureStorage11::isRenderTarget() const
+{
+ return (mBindFlags & (D3D11_BIND_RENDER_TARGET | D3D11_BIND_DEPTH_STENCIL)) != 0;
+}
+
+bool TextureStorage11::isManaged() const
+{
+ return false;
+}
+
+int TextureStorage11::getLevelCount() const
+{
+ return mMipLevels - mTopLevel;
+}
+
+int TextureStorage11::getLevelWidth(int mipLevel) const
+{
+ return std::max(static_cast<int>(mTextureWidth) >> mipLevel, 1);
+}
+
+int TextureStorage11::getLevelHeight(int mipLevel) const
+{
+ return std::max(static_cast<int>(mTextureHeight) >> mipLevel, 1);
+}
+
+int TextureStorage11::getLevelDepth(int mipLevel) const
+{
+ return std::max(static_cast<int>(mTextureDepth) >> mipLevel, 1);
+}
+
+UINT TextureStorage11::getSubresourceIndex(int mipLevel, int layerTarget) const
+{
+ UINT index = 0;
+ if (getResource())
+ {
+ index = D3D11CalcSubresource(mipLevel, layerTarget, mMipLevels);
+ }
+ return index;
+}
+
+ID3D11ShaderResourceView *TextureStorage11::getSRV(const gl::SamplerState &samplerState)
+{
+ bool swizzleRequired = samplerState.swizzleRequired();
+ bool mipmapping = gl::IsMipmapFiltered(samplerState);
+ unsigned int mipLevels = mipmapping ? (samplerState.maxLevel - samplerState.baseLevel) : 1;
+
+ // Make sure there's 'mipLevels' mipmap levels below the base level (offset by the top level, which corresponds to GL level 0)
+ mipLevels = std::min(mipLevels, mMipLevels - mTopLevel - samplerState.baseLevel);
+
+ if (swizzleRequired)
+ {
+ verifySwizzleExists(samplerState.swizzleRed, samplerState.swizzleGreen, samplerState.swizzleBlue, samplerState.swizzleAlpha);
+ }
+
+ SRVKey key(samplerState.baseLevel, mipLevels, swizzleRequired);
+ ID3D11ShaderResourceView *srv = srvCache.find(key);
+
+ if(srv)
+ {
+ return srv;
+ }
+
+ DXGI_FORMAT format = (swizzleRequired ? mSwizzleShaderResourceFormat : mShaderResourceFormat);
+ ID3D11Resource *texture = swizzleRequired ? getSwizzleTexture() : getResource();
+
+ srv = createSRV(samplerState.baseLevel, mipLevels, format, texture);
+
+ return srvCache.add(key, srv);
+}
+
+ID3D11ShaderResourceView *TextureStorage11::getSRVLevel(int mipLevel)
+{
+ if (mipLevel >= 0 && mipLevel < getLevelCount())
+ {
+ if (!mLevelSRVs[mipLevel])
+ {
+ mLevelSRVs[mipLevel] = createSRV(mipLevel, 1, mShaderResourceFormat, getResource());
+ }
+
+ return mLevelSRVs[mipLevel];
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+void TextureStorage11::generateSwizzles(GLenum swizzleRed, GLenum swizzleGreen, GLenum swizzleBlue, GLenum swizzleAlpha)
+{
+ SwizzleCacheValue swizzleTarget(swizzleRed, swizzleGreen, swizzleBlue, swizzleAlpha);
+ for (int level = 0; level < getLevelCount(); level++)
+ {
+ // Check if the swizzle for this level is out of date
+ if (mSwizzleCache[level] != swizzleTarget)
+ {
+ // Need to re-render the swizzle for this level
+ ID3D11ShaderResourceView *sourceSRV = getSRVLevel(level);
+ ID3D11RenderTargetView *destRTV = getSwizzleRenderTarget(level);
+
+ gl::Extents size(getLevelWidth(level), getLevelHeight(level), getLevelDepth(level));
+
+ Blit11 *blitter = mRenderer->getBlitter();
+
+ if (blitter->swizzleTexture(sourceSRV, destRTV, size, swizzleRed, swizzleGreen, swizzleBlue, swizzleAlpha))
+ {
+ mSwizzleCache[level] = swizzleTarget;
+ }
+ else
+ {
+ ERR("Failed to swizzle texture.");
+ }
+ }
+ }
+}
+
+void TextureStorage11::invalidateSwizzleCacheLevel(int mipLevel)
+{
+ if (mipLevel >= 0 && static_cast<unsigned int>(mipLevel) < ArraySize(mSwizzleCache))
+ {
+ // The default constructor of SwizzleCacheValue has GL_NONE for all channels which is not a
+ // valid swizzle combination
+ mSwizzleCache[mipLevel] = SwizzleCacheValue();
+ }
+}
+
+void TextureStorage11::invalidateSwizzleCache()
+{
+ for (unsigned int mipLevel = 0; mipLevel < ArraySize(mSwizzleCache); mipLevel++)
+ {
+ invalidateSwizzleCacheLevel(mipLevel);
+ }
+}
+
+bool TextureStorage11::updateSubresourceLevel(ID3D11Resource *srcTexture, unsigned int sourceSubresource,
+ int level, int layerTarget, GLint xoffset, GLint yoffset, GLint zoffset,
+ GLsizei width, GLsizei height, GLsizei depth)
+{
+ if (srcTexture)
+ {
+ invalidateSwizzleCacheLevel(level);
+
+ gl::Extents texSize(getLevelWidth(level), getLevelHeight(level), getLevelDepth(level));
+ gl::Box copyArea(xoffset, yoffset, zoffset, width, height, depth);
+
+ bool fullCopy = copyArea.x == 0 &&
+ copyArea.y == 0 &&
+ copyArea.z == 0 &&
+ copyArea.width == texSize.width &&
+ copyArea.height == texSize.height &&
+ copyArea.depth == texSize.depth;
+
+ ID3D11Resource *dstTexture = getResource();
+ unsigned int dstSubresource = getSubresourceIndex(level + mTopLevel, layerTarget);
+
+ ASSERT(dstTexture);
+
+ if (!fullCopy && (d3d11::GetDepthBits(mTextureFormat) > 0 || d3d11::GetStencilBits(mTextureFormat) > 0))
+ {
+ // CopySubresourceRegion cannot copy partial depth stencils, use the blitter instead
+ Blit11 *blitter = mRenderer->getBlitter();
+
+ return blitter->copyDepthStencil(srcTexture, sourceSubresource, copyArea, texSize,
+ dstTexture, dstSubresource, copyArea, texSize,
+ NULL);
+ }
+ else
+ {
+ D3D11_BOX srcBox;
+ srcBox.left = copyArea.x;
+ srcBox.top = copyArea.y;
+ srcBox.right = copyArea.x + roundUp((unsigned int)width, d3d11::GetBlockWidth(mTextureFormat));
+ srcBox.bottom = copyArea.y + roundUp((unsigned int)height, d3d11::GetBlockHeight(mTextureFormat));
+ srcBox.front = copyArea.z;
+ srcBox.back = copyArea.z + copyArea.depth;
+
+ ID3D11DeviceContext *context = mRenderer->getDeviceContext();
+
+ context->CopySubresourceRegion(dstTexture, dstSubresource, copyArea.x, copyArea.y, copyArea.z,
+ srcTexture, sourceSubresource, fullCopy ? NULL : &srcBox);
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void TextureStorage11::generateMipmapLayer(RenderTarget11 *source, RenderTarget11 *dest)
+{
+ if (source && dest)
+ {
+ ID3D11ShaderResourceView *sourceSRV = source->getShaderResourceView();
+ ID3D11RenderTargetView *destRTV = dest->getRenderTargetView();
+
+ if (sourceSRV && destRTV)
+ {
+ gl::Box sourceArea(0, 0, 0, source->getWidth(), source->getHeight(), source->getDepth());
+ gl::Extents sourceSize(source->getWidth(), source->getHeight(), source->getDepth());
+
+ gl::Box destArea(0, 0, 0, dest->getWidth(), dest->getHeight(), dest->getDepth());
+ gl::Extents destSize(dest->getWidth(), dest->getHeight(), dest->getDepth());
+
+ Blit11 *blitter = mRenderer->getBlitter();
+
+ blitter->copyTexture(sourceSRV, sourceArea, sourceSize, destRTV, destArea, destSize, NULL,
+ gl::GetFormat(source->getInternalFormat(), mRenderer->getCurrentClientVersion()),
+ GL_LINEAR);
+ }
+ }
+}
+
+void TextureStorage11::verifySwizzleExists(GLenum swizzleRed, GLenum swizzleGreen, GLenum swizzleBlue, GLenum swizzleAlpha)
+{
+ SwizzleCacheValue swizzleTarget(swizzleRed, swizzleGreen, swizzleBlue, swizzleAlpha);
+ for (unsigned int level = 0; level < mMipLevels; level++)
+ {
+ ASSERT(mSwizzleCache[level] == swizzleTarget);
+ }
+}
+
+TextureStorage11_2D::TextureStorage11_2D(Renderer *renderer, SwapChain11 *swapchain)
+ : TextureStorage11(renderer, D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE)
+{
+ mTexture = swapchain->getOffscreenTexture();
+ mTexture->AddRef();
+ mSwizzleTexture = NULL;
+
+ for (unsigned int i = 0; i < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+ {
+ mRenderTarget[i] = NULL;
+ mSwizzleRenderTargets[i] = NULL;
+ }
+
+ D3D11_TEXTURE2D_DESC texDesc;
+ mTexture->GetDesc(&texDesc);
+ mMipLevels = texDesc.MipLevels;
+ mTextureFormat = texDesc.Format;
+ mTextureWidth = texDesc.Width;
+ mTextureHeight = texDesc.Height;
+ mTextureDepth = 1;
+
+ ID3D11ShaderResourceView *srv = swapchain->getRenderTargetShaderResource();
+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+ srv->GetDesc(&srvDesc);
+ mShaderResourceFormat = srvDesc.Format;
+
+ ID3D11RenderTargetView* offscreenRTV = swapchain->getRenderTarget();
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+ offscreenRTV->GetDesc(&rtvDesc);
+ mRenderTargetFormat = rtvDesc.Format;
+
+ GLint internalFormat = d3d11_gl::GetInternalFormat(mTextureFormat, renderer->getCurrentClientVersion());
+ mSwizzleTextureFormat = gl_d3d11::GetSwizzleTexFormat(internalFormat, renderer);
+ mSwizzleShaderResourceFormat = gl_d3d11::GetSwizzleSRVFormat(internalFormat, renderer);
+ mSwizzleRenderTargetFormat = gl_d3d11::GetSwizzleRTVFormat(internalFormat, renderer);
+
+ mDepthStencilFormat = DXGI_FORMAT_UNKNOWN;
+}
+
+TextureStorage11_2D::TextureStorage11_2D(Renderer *renderer, GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels)
+ : TextureStorage11(renderer, GetTextureBindFlags(internalformat, renderer->getCurrentClientVersion(), renderTarget))
+{
+ mTexture = NULL;
+ mSwizzleTexture = NULL;
+
+ for (unsigned int i = 0; i < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+ {
+ mRenderTarget[i] = NULL;
+ mSwizzleRenderTargets[i] = NULL;
+ }
+
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+
+ mTextureFormat = gl_d3d11::GetTexFormat(internalformat, clientVersion);
+ mShaderResourceFormat = gl_d3d11::GetSRVFormat(internalformat, clientVersion);
+ mDepthStencilFormat = gl_d3d11::GetDSVFormat(internalformat, clientVersion);
+ mRenderTargetFormat = gl_d3d11::GetRTVFormat(internalformat, clientVersion);
+ mSwizzleTextureFormat = gl_d3d11::GetSwizzleTexFormat(internalformat, renderer);
+ mSwizzleShaderResourceFormat = gl_d3d11::GetSwizzleSRVFormat(internalformat, renderer);
+ mSwizzleRenderTargetFormat = gl_d3d11::GetSwizzleRTVFormat(internalformat, renderer);
+
+ // if the width or height is not positive this should be treated as an incomplete texture
+ // we handle that here by skipping the d3d texture creation
+ if (width > 0 && height > 0)
+ {
+ // adjust size if needed for compressed textures
+ d3d11::MakeValidSize(false, mTextureFormat, &width, &height, &mTopLevel);
+
+ ID3D11Device *device = mRenderer->getDevice();
+
+ D3D11_TEXTURE2D_DESC desc;
+ desc.Width = width; // Compressed texture size constraints?
+ desc.Height = height;
+ desc.MipLevels = ((levels > 0) ? (mTopLevel + levels) : 0);
+ desc.ArraySize = 1;
+ desc.Format = mTextureFormat;
+ desc.SampleDesc.Count = 1;
+ desc.SampleDesc.Quality = 0;
+ desc.Usage = D3D11_USAGE_DEFAULT;
+ desc.BindFlags = getBindFlags();
+ desc.CPUAccessFlags = 0;
+ desc.MiscFlags = 0;
+
+ HRESULT result = device->CreateTexture2D(&desc, NULL, &mTexture);
+
+ // this can happen from windows TDR
+ if (d3d11::isDeviceLostError(result))
+ {
+ mRenderer->notifyDeviceLost();
+ gl::error(GL_OUT_OF_MEMORY);
+ }
+ else if (FAILED(result))
+ {
+ ASSERT(result == E_OUTOFMEMORY);
+ ERR("Creating image failed.");
+ gl::error(GL_OUT_OF_MEMORY);
+ }
+ else
+ {
+ mTexture->GetDesc(&desc);
+ mMipLevels = desc.MipLevels;
+ mTextureWidth = desc.Width;
+ mTextureHeight = desc.Height;
+ mTextureDepth = 1;
+ }
+ }
+}
+
+TextureStorage11_2D::~TextureStorage11_2D()
+{
+ SafeRelease(mTexture);
+ SafeRelease(mSwizzleTexture);
+
+ for (unsigned int i = 0; i < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+ {
+ SafeDelete(mRenderTarget[i]);
+ SafeRelease(mSwizzleRenderTargets[i]);
+ }
+}
+
+TextureStorage11_2D *TextureStorage11_2D::makeTextureStorage11_2D(TextureStorage *storage)
+{
+ ASSERT(HAS_DYNAMIC_TYPE(TextureStorage11_2D*, storage));
+ return static_cast<TextureStorage11_2D*>(storage);
+}
+
+ID3D11Resource *TextureStorage11_2D::getResource() const
+{
+ return mTexture;
+}
+
+RenderTarget *TextureStorage11_2D::getRenderTarget(int level)
+{
+ if (level >= 0 && level < getLevelCount())
+ {
+ if (!mRenderTarget[level])
+ {
+ ID3D11ShaderResourceView *srv = getSRVLevel(level);
+ if (!srv)
+ {
+ return NULL;
+ }
+
+ if (mRenderTargetFormat != DXGI_FORMAT_UNKNOWN)
+ {
+ ID3D11Device *device = mRenderer->getDevice();
+
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+ rtvDesc.Format = mRenderTargetFormat;
+ rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
+ rtvDesc.Texture2D.MipSlice = mTopLevel + level;
+
+ ID3D11RenderTargetView *rtv;
+ HRESULT result = device->CreateRenderTargetView(mTexture, &rtvDesc, &rtv);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, static_cast<RenderTarget*>(NULL));
+ }
+ ASSERT(SUCCEEDED(result));
+
+ mRenderTarget[level] = new RenderTarget11(mRenderer, rtv, mTexture, srv, getLevelWidth(level), getLevelHeight(level), 1);
+
+ // RenderTarget will take ownership of these resources
+ SafeRelease(rtv);
+ }
+ else if (mDepthStencilFormat != DXGI_FORMAT_UNKNOWN)
+ {
+ ID3D11Device *device = mRenderer->getDevice();
+
+ D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
+ dsvDesc.Format = mDepthStencilFormat;
+ dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
+ dsvDesc.Texture2D.MipSlice = mTopLevel + level;
+ dsvDesc.Flags = 0;
+
+ ID3D11DepthStencilView *dsv;
+ HRESULT result = device->CreateDepthStencilView(mTexture, &dsvDesc, &dsv);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ SafeRelease(srv);
+ return gl::error(GL_OUT_OF_MEMORY, static_cast<RenderTarget*>(NULL));
+ }
+ ASSERT(SUCCEEDED(result));
+
+ mRenderTarget[level] = new RenderTarget11(mRenderer, dsv, mTexture, srv, getLevelWidth(level), getLevelHeight(level), 1);
+
+ // RenderTarget will take ownership of these resources
+ SafeRelease(dsv);
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+ }
+
+ return mRenderTarget[level];
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+ID3D11ShaderResourceView *TextureStorage11_2D::createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture)
+{
+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+ srvDesc.Format = format;
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
+ srvDesc.Texture2D.MostDetailedMip = mTopLevel + baseLevel;
+ srvDesc.Texture2D.MipLevels = mipLevels;
+
+ ID3D11ShaderResourceView *SRV = NULL;
+
+ ID3D11Device *device = mRenderer->getDevice();
+ HRESULT result = device->CreateShaderResourceView(texture, &srvDesc, &SRV);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ gl::error(GL_OUT_OF_MEMORY);
+ }
+ ASSERT(SUCCEEDED(result));
+
+ return SRV;
+}
+
+void TextureStorage11_2D::generateMipmap(int level)
+{
+ invalidateSwizzleCacheLevel(level);
+
+ RenderTarget11 *source = RenderTarget11::makeRenderTarget11(getRenderTarget(level - 1));
+ RenderTarget11 *dest = RenderTarget11::makeRenderTarget11(getRenderTarget(level));
+
+ generateMipmapLayer(source, dest);
+}
+
+ID3D11Resource *TextureStorage11_2D::getSwizzleTexture()
+{
+ if (!mSwizzleTexture)
+ {
+ ID3D11Device *device = mRenderer->getDevice();
+
+ D3D11_TEXTURE2D_DESC desc;
+ desc.Width = mTextureWidth;
+ desc.Height = mTextureHeight;
+ desc.MipLevels = mMipLevels;
+ desc.ArraySize = 1;
+ desc.Format = mSwizzleTextureFormat;
+ desc.SampleDesc.Count = 1;
+ desc.SampleDesc.Quality = 0;
+ desc.Usage = D3D11_USAGE_DEFAULT;
+ desc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
+ desc.CPUAccessFlags = 0;
+ desc.MiscFlags = 0;
+
+ HRESULT result = device->CreateTexture2D(&desc, NULL, &mSwizzleTexture);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, static_cast<ID3D11Texture2D*>(NULL));
+ }
+ ASSERT(SUCCEEDED(result));
+ }
+
+ return mSwizzleTexture;
+}
+
+ID3D11RenderTargetView *TextureStorage11_2D::getSwizzleRenderTarget(int mipLevel)
+{
+ if (mipLevel >= 0 && mipLevel < getLevelCount())
+ {
+ if (!mSwizzleRenderTargets[mipLevel])
+ {
+ ID3D11Resource *swizzleTexture = getSwizzleTexture();
+ if (!swizzleTexture)
+ {
+ return NULL;
+ }
+
+ ID3D11Device *device = mRenderer->getDevice();
+
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+ rtvDesc.Format = mSwizzleRenderTargetFormat;
+ rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
+ rtvDesc.Texture2D.MipSlice = mTopLevel + mipLevel;
+
+ HRESULT result = device->CreateRenderTargetView(mSwizzleTexture, &rtvDesc, &mSwizzleRenderTargets[mipLevel]);
+ if (result == E_OUTOFMEMORY)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, static_cast<ID3D11RenderTargetView*>(NULL));
+ }
+ ASSERT(SUCCEEDED(result));
+ }
+
+ return mSwizzleRenderTargets[mipLevel];
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+unsigned int TextureStorage11_2D::getTextureLevelDepth(int mipLevel) const
+{
+ return 1;
+}
+
+TextureStorage11_Cube::TextureStorage11_Cube(Renderer *renderer, GLenum internalformat, bool renderTarget, int size, int levels)
+ : TextureStorage11(renderer, GetTextureBindFlags(internalformat, renderer->getCurrentClientVersion(), renderTarget))
+{
+ mTexture = NULL;
+ mSwizzleTexture = NULL;
+
+ for (unsigned int level = 0; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+ {
+ mSwizzleRenderTargets[level] = NULL;
+ for (unsigned int face = 0; face < 6; face++)
+ {
+ mRenderTarget[face][level] = NULL;
+ }
+ }
+
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+
+ mTextureFormat = gl_d3d11::GetTexFormat(internalformat, clientVersion);
+ mShaderResourceFormat = gl_d3d11::GetSRVFormat(internalformat, clientVersion);
+ mDepthStencilFormat = gl_d3d11::GetDSVFormat(internalformat, clientVersion);
+ mRenderTargetFormat = gl_d3d11::GetRTVFormat(internalformat, clientVersion);
+ mSwizzleTextureFormat = gl_d3d11::GetSwizzleTexFormat(internalformat, renderer);
+ mSwizzleShaderResourceFormat = gl_d3d11::GetSwizzleSRVFormat(internalformat, renderer);
+ mSwizzleRenderTargetFormat = gl_d3d11::GetSwizzleRTVFormat(internalformat, renderer);
+
+ // if the size is not positive this should be treated as an incomplete texture
+ // we handle that here by skipping the d3d texture creation
+ if (size > 0)
+ {
+ // adjust size if needed for compressed textures
+ int height = size;
+ d3d11::MakeValidSize(false, mTextureFormat, &size, &height, &mTopLevel);
+
+ ID3D11Device *device = mRenderer->getDevice();
+
+ D3D11_TEXTURE2D_DESC desc;
+ desc.Width = size;
+ desc.Height = size;
+ desc.MipLevels = ((levels > 0) ? (mTopLevel + levels) : 0);
+ desc.ArraySize = 6;
+ desc.Format = mTextureFormat;
+ desc.SampleDesc.Count = 1;
+ desc.SampleDesc.Quality = 0;
+ desc.Usage = D3D11_USAGE_DEFAULT;
+ desc.BindFlags = getBindFlags();
+ desc.CPUAccessFlags = 0;
+ desc.MiscFlags = D3D11_RESOURCE_MISC_TEXTURECUBE;
+
+ HRESULT result = device->CreateTexture2D(&desc, NULL, &mTexture);
+
+ if (FAILED(result))
+ {
+ ASSERT(result == E_OUTOFMEMORY);
+ ERR("Creating image failed.");
+ gl::error(GL_OUT_OF_MEMORY);
+ }
+ else
+ {
+ mTexture->GetDesc(&desc);
+ mMipLevels = desc.MipLevels;
+ mTextureWidth = desc.Width;
+ mTextureHeight = desc.Height;
+ mTextureDepth = 1;
+ }
+ }
+}
+
+TextureStorage11_Cube::~TextureStorage11_Cube()
+{
+ SafeRelease(mTexture);
+ SafeRelease(mSwizzleTexture);
+
+ for (unsigned int level = 0; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+ {
+ SafeRelease(mSwizzleRenderTargets[level]);
+ for (unsigned int face = 0; face < 6; face++)
+ {
+ SafeDelete(mRenderTarget[face][level]);
+ }
+ }
+}
+
+TextureStorage11_Cube *TextureStorage11_Cube::makeTextureStorage11_Cube(TextureStorage *storage)
+{
+ ASSERT(HAS_DYNAMIC_TYPE(TextureStorage11_Cube*, storage));
+ return static_cast<TextureStorage11_Cube*>(storage);
+}
+
+ID3D11Resource *TextureStorage11_Cube::getResource() const
+{
+ return mTexture;
+}
+
+RenderTarget *TextureStorage11_Cube::getRenderTargetFace(GLenum faceTarget, int level)
+{
+ if (level >= 0 && level < getLevelCount())
+ {
+ int faceIndex = gl::TextureCubeMap::targetToIndex(faceTarget);
+ if (!mRenderTarget[faceIndex][level])
+ {
+ ID3D11Device *device = mRenderer->getDevice();
+ HRESULT result;
+
+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+ srvDesc.Format = mShaderResourceFormat;
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY; // Will be used with Texture2D sampler, not TextureCube
+ srvDesc.Texture2DArray.MostDetailedMip = mTopLevel + level;
+ srvDesc.Texture2DArray.MipLevels = 1;
+ srvDesc.Texture2DArray.FirstArraySlice = faceIndex;
+ srvDesc.Texture2DArray.ArraySize = 1;
+
+ ID3D11ShaderResourceView *srv;
+ result = device->CreateShaderResourceView(mTexture, &srvDesc, &srv);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, static_cast<RenderTarget*>(NULL));
+ }
+ ASSERT(SUCCEEDED(result));
+
+ if (mRenderTargetFormat != DXGI_FORMAT_UNKNOWN)
+ {
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+ rtvDesc.Format = mRenderTargetFormat;
+ rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
+ rtvDesc.Texture2DArray.MipSlice = mTopLevel + level;
+ rtvDesc.Texture2DArray.FirstArraySlice = faceIndex;
+ rtvDesc.Texture2DArray.ArraySize = 1;
+
+ ID3D11RenderTargetView *rtv;
+ result = device->CreateRenderTargetView(mTexture, &rtvDesc, &rtv);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ SafeRelease(srv);
+ return gl::error(GL_OUT_OF_MEMORY, static_cast<RenderTarget*>(NULL));
+ }
+ ASSERT(SUCCEEDED(result));
+
+ mRenderTarget[faceIndex][level] = new RenderTarget11(mRenderer, rtv, mTexture, srv, getLevelWidth(level), getLevelHeight(level), 1);
+
+ // RenderTarget will take ownership of these resources
+ SafeRelease(rtv);
+ SafeRelease(srv);
+ }
+ else if (mDepthStencilFormat != DXGI_FORMAT_UNKNOWN)
+ {
+ D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
+ dsvDesc.Format = mDepthStencilFormat;
+ dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DARRAY;
+ dsvDesc.Flags = 0;
+ dsvDesc.Texture2DArray.MipSlice = mTopLevel + level;
+ dsvDesc.Texture2DArray.FirstArraySlice = faceIndex;
+ dsvDesc.Texture2DArray.ArraySize = 1;
+
+ ID3D11DepthStencilView *dsv;
+ result = device->CreateDepthStencilView(mTexture, &dsvDesc, &dsv);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ SafeRelease(srv);
+ return gl::error(GL_OUT_OF_MEMORY, static_cast<RenderTarget*>(NULL));
+ }
+ ASSERT(SUCCEEDED(result));
+
+ mRenderTarget[faceIndex][level] = new RenderTarget11(mRenderer, dsv, mTexture, srv, getLevelWidth(level), getLevelHeight(level), 1);
+
+ // RenderTarget will take ownership of these resources
+ SafeRelease(dsv);
+ SafeRelease(srv);
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+ }
+
+ return mRenderTarget[faceIndex][level];
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+ID3D11ShaderResourceView *TextureStorage11_Cube::createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture)
+{
+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+ srvDesc.Format = format;
+
+ // Unnormalized integer cube maps are not supported by DX11; we emulate them as an array of six 2D textures
+ bool unnormalizedInteger = (d3d11::GetComponentType(mTextureFormat) == GL_INT ||
+ d3d11::GetComponentType(mTextureFormat) == GL_UNSIGNED_INT);
+
+ if(unnormalizedInteger)
+ {
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY;
+ srvDesc.Texture2DArray.MostDetailedMip = mTopLevel + baseLevel;
+ srvDesc.Texture2DArray.MipLevels = 1;
+ srvDesc.Texture2DArray.FirstArraySlice = 0;
+ srvDesc.Texture2DArray.ArraySize = 6;
+ }
+ else
+ {
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE;
+ srvDesc.TextureCube.MipLevels = mipLevels;
+ srvDesc.TextureCube.MostDetailedMip = mTopLevel + baseLevel;
+ }
+
+ ID3D11ShaderResourceView *SRV = NULL;
+
+ ID3D11Device *device = mRenderer->getDevice();
+ HRESULT result = device->CreateShaderResourceView(texture, &srvDesc, &SRV);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ gl::error(GL_OUT_OF_MEMORY);
+ }
+ ASSERT(SUCCEEDED(result));
+
+ return SRV;
+}
+
+void TextureStorage11_Cube::generateMipmap(int faceIndex, int level)
+{
+ invalidateSwizzleCacheLevel(level);
+
+ RenderTarget11 *source = RenderTarget11::makeRenderTarget11(getRenderTargetFace(GL_TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level - 1));
+ RenderTarget11 *dest = RenderTarget11::makeRenderTarget11(getRenderTargetFace(GL_TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level));
+
+ generateMipmapLayer(source, dest);
+}
+
+ID3D11Resource *TextureStorage11_Cube::getSwizzleTexture()
+{
+ if (!mSwizzleTexture)
+ {
+ ID3D11Device *device = mRenderer->getDevice();
+
+ D3D11_TEXTURE2D_DESC desc;
+ desc.Width = mTextureWidth;
+ desc.Height = mTextureHeight;
+ desc.MipLevels = mMipLevels;
+ desc.ArraySize = 6;
+ desc.Format = mSwizzleTextureFormat;
+ desc.SampleDesc.Count = 1;
+ desc.SampleDesc.Quality = 0;
+ desc.Usage = D3D11_USAGE_DEFAULT;
+ desc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
+ desc.CPUAccessFlags = 0;
+ desc.MiscFlags = D3D11_RESOURCE_MISC_TEXTURECUBE;
+
+ HRESULT result = device->CreateTexture2D(&desc, NULL, &mSwizzleTexture);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, static_cast<ID3D11Texture2D*>(NULL));
+ }
+ ASSERT(SUCCEEDED(result));
+ }
+
+ return mSwizzleTexture;
+}
+
+ID3D11RenderTargetView *TextureStorage11_Cube::getSwizzleRenderTarget(int mipLevel)
+{
+ if (mipLevel >= 0 && mipLevel < getLevelCount())
+ {
+ if (!mSwizzleRenderTargets[mipLevel])
+ {
+ ID3D11Resource *swizzleTexture = getSwizzleTexture();
+ if (!swizzleTexture)
+ {
+ return NULL;
+ }
+
+ ID3D11Device *device = mRenderer->getDevice();
+
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+ rtvDesc.Format = mSwizzleRenderTargetFormat;
+ rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
+ rtvDesc.Texture2DArray.MipSlice = mTopLevel + mipLevel;
+ rtvDesc.Texture2DArray.FirstArraySlice = 0;
+ rtvDesc.Texture2DArray.ArraySize = 6;
+
+ HRESULT result = device->CreateRenderTargetView(mSwizzleTexture, &rtvDesc, &mSwizzleRenderTargets[mipLevel]);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, static_cast<ID3D11RenderTargetView*>(NULL));
+ }
+ ASSERT(SUCCEEDED(result));
+ }
+
+ return mSwizzleRenderTargets[mipLevel];
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+unsigned int TextureStorage11_Cube::getTextureLevelDepth(int mipLevel) const
+{
+ return 6;
+}
+
+TextureStorage11_3D::TextureStorage11_3D(Renderer *renderer, GLenum internalformat, bool renderTarget,
+ GLsizei width, GLsizei height, GLsizei depth, int levels)
+ : TextureStorage11(renderer, GetTextureBindFlags(internalformat, renderer->getCurrentClientVersion(), renderTarget))
+{
+ mTexture = NULL;
+ mSwizzleTexture = NULL;
+
+ for (unsigned int i = 0; i < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+ {
+ mLevelRenderTargets[i] = NULL;
+ mSwizzleRenderTargets[i] = NULL;
+ }
+
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+
+ mTextureFormat = gl_d3d11::GetTexFormat(internalformat, clientVersion);
+ mShaderResourceFormat = gl_d3d11::GetSRVFormat(internalformat, clientVersion);
+ mDepthStencilFormat = gl_d3d11::GetDSVFormat(internalformat, clientVersion);
+ mRenderTargetFormat = gl_d3d11::GetRTVFormat(internalformat, clientVersion);
+ mSwizzleTextureFormat = gl_d3d11::GetSwizzleTexFormat(internalformat, renderer);
+ mSwizzleShaderResourceFormat = gl_d3d11::GetSwizzleSRVFormat(internalformat, renderer);
+ mSwizzleRenderTargetFormat = gl_d3d11::GetSwizzleRTVFormat(internalformat, renderer);
+
+ // If the width, height or depth are not positive this should be treated as an incomplete texture
+ // we handle that here by skipping the d3d texture creation
+ if (width > 0 && height > 0 && depth > 0)
+ {
+ // adjust size if needed for compressed textures
+ d3d11::MakeValidSize(false, mTextureFormat, &width, &height, &mTopLevel);
+
+ ID3D11Device *device = mRenderer->getDevice();
+
+ D3D11_TEXTURE3D_DESC desc;
+ desc.Width = width;
+ desc.Height = height;
+ desc.Depth = depth;
+ desc.MipLevels = ((levels > 0) ? (mTopLevel + levels) : 0);
+ desc.Format = mTextureFormat;
+ desc.Usage = D3D11_USAGE_DEFAULT;
+ desc.BindFlags = getBindFlags();
+ desc.CPUAccessFlags = 0;
+ desc.MiscFlags = 0;
+
+ HRESULT result = device->CreateTexture3D(&desc, NULL, &mTexture);
+
+ // this can happen from windows TDR
+ if (d3d11::isDeviceLostError(result))
+ {
+ mRenderer->notifyDeviceLost();
+ gl::error(GL_OUT_OF_MEMORY);
+ }
+ else if (FAILED(result))
+ {
+ ASSERT(result == E_OUTOFMEMORY);
+ ERR("Creating image failed.");
+ gl::error(GL_OUT_OF_MEMORY);
+ }
+ else
+ {
+ mTexture->GetDesc(&desc);
+ mMipLevels = desc.MipLevels;
+ mTextureWidth = desc.Width;
+ mTextureHeight = desc.Height;
+ mTextureDepth = desc.Depth;
+ }
+ }
+}
+
+TextureStorage11_3D::~TextureStorage11_3D()
+{
+ SafeRelease(mTexture);
+ SafeRelease(mSwizzleTexture);
+
+ for (RenderTargetMap::iterator i = mLevelLayerRenderTargets.begin(); i != mLevelLayerRenderTargets.end(); i++)
+ {
+ SafeDelete(i->second);
+ }
+ mLevelLayerRenderTargets.clear();
+
+ for (unsigned int i = 0; i < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+ {
+ SafeDelete(mLevelRenderTargets[i]);
+ SafeRelease(mSwizzleRenderTargets[i]);
+ }
+}
+
+TextureStorage11_3D *TextureStorage11_3D::makeTextureStorage11_3D(TextureStorage *storage)
+{
+ ASSERT(HAS_DYNAMIC_TYPE(TextureStorage11_3D*, storage));
+ return static_cast<TextureStorage11_3D*>(storage);
+}
+
+ID3D11Resource *TextureStorage11_3D::getResource() const
+{
+ return mTexture;
+}
+
+ID3D11ShaderResourceView *TextureStorage11_3D::createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture)
+{
+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+ srvDesc.Format = format;
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE3D;
+ srvDesc.Texture3D.MostDetailedMip = baseLevel;
+ srvDesc.Texture3D.MipLevels = mipLevels;
+
+ ID3D11ShaderResourceView *SRV = NULL;
+
+ ID3D11Device *device = mRenderer->getDevice();
+ HRESULT result = device->CreateShaderResourceView(texture, &srvDesc, &SRV);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ gl::error(GL_OUT_OF_MEMORY);
+ }
+ ASSERT(SUCCEEDED(result));
+
+ return SRV;
+}
+
+RenderTarget *TextureStorage11_3D::getRenderTarget(int mipLevel)
+{
+ if (mipLevel >= 0 && mipLevel < getLevelCount())
+ {
+ if (!mLevelRenderTargets[mipLevel])
+ {
+ ID3D11ShaderResourceView *srv = getSRVLevel(mipLevel);
+ if (!srv)
+ {
+ return NULL;
+ }
+
+ if (mRenderTargetFormat != DXGI_FORMAT_UNKNOWN)
+ {
+ ID3D11Device *device = mRenderer->getDevice();
+
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+ rtvDesc.Format = mRenderTargetFormat;
+ rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE3D;
+ rtvDesc.Texture3D.MipSlice = mTopLevel + mipLevel;
+ rtvDesc.Texture3D.FirstWSlice = 0;
+ rtvDesc.Texture3D.WSize = -1;
+
+ ID3D11RenderTargetView *rtv;
+ HRESULT result = device->CreateRenderTargetView(mTexture, &rtvDesc, &rtv);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ SafeRelease(srv);
+ return gl::error(GL_OUT_OF_MEMORY, static_cast<RenderTarget*>(NULL));
+ }
+ ASSERT(SUCCEEDED(result));
+
+ mLevelRenderTargets[mipLevel] = new RenderTarget11(mRenderer, rtv, mTexture, srv, getLevelWidth(mipLevel), getLevelHeight(mipLevel), getLevelDepth(mipLevel));
+
+ // RenderTarget will take ownership of these resources
+ SafeRelease(rtv);
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+ }
+
+ return mLevelRenderTargets[mipLevel];
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+RenderTarget *TextureStorage11_3D::getRenderTargetLayer(int mipLevel, int layer)
+{
+ if (mipLevel >= 0 && mipLevel < getLevelCount())
+ {
+ LevelLayerKey key(mipLevel, layer);
+ if (mLevelLayerRenderTargets.find(key) == mLevelLayerRenderTargets.end())
+ {
+ ID3D11Device *device = mRenderer->getDevice();
+ HRESULT result;
+
+ // TODO, what kind of SRV is expected here?
+ ID3D11ShaderResourceView *srv = NULL;
+
+ if (mRenderTargetFormat != DXGI_FORMAT_UNKNOWN)
+ {
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+ rtvDesc.Format = mRenderTargetFormat;
+ rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE3D;
+ rtvDesc.Texture3D.MipSlice = mTopLevel + mipLevel;
+ rtvDesc.Texture3D.FirstWSlice = layer;
+ rtvDesc.Texture3D.WSize = 1;
+
+ ID3D11RenderTargetView *rtv;
+ result = device->CreateRenderTargetView(mTexture, &rtvDesc, &rtv);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ SafeRelease(srv);
+ return gl::error(GL_OUT_OF_MEMORY, static_cast<RenderTarget*>(NULL));
+ }
+ ASSERT(SUCCEEDED(result));
+
+ mLevelLayerRenderTargets[key] = new RenderTarget11(mRenderer, rtv, mTexture, srv, getLevelWidth(mipLevel), getLevelHeight(mipLevel), 1);
+
+ // RenderTarget will take ownership of these resources
+ SafeRelease(rtv);
+ SafeRelease(srv);
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+ }
+
+ return mLevelLayerRenderTargets[key];
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+void TextureStorage11_3D::generateMipmap(int level)
+{
+ invalidateSwizzleCacheLevel(level);
+
+ RenderTarget11 *source = RenderTarget11::makeRenderTarget11(getRenderTarget(level - 1));
+ RenderTarget11 *dest = RenderTarget11::makeRenderTarget11(getRenderTarget(level));
+
+ generateMipmapLayer(source, dest);
+}
+
+ID3D11Resource *TextureStorage11_3D::getSwizzleTexture()
+{
+ if (!mSwizzleTexture)
+ {
+ ID3D11Device *device = mRenderer->getDevice();
+
+ D3D11_TEXTURE3D_DESC desc;
+ desc.Width = mTextureWidth;
+ desc.Height = mTextureHeight;
+ desc.Depth = mTextureDepth;
+ desc.MipLevels = mMipLevels;
+ desc.Format = mSwizzleTextureFormat;
+ desc.Usage = D3D11_USAGE_DEFAULT;
+ desc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
+ desc.CPUAccessFlags = 0;
+ desc.MiscFlags = 0;
+
+ HRESULT result = device->CreateTexture3D(&desc, NULL, &mSwizzleTexture);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, static_cast<ID3D11Texture3D*>(NULL));
+ }
+ ASSERT(SUCCEEDED(result));
+ }
+
+ return mSwizzleTexture;
+}
+
+ID3D11RenderTargetView *TextureStorage11_3D::getSwizzleRenderTarget(int mipLevel)
+{
+ if (mipLevel >= 0 && mipLevel < getLevelCount())
+ {
+ if (!mSwizzleRenderTargets[mipLevel])
+ {
+ ID3D11Resource *swizzleTexture = getSwizzleTexture();
+ if (!swizzleTexture)
+ {
+ return NULL;
+ }
+
+ ID3D11Device *device = mRenderer->getDevice();
+
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+ rtvDesc.Format = mSwizzleRenderTargetFormat;
+ rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE3D;
+ rtvDesc.Texture3D.MipSlice = mTopLevel + mipLevel;
+ rtvDesc.Texture3D.FirstWSlice = 0;
+ rtvDesc.Texture3D.WSize = -1;
+
+ HRESULT result = device->CreateRenderTargetView(mSwizzleTexture, &rtvDesc, &mSwizzleRenderTargets[mipLevel]);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, static_cast<ID3D11RenderTargetView*>(NULL));
+ }
+ ASSERT(SUCCEEDED(result));
+ }
+
+ return mSwizzleRenderTargets[mipLevel];
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+unsigned int TextureStorage11_3D::getTextureLevelDepth(int mipLevel) const
+{
+ return std::max(mTextureDepth >> mipLevel, 1U);
+}
+
+
+TextureStorage11_2DArray::TextureStorage11_2DArray(Renderer *renderer, GLenum internalformat, bool renderTarget,
+ GLsizei width, GLsizei height, GLsizei depth, int levels)
+ : TextureStorage11(renderer, GetTextureBindFlags(internalformat, renderer->getCurrentClientVersion(), renderTarget))
+{
+ mTexture = NULL;
+ mSwizzleTexture = NULL;
+
+ for (unsigned int level = 0; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+ {
+ mSwizzleRenderTargets[level] = NULL;
+ }
+
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+
+ mTextureFormat = gl_d3d11::GetTexFormat(internalformat, clientVersion);
+ mShaderResourceFormat = gl_d3d11::GetSRVFormat(internalformat, clientVersion);
+ mDepthStencilFormat = gl_d3d11::GetDSVFormat(internalformat, clientVersion);
+ mRenderTargetFormat = gl_d3d11::GetRTVFormat(internalformat, clientVersion);
+ mSwizzleTextureFormat = gl_d3d11::GetSwizzleTexFormat(internalformat, renderer);
+ mSwizzleShaderResourceFormat = gl_d3d11::GetSwizzleSRVFormat(internalformat, renderer);
+ mSwizzleRenderTargetFormat = gl_d3d11::GetSwizzleRTVFormat(internalformat, renderer);
+
+ // if the width, height or depth is not positive this should be treated as an incomplete texture
+ // we handle that here by skipping the d3d texture creation
+ if (width > 0 && height > 0 && depth > 0)
+ {
+ // adjust size if needed for compressed textures
+ d3d11::MakeValidSize(false, mTextureFormat, &width, &height, &mTopLevel);
+
+ ID3D11Device *device = mRenderer->getDevice();
+
+ D3D11_TEXTURE2D_DESC desc;
+ desc.Width = width;
+ desc.Height = height;
+ desc.MipLevels = ((levels > 0) ? (mTopLevel + levels) : 0);
+ desc.ArraySize = depth;
+ desc.Format = mTextureFormat;
+ desc.SampleDesc.Count = 1;
+ desc.SampleDesc.Quality = 0;
+ desc.Usage = D3D11_USAGE_DEFAULT;
+ desc.BindFlags = getBindFlags();
+ desc.CPUAccessFlags = 0;
+ desc.MiscFlags = 0;
+
+ HRESULT result = device->CreateTexture2D(&desc, NULL, &mTexture);
+
+ // this can happen from windows TDR
+ if (d3d11::isDeviceLostError(result))
+ {
+ mRenderer->notifyDeviceLost();
+ gl::error(GL_OUT_OF_MEMORY);
+ }
+ else if (FAILED(result))
+ {
+ ASSERT(result == E_OUTOFMEMORY);
+ ERR("Creating image failed.");
+ gl::error(GL_OUT_OF_MEMORY);
+ }
+ else
+ {
+ mTexture->GetDesc(&desc);
+ mMipLevels = desc.MipLevels;
+ mTextureWidth = desc.Width;
+ mTextureHeight = desc.Height;
+ mTextureDepth = desc.ArraySize;
+ }
+ }
+}
+
+TextureStorage11_2DArray::~TextureStorage11_2DArray()
+{
+ SafeRelease(mTexture);
+ SafeRelease(mSwizzleTexture);
+
+ for (unsigned int level = 0; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+ {
+ SafeRelease(mSwizzleRenderTargets[level]);
+ }
+
+ for (RenderTargetMap::iterator i = mRenderTargets.begin(); i != mRenderTargets.end(); i++)
+ {
+ SafeDelete(i->second);
+ }
+ mRenderTargets.clear();
+}
+
+TextureStorage11_2DArray *TextureStorage11_2DArray::makeTextureStorage11_2DArray(TextureStorage *storage)
+{
+ ASSERT(HAS_DYNAMIC_TYPE(TextureStorage11_2DArray*, storage));
+ return static_cast<TextureStorage11_2DArray*>(storage);
+}
+
+ID3D11Resource *TextureStorage11_2DArray::getResource() const
+{
+ return mTexture;
+}
+
+ID3D11ShaderResourceView *TextureStorage11_2DArray::createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture)
+{
+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+ srvDesc.Format = format;
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY;
+ srvDesc.Texture2DArray.MostDetailedMip = mTopLevel + baseLevel;
+ srvDesc.Texture2DArray.MipLevels = mipLevels;
+ srvDesc.Texture2DArray.FirstArraySlice = 0;
+ srvDesc.Texture2DArray.ArraySize = mTextureDepth;
+
+ ID3D11ShaderResourceView *SRV = NULL;
+
+ ID3D11Device *device = mRenderer->getDevice();
+ HRESULT result = device->CreateShaderResourceView(texture, &srvDesc, &SRV);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ gl::error(GL_OUT_OF_MEMORY);
+ }
+ ASSERT(SUCCEEDED(result));
+
+ return SRV;
+}
+
+RenderTarget *TextureStorage11_2DArray::getRenderTargetLayer(int mipLevel, int layer)
+{
+ if (mipLevel >= 0 && mipLevel < getLevelCount())
+ {
+ LevelLayerKey key(mipLevel, layer);
+ if (mRenderTargets.find(key) == mRenderTargets.end())
+ {
+ ID3D11Device *device = mRenderer->getDevice();
+ HRESULT result;
+
+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+ srvDesc.Format = mShaderResourceFormat;
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY;
+ srvDesc.Texture2DArray.MostDetailedMip = mTopLevel + mipLevel;
+ srvDesc.Texture2DArray.MipLevels = 1;
+ srvDesc.Texture2DArray.FirstArraySlice = layer;
+ srvDesc.Texture2DArray.ArraySize = 1;
+
+ ID3D11ShaderResourceView *srv;
+ result = device->CreateShaderResourceView(mTexture, &srvDesc, &srv);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, static_cast<RenderTarget*>(NULL));
+ }
+ ASSERT(SUCCEEDED(result));
+
+ if (mRenderTargetFormat != DXGI_FORMAT_UNKNOWN)
+ {
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+ rtvDesc.Format = mRenderTargetFormat;
+ rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
+ rtvDesc.Texture2DArray.MipSlice = mTopLevel + mipLevel;
+ rtvDesc.Texture2DArray.FirstArraySlice = layer;
+ rtvDesc.Texture2DArray.ArraySize = 1;
+
+ ID3D11RenderTargetView *rtv;
+ result = device->CreateRenderTargetView(mTexture, &rtvDesc, &rtv);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ SafeRelease(srv);
+ return gl::error(GL_OUT_OF_MEMORY, static_cast<RenderTarget*>(NULL));
+ }
+ ASSERT(SUCCEEDED(result));
+
+ mRenderTargets[key] = new RenderTarget11(mRenderer, rtv, mTexture, srv, getLevelWidth(mipLevel), getLevelHeight(mipLevel), 1);
+
+ // RenderTarget will take ownership of these resources
+ SafeRelease(rtv);
+ SafeRelease(srv);
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+ }
+
+ return mRenderTargets[key];
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+void TextureStorage11_2DArray::generateMipmap(int level)
+{
+ invalidateSwizzleCacheLevel(level);
+ for (unsigned int layer = 0; layer < mTextureDepth; layer++)
+ {
+ RenderTarget11 *source = RenderTarget11::makeRenderTarget11(getRenderTargetLayer(level - 1, layer));
+ RenderTarget11 *dest = RenderTarget11::makeRenderTarget11(getRenderTargetLayer(level, layer));
+
+ generateMipmapLayer(source, dest);
+ }
+}
+
+ID3D11Resource *TextureStorage11_2DArray::getSwizzleTexture()
+{
+ if (!mSwizzleTexture)
+ {
+ ID3D11Device *device = mRenderer->getDevice();
+
+ D3D11_TEXTURE2D_DESC desc;
+ desc.Width = mTextureWidth;
+ desc.Height = mTextureHeight;
+ desc.MipLevels = mMipLevels;
+ desc.ArraySize = mTextureDepth;
+ desc.Format = mSwizzleTextureFormat;
+ desc.SampleDesc.Count = 1;
+ desc.SampleDesc.Quality = 0;
+ desc.Usage = D3D11_USAGE_DEFAULT;
+ desc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
+ desc.CPUAccessFlags = 0;
+ desc.MiscFlags = 0;
+
+ HRESULT result = device->CreateTexture2D(&desc, NULL, &mSwizzleTexture);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, static_cast<ID3D11Texture2D*>(NULL));
+ }
+ ASSERT(SUCCEEDED(result));
+ }
+
+ return mSwizzleTexture;
+}
+
+ID3D11RenderTargetView *TextureStorage11_2DArray::getSwizzleRenderTarget(int mipLevel)
+{
+ if (mipLevel >= 0 && mipLevel < getLevelCount())
+ {
+ if (!mSwizzleRenderTargets[mipLevel])
+ {
+ ID3D11Resource *swizzleTexture = getSwizzleTexture();
+ if (!swizzleTexture)
+ {
+ return NULL;
+ }
+
+ ID3D11Device *device = mRenderer->getDevice();
+
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+ rtvDesc.Format = mSwizzleRenderTargetFormat;
+ rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
+ rtvDesc.Texture2DArray.MipSlice = mTopLevel + mipLevel;
+ rtvDesc.Texture2DArray.FirstArraySlice = 0;
+ rtvDesc.Texture2DArray.ArraySize = mTextureDepth;
+
+ HRESULT result = device->CreateRenderTargetView(mSwizzleTexture, &rtvDesc, &mSwizzleRenderTargets[mipLevel]);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, static_cast<ID3D11RenderTargetView*>(NULL));
+ }
+ ASSERT(SUCCEEDED(result));
+ }
+
+ return mSwizzleRenderTargets[mipLevel];
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+unsigned int TextureStorage11_2DArray::getTextureLevelDepth(int mipLevel) const
+{
+ return mTextureDepth;
+}
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.h
new file mode 100644
index 00000000000..8a612bdd110
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.h
@@ -0,0 +1,278 @@
+//
+// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// TextureStorage11.h: Defines the abstract rx::TextureStorage11 class and its concrete derived
+// classes TextureStorage11_2D and TextureStorage11_Cube, which act as the interface to the D3D11 texture.
+
+#ifndef LIBGLESV2_RENDERER_TEXTURESTORAGE11_H_
+#define LIBGLESV2_RENDERER_TEXTURESTORAGE11_H_
+
+#include "libGLESv2/Texture.h"
+#include "libGLESv2/renderer/TextureStorage.h"
+
+namespace rx
+{
+class RenderTarget;
+class RenderTarget11;
+class Renderer;
+class Renderer11;
+class SwapChain11;
+
+class TextureStorage11 : public TextureStorage
+{
+ public:
+ virtual ~TextureStorage11();
+
+ static TextureStorage11 *makeTextureStorage11(TextureStorage *storage);
+
+ static DWORD GetTextureBindFlags(GLenum internalFormat, GLuint clientVersion, bool renderTarget);
+
+ UINT getBindFlags() const;
+
+ virtual ID3D11Resource *getResource() const = 0;
+ virtual ID3D11ShaderResourceView *getSRV(const gl::SamplerState &samplerState);
+ virtual RenderTarget *getRenderTarget(int level) { return NULL; }
+ virtual RenderTarget *getRenderTargetFace(GLenum faceTarget, int level) { return NULL; }
+ virtual RenderTarget *getRenderTargetLayer(int mipLevel, int layer) { return NULL; }
+
+ virtual void generateMipmap(int level) {};
+ virtual void generateMipmap(int face, int level) {};
+
+ virtual int getTopLevel() const;
+ virtual bool isRenderTarget() const;
+ virtual bool isManaged() const;
+ virtual int getLevelCount() const;
+ UINT getSubresourceIndex(int mipLevel, int layerTarget) const;
+
+ void generateSwizzles(GLenum swizzleRed, GLenum swizzleGreen, GLenum swizzleBlue, GLenum swizzleAlpha);
+ void invalidateSwizzleCacheLevel(int mipLevel);
+ void invalidateSwizzleCache();
+
+ bool updateSubresourceLevel(ID3D11Resource *texture, unsigned int sourceSubresource, int level,
+ int layerTarget, GLint xoffset, GLint yoffset, GLint zoffset,
+ GLsizei width, GLsizei height, GLsizei depth);
+
+ protected:
+ TextureStorage11(Renderer *renderer, UINT bindFlags);
+ void generateMipmapLayer(RenderTarget11 *source, RenderTarget11 *dest);
+ int getLevelWidth(int mipLevel) const;
+ int getLevelHeight(int mipLevel) const;
+ int getLevelDepth(int mipLevel) const;
+
+ virtual ID3D11Resource *getSwizzleTexture() = 0;
+ virtual ID3D11RenderTargetView *getSwizzleRenderTarget(int mipLevel) = 0;
+ ID3D11ShaderResourceView *getSRVLevel(int mipLevel);
+
+ virtual ID3D11ShaderResourceView *createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture) = 0;
+
+ void verifySwizzleExists(GLenum swizzleRed, GLenum swizzleGreen, GLenum swizzleBlue, GLenum swizzleAlpha);
+
+ virtual unsigned int getTextureLevelDepth(int mipLevel) const = 0;
+
+ Renderer11 *mRenderer;
+ int mTopLevel;
+ unsigned int mMipLevels;
+
+ DXGI_FORMAT mTextureFormat;
+ DXGI_FORMAT mShaderResourceFormat;
+ DXGI_FORMAT mRenderTargetFormat;
+ DXGI_FORMAT mDepthStencilFormat;
+ DXGI_FORMAT mSwizzleTextureFormat;
+ DXGI_FORMAT mSwizzleShaderResourceFormat;
+ DXGI_FORMAT mSwizzleRenderTargetFormat;
+ unsigned int mTextureWidth;
+ unsigned int mTextureHeight;
+ unsigned int mTextureDepth;
+
+ struct SwizzleCacheValue
+ {
+ GLenum swizzleRed;
+ GLenum swizzleGreen;
+ GLenum swizzleBlue;
+ GLenum swizzleAlpha;
+
+ SwizzleCacheValue();
+ SwizzleCacheValue(GLenum red, GLenum green, GLenum blue, GLenum alpha);
+
+ bool operator ==(const SwizzleCacheValue &other) const;
+ bool operator !=(const SwizzleCacheValue &other) const;
+ };
+ SwizzleCacheValue mSwizzleCache[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+
+ struct SRVKey
+ {
+ SRVKey(int baseLevel = 0, int mipLevels = 0, bool swizzle = false);
+
+ bool operator==(const SRVKey &rhs) const;
+
+ int baseLevel;
+ int mipLevels;
+ bool swizzle;
+ };
+
+ struct SRVPair
+ {
+ SRVKey key;
+ ID3D11ShaderResourceView *srv;
+ };
+
+ struct SRVCache
+ {
+ ~SRVCache();
+
+ ID3D11ShaderResourceView *find(const SRVKey &key) const;
+ ID3D11ShaderResourceView *add(const SRVKey &key, ID3D11ShaderResourceView *srv);
+
+ std::vector<SRVPair> cache;
+ };
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TextureStorage11);
+
+ const UINT mBindFlags;
+
+ SRVCache srvCache;
+ ID3D11ShaderResourceView *mLevelSRVs[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+};
+
+class TextureStorage11_2D : public TextureStorage11
+{
+ public:
+ TextureStorage11_2D(Renderer *renderer, SwapChain11 *swapchain);
+ TextureStorage11_2D(Renderer *renderer, GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels);
+ virtual ~TextureStorage11_2D();
+
+ static TextureStorage11_2D *makeTextureStorage11_2D(TextureStorage *storage);
+
+ virtual ID3D11Resource *getResource() const;
+ virtual RenderTarget *getRenderTarget(int level);
+
+ virtual void generateMipmap(int level);
+
+ protected:
+ virtual ID3D11Resource *getSwizzleTexture();
+ virtual ID3D11RenderTargetView *getSwizzleRenderTarget(int mipLevel);
+
+ virtual unsigned int getTextureLevelDepth(int mipLevel) const;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TextureStorage11_2D);
+
+ virtual ID3D11ShaderResourceView *createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture);
+
+ ID3D11Texture2D *mTexture;
+ RenderTarget11 *mRenderTarget[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+
+ ID3D11Texture2D *mSwizzleTexture;
+ ID3D11RenderTargetView *mSwizzleRenderTargets[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+};
+
+class TextureStorage11_Cube : public TextureStorage11
+{
+ public:
+ TextureStorage11_Cube(Renderer *renderer, GLenum internalformat, bool renderTarget, int size, int levels);
+ virtual ~TextureStorage11_Cube();
+
+ static TextureStorage11_Cube *makeTextureStorage11_Cube(TextureStorage *storage);
+
+ virtual ID3D11Resource *getResource() const;
+ virtual RenderTarget *getRenderTargetFace(GLenum faceTarget, int level);
+
+ virtual void generateMipmap(int faceIndex, int level);
+
+ protected:
+ virtual ID3D11Resource *getSwizzleTexture();
+ virtual ID3D11RenderTargetView *getSwizzleRenderTarget(int mipLevel);
+
+ virtual unsigned int getTextureLevelDepth(int mipLevel) const;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TextureStorage11_Cube);
+
+ virtual ID3D11ShaderResourceView *createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture);
+
+ ID3D11Texture2D *mTexture;
+ RenderTarget11 *mRenderTarget[6][gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+
+ ID3D11Texture2D *mSwizzleTexture;
+ ID3D11RenderTargetView *mSwizzleRenderTargets[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+};
+
+class TextureStorage11_3D : public TextureStorage11
+{
+ public:
+ TextureStorage11_3D(Renderer *renderer, GLenum internalformat, bool renderTarget,
+ GLsizei width, GLsizei height, GLsizei depth, int levels);
+ virtual ~TextureStorage11_3D();
+
+ static TextureStorage11_3D *makeTextureStorage11_3D(TextureStorage *storage);
+
+ virtual ID3D11Resource *getResource() const;
+ virtual RenderTarget *getRenderTarget(int mipLevel);
+ virtual RenderTarget *getRenderTargetLayer(int mipLevel, int layer);
+
+ virtual void generateMipmap(int level);
+
+ protected:
+ virtual ID3D11Resource *getSwizzleTexture();
+ virtual ID3D11RenderTargetView *getSwizzleRenderTarget(int mipLevel);
+
+ virtual unsigned int getTextureLevelDepth(int mipLevel) const;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TextureStorage11_3D);
+
+ virtual ID3D11ShaderResourceView *createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture);
+
+ typedef std::pair<int, int> LevelLayerKey;
+ typedef std::map<LevelLayerKey, RenderTarget11*> RenderTargetMap;
+ RenderTargetMap mLevelLayerRenderTargets;
+
+ RenderTarget11 *mLevelRenderTargets[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+
+ ID3D11Texture3D *mTexture;
+ ID3D11Texture3D *mSwizzleTexture;
+ ID3D11RenderTargetView *mSwizzleRenderTargets[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+};
+
+class TextureStorage11_2DArray : public TextureStorage11
+{
+ public:
+ TextureStorage11_2DArray(Renderer *renderer, GLenum internalformat, bool renderTarget,
+ GLsizei width, GLsizei height, GLsizei depth, int levels);
+ virtual ~TextureStorage11_2DArray();
+
+ static TextureStorage11_2DArray *makeTextureStorage11_2DArray(TextureStorage *storage);
+
+ virtual ID3D11Resource *getResource() const;
+ virtual RenderTarget *getRenderTargetLayer(int mipLevel, int layer);
+
+ virtual void generateMipmap(int level);
+
+ protected:
+ virtual ID3D11Resource *getSwizzleTexture();
+ virtual ID3D11RenderTargetView *getSwizzleRenderTarget(int mipLevel);
+
+ virtual unsigned int getTextureLevelDepth(int mipLevel) const;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TextureStorage11_2DArray);
+
+ virtual ID3D11ShaderResourceView *createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture);
+
+ typedef std::pair<int, int> LevelLayerKey;
+ typedef std::map<LevelLayerKey, RenderTarget11*> RenderTargetMap;
+ RenderTargetMap mRenderTargets;
+
+ ID3D11Texture2D *mTexture;
+
+ ID3D11Texture2D *mSwizzleTexture;
+ ID3D11RenderTargetView *mSwizzleRenderTargets[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+};
+
+}
+
+#endif // LIBGLESV2_RENDERER_TEXTURESTORAGE11_H_
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/VertexBuffer11.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/VertexBuffer11.cpp
new file mode 100644
index 00000000000..d69668d8a37
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/VertexBuffer11.cpp
@@ -0,0 +1,223 @@
+#include "precompiled.h"
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// VertexBuffer11.cpp: Defines the D3D11 VertexBuffer implementation.
+
+#include "libGLESv2/renderer/d3d11/VertexBuffer11.h"
+#include "libGLESv2/renderer/BufferStorage.h"
+
+#include "libGLESv2/Buffer.h"
+#include "libGLESv2/renderer/d3d11/Renderer11.h"
+#include "libGLESv2/VertexAttribute.h"
+#include "libGLESv2/renderer/d3d11/formatutils11.h"
+
+namespace rx
+{
+
+VertexBuffer11::VertexBuffer11(rx::Renderer11 *const renderer) : mRenderer(renderer)
+{
+ mBuffer = NULL;
+ mBufferSize = 0;
+ mDynamicUsage = false;
+}
+
+VertexBuffer11::~VertexBuffer11()
+{
+ SafeRelease(mBuffer);
+}
+
+bool VertexBuffer11::initialize(unsigned int size, bool dynamicUsage)
+{
+ SafeRelease(mBuffer);
+
+ updateSerial();
+
+ if (size > 0)
+ {
+ ID3D11Device* dxDevice = mRenderer->getDevice();
+
+ D3D11_BUFFER_DESC bufferDesc;
+ bufferDesc.ByteWidth = size;
+ bufferDesc.Usage = D3D11_USAGE_DYNAMIC;
+ bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
+ bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ bufferDesc.MiscFlags = 0;
+ bufferDesc.StructureByteStride = 0;
+
+ HRESULT result = dxDevice->CreateBuffer(&bufferDesc, NULL, &mBuffer);
+ if (FAILED(result))
+ {
+ return false;
+ }
+ }
+
+ mBufferSize = size;
+ mDynamicUsage = dynamicUsage;
+ return true;
+}
+
+VertexBuffer11 *VertexBuffer11::makeVertexBuffer11(VertexBuffer *vetexBuffer)
+{
+ ASSERT(HAS_DYNAMIC_TYPE(VertexBuffer11*, vetexBuffer));
+ return static_cast<VertexBuffer11*>(vetexBuffer);
+}
+
+bool VertexBuffer11::storeVertexAttributes(const gl::VertexAttribute &attrib, const gl::VertexAttribCurrentValueData &currentValue,
+ GLint start, GLsizei count, GLsizei instances, unsigned int offset)
+{
+ if (mBuffer)
+ {
+ gl::Buffer *buffer = attrib.mBoundBuffer.get();
+ int inputStride = attrib.stride();
+ ID3D11DeviceContext *dxContext = mRenderer->getDeviceContext();
+
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
+ HRESULT result = dxContext->Map(mBuffer, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &mappedResource);
+ if (FAILED(result))
+ {
+ ERR("Vertex buffer map failed with error 0x%08x", result);
+ return false;
+ }
+
+ char* output = reinterpret_cast<char*>(mappedResource.pData) + offset;
+
+ const char *input = NULL;
+ if (attrib.mArrayEnabled)
+ {
+ if (buffer)
+ {
+ BufferStorage *storage = buffer->getStorage();
+ input = static_cast<const char*>(storage->getData()) + static_cast<int>(attrib.mOffset);
+ }
+ else
+ {
+ input = static_cast<const char*>(attrib.mPointer);
+ }
+ }
+ else
+ {
+ input = reinterpret_cast<const char*>(currentValue.FloatValues);
+ }
+
+ if (instances == 0 || attrib.mDivisor == 0)
+ {
+ input += inputStride * start;
+ }
+
+ gl::VertexFormat vertexFormat(attrib, currentValue.Type);
+ VertexCopyFunction conversionFunc = gl_d3d11::GetVertexCopyFunction(vertexFormat);
+ ASSERT(conversionFunc != NULL);
+ conversionFunc(input, inputStride, count, output);
+
+ dxContext->Unmap(mBuffer, 0);
+
+ return true;
+ }
+ else
+ {
+ ERR("Vertex buffer not initialized.");
+ return false;
+ }
+}
+
+bool VertexBuffer11::getSpaceRequired(const gl::VertexAttribute &attrib, GLsizei count,
+ GLsizei instances, unsigned int *outSpaceRequired) const
+{
+ unsigned int elementCount = 0;
+ if (attrib.mArrayEnabled)
+ {
+ if (instances == 0 || attrib.mDivisor == 0)
+ {
+ elementCount = count;
+ }
+ else
+ {
+ if (static_cast<unsigned int>(instances) < std::numeric_limits<unsigned int>::max() - (attrib.mDivisor - 1))
+ {
+ // Round up
+ elementCount = rx::roundUp(static_cast<unsigned int>(instances), attrib.mDivisor);
+ }
+ else
+ {
+ elementCount = instances / attrib.mDivisor;
+ }
+ }
+
+ gl::VertexFormat vertexFormat(attrib);
+ unsigned int elementSize = static_cast<unsigned int>(gl_d3d11::GetVertexElementSize(vertexFormat));
+ if (elementSize <= std::numeric_limits<unsigned int>::max() / elementCount)
+ {
+ if (outSpaceRequired)
+ {
+ *outSpaceRequired = elementSize * elementCount;
+ }
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ const unsigned int elementSize = 4;
+ if (outSpaceRequired)
+ {
+ *outSpaceRequired = elementSize * 4;
+ }
+ return true;
+ }
+}
+
+unsigned int VertexBuffer11::getBufferSize() const
+{
+ return mBufferSize;
+}
+
+bool VertexBuffer11::setBufferSize(unsigned int size)
+{
+ if (size > mBufferSize)
+ {
+ return initialize(size, mDynamicUsage);
+ }
+ else
+ {
+ return true;
+ }
+}
+
+bool VertexBuffer11::discard()
+{
+ if (mBuffer)
+ {
+ ID3D11DeviceContext *dxContext = mRenderer->getDeviceContext();
+
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
+ HRESULT result = dxContext->Map(mBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
+ if (FAILED(result))
+ {
+ ERR("Vertex buffer map failed with error 0x%08x", result);
+ return false;
+ }
+
+ dxContext->Unmap(mBuffer, 0);
+
+ return true;
+ }
+ else
+ {
+ ERR("Vertex buffer not initialized.");
+ return false;
+ }
+}
+
+ID3D11Buffer *VertexBuffer11::getBuffer() const
+{
+ return mBuffer;
+}
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/VertexBuffer11.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/VertexBuffer11.h
index eceb426e82d..191791af3c4 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/VertexBuffer11.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/VertexBuffer11.h
@@ -25,22 +25,16 @@ class VertexBuffer11 : public VertexBuffer
static VertexBuffer11 *makeVertexBuffer11(VertexBuffer *vetexBuffer);
- virtual bool storeVertexAttributes(const gl::VertexAttribute &attrib, GLint start, GLsizei count, GLsizei instances,
- unsigned int offset);
- virtual bool storeRawData(const void* data, unsigned int size, unsigned int offset);
+ virtual bool storeVertexAttributes(const gl::VertexAttribute &attrib, const gl::VertexAttribCurrentValueData &currentValue,
+ GLint start, GLsizei count, GLsizei instances, unsigned int offset);
virtual bool getSpaceRequired(const gl::VertexAttribute &attrib, GLsizei count, GLsizei instances,
unsigned int *outSpaceRequired) const;
- virtual bool requiresConversion(const gl::VertexAttribute &attrib) const;
-
virtual unsigned int getBufferSize() const;
virtual bool setBufferSize(unsigned int size);
virtual bool discard();
- unsigned int getVertexSize(const gl::VertexAttribute &attrib) const;
- DXGI_FORMAT getDXGIFormat(const gl::VertexAttribute &attrib) const;
-
ID3D11Buffer *getBuffer() const;
private:
@@ -51,22 +45,6 @@ class VertexBuffer11 : public VertexBuffer
ID3D11Buffer *mBuffer;
unsigned int mBufferSize;
bool mDynamicUsage;
-
- typedef void (*VertexConversionFunction)(const void *, unsigned int, unsigned int, void *);
- struct VertexConverter
- {
- VertexConversionFunction conversionFunc;
- bool identity;
- DXGI_FORMAT dxgiFormat;
- unsigned int outputElementSize;
- };
-
- enum { NUM_GL_VERTEX_ATTRIB_TYPES = 6 };
-
- // This table is used to generate mAttributeTypes.
- static const VertexConverter mPossibleTranslations[NUM_GL_VERTEX_ATTRIB_TYPES][2][4]; // [GL types as enumerated by typeIndex()][normalized][size - 1]
-
- static const VertexConverter &getVertexConversion(const gl::VertexAttribute &attribute);
};
}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/formatutils11.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/formatutils11.cpp
new file mode 100644
index 00000000000..695e168478f
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/formatutils11.cpp
@@ -0,0 +1,1665 @@
+#include "precompiled.h"
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// formatutils11.cpp: Queries for GL image formats and their translations to D3D11
+// formats.
+
+#include "libGLESv2/renderer/d3d11/formatutils11.h"
+#include "libGLESv2/renderer/generatemip.h"
+#include "libGLESv2/renderer/loadimage.h"
+#include "libGLESv2/renderer/copyimage.h"
+#include "libGLESv2/renderer/Renderer.h"
+#include "libGLESv2/renderer/copyvertex.h"
+
+namespace rx
+{
+
+struct D3D11ES3FormatInfo
+{
+ DXGI_FORMAT mTexFormat;
+ DXGI_FORMAT mSRVFormat;
+ DXGI_FORMAT mRTVFormat;
+ DXGI_FORMAT mDSVFormat;
+
+ D3D11ES3FormatInfo()
+ : mTexFormat(DXGI_FORMAT_UNKNOWN), mDSVFormat(DXGI_FORMAT_UNKNOWN), mRTVFormat(DXGI_FORMAT_UNKNOWN), mSRVFormat(DXGI_FORMAT_UNKNOWN)
+ { }
+
+ D3D11ES3FormatInfo(DXGI_FORMAT texFormat, DXGI_FORMAT srvFormat, DXGI_FORMAT rtvFormat, DXGI_FORMAT dsvFormat)
+ : mTexFormat(texFormat), mDSVFormat(dsvFormat), mRTVFormat(rtvFormat), mSRVFormat(srvFormat)
+ { }
+};
+
+// For sized GL internal formats, there is only one corresponding D3D11 format. This map type allows
+// querying for the DXGI texture formats to use for textures, SRVs, RTVs and DSVs given a GL internal
+// format.
+typedef std::pair<GLenum, D3D11ES3FormatInfo> D3D11ES3FormatPair;
+typedef std::map<GLenum, D3D11ES3FormatInfo> D3D11ES3FormatMap;
+
+static D3D11ES3FormatMap BuildD3D11ES3FormatMap()
+{
+ D3D11ES3FormatMap map;
+
+ // | GL internal format | | D3D11 texture format | D3D11 SRV format | D3D11 RTV format | D3D11 DSV format |
+ map.insert(D3D11ES3FormatPair(GL_NONE, D3D11ES3FormatInfo(DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_R8, D3D11ES3FormatInfo(DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_R8_SNORM, D3D11ES3FormatInfo(DXGI_FORMAT_R8_SNORM, DXGI_FORMAT_R8_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RG8, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8_UNORM, DXGI_FORMAT_R8G8_UNORM, DXGI_FORMAT_R8G8_UNORM, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RG8_SNORM, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8_SNORM, DXGI_FORMAT_R8G8_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RGB8, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RGB8_SNORM, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8B8A8_SNORM, DXGI_FORMAT_R8G8B8A8_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RGB565, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RGBA4, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RGB5_A1, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RGBA8, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RGBA8_SNORM, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8B8A8_SNORM, DXGI_FORMAT_R8G8B8A8_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RGB10_A2, D3D11ES3FormatInfo(DXGI_FORMAT_R10G10B10A2_UNORM, DXGI_FORMAT_R10G10B10A2_UNORM, DXGI_FORMAT_R10G10B10A2_UNORM, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RGB10_A2UI, D3D11ES3FormatInfo(DXGI_FORMAT_R10G10B10A2_UINT, DXGI_FORMAT_R10G10B10A2_UINT, DXGI_FORMAT_R10G10B10A2_UINT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_SRGB8, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_SRGB8_ALPHA8, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_R16F, D3D11ES3FormatInfo(DXGI_FORMAT_R16_FLOAT, DXGI_FORMAT_R16_FLOAT, DXGI_FORMAT_R16_FLOAT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RG16F, D3D11ES3FormatInfo(DXGI_FORMAT_R16G16_FLOAT, DXGI_FORMAT_R16G16_FLOAT, DXGI_FORMAT_R16G16_FLOAT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RGB16F, D3D11ES3FormatInfo(DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RGBA16F, D3D11ES3FormatInfo(DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_R32F, D3D11ES3FormatInfo(DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RG32F, D3D11ES3FormatInfo(DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RGB32F, D3D11ES3FormatInfo(DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RGBA32F, D3D11ES3FormatInfo(DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_R11F_G11F_B10F, D3D11ES3FormatInfo(DXGI_FORMAT_R11G11B10_FLOAT, DXGI_FORMAT_R11G11B10_FLOAT, DXGI_FORMAT_R11G11B10_FLOAT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RGB9_E5, D3D11ES3FormatInfo(DXGI_FORMAT_R9G9B9E5_SHAREDEXP, DXGI_FORMAT_R9G9B9E5_SHAREDEXP, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_R8I, D3D11ES3FormatInfo(DXGI_FORMAT_R8_SINT, DXGI_FORMAT_R8_SINT, DXGI_FORMAT_R8_SINT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_R8UI, D3D11ES3FormatInfo(DXGI_FORMAT_R8_UINT, DXGI_FORMAT_R8_UINT, DXGI_FORMAT_R8_UINT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_R16I, D3D11ES3FormatInfo(DXGI_FORMAT_R16_SINT, DXGI_FORMAT_R16_SINT, DXGI_FORMAT_R16_SINT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_R16UI, D3D11ES3FormatInfo(DXGI_FORMAT_R16_UINT, DXGI_FORMAT_R16_UINT, DXGI_FORMAT_R16_UINT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_R32I, D3D11ES3FormatInfo(DXGI_FORMAT_R32_SINT, DXGI_FORMAT_R32_SINT, DXGI_FORMAT_R32_SINT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_R32UI, D3D11ES3FormatInfo(DXGI_FORMAT_R32_UINT, DXGI_FORMAT_R32_UINT, DXGI_FORMAT_R32_UINT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RG8I, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8_SINT, DXGI_FORMAT_R8G8_SINT, DXGI_FORMAT_R8G8_SINT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RG8UI, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8_UINT, DXGI_FORMAT_R8G8_UINT, DXGI_FORMAT_R8G8_UINT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RG16I, D3D11ES3FormatInfo(DXGI_FORMAT_R16G16_SINT, DXGI_FORMAT_R16G16_SINT, DXGI_FORMAT_R16G16_SINT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RG16UI, D3D11ES3FormatInfo(DXGI_FORMAT_R16G16_UINT, DXGI_FORMAT_R16G16_UINT, DXGI_FORMAT_R16G16_UINT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RG32I, D3D11ES3FormatInfo(DXGI_FORMAT_R32G32_SINT, DXGI_FORMAT_R32G32_SINT, DXGI_FORMAT_R32G32_SINT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RG32UI, D3D11ES3FormatInfo(DXGI_FORMAT_R32G32_UINT, DXGI_FORMAT_R32G32_UINT, DXGI_FORMAT_R32G32_UINT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RGB8I, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8B8A8_SINT, DXGI_FORMAT_R8G8B8A8_SINT, DXGI_FORMAT_R8G8B8A8_SINT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RGB8UI, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8B8A8_UINT, DXGI_FORMAT_R8G8B8A8_UINT, DXGI_FORMAT_R8G8B8A8_UINT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RGB16I, D3D11ES3FormatInfo(DXGI_FORMAT_R16G16B16A16_SINT, DXGI_FORMAT_R16G16B16A16_SINT, DXGI_FORMAT_R16G16B16A16_SINT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RGB16UI, D3D11ES3FormatInfo(DXGI_FORMAT_R16G16B16A16_UINT, DXGI_FORMAT_R16G16B16A16_UINT, DXGI_FORMAT_R16G16B16A16_UINT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RGB32I, D3D11ES3FormatInfo(DXGI_FORMAT_R32G32B32A32_SINT, DXGI_FORMAT_R32G32B32A32_SINT, DXGI_FORMAT_R32G32B32A32_SINT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RGB32UI, D3D11ES3FormatInfo(DXGI_FORMAT_R32G32B32A32_UINT, DXGI_FORMAT_R32G32B32A32_UINT, DXGI_FORMAT_R32G32B32A32_UINT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RGBA8I, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8B8A8_SINT, DXGI_FORMAT_R8G8B8A8_SINT, DXGI_FORMAT_R8G8B8A8_SINT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RGBA8UI, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8B8A8_UINT, DXGI_FORMAT_R8G8B8A8_UINT, DXGI_FORMAT_R8G8B8A8_UINT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RGBA16I, D3D11ES3FormatInfo(DXGI_FORMAT_R16G16B16A16_SINT, DXGI_FORMAT_R16G16B16A16_SINT, DXGI_FORMAT_R16G16B16A16_SINT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RGBA16UI, D3D11ES3FormatInfo(DXGI_FORMAT_R16G16B16A16_UINT, DXGI_FORMAT_R16G16B16A16_UINT, DXGI_FORMAT_R16G16B16A16_UINT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RGBA32I, D3D11ES3FormatInfo(DXGI_FORMAT_R32G32B32A32_SINT, DXGI_FORMAT_R32G32B32A32_SINT, DXGI_FORMAT_R32G32B32A32_SINT, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RGBA32UI, D3D11ES3FormatInfo(DXGI_FORMAT_R32G32B32A32_UINT, DXGI_FORMAT_R32G32B32A32_UINT, DXGI_FORMAT_R32G32B32A32_UINT, DXGI_FORMAT_UNKNOWN)));
+
+ // Unsized formats, TODO: Are types of float and half float allowed for the unsized types? Would it change the DXGI format?
+ map.insert(D3D11ES3FormatPair(GL_ALPHA, D3D11ES3FormatInfo(DXGI_FORMAT_A8_UNORM, DXGI_FORMAT_A8_UNORM, DXGI_FORMAT_A8_UNORM, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_LUMINANCE, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_LUMINANCE_ALPHA, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RGB, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_RGBA, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_BGRA_EXT, D3D11ES3FormatInfo(DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_UNKNOWN)));
+
+ // From GL_EXT_texture_storage
+ // | GL internal format | | D3D11 texture format | D3D11 SRV format | D3D11 RTV format | D3D11 DSV format |
+ map.insert(D3D11ES3FormatPair(GL_ALPHA8_EXT, D3D11ES3FormatInfo(DXGI_FORMAT_A8_UNORM, DXGI_FORMAT_A8_UNORM, DXGI_FORMAT_A8_UNORM, DXGI_FORMAT_UNKNOWN )));
+ map.insert(D3D11ES3FormatPair(GL_LUMINANCE8_EXT, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN )));
+ map.insert(D3D11ES3FormatPair(GL_ALPHA32F_EXT, D3D11ES3FormatInfo(DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_UNKNOWN )));
+ map.insert(D3D11ES3FormatPair(GL_LUMINANCE32F_EXT, D3D11ES3FormatInfo(DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_UNKNOWN )));
+ map.insert(D3D11ES3FormatPair(GL_ALPHA16F_EXT, D3D11ES3FormatInfo(DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_UNKNOWN )));
+ map.insert(D3D11ES3FormatPair(GL_LUMINANCE16F_EXT, D3D11ES3FormatInfo(DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_UNKNOWN )));
+ map.insert(D3D11ES3FormatPair(GL_LUMINANCE8_ALPHA8_EXT, D3D11ES3FormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN )));
+ map.insert(D3D11ES3FormatPair(GL_LUMINANCE_ALPHA32F_EXT, D3D11ES3FormatInfo(DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_UNKNOWN )));
+ map.insert(D3D11ES3FormatPair(GL_LUMINANCE_ALPHA16F_EXT, D3D11ES3FormatInfo(DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_UNKNOWN )));
+ map.insert(D3D11ES3FormatPair(GL_BGRA8_EXT, D3D11ES3FormatInfo(DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_UNKNOWN )));
+ map.insert(D3D11ES3FormatPair(GL_BGRA4_ANGLEX, D3D11ES3FormatInfo(DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_UNKNOWN )));
+ map.insert(D3D11ES3FormatPair(GL_BGR5_A1_ANGLEX, D3D11ES3FormatInfo(DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_UNKNOWN )));
+
+ // Depth stencil formats
+ map.insert(D3D11ES3FormatPair(GL_DEPTH_COMPONENT16, D3D11ES3FormatInfo(DXGI_FORMAT_R16_TYPELESS, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_D16_UNORM )));
+ map.insert(D3D11ES3FormatPair(GL_DEPTH_COMPONENT24, D3D11ES3FormatInfo(DXGI_FORMAT_R24G8_TYPELESS, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_D24_UNORM_S8_UINT )));
+ map.insert(D3D11ES3FormatPair(GL_DEPTH_COMPONENT32F, D3D11ES3FormatInfo(DXGI_FORMAT_R32_TYPELESS, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_D32_FLOAT )));
+ map.insert(D3D11ES3FormatPair(GL_DEPTH24_STENCIL8, D3D11ES3FormatInfo(DXGI_FORMAT_R24G8_TYPELESS, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_D24_UNORM_S8_UINT )));
+ map.insert(D3D11ES3FormatPair(GL_DEPTH32F_STENCIL8, D3D11ES3FormatInfo(DXGI_FORMAT_R32G8X24_TYPELESS, DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_D32_FLOAT_S8X24_UINT)));
+ map.insert(D3D11ES3FormatPair(GL_STENCIL_INDEX8, D3D11ES3FormatInfo(DXGI_FORMAT_R24G8_TYPELESS, DXGI_FORMAT_X24_TYPELESS_G8_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_D24_UNORM_S8_UINT )));
+
+ // From GL_ANGLE_depth_texture
+ map.insert(D3D11ES3FormatPair(GL_DEPTH_COMPONENT32_OES, D3D11ES3FormatInfo(DXGI_FORMAT_R24G8_TYPELESS, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_D24_UNORM_S8_UINT )));
+
+ // Compressed formats, From ES 3.0.1 spec, table 3.16
+ // | GL internal format | | D3D11 texture format | D3D11 SRV format | D3D11 RTV format | D3D11 DSV format |
+ map.insert(D3D11ES3FormatPair(GL_COMPRESSED_R11_EAC, D3D11ES3FormatInfo(DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_COMPRESSED_SIGNED_R11_EAC, D3D11ES3FormatInfo(DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_COMPRESSED_RG11_EAC, D3D11ES3FormatInfo(DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_COMPRESSED_SIGNED_RG11_EAC, D3D11ES3FormatInfo(DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_COMPRESSED_RGB8_ETC2, D3D11ES3FormatInfo(DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_COMPRESSED_SRGB8_ETC2, D3D11ES3FormatInfo(DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, D3D11ES3FormatInfo(DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, D3D11ES3FormatInfo(DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_COMPRESSED_RGBA8_ETC2_EAC, D3D11ES3FormatInfo(DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, D3D11ES3FormatInfo(DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
+
+ // From GL_EXT_texture_compression_dxt1
+ map.insert(D3D11ES3FormatPair(GL_COMPRESSED_RGB_S3TC_DXT1_EXT, D3D11ES3FormatInfo(DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
+ map.insert(D3D11ES3FormatPair(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, D3D11ES3FormatInfo(DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
+
+ // From GL_ANGLE_texture_compression_dxt3
+ map.insert(D3D11ES3FormatPair(GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, D3D11ES3FormatInfo(DXGI_FORMAT_BC2_UNORM, DXGI_FORMAT_BC2_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
+
+ // From GL_ANGLE_texture_compression_dxt5
+ map.insert(D3D11ES3FormatPair(GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, D3D11ES3FormatInfo(DXGI_FORMAT_BC3_UNORM, DXGI_FORMAT_BC3_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN)));
+
+ return map;
+}
+
+static bool GetD3D11ES3FormatInfo(GLenum internalFormat, GLuint clientVersion, D3D11ES3FormatInfo *outFormatInfo)
+{
+ static const D3D11ES3FormatMap formatMap = BuildD3D11ES3FormatMap();
+ D3D11ES3FormatMap::const_iterator iter = formatMap.find(internalFormat);
+ if (iter != formatMap.end())
+ {
+ if (outFormatInfo)
+ {
+ *outFormatInfo = iter->second;
+ }
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+// ES3 image loading functions vary based on the internal format and data type given,
+// this map type determines the loading function from the internal format and type supplied
+// to glTex*Image*D and the destination DXGI_FORMAT. Source formats and types are taken from
+// Tables 3.2 and 3.3 of the ES 3 spec.
+typedef std::pair<GLenum, GLenum> InternalFormatTypePair;
+typedef std::pair<InternalFormatTypePair, LoadImageFunction> D3D11LoadFunctionPair;
+typedef std::map<InternalFormatTypePair, LoadImageFunction> D3D11LoadFunctionMap;
+
+static void UnimplementedLoadFunction(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ UNIMPLEMENTED();
+}
+
+static void UnreachableLoadFunction(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ UNREACHABLE();
+}
+
+// A helper function to insert data into the D3D11LoadFunctionMap with fewer characters.
+static inline void insertLoadFunction(D3D11LoadFunctionMap *map, GLenum internalFormat, GLenum type,
+ LoadImageFunction loadFunc)
+{
+ map->insert(D3D11LoadFunctionPair(InternalFormatTypePair(internalFormat, type), loadFunc));
+}
+
+D3D11LoadFunctionMap buildD3D11LoadFunctionMap()
+{
+ D3D11LoadFunctionMap map;
+
+ // | Internal format | Type | Load function |
+ insertLoadFunction(&map, GL_RGBA8, GL_UNSIGNED_BYTE, loadToNative<GLubyte, 4> );
+ insertLoadFunction(&map, GL_RGB5_A1, GL_UNSIGNED_BYTE, loadToNative<GLubyte, 4> );
+ insertLoadFunction(&map, GL_RGBA4, GL_UNSIGNED_BYTE, loadToNative<GLubyte, 4> );
+ insertLoadFunction(&map, GL_SRGB8_ALPHA8, GL_UNSIGNED_BYTE, loadToNative<GLubyte, 4> );
+ insertLoadFunction(&map, GL_RGBA8_SNORM, GL_BYTE, loadToNative<GLbyte, 4> );
+ insertLoadFunction(&map, GL_RGBA4, GL_UNSIGNED_SHORT_4_4_4_4, loadRGBA4444DataToRGBA );
+ insertLoadFunction(&map, GL_RGB10_A2, GL_UNSIGNED_INT_2_10_10_10_REV, loadToNative<GLuint, 1> );
+ insertLoadFunction(&map, GL_RGB5_A1, GL_UNSIGNED_SHORT_5_5_5_1, loadRGBA5551DataToRGBA );
+ insertLoadFunction(&map, GL_RGB5_A1, GL_UNSIGNED_INT_2_10_10_10_REV, loadRGBA2101010ToRGBA );
+ insertLoadFunction(&map, GL_RGBA16F, GL_HALF_FLOAT, loadToNative<GLhalf, 4> );
+ insertLoadFunction(&map, GL_RGBA32F, GL_FLOAT, loadToNative<GLfloat, 4> );
+ insertLoadFunction(&map, GL_RGBA16F, GL_FLOAT, loadFloatDataToHalfFloat<4> );
+ insertLoadFunction(&map, GL_RGBA8UI, GL_UNSIGNED_BYTE, loadToNative<GLubyte, 4> );
+ insertLoadFunction(&map, GL_RGBA8I, GL_BYTE, loadToNative<GLbyte, 4> );
+ insertLoadFunction(&map, GL_RGBA16UI, GL_UNSIGNED_SHORT, loadToNative<GLushort, 4> );
+ insertLoadFunction(&map, GL_RGBA16I, GL_SHORT, loadToNative<GLshort, 4> );
+ insertLoadFunction(&map, GL_RGBA32UI, GL_UNSIGNED_INT, loadToNative<GLuint, 4> );
+ insertLoadFunction(&map, GL_RGBA32I, GL_INT, loadToNative<GLint, 4> );
+ insertLoadFunction(&map, GL_RGB10_A2UI, GL_UNSIGNED_INT_2_10_10_10_REV, loadToNative<GLuint, 1> );
+ insertLoadFunction(&map, GL_RGB8, GL_UNSIGNED_BYTE, loadRGBUByteDataToRGBA );
+ insertLoadFunction(&map, GL_RGB565, GL_UNSIGNED_BYTE, loadToNative3To4<GLubyte, 0xFF> );
+ insertLoadFunction(&map, GL_SRGB8, GL_UNSIGNED_BYTE, loadToNative3To4<GLubyte, 0xFF> );
+ insertLoadFunction(&map, GL_RGB8_SNORM, GL_BYTE, loadRGBSByteDataToRGBA );
+ insertLoadFunction(&map, GL_RGB565, GL_UNSIGNED_SHORT_5_6_5, loadRGB565DataToRGBA );
+ insertLoadFunction(&map, GL_R11F_G11F_B10F, GL_UNSIGNED_INT_10F_11F_11F_REV, loadToNative<GLuint, 1> );
+ insertLoadFunction(&map, GL_RGB9_E5, GL_UNSIGNED_INT_5_9_9_9_REV, loadToNative<GLuint, 1> );
+ insertLoadFunction(&map, GL_RGB16F, GL_HALF_FLOAT, loadToNative3To4<GLhalf, gl::Float16One>);
+ insertLoadFunction(&map, GL_R11F_G11F_B10F, GL_HALF_FLOAT, loadRGBHalfFloatDataTo111110Float );
+ insertLoadFunction(&map, GL_RGB9_E5, GL_HALF_FLOAT, loadRGBHalfFloatDataTo999E5 );
+ insertLoadFunction(&map, GL_RGB32F, GL_FLOAT, loadToNative3To4<GLfloat, gl::Float32One>);
+ insertLoadFunction(&map, GL_RGB16F, GL_FLOAT, loadFloatRGBDataToHalfFloatRGBA );
+ insertLoadFunction(&map, GL_R11F_G11F_B10F, GL_FLOAT, loadRGBFloatDataTo111110Float );
+ insertLoadFunction(&map, GL_RGB9_E5, GL_FLOAT, loadRGBFloatDataTo999E5 );
+ insertLoadFunction(&map, GL_RGB8UI, GL_UNSIGNED_BYTE, loadToNative3To4<GLubyte, 0x01> );
+ insertLoadFunction(&map, GL_RGB8I, GL_BYTE, loadToNative3To4<GLbyte, 0x01> );
+ insertLoadFunction(&map, GL_RGB16UI, GL_UNSIGNED_SHORT, loadToNative3To4<GLushort, 0x0001> );
+ insertLoadFunction(&map, GL_RGB16I, GL_SHORT, loadToNative3To4<GLshort, 0x0001> );
+ insertLoadFunction(&map, GL_RGB32UI, GL_UNSIGNED_INT, loadToNative3To4<GLuint, 0x00000001> );
+ insertLoadFunction(&map, GL_RGB32I, GL_INT, loadToNative3To4<GLint, 0x00000001> );
+ insertLoadFunction(&map, GL_RG8, GL_UNSIGNED_BYTE, loadToNative<GLubyte, 2> );
+ insertLoadFunction(&map, GL_RG8_SNORM, GL_BYTE, loadToNative<GLbyte, 2> );
+ insertLoadFunction(&map, GL_RG16F, GL_HALF_FLOAT, loadToNative<GLhalf, 2> );
+ insertLoadFunction(&map, GL_RG32F, GL_FLOAT, loadToNative<GLfloat, 2> );
+ insertLoadFunction(&map, GL_RG16F, GL_FLOAT, loadFloatDataToHalfFloat<2> );
+ insertLoadFunction(&map, GL_RG8UI, GL_UNSIGNED_BYTE, loadToNative<GLubyte, 2> );
+ insertLoadFunction(&map, GL_RG8I, GL_BYTE, loadToNative<GLbyte, 2> );
+ insertLoadFunction(&map, GL_RG16UI, GL_UNSIGNED_SHORT, loadToNative<GLushort, 2> );
+ insertLoadFunction(&map, GL_RG16I, GL_SHORT, loadToNative<GLshort, 2> );
+ insertLoadFunction(&map, GL_RG32UI, GL_UNSIGNED_INT, loadToNative<GLuint, 2> );
+ insertLoadFunction(&map, GL_RG32I, GL_INT, loadToNative<GLint, 2> );
+ insertLoadFunction(&map, GL_R8, GL_UNSIGNED_BYTE, loadToNative<GLubyte, 1> );
+ insertLoadFunction(&map, GL_R8_SNORM, GL_BYTE, loadToNative<GLbyte, 1> );
+ insertLoadFunction(&map, GL_R16F, GL_HALF_FLOAT, loadToNative<GLhalf, 1> );
+ insertLoadFunction(&map, GL_R32F, GL_FLOAT, loadToNative<GLfloat, 1> );
+ insertLoadFunction(&map, GL_R16F, GL_FLOAT, loadFloatDataToHalfFloat<1> );
+ insertLoadFunction(&map, GL_R8UI, GL_UNSIGNED_BYTE, loadToNative<GLubyte, 1> );
+ insertLoadFunction(&map, GL_R8I, GL_BYTE, loadToNative<GLbyte, 1> );
+ insertLoadFunction(&map, GL_R16UI, GL_UNSIGNED_SHORT, loadToNative<GLushort, 1> );
+ insertLoadFunction(&map, GL_R16I, GL_SHORT, loadToNative<GLshort, 1> );
+ insertLoadFunction(&map, GL_R32UI, GL_UNSIGNED_INT, loadToNative<GLuint, 1> );
+ insertLoadFunction(&map, GL_R32I, GL_INT, loadToNative<GLint, 1> );
+ insertLoadFunction(&map, GL_DEPTH_COMPONENT16, GL_UNSIGNED_SHORT, loadToNative<GLushort, 1> );
+ insertLoadFunction(&map, GL_DEPTH_COMPONENT24, GL_UNSIGNED_INT, loadG8R24DataToR24G8 );
+ insertLoadFunction(&map, GL_DEPTH_COMPONENT16, GL_UNSIGNED_INT, loadUintDataToUshort );
+ insertLoadFunction(&map, GL_DEPTH_COMPONENT32F, GL_FLOAT, loadToNative<GLfloat, 1> );
+ insertLoadFunction(&map, GL_DEPTH24_STENCIL8, GL_UNSIGNED_INT_24_8, loadG8R24DataToR24G8 );
+ insertLoadFunction(&map, GL_DEPTH32F_STENCIL8, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, loadToNative<GLuint, 2> );
+
+ // Unsized formats
+ // Load functions are unreachable because they are converted to sized internal formats based on
+ // the format and type before loading takes place.
+ insertLoadFunction(&map, GL_RGBA, GL_UNSIGNED_BYTE, UnreachableLoadFunction );
+ insertLoadFunction(&map, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, UnreachableLoadFunction );
+ insertLoadFunction(&map, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, UnreachableLoadFunction );
+ insertLoadFunction(&map, GL_RGB, GL_UNSIGNED_BYTE, UnreachableLoadFunction );
+ insertLoadFunction(&map, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, UnreachableLoadFunction );
+ insertLoadFunction(&map, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, UnreachableLoadFunction );
+ insertLoadFunction(&map, GL_LUMINANCE, GL_UNSIGNED_BYTE, UnreachableLoadFunction );
+ insertLoadFunction(&map, GL_ALPHA, GL_UNSIGNED_BYTE, UnreachableLoadFunction );
+
+ // From GL_OES_texture_float
+ insertLoadFunction(&map, GL_LUMINANCE_ALPHA, GL_FLOAT, loadLuminanceAlphaFloatDataToRGBA );
+ insertLoadFunction(&map, GL_LUMINANCE, GL_FLOAT, loadLuminanceFloatDataToRGB );
+ insertLoadFunction(&map, GL_ALPHA, GL_FLOAT, loadAlphaFloatDataToRGBA );
+
+ // From GL_OES_texture_half_float
+ insertLoadFunction(&map, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT, loadLuminanceAlphaHalfFloatDataToRGBA);
+ insertLoadFunction(&map, GL_LUMINANCE, GL_HALF_FLOAT, loadLuminanceHalfFloatDataToRGBA );
+ insertLoadFunction(&map, GL_ALPHA, GL_HALF_FLOAT, loadAlphaHalfFloatDataToRGBA );
+
+ // From GL_EXT_texture_storage
+ insertLoadFunction(&map, GL_ALPHA8_EXT, GL_UNSIGNED_BYTE, loadToNative<GLubyte, 1> );
+ insertLoadFunction(&map, GL_LUMINANCE8_EXT, GL_UNSIGNED_BYTE, loadLuminanceDataToBGRA );
+ insertLoadFunction(&map, GL_LUMINANCE8_ALPHA8_EXT, GL_UNSIGNED_BYTE, loadLuminanceAlphaDataToBGRA );
+ insertLoadFunction(&map, GL_ALPHA32F_EXT, GL_FLOAT, loadAlphaFloatDataToRGBA );
+ insertLoadFunction(&map, GL_LUMINANCE32F_EXT, GL_FLOAT, loadLuminanceFloatDataToRGB );
+ insertLoadFunction(&map, GL_LUMINANCE_ALPHA32F_EXT, GL_FLOAT, loadLuminanceAlphaFloatDataToRGBA );
+ insertLoadFunction(&map, GL_ALPHA16F_EXT, GL_HALF_FLOAT, loadAlphaHalfFloatDataToRGBA );
+ insertLoadFunction(&map, GL_LUMINANCE16F_EXT, GL_HALF_FLOAT, loadLuminanceHalfFloatDataToRGBA );
+ insertLoadFunction(&map, GL_LUMINANCE_ALPHA16F_EXT, GL_HALF_FLOAT, loadLuminanceAlphaHalfFloatDataToRGBA);
+
+ insertLoadFunction(&map, GL_BGRA8_EXT, GL_UNSIGNED_BYTE, loadToNative<GLubyte, 4> );
+ insertLoadFunction(&map, GL_BGRA4_ANGLEX, GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT, loadRGBA4444DataToRGBA );
+ insertLoadFunction(&map, GL_BGRA4_ANGLEX, GL_UNSIGNED_BYTE, loadToNative<GLubyte, 4> );
+ insertLoadFunction(&map, GL_BGR5_A1_ANGLEX, GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT, loadRGBA5551DataToRGBA );
+ insertLoadFunction(&map, GL_BGR5_A1_ANGLEX, GL_UNSIGNED_BYTE, loadToNative<GLubyte, 4> );
+
+ // Compressed formats
+ // From ES 3.0.1 spec, table 3.16
+ // | Internal format | Type | Load function |
+ insertLoadFunction(&map, GL_COMPRESSED_R11_EAC, GL_UNSIGNED_BYTE, UnimplementedLoadFunction );
+ insertLoadFunction(&map, GL_COMPRESSED_R11_EAC, GL_UNSIGNED_BYTE, UnimplementedLoadFunction );
+ insertLoadFunction(&map, GL_COMPRESSED_SIGNED_R11_EAC, GL_UNSIGNED_BYTE, UnimplementedLoadFunction );
+ insertLoadFunction(&map, GL_COMPRESSED_RG11_EAC, GL_UNSIGNED_BYTE, UnimplementedLoadFunction );
+ insertLoadFunction(&map, GL_COMPRESSED_SIGNED_RG11_EAC, GL_UNSIGNED_BYTE, UnimplementedLoadFunction );
+ insertLoadFunction(&map, GL_COMPRESSED_RGB8_ETC2, GL_UNSIGNED_BYTE, UnimplementedLoadFunction );
+ insertLoadFunction(&map, GL_COMPRESSED_SRGB8_ETC2, GL_UNSIGNED_BYTE, UnimplementedLoadFunction );
+ insertLoadFunction(&map, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_UNSIGNED_BYTE, UnimplementedLoadFunction );
+ insertLoadFunction(&map, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_UNSIGNED_BYTE, UnimplementedLoadFunction );
+ insertLoadFunction(&map, GL_COMPRESSED_RGBA8_ETC2_EAC, GL_UNSIGNED_BYTE, UnimplementedLoadFunction );
+ insertLoadFunction(&map, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, GL_UNSIGNED_BYTE, UnimplementedLoadFunction );
+
+ // From GL_EXT_texture_compression_dxt1
+ insertLoadFunction(&map, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_UNSIGNED_BYTE, loadCompressedBlockDataToNative<4, 4, 8>);
+ insertLoadFunction(&map, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, GL_UNSIGNED_BYTE, loadCompressedBlockDataToNative<4, 4, 8>);
+
+ // From GL_ANGLE_texture_compression_dxt3
+ insertLoadFunction(&map, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, GL_UNSIGNED_BYTE, loadCompressedBlockDataToNative<4, 4, 16>);
+
+ // From GL_ANGLE_texture_compression_dxt5
+ insertLoadFunction(&map, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, GL_UNSIGNED_BYTE, loadCompressedBlockDataToNative<4, 4, 16>);
+
+ return map;
+}
+
+struct D3D11ES2FormatInfo
+{
+ DXGI_FORMAT mTexFormat;
+ DXGI_FORMAT mSRVFormat;
+ DXGI_FORMAT mRTVFormat;
+ DXGI_FORMAT mDSVFormat;
+
+ LoadImageFunction mLoadImageFunction;
+
+ D3D11ES2FormatInfo()
+ : mTexFormat(DXGI_FORMAT_UNKNOWN), mDSVFormat(DXGI_FORMAT_UNKNOWN), mRTVFormat(DXGI_FORMAT_UNKNOWN),
+ mSRVFormat(DXGI_FORMAT_UNKNOWN), mLoadImageFunction(NULL)
+ { }
+
+ D3D11ES2FormatInfo(DXGI_FORMAT texFormat, DXGI_FORMAT srvFormat, DXGI_FORMAT rtvFormat, DXGI_FORMAT dsvFormat,
+ LoadImageFunction loadFunc)
+ : mTexFormat(texFormat), mDSVFormat(dsvFormat), mRTVFormat(rtvFormat), mSRVFormat(srvFormat),
+ mLoadImageFunction(loadFunc)
+ { }
+};
+
+// ES2 internal formats can map to DXGI formats and loading functions
+typedef std::pair<GLenum, D3D11ES2FormatInfo> D3D11ES2FormatPair;
+typedef std::map<GLenum, D3D11ES2FormatInfo> D3D11ES2FormatMap;
+
+static D3D11ES2FormatMap BuildD3D11ES2FormatMap()
+{
+ D3D11ES2FormatMap map;
+
+ // | Internal format | | Texture format | SRV format | RTV format | DSV format | Load function |
+ map.insert(D3D11ES2FormatPair(GL_NONE, D3D11ES2FormatInfo(DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, UnreachableLoadFunction )));
+ map.insert(D3D11ES2FormatPair(GL_DEPTH_COMPONENT16, D3D11ES2FormatInfo(DXGI_FORMAT_R16_TYPELESS, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_D16_UNORM, UnreachableLoadFunction )));
+ map.insert(D3D11ES2FormatPair(GL_DEPTH_COMPONENT32_OES, D3D11ES2FormatInfo(DXGI_FORMAT_R32_TYPELESS, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_D32_FLOAT, UnreachableLoadFunction )));
+ map.insert(D3D11ES2FormatPair(GL_DEPTH24_STENCIL8_OES, D3D11ES2FormatInfo(DXGI_FORMAT_R24G8_TYPELESS, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_D24_UNORM_S8_UINT, UnreachableLoadFunction )));
+ map.insert(D3D11ES2FormatPair(GL_STENCIL_INDEX8, D3D11ES2FormatInfo(DXGI_FORMAT_R24G8_TYPELESS, DXGI_FORMAT_X24_TYPELESS_G8_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_D24_UNORM_S8_UINT, UnreachableLoadFunction )));
+
+ map.insert(D3D11ES2FormatPair(GL_RGBA32F_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_UNKNOWN, loadRGBAFloatDataToRGBA )));
+ map.insert(D3D11ES2FormatPair(GL_RGB32F_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_UNKNOWN, loadRGBFloatDataToRGBA )));
+ map.insert(D3D11ES2FormatPair(GL_ALPHA32F_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_UNKNOWN, loadAlphaFloatDataToRGBA )));
+ map.insert(D3D11ES2FormatPair(GL_LUMINANCE32F_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_UNKNOWN, loadLuminanceFloatDataToRGBA )));
+ map.insert(D3D11ES2FormatPair(GL_LUMINANCE_ALPHA32F_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_UNKNOWN, loadLuminanceAlphaFloatDataToRGBA )));
+
+ map.insert(D3D11ES2FormatPair(GL_RGBA16F_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_UNKNOWN, loadRGBAHalfFloatDataToRGBA )));
+ map.insert(D3D11ES2FormatPair(GL_RGB16F_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_UNKNOWN, loadRGBHalfFloatDataToRGBA )));
+ map.insert(D3D11ES2FormatPair(GL_ALPHA16F_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_UNKNOWN, loadAlphaHalfFloatDataToRGBA )));
+ map.insert(D3D11ES2FormatPair(GL_LUMINANCE16F_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_UNKNOWN, loadLuminanceHalfFloatDataToRGBA )));
+ map.insert(D3D11ES2FormatPair(GL_LUMINANCE_ALPHA16F_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_UNKNOWN, loadLuminanceAlphaHalfFloatDataToRGBA )));
+
+ map.insert(D3D11ES2FormatPair(GL_ALPHA8_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_A8_UNORM, DXGI_FORMAT_A8_UNORM, DXGI_FORMAT_A8_UNORM, DXGI_FORMAT_UNKNOWN, loadAlphaDataToNative )));
+ map.insert(D3D11ES2FormatPair(GL_LUMINANCE8_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN, loadLuminanceDataToBGRA )));
+ map.insert(D3D11ES2FormatPair(GL_LUMINANCE8_ALPHA8_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN, loadLuminanceAlphaDataToBGRA )));
+
+ map.insert(D3D11ES2FormatPair(GL_RGB8_OES, D3D11ES2FormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN, loadRGBUByteDataToRGBA )));
+ map.insert(D3D11ES2FormatPair(GL_RGB565, D3D11ES2FormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN, loadRGB565DataToRGBA )));
+ map.insert(D3D11ES2FormatPair(GL_RGBA8_OES, D3D11ES2FormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN, loadRGBAUByteDataToNative )));
+ map.insert(D3D11ES2FormatPair(GL_RGBA4, D3D11ES2FormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN, loadRGBA4444DataToRGBA )));
+ map.insert(D3D11ES2FormatPair(GL_RGB5_A1, D3D11ES2FormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN, loadRGBA5551DataToRGBA )));
+ map.insert(D3D11ES2FormatPair(GL_BGRA8_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_UNKNOWN, loadBGRADataToBGRA )));
+ map.insert(D3D11ES2FormatPair(GL_BGRA4_ANGLEX, D3D11ES2FormatInfo(DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_UNKNOWN, loadRGBA4444DataToRGBA )));
+ map.insert(D3D11ES2FormatPair(GL_BGR5_A1_ANGLEX, D3D11ES2FormatInfo(DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_UNKNOWN, loadRGBA5551DataToRGBA )));
+
+ // From GL_EXT_texture_rg
+ map.insert(D3D11ES2FormatPair(GL_R8_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_UNKNOWN, loadToNative<GLubyte, 1> )));
+ map.insert(D3D11ES2FormatPair(GL_R32F_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_UNKNOWN, loadToNative<GLfloat, 1> )));
+ map.insert(D3D11ES2FormatPair(GL_R16F_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_R16_FLOAT, DXGI_FORMAT_R16_FLOAT, DXGI_FORMAT_R16_FLOAT, DXGI_FORMAT_UNKNOWN, loadToNative<GLhalf, 1> )));
+ map.insert(D3D11ES2FormatPair(GL_RG8_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_R8G8_UNORM, DXGI_FORMAT_R8G8_UNORM, DXGI_FORMAT_R8G8_UNORM, DXGI_FORMAT_UNKNOWN, loadToNative<GLubyte, 2> )));
+ map.insert(D3D11ES2FormatPair(GL_RG32F_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_UNKNOWN, loadToNative<GLfloat, 2> )));
+ map.insert(D3D11ES2FormatPair(GL_RG16F_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_R16G16_FLOAT, DXGI_FORMAT_R16G16_FLOAT, DXGI_FORMAT_R16G16_FLOAT, DXGI_FORMAT_UNKNOWN, loadToNative<GLhalf, 2> )));
+
+ map.insert(D3D11ES2FormatPair(GL_COMPRESSED_RGB_S3TC_DXT1_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, loadCompressedBlockDataToNative<4, 4, 8>)));
+ map.insert(D3D11ES2FormatPair(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, loadCompressedBlockDataToNative<4, 4, 8>)));
+ map.insert(D3D11ES2FormatPair(GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, D3D11ES2FormatInfo(DXGI_FORMAT_BC2_UNORM, DXGI_FORMAT_BC2_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, loadCompressedBlockDataToNative<4, 4, 16>)));
+ map.insert(D3D11ES2FormatPair(GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, D3D11ES2FormatInfo(DXGI_FORMAT_BC3_UNORM, DXGI_FORMAT_BC3_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, loadCompressedBlockDataToNative<4, 4, 16>)));
+
+ return map;
+}
+
+static bool GetD3D11ES2FormatInfo(GLenum internalFormat, GLuint clientVersion, D3D11ES2FormatInfo *outFormatInfo)
+{
+ static const D3D11ES2FormatMap formatMap = BuildD3D11ES2FormatMap();
+ D3D11ES2FormatMap::const_iterator iter = formatMap.find(internalFormat);
+ if (iter != formatMap.end())
+ {
+ if (outFormatInfo)
+ {
+ *outFormatInfo = iter->second;
+ }
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+// A map to determine the pixel size and mipmap generation function of a given DXGI format
+struct DXGIFormatInfo
+{
+ GLuint mPixelBits;
+ GLuint mBlockWidth;
+ GLuint mBlockHeight;
+ GLenum mComponentType;
+
+ MipGenerationFunction mMipGenerationFunction;
+ ColorReadFunction mColorReadFunction;
+
+ DXGIFormatInfo()
+ : mPixelBits(0), mBlockWidth(0), mBlockHeight(0), mComponentType(GL_NONE), mMipGenerationFunction(NULL),
+ mColorReadFunction(NULL)
+ { }
+
+ DXGIFormatInfo(GLuint pixelBits, GLuint blockWidth, GLuint blockHeight, GLenum componentType,
+ MipGenerationFunction mipFunc, ColorReadFunction readFunc)
+ : mPixelBits(pixelBits), mBlockWidth(blockWidth), mBlockHeight(blockHeight), mComponentType(componentType),
+ mMipGenerationFunction(mipFunc), mColorReadFunction(readFunc)
+ { }
+};
+
+typedef std::map<DXGI_FORMAT, DXGIFormatInfo> DXGIFormatInfoMap;
+
+void AddDXGIFormat(DXGIFormatInfoMap *map, DXGI_FORMAT dxgiFormat, GLuint pixelBits, GLuint blockWidth, GLuint blockHeight,
+ GLenum componentType, MipGenerationFunction mipFunc, ColorReadFunction readFunc)
+{
+ map->insert(std::make_pair(dxgiFormat, DXGIFormatInfo(pixelBits, blockWidth, blockHeight, componentType, mipFunc, readFunc)));
+}
+
+static DXGIFormatInfoMap BuildDXGIFormatInfoMap()
+{
+ DXGIFormatInfoMap map;
+
+ // | DXGI format |S |W |H |Component Type | Mip generation function | Color read function
+ AddDXGIFormat(&map, DXGI_FORMAT_UNKNOWN, 0, 0, 0, GL_NONE, NULL, NULL);
+
+ AddDXGIFormat(&map, DXGI_FORMAT_A8_UNORM, 8, 1, 1, GL_UNSIGNED_NORMALIZED, GenerateMip<A8>, ReadColor<A8, GLfloat>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R8_UNORM, 8, 1, 1, GL_UNSIGNED_NORMALIZED, GenerateMip<R8>, ReadColor<R8, GLfloat>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R8G8_UNORM, 16, 1, 1, GL_UNSIGNED_NORMALIZED, GenerateMip<R8G8>, ReadColor<R8G8, GLfloat>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R8G8B8A8_UNORM, 32, 1, 1, GL_UNSIGNED_NORMALIZED, GenerateMip<R8G8B8A8>, ReadColor<R8G8B8A8, GLfloat>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, 32, 1, 1, GL_UNSIGNED_NORMALIZED, GenerateMip<R8G8B8A8>, ReadColor<R8G8B8A8, GLfloat>);
+ AddDXGIFormat(&map, DXGI_FORMAT_B8G8R8A8_UNORM, 32, 1, 1, GL_UNSIGNED_NORMALIZED, GenerateMip<B8G8R8A8>, ReadColor<B8G8R8A8, GLfloat>);
+
+ AddDXGIFormat(&map, DXGI_FORMAT_R8_SNORM, 8, 1, 1, GL_SIGNED_NORMALIZED, GenerateMip<R8S>, ReadColor<R8S, GLfloat>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R8G8_SNORM, 16, 1, 1, GL_SIGNED_NORMALIZED, GenerateMip<R8G8S>, ReadColor<R8G8S, GLfloat>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R8G8B8A8_SNORM, 32, 1, 1, GL_SIGNED_NORMALIZED, GenerateMip<R8G8B8A8S>, ReadColor<R8G8B8A8S, GLfloat>);
+
+ AddDXGIFormat(&map, DXGI_FORMAT_R8_UINT, 8, 1, 1, GL_UNSIGNED_INT, GenerateMip<R8>, ReadColor<R8, GLuint>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16_UINT, 16, 1, 1, GL_UNSIGNED_INT, GenerateMip<R16>, ReadColor<R16, GLuint>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32_UINT, 32, 1, 1, GL_UNSIGNED_INT, GenerateMip<R32>, ReadColor<R32, GLuint>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R8G8_UINT, 16, 1, 1, GL_UNSIGNED_INT, GenerateMip<R8G8>, ReadColor<R8G8, GLuint>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16G16_UINT, 32, 1, 1, GL_UNSIGNED_INT, GenerateMip<R16G16>, ReadColor<R16G16, GLuint>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32G32_UINT, 64, 1, 1, GL_UNSIGNED_INT, GenerateMip<R32G32>, ReadColor<R32G32, GLuint>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32G32B32_UINT, 96, 1, 1, GL_UNSIGNED_INT, GenerateMip<R32G32B32>, ReadColor<R32G32B32, GLuint>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R8G8B8A8_UINT, 32, 1, 1, GL_UNSIGNED_INT, GenerateMip<R8G8B8A8>, ReadColor<R8G8B8A8, GLuint>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16G16B16A16_UINT, 64, 1, 1, GL_UNSIGNED_INT, GenerateMip<R16G16B16A16>, ReadColor<R16G16B16A16, GLuint>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32G32B32A32_UINT, 128, 1, 1, GL_UNSIGNED_INT, GenerateMip<R32G32B32A32>, ReadColor<R32G32B32A32, GLuint>);
+
+ AddDXGIFormat(&map, DXGI_FORMAT_R8_SINT, 8, 1, 1, GL_INT, GenerateMip<R8S>, ReadColor<R8S, GLint>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16_SINT, 16, 1, 1, GL_INT, GenerateMip<R16S>, ReadColor<R16S, GLint>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32_SINT, 32, 1, 1, GL_INT, GenerateMip<R32S>, ReadColor<R32S, GLint>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R8G8_SINT, 16, 1, 1, GL_INT, GenerateMip<R8G8S>, ReadColor<R8G8S, GLint>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16G16_SINT, 32, 1, 1, GL_INT, GenerateMip<R16G16S>, ReadColor<R16G16S, GLint>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32G32_SINT, 64, 1, 1, GL_INT, GenerateMip<R32G32S>, ReadColor<R32G32S, GLint>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32G32B32_SINT, 96, 1, 1, GL_INT, GenerateMip<R32G32B32S>, ReadColor<R32G32B32S, GLint>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R8G8B8A8_SINT, 32, 1, 1, GL_INT, GenerateMip<R8G8B8A8S>, ReadColor<R8G8B8A8S, GLint>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16G16B16A16_SINT, 64, 1, 1, GL_INT, GenerateMip<R16G16B16A16S>, ReadColor<R16G16B16A16S, GLint>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32G32B32A32_SINT, 128, 1, 1, GL_INT, GenerateMip<R32G32B32A32S>, ReadColor<R32G32B32A32S, GLint>);
+
+ AddDXGIFormat(&map, DXGI_FORMAT_R10G10B10A2_UNORM, 32, 1, 1, GL_UNSIGNED_NORMALIZED, GenerateMip<R10G10B10A2>, ReadColor<R10G10B10A2, GLfloat>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R10G10B10A2_UINT, 32, 1, 1, GL_UNSIGNED_INT, GenerateMip<R10G10B10A2>, ReadColor<R10G10B10A2, GLuint>);
+
+ AddDXGIFormat(&map, DXGI_FORMAT_R16_FLOAT, 16, 1, 1, GL_FLOAT, GenerateMip<R16F>, ReadColor<R16F, GLfloat>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16G16_FLOAT, 32, 1, 1, GL_FLOAT, GenerateMip<R16G16F>, ReadColor<R16G16F, GLfloat>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16G16B16A16_FLOAT, 64, 1, 1, GL_FLOAT, GenerateMip<R16G16B16A16F>, ReadColor<R16G16B16A16F, GLfloat>);
+
+ AddDXGIFormat(&map, DXGI_FORMAT_R32_FLOAT, 32, 1, 1, GL_FLOAT, GenerateMip<R32F>, ReadColor<R32F, GLfloat>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32G32_FLOAT, 64, 1, 1, GL_FLOAT, GenerateMip<R32G32F>, ReadColor<R32G32F, GLfloat>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32G32B32_FLOAT, 96, 1, 1, GL_FLOAT, NULL, NULL);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32G32B32A32_FLOAT, 128, 1, 1, GL_FLOAT, GenerateMip<R32G32B32A32F>, ReadColor<R32G32B32A32F, GLfloat>);
+
+ AddDXGIFormat(&map, DXGI_FORMAT_R9G9B9E5_SHAREDEXP, 32, 1, 1, GL_FLOAT, GenerateMip<R9G9B9E5>, ReadColor<R9G9B9E5, GLfloat>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R11G11B10_FLOAT, 32, 1, 1, GL_FLOAT, GenerateMip<R11G11B10F>, ReadColor<R11G11B10F, GLfloat>);
+
+ AddDXGIFormat(&map, DXGI_FORMAT_R16_TYPELESS, 16, 1, 1, GL_NONE, NULL, NULL);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16_UNORM, 16, 1, 1, GL_UNSIGNED_NORMALIZED, NULL, NULL);
+ AddDXGIFormat(&map, DXGI_FORMAT_D16_UNORM, 16, 1, 1, GL_UNSIGNED_NORMALIZED, NULL, NULL);
+ AddDXGIFormat(&map, DXGI_FORMAT_R24G8_TYPELESS, 32, 1, 1, GL_NONE, NULL, NULL);
+ AddDXGIFormat(&map, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, 32, 1, 1, GL_NONE, NULL, NULL);
+ AddDXGIFormat(&map, DXGI_FORMAT_D24_UNORM_S8_UINT, 32, 1, 1, GL_UNSIGNED_INT, NULL, NULL);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32G8X24_TYPELESS, 64, 1, 1, GL_NONE, NULL, NULL);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS, 64, 1, 1, GL_NONE, NULL, NULL);
+ AddDXGIFormat(&map, DXGI_FORMAT_D32_FLOAT_S8X24_UINT, 64, 1, 1, GL_UNSIGNED_INT, NULL, NULL);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32_TYPELESS, 32, 1, 1, GL_NONE, NULL, NULL);
+ AddDXGIFormat(&map, DXGI_FORMAT_D32_FLOAT, 32, 1, 1, GL_FLOAT, NULL, NULL);
+
+ AddDXGIFormat(&map, DXGI_FORMAT_BC1_UNORM, 64, 4, 4, GL_UNSIGNED_NORMALIZED, NULL, NULL);
+ AddDXGIFormat(&map, DXGI_FORMAT_BC2_UNORM, 128, 4, 4, GL_UNSIGNED_NORMALIZED, NULL, NULL);
+ AddDXGIFormat(&map, DXGI_FORMAT_BC3_UNORM, 128, 4, 4, GL_UNSIGNED_NORMALIZED, NULL, NULL);
+
+ // Useful formats for vertex buffers
+ AddDXGIFormat(&map, DXGI_FORMAT_R16_UNORM, 16, 1, 1, GL_UNSIGNED_NORMALIZED, NULL, NULL);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16_SNORM, 16, 1, 1, GL_SIGNED_NORMALIZED, NULL, NULL);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16G16_UNORM, 32, 1, 1, GL_UNSIGNED_NORMALIZED, NULL, NULL);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16G16_SNORM, 32, 1, 1, GL_SIGNED_NORMALIZED, NULL, NULL);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16G16B16A16_UNORM, 64, 1, 1, GL_UNSIGNED_NORMALIZED, NULL, NULL);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16G16B16A16_SNORM, 64, 1, 1, GL_SIGNED_NORMALIZED, NULL, NULL);
+
+ return map;
+}
+
+typedef std::map<DXGI_FORMAT, GLenum> DXGIToESFormatMap;
+
+inline void AddDXGIToESEntry(DXGIToESFormatMap *map, DXGI_FORMAT key, GLenum value)
+{
+ map->insert(std::make_pair(key, value));
+}
+
+static DXGIToESFormatMap BuildCommonDXGIToESFormatMap()
+{
+ DXGIToESFormatMap map;
+
+ AddDXGIToESEntry(&map, DXGI_FORMAT_UNKNOWN, GL_NONE);
+
+ AddDXGIToESEntry(&map, DXGI_FORMAT_A8_UNORM, GL_ALPHA8_EXT);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R8_UNORM, GL_R8);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R8G8_UNORM, GL_RG8);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R8G8B8A8_UNORM, GL_RGBA8);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, GL_SRGB8_ALPHA8);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_B8G8R8A8_UNORM, GL_BGRA8_EXT);
+
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R8_SNORM, GL_R8_SNORM);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R8G8_SNORM, GL_RG8_SNORM);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R8G8B8A8_SNORM, GL_RGBA8_SNORM);
+
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R8_UINT, GL_R8UI);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R16_UINT, GL_R16UI);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R32_UINT, GL_R32UI);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R8G8_UINT, GL_RG8UI);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R16G16_UINT, GL_RG16UI);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R32G32_UINT, GL_RG32UI);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R32G32B32_UINT, GL_RGB32UI);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R8G8B8A8_UINT, GL_RGBA8UI);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R16G16B16A16_UINT, GL_RGBA16UI);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R32G32B32A32_UINT, GL_RGBA32UI);
+
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R8_SINT, GL_R8I);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R16_SINT, GL_R16I);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R32_SINT, GL_R32I);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R8G8_SINT, GL_RG8I);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R16G16_SINT, GL_RG16I);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R32G32_SINT, GL_RG32I);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R32G32B32_SINT, GL_RGB32I);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R8G8B8A8_SINT, GL_RGBA8I);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R16G16B16A16_SINT, GL_RGBA16I);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R32G32B32A32_SINT, GL_RGBA32I);
+
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R10G10B10A2_UNORM, GL_RGB10_A2);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R10G10B10A2_UINT, GL_RGB10_A2UI);
+
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R16_FLOAT, GL_R16F);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R16G16_FLOAT, GL_RG16F);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R16G16B16A16_FLOAT, GL_RGBA16F);
+
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R32_FLOAT, GL_R32F);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R32G32_FLOAT, GL_RG32F);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R32G32B32_FLOAT, GL_RGB32F);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R32G32B32A32_FLOAT, GL_RGBA32F);
+
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R9G9B9E5_SHAREDEXP, GL_RGB9_E5);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R11G11B10_FLOAT, GL_R11F_G11F_B10F);
+
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R16_TYPELESS, GL_DEPTH_COMPONENT16);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R16_UNORM, GL_DEPTH_COMPONENT16);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_D16_UNORM, GL_DEPTH_COMPONENT16);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R24G8_TYPELESS, GL_DEPTH24_STENCIL8_OES);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, GL_DEPTH24_STENCIL8_OES);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_D24_UNORM_S8_UINT, GL_DEPTH24_STENCIL8_OES);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R32G8X24_TYPELESS, GL_DEPTH32F_STENCIL8);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS, GL_DEPTH32F_STENCIL8);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_D32_FLOAT_S8X24_UINT, GL_DEPTH32F_STENCIL8);
+
+ AddDXGIToESEntry(&map, DXGI_FORMAT_BC1_UNORM, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_BC2_UNORM, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_BC3_UNORM, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE);
+
+ return map;
+}
+
+static DXGIToESFormatMap BuildDXGIToES2FormatMap()
+{
+ DXGIToESFormatMap map = BuildCommonDXGIToESFormatMap();
+
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R32_TYPELESS, GL_DEPTH_COMPONENT32_OES);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_D32_FLOAT, GL_DEPTH_COMPONENT32_OES);
+
+ return map;
+}
+
+static DXGIToESFormatMap BuildDXGIToES3FormatMap()
+{
+ DXGIToESFormatMap map = BuildCommonDXGIToESFormatMap();
+
+ AddDXGIToESEntry(&map, DXGI_FORMAT_R32_TYPELESS, GL_DEPTH_COMPONENT32F);
+ AddDXGIToESEntry(&map, DXGI_FORMAT_D32_FLOAT, GL_DEPTH_COMPONENT32F);
+
+ return map;
+}
+
+static const DXGIFormatInfoMap &GetDXGIFormatInfoMap()
+{
+ static const DXGIFormatInfoMap infoMap = BuildDXGIFormatInfoMap();
+ return infoMap;
+}
+
+static bool GetDXGIFormatInfo(DXGI_FORMAT format, DXGIFormatInfo *outFormatInfo)
+{
+ const DXGIFormatInfoMap &infoMap = GetDXGIFormatInfoMap();
+ DXGIFormatInfoMap::const_iterator iter = infoMap.find(format);
+ if (iter != infoMap.end())
+ {
+ if (outFormatInfo)
+ {
+ *outFormatInfo = iter->second;
+ }
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+static d3d11::DXGIFormatSet BuildAllDXGIFormatSet()
+{
+ d3d11::DXGIFormatSet set;
+
+ const DXGIFormatInfoMap &infoMap = GetDXGIFormatInfoMap();
+ for (DXGIFormatInfoMap::const_iterator i = infoMap.begin(); i != infoMap.end(); ++i)
+ {
+ set.insert(i->first);
+ }
+
+ return set;
+}
+
+struct D3D11FastCopyFormat
+{
+ DXGI_FORMAT mSourceFormat;
+ GLenum mDestFormat;
+ GLenum mDestType;
+
+ D3D11FastCopyFormat(DXGI_FORMAT sourceFormat, GLenum destFormat, GLenum destType)
+ : mSourceFormat(sourceFormat), mDestFormat(destFormat), mDestType(destType)
+ { }
+
+ bool operator<(const D3D11FastCopyFormat& other) const
+ {
+ return memcmp(this, &other, sizeof(D3D11FastCopyFormat)) < 0;
+ }
+};
+
+typedef std::map<D3D11FastCopyFormat, ColorCopyFunction> D3D11FastCopyMap;
+typedef std::pair<D3D11FastCopyFormat, ColorCopyFunction> D3D11FastCopyPair;
+
+static D3D11FastCopyMap BuildFastCopyMap()
+{
+ D3D11FastCopyMap map;
+
+ map.insert(D3D11FastCopyPair(D3D11FastCopyFormat(DXGI_FORMAT_B8G8R8A8_UNORM, GL_RGBA, GL_UNSIGNED_BYTE), CopyBGRAUByteToRGBAUByte));
+
+ return map;
+}
+
+struct DXGIDepthStencilInfo
+{
+ unsigned int mDepthBits;
+ unsigned int mDepthOffset;
+ unsigned int mStencilBits;
+ unsigned int mStencilOffset;
+
+ DXGIDepthStencilInfo()
+ : mDepthBits(0), mDepthOffset(0), mStencilBits(0), mStencilOffset(0)
+ { }
+
+ DXGIDepthStencilInfo(unsigned int depthBits, unsigned int depthOffset, unsigned int stencilBits, unsigned int stencilOffset)
+ : mDepthBits(depthBits), mDepthOffset(depthOffset), mStencilBits(stencilBits), mStencilOffset(stencilOffset)
+ { }
+};
+
+typedef std::map<DXGI_FORMAT, DXGIDepthStencilInfo> DepthStencilInfoMap;
+typedef std::pair<DXGI_FORMAT, DXGIDepthStencilInfo> DepthStencilInfoPair;
+
+static DepthStencilInfoMap BuildDepthStencilInfoMap()
+{
+ DepthStencilInfoMap map;
+
+ map.insert(DepthStencilInfoPair(DXGI_FORMAT_R16_TYPELESS, DXGIDepthStencilInfo(16, 0, 0, 0)));
+ map.insert(DepthStencilInfoPair(DXGI_FORMAT_R16_UNORM, DXGIDepthStencilInfo(16, 0, 0, 0)));
+ map.insert(DepthStencilInfoPair(DXGI_FORMAT_D16_UNORM, DXGIDepthStencilInfo(16, 0, 0, 0)));
+
+ map.insert(DepthStencilInfoPair(DXGI_FORMAT_R24G8_TYPELESS, DXGIDepthStencilInfo(24, 0, 8, 24)));
+ map.insert(DepthStencilInfoPair(DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGIDepthStencilInfo(24, 0, 8, 24)));
+ map.insert(DepthStencilInfoPair(DXGI_FORMAT_D24_UNORM_S8_UINT, DXGIDepthStencilInfo(24, 0, 8, 24)));
+
+ map.insert(DepthStencilInfoPair(DXGI_FORMAT_R32_TYPELESS, DXGIDepthStencilInfo(32, 0, 0, 0)));
+ map.insert(DepthStencilInfoPair(DXGI_FORMAT_R32_FLOAT, DXGIDepthStencilInfo(32, 0, 0, 0)));
+ map.insert(DepthStencilInfoPair(DXGI_FORMAT_D32_FLOAT, DXGIDepthStencilInfo(32, 0, 0, 0)));
+
+ map.insert(DepthStencilInfoPair(DXGI_FORMAT_R32G8X24_TYPELESS, DXGIDepthStencilInfo(32, 0, 8, 32)));
+ map.insert(DepthStencilInfoPair(DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS, DXGIDepthStencilInfo(32, 0, 8, 32)));
+ map.insert(DepthStencilInfoPair(DXGI_FORMAT_D32_FLOAT_S8X24_UINT, DXGIDepthStencilInfo(32, 0, 8, 32)));
+
+ return map;
+}
+
+static const DepthStencilInfoMap &GetDepthStencilInfoMap()
+{
+ static const DepthStencilInfoMap infoMap = BuildDepthStencilInfoMap();
+ return infoMap;
+}
+
+bool GetDepthStencilInfo(DXGI_FORMAT format, DXGIDepthStencilInfo *outDepthStencilInfo)
+{
+ const DepthStencilInfoMap& infoMap = GetDepthStencilInfoMap();
+ DepthStencilInfoMap::const_iterator iter = infoMap.find(format);
+ if (iter != infoMap.end())
+ {
+ if (outDepthStencilInfo)
+ {
+ *outDepthStencilInfo = iter->second;
+ }
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+struct SwizzleSizeType
+{
+ unsigned int mMaxComponentSize;
+ GLenum mComponentType;
+
+ SwizzleSizeType()
+ : mMaxComponentSize(0), mComponentType(GL_NONE)
+ { }
+
+ SwizzleSizeType(unsigned int maxComponentSize, GLenum componentType)
+ : mMaxComponentSize(maxComponentSize), mComponentType(componentType)
+ { }
+
+ bool operator<(const SwizzleSizeType& other) const
+ {
+ return (mMaxComponentSize != other.mMaxComponentSize) ? (mMaxComponentSize < other.mMaxComponentSize)
+ : (mComponentType < other.mComponentType);
+ }
+};
+
+struct SwizzleFormatInfo
+{
+ DXGI_FORMAT mTexFormat;
+ DXGI_FORMAT mSRVFormat;
+ DXGI_FORMAT mRTVFormat;
+
+ SwizzleFormatInfo()
+ : mTexFormat(DXGI_FORMAT_UNKNOWN), mSRVFormat(DXGI_FORMAT_UNKNOWN), mRTVFormat(DXGI_FORMAT_UNKNOWN)
+ { }
+
+ SwizzleFormatInfo(DXGI_FORMAT texFormat, DXGI_FORMAT srvFormat, DXGI_FORMAT rtvFormat)
+ : mTexFormat(texFormat), mSRVFormat(srvFormat), mRTVFormat(rtvFormat)
+ { }
+};
+
+typedef std::map<SwizzleSizeType, SwizzleFormatInfo> SwizzleInfoMap;
+typedef std::pair<SwizzleSizeType, SwizzleFormatInfo> SwizzleInfoPair;
+
+static SwizzleInfoMap BuildSwizzleInfoMap()
+{
+ SwizzleInfoMap map;
+
+ map.insert(SwizzleInfoPair(SwizzleSizeType( 8, GL_UNSIGNED_NORMALIZED), SwizzleFormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM )));
+ map.insert(SwizzleInfoPair(SwizzleSizeType(16, GL_UNSIGNED_NORMALIZED), SwizzleFormatInfo(DXGI_FORMAT_R16G16B16A16_UNORM, DXGI_FORMAT_R16G16B16A16_UNORM, DXGI_FORMAT_R16G16B16A16_UNORM)));
+ map.insert(SwizzleInfoPair(SwizzleSizeType(24, GL_UNSIGNED_NORMALIZED), SwizzleFormatInfo(DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT)));
+ map.insert(SwizzleInfoPair(SwizzleSizeType(32, GL_UNSIGNED_NORMALIZED), SwizzleFormatInfo(DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT)));
+
+ map.insert(SwizzleInfoPair(SwizzleSizeType( 8, GL_SIGNED_NORMALIZED ), SwizzleFormatInfo(DXGI_FORMAT_R8G8B8A8_SNORM, DXGI_FORMAT_R8G8B8A8_SNORM, DXGI_FORMAT_R8G8B8A8_SNORM )));
+
+ map.insert(SwizzleInfoPair(SwizzleSizeType(16, GL_FLOAT ), SwizzleFormatInfo(DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT)));
+ map.insert(SwizzleInfoPair(SwizzleSizeType(32, GL_FLOAT ), SwizzleFormatInfo(DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT)));
+
+ map.insert(SwizzleInfoPair(SwizzleSizeType( 8, GL_UNSIGNED_INT ), SwizzleFormatInfo(DXGI_FORMAT_R8G8B8A8_UINT, DXGI_FORMAT_R8G8B8A8_UINT, DXGI_FORMAT_R8G8B8A8_UINT )));
+ map.insert(SwizzleInfoPair(SwizzleSizeType(16, GL_UNSIGNED_INT ), SwizzleFormatInfo(DXGI_FORMAT_R16G16B16A16_UINT, DXGI_FORMAT_R16G16B16A16_UINT, DXGI_FORMAT_R16G16B16A16_UINT )));
+ map.insert(SwizzleInfoPair(SwizzleSizeType(32, GL_UNSIGNED_INT ), SwizzleFormatInfo(DXGI_FORMAT_R32G32B32A32_UINT, DXGI_FORMAT_R32G32B32A32_UINT, DXGI_FORMAT_R32G32B32A32_UINT )));
+
+ map.insert(SwizzleInfoPair(SwizzleSizeType( 8, GL_INT ), SwizzleFormatInfo(DXGI_FORMAT_R8G8B8A8_SINT, DXGI_FORMAT_R8G8B8A8_SINT, DXGI_FORMAT_R8G8B8A8_SINT )));
+ map.insert(SwizzleInfoPair(SwizzleSizeType(16, GL_INT ), SwizzleFormatInfo(DXGI_FORMAT_R16G16B16A16_SINT, DXGI_FORMAT_R16G16B16A16_SINT, DXGI_FORMAT_R16G16B16A16_SINT )));
+ map.insert(SwizzleInfoPair(SwizzleSizeType(32, GL_INT ), SwizzleFormatInfo(DXGI_FORMAT_R32G32B32A32_SINT, DXGI_FORMAT_R32G32B32A32_SINT, DXGI_FORMAT_R32G32B32A32_SINT )));
+
+ return map;
+}
+typedef std::pair<GLint, InitializeTextureDataFunction> InternalFormatInitializerPair;
+typedef std::map<GLint, InitializeTextureDataFunction> InternalFormatInitializerMap;
+
+static InternalFormatInitializerMap BuildInternalFormatInitializerMap()
+{
+ InternalFormatInitializerMap map;
+
+ map.insert(InternalFormatInitializerPair(GL_RGB8, initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF> ));
+ map.insert(InternalFormatInitializerPair(GL_RGB565, initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF> ));
+ map.insert(InternalFormatInitializerPair(GL_SRGB8, initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF> ));
+ map.insert(InternalFormatInitializerPair(GL_RGB16F, initialize4ComponentData<GLhalf, 0x0000, 0x0000, 0x0000, gl::Float16One>));
+ map.insert(InternalFormatInitializerPair(GL_RGB32F, initialize4ComponentData<GLfloat, 0x00000000, 0x00000000, 0x00000000, gl::Float32One>));
+ map.insert(InternalFormatInitializerPair(GL_RGB8UI, initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0x01> ));
+ map.insert(InternalFormatInitializerPair(GL_RGB8I, initialize4ComponentData<GLbyte, 0x00, 0x00, 0x00, 0x01> ));
+ map.insert(InternalFormatInitializerPair(GL_RGB16UI, initialize4ComponentData<GLushort, 0x0000, 0x0000, 0x0000, 0x0001> ));
+ map.insert(InternalFormatInitializerPair(GL_RGB16I, initialize4ComponentData<GLshort, 0x0000, 0x0000, 0x0000, 0x0001> ));
+ map.insert(InternalFormatInitializerPair(GL_RGB32UI, initialize4ComponentData<GLuint, 0x00000000, 0x00000000, 0x00000000, 0x00000001> ));
+ map.insert(InternalFormatInitializerPair(GL_RGB32I, initialize4ComponentData<GLint, 0x00000000, 0x00000000, 0x00000000, 0x00000001> ));
+
+ return map;
+}
+
+static const SwizzleInfoMap &GetSwizzleInfoMap()
+{
+ static const SwizzleInfoMap map = BuildSwizzleInfoMap();
+ return map;
+}
+
+static const SwizzleFormatInfo GetSwizzleFormatInfo(GLint internalFormat, GLuint clientVersion)
+{
+ // Get the maximum sized component
+ unsigned int maxBits = 1;
+
+ if (gl::IsFormatCompressed(internalFormat, clientVersion))
+ {
+ unsigned int compressedBitsPerBlock = gl::GetPixelBytes(internalFormat, clientVersion) * 8;
+ unsigned int blockSize = gl::GetCompressedBlockWidth(internalFormat, clientVersion) *
+ gl::GetCompressedBlockHeight(internalFormat, clientVersion);
+ maxBits = std::max(compressedBitsPerBlock / blockSize, maxBits);
+ }
+ else
+ {
+ maxBits = std::max(maxBits, gl::GetAlphaBits( internalFormat, clientVersion));
+ maxBits = std::max(maxBits, gl::GetRedBits( internalFormat, clientVersion));
+ maxBits = std::max(maxBits, gl::GetGreenBits( internalFormat, clientVersion));
+ maxBits = std::max(maxBits, gl::GetBlueBits( internalFormat, clientVersion));
+ maxBits = std::max(maxBits, gl::GetLuminanceBits(internalFormat, clientVersion));
+ maxBits = std::max(maxBits, gl::GetDepthBits( internalFormat, clientVersion));
+ }
+
+ maxBits = roundUp(maxBits, 8U);
+
+ GLenum componentType = gl::GetComponentType(internalFormat, clientVersion);
+
+ const SwizzleInfoMap &map = GetSwizzleInfoMap();
+ SwizzleInfoMap::const_iterator iter = map.find(SwizzleSizeType(maxBits, componentType));
+
+ if (iter != map.end())
+ {
+ return iter->second;
+ }
+ else
+ {
+ UNREACHABLE();
+ static const SwizzleFormatInfo defaultFormatInfo;
+ return defaultFormatInfo;
+ }
+}
+
+static const InternalFormatInitializerMap &GetInternalFormatInitializerMap()
+{
+ static const InternalFormatInitializerMap map = BuildInternalFormatInitializerMap();
+ return map;
+}
+
+namespace d3d11
+{
+
+MipGenerationFunction GetMipGenerationFunction(DXGI_FORMAT format)
+{
+ DXGIFormatInfo formatInfo;
+ if (GetDXGIFormatInfo(format, &formatInfo))
+ {
+ return formatInfo.mMipGenerationFunction;
+ }
+ else
+ {
+ UNREACHABLE();
+ return NULL;
+ }
+}
+
+LoadImageFunction GetImageLoadFunction(GLenum internalFormat, GLenum type, GLuint clientVersion)
+{
+ if (clientVersion == 2)
+ {
+ D3D11ES2FormatInfo d3d11FormatInfo;
+ if (GetD3D11ES2FormatInfo(internalFormat, clientVersion, &d3d11FormatInfo))
+ {
+ return d3d11FormatInfo.mLoadImageFunction;
+ }
+ else
+ {
+ UNREACHABLE();
+ return NULL;
+ }
+ }
+ else if (clientVersion == 3)
+ {
+ static const D3D11LoadFunctionMap loadImageMap = buildD3D11LoadFunctionMap();
+ D3D11LoadFunctionMap::const_iterator iter = loadImageMap.find(InternalFormatTypePair(internalFormat, type));
+ if (iter != loadImageMap.end())
+ {
+ return iter->second;
+ }
+ else
+ {
+ UNREACHABLE();
+ return NULL;
+ }
+ }
+ else
+ {
+ UNREACHABLE();
+ return NULL;
+ }
+}
+
+GLuint GetFormatPixelBytes(DXGI_FORMAT format)
+{
+ DXGIFormatInfo dxgiFormatInfo;
+ if (GetDXGIFormatInfo(format, &dxgiFormatInfo))
+ {
+ return dxgiFormatInfo.mPixelBits / 8;
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+GLuint GetBlockWidth(DXGI_FORMAT format)
+{
+ DXGIFormatInfo dxgiFormatInfo;
+ if (GetDXGIFormatInfo(format, &dxgiFormatInfo))
+ {
+ return dxgiFormatInfo.mBlockWidth;
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+GLuint GetBlockHeight(DXGI_FORMAT format)
+{
+ DXGIFormatInfo dxgiFormatInfo;
+ if (GetDXGIFormatInfo(format, &dxgiFormatInfo))
+ {
+ return dxgiFormatInfo.mBlockHeight;
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+GLenum GetComponentType(DXGI_FORMAT format)
+{
+ DXGIFormatInfo dxgiFormatInfo;
+ if (GetDXGIFormatInfo(format, &dxgiFormatInfo))
+ {
+ return dxgiFormatInfo.mComponentType;
+ }
+ else
+ {
+ UNREACHABLE();
+ return GL_NONE;
+ }
+}
+
+GLuint GetDepthBits(DXGI_FORMAT format)
+{
+ DXGIDepthStencilInfo dxgiDSInfo;
+ if (GetDepthStencilInfo(format, &dxgiDSInfo))
+ {
+ return dxgiDSInfo.mDepthBits;
+ }
+ else
+ {
+ // Since the depth stencil info map does not contain all used DXGI formats,
+ // we should not assert that the format exists
+ return 0;
+ }
+}
+
+GLuint GetDepthOffset(DXGI_FORMAT format)
+{
+ DXGIDepthStencilInfo dxgiDSInfo;
+ if (GetDepthStencilInfo(format, &dxgiDSInfo))
+ {
+ return dxgiDSInfo.mDepthOffset;
+ }
+ else
+ {
+ // Since the depth stencil info map does not contain all used DXGI formats,
+ // we should not assert that the format exists
+ return 0;
+ }
+}
+
+GLuint GetStencilBits(DXGI_FORMAT format)
+{
+ DXGIDepthStencilInfo dxgiDSInfo;
+ if (GetDepthStencilInfo(format, &dxgiDSInfo))
+ {
+ return dxgiDSInfo.mStencilBits;
+ }
+ else
+ {
+ // Since the depth stencil info map does not contain all used DXGI formats,
+ // we should not assert that the format exists
+ return 0;
+ }
+}
+
+GLuint GetStencilOffset(DXGI_FORMAT format)
+{
+ DXGIDepthStencilInfo dxgiDSInfo;
+ if (GetDepthStencilInfo(format, &dxgiDSInfo))
+ {
+ return dxgiDSInfo.mStencilOffset;
+ }
+ else
+ {
+ // Since the depth stencil info map does not contain all used DXGI formats,
+ // we should not assert that the format exists
+ return 0;
+ }
+}
+
+void MakeValidSize(bool isImage, DXGI_FORMAT format, GLsizei *requestWidth, GLsizei *requestHeight, int *levelOffset)
+{
+ DXGIFormatInfo dxgiFormatInfo;
+ if (GetDXGIFormatInfo(format, &dxgiFormatInfo))
+ {
+ int upsampleCount = 0;
+
+ GLsizei blockWidth = dxgiFormatInfo.mBlockWidth;
+ GLsizei blockHeight = dxgiFormatInfo.mBlockHeight;
+
+ // Don't expand the size of full textures that are at least (blockWidth x blockHeight) already.
+ if (isImage || *requestWidth < blockWidth || *requestHeight < blockHeight)
+ {
+ while (*requestWidth % blockWidth != 0 || *requestHeight % blockHeight != 0)
+ {
+ *requestWidth <<= 1;
+ *requestHeight <<= 1;
+ upsampleCount++;
+ }
+ }
+ *levelOffset = upsampleCount;
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+}
+
+const DXGIFormatSet &GetAllUsedDXGIFormats()
+{
+ static DXGIFormatSet formatSet = BuildAllDXGIFormatSet();
+ return formatSet;
+}
+
+ColorReadFunction GetColorReadFunction(DXGI_FORMAT format)
+{
+ DXGIFormatInfo dxgiFormatInfo;
+ if (GetDXGIFormatInfo(format, &dxgiFormatInfo))
+ {
+ return dxgiFormatInfo.mColorReadFunction;
+ }
+ else
+ {
+ UNREACHABLE();
+ return NULL;
+ }
+}
+
+ColorCopyFunction GetFastCopyFunction(DXGI_FORMAT sourceFormat, GLenum destFormat, GLenum destType)
+{
+ static const D3D11FastCopyMap fastCopyMap = BuildFastCopyMap();
+ D3D11FastCopyMap::const_iterator iter = fastCopyMap.find(D3D11FastCopyFormat(sourceFormat, destFormat, destType));
+ return (iter != fastCopyMap.end()) ? iter->second : NULL;
+}
+
+}
+
+namespace gl_d3d11
+{
+
+DXGI_FORMAT GetTexFormat(GLenum internalFormat, GLuint clientVersion)
+{
+ if (clientVersion == 2)
+ {
+ D3D11ES2FormatInfo d3d11FormatInfo;
+ if (GetD3D11ES2FormatInfo(internalFormat, clientVersion, &d3d11FormatInfo))
+ {
+ return d3d11FormatInfo.mTexFormat;
+ }
+ else
+ {
+ UNREACHABLE();
+ return DXGI_FORMAT_UNKNOWN;
+ }
+ }
+ else if (clientVersion == 3)
+ {
+ D3D11ES3FormatInfo d3d11FormatInfo;
+ if (GetD3D11ES3FormatInfo(internalFormat, clientVersion, &d3d11FormatInfo))
+ {
+ return d3d11FormatInfo.mTexFormat;
+ }
+ else
+ {
+ UNREACHABLE();
+ return DXGI_FORMAT_UNKNOWN;
+ }
+ }
+ else
+ {
+ UNREACHABLE();
+ return DXGI_FORMAT_UNKNOWN;
+ }
+}
+
+DXGI_FORMAT GetSRVFormat(GLenum internalFormat, GLuint clientVersion)
+{
+ if (clientVersion == 2)
+ {
+ D3D11ES2FormatInfo d3d11FormatInfo;
+ if (GetD3D11ES2FormatInfo(internalFormat, clientVersion, &d3d11FormatInfo))
+ {
+ return d3d11FormatInfo.mSRVFormat;
+ }
+ else
+ {
+ UNREACHABLE();
+ return DXGI_FORMAT_UNKNOWN;
+ }
+ }
+ else if (clientVersion == 3)
+ {
+ D3D11ES3FormatInfo d3d11FormatInfo;
+ if (GetD3D11ES3FormatInfo(internalFormat, clientVersion, &d3d11FormatInfo))
+ {
+ return d3d11FormatInfo.mSRVFormat;
+ }
+ else
+ {
+ UNREACHABLE();
+ return DXGI_FORMAT_UNKNOWN;
+ }
+ }
+ else
+ {
+ UNREACHABLE();
+ return DXGI_FORMAT_UNKNOWN;
+ }
+}
+
+DXGI_FORMAT GetRTVFormat(GLenum internalFormat, GLuint clientVersion)
+{
+ if (clientVersion == 2)
+ {
+ D3D11ES2FormatInfo d3d11FormatInfo;
+ if (GetD3D11ES2FormatInfo(internalFormat, clientVersion, &d3d11FormatInfo))
+ {
+ return d3d11FormatInfo.mRTVFormat;
+ }
+ else
+ {
+ UNREACHABLE();
+ return DXGI_FORMAT_UNKNOWN;
+ }
+ }
+ else if (clientVersion == 3)
+ {
+ D3D11ES3FormatInfo d3d11FormatInfo;
+ if (GetD3D11ES3FormatInfo(internalFormat, clientVersion, &d3d11FormatInfo))
+ {
+ return d3d11FormatInfo.mRTVFormat;
+ }
+ else
+ {
+ UNREACHABLE();
+ return DXGI_FORMAT_UNKNOWN;
+ }
+ }
+ else
+ {
+ UNREACHABLE();
+ return DXGI_FORMAT_UNKNOWN;
+ }
+}
+
+DXGI_FORMAT GetDSVFormat(GLenum internalFormat, GLuint clientVersion)
+{
+ if (clientVersion == 2)
+ {
+ D3D11ES2FormatInfo d3d11FormatInfo;
+ if (GetD3D11ES2FormatInfo(internalFormat, clientVersion, &d3d11FormatInfo))
+ {
+ return d3d11FormatInfo.mDSVFormat;
+ }
+ else
+ {
+ return DXGI_FORMAT_UNKNOWN;
+ }
+ }
+ else if (clientVersion == 3)
+ {
+ D3D11ES3FormatInfo d3d11FormatInfo;
+ if (GetD3D11ES3FormatInfo(internalFormat, clientVersion, &d3d11FormatInfo))
+ {
+ return d3d11FormatInfo.mDSVFormat;
+ }
+ else
+ {
+ return DXGI_FORMAT_UNKNOWN;
+ }
+ }
+ else
+ {
+ UNREACHABLE();
+ return DXGI_FORMAT_UNKNOWN;
+ }
+}
+
+// Given a GL internal format, this function returns the DSV format if it is depth- or stencil-renderable,
+// the RTV format if it is color-renderable, and the (nonrenderable) texture format otherwise.
+DXGI_FORMAT GetRenderableFormat(GLenum internalFormat, GLuint clientVersion)
+{
+ DXGI_FORMAT targetFormat = GetDSVFormat(internalFormat, clientVersion);
+ if (targetFormat == DXGI_FORMAT_UNKNOWN)
+ targetFormat = GetRTVFormat(internalFormat, clientVersion);
+ if (targetFormat == DXGI_FORMAT_UNKNOWN)
+ targetFormat = GetTexFormat(internalFormat, clientVersion);
+
+ return targetFormat;
+}
+
+DXGI_FORMAT GetSwizzleTexFormat(GLint internalFormat, const Renderer *renderer)
+{
+ GLuint clientVersion = renderer->getCurrentClientVersion();
+ if (gl::GetComponentCount(internalFormat, clientVersion) != 4 || !gl::IsColorRenderingSupported(internalFormat, renderer))
+ {
+ const SwizzleFormatInfo &swizzleInfo = GetSwizzleFormatInfo(internalFormat, clientVersion);
+ return swizzleInfo.mTexFormat;
+ }
+ else
+ {
+ return GetTexFormat(internalFormat, clientVersion);
+ }
+}
+
+DXGI_FORMAT GetSwizzleSRVFormat(GLint internalFormat, const Renderer *renderer)
+{
+ GLuint clientVersion = renderer->getCurrentClientVersion();
+ if (gl::GetComponentCount(internalFormat, clientVersion) != 4 || !gl::IsColorRenderingSupported(internalFormat, renderer))
+ {
+ const SwizzleFormatInfo &swizzleInfo = GetSwizzleFormatInfo(internalFormat, clientVersion);
+ return swizzleInfo.mSRVFormat;
+ }
+ else
+ {
+ return GetTexFormat(internalFormat, clientVersion);
+ }
+}
+
+DXGI_FORMAT GetSwizzleRTVFormat(GLint internalFormat, const Renderer *renderer)
+{
+ GLuint clientVersion = renderer->getCurrentClientVersion();
+ if (gl::GetComponentCount(internalFormat, clientVersion) != 4 || !gl::IsColorRenderingSupported(internalFormat, renderer))
+ {
+ const SwizzleFormatInfo &swizzleInfo = GetSwizzleFormatInfo(internalFormat, clientVersion);
+ return swizzleInfo.mRTVFormat;
+ }
+ else
+ {
+ return GetTexFormat(internalFormat, clientVersion);
+ }
+}
+
+bool RequiresTextureDataInitialization(GLint internalFormat)
+{
+ const InternalFormatInitializerMap &map = GetInternalFormatInitializerMap();
+ return map.find(internalFormat) != map.end();
+}
+
+InitializeTextureDataFunction GetTextureDataInitializationFunction(GLint internalFormat)
+{
+ const InternalFormatInitializerMap &map = GetInternalFormatInitializerMap();
+ InternalFormatInitializerMap::const_iterator iter = map.find(internalFormat);
+ if (iter != map.end())
+ {
+ return iter->second;
+ }
+ else
+ {
+ UNREACHABLE();
+ return NULL;
+ }
+}
+
+struct D3D11VertexFormatInfo
+{
+ rx::VertexConversionType mConversionType;
+ DXGI_FORMAT mNativeFormat;
+ VertexCopyFunction mCopyFunction;
+
+ D3D11VertexFormatInfo()
+ : mConversionType(VERTEX_CONVERT_NONE),
+ mNativeFormat(DXGI_FORMAT_UNKNOWN),
+ mCopyFunction(NULL)
+ {}
+
+ D3D11VertexFormatInfo(VertexConversionType conversionType, DXGI_FORMAT nativeFormat, VertexCopyFunction copyFunction)
+ : mConversionType(conversionType),
+ mNativeFormat(nativeFormat),
+ mCopyFunction(copyFunction)
+ {}
+};
+
+typedef std::map<gl::VertexFormat, D3D11VertexFormatInfo> D3D11VertexFormatInfoMap;
+
+typedef std::pair<gl::VertexFormat, D3D11VertexFormatInfo> D3D11VertexFormatPair;
+
+static void addVertexFormatInfo(D3D11VertexFormatInfoMap *map, GLenum inputType, GLboolean normalized, GLuint componentCount,
+ VertexConversionType conversionType, DXGI_FORMAT nativeFormat, VertexCopyFunction copyFunction)
+{
+ gl::VertexFormat inputFormat(inputType, normalized, componentCount, false);
+ map->insert(D3D11VertexFormatPair(inputFormat, D3D11VertexFormatInfo(conversionType, nativeFormat, copyFunction)));
+}
+
+static void addIntegerVertexFormatInfo(D3D11VertexFormatInfoMap *map, GLenum inputType, GLuint componentCount,
+ VertexConversionType conversionType, DXGI_FORMAT nativeFormat, VertexCopyFunction copyFunction)
+{
+ gl::VertexFormat inputFormat(inputType, GL_FALSE, componentCount, true);
+ map->insert(D3D11VertexFormatPair(inputFormat, D3D11VertexFormatInfo(conversionType, nativeFormat, copyFunction)));
+}
+
+static D3D11VertexFormatInfoMap BuildD3D11VertexFormatInfoMap()
+{
+ D3D11VertexFormatInfoMap map;
+
+ // TODO: column legend
+
+ //
+ // Float formats
+ //
+
+ // GL_BYTE -- un-normalized
+ addVertexFormatInfo(&map, GL_BYTE, GL_FALSE, 1, VERTEX_CONVERT_GPU, DXGI_FORMAT_R8_SINT, &copyVertexData<GLbyte, 1, 0>);
+ addVertexFormatInfo(&map, GL_BYTE, GL_FALSE, 2, VERTEX_CONVERT_GPU, DXGI_FORMAT_R8G8_SINT, &copyVertexData<GLbyte, 2, 0>);
+ addVertexFormatInfo(&map, GL_BYTE, GL_FALSE, 3, VERTEX_CONVERT_BOTH, DXGI_FORMAT_R8G8B8A8_SINT, &copyVertexData<GLbyte, 3, 1>);
+ addVertexFormatInfo(&map, GL_BYTE, GL_FALSE, 4, VERTEX_CONVERT_GPU, DXGI_FORMAT_R8G8B8A8_SINT, &copyVertexData<GLbyte, 4, 0>);
+
+ // GL_BYTE -- normalized
+ addVertexFormatInfo(&map, GL_BYTE, GL_TRUE, 1, VERTEX_CONVERT_NONE, DXGI_FORMAT_R8_SNORM, &copyVertexData<GLbyte, 1, 0>);
+ addVertexFormatInfo(&map, GL_BYTE, GL_TRUE, 2, VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8_SNORM, &copyVertexData<GLbyte, 2, 0>);
+ addVertexFormatInfo(&map, GL_BYTE, GL_TRUE, 3, VERTEX_CONVERT_CPU, DXGI_FORMAT_R8G8B8A8_SNORM, &copyVertexData<GLbyte, 3, INT8_MAX>);
+ addVertexFormatInfo(&map, GL_BYTE, GL_TRUE, 4, VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8B8A8_SNORM, &copyVertexData<GLbyte, 4, 0>);
+
+ // GL_UNSIGNED_BYTE -- un-normalized
+ addVertexFormatInfo(&map, GL_UNSIGNED_BYTE, GL_FALSE, 1, VERTEX_CONVERT_GPU, DXGI_FORMAT_R8_UINT, &copyVertexData<GLubyte, 1, 0>);
+ addVertexFormatInfo(&map, GL_UNSIGNED_BYTE, GL_FALSE, 2, VERTEX_CONVERT_GPU, DXGI_FORMAT_R8G8_UINT, &copyVertexData<GLubyte, 2, 0>);
+ addVertexFormatInfo(&map, GL_UNSIGNED_BYTE, GL_FALSE, 3, VERTEX_CONVERT_BOTH, DXGI_FORMAT_R8G8B8A8_UINT, &copyVertexData<GLubyte, 3, 1>);
+ addVertexFormatInfo(&map, GL_UNSIGNED_BYTE, GL_FALSE, 4, VERTEX_CONVERT_GPU, DXGI_FORMAT_R8G8B8A8_UINT, &copyVertexData<GLubyte, 4, 0>);
+
+ // GL_UNSIGNED_BYTE -- normalized
+ addVertexFormatInfo(&map, GL_UNSIGNED_BYTE, GL_TRUE, 1, VERTEX_CONVERT_NONE, DXGI_FORMAT_R8_UNORM, &copyVertexData<GLubyte, 1, 0>);
+ addVertexFormatInfo(&map, GL_UNSIGNED_BYTE, GL_TRUE, 2, VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8_UNORM, &copyVertexData<GLubyte, 2, 0>);
+ addVertexFormatInfo(&map, GL_UNSIGNED_BYTE, GL_TRUE, 3, VERTEX_CONVERT_CPU, DXGI_FORMAT_R8G8B8A8_UNORM, &copyVertexData<GLubyte, 3, UINT8_MAX>);
+ addVertexFormatInfo(&map, GL_UNSIGNED_BYTE, GL_TRUE, 4, VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8B8A8_UNORM, &copyVertexData<GLubyte, 4, 0>);
+
+ // GL_SHORT -- un-normalized
+ addVertexFormatInfo(&map, GL_SHORT, GL_FALSE, 1, VERTEX_CONVERT_GPU, DXGI_FORMAT_R16_SINT, &copyVertexData<GLshort, 1, 0>);
+ addVertexFormatInfo(&map, GL_SHORT, GL_FALSE, 2, VERTEX_CONVERT_GPU, DXGI_FORMAT_R16G16_SINT, &copyVertexData<GLshort, 2, 0>);
+ addVertexFormatInfo(&map, GL_SHORT, GL_FALSE, 3, VERTEX_CONVERT_BOTH, DXGI_FORMAT_R16G16B16A16_SINT, &copyVertexData<GLshort, 4, 1>);
+ addVertexFormatInfo(&map, GL_SHORT, GL_FALSE, 4, VERTEX_CONVERT_GPU, DXGI_FORMAT_R16G16B16A16_SINT, &copyVertexData<GLshort, 4, 0>);
+
+ // GL_SHORT -- normalized
+ addVertexFormatInfo(&map, GL_SHORT, GL_TRUE, 1, VERTEX_CONVERT_NONE, DXGI_FORMAT_R16_SNORM, &copyVertexData<GLshort, 1, 0>);
+ addVertexFormatInfo(&map, GL_SHORT, GL_TRUE, 2, VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16_SNORM, &copyVertexData<GLshort, 2, 0>);
+ addVertexFormatInfo(&map, GL_SHORT, GL_TRUE, 3, VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_SNORM, &copyVertexData<GLshort, 3, INT16_MAX>);
+ addVertexFormatInfo(&map, GL_SHORT, GL_TRUE, 4, VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16B16A16_SNORM, &copyVertexData<GLshort, 4, 0>);
+
+ // GL_UNSIGNED_SHORT -- un-normalized
+ addVertexFormatInfo(&map, GL_UNSIGNED_SHORT, GL_FALSE, 1, VERTEX_CONVERT_GPU, DXGI_FORMAT_R16_UINT, &copyVertexData<GLushort, 1, 0>);
+ addVertexFormatInfo(&map, GL_UNSIGNED_SHORT, GL_FALSE, 2, VERTEX_CONVERT_GPU, DXGI_FORMAT_R16G16_UINT, &copyVertexData<GLushort, 2, 0>);
+ addVertexFormatInfo(&map, GL_UNSIGNED_SHORT, GL_FALSE, 3, VERTEX_CONVERT_BOTH, DXGI_FORMAT_R16G16B16A16_UINT, &copyVertexData<GLushort, 3, 1>);
+ addVertexFormatInfo(&map, GL_UNSIGNED_SHORT, GL_FALSE, 4, VERTEX_CONVERT_GPU, DXGI_FORMAT_R16G16B16A16_UINT, &copyVertexData<GLushort, 4, 0>);
+
+ // GL_UNSIGNED_SHORT -- normalized
+ addVertexFormatInfo(&map, GL_UNSIGNED_SHORT, GL_TRUE, 1, VERTEX_CONVERT_NONE, DXGI_FORMAT_R16_UNORM, &copyVertexData<GLushort, 1, 0>);
+ addVertexFormatInfo(&map, GL_UNSIGNED_SHORT, GL_TRUE, 2, VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16_UNORM, &copyVertexData<GLushort, 2, 0>);
+ addVertexFormatInfo(&map, GL_UNSIGNED_SHORT, GL_TRUE, 3, VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_UNORM, &copyVertexData<GLushort, 3, UINT16_MAX>);
+ addVertexFormatInfo(&map, GL_UNSIGNED_SHORT, GL_TRUE, 4, VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16B16A16_UNORM, &copyVertexData<GLushort, 4, 0>);
+
+ // GL_INT -- un-normalized
+ addVertexFormatInfo(&map, GL_INT, GL_FALSE, 1, VERTEX_CONVERT_GPU, DXGI_FORMAT_R32_SINT, &copyVertexData<GLint, 1, 0>);
+ addVertexFormatInfo(&map, GL_INT, GL_FALSE, 2, VERTEX_CONVERT_GPU, DXGI_FORMAT_R32G32_SINT, &copyVertexData<GLint, 2, 0>);
+ addVertexFormatInfo(&map, GL_INT, GL_FALSE, 3, VERTEX_CONVERT_GPU, DXGI_FORMAT_R32G32B32_SINT, &copyVertexData<GLint, 3, 0>);
+ addVertexFormatInfo(&map, GL_INT, GL_FALSE, 4, VERTEX_CONVERT_GPU, DXGI_FORMAT_R32G32B32A32_SINT, &copyVertexData<GLint, 4, 0>);
+
+ // GL_INT -- normalized
+ addVertexFormatInfo(&map, GL_INT, GL_TRUE, 1, VERTEX_CONVERT_CPU, DXGI_FORMAT_R32_FLOAT, &copyToFloatVertexData<GLint, 1, true>);
+ addVertexFormatInfo(&map, GL_INT, GL_TRUE, 2, VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT, &copyToFloatVertexData<GLint, 2, true>);
+ addVertexFormatInfo(&map, GL_INT, GL_TRUE, 3, VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32_FLOAT, &copyToFloatVertexData<GLint, 3, true>);
+ addVertexFormatInfo(&map, GL_INT, GL_TRUE, 4, VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT, &copyToFloatVertexData<GLint, 4, true>);
+
+ // GL_UNSIGNED_INT -- un-normalized
+ addVertexFormatInfo(&map, GL_UNSIGNED_INT, GL_FALSE, 1, VERTEX_CONVERT_GPU, DXGI_FORMAT_R32_UINT, &copyVertexData<GLuint, 1, 0>);
+ addVertexFormatInfo(&map, GL_UNSIGNED_INT, GL_FALSE, 2, VERTEX_CONVERT_GPU, DXGI_FORMAT_R32G32_UINT, &copyVertexData<GLuint, 2, 0>);
+ addVertexFormatInfo(&map, GL_UNSIGNED_INT, GL_FALSE, 3, VERTEX_CONVERT_GPU, DXGI_FORMAT_R32G32B32_UINT, &copyVertexData<GLuint, 3, 0>);
+ addVertexFormatInfo(&map, GL_UNSIGNED_INT, GL_FALSE, 4, VERTEX_CONVERT_GPU, DXGI_FORMAT_R32G32B32A32_UINT, &copyVertexData<GLuint, 4, 0>);
+
+ // GL_UNSIGNED_INT -- normalized
+ addVertexFormatInfo(&map, GL_UNSIGNED_INT, GL_TRUE, 1, VERTEX_CONVERT_NONE, DXGI_FORMAT_R32_FLOAT, &copyToFloatVertexData<GLuint, 1, true>);
+ addVertexFormatInfo(&map, GL_UNSIGNED_INT, GL_TRUE, 2, VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32_FLOAT, &copyToFloatVertexData<GLuint, 2, true>);
+ addVertexFormatInfo(&map, GL_UNSIGNED_INT, GL_TRUE, 3, VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32_FLOAT, &copyToFloatVertexData<GLuint, 3, true>);
+ addVertexFormatInfo(&map, GL_UNSIGNED_INT, GL_TRUE, 4, VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32A32_FLOAT, &copyToFloatVertexData<GLuint, 4, true>);
+
+ // GL_FIXED
+ addVertexFormatInfo(&map, GL_FIXED, GL_FALSE, 1, VERTEX_CONVERT_CPU, DXGI_FORMAT_R32_FLOAT, &copyFixedVertexData<1>);
+ addVertexFormatInfo(&map, GL_FIXED, GL_FALSE, 2, VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT, &copyFixedVertexData<2>);
+ addVertexFormatInfo(&map, GL_FIXED, GL_FALSE, 3, VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32_FLOAT, &copyFixedVertexData<3>);
+ addVertexFormatInfo(&map, GL_FIXED, GL_FALSE, 4, VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT, &copyFixedVertexData<4>);
+
+ // GL_HALF_FLOAT
+ addVertexFormatInfo(&map, GL_HALF_FLOAT, GL_FALSE, 1, VERTEX_CONVERT_NONE, DXGI_FORMAT_R16_FLOAT, &copyVertexData<GLhalf, 1, 0>);
+ addVertexFormatInfo(&map, GL_HALF_FLOAT, GL_FALSE, 2, VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16_FLOAT, &copyVertexData<GLhalf, 2, 0>);
+ addVertexFormatInfo(&map, GL_HALF_FLOAT, GL_FALSE, 3, VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_FLOAT, &copyVertexData<GLhalf, 3, gl::Float16One>);
+ addVertexFormatInfo(&map, GL_HALF_FLOAT, GL_FALSE, 4, VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16B16A16_FLOAT, &copyVertexData<GLhalf, 4, 0>);
+
+ // GL_FLOAT
+ addVertexFormatInfo(&map, GL_FLOAT, GL_FALSE, 1, VERTEX_CONVERT_NONE, DXGI_FORMAT_R32_FLOAT, &copyVertexData<GLfloat, 1, 0>);
+ addVertexFormatInfo(&map, GL_FLOAT, GL_FALSE, 2, VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32_FLOAT, &copyVertexData<GLfloat, 2, 0>);
+ addVertexFormatInfo(&map, GL_FLOAT, GL_FALSE, 3, VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32_FLOAT, &copyVertexData<GLfloat, 3, 0>);
+ addVertexFormatInfo(&map, GL_FLOAT, GL_FALSE, 4, VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32A32_FLOAT, &copyVertexData<GLfloat, 4, 0>);
+
+ // GL_INT_2_10_10_10_REV
+ addVertexFormatInfo(&map, GL_INT_2_10_10_10_REV, GL_FALSE, 4, VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT, &copyPackedVertexData<true, false, true>);
+ addVertexFormatInfo(&map, GL_INT_2_10_10_10_REV, GL_TRUE, 4, VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT, &copyPackedVertexData<true, true, true>);
+
+ // GL_UNSIGNED_INT_2_10_10_10_REV
+ addVertexFormatInfo(&map, GL_UNSIGNED_INT_2_10_10_10_REV, GL_FALSE, 4, VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT, &copyPackedVertexData<false, false, true>);
+ addVertexFormatInfo(&map, GL_UNSIGNED_INT_2_10_10_10_REV, GL_TRUE, 4, VERTEX_CONVERT_NONE, DXGI_FORMAT_R10G10B10A2_UNORM, &copyPackedUnsignedVertexData);
+
+ //
+ // Integer Formats
+ //
+
+ // GL_BYTE
+ addIntegerVertexFormatInfo(&map, GL_BYTE, 1, VERTEX_CONVERT_NONE, DXGI_FORMAT_R8_SINT, &copyVertexData<GLbyte, 1, 0>);
+ addIntegerVertexFormatInfo(&map, GL_BYTE, 2, VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8_SINT, &copyVertexData<GLbyte, 2, 0>);
+ addIntegerVertexFormatInfo(&map, GL_BYTE, 3, VERTEX_CONVERT_CPU, DXGI_FORMAT_R8G8B8A8_SINT, &copyVertexData<GLbyte, 3, 1>);
+ addIntegerVertexFormatInfo(&map, GL_BYTE, 4, VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8B8A8_SINT, &copyVertexData<GLbyte, 4, 0>);
+
+ // GL_UNSIGNED_BYTE
+ addIntegerVertexFormatInfo(&map, GL_UNSIGNED_BYTE, 1, VERTEX_CONVERT_NONE, DXGI_FORMAT_R8_UINT, &copyVertexData<GLubyte, 1, 0>);
+ addIntegerVertexFormatInfo(&map, GL_UNSIGNED_BYTE, 2, VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8_UINT, &copyVertexData<GLubyte, 2, 0>);
+ addIntegerVertexFormatInfo(&map, GL_UNSIGNED_BYTE, 3, VERTEX_CONVERT_CPU, DXGI_FORMAT_R8G8B8A8_UINT, &copyVertexData<GLubyte, 3, 1>);
+ addIntegerVertexFormatInfo(&map, GL_UNSIGNED_BYTE, 4, VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8B8A8_UINT, &copyVertexData<GLubyte, 4, 0>);
+
+ // GL_SHORT
+ addIntegerVertexFormatInfo(&map, GL_SHORT, 1, VERTEX_CONVERT_NONE, DXGI_FORMAT_R16_SINT, &copyVertexData<GLshort, 1, 0>);
+ addIntegerVertexFormatInfo(&map, GL_SHORT, 2, VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16_SINT, &copyVertexData<GLshort, 2, 0>);
+ addIntegerVertexFormatInfo(&map, GL_SHORT, 3, VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_SINT, &copyVertexData<GLshort, 3, 1>);
+ addIntegerVertexFormatInfo(&map, GL_SHORT, 4, VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16B16A16_SINT, &copyVertexData<GLshort, 4, 0>);
+
+ // GL_UNSIGNED_SHORT
+ addIntegerVertexFormatInfo(&map, GL_UNSIGNED_SHORT, 1, VERTEX_CONVERT_NONE, DXGI_FORMAT_R16_UINT, &copyVertexData<GLushort, 1, 0>);
+ addIntegerVertexFormatInfo(&map, GL_UNSIGNED_SHORT, 2, VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16_UINT, &copyVertexData<GLushort, 2, 0>);
+ addIntegerVertexFormatInfo(&map, GL_UNSIGNED_SHORT, 3, VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_UINT, &copyVertexData<GLushort, 3, 1>);
+ addIntegerVertexFormatInfo(&map, GL_UNSIGNED_SHORT, 4, VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16B16A16_UINT, &copyVertexData<GLushort, 4, 0>);
+
+ // GL_INT
+ addIntegerVertexFormatInfo(&map, GL_INT, 1, VERTEX_CONVERT_NONE, DXGI_FORMAT_R32_SINT, &copyVertexData<GLint, 1, 0>);
+ addIntegerVertexFormatInfo(&map, GL_INT, 2, VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32_SINT, &copyVertexData<GLint, 2, 0>);
+ addIntegerVertexFormatInfo(&map, GL_INT, 3, VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32_SINT, &copyVertexData<GLint, 3, 0>);
+ addIntegerVertexFormatInfo(&map, GL_INT, 4, VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32A32_SINT, &copyVertexData<GLint, 4, 0>);
+
+ // GL_UNSIGNED_INT
+ addIntegerVertexFormatInfo(&map, GL_UNSIGNED_INT, 1, VERTEX_CONVERT_NONE, DXGI_FORMAT_R32_SINT, &copyVertexData<GLuint, 1, 0>);
+ addIntegerVertexFormatInfo(&map, GL_UNSIGNED_INT, 2, VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32_SINT, &copyVertexData<GLuint, 2, 0>);
+ addIntegerVertexFormatInfo(&map, GL_UNSIGNED_INT, 3, VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32_SINT, &copyVertexData<GLuint, 3, 0>);
+ addIntegerVertexFormatInfo(&map, GL_UNSIGNED_INT, 4, VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32A32_SINT, &copyVertexData<GLuint, 4, 0>);
+
+ // GL_INT_2_10_10_10_REV
+ addIntegerVertexFormatInfo(&map, GL_INT_2_10_10_10_REV, 4, VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_SINT, &copyPackedVertexData<true, true, false>);
+
+ // GL_UNSIGNED_INT_2_10_10_10_REV
+ addIntegerVertexFormatInfo(&map, GL_UNSIGNED_INT_2_10_10_10_REV, 4, VERTEX_CONVERT_NONE, DXGI_FORMAT_R10G10B10A2_UINT, &copyPackedUnsignedVertexData);
+
+ return map;
+}
+
+static bool GetD3D11VertexFormatInfo(const gl::VertexFormat &vertexFormat, D3D11VertexFormatInfo *outVertexFormatInfo)
+{
+ static const D3D11VertexFormatInfoMap vertexFormatMap = BuildD3D11VertexFormatInfoMap();
+
+ D3D11VertexFormatInfoMap::const_iterator iter = vertexFormatMap.find(vertexFormat);
+ if (iter != vertexFormatMap.end())
+ {
+ if (outVertexFormatInfo)
+ {
+ *outVertexFormatInfo = iter->second;
+ }
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+VertexCopyFunction GetVertexCopyFunction(const gl::VertexFormat &vertexFormat)
+{
+ D3D11VertexFormatInfo vertexFormatInfo;
+ if (GetD3D11VertexFormatInfo(vertexFormat, &vertexFormatInfo))
+ {
+ return vertexFormatInfo.mCopyFunction;
+ }
+ else
+ {
+ UNREACHABLE();
+ return NULL;
+ }
+}
+
+size_t GetVertexElementSize(const gl::VertexFormat &vertexFormat)
+{
+ D3D11VertexFormatInfo vertexFormatInfo;
+ if (GetD3D11VertexFormatInfo(vertexFormat, &vertexFormatInfo))
+ {
+ // FIXME: should not need a client version, and is not a pixel!
+ return d3d11::GetFormatPixelBytes(vertexFormatInfo.mNativeFormat);
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+rx::VertexConversionType GetVertexConversionType(const gl::VertexFormat &vertexFormat)
+{
+ D3D11VertexFormatInfo vertexFormatInfo;
+ if (GetD3D11VertexFormatInfo(vertexFormat, &vertexFormatInfo))
+ {
+ return vertexFormatInfo.mConversionType;
+ }
+ else
+ {
+ UNREACHABLE();
+ return VERTEX_CONVERT_NONE;
+ }
+}
+
+DXGI_FORMAT GetNativeVertexFormat(const gl::VertexFormat &vertexFormat)
+{
+ D3D11VertexFormatInfo vertexFormatInfo;
+ if (GetD3D11VertexFormatInfo(vertexFormat, &vertexFormatInfo))
+ {
+ return vertexFormatInfo.mNativeFormat;
+ }
+ else
+ {
+ UNREACHABLE();
+ return DXGI_FORMAT_UNKNOWN;
+ }
+}
+
+}
+
+namespace d3d11_gl
+{
+
+GLenum GetInternalFormat(DXGI_FORMAT format, GLuint clientVersion)
+{
+ if (clientVersion == 2)
+ {
+ static DXGIToESFormatMap es2FormatMap = BuildDXGIToES2FormatMap();
+ auto formatIt = es2FormatMap.find(format);
+ if (formatIt != es2FormatMap.end())
+ {
+ return formatIt->second;
+ }
+ }
+ else if (clientVersion == 3)
+ {
+ static DXGIToESFormatMap es3FormatMap = BuildDXGIToES3FormatMap();
+ auto formatIt = es3FormatMap.find(format);
+ if (formatIt != es3FormatMap.end())
+ {
+ return formatIt->second;
+ }
+ }
+
+ UNREACHABLE();
+ return GL_NONE;
+}
+
+}
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/formatutils11.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/formatutils11.h
new file mode 100644
index 00000000000..d7ae4e0b9d9
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/formatutils11.h
@@ -0,0 +1,79 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// formatutils11.h: Queries for GL image formats and their translations to D3D11
+// formats.
+
+#ifndef LIBGLESV2_RENDERER_FORMATUTILS11_H_
+#define LIBGLESV2_RENDERER_FORMATUTILS11_H_
+
+#include "libGLESv2/formatutils.h"
+
+namespace rx
+{
+
+class Renderer;
+
+namespace d3d11
+{
+
+typedef std::set<DXGI_FORMAT> DXGIFormatSet;
+
+MipGenerationFunction GetMipGenerationFunction(DXGI_FORMAT format);
+LoadImageFunction GetImageLoadFunction(GLenum internalFormat, GLenum type, GLuint clientVersion);
+
+GLuint GetFormatPixelBytes(DXGI_FORMAT format);
+GLuint GetBlockWidth(DXGI_FORMAT format);
+GLuint GetBlockHeight(DXGI_FORMAT format);
+GLenum GetComponentType(DXGI_FORMAT format);
+
+GLuint GetDepthBits(DXGI_FORMAT format);
+GLuint GetDepthOffset(DXGI_FORMAT format);
+GLuint GetStencilBits(DXGI_FORMAT format);
+GLuint GetStencilOffset(DXGI_FORMAT format);
+
+void MakeValidSize(bool isImage, DXGI_FORMAT format, GLsizei *requestWidth, GLsizei *requestHeight, int *levelOffset);
+
+const DXGIFormatSet &GetAllUsedDXGIFormats();
+
+ColorReadFunction GetColorReadFunction(DXGI_FORMAT format);
+ColorCopyFunction GetFastCopyFunction(DXGI_FORMAT sourceFormat, GLenum destFormat, GLenum destType);
+
+}
+
+namespace gl_d3d11
+{
+
+DXGI_FORMAT GetTexFormat(GLenum internalFormat, GLuint clientVersion);
+DXGI_FORMAT GetSRVFormat(GLenum internalFormat, GLuint clientVersion);
+DXGI_FORMAT GetRTVFormat(GLenum internalFormat, GLuint clientVersion);
+DXGI_FORMAT GetDSVFormat(GLenum internalFormat, GLuint clientVersion);
+DXGI_FORMAT GetRenderableFormat(GLenum internalFormat, GLuint clientVersion);
+
+DXGI_FORMAT GetSwizzleTexFormat(GLint internalFormat, const Renderer *renderer);
+DXGI_FORMAT GetSwizzleSRVFormat(GLint internalFormat, const Renderer *renderer);
+DXGI_FORMAT GetSwizzleRTVFormat(GLint internalFormat, const Renderer *renderer);
+
+bool RequiresTextureDataInitialization(GLint internalFormat);
+InitializeTextureDataFunction GetTextureDataInitializationFunction(GLint internalFormat);
+
+VertexCopyFunction GetVertexCopyFunction(const gl::VertexFormat &vertexFormat);
+size_t GetVertexElementSize(const gl::VertexFormat &vertexFormat);
+VertexConversionType GetVertexConversionType(const gl::VertexFormat &vertexFormat);
+DXGI_FORMAT GetNativeVertexFormat(const gl::VertexFormat &vertexFormat);
+
+}
+
+namespace d3d11_gl
+{
+
+GLenum GetInternalFormat(DXGI_FORMAT format, GLuint clientVersion);
+
+}
+
+}
+
+#endif // LIBGLESV2_RENDERER_FORMATUTILS11_H_
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/renderer11_utils.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/renderer11_utils.cpp
new file mode 100644
index 00000000000..327d2f04f61
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/renderer11_utils.cpp
@@ -0,0 +1,280 @@
+#include "precompiled.h"
+//
+// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// renderer11_utils.cpp: Conversion functions and other utility routines
+// specific to the D3D11 renderer.
+
+#include "libGLESv2/renderer/d3d11/renderer11_utils.h"
+#include "libGLESv2/renderer/d3d11/formatutils11.h"
+#include "common/debug.h"
+
+namespace rx
+{
+
+namespace gl_d3d11
+{
+
+D3D11_BLEND ConvertBlendFunc(GLenum glBlend, bool isAlpha)
+{
+ D3D11_BLEND d3dBlend = D3D11_BLEND_ZERO;
+
+ switch (glBlend)
+ {
+ case GL_ZERO: d3dBlend = D3D11_BLEND_ZERO; break;
+ case GL_ONE: d3dBlend = D3D11_BLEND_ONE; break;
+ case GL_SRC_COLOR: d3dBlend = (isAlpha ? D3D11_BLEND_SRC_ALPHA : D3D11_BLEND_SRC_COLOR); break;
+ case GL_ONE_MINUS_SRC_COLOR: d3dBlend = (isAlpha ? D3D11_BLEND_INV_SRC_ALPHA : D3D11_BLEND_INV_SRC_COLOR); break;
+ case GL_DST_COLOR: d3dBlend = (isAlpha ? D3D11_BLEND_DEST_ALPHA : D3D11_BLEND_DEST_COLOR); break;
+ case GL_ONE_MINUS_DST_COLOR: d3dBlend = (isAlpha ? D3D11_BLEND_INV_DEST_ALPHA : D3D11_BLEND_INV_DEST_COLOR); break;
+ case GL_SRC_ALPHA: d3dBlend = D3D11_BLEND_SRC_ALPHA; break;
+ case GL_ONE_MINUS_SRC_ALPHA: d3dBlend = D3D11_BLEND_INV_SRC_ALPHA; break;
+ case GL_DST_ALPHA: d3dBlend = D3D11_BLEND_DEST_ALPHA; break;
+ case GL_ONE_MINUS_DST_ALPHA: d3dBlend = D3D11_BLEND_INV_DEST_ALPHA; break;
+ case GL_CONSTANT_COLOR: d3dBlend = D3D11_BLEND_BLEND_FACTOR; break;
+ case GL_ONE_MINUS_CONSTANT_COLOR: d3dBlend = D3D11_BLEND_INV_BLEND_FACTOR; break;
+ case GL_CONSTANT_ALPHA: d3dBlend = D3D11_BLEND_BLEND_FACTOR; break;
+ case GL_ONE_MINUS_CONSTANT_ALPHA: d3dBlend = D3D11_BLEND_INV_BLEND_FACTOR; break;
+ case GL_SRC_ALPHA_SATURATE: d3dBlend = D3D11_BLEND_SRC_ALPHA_SAT; break;
+ default: UNREACHABLE();
+ }
+
+ return d3dBlend;
+}
+
+D3D11_BLEND_OP ConvertBlendOp(GLenum glBlendOp)
+{
+ D3D11_BLEND_OP d3dBlendOp = D3D11_BLEND_OP_ADD;
+
+ switch (glBlendOp)
+ {
+ case GL_FUNC_ADD: d3dBlendOp = D3D11_BLEND_OP_ADD; break;
+ case GL_FUNC_SUBTRACT: d3dBlendOp = D3D11_BLEND_OP_SUBTRACT; break;
+ case GL_FUNC_REVERSE_SUBTRACT: d3dBlendOp = D3D11_BLEND_OP_REV_SUBTRACT; break;
+ case GL_MIN: d3dBlendOp = D3D11_BLEND_OP_MIN; break;
+ case GL_MAX: d3dBlendOp = D3D11_BLEND_OP_MAX; break;
+ default: UNREACHABLE();
+ }
+
+ return d3dBlendOp;
+}
+
+UINT8 ConvertColorMask(bool red, bool green, bool blue, bool alpha)
+{
+ UINT8 mask = 0;
+ if (red)
+ {
+ mask |= D3D11_COLOR_WRITE_ENABLE_RED;
+ }
+ if (green)
+ {
+ mask |= D3D11_COLOR_WRITE_ENABLE_GREEN;
+ }
+ if (blue)
+ {
+ mask |= D3D11_COLOR_WRITE_ENABLE_BLUE;
+ }
+ if (alpha)
+ {
+ mask |= D3D11_COLOR_WRITE_ENABLE_ALPHA;
+ }
+ return mask;
+}
+
+D3D11_CULL_MODE ConvertCullMode(bool cullEnabled, GLenum cullMode)
+{
+ D3D11_CULL_MODE cull = D3D11_CULL_NONE;
+
+ if (cullEnabled)
+ {
+ switch (cullMode)
+ {
+ case GL_FRONT: cull = D3D11_CULL_FRONT; break;
+ case GL_BACK: cull = D3D11_CULL_BACK; break;
+ case GL_FRONT_AND_BACK: cull = D3D11_CULL_NONE; break;
+ default: UNREACHABLE();
+ }
+ }
+ else
+ {
+ cull = D3D11_CULL_NONE;
+ }
+
+ return cull;
+}
+
+D3D11_COMPARISON_FUNC ConvertComparison(GLenum comparison)
+{
+ D3D11_COMPARISON_FUNC d3dComp = D3D11_COMPARISON_NEVER;
+ switch (comparison)
+ {
+ case GL_NEVER: d3dComp = D3D11_COMPARISON_NEVER; break;
+ case GL_ALWAYS: d3dComp = D3D11_COMPARISON_ALWAYS; break;
+ case GL_LESS: d3dComp = D3D11_COMPARISON_LESS; break;
+ case GL_LEQUAL: d3dComp = D3D11_COMPARISON_LESS_EQUAL; break;
+ case GL_EQUAL: d3dComp = D3D11_COMPARISON_EQUAL; break;
+ case GL_GREATER: d3dComp = D3D11_COMPARISON_GREATER; break;
+ case GL_GEQUAL: d3dComp = D3D11_COMPARISON_GREATER_EQUAL; break;
+ case GL_NOTEQUAL: d3dComp = D3D11_COMPARISON_NOT_EQUAL; break;
+ default: UNREACHABLE();
+ }
+
+ return d3dComp;
+}
+
+D3D11_DEPTH_WRITE_MASK ConvertDepthMask(bool depthWriteEnabled)
+{
+ return depthWriteEnabled ? D3D11_DEPTH_WRITE_MASK_ALL : D3D11_DEPTH_WRITE_MASK_ZERO;
+}
+
+UINT8 ConvertStencilMask(GLuint stencilmask)
+{
+ return static_cast<UINT8>(stencilmask);
+}
+
+D3D11_STENCIL_OP ConvertStencilOp(GLenum stencilOp)
+{
+ D3D11_STENCIL_OP d3dStencilOp = D3D11_STENCIL_OP_KEEP;
+
+ switch (stencilOp)
+ {
+ case GL_ZERO: d3dStencilOp = D3D11_STENCIL_OP_ZERO; break;
+ case GL_KEEP: d3dStencilOp = D3D11_STENCIL_OP_KEEP; break;
+ case GL_REPLACE: d3dStencilOp = D3D11_STENCIL_OP_REPLACE; break;
+ case GL_INCR: d3dStencilOp = D3D11_STENCIL_OP_INCR_SAT; break;
+ case GL_DECR: d3dStencilOp = D3D11_STENCIL_OP_DECR_SAT; break;
+ case GL_INVERT: d3dStencilOp = D3D11_STENCIL_OP_INVERT; break;
+ case GL_INCR_WRAP: d3dStencilOp = D3D11_STENCIL_OP_INCR; break;
+ case GL_DECR_WRAP: d3dStencilOp = D3D11_STENCIL_OP_DECR; break;
+ default: UNREACHABLE();
+ }
+
+ return d3dStencilOp;
+}
+
+D3D11_FILTER ConvertFilter(GLenum minFilter, GLenum magFilter, float maxAnisotropy, GLenum comparisonMode)
+{
+ bool comparison = comparisonMode != GL_NONE;
+
+ if (maxAnisotropy > 1.0f)
+ {
+ return D3D11_ENCODE_ANISOTROPIC_FILTER(static_cast<D3D11_COMPARISON_FUNC>(comparison));
+ }
+ else
+ {
+ D3D11_FILTER_TYPE dxMin = D3D11_FILTER_TYPE_POINT;
+ D3D11_FILTER_TYPE dxMip = D3D11_FILTER_TYPE_POINT;
+ switch (minFilter)
+ {
+ case GL_NEAREST: dxMin = D3D11_FILTER_TYPE_POINT; dxMip = D3D11_FILTER_TYPE_POINT; break;
+ case GL_LINEAR: dxMin = D3D11_FILTER_TYPE_LINEAR; dxMip = D3D11_FILTER_TYPE_POINT; break;
+ case GL_NEAREST_MIPMAP_NEAREST: dxMin = D3D11_FILTER_TYPE_POINT; dxMip = D3D11_FILTER_TYPE_POINT; break;
+ case GL_LINEAR_MIPMAP_NEAREST: dxMin = D3D11_FILTER_TYPE_LINEAR; dxMip = D3D11_FILTER_TYPE_POINT; break;
+ case GL_NEAREST_MIPMAP_LINEAR: dxMin = D3D11_FILTER_TYPE_POINT; dxMip = D3D11_FILTER_TYPE_LINEAR; break;
+ case GL_LINEAR_MIPMAP_LINEAR: dxMin = D3D11_FILTER_TYPE_LINEAR; dxMip = D3D11_FILTER_TYPE_LINEAR; break;
+ default: UNREACHABLE();
+ }
+
+ D3D11_FILTER_TYPE dxMag = D3D11_FILTER_TYPE_POINT;
+ switch (magFilter)
+ {
+ case GL_NEAREST: dxMag = D3D11_FILTER_TYPE_POINT; break;
+ case GL_LINEAR: dxMag = D3D11_FILTER_TYPE_LINEAR; break;
+ default: UNREACHABLE();
+ }
+
+ return D3D11_ENCODE_BASIC_FILTER(dxMin, dxMag, dxMip, static_cast<D3D11_COMPARISON_FUNC>(comparison));
+ }
+}
+
+D3D11_TEXTURE_ADDRESS_MODE ConvertTextureWrap(GLenum wrap)
+{
+ switch (wrap)
+ {
+ case GL_REPEAT: return D3D11_TEXTURE_ADDRESS_WRAP;
+ case GL_CLAMP_TO_EDGE: return D3D11_TEXTURE_ADDRESS_CLAMP;
+ case GL_MIRRORED_REPEAT: return D3D11_TEXTURE_ADDRESS_MIRROR;
+ default: UNREACHABLE();
+ }
+
+ return D3D11_TEXTURE_ADDRESS_WRAP;
+}
+
+D3D11_QUERY ConvertQueryType(GLenum queryType)
+{
+ switch (queryType)
+ {
+ case GL_ANY_SAMPLES_PASSED_EXT:
+ case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT: return D3D11_QUERY_OCCLUSION;
+ case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: return D3D11_QUERY_SO_STATISTICS;
+ default: UNREACHABLE(); return D3D11_QUERY_EVENT;
+ }
+}
+
+}
+
+namespace d3d11
+{
+
+void GenerateInitialTextureData(GLint internalFormat, GLuint clientVersion, GLuint width, GLuint height, GLuint depth,
+ GLuint mipLevels, std::vector<D3D11_SUBRESOURCE_DATA> *outSubresourceData,
+ std::vector< std::vector<BYTE> > *outData)
+{
+ InitializeTextureDataFunction initializeFunc = gl_d3d11::GetTextureDataInitializationFunction(internalFormat);
+ DXGI_FORMAT dxgiFormat = gl_d3d11::GetTexFormat(internalFormat, clientVersion);
+
+ outSubresourceData->resize(mipLevels);
+ outData->resize(mipLevels);
+
+ for (unsigned int i = 0; i < mipLevels; i++)
+ {
+ unsigned int mipWidth = std::max(width >> i, 1U);
+ unsigned int mipHeight = std::max(height >> i, 1U);
+ unsigned int mipDepth = std::max(depth >> i, 1U);
+
+ unsigned int rowWidth = d3d11::GetFormatPixelBytes(dxgiFormat) * mipWidth;
+ unsigned int imageSize = rowWidth * height;
+
+ outData->at(i).resize(rowWidth * mipHeight * mipDepth);
+ initializeFunc(mipWidth, mipHeight, mipDepth, outData->at(i).data(), rowWidth, imageSize);
+
+ outSubresourceData->at(i).pSysMem = outData->at(i).data();
+ outSubresourceData->at(i).SysMemPitch = rowWidth;
+ outSubresourceData->at(i).SysMemSlicePitch = imageSize;
+ }
+}
+
+void SetPositionTexCoordVertex(PositionTexCoordVertex* vertex, float x, float y, float u, float v)
+{
+ vertex->x = x;
+ vertex->y = y;
+ vertex->u = u;
+ vertex->v = v;
+}
+
+void SetPositionLayerTexCoord3DVertex(PositionLayerTexCoord3DVertex* vertex, float x, float y,
+ unsigned int layer, float u, float v, float s)
+{
+ vertex->x = x;
+ vertex->y = y;
+ vertex->l = layer;
+ vertex->u = u;
+ vertex->v = v;
+ vertex->s = s;
+}
+
+HRESULT SetDebugName(ID3D11DeviceChild *resource, const char *name)
+{
+#if defined(_DEBUG)
+ return resource->SetPrivateData(WKPDID_D3DDebugObjectName, strlen(name), name);
+#else
+ return S_OK;
+#endif
+}
+
+}
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/renderer11_utils.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/renderer11_utils.h
new file mode 100644
index 00000000000..94bb8f88fe2
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/renderer11_utils.h
@@ -0,0 +1,165 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// renderer11_utils.h: Conversion functions and other utility routines
+// specific to the D3D11 renderer.
+
+#ifndef LIBGLESV2_RENDERER_RENDERER11_UTILS_H
+#define LIBGLESV2_RENDERER_RENDERER11_UTILS_H
+
+#include "libGLESv2/angletypes.h"
+
+namespace rx
+{
+
+namespace gl_d3d11
+{
+
+D3D11_BLEND ConvertBlendFunc(GLenum glBlend, bool isAlpha);
+D3D11_BLEND_OP ConvertBlendOp(GLenum glBlendOp);
+UINT8 ConvertColorMask(bool maskRed, bool maskGreen, bool maskBlue, bool maskAlpha);
+
+D3D11_CULL_MODE ConvertCullMode(bool cullEnabled, GLenum cullMode);
+
+D3D11_COMPARISON_FUNC ConvertComparison(GLenum comparison);
+D3D11_DEPTH_WRITE_MASK ConvertDepthMask(bool depthWriteEnabled);
+UINT8 ConvertStencilMask(GLuint stencilmask);
+D3D11_STENCIL_OP ConvertStencilOp(GLenum stencilOp);
+
+D3D11_FILTER ConvertFilter(GLenum minFilter, GLenum magFilter, float maxAnisotropy, GLenum comparisonMode);
+D3D11_TEXTURE_ADDRESS_MODE ConvertTextureWrap(GLenum wrap);
+
+D3D11_QUERY ConvertQueryType(GLenum queryType);
+
+}
+
+namespace d3d11
+{
+
+void GenerateInitialTextureData(GLint internalFormat, GLuint clientVersion, GLuint width, GLuint height, GLuint depth,
+ GLuint mipLevels, std::vector<D3D11_SUBRESOURCE_DATA> *outSubresourceData,
+ std::vector< std::vector<BYTE> > *outData);
+
+struct PositionTexCoordVertex
+{
+ float x, y;
+ float u, v;
+};
+void SetPositionTexCoordVertex(PositionTexCoordVertex* vertex, float x, float y, float u, float v);
+
+struct PositionLayerTexCoord3DVertex
+{
+ float x, y;
+ unsigned int l;
+ float u, v, s;
+};
+void SetPositionLayerTexCoord3DVertex(PositionLayerTexCoord3DVertex* vertex, float x, float y,
+ unsigned int layer, float u, float v, float s);
+
+template <typename T>
+struct PositionDepthColorVertex
+{
+ float x, y, z;
+ T r, g, b, a;
+};
+
+template <typename T>
+void SetPositionDepthColorVertex(PositionDepthColorVertex<T>* vertex, float x, float y, float z,
+ const gl::Color<T> &color)
+{
+ vertex->x = x;
+ vertex->y = y;
+ vertex->z = z;
+ vertex->r = color.red;
+ vertex->g = color.green;
+ vertex->b = color.blue;
+ vertex->a = color.alpha;
+}
+
+HRESULT SetDebugName(ID3D11DeviceChild *resource, const char *name);
+
+template <typename outType>
+outType* DynamicCastComObject(IUnknown* object)
+{
+ outType *outObject = NULL;
+ HRESULT result = object->QueryInterface(__uuidof(outType), reinterpret_cast<void**>(&outObject));
+ if (SUCCEEDED(result))
+ {
+ return outObject;
+ }
+ else
+ {
+ SafeRelease(outObject);
+ return NULL;
+ }
+}
+
+inline bool isDeviceLostError(HRESULT errorCode)
+{
+ switch (errorCode)
+ {
+ case DXGI_ERROR_DEVICE_HUNG:
+ case DXGI_ERROR_DEVICE_REMOVED:
+ case DXGI_ERROR_DEVICE_RESET:
+ case DXGI_ERROR_DRIVER_INTERNAL_ERROR:
+ case DXGI_ERROR_NOT_CURRENTLY_AVAILABLE:
+ return true;
+ default:
+ return false;
+ }
+}
+
+template <unsigned int N>
+inline ID3D11VertexShader *CompileVS(ID3D11Device *device, const BYTE (&byteCode)[N], const char *name)
+{
+ ID3D11VertexShader *vs = NULL;
+ HRESULT result = device->CreateVertexShader(byteCode, N, NULL, &vs);
+ UNUSED_ASSERTION_VARIABLE(result);
+ ASSERT(SUCCEEDED(result));
+ SetDebugName(vs, name);
+ return vs;
+}
+
+template <unsigned int N>
+inline ID3D11GeometryShader *CompileGS(ID3D11Device *device, const BYTE (&byteCode)[N], const char *name)
+{
+ ID3D11GeometryShader *gs = NULL;
+ HRESULT result = device->CreateGeometryShader(byteCode, N, NULL, &gs);
+ UNUSED_ASSERTION_VARIABLE(result);
+ ASSERT(SUCCEEDED(result));
+ SetDebugName(gs, name);
+ return gs;
+}
+
+template <unsigned int N>
+inline ID3D11PixelShader *CompilePS(ID3D11Device *device, const BYTE (&byteCode)[N], const char *name)
+{
+ ID3D11PixelShader *ps = NULL;
+ HRESULT result = device->CreatePixelShader(byteCode, N, NULL, &ps);
+ UNUSED_ASSERTION_VARIABLE(result);
+ ASSERT(SUCCEEDED(result));
+ SetDebugName(ps, name);
+ return ps;
+}
+
+// Copy data to small D3D11 buffers, such as for small constant buffers, which use one struct to
+// represent an entire buffer.
+template <class T>
+inline void SetBufferData(ID3D11DeviceContext *context, ID3D11Buffer *constantBuffer, const T &value)
+{
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
+ context->Map(constantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
+
+ memcpy(mappedResource.pData, &value, sizeof(T));
+
+ context->Unmap(constantBuffer, 0);
+}
+
+}
+
+}
+
+#endif // LIBGLESV2_RENDERER_RENDERER11_UTILS_H
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/BufferToTexture11.hlsl b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/BufferToTexture11.hlsl
new file mode 100644
index 00000000000..20e6623a30c
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/BufferToTexture11.hlsl
@@ -0,0 +1,76 @@
+Buffer<float4> Buffer4F : register(t0);
+Buffer<int4> Buffer4I : register(t0);
+Buffer<uint4> Buffer4UI : register(t0);
+
+struct VS_OUTPUT
+{
+ float4 position : SV_Position;
+ uint index : TEXCOORD0;
+ uint slice : LAYER;
+};
+
+struct GS_OUTPUT
+{
+ float4 position : SV_Position;
+ uint index : TEXCOORD0;
+ uint slice : SV_RenderTargetArrayIndex;
+};
+
+cbuffer BufferCopyParams : register(b0)
+{
+ uint FirstPixelOffset;
+ uint PixelsPerRow;
+ uint RowStride;
+ uint RowsPerSlice;
+ float2 PositionOffset;
+ float2 PositionScale;
+ int2 TexLocationOffset;
+ int2 TexLocationScale;
+}
+
+void ComputePositionAndIndex(uint vertexID, out VS_OUTPUT outVertex)
+{
+ uint PixelsPerSlice = PixelsPerRow * RowsPerSlice;
+ uint SliceStride = RowStride * RowsPerSlice;
+
+ uint slice = vertexID / PixelsPerSlice;
+ uint sliceOffset = slice * PixelsPerSlice;
+ uint row = (vertexID - sliceOffset) / PixelsPerRow;
+ uint col = vertexID - sliceOffset - (row * PixelsPerRow);
+
+ float2 coords = float2(float(col), float(row));
+
+ outVertex.position = float4(PositionOffset + PositionScale * coords, 0.0f, 1.0f);
+ outVertex.index = FirstPixelOffset + slice * SliceStride + row * RowStride + col;
+ outVertex.slice = slice;
+}
+
+void VS_BufferToTexture(in uint vertexID : SV_VertexID, out VS_OUTPUT outVertex)
+{
+ ComputePositionAndIndex(vertexID, outVertex);
+}
+
+[maxvertexcount(1)]
+void GS_BufferToTexture(point VS_OUTPUT inVertex[1], inout PointStream<GS_OUTPUT> outStream)
+{
+ GS_OUTPUT outVertex;
+ outVertex.position = inVertex[0].position;
+ outVertex.index = inVertex[0].index;
+ outVertex.slice = inVertex[0].slice;
+ outStream.Append(outVertex);
+}
+
+float4 PS_BufferToTexture_4F(in float4 inPosition : SV_Position, in uint inIndex : TEXCOORD0) : SV_Target
+{
+ return Buffer4F.Load(inIndex);
+}
+
+int4 PS_BufferToTexture_4I(in float4 inPosition : SV_Position, in uint inIndex : TEXCOORD0) : SV_Target
+{
+ return Buffer4I.Load(inIndex);
+}
+
+uint4 PS_BufferToTexture_4UI(in float4 inPosition : SV_Position, in uint inIndex : TEXCOORD0) : SV_Target
+{
+ return Buffer4UI.Load(inIndex);
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/Clear11.hlsl b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/Clear11.hlsl
new file mode 100644
index 00000000000..6deef2ba19c
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/Clear11.hlsl
@@ -0,0 +1,102 @@
+// Assume we are in SM4+, which has 8 color outputs
+
+void VS_ClearFloat( in float3 inPosition : POSITION, in float4 inColor : COLOR,
+ out float4 outPosition : SV_POSITION, out float4 outColor : COLOR)
+{
+ outPosition = float4(inPosition, 1.0f);
+ outColor = inColor;
+}
+
+struct PS_OutputFloat
+{
+ float4 color0 : SV_TARGET0;
+ float4 color1 : SV_TARGET1;
+ float4 color2 : SV_TARGET2;
+ float4 color3 : SV_TARGET3;
+ float4 color4 : SV_TARGET4;
+ float4 color5 : SV_TARGET5;
+ float4 color6 : SV_TARGET6;
+ float4 color7 : SV_TARGET7;
+};
+
+PS_OutputFloat PS_ClearFloat(in float4 inPosition : SV_POSITION, in float4 inColor : COLOR)
+{
+ PS_OutputFloat outColor;
+ outColor.color0 = inColor;
+ outColor.color1 = inColor;
+ outColor.color2 = inColor;
+ outColor.color3 = inColor;
+ outColor.color4 = inColor;
+ outColor.color5 = inColor;
+ outColor.color6 = inColor;
+ outColor.color7 = inColor;
+ return outColor;
+}
+
+
+void VS_ClearUint( in float3 inPosition : POSITION, in uint4 inColor : COLOR,
+ out float4 outPosition : SV_POSITION, out uint4 outColor : COLOR)
+{
+ outPosition = float4(inPosition, 1.0f);
+ outColor = inColor;
+}
+
+struct PS_OutputUint
+{
+ uint4 color0 : SV_TARGET0;
+ uint4 color1 : SV_TARGET1;
+ uint4 color2 : SV_TARGET2;
+ uint4 color3 : SV_TARGET3;
+ uint4 color4 : SV_TARGET4;
+ uint4 color5 : SV_TARGET5;
+ uint4 color6 : SV_TARGET6;
+ uint4 color7 : SV_TARGET7;
+};
+
+PS_OutputUint PS_ClearUint(in float4 inPosition : SV_POSITION, in uint4 inColor : COLOR)
+{
+ PS_OutputUint outColor;
+ outColor.color0 = inColor;
+ outColor.color1 = inColor;
+ outColor.color2 = inColor;
+ outColor.color3 = inColor;
+ outColor.color4 = inColor;
+ outColor.color5 = inColor;
+ outColor.color6 = inColor;
+ outColor.color7 = inColor;
+ return outColor;
+}
+
+
+void VS_ClearSint( in float3 inPosition : POSITION, in int4 inColor : COLOR,
+ out float4 outPosition : SV_POSITION, out int4 outColor : COLOR)
+{
+ outPosition = float4(inPosition, 1.0f);
+ outColor = inColor;
+}
+
+struct PS_OutputSint
+{
+ int4 color0 : SV_TARGET0;
+ int4 color1 : SV_TARGET1;
+ int4 color2 : SV_TARGET2;
+ int4 color3 : SV_TARGET3;
+ int4 color4 : SV_TARGET4;
+ int4 color5 : SV_TARGET5;
+ int4 color6 : SV_TARGET6;
+ int4 color7 : SV_TARGET7;
+};
+
+PS_OutputSint PS_ClearSint(in float4 inPosition : SV_POSITION, in int4 inColor : COLOR)
+{
+ PS_OutputSint outColor;
+ outColor.color0 = inColor;
+ outColor.color1 = inColor;
+ outColor.color2 = inColor;
+ outColor.color3 = inColor;
+ outColor.color4 = inColor;
+ outColor.color5 = inColor;
+ outColor.color6 = inColor;
+ outColor.color7 = inColor;
+ return outColor;
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/Passthrough2D11.hlsl b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/Passthrough2D11.hlsl
new file mode 100644
index 00000000000..8671c39fb7a
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/Passthrough2D11.hlsl
@@ -0,0 +1,111 @@
+Texture2D<float4> TextureF : register(t0);
+Texture2D<uint4> TextureUI : register(t0);
+Texture2D<int4> TextureI : register(t0);
+
+SamplerState Sampler : register(s0);
+
+void VS_Passthrough2D( in float2 inPosition : POSITION, in float2 inTexCoord : TEXCOORD0,
+ out float4 outPosition : SV_POSITION, out float2 outTexCoord : TEXCOORD0)
+{
+ outPosition = float4(inPosition, 0.0f, 1.0f);
+ outTexCoord = inTexCoord;
+}
+
+float PS_PassthroughDepth2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_DEPTH
+{
+ return TextureF.Sample(Sampler, inTexCoord).r;
+}
+
+float4 PS_PassthroughRGBA2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+ return TextureF.Sample(Sampler, inTexCoord).rgba;
+}
+
+uint4 PS_PassthroughRGBA2DUI(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+ uint2 size;
+ TextureUI.GetDimensions(size.x, size.y);
+
+ return TextureUI.Load(int3(size * inTexCoord, 0)).rgba;
+}
+
+int4 PS_PassthroughRGBA2DI(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+ uint2 size;
+ TextureI.GetDimensions(size.x, size.y);
+
+ return TextureI.Load(int3(size * inTexCoord, 0)).rgba;
+}
+
+float4 PS_PassthroughRGB2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+ return float4(TextureF.Sample(Sampler, inTexCoord).rgb, 1.0f);
+}
+
+uint4 PS_PassthroughRGB2DUI(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+ uint2 size;
+ TextureUI.GetDimensions(size.x, size.y);
+
+ return uint4(TextureUI.Load(int3(size * inTexCoord, 0)).rgb, 0);
+}
+
+int4 PS_PassthroughRGB2DI(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+ uint2 size;
+ TextureI.GetDimensions(size.x, size.y);
+
+ return int4(TextureI.Load(int3(size * inTexCoord, 0)).rgb, 0);
+}
+
+float4 PS_PassthroughRG2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+ return float4(TextureF.Sample(Sampler, inTexCoord).rg, 0.0f, 1.0f);
+}
+
+uint4 PS_PassthroughRG2DUI(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+ uint2 size;
+ TextureUI.GetDimensions(size.x, size.y);
+
+ return uint4(TextureUI.Load(int3(size * inTexCoord, 0)).rg, 0, 0);
+}
+
+int4 PS_PassthroughRG2DI(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+ uint2 size;
+ TextureI.GetDimensions(size.x, size.y);
+
+ return int4(TextureI.Load(int3(size * inTexCoord, 0)).rg, 0, 0);
+}
+
+float4 PS_PassthroughR2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+ return float4(TextureF.Sample(Sampler, inTexCoord).r, 0.0f, 0.0f, 1.0f);
+}
+
+uint4 PS_PassthroughR2DUI(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+ uint2 size;
+ TextureUI.GetDimensions(size.x, size.y);
+
+ return uint4(TextureUI.Load(int3(size * inTexCoord, 0)).r, 0, 0, 0);
+}
+
+int4 PS_PassthroughR2DI(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+ uint2 size;
+ TextureI.GetDimensions(size.x, size.y);
+
+ return int4(TextureI.Load(int3(size * inTexCoord, 0)).r, 0, 0, 0);
+}
+
+float4 PS_PassthroughLum2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+ return float4(TextureF.Sample(Sampler, inTexCoord).rrr, 1.0f);
+}
+
+float4 PS_PassthroughLumAlpha2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+ return TextureF.Sample(Sampler, inTexCoord).rrra;
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/Passthrough3D11.hlsl b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/Passthrough3D11.hlsl
new file mode 100644
index 00000000000..c23c9032ec2
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/Passthrough3D11.hlsl
@@ -0,0 +1,146 @@
+Texture3D<float4> TextureF : register(t0);
+Texture3D<uint4> TextureUI : register(t0);
+Texture3D<int4> TextureI : register(t0);
+
+SamplerState Sampler : register(s0);
+
+struct VS_INPUT
+{
+ float2 Position : POSITION;
+ uint Layer : LAYER;
+ float3 TexCoord : TEXCOORD;
+};
+
+struct VS_OUTPUT
+{
+ float4 Position : SV_POSITION;
+ uint Layer : LAYER;
+ float3 TexCoord : TEXCOORD;
+};
+
+struct GS_OUTPUT
+{
+ float4 Position : SV_POSITION;
+ uint Layer : SV_RENDERTARGETARRAYINDEX;
+ float3 TexCoord : TEXCOORD;
+};
+
+VS_OUTPUT VS_Passthrough3D(VS_INPUT input)
+{
+ VS_OUTPUT output;
+
+ output.Position = float4(input.Position, 0.0f, 1.0f);
+ output.Layer = input.Layer;
+ output.TexCoord = input.TexCoord;
+
+ return output;
+}
+
+[maxvertexcount(3)]
+void GS_Passthrough3D(triangle VS_OUTPUT input[3], inout TriangleStream<GS_OUTPUT> outputStream)
+{
+ GS_OUTPUT output;
+
+ for (int i = 0; i < 3; i++)
+ {
+ output.Position = input[i].Position;
+ output.Layer = input[i].Layer;
+ output.TexCoord = input[i].TexCoord;
+
+ outputStream.Append(output);
+ }
+}
+
+float4 PS_PassthroughRGBA3D(GS_OUTPUT input) : SV_TARGET0
+{
+ return TextureF.Sample(Sampler, input.TexCoord).rgba;
+}
+
+uint4 PS_PassthroughRGBA3DUI(GS_OUTPUT input) : SV_TARGET0
+{
+ uint3 size;
+ TextureUI.GetDimensions(size.x, size.y, size.z);
+
+ return TextureUI.Load(int4(size * input.TexCoord, 0)).rgba;
+}
+
+int4 PS_PassthroughRGBA3DI(GS_OUTPUT input) : SV_TARGET0
+{
+ uint3 size;
+ TextureI.GetDimensions(size.x, size.y, size.z);
+
+ return TextureI.Load(int4(size * input.TexCoord, 0)).rgba;
+}
+
+float4 PS_PassthroughRGB3D(GS_OUTPUT input) : SV_TARGET0
+{
+ return float4(TextureF.Sample(Sampler, input.TexCoord).rgb, 1.0f);
+}
+
+uint4 PS_PassthroughRGB3DUI(GS_OUTPUT input) : SV_TARGET0
+{
+ uint3 size;
+ TextureUI.GetDimensions(size.x, size.y, size.z);
+
+ return uint4(TextureUI.Load(int4(size * input.TexCoord, 0)).rgb, 0);
+}
+
+int4 PS_PassthroughRGB3DI(GS_OUTPUT input) : SV_TARGET0
+{
+ uint3 size;
+ TextureI.GetDimensions(size.x, size.y, size.z);
+
+ return int4(TextureI.Load(int4(size * input.TexCoord, 0)).rgb, 0);
+}
+
+float4 PS_PassthroughRG3D(GS_OUTPUT input) : SV_TARGET0
+{
+ return float4(TextureF.Sample(Sampler, input.TexCoord).rg, 0.0f, 1.0f);
+}
+
+uint4 PS_PassthroughRG3DUI(GS_OUTPUT input) : SV_TARGET0
+{
+ uint3 size;
+ TextureUI.GetDimensions(size.x, size.y, size.z);
+
+ return uint4(TextureUI.Load(int4(size * input.TexCoord, 0)).rg, 0, 0);
+}
+
+int4 PS_PassthroughRG3DI(GS_OUTPUT input) : SV_TARGET0
+{
+ uint3 size;
+ TextureI.GetDimensions(size.x, size.y, size.z);
+
+ return int4(TextureI.Load(int4(size * input.TexCoord, 0)).rg, 0, 0);
+}
+
+float4 PS_PassthroughR3D(GS_OUTPUT input) : SV_TARGET0
+{
+ return float4(TextureF.Sample(Sampler, input.TexCoord).r, 0.0f, 0.0f, 1.0f);
+}
+
+uint4 PS_PassthroughR3DUI(GS_OUTPUT input) : SV_TARGET0
+{
+ uint3 size;
+ TextureUI.GetDimensions(size.x, size.y, size.z);
+
+ return uint4(TextureUI.Load(int4(size * input.TexCoord, 0)).r, 0, 0, 0);
+}
+
+int4 PS_PassthroughR3DI(GS_OUTPUT input) : SV_TARGET0
+{
+ uint3 size;
+ TextureI.GetDimensions(size.x, size.y, size.z);
+
+ return int4(TextureI.Load(int4(size * input.TexCoord, 0)).r, 0, 0, 0);
+}
+
+float4 PS_PassthroughLum3D(GS_OUTPUT input) : SV_TARGET0
+{
+ return float4(TextureF.Sample(Sampler, input.TexCoord).rrr, 1.0f);
+}
+
+float4 PS_PassthroughLumAlpha3D(GS_OUTPUT input) : SV_TARGET0
+{
+ return TextureF.Sample(Sampler, input.TexCoord).rrra;
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/Swizzle11.hlsl b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/Swizzle11.hlsl
new file mode 100644
index 00000000000..505e2221376
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/Swizzle11.hlsl
@@ -0,0 +1,99 @@
+Texture2D<float4> TextureF2D : register(t0);
+Texture2D<uint4> TextureUI2D : register(t0);
+Texture2D<int4> TextureI2D : register(t0);
+
+Texture3D<float4> TextureF3D : register(t0);
+Texture3D<uint4> TextureUI3D : register(t0);
+Texture3D<int4> TextureI3D : register(t0);
+
+Texture2DArray<float4> TextureF2DArray : register(t0);
+Texture2DArray<uint4> TextureUI2DArray : register(t0);
+Texture2DArray<int4> TextureI2DArray : register(t0);
+
+SamplerState Sampler : register(s0);
+
+cbuffer SwizzleProperties : register(b0)
+{
+ uint4 SwizzleIndices : packoffset(c0);
+}
+
+float4 SwizzleLookup(in float4 sample)
+{
+ float lookup[6] = { sample[0], sample[1], sample[2], sample[3], 0.0f, 1.0f };
+ return float4(lookup[SwizzleIndices[0]], lookup[SwizzleIndices[1]], lookup[SwizzleIndices[2]], lookup[SwizzleIndices[3]]);
+}
+
+int4 SwizzleLookup(in int4 sample)
+{
+ int lookup[6] = { sample[0], sample[1], sample[2], sample[3], 0.0f, 1.0f };
+ return int4(lookup[SwizzleIndices[0]], lookup[SwizzleIndices[1]], lookup[SwizzleIndices[2]], lookup[SwizzleIndices[3]]);
+}
+
+uint4 SwizzleLookup(in uint4 sample)
+{
+ uint lookup[6] = { sample[0], sample[1], sample[2], sample[3], 0.0f, 1.0f };
+ return uint4(lookup[SwizzleIndices[0]], lookup[SwizzleIndices[1]], lookup[SwizzleIndices[2]], lookup[SwizzleIndices[3]]);
+}
+
+float4 PS_SwizzleF2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+ return SwizzleLookup(TextureF2D.Sample(Sampler, inTexCoord));
+}
+
+int4 PS_SwizzleI2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+ uint2 size;
+ TextureI2D.GetDimensions(size.x, size.y);
+
+ return SwizzleLookup(TextureI2D.Load(int3(size * inTexCoord, 0)));
+}
+
+uint4 PS_SwizzleUI2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+ uint2 size;
+ TextureUI2D.GetDimensions(size.x, size.y);
+
+ return SwizzleLookup(TextureUI2D.Load(int3(size * inTexCoord, 0)));
+}
+
+float4 PS_SwizzleF3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+ return SwizzleLookup(TextureF3D.Sample(Sampler, inTexCoord));
+}
+
+int4 PS_SwizzleI3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+ uint3 size;
+ TextureI3D.GetDimensions(size.x, size.y, size.z);
+
+ return SwizzleLookup(TextureI3D.Load(int4(size * inTexCoord, 0)));
+}
+
+uint4 PS_SwizzleUI3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+ uint3 size;
+ TextureUI3D.GetDimensions(size.x, size.y, size.z);
+
+ return SwizzleLookup(TextureUI3D.Load(int4(size * inTexCoord, 0)));
+}
+
+float4 PS_SwizzleF2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+ return SwizzleLookup(TextureF2DArray.Sample(Sampler, float3(inTexCoord.xy, inLayer)));
+}
+
+int4 PS_SwizzleI2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+ uint3 size;
+ TextureI2DArray.GetDimensions(size.x, size.y, size.z);
+
+ return SwizzleLookup(TextureI2DArray.Load(int4(size.xy * inTexCoord.xy, inLayer, 0)));
+}
+
+uint4 PS_SwizzleUI2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+ uint3 size;
+ TextureUI2DArray.GetDimensions(size.x, size.y, size.z);
+
+ return SwizzleLookup(TextureUI2DArray.Load(int4(size.xy * inTexCoord.xy, inLayer, 0)));
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/buffertotexture11_gs.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/buffertotexture11_gs.h
new file mode 100644
index 00000000000..8259bc8eb01
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/buffertotexture11_gs.h
@@ -0,0 +1,166 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_Position 0 xyzw 0 POS float xyzw
+// TEXCOORD 0 x 1 NONE uint x
+// LAYER 0 y 1 NONE uint y
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_Position 0 xyzw 0 POS float xyzw
+// TEXCOORD 0 x 1 NONE uint x
+// SV_RenderTargetArrayIndex 0 y 1 RTINDEX uint y
+//
+gs_4_0
+dcl_input_siv v[1][0].xyzw, position
+dcl_input v[1][1].x
+dcl_input v[1][1].y
+dcl_inputprimitive point
+dcl_outputtopology pointlist
+dcl_output_siv o0.xyzw, position
+dcl_output o1.x
+dcl_output_siv o1.y, rendertarget_array_index
+dcl_maxout 1
+mov o0.xyzw, v[0][0].xyzw
+mov o1.x, v[0][1].x
+mov o1.y, v[0][1].y
+emit
+ret
+// Approximately 5 instruction slots used
+#endif
+
+const BYTE g_GS_BufferToTexture[] =
+{
+ 68, 88, 66, 67, 76, 247,
+ 16, 54, 179, 210, 24, 242,
+ 185, 199, 67, 148, 241, 107,
+ 16, 2, 1, 0, 0, 0,
+ 212, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 140, 0, 0, 0, 0, 1,
+ 0, 0, 136, 1, 0, 0,
+ 88, 2, 0, 0, 82, 68,
+ 69, 70, 80, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 83, 71, 0, 1, 0, 0,
+ 28, 0, 0, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102,
+ 116, 32, 40, 82, 41, 32,
+ 72, 76, 83, 76, 32, 83,
+ 104, 97, 100, 101, 114, 32,
+ 67, 111, 109, 112, 105, 108,
+ 101, 114, 32, 57, 46, 51,
+ 48, 46, 57, 50, 48, 48,
+ 46, 49, 54, 51, 56, 52,
+ 0, 171, 73, 83, 71, 78,
+ 108, 0, 0, 0, 3, 0,
+ 0, 0, 8, 0, 0, 0,
+ 80, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 15, 0, 0,
+ 92, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 1, 1, 0, 0,
+ 101, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 2, 2, 0, 0,
+ 83, 86, 95, 80, 111, 115,
+ 105, 116, 105, 111, 110, 0,
+ 84, 69, 88, 67, 79, 79,
+ 82, 68, 0, 76, 65, 89,
+ 69, 82, 0, 171, 79, 83,
+ 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0,
+ 0, 0, 80, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 1, 14,
+ 0, 0, 101, 0, 0, 0,
+ 0, 0, 0, 0, 4, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 2, 13,
+ 0, 0, 83, 86, 95, 80,
+ 111, 115, 105, 116, 105, 111,
+ 110, 0, 84, 69, 88, 67,
+ 79, 79, 82, 68, 0, 83,
+ 86, 95, 82, 101, 110, 100,
+ 101, 114, 84, 97, 114, 103,
+ 101, 116, 65, 114, 114, 97,
+ 121, 73, 110, 100, 101, 120,
+ 0, 171, 83, 72, 68, 82,
+ 200, 0, 0, 0, 64, 0,
+ 2, 0, 50, 0, 0, 0,
+ 97, 0, 0, 5, 242, 16,
+ 32, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 95, 0, 0, 4,
+ 18, 16, 32, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0,
+ 95, 0, 0, 4, 34, 16,
+ 32, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 93, 8,
+ 0, 1, 92, 8, 0, 1,
+ 103, 0, 0, 4, 242, 32,
+ 16, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 101, 0,
+ 0, 3, 18, 32, 16, 0,
+ 1, 0, 0, 0, 103, 0,
+ 0, 4, 34, 32, 16, 0,
+ 1, 0, 0, 0, 4, 0,
+ 0, 0, 94, 0, 0, 2,
+ 1, 0, 0, 0, 54, 0,
+ 0, 6, 242, 32, 16, 0,
+ 0, 0, 0, 0, 70, 30,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 32, 16, 0,
+ 1, 0, 0, 0, 10, 16,
+ 32, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 54, 0,
+ 0, 6, 34, 32, 16, 0,
+ 1, 0, 0, 0, 26, 16,
+ 32, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 19, 0,
+ 0, 1, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0,
+ 0, 0, 5, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 6, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/buffertotexture11_ps_4f.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/buffertotexture11_ps_4f.h
new file mode 100644
index 00000000000..ce4ca086698
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/buffertotexture11_ps_4f.h
@@ -0,0 +1,223 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Buffer Definitions:
+//
+// cbuffer BufferCopyParams
+// {
+//
+// uint FirstPixelOffset; // Offset: 0 Size: 4 [unused]
+// uint PixelsPerRow; // Offset: 4 Size: 4 [unused]
+// uint RowStride; // Offset: 8 Size: 4 [unused]
+// uint RowsPerSlice; // Offset: 12 Size: 4 [unused]
+// float2 PositionOffset; // Offset: 16 Size: 8 [unused]
+// float2 PositionScale; // Offset: 24 Size: 8 [unused]
+// int2 TexLocationOffset; // Offset: 32 Size: 8 [unused]
+// int2 TexLocationScale; // Offset: 40 Size: 8 [unused]
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Buffer4F texture float4 buf 0 1
+// BufferCopyParams cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_Position 0 xyzw 0 POS float
+// TEXCOORD 0 x 1 NONE uint x
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_Target 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_constantbuffer cb0[1], immediateIndexed
+dcl_resource_buffer (float,float,float,float) t0
+dcl_input_ps constant v1.x
+dcl_output o0.xyzw
+ld o0.xyzw, v1.xxxx, t0.xyzw
+ret
+// Approximately 2 instruction slots used
+#endif
+
+const BYTE g_PS_BufferToTexture_4F[] =
+{
+ 68, 88, 66, 67, 161, 212,
+ 38, 156, 243, 82, 97, 91,
+ 138, 4, 55, 121, 28, 62,
+ 245, 159, 1, 0, 0, 0,
+ 216, 3, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 104, 2, 0, 0, 192, 2,
+ 0, 0, 244, 2, 0, 0,
+ 92, 3, 0, 0, 82, 68,
+ 69, 70, 44, 2, 0, 0,
+ 1, 0, 0, 0, 120, 0,
+ 0, 0, 2, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 249, 1, 0, 0, 92, 0,
+ 0, 0, 2, 0, 0, 0,
+ 5, 0, 0, 0, 1, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0,
+ 101, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 66, 117, 102, 102,
+ 101, 114, 52, 70, 0, 66,
+ 117, 102, 102, 101, 114, 67,
+ 111, 112, 121, 80, 97, 114,
+ 97, 109, 115, 0, 171, 171,
+ 101, 0, 0, 0, 8, 0,
+ 0, 0, 144, 0, 0, 0,
+ 48, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 80, 1, 0, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 100, 1,
+ 0, 0, 0, 0, 0, 0,
+ 116, 1, 0, 0, 4, 0,
+ 0, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 100, 1,
+ 0, 0, 0, 0, 0, 0,
+ 129, 1, 0, 0, 8, 0,
+ 0, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 100, 1,
+ 0, 0, 0, 0, 0, 0,
+ 139, 1, 0, 0, 12, 0,
+ 0, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 100, 1,
+ 0, 0, 0, 0, 0, 0,
+ 152, 1, 0, 0, 16, 0,
+ 0, 0, 8, 0, 0, 0,
+ 0, 0, 0, 0, 168, 1,
+ 0, 0, 0, 0, 0, 0,
+ 184, 1, 0, 0, 24, 0,
+ 0, 0, 8, 0, 0, 0,
+ 0, 0, 0, 0, 168, 1,
+ 0, 0, 0, 0, 0, 0,
+ 198, 1, 0, 0, 32, 0,
+ 0, 0, 8, 0, 0, 0,
+ 0, 0, 0, 0, 216, 1,
+ 0, 0, 0, 0, 0, 0,
+ 232, 1, 0, 0, 40, 0,
+ 0, 0, 8, 0, 0, 0,
+ 0, 0, 0, 0, 216, 1,
+ 0, 0, 0, 0, 0, 0,
+ 70, 105, 114, 115, 116, 80,
+ 105, 120, 101, 108, 79, 102,
+ 102, 115, 101, 116, 0, 171,
+ 171, 171, 0, 0, 19, 0,
+ 1, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 80, 105, 120, 101, 108, 115,
+ 80, 101, 114, 82, 111, 119,
+ 0, 82, 111, 119, 83, 116,
+ 114, 105, 100, 101, 0, 82,
+ 111, 119, 115, 80, 101, 114,
+ 83, 108, 105, 99, 101, 0,
+ 80, 111, 115, 105, 116, 105,
+ 111, 110, 79, 102, 102, 115,
+ 101, 116, 0, 171, 1, 0,
+ 3, 0, 1, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 80, 111, 115, 105,
+ 116, 105, 111, 110, 83, 99,
+ 97, 108, 101, 0, 84, 101,
+ 120, 76, 111, 99, 97, 116,
+ 105, 111, 110, 79, 102, 102,
+ 115, 101, 116, 0, 1, 0,
+ 2, 0, 1, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 84, 101, 120, 76,
+ 111, 99, 97, 116, 105, 111,
+ 110, 83, 99, 97, 108, 101,
+ 0, 77, 105, 99, 114, 111,
+ 115, 111, 102, 116, 32, 40,
+ 82, 41, 32, 72, 76, 83,
+ 76, 32, 83, 104, 97, 100,
+ 101, 114, 32, 67, 111, 109,
+ 112, 105, 108, 101, 114, 32,
+ 57, 46, 51, 48, 46, 57,
+ 50, 48, 48, 46, 49, 54,
+ 51, 56, 52, 0, 73, 83,
+ 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0,
+ 0, 0, 56, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 68, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 1, 1,
+ 0, 0, 83, 86, 95, 80,
+ 111, 115, 105, 116, 105, 111,
+ 110, 0, 84, 69, 88, 67,
+ 79, 79, 82, 68, 0, 171,
+ 171, 171, 79, 83, 71, 78,
+ 44, 0, 0, 0, 1, 0,
+ 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 83, 86, 95, 84, 97, 114,
+ 103, 101, 116, 0, 171, 171,
+ 83, 72, 68, 82, 96, 0,
+ 0, 0, 64, 0, 0, 0,
+ 24, 0, 0, 0, 89, 0,
+ 0, 4, 70, 142, 32, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 88, 8, 0, 4,
+ 0, 112, 16, 0, 0, 0,
+ 0, 0, 85, 85, 0, 0,
+ 98, 8, 0, 3, 18, 16,
+ 16, 0, 1, 0, 0, 0,
+ 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0,
+ 45, 0, 0, 7, 242, 32,
+ 16, 0, 0, 0, 0, 0,
+ 6, 16, 16, 0, 1, 0,
+ 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 62, 0,
+ 0, 1, 83, 84, 65, 84,
+ 116, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/buffertotexture11_ps_4i.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/buffertotexture11_ps_4i.h
new file mode 100644
index 00000000000..666930a471d
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/buffertotexture11_ps_4i.h
@@ -0,0 +1,129 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Buffer4I texture sint4 buf 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_Position 0 xyzw 0 POS float
+// TEXCOORD 0 x 1 NONE uint x
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_Target 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_resource_buffer (sint,sint,sint,sint) t0
+dcl_input_ps constant v1.x
+dcl_output o0.xyzw
+ld o0.xyzw, v1.xxxx, t0.xyzw
+ret
+// Approximately 2 instruction slots used
+#endif
+
+const BYTE g_PS_BufferToTexture_4I[] =
+{
+ 68, 88, 66, 67, 178, 234,
+ 204, 249, 218, 40, 155, 155,
+ 252, 18, 110, 38, 237, 186,
+ 217, 231, 1, 0, 0, 0,
+ 20, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 180, 0, 0, 0, 12, 1,
+ 0, 0, 64, 1, 0, 0,
+ 152, 1, 0, 0, 82, 68,
+ 69, 70, 120, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 69, 0, 0, 0, 60, 0,
+ 0, 0, 2, 0, 0, 0,
+ 3, 0, 0, 0, 1, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0,
+ 66, 117, 102, 102, 101, 114,
+ 52, 73, 0, 77, 105, 99,
+ 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72,
+ 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67,
+ 111, 109, 112, 105, 108, 101,
+ 114, 32, 57, 46, 51, 48,
+ 46, 57, 50, 48, 48, 46,
+ 49, 54, 51, 56, 52, 0,
+ 73, 83, 71, 78, 80, 0,
+ 0, 0, 2, 0, 0, 0,
+ 8, 0, 0, 0, 56, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 68, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 1, 0, 0, 83, 86,
+ 95, 80, 111, 115, 105, 116,
+ 105, 111, 110, 0, 84, 69,
+ 88, 67, 79, 79, 82, 68,
+ 0, 171, 171, 171, 79, 83,
+ 71, 78, 44, 0, 0, 0,
+ 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 83, 86, 95, 84,
+ 97, 114, 103, 101, 116, 0,
+ 171, 171, 83, 72, 68, 82,
+ 80, 0, 0, 0, 64, 0,
+ 0, 0, 20, 0, 0, 0,
+ 88, 8, 0, 4, 0, 112,
+ 16, 0, 0, 0, 0, 0,
+ 51, 51, 0, 0, 98, 8,
+ 0, 3, 18, 16, 16, 0,
+ 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0,
+ 0, 0, 0, 0, 45, 0,
+ 0, 7, 242, 32, 16, 0,
+ 0, 0, 0, 0, 6, 16,
+ 16, 0, 1, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0,
+ 0, 0, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/buffertotexture11_ps_4ui.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/buffertotexture11_ps_4ui.h
new file mode 100644
index 00000000000..1c3a3e1b707
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/buffertotexture11_ps_4ui.h
@@ -0,0 +1,130 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Buffer4UI texture uint4 buf 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_Position 0 xyzw 0 POS float
+// TEXCOORD 0 x 1 NONE uint x
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_Target 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_resource_buffer (uint,uint,uint,uint) t0
+dcl_input_ps constant v1.x
+dcl_output o0.xyzw
+ld o0.xyzw, v1.xxxx, t0.xyzw
+ret
+// Approximately 2 instruction slots used
+#endif
+
+const BYTE g_PS_BufferToTexture_4UI[] =
+{
+ 68, 88, 66, 67, 209, 204,
+ 134, 75, 28, 212, 134, 131,
+ 219, 18, 16, 227, 99, 23,
+ 205, 131, 1, 0, 0, 0,
+ 24, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 184, 0, 0, 0, 16, 1,
+ 0, 0, 68, 1, 0, 0,
+ 156, 1, 0, 0, 82, 68,
+ 69, 70, 124, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 70, 0, 0, 0, 60, 0,
+ 0, 0, 2, 0, 0, 0,
+ 4, 0, 0, 0, 1, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0,
+ 66, 117, 102, 102, 101, 114,
+ 52, 85, 73, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102,
+ 116, 32, 40, 82, 41, 32,
+ 72, 76, 83, 76, 32, 83,
+ 104, 97, 100, 101, 114, 32,
+ 67, 111, 109, 112, 105, 108,
+ 101, 114, 32, 57, 46, 51,
+ 48, 46, 57, 50, 48, 48,
+ 46, 49, 54, 51, 56, 52,
+ 0, 171, 171, 171, 73, 83,
+ 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0,
+ 0, 0, 56, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 68, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 1, 1,
+ 0, 0, 83, 86, 95, 80,
+ 111, 115, 105, 116, 105, 111,
+ 110, 0, 84, 69, 88, 67,
+ 79, 79, 82, 68, 0, 171,
+ 171, 171, 79, 83, 71, 78,
+ 44, 0, 0, 0, 1, 0,
+ 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 83, 86, 95, 84, 97, 114,
+ 103, 101, 116, 0, 171, 171,
+ 83, 72, 68, 82, 80, 0,
+ 0, 0, 64, 0, 0, 0,
+ 20, 0, 0, 0, 88, 8,
+ 0, 4, 0, 112, 16, 0,
+ 0, 0, 0, 0, 68, 68,
+ 0, 0, 98, 8, 0, 3,
+ 18, 16, 16, 0, 1, 0,
+ 0, 0, 101, 0, 0, 3,
+ 242, 32, 16, 0, 0, 0,
+ 0, 0, 45, 0, 0, 7,
+ 242, 32, 16, 0, 0, 0,
+ 0, 0, 6, 16, 16, 0,
+ 1, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0,
+ 62, 0, 0, 1, 83, 84,
+ 65, 84, 116, 0, 0, 0,
+ 2, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/buffertotexture11_vs.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/buffertotexture11_vs.h
new file mode 100644
index 00000000000..1331f3aa3b1
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/buffertotexture11_vs.h
@@ -0,0 +1,303 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Buffer Definitions:
+//
+// cbuffer BufferCopyParams
+// {
+//
+// uint FirstPixelOffset; // Offset: 0 Size: 4
+// uint PixelsPerRow; // Offset: 4 Size: 4
+// uint RowStride; // Offset: 8 Size: 4
+// uint RowsPerSlice; // Offset: 12 Size: 4
+// float2 PositionOffset; // Offset: 16 Size: 8
+// float2 PositionScale; // Offset: 24 Size: 8
+// int2 TexLocationOffset; // Offset: 32 Size: 8 [unused]
+// int2 TexLocationScale; // Offset: 40 Size: 8 [unused]
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// BufferCopyParams cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_VertexID 0 x 0 VERTID uint x
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_Position 0 xyzw 0 POS float xyzw
+// TEXCOORD 0 x 1 NONE uint x
+// LAYER 0 y 1 NONE uint y
+//
+vs_4_0
+dcl_constantbuffer cb0[2], immediateIndexed
+dcl_input_sgv v0.x, vertex_id
+dcl_output_siv o0.xyzw, position
+dcl_output o1.x
+dcl_output o1.y
+dcl_temps 2
+mov o0.zw, l(0,0,0,1.000000)
+imul null, r0.xy, cb0[0].wwww, cb0[0].yzyy
+udiv r0.z, null, v0.x, r0.x
+imad r0.x, -r0.z, r0.x, v0.x
+imad r0.y, r0.z, r0.y, cb0[0].x
+mov o1.y, r0.z
+udiv r0.z, null, r0.x, cb0[0].y
+imad r0.x, -r0.z, cb0[0].y, r0.x
+utof r1.xy, r0.xzxx
+imad r0.y, r0.z, cb0[0].z, r0.y
+iadd o1.x, r0.x, r0.y
+mad o0.xy, cb0[1].zwzz, r1.xyxx, cb0[1].xyxx
+ret
+// Approximately 13 instruction slots used
+#endif
+
+const BYTE g_VS_BufferToTexture[] =
+{
+ 68, 88, 66, 67, 158, 32,
+ 140, 89, 212, 226, 251, 197,
+ 186, 151, 46, 176, 250, 58,
+ 75, 228, 1, 0, 0, 0,
+ 104, 5, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 64, 2, 0, 0, 116, 2,
+ 0, 0, 232, 2, 0, 0,
+ 236, 4, 0, 0, 82, 68,
+ 69, 70, 4, 2, 0, 0,
+ 1, 0, 0, 0, 80, 0,
+ 0, 0, 1, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 254, 255, 0, 1, 0, 0,
+ 209, 1, 0, 0, 60, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0,
+ 66, 117, 102, 102, 101, 114,
+ 67, 111, 112, 121, 80, 97,
+ 114, 97, 109, 115, 0, 171,
+ 171, 171, 60, 0, 0, 0,
+ 8, 0, 0, 0, 104, 0,
+ 0, 0, 48, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 40, 1, 0, 0,
+ 0, 0, 0, 0, 4, 0,
+ 0, 0, 2, 0, 0, 0,
+ 60, 1, 0, 0, 0, 0,
+ 0, 0, 76, 1, 0, 0,
+ 4, 0, 0, 0, 4, 0,
+ 0, 0, 2, 0, 0, 0,
+ 60, 1, 0, 0, 0, 0,
+ 0, 0, 89, 1, 0, 0,
+ 8, 0, 0, 0, 4, 0,
+ 0, 0, 2, 0, 0, 0,
+ 60, 1, 0, 0, 0, 0,
+ 0, 0, 99, 1, 0, 0,
+ 12, 0, 0, 0, 4, 0,
+ 0, 0, 2, 0, 0, 0,
+ 60, 1, 0, 0, 0, 0,
+ 0, 0, 112, 1, 0, 0,
+ 16, 0, 0, 0, 8, 0,
+ 0, 0, 2, 0, 0, 0,
+ 128, 1, 0, 0, 0, 0,
+ 0, 0, 144, 1, 0, 0,
+ 24, 0, 0, 0, 8, 0,
+ 0, 0, 2, 0, 0, 0,
+ 128, 1, 0, 0, 0, 0,
+ 0, 0, 158, 1, 0, 0,
+ 32, 0, 0, 0, 8, 0,
+ 0, 0, 0, 0, 0, 0,
+ 176, 1, 0, 0, 0, 0,
+ 0, 0, 192, 1, 0, 0,
+ 40, 0, 0, 0, 8, 0,
+ 0, 0, 0, 0, 0, 0,
+ 176, 1, 0, 0, 0, 0,
+ 0, 0, 70, 105, 114, 115,
+ 116, 80, 105, 120, 101, 108,
+ 79, 102, 102, 115, 101, 116,
+ 0, 171, 171, 171, 0, 0,
+ 19, 0, 1, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 80, 105, 120, 101,
+ 108, 115, 80, 101, 114, 82,
+ 111, 119, 0, 82, 111, 119,
+ 83, 116, 114, 105, 100, 101,
+ 0, 82, 111, 119, 115, 80,
+ 101, 114, 83, 108, 105, 99,
+ 101, 0, 80, 111, 115, 105,
+ 116, 105, 111, 110, 79, 102,
+ 102, 115, 101, 116, 0, 171,
+ 1, 0, 3, 0, 1, 0,
+ 2, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 80, 111,
+ 115, 105, 116, 105, 111, 110,
+ 83, 99, 97, 108, 101, 0,
+ 84, 101, 120, 76, 111, 99,
+ 97, 116, 105, 111, 110, 79,
+ 102, 102, 115, 101, 116, 0,
+ 1, 0, 2, 0, 1, 0,
+ 2, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 84, 101,
+ 120, 76, 111, 99, 97, 116,
+ 105, 111, 110, 83, 99, 97,
+ 108, 101, 0, 77, 105, 99,
+ 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72,
+ 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67,
+ 111, 109, 112, 105, 108, 101,
+ 114, 32, 57, 46, 51, 48,
+ 46, 57, 50, 48, 48, 46,
+ 49, 54, 51, 56, 52, 0,
+ 73, 83, 71, 78, 44, 0,
+ 0, 0, 1, 0, 0, 0,
+ 8, 0, 0, 0, 32, 0,
+ 0, 0, 0, 0, 0, 0,
+ 6, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 1, 0, 0, 83, 86,
+ 95, 86, 101, 114, 116, 101,
+ 120, 73, 68, 0, 79, 83,
+ 71, 78, 108, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0,
+ 0, 0, 80, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 1, 14,
+ 0, 0, 101, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 2, 13,
+ 0, 0, 83, 86, 95, 80,
+ 111, 115, 105, 116, 105, 111,
+ 110, 0, 84, 69, 88, 67,
+ 79, 79, 82, 68, 0, 76,
+ 65, 89, 69, 82, 0, 171,
+ 83, 72, 68, 82, 252, 1,
+ 0, 0, 64, 0, 1, 0,
+ 127, 0, 0, 0, 89, 0,
+ 0, 4, 70, 142, 32, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 96, 0, 0, 4,
+ 18, 16, 16, 0, 0, 0,
+ 0, 0, 6, 0, 0, 0,
+ 103, 0, 0, 4, 242, 32,
+ 16, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 101, 0,
+ 0, 3, 18, 32, 16, 0,
+ 1, 0, 0, 0, 101, 0,
+ 0, 3, 34, 32, 16, 0,
+ 1, 0, 0, 0, 104, 0,
+ 0, 2, 2, 0, 0, 0,
+ 54, 0, 0, 8, 194, 32,
+ 16, 0, 0, 0, 0, 0,
+ 2, 64, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 128, 63, 38, 0, 0, 10,
+ 0, 208, 0, 0, 50, 0,
+ 16, 0, 0, 0, 0, 0,
+ 246, 143, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 150, 133, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 78, 0, 0, 8, 66, 0,
+ 16, 0, 0, 0, 0, 0,
+ 0, 208, 0, 0, 10, 16,
+ 16, 0, 0, 0, 0, 0,
+ 10, 0, 16, 0, 0, 0,
+ 0, 0, 35, 0, 0, 10,
+ 18, 0, 16, 0, 0, 0,
+ 0, 0, 42, 0, 16, 128,
+ 65, 0, 0, 0, 0, 0,
+ 0, 0, 10, 0, 16, 0,
+ 0, 0, 0, 0, 10, 16,
+ 16, 0, 0, 0, 0, 0,
+ 35, 0, 0, 10, 34, 0,
+ 16, 0, 0, 0, 0, 0,
+ 42, 0, 16, 0, 0, 0,
+ 0, 0, 26, 0, 16, 0,
+ 0, 0, 0, 0, 10, 128,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 5, 34, 32, 16, 0,
+ 1, 0, 0, 0, 42, 0,
+ 16, 0, 0, 0, 0, 0,
+ 78, 0, 0, 9, 66, 0,
+ 16, 0, 0, 0, 0, 0,
+ 0, 208, 0, 0, 10, 0,
+ 16, 0, 0, 0, 0, 0,
+ 26, 128, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 35, 0, 0, 11, 18, 0,
+ 16, 0, 0, 0, 0, 0,
+ 42, 0, 16, 128, 65, 0,
+ 0, 0, 0, 0, 0, 0,
+ 26, 128, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 10, 0, 16, 0, 0, 0,
+ 0, 0, 86, 0, 0, 5,
+ 50, 0, 16, 0, 1, 0,
+ 0, 0, 134, 0, 16, 0,
+ 0, 0, 0, 0, 35, 0,
+ 0, 10, 34, 0, 16, 0,
+ 0, 0, 0, 0, 42, 0,
+ 16, 0, 0, 0, 0, 0,
+ 42, 128, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 26, 0, 16, 0, 0, 0,
+ 0, 0, 30, 0, 0, 7,
+ 18, 32, 16, 0, 1, 0,
+ 0, 0, 10, 0, 16, 0,
+ 0, 0, 0, 0, 26, 0,
+ 16, 0, 0, 0, 0, 0,
+ 50, 0, 0, 11, 50, 32,
+ 16, 0, 0, 0, 0, 0,
+ 230, 138, 32, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 70, 0, 16, 0, 1, 0,
+ 0, 0, 70, 128, 32, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0,
+ 0, 0, 13, 0, 0, 0,
+ 2, 0, 0, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 2, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/clearmultiple11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/clearfloat11ps.h
index 82a1493f8c8..a0ddf37211f 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/clearmultiple11ps.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/clearfloat11ps.h
@@ -48,7 +48,7 @@ ret
// Approximately 9 instruction slots used
#endif
-const BYTE g_PS_ClearMultiple[] =
+const BYTE g_PS_ClearFloat[] =
{
68, 88, 66, 67, 92, 54,
120, 105, 166, 196, 132, 158,
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/clear11vs.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/clearfloat11vs.h
index c3a3f38a319..19401092750 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/clear11vs.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/clearfloat11vs.h
@@ -32,7 +32,7 @@ ret
// Approximately 4 instruction slots used
#endif
-const BYTE g_VS_Clear[] =
+const BYTE g_VS_ClearFloat[] =
{
68, 88, 66, 67, 97, 5,
13, 163, 160, 254, 95, 127,
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/clearsint11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/clearsint11ps.h
new file mode 100644
index 00000000000..43081ad9727
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/clearsint11ps.h
@@ -0,0 +1,196 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// COLOR 0 xyzw 1 NONE int xyzw
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+// SV_TARGET 1 xyzw 1 TARGET int xyzw
+// SV_TARGET 2 xyzw 2 TARGET int xyzw
+// SV_TARGET 3 xyzw 3 TARGET int xyzw
+// SV_TARGET 4 xyzw 4 TARGET int xyzw
+// SV_TARGET 5 xyzw 5 TARGET int xyzw
+// SV_TARGET 6 xyzw 6 TARGET int xyzw
+// SV_TARGET 7 xyzw 7 TARGET int xyzw
+//
+ps_4_0
+dcl_input_ps constant v1.xyzw
+dcl_output o0.xyzw
+dcl_output o1.xyzw
+dcl_output o2.xyzw
+dcl_output o3.xyzw
+dcl_output o4.xyzw
+dcl_output o5.xyzw
+dcl_output o6.xyzw
+dcl_output o7.xyzw
+mov o0.xyzw, v1.xyzw
+mov o1.xyzw, v1.xyzw
+mov o2.xyzw, v1.xyzw
+mov o3.xyzw, v1.xyzw
+mov o4.xyzw, v1.xyzw
+mov o5.xyzw, v1.xyzw
+mov o6.xyzw, v1.xyzw
+mov o7.xyzw, v1.xyzw
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_ClearSint[] =
+{
+ 68, 88, 66, 67, 254, 74,
+ 218, 24, 78, 136, 223, 133,
+ 92, 40, 115, 152, 188, 11,
+ 222, 36, 1, 0, 0, 0,
+ 88, 3, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 140, 0, 0, 0, 224, 0,
+ 0, 0, 188, 1, 0, 0,
+ 220, 2, 0, 0, 82, 68,
+ 69, 70, 80, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 28, 0, 0, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102,
+ 116, 32, 40, 82, 41, 32,
+ 72, 76, 83, 76, 32, 83,
+ 104, 97, 100, 101, 114, 32,
+ 67, 111, 109, 112, 105, 108,
+ 101, 114, 32, 57, 46, 51,
+ 48, 46, 57, 50, 48, 48,
+ 46, 49, 54, 51, 56, 52,
+ 0, 171, 73, 83, 71, 78,
+ 76, 0, 0, 0, 2, 0,
+ 0, 0, 8, 0, 0, 0,
+ 56, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 68, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 1, 0,
+ 0, 0, 15, 15, 0, 0,
+ 83, 86, 95, 80, 79, 83,
+ 73, 84, 73, 79, 78, 0,
+ 67, 79, 76, 79, 82, 0,
+ 171, 171, 79, 83, 71, 78,
+ 212, 0, 0, 0, 8, 0,
+ 0, 0, 8, 0, 0, 0,
+ 200, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 200, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 1, 0,
+ 0, 0, 15, 0, 0, 0,
+ 200, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 2, 0,
+ 0, 0, 15, 0, 0, 0,
+ 200, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 3, 0,
+ 0, 0, 15, 0, 0, 0,
+ 200, 0, 0, 0, 4, 0,
+ 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 4, 0,
+ 0, 0, 15, 0, 0, 0,
+ 200, 0, 0, 0, 5, 0,
+ 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 5, 0,
+ 0, 0, 15, 0, 0, 0,
+ 200, 0, 0, 0, 6, 0,
+ 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 6, 0,
+ 0, 0, 15, 0, 0, 0,
+ 200, 0, 0, 0, 7, 0,
+ 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 7, 0,
+ 0, 0, 15, 0, 0, 0,
+ 83, 86, 95, 84, 65, 82,
+ 71, 69, 84, 0, 171, 171,
+ 83, 72, 68, 82, 24, 1,
+ 0, 0, 64, 0, 0, 0,
+ 70, 0, 0, 0, 98, 8,
+ 0, 3, 242, 16, 16, 0,
+ 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0,
+ 0, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0,
+ 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0,
+ 2, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0,
+ 3, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0,
+ 4, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0,
+ 5, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0,
+ 6, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0,
+ 7, 0, 0, 0, 54, 0,
+ 0, 5, 242, 32, 16, 0,
+ 0, 0, 0, 0, 70, 30,
+ 16, 0, 1, 0, 0, 0,
+ 54, 0, 0, 5, 242, 32,
+ 16, 0, 1, 0, 0, 0,
+ 70, 30, 16, 0, 1, 0,
+ 0, 0, 54, 0, 0, 5,
+ 242, 32, 16, 0, 2, 0,
+ 0, 0, 70, 30, 16, 0,
+ 1, 0, 0, 0, 54, 0,
+ 0, 5, 242, 32, 16, 0,
+ 3, 0, 0, 0, 70, 30,
+ 16, 0, 1, 0, 0, 0,
+ 54, 0, 0, 5, 242, 32,
+ 16, 0, 4, 0, 0, 0,
+ 70, 30, 16, 0, 1, 0,
+ 0, 0, 54, 0, 0, 5,
+ 242, 32, 16, 0, 5, 0,
+ 0, 0, 70, 30, 16, 0,
+ 1, 0, 0, 0, 54, 0,
+ 0, 5, 242, 32, 16, 0,
+ 6, 0, 0, 0, 70, 30,
+ 16, 0, 1, 0, 0, 0,
+ 54, 0, 0, 5, 242, 32,
+ 16, 0, 7, 0, 0, 0,
+ 70, 30, 16, 0, 1, 0,
+ 0, 0, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0,
+ 0, 0, 9, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 9, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 9, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/clearsint11vs.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/clearsint11vs.h
new file mode 100644
index 00000000000..f49d9fbb319
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/clearsint11vs.h
@@ -0,0 +1,131 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// POSITION 0 xyz 0 NONE float xyz
+// COLOR 0 xyzw 1 NONE int xyzw
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float xyzw
+// COLOR 0 xyzw 1 NONE int xyzw
+//
+vs_4_0
+dcl_input v0.xyz
+dcl_input v1.xyzw
+dcl_output_siv o0.xyzw, position
+dcl_output o1.xyzw
+mov o0.xyz, v0.xyzx
+mov o0.w, l(1.000000)
+mov o1.xyzw, v1.xyzw
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_VS_ClearSint[] =
+{
+ 68, 88, 66, 67, 254, 10,
+ 228, 23, 109, 37, 56, 192,
+ 81, 175, 113, 148, 13, 249,
+ 236, 118, 1, 0, 0, 0,
+ 48, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 140, 0, 0, 0, 220, 0,
+ 0, 0, 48, 1, 0, 0,
+ 180, 1, 0, 0, 82, 68,
+ 69, 70, 80, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 254, 255, 0, 1, 0, 0,
+ 28, 0, 0, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102,
+ 116, 32, 40, 82, 41, 32,
+ 72, 76, 83, 76, 32, 83,
+ 104, 97, 100, 101, 114, 32,
+ 67, 111, 109, 112, 105, 108,
+ 101, 114, 32, 57, 46, 51,
+ 48, 46, 57, 50, 48, 48,
+ 46, 49, 54, 51, 56, 52,
+ 0, 171, 73, 83, 71, 78,
+ 72, 0, 0, 0, 2, 0,
+ 0, 0, 8, 0, 0, 0,
+ 56, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 7, 7, 0, 0,
+ 65, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 1, 0,
+ 0, 0, 15, 15, 0, 0,
+ 80, 79, 83, 73, 84, 73,
+ 79, 78, 0, 67, 79, 76,
+ 79, 82, 0, 171, 79, 83,
+ 71, 78, 76, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0,
+ 0, 0, 56, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 68, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 1, 0, 0, 0, 15, 0,
+ 0, 0, 83, 86, 95, 80,
+ 79, 83, 73, 84, 73, 79,
+ 78, 0, 67, 79, 76, 79,
+ 82, 0, 171, 171, 83, 72,
+ 68, 82, 124, 0, 0, 0,
+ 64, 0, 1, 0, 31, 0,
+ 0, 0, 95, 0, 0, 3,
+ 114, 16, 16, 0, 0, 0,
+ 0, 0, 95, 0, 0, 3,
+ 242, 16, 16, 0, 1, 0,
+ 0, 0, 103, 0, 0, 4,
+ 242, 32, 16, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 101, 0, 0, 3, 242, 32,
+ 16, 0, 1, 0, 0, 0,
+ 54, 0, 0, 5, 114, 32,
+ 16, 0, 0, 0, 0, 0,
+ 70, 18, 16, 0, 0, 0,
+ 0, 0, 54, 0, 0, 5,
+ 130, 32, 16, 0, 0, 0,
+ 0, 0, 1, 64, 0, 0,
+ 0, 0, 128, 63, 54, 0,
+ 0, 5, 242, 32, 16, 0,
+ 1, 0, 0, 0, 70, 30,
+ 16, 0, 1, 0, 0, 0,
+ 62, 0, 0, 1, 83, 84,
+ 65, 84, 116, 0, 0, 0,
+ 4, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 4, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/clearuint11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/clearuint11ps.h
new file mode 100644
index 00000000000..42a21f9a370
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/clearuint11ps.h
@@ -0,0 +1,196 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// COLOR 0 xyzw 1 NONE uint xyzw
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+// SV_TARGET 1 xyzw 1 TARGET uint xyzw
+// SV_TARGET 2 xyzw 2 TARGET uint xyzw
+// SV_TARGET 3 xyzw 3 TARGET uint xyzw
+// SV_TARGET 4 xyzw 4 TARGET uint xyzw
+// SV_TARGET 5 xyzw 5 TARGET uint xyzw
+// SV_TARGET 6 xyzw 6 TARGET uint xyzw
+// SV_TARGET 7 xyzw 7 TARGET uint xyzw
+//
+ps_4_0
+dcl_input_ps constant v1.xyzw
+dcl_output o0.xyzw
+dcl_output o1.xyzw
+dcl_output o2.xyzw
+dcl_output o3.xyzw
+dcl_output o4.xyzw
+dcl_output o5.xyzw
+dcl_output o6.xyzw
+dcl_output o7.xyzw
+mov o0.xyzw, v1.xyzw
+mov o1.xyzw, v1.xyzw
+mov o2.xyzw, v1.xyzw
+mov o3.xyzw, v1.xyzw
+mov o4.xyzw, v1.xyzw
+mov o5.xyzw, v1.xyzw
+mov o6.xyzw, v1.xyzw
+mov o7.xyzw, v1.xyzw
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_ClearUint[] =
+{
+ 68, 88, 66, 67, 199, 72,
+ 167, 165, 16, 175, 86, 185,
+ 38, 71, 2, 169, 180, 38,
+ 231, 204, 1, 0, 0, 0,
+ 88, 3, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 140, 0, 0, 0, 224, 0,
+ 0, 0, 188, 1, 0, 0,
+ 220, 2, 0, 0, 82, 68,
+ 69, 70, 80, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 28, 0, 0, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102,
+ 116, 32, 40, 82, 41, 32,
+ 72, 76, 83, 76, 32, 83,
+ 104, 97, 100, 101, 114, 32,
+ 67, 111, 109, 112, 105, 108,
+ 101, 114, 32, 57, 46, 51,
+ 48, 46, 57, 50, 48, 48,
+ 46, 49, 54, 51, 56, 52,
+ 0, 171, 73, 83, 71, 78,
+ 76, 0, 0, 0, 2, 0,
+ 0, 0, 8, 0, 0, 0,
+ 56, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 68, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 15, 15, 0, 0,
+ 83, 86, 95, 80, 79, 83,
+ 73, 84, 73, 79, 78, 0,
+ 67, 79, 76, 79, 82, 0,
+ 171, 171, 79, 83, 71, 78,
+ 212, 0, 0, 0, 8, 0,
+ 0, 0, 8, 0, 0, 0,
+ 200, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 200, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 15, 0, 0, 0,
+ 200, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 2, 0,
+ 0, 0, 15, 0, 0, 0,
+ 200, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 3, 0,
+ 0, 0, 15, 0, 0, 0,
+ 200, 0, 0, 0, 4, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 4, 0,
+ 0, 0, 15, 0, 0, 0,
+ 200, 0, 0, 0, 5, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 5, 0,
+ 0, 0, 15, 0, 0, 0,
+ 200, 0, 0, 0, 6, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 6, 0,
+ 0, 0, 15, 0, 0, 0,
+ 200, 0, 0, 0, 7, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 7, 0,
+ 0, 0, 15, 0, 0, 0,
+ 83, 86, 95, 84, 65, 82,
+ 71, 69, 84, 0, 171, 171,
+ 83, 72, 68, 82, 24, 1,
+ 0, 0, 64, 0, 0, 0,
+ 70, 0, 0, 0, 98, 8,
+ 0, 3, 242, 16, 16, 0,
+ 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0,
+ 0, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0,
+ 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0,
+ 2, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0,
+ 3, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0,
+ 4, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0,
+ 5, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0,
+ 6, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0,
+ 7, 0, 0, 0, 54, 0,
+ 0, 5, 242, 32, 16, 0,
+ 0, 0, 0, 0, 70, 30,
+ 16, 0, 1, 0, 0, 0,
+ 54, 0, 0, 5, 242, 32,
+ 16, 0, 1, 0, 0, 0,
+ 70, 30, 16, 0, 1, 0,
+ 0, 0, 54, 0, 0, 5,
+ 242, 32, 16, 0, 2, 0,
+ 0, 0, 70, 30, 16, 0,
+ 1, 0, 0, 0, 54, 0,
+ 0, 5, 242, 32, 16, 0,
+ 3, 0, 0, 0, 70, 30,
+ 16, 0, 1, 0, 0, 0,
+ 54, 0, 0, 5, 242, 32,
+ 16, 0, 4, 0, 0, 0,
+ 70, 30, 16, 0, 1, 0,
+ 0, 0, 54, 0, 0, 5,
+ 242, 32, 16, 0, 5, 0,
+ 0, 0, 70, 30, 16, 0,
+ 1, 0, 0, 0, 54, 0,
+ 0, 5, 242, 32, 16, 0,
+ 6, 0, 0, 0, 70, 30,
+ 16, 0, 1, 0, 0, 0,
+ 54, 0, 0, 5, 242, 32,
+ 16, 0, 7, 0, 0, 0,
+ 70, 30, 16, 0, 1, 0,
+ 0, 0, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0,
+ 0, 0, 9, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 9, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 9, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/clearuint11vs.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/clearuint11vs.h
new file mode 100644
index 00000000000..9fe00021f0e
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/clearuint11vs.h
@@ -0,0 +1,131 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// POSITION 0 xyz 0 NONE float xyz
+// COLOR 0 xyzw 1 NONE uint xyzw
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float xyzw
+// COLOR 0 xyzw 1 NONE uint xyzw
+//
+vs_4_0
+dcl_input v0.xyz
+dcl_input v1.xyzw
+dcl_output_siv o0.xyzw, position
+dcl_output o1.xyzw
+mov o0.xyz, v0.xyzx
+mov o0.w, l(1.000000)
+mov o1.xyzw, v1.xyzw
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_VS_ClearUint[] =
+{
+ 68, 88, 66, 67, 143, 217,
+ 8, 75, 126, 180, 129, 114,
+ 145, 192, 142, 211, 178, 208,
+ 255, 251, 1, 0, 0, 0,
+ 48, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 140, 0, 0, 0, 220, 0,
+ 0, 0, 48, 1, 0, 0,
+ 180, 1, 0, 0, 82, 68,
+ 69, 70, 80, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 254, 255, 0, 1, 0, 0,
+ 28, 0, 0, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102,
+ 116, 32, 40, 82, 41, 32,
+ 72, 76, 83, 76, 32, 83,
+ 104, 97, 100, 101, 114, 32,
+ 67, 111, 109, 112, 105, 108,
+ 101, 114, 32, 57, 46, 51,
+ 48, 46, 57, 50, 48, 48,
+ 46, 49, 54, 51, 56, 52,
+ 0, 171, 73, 83, 71, 78,
+ 72, 0, 0, 0, 2, 0,
+ 0, 0, 8, 0, 0, 0,
+ 56, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 7, 7, 0, 0,
+ 65, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 15, 15, 0, 0,
+ 80, 79, 83, 73, 84, 73,
+ 79, 78, 0, 67, 79, 76,
+ 79, 82, 0, 171, 79, 83,
+ 71, 78, 76, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0,
+ 0, 0, 56, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 68, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 15, 0,
+ 0, 0, 83, 86, 95, 80,
+ 79, 83, 73, 84, 73, 79,
+ 78, 0, 67, 79, 76, 79,
+ 82, 0, 171, 171, 83, 72,
+ 68, 82, 124, 0, 0, 0,
+ 64, 0, 1, 0, 31, 0,
+ 0, 0, 95, 0, 0, 3,
+ 114, 16, 16, 0, 0, 0,
+ 0, 0, 95, 0, 0, 3,
+ 242, 16, 16, 0, 1, 0,
+ 0, 0, 103, 0, 0, 4,
+ 242, 32, 16, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 101, 0, 0, 3, 242, 32,
+ 16, 0, 1, 0, 0, 0,
+ 54, 0, 0, 5, 114, 32,
+ 16, 0, 0, 0, 0, 0,
+ 70, 18, 16, 0, 0, 0,
+ 0, 0, 54, 0, 0, 5,
+ 130, 32, 16, 0, 0, 0,
+ 0, 0, 1, 64, 0, 0,
+ 0, 0, 128, 63, 54, 0,
+ 0, 5, 242, 32, 16, 0,
+ 1, 0, 0, 0, 70, 30,
+ 16, 0, 1, 0, 0, 0,
+ 62, 0, 0, 1, 83, 84,
+ 65, 84, 116, 0, 0, 0,
+ 4, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 4, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/passthrough11vs.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthrough2d11vs.h
index bbe1be9433b..e4e2c12b5d6 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/passthrough11vs.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthrough2d11vs.h
@@ -32,7 +32,7 @@ ret
// Approximately 4 instruction slots used
#endif
-const BYTE g_VS_Passthrough[] =
+const BYTE g_VS_Passthrough2D[] =
{
68, 88, 66, 67, 197, 214,
184, 85, 240, 94, 71, 48,
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthrough3d11gs.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthrough3d11gs.h
new file mode 100644
index 00000000000..6bf18125ba7
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthrough3d11gs.h
@@ -0,0 +1,192 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float xyzw
+// LAYER 0 x 1 NONE uint x
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float xyzw
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+gs_4_0
+dcl_input_siv v[3][0].xyzw, position
+dcl_input v[3][1].x
+dcl_input v[3][2].xyz
+dcl_temps 1
+dcl_inputprimitive triangle
+dcl_outputtopology trianglestrip
+dcl_output_siv o0.xyzw, position
+dcl_output_siv o1.x, rendertarget_array_index
+dcl_output o2.xyz
+dcl_maxout 3
+mov r0.x, l(0)
+loop
+ ige r0.y, r0.x, l(3)
+ breakc_nz r0.y
+ mov o0.xyzw, v[r0.x + 0][0].xyzw
+ mov o1.x, v[r0.x + 0][1].x
+ mov o2.xyz, v[r0.x + 0][2].xyzx
+ emit
+ iadd r0.x, r0.x, l(1)
+endloop
+ret
+// Approximately 11 instruction slots used
+#endif
+
+const BYTE g_GS_Passthrough3D[] =
+{
+ 68, 88, 66, 67, 21, 92,
+ 188, 203, 22, 49, 177, 239,
+ 121, 233, 148, 135, 212, 27,
+ 172, 209, 1, 0, 0, 0,
+ 72, 3, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 140, 0, 0, 0, 0, 1,
+ 0, 0, 136, 1, 0, 0,
+ 204, 2, 0, 0, 82, 68,
+ 69, 70, 80, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 83, 71, 0, 1, 0, 0,
+ 28, 0, 0, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102,
+ 116, 32, 40, 82, 41, 32,
+ 72, 76, 83, 76, 32, 83,
+ 104, 97, 100, 101, 114, 32,
+ 67, 111, 109, 112, 105, 108,
+ 101, 114, 32, 57, 46, 51,
+ 48, 46, 57, 50, 48, 48,
+ 46, 49, 54, 51, 56, 52,
+ 0, 171, 73, 83, 71, 78,
+ 108, 0, 0, 0, 3, 0,
+ 0, 0, 8, 0, 0, 0,
+ 80, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 15, 0, 0,
+ 92, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 1, 1, 0, 0,
+ 98, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0,
+ 0, 0, 7, 7, 0, 0,
+ 83, 86, 95, 80, 79, 83,
+ 73, 84, 73, 79, 78, 0,
+ 76, 65, 89, 69, 82, 0,
+ 84, 69, 88, 67, 79, 79,
+ 82, 68, 0, 171, 79, 83,
+ 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0,
+ 0, 0, 80, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0,
+ 0, 0, 0, 0, 4, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 1, 14,
+ 0, 0, 118, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 8,
+ 0, 0, 83, 86, 95, 80,
+ 79, 83, 73, 84, 73, 79,
+ 78, 0, 83, 86, 95, 82,
+ 69, 78, 68, 69, 82, 84,
+ 65, 82, 71, 69, 84, 65,
+ 82, 82, 65, 89, 73, 78,
+ 68, 69, 88, 0, 84, 69,
+ 88, 67, 79, 79, 82, 68,
+ 0, 171, 83, 72, 68, 82,
+ 60, 1, 0, 0, 64, 0,
+ 2, 0, 79, 0, 0, 0,
+ 97, 0, 0, 5, 242, 16,
+ 32, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 95, 0, 0, 4,
+ 18, 16, 32, 0, 3, 0,
+ 0, 0, 1, 0, 0, 0,
+ 95, 0, 0, 4, 114, 16,
+ 32, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 104, 0,
+ 0, 2, 1, 0, 0, 0,
+ 93, 24, 0, 1, 92, 40,
+ 0, 1, 103, 0, 0, 4,
+ 242, 32, 16, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 103, 0, 0, 4, 18, 32,
+ 16, 0, 1, 0, 0, 0,
+ 4, 0, 0, 0, 101, 0,
+ 0, 3, 114, 32, 16, 0,
+ 2, 0, 0, 0, 94, 0,
+ 0, 2, 3, 0, 0, 0,
+ 54, 0, 0, 5, 18, 0,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 48, 0, 0, 1,
+ 33, 0, 0, 7, 34, 0,
+ 16, 0, 0, 0, 0, 0,
+ 10, 0, 16, 0, 0, 0,
+ 0, 0, 1, 64, 0, 0,
+ 3, 0, 0, 0, 3, 0,
+ 4, 3, 26, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 7, 242, 32, 16, 0,
+ 0, 0, 0, 0, 70, 30,
+ 160, 0, 10, 0, 16, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 54, 0, 0, 7,
+ 18, 32, 16, 0, 1, 0,
+ 0, 0, 10, 16, 160, 0,
+ 10, 0, 16, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 54, 0, 0, 7, 114, 32,
+ 16, 0, 2, 0, 0, 0,
+ 70, 18, 160, 0, 10, 0,
+ 16, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 19, 0,
+ 0, 1, 30, 0, 0, 7,
+ 18, 0, 16, 0, 0, 0,
+ 0, 0, 10, 0, 16, 0,
+ 0, 0, 0, 0, 1, 64,
+ 0, 0, 1, 0, 0, 0,
+ 22, 0, 0, 1, 62, 0,
+ 0, 1, 83, 84, 65, 84,
+ 116, 0, 0, 0, 11, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 6, 0,
+ 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 12, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 5, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthrough3d11vs.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthrough3d11vs.h
new file mode 100644
index 00000000000..03097d2ad62
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthrough3d11vs.h
@@ -0,0 +1,156 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// POSITION 0 xy 0 NONE float xy
+// LAYER 0 x 1 NONE uint x
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float xyzw
+// LAYER 0 x 1 NONE uint x
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+vs_4_0
+dcl_input v0.xy
+dcl_input v1.x
+dcl_input v2.xyz
+dcl_output_siv o0.xyzw, position
+dcl_output o1.x
+dcl_output o2.xyz
+mov o0.xy, v0.xyxx
+mov o0.zw, l(0,0,0,1.000000)
+mov o1.x, v1.x
+mov o2.xyz, v2.xyzx
+ret
+// Approximately 5 instruction slots used
+#endif
+
+const BYTE g_VS_Passthrough3D[] =
+{
+ 68, 88, 66, 67, 92, 60,
+ 15, 188, 90, 157, 249, 215,
+ 202, 142, 58, 127, 103, 200,
+ 181, 87, 1, 0, 0, 0,
+ 168, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 140, 0, 0, 0, 252, 0,
+ 0, 0, 112, 1, 0, 0,
+ 44, 2, 0, 0, 82, 68,
+ 69, 70, 80, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 254, 255, 0, 1, 0, 0,
+ 28, 0, 0, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102,
+ 116, 32, 40, 82, 41, 32,
+ 72, 76, 83, 76, 32, 83,
+ 104, 97, 100, 101, 114, 32,
+ 67, 111, 109, 112, 105, 108,
+ 101, 114, 32, 57, 46, 51,
+ 48, 46, 57, 50, 48, 48,
+ 46, 49, 54, 51, 56, 52,
+ 0, 171, 73, 83, 71, 78,
+ 104, 0, 0, 0, 3, 0,
+ 0, 0, 8, 0, 0, 0,
+ 80, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 3, 3, 0, 0,
+ 89, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 1, 1, 0, 0,
+ 95, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0,
+ 0, 0, 7, 7, 0, 0,
+ 80, 79, 83, 73, 84, 73,
+ 79, 78, 0, 76, 65, 89,
+ 69, 82, 0, 84, 69, 88,
+ 67, 79, 79, 82, 68, 0,
+ 79, 83, 71, 78, 108, 0,
+ 0, 0, 3, 0, 0, 0,
+ 8, 0, 0, 0, 80, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 14, 0, 0, 98, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0,
+ 0, 0, 2, 0, 0, 0,
+ 7, 8, 0, 0, 83, 86,
+ 95, 80, 79, 83, 73, 84,
+ 73, 79, 78, 0, 76, 65,
+ 89, 69, 82, 0, 84, 69,
+ 88, 67, 79, 79, 82, 68,
+ 0, 171, 83, 72, 68, 82,
+ 180, 0, 0, 0, 64, 0,
+ 1, 0, 45, 0, 0, 0,
+ 95, 0, 0, 3, 50, 16,
+ 16, 0, 0, 0, 0, 0,
+ 95, 0, 0, 3, 18, 16,
+ 16, 0, 1, 0, 0, 0,
+ 95, 0, 0, 3, 114, 16,
+ 16, 0, 2, 0, 0, 0,
+ 103, 0, 0, 4, 242, 32,
+ 16, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 101, 0,
+ 0, 3, 18, 32, 16, 0,
+ 1, 0, 0, 0, 101, 0,
+ 0, 3, 114, 32, 16, 0,
+ 2, 0, 0, 0, 54, 0,
+ 0, 5, 50, 32, 16, 0,
+ 0, 0, 0, 0, 70, 16,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 8, 194, 32,
+ 16, 0, 0, 0, 0, 0,
+ 2, 64, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 128, 63, 54, 0, 0, 5,
+ 18, 32, 16, 0, 1, 0,
+ 0, 0, 10, 16, 16, 0,
+ 1, 0, 0, 0, 54, 0,
+ 0, 5, 114, 32, 16, 0,
+ 2, 0, 0, 0, 70, 18,
+ 16, 0, 2, 0, 0, 0,
+ 62, 0, 0, 1, 83, 84,
+ 65, 84, 116, 0, 0, 0,
+ 5, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 6, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 5, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughdepth2d11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughdepth2d11ps.h
new file mode 100644
index 00000000000..d9864c665d4
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughdepth2d11ps.h
@@ -0,0 +1,146 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_DEPTH 0 N/A oDepth DEPTH float YES
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output oDepth
+dcl_temps 1
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mov oDepth, r0.x
+ret
+// Approximately 3 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughDepth2D[] =
+{
+ 68, 88, 66, 67, 205, 127,
+ 148, 170, 168, 91, 194, 133,
+ 180, 181, 17, 51, 13, 53,
+ 48, 72, 1, 0, 0, 0,
+ 100, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 220, 0, 0, 0, 52, 1,
+ 0, 0, 104, 1, 0, 0,
+ 232, 1, 0, 0, 82, 68,
+ 69, 70, 160, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 109, 0, 0, 0, 92, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0,
+ 100, 0, 0, 0, 2, 0,
+ 0, 0, 5, 0, 0, 0,
+ 4, 0, 0, 0, 255, 255,
+ 255, 255, 0, 0, 0, 0,
+ 1, 0, 0, 0, 13, 0,
+ 0, 0, 83, 97, 109, 112,
+ 108, 101, 114, 0, 84, 101,
+ 120, 116, 117, 114, 101, 70,
+ 0, 77, 105, 99, 114, 111,
+ 115, 111, 102, 116, 32, 40,
+ 82, 41, 32, 72, 76, 83,
+ 76, 32, 83, 104, 97, 100,
+ 101, 114, 32, 67, 111, 109,
+ 112, 105, 108, 101, 114, 32,
+ 57, 46, 51, 48, 46, 57,
+ 50, 48, 48, 46, 49, 54,
+ 51, 56, 52, 0, 73, 83,
+ 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0,
+ 0, 0, 56, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 68, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 1, 0, 0, 0, 3, 3,
+ 0, 0, 83, 86, 95, 80,
+ 79, 83, 73, 84, 73, 79,
+ 78, 0, 84, 69, 88, 67,
+ 79, 79, 82, 68, 0, 171,
+ 171, 171, 79, 83, 71, 78,
+ 44, 0, 0, 0, 1, 0,
+ 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 255, 255,
+ 255, 255, 1, 14, 0, 0,
+ 83, 86, 95, 68, 69, 80,
+ 84, 72, 0, 171, 171, 171,
+ 83, 72, 68, 82, 120, 0,
+ 0, 0, 64, 0, 0, 0,
+ 30, 0, 0, 0, 90, 0,
+ 0, 3, 0, 96, 16, 0,
+ 0, 0, 0, 0, 88, 24,
+ 0, 4, 0, 112, 16, 0,
+ 0, 0, 0, 0, 85, 85,
+ 0, 0, 98, 16, 0, 3,
+ 50, 16, 16, 0, 1, 0,
+ 0, 0, 101, 0, 0, 2,
+ 1, 192, 0, 0, 104, 0,
+ 0, 2, 1, 0, 0, 0,
+ 69, 0, 0, 9, 242, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 16, 16, 0, 1, 0,
+ 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 0, 96,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 4, 1, 192,
+ 0, 0, 10, 0, 16, 0,
+ 0, 0, 0, 0, 62, 0,
+ 0, 1, 83, 84, 65, 84,
+ 116, 0, 0, 0, 3, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/passthroughlum11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughlum2d11ps.h
index 73c4892cab6..141b183a50f 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/passthroughlum11ps.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughlum2d11ps.h
@@ -9,7 +9,7 @@
// Name Type Format Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// Sampler sampler NA NA 0 1
-// Texture texture float4 2d 0 1
+// TextureF texture float4 2d 0 1
//
//
//
@@ -40,12 +40,12 @@ ret
// Approximately 4 instruction slots used
#endif
-const BYTE g_PS_PassthroughLum[] =
+const BYTE g_PS_PassthroughLum2D[] =
{
- 68, 88, 66, 67, 244, 9,
- 213, 147, 19, 249, 70, 111,
- 157, 92, 243, 160, 40, 144,
- 238, 221, 1, 0, 0, 0,
+ 68, 88, 66, 67, 75, 65,
+ 224, 54, 123, 121, 78, 132,
+ 180, 89, 93, 146, 31, 209,
+ 114, 35, 1, 0, 0, 0,
128, 2, 0, 0, 5, 0,
0, 0, 52, 0, 0, 0,
220, 0, 0, 0, 52, 1,
@@ -56,7 +56,7 @@ const BYTE g_PS_PassthroughLum[] =
0, 0, 2, 0, 0, 0,
28, 0, 0, 0, 0, 4,
255, 255, 0, 1, 0, 0,
- 108, 0, 0, 0, 92, 0,
+ 109, 0, 0, 0, 92, 0,
0, 0, 3, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
@@ -69,16 +69,16 @@ const BYTE g_PS_PassthroughLum[] =
1, 0, 0, 0, 13, 0,
0, 0, 83, 97, 109, 112,
108, 101, 114, 0, 84, 101,
- 120, 116, 117, 114, 101, 0,
- 77, 105, 99, 114, 111, 115,
- 111, 102, 116, 32, 40, 82,
- 41, 32, 72, 76, 83, 76,
- 32, 83, 104, 97, 100, 101,
- 114, 32, 67, 111, 109, 112,
- 105, 108, 101, 114, 32, 57,
- 46, 51, 48, 46, 57, 50,
- 48, 48, 46, 49, 54, 51,
- 56, 52, 0, 171, 73, 83,
+ 120, 116, 117, 114, 101, 70,
+ 0, 77, 105, 99, 114, 111,
+ 115, 111, 102, 116, 32, 40,
+ 82, 41, 32, 72, 76, 83,
+ 76, 32, 83, 104, 97, 100,
+ 101, 114, 32, 67, 111, 109,
+ 112, 105, 108, 101, 114, 32,
+ 57, 46, 51, 48, 46, 57,
+ 50, 48, 48, 46, 49, 54,
+ 51, 56, 52, 0, 73, 83,
71, 78, 80, 0, 0, 0,
2, 0, 0, 0, 8, 0,
0, 0, 56, 0, 0, 0,
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughlum3d11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughlum3d11ps.h
new file mode 100644
index 00000000000..df25c15a966
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughlum3d11ps.h
@@ -0,0 +1,161 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mov o0.xyz, r0.xxxx
+mov o0.w, l(1.000000)
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughLum3D[] =
+{
+ 68, 88, 66, 67, 139, 183,
+ 126, 70, 59, 171, 117, 78,
+ 58, 168, 253, 206, 241, 67,
+ 236, 117, 1, 0, 0, 0,
+ 176, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 220, 0, 0, 0, 100, 1,
+ 0, 0, 152, 1, 0, 0,
+ 52, 2, 0, 0, 82, 68,
+ 69, 70, 160, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 109, 0, 0, 0, 92, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0,
+ 100, 0, 0, 0, 2, 0,
+ 0, 0, 5, 0, 0, 0,
+ 8, 0, 0, 0, 255, 255,
+ 255, 255, 0, 0, 0, 0,
+ 1, 0, 0, 0, 13, 0,
+ 0, 0, 83, 97, 109, 112,
+ 108, 101, 114, 0, 84, 101,
+ 120, 116, 117, 114, 101, 70,
+ 0, 77, 105, 99, 114, 111,
+ 115, 111, 102, 116, 32, 40,
+ 82, 41, 32, 72, 76, 83,
+ 76, 32, 83, 104, 97, 100,
+ 101, 114, 32, 67, 111, 109,
+ 112, 105, 108, 101, 114, 32,
+ 57, 46, 51, 48, 46, 57,
+ 50, 48, 48, 46, 49, 54,
+ 51, 56, 52, 0, 73, 83,
+ 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0,
+ 0, 0, 80, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0,
+ 0, 0, 0, 0, 4, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 118, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7,
+ 0, 0, 83, 86, 95, 80,
+ 79, 83, 73, 84, 73, 79,
+ 78, 0, 83, 86, 95, 82,
+ 69, 78, 68, 69, 82, 84,
+ 65, 82, 71, 69, 84, 65,
+ 82, 82, 65, 89, 73, 78,
+ 68, 69, 88, 0, 84, 69,
+ 88, 67, 79, 79, 82, 68,
+ 0, 171, 79, 83, 71, 78,
+ 44, 0, 0, 0, 1, 0,
+ 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 83, 86, 95, 84, 65, 82,
+ 71, 69, 84, 0, 171, 171,
+ 83, 72, 68, 82, 148, 0,
+ 0, 0, 64, 0, 0, 0,
+ 37, 0, 0, 0, 90, 0,
+ 0, 3, 0, 96, 16, 0,
+ 0, 0, 0, 0, 88, 40,
+ 0, 4, 0, 112, 16, 0,
+ 0, 0, 0, 0, 85, 85,
+ 0, 0, 98, 16, 0, 3,
+ 114, 16, 16, 0, 2, 0,
+ 0, 0, 101, 0, 0, 3,
+ 242, 32, 16, 0, 0, 0,
+ 0, 0, 104, 0, 0, 2,
+ 1, 0, 0, 0, 69, 0,
+ 0, 9, 242, 0, 16, 0,
+ 0, 0, 0, 0, 70, 18,
+ 16, 0, 2, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0,
+ 0, 0, 0, 96, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 5, 114, 32, 16, 0,
+ 0, 0, 0, 0, 6, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 5, 130, 32,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 128, 63, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0,
+ 0, 0, 4, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/passthroughlumalpha11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughlumalpha2d11ps.h
index 90007ef7d58..ad7efb3afc2 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/passthroughlumalpha11ps.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughlumalpha2d11ps.h
@@ -9,7 +9,7 @@
// Name Type Format Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// Sampler sampler NA NA 0 1
-// Texture texture float4 2d 0 1
+// TextureF texture float4 2d 0 1
//
//
//
@@ -39,12 +39,12 @@ ret
// Approximately 3 instruction slots used
#endif
-const BYTE g_PS_PassthroughLumAlpha[] =
+const BYTE g_PS_PassthroughLumAlpha2D[] =
{
- 68, 88, 66, 67, 185, 14,
- 84, 223, 192, 42, 16, 133,
- 46, 100, 95, 221, 183, 97,
- 192, 23, 1, 0, 0, 0,
+ 68, 88, 66, 67, 211, 12,
+ 122, 206, 209, 255, 137, 132,
+ 163, 164, 87, 202, 31, 60,
+ 79, 244, 1, 0, 0, 0,
108, 2, 0, 0, 5, 0,
0, 0, 52, 0, 0, 0,
220, 0, 0, 0, 52, 1,
@@ -55,7 +55,7 @@ const BYTE g_PS_PassthroughLumAlpha[] =
0, 0, 2, 0, 0, 0,
28, 0, 0, 0, 0, 4,
255, 255, 0, 1, 0, 0,
- 108, 0, 0, 0, 92, 0,
+ 109, 0, 0, 0, 92, 0,
0, 0, 3, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
@@ -68,16 +68,16 @@ const BYTE g_PS_PassthroughLumAlpha[] =
1, 0, 0, 0, 13, 0,
0, 0, 83, 97, 109, 112,
108, 101, 114, 0, 84, 101,
- 120, 116, 117, 114, 101, 0,
- 77, 105, 99, 114, 111, 115,
- 111, 102, 116, 32, 40, 82,
- 41, 32, 72, 76, 83, 76,
- 32, 83, 104, 97, 100, 101,
- 114, 32, 67, 111, 109, 112,
- 105, 108, 101, 114, 32, 57,
- 46, 51, 48, 46, 57, 50,
- 48, 48, 46, 49, 54, 51,
- 56, 52, 0, 171, 73, 83,
+ 120, 116, 117, 114, 101, 70,
+ 0, 77, 105, 99, 114, 111,
+ 115, 111, 102, 116, 32, 40,
+ 82, 41, 32, 72, 76, 83,
+ 76, 32, 83, 104, 97, 100,
+ 101, 114, 32, 67, 111, 109,
+ 112, 105, 108, 101, 114, 32,
+ 57, 46, 51, 48, 46, 57,
+ 50, 48, 48, 46, 49, 54,
+ 51, 56, 52, 0, 73, 83,
71, 78, 80, 0, 0, 0,
2, 0, 0, 0, 8, 0,
0, 0, 56, 0, 0, 0,
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughlumalpha3d11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughlumalpha3d11ps.h
new file mode 100644
index 00000000000..6a3093b965f
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughlumalpha3d11ps.h
@@ -0,0 +1,157 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mov o0.xyzw, r0.xxxw
+ret
+// Approximately 3 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughLumAlpha3D[] =
+{
+ 68, 88, 66, 67, 79, 152,
+ 38, 183, 191, 232, 234, 74,
+ 20, 216, 159, 98, 130, 89,
+ 67, 230, 1, 0, 0, 0,
+ 156, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 220, 0, 0, 0, 100, 1,
+ 0, 0, 152, 1, 0, 0,
+ 32, 2, 0, 0, 82, 68,
+ 69, 70, 160, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 109, 0, 0, 0, 92, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0,
+ 100, 0, 0, 0, 2, 0,
+ 0, 0, 5, 0, 0, 0,
+ 8, 0, 0, 0, 255, 255,
+ 255, 255, 0, 0, 0, 0,
+ 1, 0, 0, 0, 13, 0,
+ 0, 0, 83, 97, 109, 112,
+ 108, 101, 114, 0, 84, 101,
+ 120, 116, 117, 114, 101, 70,
+ 0, 77, 105, 99, 114, 111,
+ 115, 111, 102, 116, 32, 40,
+ 82, 41, 32, 72, 76, 83,
+ 76, 32, 83, 104, 97, 100,
+ 101, 114, 32, 67, 111, 109,
+ 112, 105, 108, 101, 114, 32,
+ 57, 46, 51, 48, 46, 57,
+ 50, 48, 48, 46, 49, 54,
+ 51, 56, 52, 0, 73, 83,
+ 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0,
+ 0, 0, 80, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0,
+ 0, 0, 0, 0, 4, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 118, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7,
+ 0, 0, 83, 86, 95, 80,
+ 79, 83, 73, 84, 73, 79,
+ 78, 0, 83, 86, 95, 82,
+ 69, 78, 68, 69, 82, 84,
+ 65, 82, 71, 69, 84, 65,
+ 82, 82, 65, 89, 73, 78,
+ 68, 69, 88, 0, 84, 69,
+ 88, 67, 79, 79, 82, 68,
+ 0, 171, 79, 83, 71, 78,
+ 44, 0, 0, 0, 1, 0,
+ 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 83, 86, 95, 84, 65, 82,
+ 71, 69, 84, 0, 171, 171,
+ 83, 72, 68, 82, 128, 0,
+ 0, 0, 64, 0, 0, 0,
+ 32, 0, 0, 0, 90, 0,
+ 0, 3, 0, 96, 16, 0,
+ 0, 0, 0, 0, 88, 40,
+ 0, 4, 0, 112, 16, 0,
+ 0, 0, 0, 0, 85, 85,
+ 0, 0, 98, 16, 0, 3,
+ 114, 16, 16, 0, 2, 0,
+ 0, 0, 101, 0, 0, 3,
+ 242, 32, 16, 0, 0, 0,
+ 0, 0, 104, 0, 0, 2,
+ 1, 0, 0, 0, 69, 0,
+ 0, 9, 242, 0, 16, 0,
+ 0, 0, 0, 0, 70, 18,
+ 16, 0, 2, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0,
+ 0, 0, 0, 96, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 5, 242, 32, 16, 0,
+ 0, 0, 0, 0, 6, 12,
+ 16, 0, 0, 0, 0, 0,
+ 62, 0, 0, 1, 83, 84,
+ 65, 84, 116, 0, 0, 0,
+ 3, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughr2d11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughr2d11ps.h
new file mode 100644
index 00000000000..ba802a8f167
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughr2d11ps.h
@@ -0,0 +1,154 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mov o0.x, r0.x
+mov o0.yzw, l(0,0,0,1.000000)
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughR2D[] =
+{
+ 68, 88, 66, 67, 165, 241,
+ 169, 123, 72, 216, 126, 110,
+ 212, 26, 98, 247, 42, 20,
+ 73, 129, 1, 0, 0, 0,
+ 140, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 220, 0, 0, 0, 52, 1,
+ 0, 0, 104, 1, 0, 0,
+ 16, 2, 0, 0, 82, 68,
+ 69, 70, 160, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 109, 0, 0, 0, 92, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0,
+ 100, 0, 0, 0, 2, 0,
+ 0, 0, 5, 0, 0, 0,
+ 4, 0, 0, 0, 255, 255,
+ 255, 255, 0, 0, 0, 0,
+ 1, 0, 0, 0, 13, 0,
+ 0, 0, 83, 97, 109, 112,
+ 108, 101, 114, 0, 84, 101,
+ 120, 116, 117, 114, 101, 70,
+ 0, 77, 105, 99, 114, 111,
+ 115, 111, 102, 116, 32, 40,
+ 82, 41, 32, 72, 76, 83,
+ 76, 32, 83, 104, 97, 100,
+ 101, 114, 32, 67, 111, 109,
+ 112, 105, 108, 101, 114, 32,
+ 57, 46, 51, 48, 46, 57,
+ 50, 48, 48, 46, 49, 54,
+ 51, 56, 52, 0, 73, 83,
+ 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0,
+ 0, 0, 56, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 68, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 1, 0, 0, 0, 3, 3,
+ 0, 0, 83, 86, 95, 80,
+ 79, 83, 73, 84, 73, 79,
+ 78, 0, 84, 69, 88, 67,
+ 79, 79, 82, 68, 0, 171,
+ 171, 171, 79, 83, 71, 78,
+ 44, 0, 0, 0, 1, 0,
+ 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 83, 86, 95, 84, 65, 82,
+ 71, 69, 84, 0, 171, 171,
+ 83, 72, 68, 82, 160, 0,
+ 0, 0, 64, 0, 0, 0,
+ 40, 0, 0, 0, 90, 0,
+ 0, 3, 0, 96, 16, 0,
+ 0, 0, 0, 0, 88, 24,
+ 0, 4, 0, 112, 16, 0,
+ 0, 0, 0, 0, 85, 85,
+ 0, 0, 98, 16, 0, 3,
+ 50, 16, 16, 0, 1, 0,
+ 0, 0, 101, 0, 0, 3,
+ 242, 32, 16, 0, 0, 0,
+ 0, 0, 104, 0, 0, 2,
+ 1, 0, 0, 0, 69, 0,
+ 0, 9, 242, 0, 16, 0,
+ 0, 0, 0, 0, 70, 16,
+ 16, 0, 1, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0,
+ 0, 0, 0, 96, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 5, 18, 32, 16, 0,
+ 0, 0, 0, 0, 10, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 8, 226, 32,
+ 16, 0, 0, 0, 0, 0,
+ 2, 64, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 128, 63, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0,
+ 0, 0, 4, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughr2di11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughr2di11ps.h
new file mode 100644
index 00000000000..78d780989a2
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughr2di11ps.h
@@ -0,0 +1,168 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI texture sint4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_resource_texture2d (sint,sint,sint,sint) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.x, r0.x
+mov o0.yzw, l(0,0,0,0)
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughR2DI[] =
+{
+ 68, 88, 66, 67, 175, 34,
+ 58, 63, 77, 138, 186, 41,
+ 33, 239, 107, 231, 51, 122,
+ 194, 229, 1, 0, 0, 0,
+ 208, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 180, 0, 0, 0, 12, 1,
+ 0, 0, 64, 1, 0, 0,
+ 84, 2, 0, 0, 82, 68,
+ 69, 70, 120, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 69, 0, 0, 0, 60, 0,
+ 0, 0, 2, 0, 0, 0,
+ 3, 0, 0, 0, 4, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0,
+ 84, 101, 120, 116, 117, 114,
+ 101, 73, 0, 77, 105, 99,
+ 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72,
+ 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67,
+ 111, 109, 112, 105, 108, 101,
+ 114, 32, 57, 46, 51, 48,
+ 46, 57, 50, 48, 48, 46,
+ 49, 54, 51, 56, 52, 0,
+ 73, 83, 71, 78, 80, 0,
+ 0, 0, 2, 0, 0, 0,
+ 8, 0, 0, 0, 56, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 68, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0,
+ 0, 0, 1, 0, 0, 0,
+ 3, 3, 0, 0, 83, 86,
+ 95, 80, 79, 83, 73, 84,
+ 73, 79, 78, 0, 84, 69,
+ 88, 67, 79, 79, 82, 68,
+ 0, 171, 171, 171, 79, 83,
+ 71, 78, 44, 0, 0, 0,
+ 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 83, 86, 95, 84,
+ 65, 82, 71, 69, 84, 0,
+ 171, 171, 83, 72, 68, 82,
+ 12, 1, 0, 0, 64, 0,
+ 0, 0, 67, 0, 0, 0,
+ 88, 24, 0, 4, 0, 112,
+ 16, 0, 0, 0, 0, 0,
+ 51, 51, 0, 0, 98, 16,
+ 0, 3, 50, 16, 16, 0,
+ 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0,
+ 0, 0, 0, 0, 104, 0,
+ 0, 2, 1, 0, 0, 0,
+ 61, 16, 0, 7, 242, 0,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 86, 0,
+ 0, 5, 50, 0, 16, 0,
+ 0, 0, 0, 0, 70, 0,
+ 16, 0, 0, 0, 0, 0,
+ 56, 0, 0, 7, 50, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 0, 16, 0, 0, 0,
+ 0, 0, 70, 16, 16, 0,
+ 1, 0, 0, 0, 27, 0,
+ 0, 5, 50, 0, 16, 0,
+ 0, 0, 0, 0, 70, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 8, 194, 0,
+ 16, 0, 0, 0, 0, 0,
+ 2, 64, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 45, 0, 0, 7,
+ 242, 0, 16, 0, 0, 0,
+ 0, 0, 70, 14, 16, 0,
+ 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 5, 18, 32,
+ 16, 0, 0, 0, 0, 0,
+ 10, 0, 16, 0, 0, 0,
+ 0, 0, 54, 0, 0, 8,
+ 226, 32, 16, 0, 0, 0,
+ 0, 0, 2, 64, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 62, 0,
+ 0, 1, 83, 84, 65, 84,
+ 116, 0, 0, 0, 9, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughr2dui11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughr2dui11ps.h
new file mode 100644
index 00000000000..db32b558ea9
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughr2dui11ps.h
@@ -0,0 +1,169 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI texture uint4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_resource_texture2d (uint,uint,uint,uint) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.x, r0.x
+mov o0.yzw, l(0,0,0,0)
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughR2DUI[] =
+{
+ 68, 88, 66, 67, 166, 175,
+ 86, 113, 175, 196, 222, 119,
+ 102, 108, 1, 17, 158, 88,
+ 24, 124, 1, 0, 0, 0,
+ 212, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 184, 0, 0, 0, 16, 1,
+ 0, 0, 68, 1, 0, 0,
+ 88, 2, 0, 0, 82, 68,
+ 69, 70, 124, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 70, 0, 0, 0, 60, 0,
+ 0, 0, 2, 0, 0, 0,
+ 4, 0, 0, 0, 4, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0,
+ 84, 101, 120, 116, 117, 114,
+ 101, 85, 73, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102,
+ 116, 32, 40, 82, 41, 32,
+ 72, 76, 83, 76, 32, 83,
+ 104, 97, 100, 101, 114, 32,
+ 67, 111, 109, 112, 105, 108,
+ 101, 114, 32, 57, 46, 51,
+ 48, 46, 57, 50, 48, 48,
+ 46, 49, 54, 51, 56, 52,
+ 0, 171, 171, 171, 73, 83,
+ 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0,
+ 0, 0, 56, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 68, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 1, 0, 0, 0, 3, 3,
+ 0, 0, 83, 86, 95, 80,
+ 79, 83, 73, 84, 73, 79,
+ 78, 0, 84, 69, 88, 67,
+ 79, 79, 82, 68, 0, 171,
+ 171, 171, 79, 83, 71, 78,
+ 44, 0, 0, 0, 1, 0,
+ 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 83, 86, 95, 84, 65, 82,
+ 71, 69, 84, 0, 171, 171,
+ 83, 72, 68, 82, 12, 1,
+ 0, 0, 64, 0, 0, 0,
+ 67, 0, 0, 0, 88, 24,
+ 0, 4, 0, 112, 16, 0,
+ 0, 0, 0, 0, 68, 68,
+ 0, 0, 98, 16, 0, 3,
+ 50, 16, 16, 0, 1, 0,
+ 0, 0, 101, 0, 0, 3,
+ 242, 32, 16, 0, 0, 0,
+ 0, 0, 104, 0, 0, 2,
+ 1, 0, 0, 0, 61, 16,
+ 0, 7, 242, 0, 16, 0,
+ 0, 0, 0, 0, 1, 64,
+ 0, 0, 0, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0,
+ 0, 0, 86, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0,
+ 0, 0, 70, 0, 16, 0,
+ 0, 0, 0, 0, 56, 0,
+ 0, 7, 50, 0, 16, 0,
+ 0, 0, 0, 0, 70, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 16, 16, 0, 1, 0,
+ 0, 0, 27, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0,
+ 0, 0, 70, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 8, 194, 0, 16, 0,
+ 0, 0, 0, 0, 2, 64,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 45, 0, 0, 7, 242, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 14, 16, 0, 0, 0,
+ 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 5, 18, 32, 16, 0,
+ 0, 0, 0, 0, 10, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 8, 226, 32,
+ 16, 0, 0, 0, 0, 0,
+ 2, 64, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0,
+ 0, 0, 9, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughr3d11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughr3d11ps.h
new file mode 100644
index 00000000000..317502be72f
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughr3d11ps.h
@@ -0,0 +1,163 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mov o0.x, r0.x
+mov o0.yzw, l(0,0,0,1.000000)
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughR3D[] =
+{
+ 68, 88, 66, 67, 154, 126,
+ 157, 110, 55, 22, 118, 195,
+ 222, 16, 4, 44, 4, 186,
+ 175, 193, 1, 0, 0, 0,
+ 188, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 220, 0, 0, 0, 100, 1,
+ 0, 0, 152, 1, 0, 0,
+ 64, 2, 0, 0, 82, 68,
+ 69, 70, 160, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 109, 0, 0, 0, 92, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0,
+ 100, 0, 0, 0, 2, 0,
+ 0, 0, 5, 0, 0, 0,
+ 8, 0, 0, 0, 255, 255,
+ 255, 255, 0, 0, 0, 0,
+ 1, 0, 0, 0, 13, 0,
+ 0, 0, 83, 97, 109, 112,
+ 108, 101, 114, 0, 84, 101,
+ 120, 116, 117, 114, 101, 70,
+ 0, 77, 105, 99, 114, 111,
+ 115, 111, 102, 116, 32, 40,
+ 82, 41, 32, 72, 76, 83,
+ 76, 32, 83, 104, 97, 100,
+ 101, 114, 32, 67, 111, 109,
+ 112, 105, 108, 101, 114, 32,
+ 57, 46, 51, 48, 46, 57,
+ 50, 48, 48, 46, 49, 54,
+ 51, 56, 52, 0, 73, 83,
+ 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0,
+ 0, 0, 80, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0,
+ 0, 0, 0, 0, 4, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 118, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7,
+ 0, 0, 83, 86, 95, 80,
+ 79, 83, 73, 84, 73, 79,
+ 78, 0, 83, 86, 95, 82,
+ 69, 78, 68, 69, 82, 84,
+ 65, 82, 71, 69, 84, 65,
+ 82, 82, 65, 89, 73, 78,
+ 68, 69, 88, 0, 84, 69,
+ 88, 67, 79, 79, 82, 68,
+ 0, 171, 79, 83, 71, 78,
+ 44, 0, 0, 0, 1, 0,
+ 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 83, 86, 95, 84, 65, 82,
+ 71, 69, 84, 0, 171, 171,
+ 83, 72, 68, 82, 160, 0,
+ 0, 0, 64, 0, 0, 0,
+ 40, 0, 0, 0, 90, 0,
+ 0, 3, 0, 96, 16, 0,
+ 0, 0, 0, 0, 88, 40,
+ 0, 4, 0, 112, 16, 0,
+ 0, 0, 0, 0, 85, 85,
+ 0, 0, 98, 16, 0, 3,
+ 114, 16, 16, 0, 2, 0,
+ 0, 0, 101, 0, 0, 3,
+ 242, 32, 16, 0, 0, 0,
+ 0, 0, 104, 0, 0, 2,
+ 1, 0, 0, 0, 69, 0,
+ 0, 9, 242, 0, 16, 0,
+ 0, 0, 0, 0, 70, 18,
+ 16, 0, 2, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0,
+ 0, 0, 0, 96, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 5, 18, 32, 16, 0,
+ 0, 0, 0, 0, 10, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 8, 226, 32,
+ 16, 0, 0, 0, 0, 0,
+ 2, 64, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 128, 63, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0,
+ 0, 0, 4, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughr3di11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughr3di11ps.h
new file mode 100644
index 00000000000..f6c44744e84
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughr3di11ps.h
@@ -0,0 +1,175 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI texture sint4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_resource_texture3d (sint,sint,sint,sint) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xyz, r0.xyzx
+mul r0.xyz, r0.xyzx, v2.xyzx
+ftoi r0.xyz, r0.xyzx
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.x, r0.x
+mov o0.yzw, l(0,0,0,0)
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughR3DI[] =
+{
+ 68, 88, 66, 67, 32, 229,
+ 168, 57, 179, 12, 205, 158,
+ 146, 39, 161, 133, 6, 137,
+ 250, 121, 1, 0, 0, 0,
+ 244, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 180, 0, 0, 0, 60, 1,
+ 0, 0, 112, 1, 0, 0,
+ 120, 2, 0, 0, 82, 68,
+ 69, 70, 120, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 69, 0, 0, 0, 60, 0,
+ 0, 0, 2, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0,
+ 84, 101, 120, 116, 117, 114,
+ 101, 73, 0, 77, 105, 99,
+ 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72,
+ 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67,
+ 111, 109, 112, 105, 108, 101,
+ 114, 32, 57, 46, 51, 48,
+ 46, 57, 50, 48, 48, 46,
+ 49, 54, 51, 56, 52, 0,
+ 73, 83, 71, 78, 128, 0,
+ 0, 0, 3, 0, 0, 0,
+ 8, 0, 0, 0, 80, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 118, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0,
+ 0, 0, 2, 0, 0, 0,
+ 7, 7, 0, 0, 83, 86,
+ 95, 80, 79, 83, 73, 84,
+ 73, 79, 78, 0, 83, 86,
+ 95, 82, 69, 78, 68, 69,
+ 82, 84, 65, 82, 71, 69,
+ 84, 65, 82, 82, 65, 89,
+ 73, 78, 68, 69, 88, 0,
+ 84, 69, 88, 67, 79, 79,
+ 82, 68, 0, 171, 79, 83,
+ 71, 78, 44, 0, 0, 0,
+ 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 83, 86, 95, 84,
+ 65, 82, 71, 69, 84, 0,
+ 171, 171, 83, 72, 68, 82,
+ 0, 1, 0, 0, 64, 0,
+ 0, 0, 64, 0, 0, 0,
+ 88, 40, 0, 4, 0, 112,
+ 16, 0, 0, 0, 0, 0,
+ 51, 51, 0, 0, 98, 16,
+ 0, 3, 114, 16, 16, 0,
+ 2, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0,
+ 0, 0, 0, 0, 104, 0,
+ 0, 2, 1, 0, 0, 0,
+ 61, 16, 0, 7, 242, 0,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 86, 0,
+ 0, 5, 114, 0, 16, 0,
+ 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0,
+ 56, 0, 0, 7, 114, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 2, 16, 0, 0, 0,
+ 0, 0, 70, 18, 16, 0,
+ 2, 0, 0, 0, 27, 0,
+ 0, 5, 114, 0, 16, 0,
+ 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 5, 130, 0,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 45, 0, 0, 7,
+ 242, 0, 16, 0, 0, 0,
+ 0, 0, 70, 14, 16, 0,
+ 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 5, 18, 32,
+ 16, 0, 0, 0, 0, 0,
+ 10, 0, 16, 0, 0, 0,
+ 0, 0, 54, 0, 0, 8,
+ 226, 32, 16, 0, 0, 0,
+ 0, 0, 2, 64, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 62, 0,
+ 0, 1, 83, 84, 65, 84,
+ 116, 0, 0, 0, 9, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughr3dui11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughr3dui11ps.h
new file mode 100644
index 00000000000..56c10c6c140
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughr3dui11ps.h
@@ -0,0 +1,176 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI texture uint4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_resource_texture3d (uint,uint,uint,uint) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xyz, r0.xyzx
+mul r0.xyz, r0.xyzx, v2.xyzx
+ftoi r0.xyz, r0.xyzx
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.x, r0.x
+mov o0.yzw, l(0,0,0,0)
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughR3DUI[] =
+{
+ 68, 88, 66, 67, 8, 69,
+ 203, 31, 19, 83, 247, 164,
+ 150, 170, 250, 231, 193, 198,
+ 155, 234, 1, 0, 0, 0,
+ 248, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 184, 0, 0, 0, 64, 1,
+ 0, 0, 116, 1, 0, 0,
+ 124, 2, 0, 0, 82, 68,
+ 69, 70, 124, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 70, 0, 0, 0, 60, 0,
+ 0, 0, 2, 0, 0, 0,
+ 4, 0, 0, 0, 8, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0,
+ 84, 101, 120, 116, 117, 114,
+ 101, 85, 73, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102,
+ 116, 32, 40, 82, 41, 32,
+ 72, 76, 83, 76, 32, 83,
+ 104, 97, 100, 101, 114, 32,
+ 67, 111, 109, 112, 105, 108,
+ 101, 114, 32, 57, 46, 51,
+ 48, 46, 57, 50, 48, 48,
+ 46, 49, 54, 51, 56, 52,
+ 0, 171, 171, 171, 73, 83,
+ 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0,
+ 0, 0, 80, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0,
+ 0, 0, 0, 0, 4, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 118, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7,
+ 0, 0, 83, 86, 95, 80,
+ 79, 83, 73, 84, 73, 79,
+ 78, 0, 83, 86, 95, 82,
+ 69, 78, 68, 69, 82, 84,
+ 65, 82, 71, 69, 84, 65,
+ 82, 82, 65, 89, 73, 78,
+ 68, 69, 88, 0, 84, 69,
+ 88, 67, 79, 79, 82, 68,
+ 0, 171, 79, 83, 71, 78,
+ 44, 0, 0, 0, 1, 0,
+ 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 83, 86, 95, 84, 65, 82,
+ 71, 69, 84, 0, 171, 171,
+ 83, 72, 68, 82, 0, 1,
+ 0, 0, 64, 0, 0, 0,
+ 64, 0, 0, 0, 88, 40,
+ 0, 4, 0, 112, 16, 0,
+ 0, 0, 0, 0, 68, 68,
+ 0, 0, 98, 16, 0, 3,
+ 114, 16, 16, 0, 2, 0,
+ 0, 0, 101, 0, 0, 3,
+ 242, 32, 16, 0, 0, 0,
+ 0, 0, 104, 0, 0, 2,
+ 1, 0, 0, 0, 61, 16,
+ 0, 7, 242, 0, 16, 0,
+ 0, 0, 0, 0, 1, 64,
+ 0, 0, 0, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0,
+ 0, 0, 86, 0, 0, 5,
+ 114, 0, 16, 0, 0, 0,
+ 0, 0, 70, 2, 16, 0,
+ 0, 0, 0, 0, 56, 0,
+ 0, 7, 114, 0, 16, 0,
+ 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0,
+ 70, 18, 16, 0, 2, 0,
+ 0, 0, 27, 0, 0, 5,
+ 114, 0, 16, 0, 0, 0,
+ 0, 0, 70, 2, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 5, 130, 0, 16, 0,
+ 0, 0, 0, 0, 1, 64,
+ 0, 0, 0, 0, 0, 0,
+ 45, 0, 0, 7, 242, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 14, 16, 0, 0, 0,
+ 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 5, 18, 32, 16, 0,
+ 0, 0, 0, 0, 10, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 8, 226, 32,
+ 16, 0, 0, 0, 0, 0,
+ 2, 64, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0,
+ 0, 0, 9, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg2d11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg2d11ps.h
new file mode 100644
index 00000000000..d8f0e5864b7
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg2d11ps.h
@@ -0,0 +1,154 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mov o0.xy, r0.xyxx
+mov o0.zw, l(0,0,0,1.000000)
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRG2D[] =
+{
+ 68, 88, 66, 67, 106, 129,
+ 89, 74, 87, 68, 176, 125,
+ 58, 44, 17, 208, 223, 126,
+ 71, 132, 1, 0, 0, 0,
+ 140, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 220, 0, 0, 0, 52, 1,
+ 0, 0, 104, 1, 0, 0,
+ 16, 2, 0, 0, 82, 68,
+ 69, 70, 160, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 109, 0, 0, 0, 92, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0,
+ 100, 0, 0, 0, 2, 0,
+ 0, 0, 5, 0, 0, 0,
+ 4, 0, 0, 0, 255, 255,
+ 255, 255, 0, 0, 0, 0,
+ 1, 0, 0, 0, 13, 0,
+ 0, 0, 83, 97, 109, 112,
+ 108, 101, 114, 0, 84, 101,
+ 120, 116, 117, 114, 101, 70,
+ 0, 77, 105, 99, 114, 111,
+ 115, 111, 102, 116, 32, 40,
+ 82, 41, 32, 72, 76, 83,
+ 76, 32, 83, 104, 97, 100,
+ 101, 114, 32, 67, 111, 109,
+ 112, 105, 108, 101, 114, 32,
+ 57, 46, 51, 48, 46, 57,
+ 50, 48, 48, 46, 49, 54,
+ 51, 56, 52, 0, 73, 83,
+ 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0,
+ 0, 0, 56, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 68, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 1, 0, 0, 0, 3, 3,
+ 0, 0, 83, 86, 95, 80,
+ 79, 83, 73, 84, 73, 79,
+ 78, 0, 84, 69, 88, 67,
+ 79, 79, 82, 68, 0, 171,
+ 171, 171, 79, 83, 71, 78,
+ 44, 0, 0, 0, 1, 0,
+ 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 83, 86, 95, 84, 65, 82,
+ 71, 69, 84, 0, 171, 171,
+ 83, 72, 68, 82, 160, 0,
+ 0, 0, 64, 0, 0, 0,
+ 40, 0, 0, 0, 90, 0,
+ 0, 3, 0, 96, 16, 0,
+ 0, 0, 0, 0, 88, 24,
+ 0, 4, 0, 112, 16, 0,
+ 0, 0, 0, 0, 85, 85,
+ 0, 0, 98, 16, 0, 3,
+ 50, 16, 16, 0, 1, 0,
+ 0, 0, 101, 0, 0, 3,
+ 242, 32, 16, 0, 0, 0,
+ 0, 0, 104, 0, 0, 2,
+ 1, 0, 0, 0, 69, 0,
+ 0, 9, 242, 0, 16, 0,
+ 0, 0, 0, 0, 70, 16,
+ 16, 0, 1, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0,
+ 0, 0, 0, 96, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 5, 50, 32, 16, 0,
+ 0, 0, 0, 0, 70, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 8, 194, 32,
+ 16, 0, 0, 0, 0, 0,
+ 2, 64, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 128, 63, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0,
+ 0, 0, 4, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg2di11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg2di11ps.h
new file mode 100644
index 00000000000..0dd83a2ec8c
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg2di11ps.h
@@ -0,0 +1,168 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI texture sint4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_resource_texture2d (sint,sint,sint,sint) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.xy, r0.xyxx
+mov o0.zw, l(0,0,0,0)
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRG2DI[] =
+{
+ 68, 88, 66, 67, 0, 22,
+ 144, 161, 146, 93, 225, 81,
+ 225, 191, 53, 51, 239, 96,
+ 173, 21, 1, 0, 0, 0,
+ 208, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 180, 0, 0, 0, 12, 1,
+ 0, 0, 64, 1, 0, 0,
+ 84, 2, 0, 0, 82, 68,
+ 69, 70, 120, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 69, 0, 0, 0, 60, 0,
+ 0, 0, 2, 0, 0, 0,
+ 3, 0, 0, 0, 4, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0,
+ 84, 101, 120, 116, 117, 114,
+ 101, 73, 0, 77, 105, 99,
+ 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72,
+ 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67,
+ 111, 109, 112, 105, 108, 101,
+ 114, 32, 57, 46, 51, 48,
+ 46, 57, 50, 48, 48, 46,
+ 49, 54, 51, 56, 52, 0,
+ 73, 83, 71, 78, 80, 0,
+ 0, 0, 2, 0, 0, 0,
+ 8, 0, 0, 0, 56, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 68, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0,
+ 0, 0, 1, 0, 0, 0,
+ 3, 3, 0, 0, 83, 86,
+ 95, 80, 79, 83, 73, 84,
+ 73, 79, 78, 0, 84, 69,
+ 88, 67, 79, 79, 82, 68,
+ 0, 171, 171, 171, 79, 83,
+ 71, 78, 44, 0, 0, 0,
+ 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 83, 86, 95, 84,
+ 65, 82, 71, 69, 84, 0,
+ 171, 171, 83, 72, 68, 82,
+ 12, 1, 0, 0, 64, 0,
+ 0, 0, 67, 0, 0, 0,
+ 88, 24, 0, 4, 0, 112,
+ 16, 0, 0, 0, 0, 0,
+ 51, 51, 0, 0, 98, 16,
+ 0, 3, 50, 16, 16, 0,
+ 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0,
+ 0, 0, 0, 0, 104, 0,
+ 0, 2, 1, 0, 0, 0,
+ 61, 16, 0, 7, 242, 0,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 86, 0,
+ 0, 5, 50, 0, 16, 0,
+ 0, 0, 0, 0, 70, 0,
+ 16, 0, 0, 0, 0, 0,
+ 56, 0, 0, 7, 50, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 0, 16, 0, 0, 0,
+ 0, 0, 70, 16, 16, 0,
+ 1, 0, 0, 0, 27, 0,
+ 0, 5, 50, 0, 16, 0,
+ 0, 0, 0, 0, 70, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 8, 194, 0,
+ 16, 0, 0, 0, 0, 0,
+ 2, 64, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 45, 0, 0, 7,
+ 242, 0, 16, 0, 0, 0,
+ 0, 0, 70, 14, 16, 0,
+ 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 5, 50, 32,
+ 16, 0, 0, 0, 0, 0,
+ 70, 0, 16, 0, 0, 0,
+ 0, 0, 54, 0, 0, 8,
+ 194, 32, 16, 0, 0, 0,
+ 0, 0, 2, 64, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 62, 0,
+ 0, 1, 83, 84, 65, 84,
+ 116, 0, 0, 0, 9, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg2dui11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg2dui11ps.h
new file mode 100644
index 00000000000..f4ed9e6c69b
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg2dui11ps.h
@@ -0,0 +1,169 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI texture uint4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_resource_texture2d (uint,uint,uint,uint) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.xy, r0.xyxx
+mov o0.zw, l(0,0,0,0)
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRG2DUI[] =
+{
+ 68, 88, 66, 67, 130, 164,
+ 140, 202, 225, 164, 4, 123,
+ 218, 122, 13, 46, 22, 3,
+ 146, 201, 1, 0, 0, 0,
+ 212, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 184, 0, 0, 0, 16, 1,
+ 0, 0, 68, 1, 0, 0,
+ 88, 2, 0, 0, 82, 68,
+ 69, 70, 124, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 70, 0, 0, 0, 60, 0,
+ 0, 0, 2, 0, 0, 0,
+ 4, 0, 0, 0, 4, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0,
+ 84, 101, 120, 116, 117, 114,
+ 101, 85, 73, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102,
+ 116, 32, 40, 82, 41, 32,
+ 72, 76, 83, 76, 32, 83,
+ 104, 97, 100, 101, 114, 32,
+ 67, 111, 109, 112, 105, 108,
+ 101, 114, 32, 57, 46, 51,
+ 48, 46, 57, 50, 48, 48,
+ 46, 49, 54, 51, 56, 52,
+ 0, 171, 171, 171, 73, 83,
+ 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0,
+ 0, 0, 56, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 68, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 1, 0, 0, 0, 3, 3,
+ 0, 0, 83, 86, 95, 80,
+ 79, 83, 73, 84, 73, 79,
+ 78, 0, 84, 69, 88, 67,
+ 79, 79, 82, 68, 0, 171,
+ 171, 171, 79, 83, 71, 78,
+ 44, 0, 0, 0, 1, 0,
+ 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 83, 86, 95, 84, 65, 82,
+ 71, 69, 84, 0, 171, 171,
+ 83, 72, 68, 82, 12, 1,
+ 0, 0, 64, 0, 0, 0,
+ 67, 0, 0, 0, 88, 24,
+ 0, 4, 0, 112, 16, 0,
+ 0, 0, 0, 0, 68, 68,
+ 0, 0, 98, 16, 0, 3,
+ 50, 16, 16, 0, 1, 0,
+ 0, 0, 101, 0, 0, 3,
+ 242, 32, 16, 0, 0, 0,
+ 0, 0, 104, 0, 0, 2,
+ 1, 0, 0, 0, 61, 16,
+ 0, 7, 242, 0, 16, 0,
+ 0, 0, 0, 0, 1, 64,
+ 0, 0, 0, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0,
+ 0, 0, 86, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0,
+ 0, 0, 70, 0, 16, 0,
+ 0, 0, 0, 0, 56, 0,
+ 0, 7, 50, 0, 16, 0,
+ 0, 0, 0, 0, 70, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 16, 16, 0, 1, 0,
+ 0, 0, 27, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0,
+ 0, 0, 70, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 8, 194, 0, 16, 0,
+ 0, 0, 0, 0, 2, 64,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 45, 0, 0, 7, 242, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 14, 16, 0, 0, 0,
+ 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 5, 50, 32, 16, 0,
+ 0, 0, 0, 0, 70, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 8, 194, 32,
+ 16, 0, 0, 0, 0, 0,
+ 2, 64, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0,
+ 0, 0, 9, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg3d11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg3d11ps.h
new file mode 100644
index 00000000000..23a6f05f802
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg3d11ps.h
@@ -0,0 +1,163 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mov o0.xy, r0.xyxx
+mov o0.zw, l(0,0,0,1.000000)
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRG3D[] =
+{
+ 68, 88, 66, 67, 142, 241,
+ 58, 49, 223, 78, 87, 10,
+ 12, 78, 47, 182, 66, 149,
+ 242, 111, 1, 0, 0, 0,
+ 188, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 220, 0, 0, 0, 100, 1,
+ 0, 0, 152, 1, 0, 0,
+ 64, 2, 0, 0, 82, 68,
+ 69, 70, 160, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 109, 0, 0, 0, 92, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0,
+ 100, 0, 0, 0, 2, 0,
+ 0, 0, 5, 0, 0, 0,
+ 8, 0, 0, 0, 255, 255,
+ 255, 255, 0, 0, 0, 0,
+ 1, 0, 0, 0, 13, 0,
+ 0, 0, 83, 97, 109, 112,
+ 108, 101, 114, 0, 84, 101,
+ 120, 116, 117, 114, 101, 70,
+ 0, 77, 105, 99, 114, 111,
+ 115, 111, 102, 116, 32, 40,
+ 82, 41, 32, 72, 76, 83,
+ 76, 32, 83, 104, 97, 100,
+ 101, 114, 32, 67, 111, 109,
+ 112, 105, 108, 101, 114, 32,
+ 57, 46, 51, 48, 46, 57,
+ 50, 48, 48, 46, 49, 54,
+ 51, 56, 52, 0, 73, 83,
+ 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0,
+ 0, 0, 80, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0,
+ 0, 0, 0, 0, 4, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 118, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7,
+ 0, 0, 83, 86, 95, 80,
+ 79, 83, 73, 84, 73, 79,
+ 78, 0, 83, 86, 95, 82,
+ 69, 78, 68, 69, 82, 84,
+ 65, 82, 71, 69, 84, 65,
+ 82, 82, 65, 89, 73, 78,
+ 68, 69, 88, 0, 84, 69,
+ 88, 67, 79, 79, 82, 68,
+ 0, 171, 79, 83, 71, 78,
+ 44, 0, 0, 0, 1, 0,
+ 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 83, 86, 95, 84, 65, 82,
+ 71, 69, 84, 0, 171, 171,
+ 83, 72, 68, 82, 160, 0,
+ 0, 0, 64, 0, 0, 0,
+ 40, 0, 0, 0, 90, 0,
+ 0, 3, 0, 96, 16, 0,
+ 0, 0, 0, 0, 88, 40,
+ 0, 4, 0, 112, 16, 0,
+ 0, 0, 0, 0, 85, 85,
+ 0, 0, 98, 16, 0, 3,
+ 114, 16, 16, 0, 2, 0,
+ 0, 0, 101, 0, 0, 3,
+ 242, 32, 16, 0, 0, 0,
+ 0, 0, 104, 0, 0, 2,
+ 1, 0, 0, 0, 69, 0,
+ 0, 9, 242, 0, 16, 0,
+ 0, 0, 0, 0, 70, 18,
+ 16, 0, 2, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0,
+ 0, 0, 0, 96, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 5, 50, 32, 16, 0,
+ 0, 0, 0, 0, 70, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 8, 194, 32,
+ 16, 0, 0, 0, 0, 0,
+ 2, 64, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 128, 63, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0,
+ 0, 0, 4, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg3di11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg3di11ps.h
new file mode 100644
index 00000000000..3e3b1331f09
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg3di11ps.h
@@ -0,0 +1,175 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI texture sint4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_resource_texture3d (sint,sint,sint,sint) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xyz, r0.xyzx
+mul r0.xyz, r0.xyzx, v2.xyzx
+ftoi r0.xyz, r0.xyzx
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.xy, r0.xyxx
+mov o0.zw, l(0,0,0,0)
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRG3DI[] =
+{
+ 68, 88, 66, 67, 177, 20,
+ 184, 219, 63, 125, 238, 228,
+ 90, 44, 180, 111, 221, 4,
+ 193, 138, 1, 0, 0, 0,
+ 244, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 180, 0, 0, 0, 60, 1,
+ 0, 0, 112, 1, 0, 0,
+ 120, 2, 0, 0, 82, 68,
+ 69, 70, 120, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 69, 0, 0, 0, 60, 0,
+ 0, 0, 2, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0,
+ 84, 101, 120, 116, 117, 114,
+ 101, 73, 0, 77, 105, 99,
+ 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72,
+ 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67,
+ 111, 109, 112, 105, 108, 101,
+ 114, 32, 57, 46, 51, 48,
+ 46, 57, 50, 48, 48, 46,
+ 49, 54, 51, 56, 52, 0,
+ 73, 83, 71, 78, 128, 0,
+ 0, 0, 3, 0, 0, 0,
+ 8, 0, 0, 0, 80, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 118, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0,
+ 0, 0, 2, 0, 0, 0,
+ 7, 7, 0, 0, 83, 86,
+ 95, 80, 79, 83, 73, 84,
+ 73, 79, 78, 0, 83, 86,
+ 95, 82, 69, 78, 68, 69,
+ 82, 84, 65, 82, 71, 69,
+ 84, 65, 82, 82, 65, 89,
+ 73, 78, 68, 69, 88, 0,
+ 84, 69, 88, 67, 79, 79,
+ 82, 68, 0, 171, 79, 83,
+ 71, 78, 44, 0, 0, 0,
+ 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 83, 86, 95, 84,
+ 65, 82, 71, 69, 84, 0,
+ 171, 171, 83, 72, 68, 82,
+ 0, 1, 0, 0, 64, 0,
+ 0, 0, 64, 0, 0, 0,
+ 88, 40, 0, 4, 0, 112,
+ 16, 0, 0, 0, 0, 0,
+ 51, 51, 0, 0, 98, 16,
+ 0, 3, 114, 16, 16, 0,
+ 2, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0,
+ 0, 0, 0, 0, 104, 0,
+ 0, 2, 1, 0, 0, 0,
+ 61, 16, 0, 7, 242, 0,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 86, 0,
+ 0, 5, 114, 0, 16, 0,
+ 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0,
+ 56, 0, 0, 7, 114, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 2, 16, 0, 0, 0,
+ 0, 0, 70, 18, 16, 0,
+ 2, 0, 0, 0, 27, 0,
+ 0, 5, 114, 0, 16, 0,
+ 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 5, 130, 0,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 45, 0, 0, 7,
+ 242, 0, 16, 0, 0, 0,
+ 0, 0, 70, 14, 16, 0,
+ 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 5, 50, 32,
+ 16, 0, 0, 0, 0, 0,
+ 70, 0, 16, 0, 0, 0,
+ 0, 0, 54, 0, 0, 8,
+ 194, 32, 16, 0, 0, 0,
+ 0, 0, 2, 64, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 62, 0,
+ 0, 1, 83, 84, 65, 84,
+ 116, 0, 0, 0, 9, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg3dui11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg3dui11ps.h
new file mode 100644
index 00000000000..3ea21273d55
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrg3dui11ps.h
@@ -0,0 +1,176 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI texture uint4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_resource_texture3d (uint,uint,uint,uint) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xyz, r0.xyzx
+mul r0.xyz, r0.xyzx, v2.xyzx
+ftoi r0.xyz, r0.xyzx
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.xy, r0.xyxx
+mov o0.zw, l(0,0,0,0)
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRG3DUI[] =
+{
+ 68, 88, 66, 67, 44, 75,
+ 122, 141, 176, 19, 231, 192,
+ 165, 252, 210, 30, 121, 18,
+ 77, 89, 1, 0, 0, 0,
+ 248, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 184, 0, 0, 0, 64, 1,
+ 0, 0, 116, 1, 0, 0,
+ 124, 2, 0, 0, 82, 68,
+ 69, 70, 124, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 70, 0, 0, 0, 60, 0,
+ 0, 0, 2, 0, 0, 0,
+ 4, 0, 0, 0, 8, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0,
+ 84, 101, 120, 116, 117, 114,
+ 101, 85, 73, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102,
+ 116, 32, 40, 82, 41, 32,
+ 72, 76, 83, 76, 32, 83,
+ 104, 97, 100, 101, 114, 32,
+ 67, 111, 109, 112, 105, 108,
+ 101, 114, 32, 57, 46, 51,
+ 48, 46, 57, 50, 48, 48,
+ 46, 49, 54, 51, 56, 52,
+ 0, 171, 171, 171, 73, 83,
+ 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0,
+ 0, 0, 80, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0,
+ 0, 0, 0, 0, 4, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 118, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7,
+ 0, 0, 83, 86, 95, 80,
+ 79, 83, 73, 84, 73, 79,
+ 78, 0, 83, 86, 95, 82,
+ 69, 78, 68, 69, 82, 84,
+ 65, 82, 71, 69, 84, 65,
+ 82, 82, 65, 89, 73, 78,
+ 68, 69, 88, 0, 84, 69,
+ 88, 67, 79, 79, 82, 68,
+ 0, 171, 79, 83, 71, 78,
+ 44, 0, 0, 0, 1, 0,
+ 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 83, 86, 95, 84, 65, 82,
+ 71, 69, 84, 0, 171, 171,
+ 83, 72, 68, 82, 0, 1,
+ 0, 0, 64, 0, 0, 0,
+ 64, 0, 0, 0, 88, 40,
+ 0, 4, 0, 112, 16, 0,
+ 0, 0, 0, 0, 68, 68,
+ 0, 0, 98, 16, 0, 3,
+ 114, 16, 16, 0, 2, 0,
+ 0, 0, 101, 0, 0, 3,
+ 242, 32, 16, 0, 0, 0,
+ 0, 0, 104, 0, 0, 2,
+ 1, 0, 0, 0, 61, 16,
+ 0, 7, 242, 0, 16, 0,
+ 0, 0, 0, 0, 1, 64,
+ 0, 0, 0, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0,
+ 0, 0, 86, 0, 0, 5,
+ 114, 0, 16, 0, 0, 0,
+ 0, 0, 70, 2, 16, 0,
+ 0, 0, 0, 0, 56, 0,
+ 0, 7, 114, 0, 16, 0,
+ 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0,
+ 70, 18, 16, 0, 2, 0,
+ 0, 0, 27, 0, 0, 5,
+ 114, 0, 16, 0, 0, 0,
+ 0, 0, 70, 2, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 5, 130, 0, 16, 0,
+ 0, 0, 0, 0, 1, 64,
+ 0, 0, 0, 0, 0, 0,
+ 45, 0, 0, 7, 242, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 14, 16, 0, 0, 0,
+ 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 5, 50, 32, 16, 0,
+ 0, 0, 0, 0, 70, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 8, 194, 32,
+ 16, 0, 0, 0, 0, 0,
+ 2, 64, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0,
+ 0, 0, 9, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/passthroughrgb11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb2d11ps.h
index a99c5411124..32863fc63ad 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/passthroughrgb11ps.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb2d11ps.h
@@ -9,7 +9,7 @@
// Name Type Format Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// Sampler sampler NA NA 0 1
-// Texture texture float4 2d 0 1
+// TextureF texture float4 2d 0 1
//
//
//
@@ -40,12 +40,12 @@ ret
// Approximately 4 instruction slots used
#endif
-const BYTE g_PS_PassthroughRGB[] =
+const BYTE g_PS_PassthroughRGB2D[] =
{
- 68, 88, 66, 67, 125, 186,
- 250, 242, 113, 255, 59, 239,
- 119, 158, 237, 78, 220, 43,
- 160, 46, 1, 0, 0, 0,
+ 68, 88, 66, 67, 173, 177,
+ 43, 26, 103, 245, 60, 209,
+ 56, 67, 66, 231, 81, 165,
+ 64, 69, 1, 0, 0, 0,
128, 2, 0, 0, 5, 0,
0, 0, 52, 0, 0, 0,
220, 0, 0, 0, 52, 1,
@@ -56,7 +56,7 @@ const BYTE g_PS_PassthroughRGB[] =
0, 0, 2, 0, 0, 0,
28, 0, 0, 0, 0, 4,
255, 255, 0, 1, 0, 0,
- 108, 0, 0, 0, 92, 0,
+ 109, 0, 0, 0, 92, 0,
0, 0, 3, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
@@ -69,16 +69,16 @@ const BYTE g_PS_PassthroughRGB[] =
1, 0, 0, 0, 13, 0,
0, 0, 83, 97, 109, 112,
108, 101, 114, 0, 84, 101,
- 120, 116, 117, 114, 101, 0,
- 77, 105, 99, 114, 111, 115,
- 111, 102, 116, 32, 40, 82,
- 41, 32, 72, 76, 83, 76,
- 32, 83, 104, 97, 100, 101,
- 114, 32, 67, 111, 109, 112,
- 105, 108, 101, 114, 32, 57,
- 46, 51, 48, 46, 57, 50,
- 48, 48, 46, 49, 54, 51,
- 56, 52, 0, 171, 73, 83,
+ 120, 116, 117, 114, 101, 70,
+ 0, 77, 105, 99, 114, 111,
+ 115, 111, 102, 116, 32, 40,
+ 82, 41, 32, 72, 76, 83,
+ 76, 32, 83, 104, 97, 100,
+ 101, 114, 32, 67, 111, 109,
+ 112, 105, 108, 101, 114, 32,
+ 57, 46, 51, 48, 46, 57,
+ 50, 48, 48, 46, 49, 54,
+ 51, 56, 52, 0, 73, 83,
71, 78, 80, 0, 0, 0,
2, 0, 0, 0, 8, 0,
0, 0, 56, 0, 0, 0,
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb2di11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb2di11ps.h
new file mode 100644
index 00000000000..3fbd9ee54cd
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb2di11ps.h
@@ -0,0 +1,166 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI texture sint4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_resource_texture2d (sint,sint,sint,sint) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.xyz, r0.xyzx
+mov o0.w, l(0)
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGB2DI[] =
+{
+ 68, 88, 66, 67, 249, 26,
+ 212, 170, 3, 17, 240, 188,
+ 220, 164, 244, 167, 202, 103,
+ 2, 190, 1, 0, 0, 0,
+ 196, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 180, 0, 0, 0, 12, 1,
+ 0, 0, 64, 1, 0, 0,
+ 72, 2, 0, 0, 82, 68,
+ 69, 70, 120, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 69, 0, 0, 0, 60, 0,
+ 0, 0, 2, 0, 0, 0,
+ 3, 0, 0, 0, 4, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0,
+ 84, 101, 120, 116, 117, 114,
+ 101, 73, 0, 77, 105, 99,
+ 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72,
+ 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67,
+ 111, 109, 112, 105, 108, 101,
+ 114, 32, 57, 46, 51, 48,
+ 46, 57, 50, 48, 48, 46,
+ 49, 54, 51, 56, 52, 0,
+ 73, 83, 71, 78, 80, 0,
+ 0, 0, 2, 0, 0, 0,
+ 8, 0, 0, 0, 56, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 68, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0,
+ 0, 0, 1, 0, 0, 0,
+ 3, 3, 0, 0, 83, 86,
+ 95, 80, 79, 83, 73, 84,
+ 73, 79, 78, 0, 84, 69,
+ 88, 67, 79, 79, 82, 68,
+ 0, 171, 171, 171, 79, 83,
+ 71, 78, 44, 0, 0, 0,
+ 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 83, 86, 95, 84,
+ 65, 82, 71, 69, 84, 0,
+ 171, 171, 83, 72, 68, 82,
+ 0, 1, 0, 0, 64, 0,
+ 0, 0, 64, 0, 0, 0,
+ 88, 24, 0, 4, 0, 112,
+ 16, 0, 0, 0, 0, 0,
+ 51, 51, 0, 0, 98, 16,
+ 0, 3, 50, 16, 16, 0,
+ 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0,
+ 0, 0, 0, 0, 104, 0,
+ 0, 2, 1, 0, 0, 0,
+ 61, 16, 0, 7, 242, 0,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 86, 0,
+ 0, 5, 50, 0, 16, 0,
+ 0, 0, 0, 0, 70, 0,
+ 16, 0, 0, 0, 0, 0,
+ 56, 0, 0, 7, 50, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 0, 16, 0, 0, 0,
+ 0, 0, 70, 16, 16, 0,
+ 1, 0, 0, 0, 27, 0,
+ 0, 5, 50, 0, 16, 0,
+ 0, 0, 0, 0, 70, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 8, 194, 0,
+ 16, 0, 0, 0, 0, 0,
+ 2, 64, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 45, 0, 0, 7,
+ 242, 0, 16, 0, 0, 0,
+ 0, 0, 70, 14, 16, 0,
+ 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 5, 114, 32,
+ 16, 0, 0, 0, 0, 0,
+ 70, 2, 16, 0, 0, 0,
+ 0, 0, 54, 0, 0, 5,
+ 130, 32, 16, 0, 0, 0,
+ 0, 0, 1, 64, 0, 0,
+ 0, 0, 0, 0, 62, 0,
+ 0, 1, 83, 84, 65, 84,
+ 116, 0, 0, 0, 9, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb2dui11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb2dui11ps.h
new file mode 100644
index 00000000000..f1be28582aa
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb2dui11ps.h
@@ -0,0 +1,167 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI texture uint4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_resource_texture2d (uint,uint,uint,uint) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.xyz, r0.xyzx
+mov o0.w, l(0)
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGB2DUI[] =
+{
+ 68, 88, 66, 67, 158, 133,
+ 153, 245, 14, 212, 29, 23,
+ 89, 41, 242, 173, 58, 186,
+ 36, 20, 1, 0, 0, 0,
+ 200, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 184, 0, 0, 0, 16, 1,
+ 0, 0, 68, 1, 0, 0,
+ 76, 2, 0, 0, 82, 68,
+ 69, 70, 124, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 70, 0, 0, 0, 60, 0,
+ 0, 0, 2, 0, 0, 0,
+ 4, 0, 0, 0, 4, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0,
+ 84, 101, 120, 116, 117, 114,
+ 101, 85, 73, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102,
+ 116, 32, 40, 82, 41, 32,
+ 72, 76, 83, 76, 32, 83,
+ 104, 97, 100, 101, 114, 32,
+ 67, 111, 109, 112, 105, 108,
+ 101, 114, 32, 57, 46, 51,
+ 48, 46, 57, 50, 48, 48,
+ 46, 49, 54, 51, 56, 52,
+ 0, 171, 171, 171, 73, 83,
+ 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0,
+ 0, 0, 56, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 68, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 1, 0, 0, 0, 3, 3,
+ 0, 0, 83, 86, 95, 80,
+ 79, 83, 73, 84, 73, 79,
+ 78, 0, 84, 69, 88, 67,
+ 79, 79, 82, 68, 0, 171,
+ 171, 171, 79, 83, 71, 78,
+ 44, 0, 0, 0, 1, 0,
+ 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 83, 86, 95, 84, 65, 82,
+ 71, 69, 84, 0, 171, 171,
+ 83, 72, 68, 82, 0, 1,
+ 0, 0, 64, 0, 0, 0,
+ 64, 0, 0, 0, 88, 24,
+ 0, 4, 0, 112, 16, 0,
+ 0, 0, 0, 0, 68, 68,
+ 0, 0, 98, 16, 0, 3,
+ 50, 16, 16, 0, 1, 0,
+ 0, 0, 101, 0, 0, 3,
+ 242, 32, 16, 0, 0, 0,
+ 0, 0, 104, 0, 0, 2,
+ 1, 0, 0, 0, 61, 16,
+ 0, 7, 242, 0, 16, 0,
+ 0, 0, 0, 0, 1, 64,
+ 0, 0, 0, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0,
+ 0, 0, 86, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0,
+ 0, 0, 70, 0, 16, 0,
+ 0, 0, 0, 0, 56, 0,
+ 0, 7, 50, 0, 16, 0,
+ 0, 0, 0, 0, 70, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 16, 16, 0, 1, 0,
+ 0, 0, 27, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0,
+ 0, 0, 70, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 8, 194, 0, 16, 0,
+ 0, 0, 0, 0, 2, 64,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 45, 0, 0, 7, 242, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 14, 16, 0, 0, 0,
+ 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 5, 114, 32, 16, 0,
+ 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 5, 130, 32,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0,
+ 0, 0, 9, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb3d11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb3d11ps.h
new file mode 100644
index 00000000000..466756c313e
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb3d11ps.h
@@ -0,0 +1,161 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mov o0.xyz, r0.xyzx
+mov o0.w, l(1.000000)
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGB3D[] =
+{
+ 68, 88, 66, 67, 151, 192,
+ 30, 128, 185, 187, 67, 126,
+ 162, 19, 147, 24, 96, 236,
+ 66, 114, 1, 0, 0, 0,
+ 176, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 220, 0, 0, 0, 100, 1,
+ 0, 0, 152, 1, 0, 0,
+ 52, 2, 0, 0, 82, 68,
+ 69, 70, 160, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 109, 0, 0, 0, 92, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0,
+ 100, 0, 0, 0, 2, 0,
+ 0, 0, 5, 0, 0, 0,
+ 8, 0, 0, 0, 255, 255,
+ 255, 255, 0, 0, 0, 0,
+ 1, 0, 0, 0, 13, 0,
+ 0, 0, 83, 97, 109, 112,
+ 108, 101, 114, 0, 84, 101,
+ 120, 116, 117, 114, 101, 70,
+ 0, 77, 105, 99, 114, 111,
+ 115, 111, 102, 116, 32, 40,
+ 82, 41, 32, 72, 76, 83,
+ 76, 32, 83, 104, 97, 100,
+ 101, 114, 32, 67, 111, 109,
+ 112, 105, 108, 101, 114, 32,
+ 57, 46, 51, 48, 46, 57,
+ 50, 48, 48, 46, 49, 54,
+ 51, 56, 52, 0, 73, 83,
+ 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0,
+ 0, 0, 80, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0,
+ 0, 0, 0, 0, 4, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 118, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7,
+ 0, 0, 83, 86, 95, 80,
+ 79, 83, 73, 84, 73, 79,
+ 78, 0, 83, 86, 95, 82,
+ 69, 78, 68, 69, 82, 84,
+ 65, 82, 71, 69, 84, 65,
+ 82, 82, 65, 89, 73, 78,
+ 68, 69, 88, 0, 84, 69,
+ 88, 67, 79, 79, 82, 68,
+ 0, 171, 79, 83, 71, 78,
+ 44, 0, 0, 0, 1, 0,
+ 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 83, 86, 95, 84, 65, 82,
+ 71, 69, 84, 0, 171, 171,
+ 83, 72, 68, 82, 148, 0,
+ 0, 0, 64, 0, 0, 0,
+ 37, 0, 0, 0, 90, 0,
+ 0, 3, 0, 96, 16, 0,
+ 0, 0, 0, 0, 88, 40,
+ 0, 4, 0, 112, 16, 0,
+ 0, 0, 0, 0, 85, 85,
+ 0, 0, 98, 16, 0, 3,
+ 114, 16, 16, 0, 2, 0,
+ 0, 0, 101, 0, 0, 3,
+ 242, 32, 16, 0, 0, 0,
+ 0, 0, 104, 0, 0, 2,
+ 1, 0, 0, 0, 69, 0,
+ 0, 9, 242, 0, 16, 0,
+ 0, 0, 0, 0, 70, 18,
+ 16, 0, 2, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0,
+ 0, 0, 0, 96, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 5, 114, 32, 16, 0,
+ 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 5, 130, 32,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 128, 63, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0,
+ 0, 0, 4, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb3di11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb3di11ps.h
new file mode 100644
index 00000000000..99073a2e767
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb3di11ps.h
@@ -0,0 +1,173 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI texture sint4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_resource_texture3d (sint,sint,sint,sint) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xyz, r0.xyzx
+mul r0.xyz, r0.xyzx, v2.xyzx
+ftoi r0.xyz, r0.xyzx
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.xyz, r0.xyzx
+mov o0.w, l(0)
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGB3DI[] =
+{
+ 68, 88, 66, 67, 159, 150,
+ 210, 67, 149, 116, 221, 62,
+ 207, 82, 157, 210, 9, 100,
+ 131, 204, 1, 0, 0, 0,
+ 232, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 180, 0, 0, 0, 60, 1,
+ 0, 0, 112, 1, 0, 0,
+ 108, 2, 0, 0, 82, 68,
+ 69, 70, 120, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 69, 0, 0, 0, 60, 0,
+ 0, 0, 2, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0,
+ 84, 101, 120, 116, 117, 114,
+ 101, 73, 0, 77, 105, 99,
+ 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72,
+ 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67,
+ 111, 109, 112, 105, 108, 101,
+ 114, 32, 57, 46, 51, 48,
+ 46, 57, 50, 48, 48, 46,
+ 49, 54, 51, 56, 52, 0,
+ 73, 83, 71, 78, 128, 0,
+ 0, 0, 3, 0, 0, 0,
+ 8, 0, 0, 0, 80, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 118, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0,
+ 0, 0, 2, 0, 0, 0,
+ 7, 7, 0, 0, 83, 86,
+ 95, 80, 79, 83, 73, 84,
+ 73, 79, 78, 0, 83, 86,
+ 95, 82, 69, 78, 68, 69,
+ 82, 84, 65, 82, 71, 69,
+ 84, 65, 82, 82, 65, 89,
+ 73, 78, 68, 69, 88, 0,
+ 84, 69, 88, 67, 79, 79,
+ 82, 68, 0, 171, 79, 83,
+ 71, 78, 44, 0, 0, 0,
+ 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 83, 86, 95, 84,
+ 65, 82, 71, 69, 84, 0,
+ 171, 171, 83, 72, 68, 82,
+ 244, 0, 0, 0, 64, 0,
+ 0, 0, 61, 0, 0, 0,
+ 88, 40, 0, 4, 0, 112,
+ 16, 0, 0, 0, 0, 0,
+ 51, 51, 0, 0, 98, 16,
+ 0, 3, 114, 16, 16, 0,
+ 2, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0,
+ 0, 0, 0, 0, 104, 0,
+ 0, 2, 1, 0, 0, 0,
+ 61, 16, 0, 7, 242, 0,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 86, 0,
+ 0, 5, 114, 0, 16, 0,
+ 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0,
+ 56, 0, 0, 7, 114, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 2, 16, 0, 0, 0,
+ 0, 0, 70, 18, 16, 0,
+ 2, 0, 0, 0, 27, 0,
+ 0, 5, 114, 0, 16, 0,
+ 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 5, 130, 0,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 45, 0, 0, 7,
+ 242, 0, 16, 0, 0, 0,
+ 0, 0, 70, 14, 16, 0,
+ 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 5, 114, 32,
+ 16, 0, 0, 0, 0, 0,
+ 70, 2, 16, 0, 0, 0,
+ 0, 0, 54, 0, 0, 5,
+ 130, 32, 16, 0, 0, 0,
+ 0, 0, 1, 64, 0, 0,
+ 0, 0, 0, 0, 62, 0,
+ 0, 1, 83, 84, 65, 84,
+ 116, 0, 0, 0, 9, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb3dui11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb3dui11ps.h
new file mode 100644
index 00000000000..627b216a2a7
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb3dui11ps.h
@@ -0,0 +1,174 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI texture uint4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_resource_texture3d (uint,uint,uint,uint) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xyz, r0.xyzx
+mul r0.xyz, r0.xyzx, v2.xyzx
+ftoi r0.xyz, r0.xyzx
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.xyz, r0.xyzx
+mov o0.w, l(0)
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGB3DUI[] =
+{
+ 68, 88, 66, 67, 120, 50,
+ 182, 251, 216, 8, 85, 92,
+ 127, 151, 194, 64, 248, 151,
+ 55, 163, 1, 0, 0, 0,
+ 236, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 184, 0, 0, 0, 64, 1,
+ 0, 0, 116, 1, 0, 0,
+ 112, 2, 0, 0, 82, 68,
+ 69, 70, 124, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 70, 0, 0, 0, 60, 0,
+ 0, 0, 2, 0, 0, 0,
+ 4, 0, 0, 0, 8, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0,
+ 84, 101, 120, 116, 117, 114,
+ 101, 85, 73, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102,
+ 116, 32, 40, 82, 41, 32,
+ 72, 76, 83, 76, 32, 83,
+ 104, 97, 100, 101, 114, 32,
+ 67, 111, 109, 112, 105, 108,
+ 101, 114, 32, 57, 46, 51,
+ 48, 46, 57, 50, 48, 48,
+ 46, 49, 54, 51, 56, 52,
+ 0, 171, 171, 171, 73, 83,
+ 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0,
+ 0, 0, 80, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0,
+ 0, 0, 0, 0, 4, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 118, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7,
+ 0, 0, 83, 86, 95, 80,
+ 79, 83, 73, 84, 73, 79,
+ 78, 0, 83, 86, 95, 82,
+ 69, 78, 68, 69, 82, 84,
+ 65, 82, 71, 69, 84, 65,
+ 82, 82, 65, 89, 73, 78,
+ 68, 69, 88, 0, 84, 69,
+ 88, 67, 79, 79, 82, 68,
+ 0, 171, 79, 83, 71, 78,
+ 44, 0, 0, 0, 1, 0,
+ 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 83, 86, 95, 84, 65, 82,
+ 71, 69, 84, 0, 171, 171,
+ 83, 72, 68, 82, 244, 0,
+ 0, 0, 64, 0, 0, 0,
+ 61, 0, 0, 0, 88, 40,
+ 0, 4, 0, 112, 16, 0,
+ 0, 0, 0, 0, 68, 68,
+ 0, 0, 98, 16, 0, 3,
+ 114, 16, 16, 0, 2, 0,
+ 0, 0, 101, 0, 0, 3,
+ 242, 32, 16, 0, 0, 0,
+ 0, 0, 104, 0, 0, 2,
+ 1, 0, 0, 0, 61, 16,
+ 0, 7, 242, 0, 16, 0,
+ 0, 0, 0, 0, 1, 64,
+ 0, 0, 0, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0,
+ 0, 0, 86, 0, 0, 5,
+ 114, 0, 16, 0, 0, 0,
+ 0, 0, 70, 2, 16, 0,
+ 0, 0, 0, 0, 56, 0,
+ 0, 7, 114, 0, 16, 0,
+ 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0,
+ 70, 18, 16, 0, 2, 0,
+ 0, 0, 27, 0, 0, 5,
+ 114, 0, 16, 0, 0, 0,
+ 0, 0, 70, 2, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 5, 130, 0, 16, 0,
+ 0, 0, 0, 0, 1, 64,
+ 0, 0, 0, 0, 0, 0,
+ 45, 0, 0, 7, 242, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 14, 16, 0, 0, 0,
+ 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 5, 114, 32, 16, 0,
+ 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 5, 130, 32,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0,
+ 0, 0, 9, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/passthroughrgba11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba2d11ps.h
index bf9ee709f78..54abeda0bac 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/passthroughrgba11ps.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba2d11ps.h
@@ -9,7 +9,7 @@
// Name Type Format Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// Sampler sampler NA NA 0 1
-// Texture texture float4 2d 0 1
+// TextureF texture float4 2d 0 1
//
//
//
@@ -37,12 +37,12 @@ ret
// Approximately 2 instruction slots used
#endif
-const BYTE g_PS_PassthroughRGBA[] =
+const BYTE g_PS_PassthroughRGBA2D[] =
{
- 68, 88, 66, 67, 151, 152,
- 8, 102, 174, 135, 76, 57,
- 100, 146, 59, 74, 205, 35,
- 206, 21, 1, 0, 0, 0,
+ 68, 88, 66, 67, 185, 246,
+ 217, 85, 112, 245, 247, 121,
+ 114, 229, 186, 138, 215, 134,
+ 18, 1, 1, 0, 0, 0,
80, 2, 0, 0, 5, 0,
0, 0, 52, 0, 0, 0,
220, 0, 0, 0, 52, 1,
@@ -53,7 +53,7 @@ const BYTE g_PS_PassthroughRGBA[] =
0, 0, 2, 0, 0, 0,
28, 0, 0, 0, 0, 4,
255, 255, 0, 1, 0, 0,
- 108, 0, 0, 0, 92, 0,
+ 109, 0, 0, 0, 92, 0,
0, 0, 3, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
@@ -66,16 +66,16 @@ const BYTE g_PS_PassthroughRGBA[] =
1, 0, 0, 0, 13, 0,
0, 0, 83, 97, 109, 112,
108, 101, 114, 0, 84, 101,
- 120, 116, 117, 114, 101, 0,
- 77, 105, 99, 114, 111, 115,
- 111, 102, 116, 32, 40, 82,
- 41, 32, 72, 76, 83, 76,
- 32, 83, 104, 97, 100, 101,
- 114, 32, 67, 111, 109, 112,
- 105, 108, 101, 114, 32, 57,
- 46, 51, 48, 46, 57, 50,
- 48, 48, 46, 49, 54, 51,
- 56, 52, 0, 171, 73, 83,
+ 120, 116, 117, 114, 101, 70,
+ 0, 77, 105, 99, 114, 111,
+ 115, 111, 102, 116, 32, 40,
+ 82, 41, 32, 72, 76, 83,
+ 76, 32, 83, 104, 97, 100,
+ 101, 114, 32, 67, 111, 109,
+ 112, 105, 108, 101, 114, 32,
+ 57, 46, 51, 48, 46, 57,
+ 50, 48, 48, 46, 49, 54,
+ 51, 56, 52, 0, 73, 83,
71, 78, 80, 0, 0, 0,
2, 0, 0, 0, 8, 0,
0, 0, 56, 0, 0, 0,
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba2di11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba2di11ps.h
new file mode 100644
index 00000000000..8513bebce2e
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba2di11ps.h
@@ -0,0 +1,158 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI texture sint4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_resource_texture2d (sint,sint,sint,sint) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ld o0.xyzw, r0.xyzw, t0.xyzw
+ret
+// Approximately 7 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGBA2DI[] =
+{
+ 68, 88, 66, 67, 154, 22,
+ 19, 195, 64, 124, 15, 43,
+ 32, 163, 142, 31, 97, 239,
+ 22, 9, 1, 0, 0, 0,
+ 156, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 180, 0, 0, 0, 12, 1,
+ 0, 0, 64, 1, 0, 0,
+ 32, 2, 0, 0, 82, 68,
+ 69, 70, 120, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 69, 0, 0, 0, 60, 0,
+ 0, 0, 2, 0, 0, 0,
+ 3, 0, 0, 0, 4, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0,
+ 84, 101, 120, 116, 117, 114,
+ 101, 73, 0, 77, 105, 99,
+ 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72,
+ 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67,
+ 111, 109, 112, 105, 108, 101,
+ 114, 32, 57, 46, 51, 48,
+ 46, 57, 50, 48, 48, 46,
+ 49, 54, 51, 56, 52, 0,
+ 73, 83, 71, 78, 80, 0,
+ 0, 0, 2, 0, 0, 0,
+ 8, 0, 0, 0, 56, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 68, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0,
+ 0, 0, 1, 0, 0, 0,
+ 3, 3, 0, 0, 83, 86,
+ 95, 80, 79, 83, 73, 84,
+ 73, 79, 78, 0, 84, 69,
+ 88, 67, 79, 79, 82, 68,
+ 0, 171, 171, 171, 79, 83,
+ 71, 78, 44, 0, 0, 0,
+ 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 83, 86, 95, 84,
+ 65, 82, 71, 69, 84, 0,
+ 171, 171, 83, 72, 68, 82,
+ 216, 0, 0, 0, 64, 0,
+ 0, 0, 54, 0, 0, 0,
+ 88, 24, 0, 4, 0, 112,
+ 16, 0, 0, 0, 0, 0,
+ 51, 51, 0, 0, 98, 16,
+ 0, 3, 50, 16, 16, 0,
+ 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0,
+ 0, 0, 0, 0, 104, 0,
+ 0, 2, 1, 0, 0, 0,
+ 61, 16, 0, 7, 242, 0,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 86, 0,
+ 0, 5, 50, 0, 16, 0,
+ 0, 0, 0, 0, 70, 0,
+ 16, 0, 0, 0, 0, 0,
+ 56, 0, 0, 7, 50, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 0, 16, 0, 0, 0,
+ 0, 0, 70, 16, 16, 0,
+ 1, 0, 0, 0, 27, 0,
+ 0, 5, 50, 0, 16, 0,
+ 0, 0, 0, 0, 70, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 8, 194, 0,
+ 16, 0, 0, 0, 0, 0,
+ 2, 64, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 45, 0, 0, 7,
+ 242, 32, 16, 0, 0, 0,
+ 0, 0, 70, 14, 16, 0,
+ 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0,
+ 62, 0, 0, 1, 83, 84,
+ 65, 84, 116, 0, 0, 0,
+ 7, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba2dui11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba2dui11ps.h
new file mode 100644
index 00000000000..6f1062f14be
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba2dui11ps.h
@@ -0,0 +1,158 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI texture uint4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_resource_texture2d (uint,uint,uint,uint) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ld o0.xyzw, r0.xyzw, t0.xyzw
+ret
+// Approximately 7 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGBA2DUI[] =
+{
+ 68, 88, 66, 67, 70, 254,
+ 149, 124, 180, 164, 152, 186,
+ 218, 175, 81, 67, 76, 30,
+ 28, 75, 1, 0, 0, 0,
+ 160, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 184, 0, 0, 0, 16, 1,
+ 0, 0, 68, 1, 0, 0,
+ 36, 2, 0, 0, 82, 68,
+ 69, 70, 124, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 70, 0, 0, 0, 60, 0,
+ 0, 0, 2, 0, 0, 0,
+ 4, 0, 0, 0, 4, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0,
+ 84, 101, 120, 116, 117, 114,
+ 101, 85, 73, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102,
+ 116, 32, 40, 82, 41, 32,
+ 72, 76, 83, 76, 32, 83,
+ 104, 97, 100, 101, 114, 32,
+ 67, 111, 109, 112, 105, 108,
+ 101, 114, 32, 57, 46, 51,
+ 48, 46, 57, 50, 48, 48,
+ 46, 49, 54, 51, 56, 52,
+ 0, 171, 171, 171, 73, 83,
+ 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0,
+ 0, 0, 56, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 68, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 1, 0, 0, 0, 3, 3,
+ 0, 0, 83, 86, 95, 80,
+ 79, 83, 73, 84, 73, 79,
+ 78, 0, 84, 69, 88, 67,
+ 79, 79, 82, 68, 0, 171,
+ 171, 171, 79, 83, 71, 78,
+ 44, 0, 0, 0, 1, 0,
+ 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 83, 86, 95, 84, 65, 82,
+ 71, 69, 84, 0, 171, 171,
+ 83, 72, 68, 82, 216, 0,
+ 0, 0, 64, 0, 0, 0,
+ 54, 0, 0, 0, 88, 24,
+ 0, 4, 0, 112, 16, 0,
+ 0, 0, 0, 0, 68, 68,
+ 0, 0, 98, 16, 0, 3,
+ 50, 16, 16, 0, 1, 0,
+ 0, 0, 101, 0, 0, 3,
+ 242, 32, 16, 0, 0, 0,
+ 0, 0, 104, 0, 0, 2,
+ 1, 0, 0, 0, 61, 16,
+ 0, 7, 242, 0, 16, 0,
+ 0, 0, 0, 0, 1, 64,
+ 0, 0, 0, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0,
+ 0, 0, 86, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0,
+ 0, 0, 70, 0, 16, 0,
+ 0, 0, 0, 0, 56, 0,
+ 0, 7, 50, 0, 16, 0,
+ 0, 0, 0, 0, 70, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 16, 16, 0, 1, 0,
+ 0, 0, 27, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0,
+ 0, 0, 70, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 8, 194, 0, 16, 0,
+ 0, 0, 0, 0, 2, 64,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 45, 0, 0, 7, 242, 32,
+ 16, 0, 0, 0, 0, 0,
+ 70, 14, 16, 0, 0, 0,
+ 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 62, 0,
+ 0, 1, 83, 84, 65, 84,
+ 116, 0, 0, 0, 7, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba3d11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba3d11ps.h
new file mode 100644
index 00000000000..a2df7ed87db
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba3d11ps.h
@@ -0,0 +1,150 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+sample o0.xyzw, v2.xyzx, t0.xyzw, s0
+ret
+// Approximately 2 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGBA3D[] =
+{
+ 68, 88, 66, 67, 210, 245,
+ 69, 229, 208, 176, 191, 93,
+ 81, 12, 174, 136, 0, 184,
+ 83, 208, 1, 0, 0, 0,
+ 128, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 220, 0, 0, 0, 100, 1,
+ 0, 0, 152, 1, 0, 0,
+ 4, 2, 0, 0, 82, 68,
+ 69, 70, 160, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 109, 0, 0, 0, 92, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0,
+ 100, 0, 0, 0, 2, 0,
+ 0, 0, 5, 0, 0, 0,
+ 8, 0, 0, 0, 255, 255,
+ 255, 255, 0, 0, 0, 0,
+ 1, 0, 0, 0, 13, 0,
+ 0, 0, 83, 97, 109, 112,
+ 108, 101, 114, 0, 84, 101,
+ 120, 116, 117, 114, 101, 70,
+ 0, 77, 105, 99, 114, 111,
+ 115, 111, 102, 116, 32, 40,
+ 82, 41, 32, 72, 76, 83,
+ 76, 32, 83, 104, 97, 100,
+ 101, 114, 32, 67, 111, 109,
+ 112, 105, 108, 101, 114, 32,
+ 57, 46, 51, 48, 46, 57,
+ 50, 48, 48, 46, 49, 54,
+ 51, 56, 52, 0, 73, 83,
+ 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0,
+ 0, 0, 80, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0,
+ 0, 0, 0, 0, 4, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 118, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7,
+ 0, 0, 83, 86, 95, 80,
+ 79, 83, 73, 84, 73, 79,
+ 78, 0, 83, 86, 95, 82,
+ 69, 78, 68, 69, 82, 84,
+ 65, 82, 71, 69, 84, 65,
+ 82, 82, 65, 89, 73, 78,
+ 68, 69, 88, 0, 84, 69,
+ 88, 67, 79, 79, 82, 68,
+ 0, 171, 79, 83, 71, 78,
+ 44, 0, 0, 0, 1, 0,
+ 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 83, 86, 95, 84, 65, 82,
+ 71, 69, 84, 0, 171, 171,
+ 83, 72, 68, 82, 100, 0,
+ 0, 0, 64, 0, 0, 0,
+ 25, 0, 0, 0, 90, 0,
+ 0, 3, 0, 96, 16, 0,
+ 0, 0, 0, 0, 88, 40,
+ 0, 4, 0, 112, 16, 0,
+ 0, 0, 0, 0, 85, 85,
+ 0, 0, 98, 16, 0, 3,
+ 114, 16, 16, 0, 2, 0,
+ 0, 0, 101, 0, 0, 3,
+ 242, 32, 16, 0, 0, 0,
+ 0, 0, 69, 0, 0, 9,
+ 242, 32, 16, 0, 0, 0,
+ 0, 0, 70, 18, 16, 0,
+ 2, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0,
+ 0, 96, 16, 0, 0, 0,
+ 0, 0, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba3di11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba3di11ps.h
new file mode 100644
index 00000000000..0fcfe3932bf
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba3di11ps.h
@@ -0,0 +1,165 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI texture sint4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_resource_texture3d (sint,sint,sint,sint) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xyz, r0.xyzx
+mul r0.xyz, r0.xyzx, v2.xyzx
+ftoi r0.xyz, r0.xyzx
+mov r0.w, l(0)
+ld o0.xyzw, r0.xyzw, t0.xyzw
+ret
+// Approximately 7 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGBA3DI[] =
+{
+ 68, 88, 66, 67, 152, 248,
+ 214, 130, 39, 9, 70, 81,
+ 25, 166, 69, 85, 30, 229,
+ 132, 197, 1, 0, 0, 0,
+ 192, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 180, 0, 0, 0, 60, 1,
+ 0, 0, 112, 1, 0, 0,
+ 68, 2, 0, 0, 82, 68,
+ 69, 70, 120, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 69, 0, 0, 0, 60, 0,
+ 0, 0, 2, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0,
+ 84, 101, 120, 116, 117, 114,
+ 101, 73, 0, 77, 105, 99,
+ 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72,
+ 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67,
+ 111, 109, 112, 105, 108, 101,
+ 114, 32, 57, 46, 51, 48,
+ 46, 57, 50, 48, 48, 46,
+ 49, 54, 51, 56, 52, 0,
+ 73, 83, 71, 78, 128, 0,
+ 0, 0, 3, 0, 0, 0,
+ 8, 0, 0, 0, 80, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 118, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0,
+ 0, 0, 2, 0, 0, 0,
+ 7, 7, 0, 0, 83, 86,
+ 95, 80, 79, 83, 73, 84,
+ 73, 79, 78, 0, 83, 86,
+ 95, 82, 69, 78, 68, 69,
+ 82, 84, 65, 82, 71, 69,
+ 84, 65, 82, 82, 65, 89,
+ 73, 78, 68, 69, 88, 0,
+ 84, 69, 88, 67, 79, 79,
+ 82, 68, 0, 171, 79, 83,
+ 71, 78, 44, 0, 0, 0,
+ 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 83, 86, 95, 84,
+ 65, 82, 71, 69, 84, 0,
+ 171, 171, 83, 72, 68, 82,
+ 204, 0, 0, 0, 64, 0,
+ 0, 0, 51, 0, 0, 0,
+ 88, 40, 0, 4, 0, 112,
+ 16, 0, 0, 0, 0, 0,
+ 51, 51, 0, 0, 98, 16,
+ 0, 3, 114, 16, 16, 0,
+ 2, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0,
+ 0, 0, 0, 0, 104, 0,
+ 0, 2, 1, 0, 0, 0,
+ 61, 16, 0, 7, 242, 0,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 86, 0,
+ 0, 5, 114, 0, 16, 0,
+ 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0,
+ 56, 0, 0, 7, 114, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 2, 16, 0, 0, 0,
+ 0, 0, 70, 18, 16, 0,
+ 2, 0, 0, 0, 27, 0,
+ 0, 5, 114, 0, 16, 0,
+ 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 5, 130, 0,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 45, 0, 0, 7,
+ 242, 32, 16, 0, 0, 0,
+ 0, 0, 70, 14, 16, 0,
+ 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0,
+ 62, 0, 0, 1, 83, 84,
+ 65, 84, 116, 0, 0, 0,
+ 7, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba3dui11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba3dui11ps.h
new file mode 100644
index 00000000000..748195ea587
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba3dui11ps.h
@@ -0,0 +1,165 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI texture uint4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_resource_texture3d (uint,uint,uint,uint) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xyz, r0.xyzx
+mul r0.xyz, r0.xyzx, v2.xyzx
+ftoi r0.xyz, r0.xyzx
+mov r0.w, l(0)
+ld o0.xyzw, r0.xyzw, t0.xyzw
+ret
+// Approximately 7 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGBA3DUI[] =
+{
+ 68, 88, 66, 67, 24, 171,
+ 238, 127, 243, 33, 183, 183,
+ 228, 225, 69, 159, 98, 227,
+ 253, 69, 1, 0, 0, 0,
+ 196, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 184, 0, 0, 0, 64, 1,
+ 0, 0, 116, 1, 0, 0,
+ 72, 2, 0, 0, 82, 68,
+ 69, 70, 124, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 70, 0, 0, 0, 60, 0,
+ 0, 0, 2, 0, 0, 0,
+ 4, 0, 0, 0, 8, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0,
+ 84, 101, 120, 116, 117, 114,
+ 101, 85, 73, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102,
+ 116, 32, 40, 82, 41, 32,
+ 72, 76, 83, 76, 32, 83,
+ 104, 97, 100, 101, 114, 32,
+ 67, 111, 109, 112, 105, 108,
+ 101, 114, 32, 57, 46, 51,
+ 48, 46, 57, 50, 48, 48,
+ 46, 49, 54, 51, 56, 52,
+ 0, 171, 171, 171, 73, 83,
+ 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0,
+ 0, 0, 80, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0,
+ 0, 0, 0, 0, 4, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 118, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7,
+ 0, 0, 83, 86, 95, 80,
+ 79, 83, 73, 84, 73, 79,
+ 78, 0, 83, 86, 95, 82,
+ 69, 78, 68, 69, 82, 84,
+ 65, 82, 71, 69, 84, 65,
+ 82, 82, 65, 89, 73, 78,
+ 68, 69, 88, 0, 84, 69,
+ 88, 67, 79, 79, 82, 68,
+ 0, 171, 79, 83, 71, 78,
+ 44, 0, 0, 0, 1, 0,
+ 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 83, 86, 95, 84, 65, 82,
+ 71, 69, 84, 0, 171, 171,
+ 83, 72, 68, 82, 204, 0,
+ 0, 0, 64, 0, 0, 0,
+ 51, 0, 0, 0, 88, 40,
+ 0, 4, 0, 112, 16, 0,
+ 0, 0, 0, 0, 68, 68,
+ 0, 0, 98, 16, 0, 3,
+ 114, 16, 16, 0, 2, 0,
+ 0, 0, 101, 0, 0, 3,
+ 242, 32, 16, 0, 0, 0,
+ 0, 0, 104, 0, 0, 2,
+ 1, 0, 0, 0, 61, 16,
+ 0, 7, 242, 0, 16, 0,
+ 0, 0, 0, 0, 1, 64,
+ 0, 0, 0, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0,
+ 0, 0, 86, 0, 0, 5,
+ 114, 0, 16, 0, 0, 0,
+ 0, 0, 70, 2, 16, 0,
+ 0, 0, 0, 0, 56, 0,
+ 0, 7, 114, 0, 16, 0,
+ 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0,
+ 70, 18, 16, 0, 2, 0,
+ 0, 0, 27, 0, 0, 5,
+ 114, 0, 16, 0, 0, 0,
+ 0, 0, 70, 2, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 5, 130, 0, 16, 0,
+ 0, 0, 0, 0, 1, 64,
+ 0, 0, 0, 0, 0, 0,
+ 45, 0, 0, 7, 242, 32,
+ 16, 0, 0, 0, 0, 0,
+ 70, 14, 16, 0, 0, 0,
+ 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 62, 0,
+ 0, 1, 83, 84, 65, 84,
+ 116, 0, 0, 0, 7, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzlef2darrayps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzlef2darrayps.h
new file mode 100644
index 00000000000..6e531b329a9
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzlef2darrayps.h
@@ -0,0 +1,279 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Buffer Definitions:
+//
+// cbuffer SwizzleProperties
+// {
+//
+// uint4 SwizzleIndices; // Offset: 0 Size: 16
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF2DArray texture float4 2darray 0 1
+// SwizzleProperties cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_constantbuffer cb0[1], immediateIndexed
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+dcl_indexableTemp x0[6], 4
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+mov x0[0].x, r0.x
+mov x0[1].x, r0.y
+mov x0[2].x, r0.z
+mov x0[3].x, r0.w
+mov x0[4].x, l(0)
+mov x0[5].x, l(1.000000)
+mov r0.x, cb0[0].x
+mov o0.x, x0[r0.x + 0].x
+mov r0.x, cb0[0].y
+mov o0.y, x0[r0.x + 0].x
+mov r0.x, cb0[0].z
+mov o0.z, x0[r0.x + 0].x
+mov r0.x, cb0[0].w
+mov o0.w, x0[r0.x + 0].x
+ret
+// Approximately 18 instruction slots used
+#endif
+
+const BYTE g_PS_SwizzleF2DArray[] =
+{
+ 68, 88, 66, 67, 161, 112,
+ 176, 131, 216, 246, 27, 65,
+ 39, 246, 72, 161, 231, 81,
+ 229, 143, 1, 0, 0, 0,
+ 204, 4, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 104, 1, 0, 0, 240, 1,
+ 0, 0, 36, 2, 0, 0,
+ 80, 4, 0, 0, 82, 68,
+ 69, 70, 44, 1, 0, 0,
+ 1, 0, 0, 0, 168, 0,
+ 0, 0, 3, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 248, 0, 0, 0, 124, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0,
+ 132, 0, 0, 0, 2, 0,
+ 0, 0, 5, 0, 0, 0,
+ 5, 0, 0, 0, 255, 255,
+ 255, 255, 0, 0, 0, 0,
+ 1, 0, 0, 0, 13, 0,
+ 0, 0, 148, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 83, 97,
+ 109, 112, 108, 101, 114, 0,
+ 84, 101, 120, 116, 117, 114,
+ 101, 70, 50, 68, 65, 114,
+ 114, 97, 121, 0, 83, 119,
+ 105, 122, 122, 108, 101, 80,
+ 114, 111, 112, 101, 114, 116,
+ 105, 101, 115, 0, 171, 171,
+ 148, 0, 0, 0, 1, 0,
+ 0, 0, 192, 0, 0, 0,
+ 16, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 216, 0, 0, 0, 0, 0,
+ 0, 0, 16, 0, 0, 0,
+ 2, 0, 0, 0, 232, 0,
+ 0, 0, 0, 0, 0, 0,
+ 83, 119, 105, 122, 122, 108,
+ 101, 73, 110, 100, 105, 99,
+ 101, 115, 0, 171, 1, 0,
+ 19, 0, 1, 0, 4, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 77, 105, 99, 114,
+ 111, 115, 111, 102, 116, 32,
+ 40, 82, 41, 32, 72, 76,
+ 83, 76, 32, 83, 104, 97,
+ 100, 101, 114, 32, 67, 111,
+ 109, 112, 105, 108, 101, 114,
+ 32, 57, 46, 51, 48, 46,
+ 57, 50, 48, 48, 46, 49,
+ 54, 51, 56, 52, 0, 171,
+ 73, 83, 71, 78, 128, 0,
+ 0, 0, 3, 0, 0, 0,
+ 8, 0, 0, 0, 80, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 1, 0, 0, 118, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0,
+ 0, 0, 2, 0, 0, 0,
+ 7, 3, 0, 0, 83, 86,
+ 95, 80, 79, 83, 73, 84,
+ 73, 79, 78, 0, 83, 86,
+ 95, 82, 69, 78, 68, 69,
+ 82, 84, 65, 82, 71, 69,
+ 84, 65, 82, 82, 65, 89,
+ 73, 78, 68, 69, 88, 0,
+ 84, 69, 88, 67, 79, 79,
+ 82, 68, 0, 171, 79, 83,
+ 71, 78, 44, 0, 0, 0,
+ 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 83, 86, 95, 84,
+ 65, 82, 71, 69, 84, 0,
+ 171, 171, 83, 72, 68, 82,
+ 36, 2, 0, 0, 64, 0,
+ 0, 0, 137, 0, 0, 0,
+ 89, 0, 0, 4, 70, 142,
+ 32, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 90, 0,
+ 0, 3, 0, 96, 16, 0,
+ 0, 0, 0, 0, 88, 64,
+ 0, 4, 0, 112, 16, 0,
+ 0, 0, 0, 0, 85, 85,
+ 0, 0, 100, 8, 0, 4,
+ 18, 16, 16, 0, 1, 0,
+ 0, 0, 4, 0, 0, 0,
+ 98, 16, 0, 3, 50, 16,
+ 16, 0, 2, 0, 0, 0,
+ 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0,
+ 104, 0, 0, 2, 1, 0,
+ 0, 0, 105, 0, 0, 4,
+ 0, 0, 0, 0, 6, 0,
+ 0, 0, 4, 0, 0, 0,
+ 86, 0, 0, 5, 66, 0,
+ 16, 0, 0, 0, 0, 0,
+ 10, 16, 16, 0, 1, 0,
+ 0, 0, 54, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0,
+ 0, 0, 70, 16, 16, 0,
+ 2, 0, 0, 0, 69, 0,
+ 0, 9, 242, 0, 16, 0,
+ 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0,
+ 0, 0, 0, 96, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 10, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 26, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 42, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 3, 0,
+ 0, 0, 58, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 4, 0,
+ 0, 0, 1, 64, 0, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 5, 0,
+ 0, 0, 1, 64, 0, 0,
+ 0, 0, 128, 63, 54, 0,
+ 0, 6, 18, 0, 16, 0,
+ 0, 0, 0, 0, 10, 128,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 7, 18, 32, 16, 0,
+ 0, 0, 0, 0, 10, 48,
+ 32, 4, 0, 0, 0, 0,
+ 10, 0, 16, 0, 0, 0,
+ 0, 0, 54, 0, 0, 6,
+ 18, 0, 16, 0, 0, 0,
+ 0, 0, 26, 128, 32, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 54, 0, 0, 7,
+ 34, 32, 16, 0, 0, 0,
+ 0, 0, 10, 48, 32, 4,
+ 0, 0, 0, 0, 10, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 0,
+ 16, 0, 0, 0, 0, 0,
+ 42, 128, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 54, 0, 0, 7, 66, 32,
+ 16, 0, 0, 0, 0, 0,
+ 10, 48, 32, 4, 0, 0,
+ 0, 0, 10, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 0, 16, 0,
+ 0, 0, 0, 0, 58, 128,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 7, 130, 32, 16, 0,
+ 0, 0, 0, 0, 10, 48,
+ 32, 4, 0, 0, 0, 0,
+ 10, 0, 16, 0, 0, 0,
+ 0, 0, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0,
+ 0, 0, 18, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 6, 0, 0, 0, 10, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 6, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzlef2dps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzlef2dps.h
new file mode 100644
index 00000000000..3439e7cd521
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzlef2dps.h
@@ -0,0 +1,257 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Buffer Definitions:
+//
+// cbuffer SwizzleProperties
+// {
+//
+// uint4 SwizzleIndices; // Offset: 0 Size: 16
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF2D texture float4 2d 0 1
+// SwizzleProperties cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_constantbuffer cb0[1], immediateIndexed
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+dcl_indexableTemp x0[6], 4
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mov x0[0].x, r0.x
+mov x0[1].x, r0.y
+mov x0[2].x, r0.z
+mov x0[3].x, r0.w
+mov x0[4].x, l(0)
+mov x0[5].x, l(1.000000)
+mov r0.x, cb0[0].x
+mov o0.x, x0[r0.x + 0].x
+mov r0.x, cb0[0].y
+mov o0.y, x0[r0.x + 0].x
+mov r0.x, cb0[0].z
+mov o0.z, x0[r0.x + 0].x
+mov r0.x, cb0[0].w
+mov o0.w, x0[r0.x + 0].x
+ret
+// Approximately 16 instruction slots used
+#endif
+
+const BYTE g_PS_SwizzleF2D[] =
+{
+ 68, 88, 66, 67, 162, 151,
+ 82, 12, 22, 214, 143, 216,
+ 57, 84, 12, 76, 109, 120,
+ 162, 201, 1, 0, 0, 0,
+ 96, 4, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 100, 1, 0, 0, 188, 1,
+ 0, 0, 240, 1, 0, 0,
+ 228, 3, 0, 0, 82, 68,
+ 69, 70, 40, 1, 0, 0,
+ 1, 0, 0, 0, 164, 0,
+ 0, 0, 3, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 244, 0, 0, 0, 124, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0,
+ 132, 0, 0, 0, 2, 0,
+ 0, 0, 5, 0, 0, 0,
+ 4, 0, 0, 0, 255, 255,
+ 255, 255, 0, 0, 0, 0,
+ 1, 0, 0, 0, 13, 0,
+ 0, 0, 143, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 83, 97,
+ 109, 112, 108, 101, 114, 0,
+ 84, 101, 120, 116, 117, 114,
+ 101, 70, 50, 68, 0, 83,
+ 119, 105, 122, 122, 108, 101,
+ 80, 114, 111, 112, 101, 114,
+ 116, 105, 101, 115, 0, 171,
+ 171, 171, 143, 0, 0, 0,
+ 1, 0, 0, 0, 188, 0,
+ 0, 0, 16, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 212, 0, 0, 0,
+ 0, 0, 0, 0, 16, 0,
+ 0, 0, 2, 0, 0, 0,
+ 228, 0, 0, 0, 0, 0,
+ 0, 0, 83, 119, 105, 122,
+ 122, 108, 101, 73, 110, 100,
+ 105, 99, 101, 115, 0, 171,
+ 1, 0, 19, 0, 1, 0,
+ 4, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102,
+ 116, 32, 40, 82, 41, 32,
+ 72, 76, 83, 76, 32, 83,
+ 104, 97, 100, 101, 114, 32,
+ 67, 111, 109, 112, 105, 108,
+ 101, 114, 32, 57, 46, 51,
+ 48, 46, 57, 50, 48, 48,
+ 46, 49, 54, 51, 56, 52,
+ 0, 171, 73, 83, 71, 78,
+ 80, 0, 0, 0, 2, 0,
+ 0, 0, 8, 0, 0, 0,
+ 56, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 68, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 1, 0,
+ 0, 0, 3, 3, 0, 0,
+ 83, 86, 95, 80, 79, 83,
+ 73, 84, 73, 79, 78, 0,
+ 84, 69, 88, 67, 79, 79,
+ 82, 68, 0, 171, 171, 171,
+ 79, 83, 71, 78, 44, 0,
+ 0, 0, 1, 0, 0, 0,
+ 8, 0, 0, 0, 32, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 83, 86,
+ 95, 84, 65, 82, 71, 69,
+ 84, 0, 171, 171, 83, 72,
+ 68, 82, 236, 1, 0, 0,
+ 64, 0, 0, 0, 123, 0,
+ 0, 0, 89, 0, 0, 4,
+ 70, 142, 32, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 90, 0, 0, 3, 0, 96,
+ 16, 0, 0, 0, 0, 0,
+ 88, 24, 0, 4, 0, 112,
+ 16, 0, 0, 0, 0, 0,
+ 85, 85, 0, 0, 98, 16,
+ 0, 3, 50, 16, 16, 0,
+ 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0,
+ 0, 0, 0, 0, 104, 0,
+ 0, 2, 1, 0, 0, 0,
+ 105, 0, 0, 4, 0, 0,
+ 0, 0, 6, 0, 0, 0,
+ 4, 0, 0, 0, 69, 0,
+ 0, 9, 242, 0, 16, 0,
+ 0, 0, 0, 0, 70, 16,
+ 16, 0, 1, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0,
+ 0, 0, 0, 96, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 10, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 26, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 42, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 3, 0,
+ 0, 0, 58, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 4, 0,
+ 0, 0, 1, 64, 0, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 5, 0,
+ 0, 0, 1, 64, 0, 0,
+ 0, 0, 128, 63, 54, 0,
+ 0, 6, 18, 0, 16, 0,
+ 0, 0, 0, 0, 10, 128,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 7, 18, 32, 16, 0,
+ 0, 0, 0, 0, 10, 48,
+ 32, 4, 0, 0, 0, 0,
+ 10, 0, 16, 0, 0, 0,
+ 0, 0, 54, 0, 0, 6,
+ 18, 0, 16, 0, 0, 0,
+ 0, 0, 26, 128, 32, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 54, 0, 0, 7,
+ 34, 32, 16, 0, 0, 0,
+ 0, 0, 10, 48, 32, 4,
+ 0, 0, 0, 0, 10, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 0,
+ 16, 0, 0, 0, 0, 0,
+ 42, 128, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 54, 0, 0, 7, 66, 32,
+ 16, 0, 0, 0, 0, 0,
+ 10, 48, 32, 4, 0, 0,
+ 0, 0, 10, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 0, 16, 0,
+ 0, 0, 0, 0, 58, 128,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 7, 130, 32, 16, 0,
+ 0, 0, 0, 0, 10, 48,
+ 32, 4, 0, 0, 0, 0,
+ 10, 0, 16, 0, 0, 0,
+ 0, 0, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0,
+ 0, 0, 16, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 6, 0, 0, 0, 10, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 5, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzlef3dps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzlef3dps.h
new file mode 100644
index 00000000000..4985c3cc54c
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzlef3dps.h
@@ -0,0 +1,266 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Buffer Definitions:
+//
+// cbuffer SwizzleProperties
+// {
+//
+// uint4 SwizzleIndices; // Offset: 0 Size: 16
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF3D texture float4 3d 0 1
+// SwizzleProperties cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_constantbuffer cb0[1], immediateIndexed
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+dcl_indexableTemp x0[6], 4
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mov x0[0].x, r0.x
+mov x0[1].x, r0.y
+mov x0[2].x, r0.z
+mov x0[3].x, r0.w
+mov x0[4].x, l(0)
+mov x0[5].x, l(1.000000)
+mov r0.x, cb0[0].x
+mov o0.x, x0[r0.x + 0].x
+mov r0.x, cb0[0].y
+mov o0.y, x0[r0.x + 0].x
+mov r0.x, cb0[0].z
+mov o0.z, x0[r0.x + 0].x
+mov r0.x, cb0[0].w
+mov o0.w, x0[r0.x + 0].x
+ret
+// Approximately 16 instruction slots used
+#endif
+
+const BYTE g_PS_SwizzleF3D[] =
+{
+ 68, 88, 66, 67, 112, 23,
+ 39, 219, 141, 10, 170, 22,
+ 165, 204, 123, 149, 248, 84,
+ 184, 117, 1, 0, 0, 0,
+ 144, 4, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 100, 1, 0, 0, 236, 1,
+ 0, 0, 32, 2, 0, 0,
+ 20, 4, 0, 0, 82, 68,
+ 69, 70, 40, 1, 0, 0,
+ 1, 0, 0, 0, 164, 0,
+ 0, 0, 3, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 244, 0, 0, 0, 124, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0,
+ 132, 0, 0, 0, 2, 0,
+ 0, 0, 5, 0, 0, 0,
+ 8, 0, 0, 0, 255, 255,
+ 255, 255, 0, 0, 0, 0,
+ 1, 0, 0, 0, 13, 0,
+ 0, 0, 143, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 83, 97,
+ 109, 112, 108, 101, 114, 0,
+ 84, 101, 120, 116, 117, 114,
+ 101, 70, 51, 68, 0, 83,
+ 119, 105, 122, 122, 108, 101,
+ 80, 114, 111, 112, 101, 114,
+ 116, 105, 101, 115, 0, 171,
+ 171, 171, 143, 0, 0, 0,
+ 1, 0, 0, 0, 188, 0,
+ 0, 0, 16, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 212, 0, 0, 0,
+ 0, 0, 0, 0, 16, 0,
+ 0, 0, 2, 0, 0, 0,
+ 228, 0, 0, 0, 0, 0,
+ 0, 0, 83, 119, 105, 122,
+ 122, 108, 101, 73, 110, 100,
+ 105, 99, 101, 115, 0, 171,
+ 1, 0, 19, 0, 1, 0,
+ 4, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102,
+ 116, 32, 40, 82, 41, 32,
+ 72, 76, 83, 76, 32, 83,
+ 104, 97, 100, 101, 114, 32,
+ 67, 111, 109, 112, 105, 108,
+ 101, 114, 32, 57, 46, 51,
+ 48, 46, 57, 50, 48, 48,
+ 46, 49, 54, 51, 56, 52,
+ 0, 171, 73, 83, 71, 78,
+ 128, 0, 0, 0, 3, 0,
+ 0, 0, 8, 0, 0, 0,
+ 80, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 92, 0, 0, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0,
+ 118, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0,
+ 0, 0, 7, 7, 0, 0,
+ 83, 86, 95, 80, 79, 83,
+ 73, 84, 73, 79, 78, 0,
+ 83, 86, 95, 82, 69, 78,
+ 68, 69, 82, 84, 65, 82,
+ 71, 69, 84, 65, 82, 82,
+ 65, 89, 73, 78, 68, 69,
+ 88, 0, 84, 69, 88, 67,
+ 79, 79, 82, 68, 0, 171,
+ 79, 83, 71, 78, 44, 0,
+ 0, 0, 1, 0, 0, 0,
+ 8, 0, 0, 0, 32, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 83, 86,
+ 95, 84, 65, 82, 71, 69,
+ 84, 0, 171, 171, 83, 72,
+ 68, 82, 236, 1, 0, 0,
+ 64, 0, 0, 0, 123, 0,
+ 0, 0, 89, 0, 0, 4,
+ 70, 142, 32, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 90, 0, 0, 3, 0, 96,
+ 16, 0, 0, 0, 0, 0,
+ 88, 40, 0, 4, 0, 112,
+ 16, 0, 0, 0, 0, 0,
+ 85, 85, 0, 0, 98, 16,
+ 0, 3, 114, 16, 16, 0,
+ 2, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0,
+ 0, 0, 0, 0, 104, 0,
+ 0, 2, 1, 0, 0, 0,
+ 105, 0, 0, 4, 0, 0,
+ 0, 0, 6, 0, 0, 0,
+ 4, 0, 0, 0, 69, 0,
+ 0, 9, 242, 0, 16, 0,
+ 0, 0, 0, 0, 70, 18,
+ 16, 0, 2, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0,
+ 0, 0, 0, 96, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 10, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 26, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 42, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 3, 0,
+ 0, 0, 58, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 4, 0,
+ 0, 0, 1, 64, 0, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 5, 0,
+ 0, 0, 1, 64, 0, 0,
+ 0, 0, 128, 63, 54, 0,
+ 0, 6, 18, 0, 16, 0,
+ 0, 0, 0, 0, 10, 128,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 7, 18, 32, 16, 0,
+ 0, 0, 0, 0, 10, 48,
+ 32, 4, 0, 0, 0, 0,
+ 10, 0, 16, 0, 0, 0,
+ 0, 0, 54, 0, 0, 6,
+ 18, 0, 16, 0, 0, 0,
+ 0, 0, 26, 128, 32, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 54, 0, 0, 7,
+ 34, 32, 16, 0, 0, 0,
+ 0, 0, 10, 48, 32, 4,
+ 0, 0, 0, 0, 10, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 0,
+ 16, 0, 0, 0, 0, 0,
+ 42, 128, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 54, 0, 0, 7, 66, 32,
+ 16, 0, 0, 0, 0, 0,
+ 10, 48, 32, 4, 0, 0,
+ 0, 0, 10, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 0, 16, 0,
+ 0, 0, 0, 0, 58, 128,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 7, 130, 32, 16, 0,
+ 0, 0, 0, 0, 10, 48,
+ 32, 4, 0, 0, 0, 0,
+ 10, 0, 16, 0, 0, 0,
+ 0, 0, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0,
+ 0, 0, 16, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 6, 0, 0, 0, 10, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 5, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzlei2darrayps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzlei2darrayps.h
new file mode 100644
index 00000000000..6f2fa45fc5e
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzlei2darrayps.h
@@ -0,0 +1,287 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Buffer Definitions:
+//
+// cbuffer SwizzleProperties
+// {
+//
+// uint4 SwizzleIndices; // Offset: 0 Size: 16
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI2DArray texture sint4 2darray 0 1
+// SwizzleProperties cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_constantbuffer cb0[1], immediateIndexed
+dcl_resource_texture2darray (sint,sint,sint,sint) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+dcl_indexableTemp x0[6], 4
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v2.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.z, v1.x
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov x0[0].x, r0.x
+mov x0[1].x, r0.y
+mov x0[2].x, r0.z
+mov x0[3].x, r0.w
+mov x0[4].x, l(0)
+mov x0[5].x, l(1)
+mov r0.x, cb0[0].x
+mov o0.x, x0[r0.x + 0].x
+mov r0.x, cb0[0].y
+mov o0.y, x0[r0.x + 0].x
+mov r0.x, cb0[0].z
+mov o0.z, x0[r0.x + 0].x
+mov r0.x, cb0[0].w
+mov o0.w, x0[r0.x + 0].x
+ret
+// Approximately 22 instruction slots used
+#endif
+
+const BYTE g_PS_SwizzleI2DArray[] =
+{
+ 68, 88, 66, 67, 75, 76,
+ 4, 200, 179, 192, 148, 142,
+ 191, 41, 209, 141, 122, 203,
+ 184, 74, 1, 0, 0, 0,
+ 240, 4, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 64, 1, 0, 0, 200, 1,
+ 0, 0, 252, 1, 0, 0,
+ 116, 4, 0, 0, 82, 68,
+ 69, 70, 4, 1, 0, 0,
+ 1, 0, 0, 0, 128, 0,
+ 0, 0, 2, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 208, 0, 0, 0, 92, 0,
+ 0, 0, 2, 0, 0, 0,
+ 3, 0, 0, 0, 5, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0,
+ 108, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 84, 101, 120, 116,
+ 117, 114, 101, 73, 50, 68,
+ 65, 114, 114, 97, 121, 0,
+ 83, 119, 105, 122, 122, 108,
+ 101, 80, 114, 111, 112, 101,
+ 114, 116, 105, 101, 115, 0,
+ 171, 171, 108, 0, 0, 0,
+ 1, 0, 0, 0, 152, 0,
+ 0, 0, 16, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 176, 0, 0, 0,
+ 0, 0, 0, 0, 16, 0,
+ 0, 0, 2, 0, 0, 0,
+ 192, 0, 0, 0, 0, 0,
+ 0, 0, 83, 119, 105, 122,
+ 122, 108, 101, 73, 110, 100,
+ 105, 99, 101, 115, 0, 171,
+ 1, 0, 19, 0, 1, 0,
+ 4, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102,
+ 116, 32, 40, 82, 41, 32,
+ 72, 76, 83, 76, 32, 83,
+ 104, 97, 100, 101, 114, 32,
+ 67, 111, 109, 112, 105, 108,
+ 101, 114, 32, 57, 46, 51,
+ 48, 46, 57, 50, 48, 48,
+ 46, 49, 54, 51, 56, 52,
+ 0, 171, 73, 83, 71, 78,
+ 128, 0, 0, 0, 3, 0,
+ 0, 0, 8, 0, 0, 0,
+ 80, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 92, 0, 0, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 1, 1, 0, 0,
+ 118, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0,
+ 0, 0, 7, 3, 0, 0,
+ 83, 86, 95, 80, 79, 83,
+ 73, 84, 73, 79, 78, 0,
+ 83, 86, 95, 82, 69, 78,
+ 68, 69, 82, 84, 65, 82,
+ 71, 69, 84, 65, 82, 82,
+ 65, 89, 73, 78, 68, 69,
+ 88, 0, 84, 69, 88, 67,
+ 79, 79, 82, 68, 0, 171,
+ 79, 83, 71, 78, 44, 0,
+ 0, 0, 1, 0, 0, 0,
+ 8, 0, 0, 0, 32, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 83, 86,
+ 95, 84, 65, 82, 71, 69,
+ 84, 0, 171, 171, 83, 72,
+ 68, 82, 112, 2, 0, 0,
+ 64, 0, 0, 0, 156, 0,
+ 0, 0, 89, 0, 0, 4,
+ 70, 142, 32, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 88, 64, 0, 4, 0, 112,
+ 16, 0, 0, 0, 0, 0,
+ 51, 51, 0, 0, 100, 8,
+ 0, 4, 18, 16, 16, 0,
+ 1, 0, 0, 0, 4, 0,
+ 0, 0, 98, 16, 0, 3,
+ 50, 16, 16, 0, 2, 0,
+ 0, 0, 101, 0, 0, 3,
+ 242, 32, 16, 0, 0, 0,
+ 0, 0, 104, 0, 0, 2,
+ 1, 0, 0, 0, 105, 0,
+ 0, 4, 0, 0, 0, 0,
+ 6, 0, 0, 0, 4, 0,
+ 0, 0, 61, 16, 0, 7,
+ 242, 0, 16, 0, 0, 0,
+ 0, 0, 1, 64, 0, 0,
+ 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0,
+ 86, 0, 0, 5, 50, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 0, 16, 0, 0, 0,
+ 0, 0, 56, 0, 0, 7,
+ 50, 0, 16, 0, 0, 0,
+ 0, 0, 70, 0, 16, 0,
+ 0, 0, 0, 0, 70, 16,
+ 16, 0, 2, 0, 0, 0,
+ 27, 0, 0, 5, 50, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 0, 16, 0, 0, 0,
+ 0, 0, 54, 0, 0, 5,
+ 66, 0, 16, 0, 0, 0,
+ 0, 0, 10, 16, 16, 0,
+ 1, 0, 0, 0, 54, 0,
+ 0, 5, 130, 0, 16, 0,
+ 0, 0, 0, 0, 1, 64,
+ 0, 0, 0, 0, 0, 0,
+ 45, 0, 0, 7, 242, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 14, 16, 0, 0, 0,
+ 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 10, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 26, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 42, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 3, 0,
+ 0, 0, 58, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 4, 0,
+ 0, 0, 1, 64, 0, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 5, 0,
+ 0, 0, 1, 64, 0, 0,
+ 1, 0, 0, 0, 54, 0,
+ 0, 6, 18, 0, 16, 0,
+ 0, 0, 0, 0, 10, 128,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 7, 18, 32, 16, 0,
+ 0, 0, 0, 0, 10, 48,
+ 32, 4, 0, 0, 0, 0,
+ 10, 0, 16, 0, 0, 0,
+ 0, 0, 54, 0, 0, 6,
+ 18, 0, 16, 0, 0, 0,
+ 0, 0, 26, 128, 32, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 54, 0, 0, 7,
+ 34, 32, 16, 0, 0, 0,
+ 0, 0, 10, 48, 32, 4,
+ 0, 0, 0, 0, 10, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 0,
+ 16, 0, 0, 0, 0, 0,
+ 42, 128, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 54, 0, 0, 7, 66, 32,
+ 16, 0, 0, 0, 0, 0,
+ 10, 48, 32, 4, 0, 0,
+ 0, 0, 10, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 0, 16, 0,
+ 0, 0, 0, 0, 58, 128,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 7, 130, 32, 16, 0,
+ 0, 0, 0, 0, 10, 48,
+ 32, 4, 0, 0, 0, 0,
+ 10, 0, 16, 0, 0, 0,
+ 0, 0, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0,
+ 0, 0, 22, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 6, 0, 0, 0, 10, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 7, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzlei2dps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzlei2dps.h
new file mode 100644
index 00000000000..f7d4540112c
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzlei2dps.h
@@ -0,0 +1,271 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Buffer Definitions:
+//
+// cbuffer SwizzleProperties
+// {
+//
+// uint4 SwizzleIndices; // Offset: 0 Size: 16
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI2D texture sint4 2d 0 1
+// SwizzleProperties cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_constantbuffer cb0[1], immediateIndexed
+dcl_resource_texture2d (sint,sint,sint,sint) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+dcl_indexableTemp x0[6], 4
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov x0[0].x, r0.x
+mov x0[1].x, r0.y
+mov x0[2].x, r0.z
+mov x0[3].x, r0.w
+mov x0[4].x, l(0)
+mov x0[5].x, l(1)
+mov r0.x, cb0[0].x
+mov o0.x, x0[r0.x + 0].x
+mov r0.x, cb0[0].y
+mov o0.y, x0[r0.x + 0].x
+mov r0.x, cb0[0].z
+mov o0.z, x0[r0.x + 0].x
+mov r0.x, cb0[0].w
+mov o0.w, x0[r0.x + 0].x
+ret
+// Approximately 21 instruction slots used
+#endif
+
+const BYTE g_PS_SwizzleI2D[] =
+{
+ 68, 88, 66, 67, 137, 89,
+ 210, 142, 141, 7, 14, 194,
+ 111, 71, 23, 167, 232, 166,
+ 154, 59, 1, 0, 0, 0,
+ 164, 4, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 60, 1, 0, 0, 148, 1,
+ 0, 0, 200, 1, 0, 0,
+ 40, 4, 0, 0, 82, 68,
+ 69, 70, 0, 1, 0, 0,
+ 1, 0, 0, 0, 124, 0,
+ 0, 0, 2, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 204, 0, 0, 0, 92, 0,
+ 0, 0, 2, 0, 0, 0,
+ 3, 0, 0, 0, 4, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0,
+ 103, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 84, 101, 120, 116,
+ 117, 114, 101, 73, 50, 68,
+ 0, 83, 119, 105, 122, 122,
+ 108, 101, 80, 114, 111, 112,
+ 101, 114, 116, 105, 101, 115,
+ 0, 171, 171, 171, 103, 0,
+ 0, 0, 1, 0, 0, 0,
+ 148, 0, 0, 0, 16, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 172, 0,
+ 0, 0, 0, 0, 0, 0,
+ 16, 0, 0, 0, 2, 0,
+ 0, 0, 188, 0, 0, 0,
+ 0, 0, 0, 0, 83, 119,
+ 105, 122, 122, 108, 101, 73,
+ 110, 100, 105, 99, 101, 115,
+ 0, 171, 1, 0, 19, 0,
+ 1, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 77, 105, 99, 114, 111, 115,
+ 111, 102, 116, 32, 40, 82,
+ 41, 32, 72, 76, 83, 76,
+ 32, 83, 104, 97, 100, 101,
+ 114, 32, 67, 111, 109, 112,
+ 105, 108, 101, 114, 32, 57,
+ 46, 51, 48, 46, 57, 50,
+ 48, 48, 46, 49, 54, 51,
+ 56, 52, 0, 171, 73, 83,
+ 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0,
+ 0, 0, 56, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 68, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 1, 0, 0, 0, 3, 3,
+ 0, 0, 83, 86, 95, 80,
+ 79, 83, 73, 84, 73, 79,
+ 78, 0, 84, 69, 88, 67,
+ 79, 79, 82, 68, 0, 171,
+ 171, 171, 79, 83, 71, 78,
+ 44, 0, 0, 0, 1, 0,
+ 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 83, 86, 95, 84, 65, 82,
+ 71, 69, 84, 0, 171, 171,
+ 83, 72, 68, 82, 88, 2,
+ 0, 0, 64, 0, 0, 0,
+ 150, 0, 0, 0, 89, 0,
+ 0, 4, 70, 142, 32, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 88, 24, 0, 4,
+ 0, 112, 16, 0, 0, 0,
+ 0, 0, 51, 51, 0, 0,
+ 98, 16, 0, 3, 50, 16,
+ 16, 0, 1, 0, 0, 0,
+ 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0,
+ 104, 0, 0, 2, 1, 0,
+ 0, 0, 105, 0, 0, 4,
+ 0, 0, 0, 0, 6, 0,
+ 0, 0, 4, 0, 0, 0,
+ 61, 16, 0, 7, 242, 0,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 86, 0,
+ 0, 5, 50, 0, 16, 0,
+ 0, 0, 0, 0, 70, 0,
+ 16, 0, 0, 0, 0, 0,
+ 56, 0, 0, 7, 50, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 0, 16, 0, 0, 0,
+ 0, 0, 70, 16, 16, 0,
+ 1, 0, 0, 0, 27, 0,
+ 0, 5, 50, 0, 16, 0,
+ 0, 0, 0, 0, 70, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 8, 194, 0,
+ 16, 0, 0, 0, 0, 0,
+ 2, 64, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 45, 0, 0, 7,
+ 242, 0, 16, 0, 0, 0,
+ 0, 0, 70, 14, 16, 0,
+ 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 48,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 10, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 48,
+ 32, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 26, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 48,
+ 32, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 42, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 48,
+ 32, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 58, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 48,
+ 32, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 1, 64,
+ 0, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 48,
+ 32, 0, 0, 0, 0, 0,
+ 5, 0, 0, 0, 1, 64,
+ 0, 0, 1, 0, 0, 0,
+ 54, 0, 0, 6, 18, 0,
+ 16, 0, 0, 0, 0, 0,
+ 10, 128, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 54, 0, 0, 7, 18, 32,
+ 16, 0, 0, 0, 0, 0,
+ 10, 48, 32, 4, 0, 0,
+ 0, 0, 10, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 0, 16, 0,
+ 0, 0, 0, 0, 26, 128,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 7, 34, 32, 16, 0,
+ 0, 0, 0, 0, 10, 48,
+ 32, 4, 0, 0, 0, 0,
+ 10, 0, 16, 0, 0, 0,
+ 0, 0, 54, 0, 0, 6,
+ 18, 0, 16, 0, 0, 0,
+ 0, 0, 42, 128, 32, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 54, 0, 0, 7,
+ 66, 32, 16, 0, 0, 0,
+ 0, 0, 10, 48, 32, 4,
+ 0, 0, 0, 0, 10, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 0,
+ 16, 0, 0, 0, 0, 0,
+ 58, 128, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 54, 0, 0, 7, 130, 32,
+ 16, 0, 0, 0, 0, 0,
+ 10, 48, 32, 4, 0, 0,
+ 0, 0, 10, 0, 16, 0,
+ 0, 0, 0, 0, 62, 0,
+ 0, 1, 83, 84, 65, 84,
+ 116, 0, 0, 0, 21, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 6, 0, 0, 0,
+ 10, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 6, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzlei3dps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzlei3dps.h
new file mode 100644
index 00000000000..064c2760449
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzlei3dps.h
@@ -0,0 +1,278 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Buffer Definitions:
+//
+// cbuffer SwizzleProperties
+// {
+//
+// uint4 SwizzleIndices; // Offset: 0 Size: 16
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI3D texture sint4 3d 0 1
+// SwizzleProperties cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_constantbuffer cb0[1], immediateIndexed
+dcl_resource_texture3d (sint,sint,sint,sint) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+dcl_indexableTemp x0[6], 4
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xyz, r0.xyzx
+mul r0.xyz, r0.xyzx, v2.xyzx
+ftoi r0.xyz, r0.xyzx
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov x0[0].x, r0.x
+mov x0[1].x, r0.y
+mov x0[2].x, r0.z
+mov x0[3].x, r0.w
+mov x0[4].x, l(0)
+mov x0[5].x, l(1)
+mov r0.x, cb0[0].x
+mov o0.x, x0[r0.x + 0].x
+mov r0.x, cb0[0].y
+mov o0.y, x0[r0.x + 0].x
+mov r0.x, cb0[0].z
+mov o0.z, x0[r0.x + 0].x
+mov r0.x, cb0[0].w
+mov o0.w, x0[r0.x + 0].x
+ret
+// Approximately 21 instruction slots used
+#endif
+
+const BYTE g_PS_SwizzleI3D[] =
+{
+ 68, 88, 66, 67, 101, 41,
+ 194, 229, 103, 175, 204, 102,
+ 192, 43, 200, 161, 117, 114,
+ 19, 252, 1, 0, 0, 0,
+ 200, 4, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 60, 1, 0, 0, 196, 1,
+ 0, 0, 248, 1, 0, 0,
+ 76, 4, 0, 0, 82, 68,
+ 69, 70, 0, 1, 0, 0,
+ 1, 0, 0, 0, 124, 0,
+ 0, 0, 2, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 204, 0, 0, 0, 92, 0,
+ 0, 0, 2, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0,
+ 103, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 84, 101, 120, 116,
+ 117, 114, 101, 73, 51, 68,
+ 0, 83, 119, 105, 122, 122,
+ 108, 101, 80, 114, 111, 112,
+ 101, 114, 116, 105, 101, 115,
+ 0, 171, 171, 171, 103, 0,
+ 0, 0, 1, 0, 0, 0,
+ 148, 0, 0, 0, 16, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 172, 0,
+ 0, 0, 0, 0, 0, 0,
+ 16, 0, 0, 0, 2, 0,
+ 0, 0, 188, 0, 0, 0,
+ 0, 0, 0, 0, 83, 119,
+ 105, 122, 122, 108, 101, 73,
+ 110, 100, 105, 99, 101, 115,
+ 0, 171, 1, 0, 19, 0,
+ 1, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 77, 105, 99, 114, 111, 115,
+ 111, 102, 116, 32, 40, 82,
+ 41, 32, 72, 76, 83, 76,
+ 32, 83, 104, 97, 100, 101,
+ 114, 32, 67, 111, 109, 112,
+ 105, 108, 101, 114, 32, 57,
+ 46, 51, 48, 46, 57, 50,
+ 48, 48, 46, 49, 54, 51,
+ 56, 52, 0, 171, 73, 83,
+ 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0,
+ 0, 0, 80, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0,
+ 0, 0, 0, 0, 4, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 118, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7,
+ 0, 0, 83, 86, 95, 80,
+ 79, 83, 73, 84, 73, 79,
+ 78, 0, 83, 86, 95, 82,
+ 69, 78, 68, 69, 82, 84,
+ 65, 82, 71, 69, 84, 65,
+ 82, 82, 65, 89, 73, 78,
+ 68, 69, 88, 0, 84, 69,
+ 88, 67, 79, 79, 82, 68,
+ 0, 171, 79, 83, 71, 78,
+ 44, 0, 0, 0, 1, 0,
+ 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 83, 86, 95, 84, 65, 82,
+ 71, 69, 84, 0, 171, 171,
+ 83, 72, 68, 82, 76, 2,
+ 0, 0, 64, 0, 0, 0,
+ 147, 0, 0, 0, 89, 0,
+ 0, 4, 70, 142, 32, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 88, 40, 0, 4,
+ 0, 112, 16, 0, 0, 0,
+ 0, 0, 51, 51, 0, 0,
+ 98, 16, 0, 3, 114, 16,
+ 16, 0, 2, 0, 0, 0,
+ 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0,
+ 104, 0, 0, 2, 1, 0,
+ 0, 0, 105, 0, 0, 4,
+ 0, 0, 0, 0, 6, 0,
+ 0, 0, 4, 0, 0, 0,
+ 61, 16, 0, 7, 242, 0,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 86, 0,
+ 0, 5, 114, 0, 16, 0,
+ 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0,
+ 56, 0, 0, 7, 114, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 2, 16, 0, 0, 0,
+ 0, 0, 70, 18, 16, 0,
+ 2, 0, 0, 0, 27, 0,
+ 0, 5, 114, 0, 16, 0,
+ 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 5, 130, 0,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 45, 0, 0, 7,
+ 242, 0, 16, 0, 0, 0,
+ 0, 0, 70, 14, 16, 0,
+ 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 48,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 10, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 48,
+ 32, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 26, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 48,
+ 32, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 42, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 48,
+ 32, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 58, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 48,
+ 32, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 1, 64,
+ 0, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 48,
+ 32, 0, 0, 0, 0, 0,
+ 5, 0, 0, 0, 1, 64,
+ 0, 0, 1, 0, 0, 0,
+ 54, 0, 0, 6, 18, 0,
+ 16, 0, 0, 0, 0, 0,
+ 10, 128, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 54, 0, 0, 7, 18, 32,
+ 16, 0, 0, 0, 0, 0,
+ 10, 48, 32, 4, 0, 0,
+ 0, 0, 10, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 0, 16, 0,
+ 0, 0, 0, 0, 26, 128,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 7, 34, 32, 16, 0,
+ 0, 0, 0, 0, 10, 48,
+ 32, 4, 0, 0, 0, 0,
+ 10, 0, 16, 0, 0, 0,
+ 0, 0, 54, 0, 0, 6,
+ 18, 0, 16, 0, 0, 0,
+ 0, 0, 42, 128, 32, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 54, 0, 0, 7,
+ 66, 32, 16, 0, 0, 0,
+ 0, 0, 10, 48, 32, 4,
+ 0, 0, 0, 0, 10, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 0,
+ 16, 0, 0, 0, 0, 0,
+ 58, 128, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 54, 0, 0, 7, 130, 32,
+ 16, 0, 0, 0, 0, 0,
+ 10, 48, 32, 4, 0, 0,
+ 0, 0, 10, 0, 16, 0,
+ 0, 0, 0, 0, 62, 0,
+ 0, 1, 83, 84, 65, 84,
+ 116, 0, 0, 0, 21, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 6, 0, 0, 0,
+ 10, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 6, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzleui2darrayps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzleui2darrayps.h
new file mode 100644
index 00000000000..5fa9a54cd21
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzleui2darrayps.h
@@ -0,0 +1,287 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Buffer Definitions:
+//
+// cbuffer SwizzleProperties
+// {
+//
+// uint4 SwizzleIndices; // Offset: 0 Size: 16
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI2DArray texture uint4 2darray 0 1
+// SwizzleProperties cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_constantbuffer cb0[1], immediateIndexed
+dcl_resource_texture2darray (uint,uint,uint,uint) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+dcl_indexableTemp x0[6], 4
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v2.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.z, v1.x
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov x0[0].x, r0.x
+mov x0[1].x, r0.y
+mov x0[2].x, r0.z
+mov x0[3].x, r0.w
+mov x0[4].x, l(0)
+mov x0[5].x, l(1)
+mov r0.x, cb0[0].x
+mov o0.x, x0[r0.x + 0].x
+mov r0.x, cb0[0].y
+mov o0.y, x0[r0.x + 0].x
+mov r0.x, cb0[0].z
+mov o0.z, x0[r0.x + 0].x
+mov r0.x, cb0[0].w
+mov o0.w, x0[r0.x + 0].x
+ret
+// Approximately 22 instruction slots used
+#endif
+
+const BYTE g_PS_SwizzleUI2DArray[] =
+{
+ 68, 88, 66, 67, 239, 117,
+ 221, 64, 238, 147, 130, 15,
+ 39, 48, 171, 143, 66, 71,
+ 242, 70, 1, 0, 0, 0,
+ 240, 4, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 64, 1, 0, 0, 200, 1,
+ 0, 0, 252, 1, 0, 0,
+ 116, 4, 0, 0, 82, 68,
+ 69, 70, 4, 1, 0, 0,
+ 1, 0, 0, 0, 128, 0,
+ 0, 0, 2, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 208, 0, 0, 0, 92, 0,
+ 0, 0, 2, 0, 0, 0,
+ 4, 0, 0, 0, 5, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0,
+ 109, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 84, 101, 120, 116,
+ 117, 114, 101, 85, 73, 50,
+ 68, 65, 114, 114, 97, 121,
+ 0, 83, 119, 105, 122, 122,
+ 108, 101, 80, 114, 111, 112,
+ 101, 114, 116, 105, 101, 115,
+ 0, 171, 109, 0, 0, 0,
+ 1, 0, 0, 0, 152, 0,
+ 0, 0, 16, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 176, 0, 0, 0,
+ 0, 0, 0, 0, 16, 0,
+ 0, 0, 2, 0, 0, 0,
+ 192, 0, 0, 0, 0, 0,
+ 0, 0, 83, 119, 105, 122,
+ 122, 108, 101, 73, 110, 100,
+ 105, 99, 101, 115, 0, 171,
+ 1, 0, 19, 0, 1, 0,
+ 4, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102,
+ 116, 32, 40, 82, 41, 32,
+ 72, 76, 83, 76, 32, 83,
+ 104, 97, 100, 101, 114, 32,
+ 67, 111, 109, 112, 105, 108,
+ 101, 114, 32, 57, 46, 51,
+ 48, 46, 57, 50, 48, 48,
+ 46, 49, 54, 51, 56, 52,
+ 0, 171, 73, 83, 71, 78,
+ 128, 0, 0, 0, 3, 0,
+ 0, 0, 8, 0, 0, 0,
+ 80, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 92, 0, 0, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 1, 1, 0, 0,
+ 118, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0,
+ 0, 0, 7, 3, 0, 0,
+ 83, 86, 95, 80, 79, 83,
+ 73, 84, 73, 79, 78, 0,
+ 83, 86, 95, 82, 69, 78,
+ 68, 69, 82, 84, 65, 82,
+ 71, 69, 84, 65, 82, 82,
+ 65, 89, 73, 78, 68, 69,
+ 88, 0, 84, 69, 88, 67,
+ 79, 79, 82, 68, 0, 171,
+ 79, 83, 71, 78, 44, 0,
+ 0, 0, 1, 0, 0, 0,
+ 8, 0, 0, 0, 32, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 83, 86,
+ 95, 84, 65, 82, 71, 69,
+ 84, 0, 171, 171, 83, 72,
+ 68, 82, 112, 2, 0, 0,
+ 64, 0, 0, 0, 156, 0,
+ 0, 0, 89, 0, 0, 4,
+ 70, 142, 32, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 88, 64, 0, 4, 0, 112,
+ 16, 0, 0, 0, 0, 0,
+ 68, 68, 0, 0, 100, 8,
+ 0, 4, 18, 16, 16, 0,
+ 1, 0, 0, 0, 4, 0,
+ 0, 0, 98, 16, 0, 3,
+ 50, 16, 16, 0, 2, 0,
+ 0, 0, 101, 0, 0, 3,
+ 242, 32, 16, 0, 0, 0,
+ 0, 0, 104, 0, 0, 2,
+ 1, 0, 0, 0, 105, 0,
+ 0, 4, 0, 0, 0, 0,
+ 6, 0, 0, 0, 4, 0,
+ 0, 0, 61, 16, 0, 7,
+ 242, 0, 16, 0, 0, 0,
+ 0, 0, 1, 64, 0, 0,
+ 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0,
+ 86, 0, 0, 5, 50, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 0, 16, 0, 0, 0,
+ 0, 0, 56, 0, 0, 7,
+ 50, 0, 16, 0, 0, 0,
+ 0, 0, 70, 0, 16, 0,
+ 0, 0, 0, 0, 70, 16,
+ 16, 0, 2, 0, 0, 0,
+ 27, 0, 0, 5, 50, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 0, 16, 0, 0, 0,
+ 0, 0, 54, 0, 0, 5,
+ 66, 0, 16, 0, 0, 0,
+ 0, 0, 10, 16, 16, 0,
+ 1, 0, 0, 0, 54, 0,
+ 0, 5, 130, 0, 16, 0,
+ 0, 0, 0, 0, 1, 64,
+ 0, 0, 0, 0, 0, 0,
+ 45, 0, 0, 7, 242, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 14, 16, 0, 0, 0,
+ 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 10, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 26, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 42, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 3, 0,
+ 0, 0, 58, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 4, 0,
+ 0, 0, 1, 64, 0, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 5, 0,
+ 0, 0, 1, 64, 0, 0,
+ 1, 0, 0, 0, 54, 0,
+ 0, 6, 18, 0, 16, 0,
+ 0, 0, 0, 0, 10, 128,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 7, 18, 32, 16, 0,
+ 0, 0, 0, 0, 10, 48,
+ 32, 4, 0, 0, 0, 0,
+ 10, 0, 16, 0, 0, 0,
+ 0, 0, 54, 0, 0, 6,
+ 18, 0, 16, 0, 0, 0,
+ 0, 0, 26, 128, 32, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 54, 0, 0, 7,
+ 34, 32, 16, 0, 0, 0,
+ 0, 0, 10, 48, 32, 4,
+ 0, 0, 0, 0, 10, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 0,
+ 16, 0, 0, 0, 0, 0,
+ 42, 128, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 54, 0, 0, 7, 66, 32,
+ 16, 0, 0, 0, 0, 0,
+ 10, 48, 32, 4, 0, 0,
+ 0, 0, 10, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 0, 16, 0,
+ 0, 0, 0, 0, 58, 128,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 7, 130, 32, 16, 0,
+ 0, 0, 0, 0, 10, 48,
+ 32, 4, 0, 0, 0, 0,
+ 10, 0, 16, 0, 0, 0,
+ 0, 0, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0,
+ 0, 0, 22, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 6, 0, 0, 0, 10, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 7, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzleui2dps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzleui2dps.h
new file mode 100644
index 00000000000..9b5b73a00b7
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzleui2dps.h
@@ -0,0 +1,271 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Buffer Definitions:
+//
+// cbuffer SwizzleProperties
+// {
+//
+// uint4 SwizzleIndices; // Offset: 0 Size: 16
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI2D texture uint4 2d 0 1
+// SwizzleProperties cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_constantbuffer cb0[1], immediateIndexed
+dcl_resource_texture2d (uint,uint,uint,uint) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+dcl_indexableTemp x0[6], 4
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov x0[0].x, r0.x
+mov x0[1].x, r0.y
+mov x0[2].x, r0.z
+mov x0[3].x, r0.w
+mov x0[4].x, l(0)
+mov x0[5].x, l(1)
+mov r0.x, cb0[0].x
+mov o0.x, x0[r0.x + 0].x
+mov r0.x, cb0[0].y
+mov o0.y, x0[r0.x + 0].x
+mov r0.x, cb0[0].z
+mov o0.z, x0[r0.x + 0].x
+mov r0.x, cb0[0].w
+mov o0.w, x0[r0.x + 0].x
+ret
+// Approximately 21 instruction slots used
+#endif
+
+const BYTE g_PS_SwizzleUI2D[] =
+{
+ 68, 88, 66, 67, 255, 167,
+ 19, 151, 79, 137, 69, 230,
+ 159, 28, 107, 211, 13, 155,
+ 249, 151, 1, 0, 0, 0,
+ 164, 4, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 60, 1, 0, 0, 148, 1,
+ 0, 0, 200, 1, 0, 0,
+ 40, 4, 0, 0, 82, 68,
+ 69, 70, 0, 1, 0, 0,
+ 1, 0, 0, 0, 124, 0,
+ 0, 0, 2, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 204, 0, 0, 0, 92, 0,
+ 0, 0, 2, 0, 0, 0,
+ 4, 0, 0, 0, 4, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0,
+ 104, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 84, 101, 120, 116,
+ 117, 114, 101, 85, 73, 50,
+ 68, 0, 83, 119, 105, 122,
+ 122, 108, 101, 80, 114, 111,
+ 112, 101, 114, 116, 105, 101,
+ 115, 0, 171, 171, 104, 0,
+ 0, 0, 1, 0, 0, 0,
+ 148, 0, 0, 0, 16, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 172, 0,
+ 0, 0, 0, 0, 0, 0,
+ 16, 0, 0, 0, 2, 0,
+ 0, 0, 188, 0, 0, 0,
+ 0, 0, 0, 0, 83, 119,
+ 105, 122, 122, 108, 101, 73,
+ 110, 100, 105, 99, 101, 115,
+ 0, 171, 1, 0, 19, 0,
+ 1, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 77, 105, 99, 114, 111, 115,
+ 111, 102, 116, 32, 40, 82,
+ 41, 32, 72, 76, 83, 76,
+ 32, 83, 104, 97, 100, 101,
+ 114, 32, 67, 111, 109, 112,
+ 105, 108, 101, 114, 32, 57,
+ 46, 51, 48, 46, 57, 50,
+ 48, 48, 46, 49, 54, 51,
+ 56, 52, 0, 171, 73, 83,
+ 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0,
+ 0, 0, 56, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 68, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 1, 0, 0, 0, 3, 3,
+ 0, 0, 83, 86, 95, 80,
+ 79, 83, 73, 84, 73, 79,
+ 78, 0, 84, 69, 88, 67,
+ 79, 79, 82, 68, 0, 171,
+ 171, 171, 79, 83, 71, 78,
+ 44, 0, 0, 0, 1, 0,
+ 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 83, 86, 95, 84, 65, 82,
+ 71, 69, 84, 0, 171, 171,
+ 83, 72, 68, 82, 88, 2,
+ 0, 0, 64, 0, 0, 0,
+ 150, 0, 0, 0, 89, 0,
+ 0, 4, 70, 142, 32, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 88, 24, 0, 4,
+ 0, 112, 16, 0, 0, 0,
+ 0, 0, 68, 68, 0, 0,
+ 98, 16, 0, 3, 50, 16,
+ 16, 0, 1, 0, 0, 0,
+ 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0,
+ 104, 0, 0, 2, 1, 0,
+ 0, 0, 105, 0, 0, 4,
+ 0, 0, 0, 0, 6, 0,
+ 0, 0, 4, 0, 0, 0,
+ 61, 16, 0, 7, 242, 0,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 86, 0,
+ 0, 5, 50, 0, 16, 0,
+ 0, 0, 0, 0, 70, 0,
+ 16, 0, 0, 0, 0, 0,
+ 56, 0, 0, 7, 50, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 0, 16, 0, 0, 0,
+ 0, 0, 70, 16, 16, 0,
+ 1, 0, 0, 0, 27, 0,
+ 0, 5, 50, 0, 16, 0,
+ 0, 0, 0, 0, 70, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 8, 194, 0,
+ 16, 0, 0, 0, 0, 0,
+ 2, 64, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 45, 0, 0, 7,
+ 242, 0, 16, 0, 0, 0,
+ 0, 0, 70, 14, 16, 0,
+ 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 48,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 10, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 48,
+ 32, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 26, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 48,
+ 32, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 42, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 48,
+ 32, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 58, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 48,
+ 32, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 1, 64,
+ 0, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 48,
+ 32, 0, 0, 0, 0, 0,
+ 5, 0, 0, 0, 1, 64,
+ 0, 0, 1, 0, 0, 0,
+ 54, 0, 0, 6, 18, 0,
+ 16, 0, 0, 0, 0, 0,
+ 10, 128, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 54, 0, 0, 7, 18, 32,
+ 16, 0, 0, 0, 0, 0,
+ 10, 48, 32, 4, 0, 0,
+ 0, 0, 10, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 0, 16, 0,
+ 0, 0, 0, 0, 26, 128,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 7, 34, 32, 16, 0,
+ 0, 0, 0, 0, 10, 48,
+ 32, 4, 0, 0, 0, 0,
+ 10, 0, 16, 0, 0, 0,
+ 0, 0, 54, 0, 0, 6,
+ 18, 0, 16, 0, 0, 0,
+ 0, 0, 42, 128, 32, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 54, 0, 0, 7,
+ 66, 32, 16, 0, 0, 0,
+ 0, 0, 10, 48, 32, 4,
+ 0, 0, 0, 0, 10, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 0,
+ 16, 0, 0, 0, 0, 0,
+ 58, 128, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 54, 0, 0, 7, 130, 32,
+ 16, 0, 0, 0, 0, 0,
+ 10, 48, 32, 4, 0, 0,
+ 0, 0, 10, 0, 16, 0,
+ 0, 0, 0, 0, 62, 0,
+ 0, 1, 83, 84, 65, 84,
+ 116, 0, 0, 0, 21, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 6, 0, 0, 0,
+ 10, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 6, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzleui3dps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzleui3dps.h
new file mode 100644
index 00000000000..87d4c5419a5
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/compiled/swizzleui3dps.h
@@ -0,0 +1,278 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+//
+///
+// Buffer Definitions:
+//
+// cbuffer SwizzleProperties
+// {
+//
+// uint4 SwizzleIndices; // Offset: 0 Size: 16
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI3D texture uint4 3d 0 1
+// SwizzleProperties cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_constantbuffer cb0[1], immediateIndexed
+dcl_resource_texture3d (uint,uint,uint,uint) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+dcl_indexableTemp x0[6], 4
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xyz, r0.xyzx
+mul r0.xyz, r0.xyzx, v2.xyzx
+ftoi r0.xyz, r0.xyzx
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov x0[0].x, r0.x
+mov x0[1].x, r0.y
+mov x0[2].x, r0.z
+mov x0[3].x, r0.w
+mov x0[4].x, l(0)
+mov x0[5].x, l(1)
+mov r0.x, cb0[0].x
+mov o0.x, x0[r0.x + 0].x
+mov r0.x, cb0[0].y
+mov o0.y, x0[r0.x + 0].x
+mov r0.x, cb0[0].z
+mov o0.z, x0[r0.x + 0].x
+mov r0.x, cb0[0].w
+mov o0.w, x0[r0.x + 0].x
+ret
+// Approximately 21 instruction slots used
+#endif
+
+const BYTE g_PS_SwizzleUI3D[] =
+{
+ 68, 88, 66, 67, 49, 1,
+ 112, 225, 163, 227, 102, 82,
+ 218, 3, 161, 60, 179, 27,
+ 12, 252, 1, 0, 0, 0,
+ 200, 4, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 60, 1, 0, 0, 196, 1,
+ 0, 0, 248, 1, 0, 0,
+ 76, 4, 0, 0, 82, 68,
+ 69, 70, 0, 1, 0, 0,
+ 1, 0, 0, 0, 124, 0,
+ 0, 0, 2, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4,
+ 255, 255, 0, 1, 0, 0,
+ 204, 0, 0, 0, 92, 0,
+ 0, 0, 2, 0, 0, 0,
+ 4, 0, 0, 0, 8, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0,
+ 104, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 84, 101, 120, 116,
+ 117, 114, 101, 85, 73, 51,
+ 68, 0, 83, 119, 105, 122,
+ 122, 108, 101, 80, 114, 111,
+ 112, 101, 114, 116, 105, 101,
+ 115, 0, 171, 171, 104, 0,
+ 0, 0, 1, 0, 0, 0,
+ 148, 0, 0, 0, 16, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 172, 0,
+ 0, 0, 0, 0, 0, 0,
+ 16, 0, 0, 0, 2, 0,
+ 0, 0, 188, 0, 0, 0,
+ 0, 0, 0, 0, 83, 119,
+ 105, 122, 122, 108, 101, 73,
+ 110, 100, 105, 99, 101, 115,
+ 0, 171, 1, 0, 19, 0,
+ 1, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 77, 105, 99, 114, 111, 115,
+ 111, 102, 116, 32, 40, 82,
+ 41, 32, 72, 76, 83, 76,
+ 32, 83, 104, 97, 100, 101,
+ 114, 32, 67, 111, 109, 112,
+ 105, 108, 101, 114, 32, 57,
+ 46, 51, 48, 46, 57, 50,
+ 48, 48, 46, 49, 54, 51,
+ 56, 52, 0, 171, 73, 83,
+ 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0,
+ 0, 0, 80, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0,
+ 0, 0, 0, 0, 4, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 118, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7,
+ 0, 0, 83, 86, 95, 80,
+ 79, 83, 73, 84, 73, 79,
+ 78, 0, 83, 86, 95, 82,
+ 69, 78, 68, 69, 82, 84,
+ 65, 82, 71, 69, 84, 65,
+ 82, 82, 65, 89, 73, 78,
+ 68, 69, 88, 0, 84, 69,
+ 88, 67, 79, 79, 82, 68,
+ 0, 171, 79, 83, 71, 78,
+ 44, 0, 0, 0, 1, 0,
+ 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 83, 86, 95, 84, 65, 82,
+ 71, 69, 84, 0, 171, 171,
+ 83, 72, 68, 82, 76, 2,
+ 0, 0, 64, 0, 0, 0,
+ 147, 0, 0, 0, 89, 0,
+ 0, 4, 70, 142, 32, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 88, 40, 0, 4,
+ 0, 112, 16, 0, 0, 0,
+ 0, 0, 68, 68, 0, 0,
+ 98, 16, 0, 3, 114, 16,
+ 16, 0, 2, 0, 0, 0,
+ 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0,
+ 104, 0, 0, 2, 1, 0,
+ 0, 0, 105, 0, 0, 4,
+ 0, 0, 0, 0, 6, 0,
+ 0, 0, 4, 0, 0, 0,
+ 61, 16, 0, 7, 242, 0,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 86, 0,
+ 0, 5, 114, 0, 16, 0,
+ 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0,
+ 56, 0, 0, 7, 114, 0,
+ 16, 0, 0, 0, 0, 0,
+ 70, 2, 16, 0, 0, 0,
+ 0, 0, 70, 18, 16, 0,
+ 2, 0, 0, 0, 27, 0,
+ 0, 5, 114, 0, 16, 0,
+ 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 5, 130, 0,
+ 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0,
+ 0, 0, 45, 0, 0, 7,
+ 242, 0, 16, 0, 0, 0,
+ 0, 0, 70, 14, 16, 0,
+ 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 48,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 10, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 48,
+ 32, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 26, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 48,
+ 32, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 42, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 48,
+ 32, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 58, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 48,
+ 32, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 1, 64,
+ 0, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 48,
+ 32, 0, 0, 0, 0, 0,
+ 5, 0, 0, 0, 1, 64,
+ 0, 0, 1, 0, 0, 0,
+ 54, 0, 0, 6, 18, 0,
+ 16, 0, 0, 0, 0, 0,
+ 10, 128, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 54, 0, 0, 7, 18, 32,
+ 16, 0, 0, 0, 0, 0,
+ 10, 48, 32, 4, 0, 0,
+ 0, 0, 10, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 0, 16, 0,
+ 0, 0, 0, 0, 26, 128,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 7, 34, 32, 16, 0,
+ 0, 0, 0, 0, 10, 48,
+ 32, 4, 0, 0, 0, 0,
+ 10, 0, 16, 0, 0, 0,
+ 0, 0, 54, 0, 0, 6,
+ 18, 0, 16, 0, 0, 0,
+ 0, 0, 42, 128, 32, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 54, 0, 0, 7,
+ 66, 32, 16, 0, 0, 0,
+ 0, 0, 10, 48, 32, 4,
+ 0, 0, 0, 0, 10, 0,
+ 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 0,
+ 16, 0, 0, 0, 0, 0,
+ 58, 128, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 54, 0, 0, 7, 130, 32,
+ 16, 0, 0, 0, 0, 0,
+ 10, 48, 32, 4, 0, 0,
+ 0, 0, 10, 0, 16, 0,
+ 0, 0, 0, 0, 62, 0,
+ 0, 1, 83, 84, 65, 84,
+ 116, 0, 0, 0, 21, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 6, 0, 0, 0,
+ 10, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 6, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/generate_shaders.bat b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/generate_shaders.bat
new file mode 100644
index 00000000000..739c9457641
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d11/shaders/generate_shaders.bat
@@ -0,0 +1,119 @@
+@ECHO OFF
+REM
+REM Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+REM Use of this source code is governed by a BSD-style license that can be
+REM found in the LICENSE file.
+REM
+
+PATH %PATH%;%ProgramFiles(x86)%\Windows Kits\8.0\bin\x86;%DXSDK_DIR%\Utilities\bin\x86
+
+setlocal
+set errorCount=0
+set successCount=0
+set debug=0
+
+if "%1" == "debug" (
+ set debug=1
+)
+if "%1" == "release" (
+ set debug=0
+)
+
+:: | Input file | Entry point | Type | Output file | Debug |
+call:BuildShader Passthrough2D11.hlsl VS_Passthrough2D vs_4_0 compiled\passthrough2d11vs.h %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughDepth2D ps_4_0 compiled\passthroughdepth2d11ps.h %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughRGBA2D ps_4_0 compiled\passthroughrgba2d11ps.h %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughRGBA2DUI ps_4_0 compiled\passthroughrgba2dui11ps.h %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughRGBA2DI ps_4_0 compiled\passthroughrgba2di11ps.h %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughRGB2D ps_4_0 compiled\passthroughrgb2d11ps.h %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughRGB2DUI ps_4_0 compiled\passthroughrgb2dui11ps.h %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughRGB2DI ps_4_0 compiled\passthroughrgb2di11ps.h %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughRG2D ps_4_0 compiled\passthroughrg2d11ps.h %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughRG2DUI ps_4_0 compiled\passthroughrg2dui11ps.h %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughRG2DI ps_4_0 compiled\passthroughrg2di11ps.h %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughR2D ps_4_0 compiled\passthroughr2d11ps.h %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughR2DUI ps_4_0 compiled\passthroughr2dui11ps.h %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughR2DI ps_4_0 compiled\passthroughr2di11ps.h %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughLum2D ps_4_0 compiled\passthroughlum2d11ps.h %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughLumAlpha2D ps_4_0 compiled\passthroughlumalpha2d11ps.h %debug%
+
+
+call:BuildShader Passthrough3D11.hlsl VS_Passthrough3D vs_4_0 compiled\passthrough3d11vs.h %debug%
+call:BuildShader Passthrough3D11.hlsl GS_Passthrough3D gs_4_0 compiled\passthrough3d11gs.h %debug%
+call:BuildShader Passthrough3D11.hlsl PS_PassthroughRGBA3D ps_4_0 compiled\passthroughrgba3d11ps.h %debug%
+call:BuildShader Passthrough3D11.hlsl PS_PassthroughRGBA3DUI ps_4_0 compiled\passthroughrgba3dui11ps.h %debug%
+call:BuildShader Passthrough3D11.hlsl PS_PassthroughRGBA3DI ps_4_0 compiled\passthroughrgba3di11ps.h %debug%
+call:BuildShader Passthrough3D11.hlsl PS_PassthroughRGB3D ps_4_0 compiled\passthroughrgb3d11ps.h %debug%
+call:BuildShader Passthrough3D11.hlsl PS_PassthroughRGB3DUI ps_4_0 compiled\passthroughrgb3dui11ps.h %debug%
+call:BuildShader Passthrough3D11.hlsl PS_PassthroughRGB3DI ps_4_0 compiled\passthroughrgb3di11ps.h %debug%
+call:BuildShader Passthrough3D11.hlsl PS_PassthroughRG3D ps_4_0 compiled\passthroughrg3d11ps.h %debug%
+call:BuildShader Passthrough3D11.hlsl PS_PassthroughRG3DUI ps_4_0 compiled\passthroughrg3dui11ps.h %debug%
+call:BuildShader Passthrough3D11.hlsl PS_PassthroughRG3DI ps_4_0 compiled\passthroughrg3di11ps.h %debug%
+call:BuildShader Passthrough3D11.hlsl PS_PassthroughR3D ps_4_0 compiled\passthroughr3d11ps.h %debug%
+call:BuildShader Passthrough3D11.hlsl PS_PassthroughR3DUI ps_4_0 compiled\passthroughr3dui11ps.h %debug%
+call:BuildShader Passthrough3D11.hlsl PS_PassthroughR3DI ps_4_0 compiled\passthroughr3di11ps.h %debug%
+call:BuildShader Passthrough3D11.hlsl PS_PassthroughLum3D ps_4_0 compiled\passthroughlum3d11ps.h %debug%
+call:BuildShader Passthrough3D11.hlsl PS_PassthroughLumAlpha3D ps_4_0 compiled\passthroughlumalpha3d11ps.h %debug%
+
+call:BuildShader Swizzle11.hlsl PS_SwizzleF2D ps_4_0 compiled\swizzlef2dps.h %debug%
+call:BuildShader Swizzle11.hlsl PS_SwizzleI2D ps_4_0 compiled\swizzlei2dps.h %debug%
+call:BuildShader Swizzle11.hlsl PS_SwizzleUI2D ps_4_0 compiled\swizzleui2dps.h %debug%
+
+call:BuildShader Swizzle11.hlsl PS_SwizzleF3D ps_4_0 compiled\swizzlef3dps.h %debug%
+call:BuildShader Swizzle11.hlsl PS_SwizzleI3D ps_4_0 compiled\swizzlei3dps.h %debug%
+call:BuildShader Swizzle11.hlsl PS_SwizzleUI3D ps_4_0 compiled\swizzleui3dps.h %debug%
+
+call:BuildShader Swizzle11.hlsl PS_SwizzleF2DArray ps_4_0 compiled\swizzlef2darrayps.h %debug%
+call:BuildShader Swizzle11.hlsl PS_SwizzleI2DArray ps_4_0 compiled\swizzlei2darrayps.h %debug%
+call:BuildShader Swizzle11.hlsl PS_SwizzleUI2DArray ps_4_0 compiled\swizzleui2darrayps.h %debug%
+
+call:BuildShader Clear11.hlsl VS_ClearFloat vs_4_0 compiled\clearfloat11vs.h %debug%
+call:BuildShader Clear11.hlsl PS_ClearFloat ps_4_0 compiled\clearfloat11ps.h %debug%
+
+call:BuildShader Clear11.hlsl VS_ClearUint vs_4_0 compiled\clearuint11vs.h %debug%
+call:BuildShader Clear11.hlsl PS_ClearUint ps_4_0 compiled\clearuint11ps.h %debug%
+
+call:BuildShader Clear11.hlsl VS_ClearSint vs_4_0 compiled\clearsint11vs.h %debug%
+call:BuildShader Clear11.hlsl PS_ClearSint ps_4_0 compiled\clearsint11ps.h %debug%
+
+call:BuildShader BufferToTexture11.hlsl VS_BufferToTexture vs_4_0 compiled/buffertotexture11_vs.h %debug%
+call:BuildShader BufferToTexture11.hlsl GS_BufferToTexture gs_4_0 compiled/buffertotexture11_gs.h %debug%
+call:BuildShader BufferToTexture11.hlsl PS_BufferToTexture_4F ps_4_0 compiled/buffertotexture11_ps_4f.h %debug%
+call:BuildShader BufferToTexture11.hlsl PS_BufferToTexture_4I ps_4_0 compiled/buffertotexture11_ps_4i.h %debug%
+call:BuildShader BufferToTexture11.hlsl PS_BufferToTexture_4UI ps_4_0 compiled/buffertotexture11_ps_4ui.h %debug%
+
+echo.
+
+if %successCount% GTR 0 (
+ echo %successCount% shaders compiled successfully.
+)
+if %errorCount% GTR 0 (
+ echo There were %errorCount% shader compilation errors.
+)
+
+endlocal
+exit /b
+
+:BuildShader
+set input=%~1
+set entry=%~2
+set type=%~3
+set output=%~4
+set debug=%~5
+
+if %debug% == 0 (
+ set "buildCMD=fxc /nologo /E %entry% /T %type% /Fh %output% %input%"
+) else (
+ set "buildCMD=fxc /nologo /Zi /Od /E %entry% /T %type% /Fh %output% %input%"
+)
+
+set error=0
+%buildCMD% || set error=1
+
+if %error% == 0 (
+ set /a successCount=%successCount%+1
+) else (
+ set /a errorCount=%errorCount%+1
+)
+
+exit /b
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/Blit.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/Blit9.cpp
index 2a3ce39c632..80a4375ccd7 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/Blit.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/Blit9.cpp
@@ -5,25 +5,26 @@
// found in the LICENSE file.
//
-// Blit.cpp: Surface copy utility class.
+// Blit9.cpp: Surface copy utility class.
-#include "libGLESv2/renderer/Blit.h"
+#include "libGLESv2/renderer/d3d9/Blit9.h"
#include "libGLESv2/main.h"
-#include "libGLESv2/renderer/renderer9_utils.h"
-#include "libGLESv2/renderer/TextureStorage9.h"
-#include "libGLESv2/renderer/RenderTarget9.h"
-#include "libGLESv2/renderer/Renderer9.h"
+#include "libGLESv2/renderer/d3d9/renderer9_utils.h"
+#include "libGLESv2/renderer/d3d9/formatutils9.h"
+#include "libGLESv2/renderer/d3d9/TextureStorage9.h"
+#include "libGLESv2/renderer/d3d9/RenderTarget9.h"
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
#include "libGLESv2/Framebuffer.h"
#include "libGLESv2/Renderbuffer.h"
namespace
{
-#include "libGLESv2/renderer/shaders/compiled/standardvs.h"
-#include "libGLESv2/renderer/shaders/compiled/flipyvs.h"
-#include "libGLESv2/renderer/shaders/compiled/passthroughps.h"
-#include "libGLESv2/renderer/shaders/compiled/luminanceps.h"
-#include "libGLESv2/renderer/shaders/compiled/componentmaskps.h"
+#include "libGLESv2/renderer/d3d9/shaders/compiled/standardvs.h"
+#include "libGLESv2/renderer/d3d9/shaders/compiled/flipyvs.h"
+#include "libGLESv2/renderer/d3d9/shaders/compiled/passthroughps.h"
+#include "libGLESv2/renderer/d3d9/shaders/compiled/luminanceps.h"
+#include "libGLESv2/renderer/d3d9/shaders/compiled/componentmaskps.h"
const BYTE* const g_shaderCode[] =
{
@@ -46,29 +47,26 @@ const size_t g_shaderSize[] =
namespace rx
{
-Blit::Blit(rx::Renderer9 *renderer)
+Blit9::Blit9(rx::Renderer9 *renderer)
: mRenderer(renderer), mQuadVertexBuffer(NULL), mQuadVertexDeclaration(NULL), mSavedStateBlock(NULL), mSavedRenderTarget(NULL), mSavedDepthStencil(NULL)
{
initGeometry();
memset(mCompiledShaders, 0, sizeof(mCompiledShaders));
}
-Blit::~Blit()
+Blit9::~Blit9()
{
- if (mSavedStateBlock) mSavedStateBlock->Release();
- if (mQuadVertexBuffer) mQuadVertexBuffer->Release();
- if (mQuadVertexDeclaration) mQuadVertexDeclaration->Release();
+ SafeRelease(mSavedStateBlock);
+ SafeRelease(mQuadVertexBuffer);
+ SafeRelease(mQuadVertexDeclaration);
for (int i = 0; i < SHADER_COUNT; i++)
{
- if (mCompiledShaders[i])
- {
- mCompiledShaders[i]->Release();
- }
+ SafeRelease(mCompiledShaders[i]);
}
}
-void Blit::initGeometry()
+void Blit9::initGeometry()
{
static const float quad[] =
{
@@ -116,7 +114,7 @@ void Blit::initGeometry()
}
template <class D3DShaderType>
-bool Blit::setShader(ShaderId source, const char *profile,
+bool Blit9::setShader(ShaderId source, const char *profile,
D3DShaderType *(rx::Renderer9::*createShader)(const DWORD *, size_t length),
HRESULT (WINAPI IDirect3DDevice9::*setShader)(D3DShaderType*))
{
@@ -154,17 +152,17 @@ bool Blit::setShader(ShaderId source, const char *profile,
return true;
}
-bool Blit::setVertexShader(ShaderId shader)
+bool Blit9::setVertexShader(ShaderId shader)
{
return setShader<IDirect3DVertexShader9>(shader, "vs_2_0", &rx::Renderer9::createVertexShader, &IDirect3DDevice9::SetVertexShader);
}
-bool Blit::setPixelShader(ShaderId shader)
+bool Blit9::setPixelShader(ShaderId shader)
{
return setShader<IDirect3DPixelShader9>(shader, "ps_2_0", &rx::Renderer9::createPixelShader, &IDirect3DDevice9::SetPixelShader);
}
-RECT Blit::getSurfaceRect(IDirect3DSurface9 *surface) const
+RECT Blit9::getSurfaceRect(IDirect3DSurface9 *surface) const
{
D3DSURFACE_DESC desc;
surface->GetDesc(&desc);
@@ -178,7 +176,7 @@ RECT Blit::getSurfaceRect(IDirect3DSurface9 *surface) const
return rect;
}
-bool Blit::boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest)
+bool Blit9::boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest)
{
IDirect3DTexture9 *texture = copySurfaceToTexture(source, getSurfaceRect(source));
if (!texture)
@@ -204,18 +202,18 @@ bool Blit::boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest)
render();
- texture->Release();
+ SafeRelease(texture);
restoreState();
return true;
}
-bool Blit::copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorageInterface2D *storage, GLint level)
+bool Blit9::copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorageInterface2D *storage, GLint level)
{
RenderTarget9 *renderTarget = NULL;
IDirect3DSurface9 *source = NULL;
- gl::Renderbuffer *colorbuffer = framebuffer->getColorbuffer(0);
+ gl::FramebufferAttachment *colorbuffer = framebuffer->getColorbuffer(0);
if (colorbuffer)
{
@@ -240,18 +238,18 @@ bool Blit::copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum des
if (destSurface)
{
result = copy(source, sourceRect, destFormat, xoffset, yoffset, destSurface);
- destSurface->Release();
+ SafeRelease(destSurface);
}
- source->Release();
+ SafeRelease(source);
return result;
}
-bool Blit::copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorageInterfaceCube *storage, GLenum target, GLint level)
+bool Blit9::copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorageInterfaceCube *storage, GLenum target, GLint level)
{
RenderTarget9 *renderTarget = NULL;
IDirect3DSurface9 *source = NULL;
- gl::Renderbuffer *colorbuffer = framebuffer->getColorbuffer(0);
+ gl::FramebufferAttachment *colorbuffer = framebuffer->getColorbuffer(0);
if (colorbuffer)
{
@@ -276,14 +274,14 @@ bool Blit::copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum des
if (destSurface)
{
result = copy(source, sourceRect, destFormat, xoffset, yoffset, destSurface);
- destSurface->Release();
+ SafeRelease(destSurface);
}
- source->Release();
+ SafeRelease(source);
return result;
}
-bool Blit::copy(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, IDirect3DSurface9 *dest)
+bool Blit9::copy(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, IDirect3DSurface9 *dest)
{
if (!dest)
{
@@ -298,7 +296,7 @@ bool Blit::copy(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFo
dest->GetDesc(&destDesc);
if (sourceDesc.Format == destDesc.Format && destDesc.Usage & D3DUSAGE_RENDERTARGET &&
- d3d9_gl::IsFormatChannelEquivalent(destDesc.Format, destFormat)) // Can use StretchRect
+ d3d9_gl::IsFormatChannelEquivalent(destDesc.Format, destFormat, mRenderer->getCurrentClientVersion())) // Can use StretchRect
{
RECT destRect = {xoffset, yoffset, xoffset + (sourceRect.right - sourceRect.left), yoffset + (sourceRect.bottom - sourceRect.top)};
HRESULT result = device->StretchRect(source, &sourceRect, dest, &destRect, D3DTEXF_POINT);
@@ -316,7 +314,7 @@ bool Blit::copy(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFo
return true;
}
-bool Blit::formatConvert(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, IDirect3DSurface9 *dest)
+bool Blit9::formatConvert(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, IDirect3DSurface9 *dest)
{
IDirect3DTexture9 *texture = copySurfaceToTexture(source, sourceRect);
if (!texture)
@@ -339,14 +337,14 @@ bool Blit::formatConvert(IDirect3DSurface9 *source, const RECT &sourceRect, GLen
render();
}
- texture->Release();
+ SafeRelease(texture);
restoreState();
return true;
}
-bool Blit::setFormatConvertShaders(GLenum destFormat)
+bool Blit9::setFormatConvertShaders(GLenum destFormat)
{
bool okay = setVertexShader(SHADER_VS_STANDARD);
@@ -356,6 +354,8 @@ bool Blit::setFormatConvertShaders(GLenum destFormat)
case GL_RGBA:
case GL_BGRA_EXT:
case GL_RGB:
+ case GL_RG_EXT:
+ case GL_RED_EXT:
case GL_ALPHA:
okay = okay && setPixelShader(SHADER_PS_COMPONENTMASK);
break;
@@ -375,41 +375,99 @@ bool Blit::setFormatConvertShaders(GLenum destFormat)
// The meaning of this constant depends on the shader that was selected.
// See the shader assembly code above for details.
- float psConst0[4] = { 0, 0, 0, 0 };
+ // Allocate one array for both registers and split it into two float4's.
+ float psConst[8] = { 0 };
+ float *multConst = &psConst[0];
+ float *addConst = &psConst[4];
switch (destFormat)
{
default: UNREACHABLE();
case GL_RGBA:
case GL_BGRA_EXT:
- psConst0[X] = 1;
- psConst0[Z] = 1;
+ multConst[X] = 1;
+ multConst[Y] = 1;
+ multConst[Z] = 1;
+ multConst[W] = 1;
+ addConst[X] = 0;
+ addConst[Y] = 0;
+ addConst[Z] = 0;
+ addConst[W] = 0;
break;
case GL_RGB:
- psConst0[X] = 1;
- psConst0[W] = 1;
+ multConst[X] = 1;
+ multConst[Y] = 1;
+ multConst[Z] = 1;
+ multConst[W] = 0;
+ addConst[X] = 0;
+ addConst[Y] = 0;
+ addConst[Z] = 0;
+ addConst[W] = 1;
+ break;
+
+ case GL_RG_EXT:
+ multConst[X] = 1;
+ multConst[Y] = 1;
+ multConst[Z] = 0;
+ multConst[W] = 0;
+ addConst[X] = 0;
+ addConst[Y] = 0;
+ addConst[Z] = 0;
+ addConst[W] = 1;
+ break;
+
+ case GL_RED_EXT:
+ multConst[X] = 1;
+ multConst[Y] = 0;
+ multConst[Z] = 0;
+ multConst[W] = 0;
+ addConst[X] = 0;
+ addConst[Y] = 0;
+ addConst[Z] = 0;
+ addConst[W] = 1;
break;
case GL_ALPHA:
- psConst0[Z] = 1;
+ multConst[X] = 0;
+ multConst[Y] = 0;
+ multConst[Z] = 0;
+ multConst[W] = 1;
+ addConst[X] = 0;
+ addConst[Y] = 0;
+ addConst[Z] = 0;
+ addConst[W] = 0;
break;
case GL_LUMINANCE:
- psConst0[Y] = 1;
+ multConst[X] = 1;
+ multConst[Y] = 0;
+ multConst[Z] = 0;
+ multConst[W] = 0;
+ addConst[X] = 0;
+ addConst[Y] = 0;
+ addConst[Z] = 0;
+ addConst[W] = 1;
break;
case GL_LUMINANCE_ALPHA:
- psConst0[X] = 1;
+ multConst[X] = 1;
+ multConst[Y] = 0;
+ multConst[Z] = 0;
+ multConst[W] = 1;
+ addConst[X] = 0;
+ addConst[Y] = 0;
+ addConst[Z] = 0;
+ addConst[W] = 0;
break;
}
- mRenderer->getDevice()->SetPixelShaderConstantF(0, psConst0, 1);
+ mRenderer->getDevice()->SetPixelShaderConstantF(0, psConst, 2);
return true;
}
-IDirect3DTexture9 *Blit::copySurfaceToTexture(IDirect3DSurface9 *surface, const RECT &sourceRect)
+IDirect3DTexture9 *Blit9::copySurfaceToTexture(IDirect3DSurface9 *surface, const RECT &sourceRect)
{
if (!surface)
{
@@ -437,26 +495,26 @@ IDirect3DTexture9 *Blit::copySurfaceToTexture(IDirect3DSurface9 *surface, const
if (FAILED(result))
{
ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
- texture->Release();
+ SafeRelease(texture);
return gl::error(GL_OUT_OF_MEMORY, (IDirect3DTexture9*)NULL);
}
mRenderer->endScene();
result = device->StretchRect(surface, &sourceRect, textureSurface, NULL, D3DTEXF_NONE);
- textureSurface->Release();
+ SafeRelease(textureSurface);
if (FAILED(result))
{
ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
- texture->Release();
+ SafeRelease(texture);
return gl::error(GL_OUT_OF_MEMORY, (IDirect3DTexture9*)NULL);
}
return texture;
}
-void Blit::setViewport(const RECT &sourceRect, GLint xoffset, GLint yoffset)
+void Blit9::setViewport(const RECT &sourceRect, GLint xoffset, GLint yoffset)
{
IDirect3DDevice9 *device = mRenderer->getDevice();
@@ -473,7 +531,7 @@ void Blit::setViewport(const RECT &sourceRect, GLint xoffset, GLint yoffset)
device->SetVertexShaderConstantF(0, halfPixelAdjust, 1);
}
-void Blit::setCommonBlitState()
+void Blit9::setCommonBlitState()
{
IDirect3DDevice9 *device = mRenderer->getDevice();
@@ -503,7 +561,7 @@ void Blit::setCommonBlitState()
}
}
-void Blit::render()
+void Blit9::render()
{
IDirect3DDevice9 *device = mRenderer->getDevice();
@@ -514,7 +572,7 @@ void Blit::render()
hr = device->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
}
-void Blit::saveState()
+void Blit9::saveState()
{
IDirect3DDevice9 *device = mRenderer->getDevice();
@@ -530,12 +588,12 @@ void Blit::saveState()
setCommonBlitState();
- static const float dummyConst[4] = { 0, 0, 0, 0 };
+ static const float dummyConst[8] = { 0 };
device->SetVertexShader(NULL);
- device->SetVertexShaderConstantF(0, dummyConst, 1);
+ device->SetVertexShaderConstantF(0, dummyConst, 2);
device->SetPixelShader(NULL);
- device->SetPixelShaderConstantF(0, dummyConst, 1);
+ device->SetPixelShaderConstantF(0, dummyConst, 2);
D3DVIEWPORT9 dummyVp;
dummyVp.X = 0;
@@ -566,23 +624,15 @@ void Blit::saveState()
}
}
-void Blit::restoreState()
+void Blit9::restoreState()
{
IDirect3DDevice9 *device = mRenderer->getDevice();
device->SetDepthStencilSurface(mSavedDepthStencil);
- if (mSavedDepthStencil != NULL)
- {
- mSavedDepthStencil->Release();
- mSavedDepthStencil = NULL;
- }
+ SafeRelease(mSavedDepthStencil);
device->SetRenderTarget(0, mSavedRenderTarget);
- if (mSavedRenderTarget != NULL)
- {
- mSavedRenderTarget->Release();
- mSavedRenderTarget = NULL;
- }
+ SafeRelease(mSavedRenderTarget);
ASSERT(mSavedStateBlock != NULL);
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/Blit.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/Blit9.h
index 3718028e662..3635bca932b 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/Blit.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/Blit9.h
@@ -4,10 +4,10 @@
// found in the LICENSE file.
//
-// Blit.cpp: Surface copy utility class.
+// Blit9.cpp: Surface copy utility class.
-#ifndef LIBGLESV2_BLIT_H_
-#define LIBGLESV2_BLIT_H_
+#ifndef LIBGLESV2_BLIT9_H_
+#define LIBGLESV2_BLIT9_H_
#include "common/angleutils.h"
@@ -22,11 +22,11 @@ class Renderer9;
class TextureStorageInterface2D;
class TextureStorageInterfaceCube;
-class Blit
+class Blit9
{
public:
- explicit Blit(Renderer9 *renderer);
- ~Blit();
+ explicit Blit9(Renderer9 *renderer);
+ ~Blit9();
// Copy from source surface to dest surface.
// sourceRect, xoffset, yoffset are in D3D coordinates (0,0 in upper-left)
@@ -87,8 +87,8 @@ class Blit
IDirect3DSurface9 *mSavedRenderTarget;
IDirect3DSurface9 *mSavedDepthStencil;
- DISALLOW_COPY_AND_ASSIGN(Blit);
+ DISALLOW_COPY_AND_ASSIGN(Blit9);
};
}
-#endif // LIBGLESV2_BLIT_H_
+#endif // LIBGLESV2_BLIT9_H_
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/BufferStorage9.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/BufferStorage9.cpp
new file mode 100644
index 00000000000..489a0401cb6
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/BufferStorage9.cpp
@@ -0,0 +1,98 @@
+#include "precompiled.h"
+//
+// Copyright (c) 2013-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// BufferStorage9.cpp Defines the BufferStorage9 class.
+
+#include "libGLESv2/renderer/d3d9/BufferStorage9.h"
+#include "common/debug.h"
+#include "libGLESv2/main.h"
+
+namespace rx
+{
+
+BufferStorage9::BufferStorage9()
+ : mSize(0)
+{
+}
+
+BufferStorage9::~BufferStorage9()
+{
+}
+
+BufferStorage9 *BufferStorage9::makeBufferStorage9(BufferStorage *bufferStorage)
+{
+ ASSERT(HAS_DYNAMIC_TYPE(BufferStorage9*, bufferStorage));
+ return static_cast<BufferStorage9*>(bufferStorage);
+}
+
+void *BufferStorage9::getData()
+{
+ return mMemory.data();
+}
+
+void BufferStorage9::setData(const void* data, size_t size, size_t offset)
+{
+ if (offset + size > mMemory.size())
+ {
+ mMemory.resize(offset + size);
+ }
+
+ mSize = std::max(mSize, offset + size);
+ if (data)
+ {
+ memcpy(mMemory.data() + offset, data, size);
+ }
+}
+
+void BufferStorage9::copyData(BufferStorage* sourceStorage, size_t size, size_t sourceOffset, size_t destOffset)
+{
+ BufferStorage9* source = makeBufferStorage9(sourceStorage);
+ if (source)
+ {
+ memcpy(mMemory.data() + destOffset, source->mMemory.data() + sourceOffset, size);
+ }
+}
+
+void BufferStorage9::clear()
+{
+ mSize = 0;
+}
+
+void BufferStorage9::markTransformFeedbackUsage()
+{
+ UNREACHABLE();
+}
+
+size_t BufferStorage9::getSize() const
+{
+ return mSize;
+}
+
+bool BufferStorage9::supportsDirectBinding() const
+{
+ return false;
+}
+
+// We do not suppot buffer mapping facility in D3D9
+bool BufferStorage9::isMapped() const
+{
+ UNREACHABLE();
+ return false;
+}
+
+void *BufferStorage9::map(GLbitfield access)
+{
+ UNREACHABLE();
+ return NULL;
+}
+
+void BufferStorage9::unmap()
+{
+ UNREACHABLE();
+}
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/BufferStorage9.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/BufferStorage9.h
index 3e803969bc3..dd61624c285 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/BufferStorage9.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/BufferStorage9.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2013-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -23,18 +23,22 @@ class BufferStorage9 : public BufferStorage
static BufferStorage9 *makeBufferStorage9(BufferStorage *bufferStorage);
virtual void *getData();
- virtual void setData(const void* data, unsigned int size, unsigned int offset);
+ virtual void setData(const void* data, size_t size, size_t offset);
+ virtual void copyData(BufferStorage* sourceStorage, size_t size, size_t sourceOffset, size_t destOffset);
virtual void clear();
- virtual unsigned int getSize() const;
+ virtual void markTransformFeedbackUsage();
+ virtual size_t getSize() const;
virtual bool supportsDirectBinding() const;
+ virtual bool isMapped() const;
+ virtual void *map(GLbitfield access);
+ virtual void unmap();
+
private:
DISALLOW_COPY_AND_ASSIGN(BufferStorage9);
- void *mMemory;
- unsigned int mAllocatedSize;
-
- unsigned int mSize;
+ std::vector<char> mMemory;
+ size_t mSize;
};
}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/Fence9.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/Fence9.cpp
new file mode 100644
index 00000000000..372a8a45a5e
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/Fence9.cpp
@@ -0,0 +1,73 @@
+#include "precompiled.h"
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Fence9.cpp: Defines the rx::Fence9 class.
+
+#include "libGLESv2/renderer/d3d9/Fence9.h"
+#include "libGLESv2/main.h"
+#include "libGLESv2/renderer/d3d9/renderer9_utils.h"
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
+
+namespace rx
+{
+
+Fence9::Fence9(rx::Renderer9 *renderer)
+{
+ mRenderer = renderer;
+ mQuery = NULL;
+}
+
+Fence9::~Fence9()
+{
+ SafeRelease(mQuery);
+}
+
+bool Fence9::isSet() const
+{
+ return mQuery != NULL;
+}
+
+void Fence9::set()
+{
+ if (!mQuery)
+ {
+ mQuery = mRenderer->allocateEventQuery();
+ if (!mQuery)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+ }
+
+ HRESULT result = mQuery->Issue(D3DISSUE_END);
+ UNUSED_ASSERTION_VARIABLE(result);
+ ASSERT(SUCCEEDED(result));
+}
+
+bool Fence9::test(bool flushCommandBuffer)
+{
+ ASSERT(mQuery);
+
+ DWORD getDataFlags = (flushCommandBuffer ? D3DGETDATA_FLUSH : 0);
+ HRESULT result = mQuery->GetData(NULL, 0, getDataFlags);
+
+ if (d3d9::isDeviceLostError(result))
+ {
+ mRenderer->notifyDeviceLost();
+ return gl::error(GL_OUT_OF_MEMORY, true);
+ }
+
+ ASSERT(result == S_OK || result == S_FALSE);
+
+ return (result == S_OK);
+}
+
+bool Fence9::hasError() const
+{
+ return mRenderer->isDeviceLost();
+}
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/Fence9.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/Fence9.h
index 9f17641e519..e923a2178cf 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/Fence9.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/Fence9.h
@@ -21,11 +21,10 @@ class Fence9 : public FenceImpl
explicit Fence9(rx::Renderer9 *renderer);
virtual ~Fence9();
- GLboolean isFence();
- void setFence(GLenum condition);
- GLboolean testFence();
- void finishFence();
- void getFenceiv(GLenum pname, GLint *params);
+ bool isSet() const;
+ void set();
+ bool test(bool flushCommandBuffer);
+ bool hasError() const;
private:
DISALLOW_COPY_AND_ASSIGN(Fence9);
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/Image9.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/Image9.cpp
index b3dcc59b6bd..001858e90a9 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/Image9.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/Image9.cpp
@@ -8,17 +8,17 @@
// Image9.cpp: Implements the rx::Image9 class, which acts as the interface to
// the actual underlying surfaces of a Texture.
-#include "libGLESv2/renderer/Image9.h"
+#include "libGLESv2/renderer/d3d9/Image9.h"
#include "libGLESv2/main.h"
#include "libGLESv2/Framebuffer.h"
#include "libGLESv2/Renderbuffer.h"
-#include "libGLESv2/renderer/Renderer9.h"
-#include "libGLESv2/renderer/RenderTarget9.h"
-#include "libGLESv2/renderer/TextureStorage9.h"
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
+#include "libGLESv2/renderer/d3d9/RenderTarget9.h"
+#include "libGLESv2/renderer/d3d9/TextureStorage9.h"
-#include "libGLESv2/renderer/renderer9_utils.h"
-#include "libGLESv2/renderer/generatemip.h"
+#include "libGLESv2/renderer/d3d9/renderer9_utils.h"
+#include "libGLESv2/renderer/d3d9/formatutils9.h"
namespace rx
{
@@ -34,10 +34,7 @@ Image9::Image9()
Image9::~Image9()
{
- if (mSurface)
- {
- mSurface->Release();
- }
+ SafeRelease(mSurface);
}
void Image9::generateMip(IDirect3DSurface9 *destSurface, IDirect3DSurface9 *sourceSurface)
@@ -54,6 +51,9 @@ void Image9::generateMip(IDirect3DSurface9 *destSurface, IDirect3DSurface9 *sour
ASSERT(sourceDesc.Width == 1 || sourceDesc.Width / 2 == destDesc.Width);
ASSERT(sourceDesc.Height == 1 || sourceDesc.Height / 2 == destDesc.Height);
+ MipGenerationFunction mipFunction = d3d9::GetMipGenerationFunction(sourceDesc.Format);
+ ASSERT(mipFunction != NULL);
+
D3DLOCKED_RECT sourceLocked = {0};
result = sourceSurface->LockRect(&sourceLocked, NULL, D3DLOCK_READONLY);
ASSERT(SUCCEEDED(result));
@@ -67,32 +67,12 @@ void Image9::generateMip(IDirect3DSurface9 *destSurface, IDirect3DSurface9 *sour
if (sourceData && destData)
{
- switch (sourceDesc.Format)
- {
- case D3DFMT_L8:
- GenerateMip<L8>(sourceDesc.Width, sourceDesc.Height, sourceData, sourceLocked.Pitch, destData, destLocked.Pitch);
- break;
- case D3DFMT_A8L8:
- GenerateMip<A8L8>(sourceDesc.Width, sourceDesc.Height, sourceData, sourceLocked.Pitch, destData, destLocked.Pitch);
- break;
- case D3DFMT_A8R8G8B8:
- case D3DFMT_X8R8G8B8:
- GenerateMip<A8R8G8B8>(sourceDesc.Width, sourceDesc.Height, sourceData, sourceLocked.Pitch, destData, destLocked.Pitch);
- break;
- case D3DFMT_A16B16G16R16F:
- GenerateMip<A16B16G16R16F>(sourceDesc.Width, sourceDesc.Height, sourceData, sourceLocked.Pitch, destData, destLocked.Pitch);
- break;
- case D3DFMT_A32B32G32R32F:
- GenerateMip<A32B32G32R32F>(sourceDesc.Width, sourceDesc.Height, sourceData, sourceLocked.Pitch, destData, destLocked.Pitch);
- break;
- default:
- UNREACHABLE();
- break;
- }
-
- destSurface->UnlockRect();
- sourceSurface->UnlockRect();
+ mipFunction(sourceDesc.Width, sourceDesc.Height, 1, sourceData, sourceLocked.Pitch, 0,
+ destData, destLocked.Pitch, 0);
}
+
+ destSurface->UnlockRect();
+ sourceSurface->UnlockRect();
}
Image9 *Image9::makeImage9(Image *img)
@@ -126,8 +106,10 @@ void Image9::copyLockableSurfaces(IDirect3DSurface9 *dest, IDirect3DSurface9 *so
D3DSURFACE_DESC desc;
source->GetDesc(&desc);
- int rows = d3d9::IsCompressedFormat(desc.Format) ? desc.Height / 4 : desc.Height;
- int bytes = d3d9::ComputeRowSize(desc.Format, desc.Width);
+ int blockHeight = d3d9::GetBlockHeight(desc.Format);
+ int rows = desc.Height / blockHeight;
+
+ int bytes = d3d9::GetBlockSize(desc.Format, desc.Width, blockHeight);
ASSERT(bytes <= sourceLock.Pitch && bytes <= destLock.Pitch);
for(int i = 0; i < rows; i++)
@@ -141,10 +123,17 @@ void Image9::copyLockableSurfaces(IDirect3DSurface9 *dest, IDirect3DSurface9 *so
else UNREACHABLE();
}
-bool Image9::redefine(rx::Renderer *renderer, GLint internalformat, GLsizei width, GLsizei height, bool forceRelease)
+bool Image9::redefine(rx::Renderer *renderer, GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, bool forceRelease)
{
+ // 3D textures are not supported by the D3D9 backend.
+ ASSERT(depth <= 1);
+
+ // Only 2D and cube texture are supported by the D3D9 backend.
+ ASSERT(target == GL_TEXTURE_2D || target == GL_TEXTURE_CUBE_MAP);
+
if (mWidth != width ||
mHeight != height ||
+ mDepth != depth ||
mInternalFormat != internalformat ||
forceRelease)
{
@@ -152,16 +141,16 @@ bool Image9::redefine(rx::Renderer *renderer, GLint internalformat, GLsizei widt
mWidth = width;
mHeight = height;
+ mDepth = depth;
mInternalFormat = internalformat;
+
// compute the d3d format that will be used
- mD3DFormat = mRenderer->ConvertTextureInternalFormat(internalformat);
- mActualFormat = d3d9_gl::GetEquivalentFormat(mD3DFormat);
+ mD3DFormat = gl_d3d9::GetTextureFormat(internalformat, mRenderer);
+ mActualFormat = d3d9_gl::GetInternalFormat(mD3DFormat);
+ mRenderable = gl_d3d9::GetRenderFormat(internalformat, mRenderer) != D3DFMT_UNKNOWN;
- if (mSurface)
- {
- mSurface->Release();
- mSurface = NULL;
- }
+ SafeRelease(mSurface);
+ mDirty = gl_d3d9::RequiresTextureDataInitialization(mInternalFormat);
return true;
}
@@ -180,14 +169,13 @@ void Image9::createSurface()
IDirect3DSurface9 *newSurface = NULL;
const D3DPOOL poolToUse = D3DPOOL_SYSTEMMEM;
const D3DFORMAT d3dFormat = getD3DFormat();
- ASSERT(d3dFormat != D3DFMT_INTZ); // We should never get here for depth textures
if (mWidth != 0 && mHeight != 0)
{
int levelToFetch = 0;
GLsizei requestWidth = mWidth;
GLsizei requestHeight = mHeight;
- gl::MakeValidSize(true, gl::IsCompressed(mInternalFormat), &requestWidth, &requestHeight, &levelToFetch);
+ d3d9::MakeValidSize(true, d3dFormat, &requestWidth, &requestHeight, &levelToFetch);
IDirect3DDevice9 *device = mRenderer->getDevice();
@@ -202,7 +190,27 @@ void Image9::createSurface()
}
newTexture->GetSurfaceLevel(levelToFetch, &newSurface);
- newTexture->Release();
+ SafeRelease(newTexture);
+
+ if (gl_d3d9::RequiresTextureDataInitialization(mInternalFormat))
+ {
+ InitializeTextureDataFunction initializeFunc = gl_d3d9::GetTextureDataInitializationFunction(mInternalFormat);
+
+ RECT entireRect;
+ entireRect.left = 0;
+ entireRect.right = mWidth;
+ entireRect.top = 0;
+ entireRect.bottom = mHeight;
+
+ D3DLOCKED_RECT lockedRect;
+ result = newSurface->LockRect(&lockedRect, &entireRect, 0);
+ ASSERT(SUCCEEDED(result));
+
+ initializeFunc(mWidth, mHeight, 1, lockedRect.pBits, lockedRect.Pitch, 0);
+
+ result = newSurface->UnlockRect();
+ ASSERT(SUCCEEDED(result));
+ }
}
mSurface = newSurface;
@@ -232,15 +240,11 @@ void Image9::unlock()
if (mSurface)
{
HRESULT result = mSurface->UnlockRect();
+ UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
}
}
-bool Image9::isRenderableFormat() const
-{
- return TextureStorage9::IsTextureFormatRenderable(getD3DFormat());
-}
-
D3DFORMAT Image9::getD3DFormat() const
{
// this should only happen if the image hasn't been redefined first
@@ -250,6 +254,13 @@ D3DFORMAT Image9::getD3DFormat() const
return mD3DFormat;
}
+bool Image9::isDirty() const
+{
+ // Make sure to that this image is marked as dirty even if the staging texture hasn't been created yet
+ // if initialization is required before use.
+ return (mSurface || gl_d3d9::RequiresTextureDataInitialization(mInternalFormat)) && mDirty;
+}
+
IDirect3DSurface9 *Image9::getSurface()
{
createSurface();
@@ -280,7 +291,7 @@ void Image9::setManagedSurface(IDirect3DSurface9 *surface)
if (mSurface)
{
copyLockableSurfaces(surface, mSurface);
- mSurface->Release();
+ SafeRelease(mSurface);
}
mSurface = surface;
@@ -288,22 +299,38 @@ void Image9::setManagedSurface(IDirect3DSurface9 *surface)
}
}
-bool Image9::updateSurface(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
+bool Image9::copyToStorage(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
{
ASSERT(getSurface() != NULL);
TextureStorage9_2D *storage9 = TextureStorage9_2D::makeTextureStorage9_2D(storage->getStorageInstance());
- return updateSurface(storage9->getSurfaceLevel(level, true), xoffset, yoffset, width, height);
+ return copyToSurface(storage9->getSurfaceLevel(level, true), xoffset, yoffset, width, height);
}
-bool Image9::updateSurface(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
+bool Image9::copyToStorage(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
{
ASSERT(getSurface() != NULL);
TextureStorage9_Cube *storage9 = TextureStorage9_Cube::makeTextureStorage9_Cube(storage->getStorageInstance());
- return updateSurface(storage9->getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level, true), xoffset, yoffset, width, height);
+ return copyToSurface(storage9->getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level, true), xoffset, yoffset, width, height);
+}
+
+bool Image9::copyToStorage(TextureStorageInterface3D *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth)
+{
+ // 3D textures are not supported by the D3D9 backend.
+ UNREACHABLE();
+ return false;
+}
+
+bool Image9::copyToStorage(TextureStorageInterface2DArray *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height)
+{
+ // 2D array textures are not supported by the D3D9 backend.
+ UNREACHABLE();
+ return false;
}
-bool Image9::updateSurface(IDirect3DSurface9 *destSurface, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
+bool Image9::copyToSurface(IDirect3DSurface9 *destSurface, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
{
+ ASSERT(width > 0 && height > 0);
+
if (!destSurface)
return false;
@@ -334,26 +361,36 @@ bool Image9::updateSurface(IDirect3DSurface9 *destSurface, GLint xoffset, GLint
copyLockableSurfaces(surf, sourceSurface);
result = device->UpdateSurface(surf, &rect, destSurface, &point);
ASSERT(SUCCEEDED(result));
- surf->Release();
+ SafeRelease(surf);
}
}
else
{
// UpdateSurface: source must be SYSTEMMEM, dest must be DEFAULT pools
HRESULT result = device->UpdateSurface(sourceSurface, &rect, destSurface, &point);
+ UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
}
}
- destSurface->Release();
+ SafeRelease(destSurface);
return true;
}
// Store the pixel rectangle designated by xoffset,yoffset,width,height with pixels stored as format/type at input
// into the target pixel rectangle.
-void Image9::loadData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
- GLint unpackAlignment, const void *input)
+void Image9::loadData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
+ GLint unpackAlignment, GLenum type, const void *input)
{
+ // 3D textures are not supported by the D3D9 backend.
+ ASSERT(zoffset == 0 && depth == 1);
+
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+ GLsizei inputRowPitch = gl::GetRowPitch(mInternalFormat, type, clientVersion, width, unpackAlignment);
+
+ LoadImageFunction loadFunction = d3d9::GetImageLoadFunction(mInternalFormat, mRenderer);
+ ASSERT(loadFunction != NULL);
+
RECT lockRect =
{
xoffset, yoffset,
@@ -367,96 +404,29 @@ void Image9::loadData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei heigh
return;
}
-
- GLsizei inputPitch = gl::ComputePitch(width, mInternalFormat, unpackAlignment);
-
- switch (mInternalFormat)
- {
- case GL_ALPHA8_EXT:
- if (gl::supportsSSE2())
- {
- loadAlphaDataToBGRASSE2(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- }
- else
- {
- loadAlphaDataToBGRA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- }
- break;
- case GL_LUMINANCE8_EXT:
- loadLuminanceDataToNativeOrBGRA(width, height, inputPitch, input, locked.Pitch, locked.pBits, getD3DFormat() == D3DFMT_L8);
- break;
- case GL_ALPHA32F_EXT:
- loadAlphaFloatDataToRGBA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- break;
- case GL_LUMINANCE32F_EXT:
- loadLuminanceFloatDataToRGBA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- break;
- case GL_ALPHA16F_EXT:
- loadAlphaHalfFloatDataToRGBA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- break;
- case GL_LUMINANCE16F_EXT:
- loadLuminanceHalfFloatDataToRGBA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- break;
- case GL_LUMINANCE8_ALPHA8_EXT:
- loadLuminanceAlphaDataToNativeOrBGRA(width, height, inputPitch, input, locked.Pitch, locked.pBits, getD3DFormat() == D3DFMT_A8L8);
- break;
- case GL_LUMINANCE_ALPHA32F_EXT:
- loadLuminanceAlphaFloatDataToRGBA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- break;
- case GL_LUMINANCE_ALPHA16F_EXT:
- loadLuminanceAlphaHalfFloatDataToRGBA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- break;
- case GL_RGB8_OES:
- loadRGBUByteDataToBGRX(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- break;
- case GL_RGB565:
- loadRGB565DataToBGRA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- break;
- case GL_RGBA8_OES:
- if (gl::supportsSSE2())
- {
- loadRGBAUByteDataToBGRASSE2(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- }
- else
- {
- loadRGBAUByteDataToBGRA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- }
- break;
- case GL_RGBA4:
- loadRGBA4444DataToBGRA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- break;
- case GL_RGB5_A1:
- loadRGBA5551DataToBGRA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- break;
- case GL_BGRA8_EXT:
- loadBGRADataToBGRA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- break;
- // float textures are converted to RGBA, not BGRA, as they're stored that way in D3D
- case GL_RGB32F_EXT:
- loadRGBFloatDataToRGBA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- break;
- case GL_RGB16F_EXT:
- loadRGBHalfFloatDataToRGBA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- break;
- case GL_RGBA32F_EXT:
- loadRGBAFloatDataToRGBA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- break;
- case GL_RGBA16F_EXT:
- loadRGBAHalfFloatDataToRGBA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- break;
- default: UNREACHABLE();
- }
+ loadFunction(width, height, depth, input, inputRowPitch, 0, locked.pBits, locked.Pitch, 0);
unlock();
}
-void Image9::loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+void Image9::loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
const void *input)
{
- ASSERT(xoffset % 4 == 0);
- ASSERT(yoffset % 4 == 0);
+ // 3D textures are not supported by the D3D9 backend.
+ ASSERT(zoffset == 0 && depth == 1);
- RECT lockRect = {
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+ GLsizei inputRowPitch = gl::GetRowPitch(mInternalFormat, GL_UNSIGNED_BYTE, clientVersion, width, 1);
+ GLsizei inputDepthPitch = gl::GetDepthPitch(mInternalFormat, GL_UNSIGNED_BYTE, clientVersion, width, height, 1);
+
+ ASSERT(xoffset % d3d9::GetBlockWidth(mD3DFormat) == 0);
+ ASSERT(yoffset % d3d9::GetBlockHeight(mD3DFormat) == 0);
+
+ LoadImageFunction loadFunction = d3d9::GetImageLoadFunction(mInternalFormat, mRenderer);
+ ASSERT(loadFunction != NULL);
+
+ RECT lockRect =
+ {
xoffset, yoffset,
xoffset + width, yoffset + height
};
@@ -468,23 +438,21 @@ void Image9::loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GLs
return;
}
- GLsizei inputSize = gl::ComputeCompressedSize(width, height, mInternalFormat);
- GLsizei inputPitch = gl::ComputeCompressedPitch(width, mInternalFormat);
- int rows = inputSize / inputPitch;
- for (int i = 0; i < rows; ++i)
- {
- memcpy((void*)((BYTE*)locked.pBits + i * locked.Pitch), (void*)((BYTE*)input + i * inputPitch), inputPitch);
- }
+ loadFunction(width, height, depth, input, inputRowPitch, inputDepthPitch,
+ locked.pBits, locked.Pitch, 0);
unlock();
}
// This implements glCopyTex[Sub]Image2D for non-renderable internal texture formats and incomplete textures
-void Image9::copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source)
+void Image9::copy(GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source)
{
+ // ES3.0 only behaviour to copy into a 3d texture
+ ASSERT(zoffset == 0);
+
RenderTarget9 *renderTarget = NULL;
IDirect3DSurface9 *surface = NULL;
- gl::Renderbuffer *colorbuffer = source->getColorbuffer(0);
+ gl::FramebufferAttachment *colorbuffer = source->getColorbuffer(0);
if (colorbuffer)
{
@@ -513,7 +481,7 @@ void Image9::copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width,
if (FAILED(result))
{
ERR("Could not create matching destination surface.");
- surface->Release();
+ SafeRelease(surface);
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -522,8 +490,8 @@ void Image9::copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width,
if (FAILED(result))
{
ERR("GetRenderTargetData unexpectedly failed.");
- renderTargetData->Release();
- surface->Release();
+ SafeRelease(renderTargetData);
+ SafeRelease(surface);
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -536,8 +504,8 @@ void Image9::copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width,
if (FAILED(result))
{
ERR("Failed to lock the source surface (rectangle might be invalid).");
- renderTargetData->Release();
- surface->Release();
+ SafeRelease(renderTargetData);
+ SafeRelease(surface);
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -548,8 +516,8 @@ void Image9::copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width,
{
ERR("Failed to lock the destination surface (rectangle might be invalid).");
renderTargetData->UnlockRect();
- renderTargetData->Release();
- surface->Release();
+ SafeRelease(renderTargetData);
+ SafeRelease(surface);
return gl::error(GL_OUT_OF_MEMORY);
}
@@ -723,10 +691,10 @@ void Image9::copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width,
unlock();
renderTargetData->UnlockRect();
- renderTargetData->Release();
- surface->Release();
+ SafeRelease(renderTargetData);
+ SafeRelease(surface);
mDirty = true;
}
-} \ No newline at end of file
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/Image9.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/Image9.h
index 2fbbca31243..8b5ba89ff24 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/Image9.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/Image9.h
@@ -37,32 +37,33 @@ class Image9 : public Image
static void generateMip(IDirect3DSurface9 *destSurface, IDirect3DSurface9 *sourceSurface);
static void copyLockableSurfaces(IDirect3DSurface9 *dest, IDirect3DSurface9 *source);
- virtual bool redefine(Renderer *renderer, GLint internalformat, GLsizei width, GLsizei height, bool forceRelease);
+ virtual bool redefine(Renderer *renderer, GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, bool forceRelease);
- virtual bool isRenderableFormat() const;
D3DFORMAT getD3DFormat() const;
- virtual bool isDirty() const {return mSurface && mDirty;}
+ virtual bool isDirty() const;
IDirect3DSurface9 *getSurface();
virtual void setManagedSurface(TextureStorageInterface2D *storage, int level);
virtual void setManagedSurface(TextureStorageInterfaceCube *storage, int face, int level);
- virtual bool updateSurface(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
- virtual bool updateSurface(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
-
- virtual void loadData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
- GLint unpackAlignment, const void *input);
- virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ virtual bool copyToStorage(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
+ virtual bool copyToStorage(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
+ virtual bool copyToStorage(TextureStorageInterface3D *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);
+ virtual bool copyToStorage(TextureStorageInterface2DArray *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height);
+
+ virtual void loadData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
+ GLint unpackAlignment, GLenum type, const void *input);
+ virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
const void *input);
- virtual void copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source);
+ virtual void copy(GLint xoffset, GLint yoffset, GLint zoffset,GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source);
private:
DISALLOW_COPY_AND_ASSIGN(Image9);
void createSurface();
void setManagedSurface(IDirect3DSurface9 *surface);
- bool updateSurface(IDirect3DSurface9 *dest, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
+ bool copyToSurface(IDirect3DSurface9 *dest, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
HRESULT lock(D3DLOCKED_RECT *lockedRect, const RECT *rect);
void unlock();
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/IndexBuffer9.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/IndexBuffer9.cpp
index c6d83c5dca7..bc2e6a8002c 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/IndexBuffer9.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/IndexBuffer9.cpp
@@ -7,8 +7,8 @@
// Indexffer9.cpp: Defines the D3D9 IndexBuffer implementation.
-#include "libGLESv2/renderer/IndexBuffer9.h"
-#include "libGLESv2/renderer/Renderer9.h"
+#include "libGLESv2/renderer/d3d9/IndexBuffer9.h"
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
namespace rx
{
@@ -23,20 +23,12 @@ IndexBuffer9::IndexBuffer9(Renderer9 *const renderer) : mRenderer(renderer)
IndexBuffer9::~IndexBuffer9()
{
- if (mIndexBuffer)
- {
- mIndexBuffer->Release();
- mIndexBuffer = NULL;
- }
+ SafeRelease(mIndexBuffer);
}
bool IndexBuffer9::initialize(unsigned int bufferSize, GLenum indexType, bool dynamic)
{
- if (mIndexBuffer)
- {
- mIndexBuffer->Release();
- mIndexBuffer = NULL;
- }
+ SafeRelease(mIndexBuffer);
updateSerial();
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/IndexBuffer9.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/IndexBuffer9.h
index 68018675324..68018675324 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/IndexBuffer9.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/IndexBuffer9.h
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/Query9.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/Query9.cpp
index ef694267dd1..bc3f58fb7bd 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/Query9.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/Query9.cpp
@@ -8,10 +8,10 @@
// Query9.cpp: Defines the rx::Query9 class which implements rx::QueryImpl.
-#include "libGLESv2/renderer/Query9.h"
+#include "libGLESv2/renderer/d3d9/Query9.h"
#include "libGLESv2/main.h"
-#include "libGLESv2/renderer/renderer9_utils.h"
-#include "libGLESv2/renderer/Renderer9.h"
+#include "libGLESv2/renderer/d3d9/renderer9_utils.h"
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
namespace rx
{
@@ -24,11 +24,7 @@ Query9::Query9(rx::Renderer9 *renderer, GLenum type) : QueryImpl(type)
Query9::~Query9()
{
- if (mQuery)
- {
- mQuery->Release();
- mQuery = NULL;
- }
+ SafeRelease(mQuery);
}
void Query9::begin()
@@ -42,17 +38,16 @@ void Query9::begin()
}
HRESULT result = mQuery->Issue(D3DISSUE_BEGIN);
+ UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
}
void Query9::end()
{
- if (mQuery == NULL)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
+ ASSERT(mQuery);
HRESULT result = mQuery->Issue(D3DISSUE_END);
+ UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
mStatus = GL_FALSE;
@@ -122,4 +117,9 @@ GLboolean Query9::testQuery()
return GL_TRUE; // prevent blocking when query is null
}
+bool Query9::isStarted() const
+{
+ return (mQuery != NULL);
+}
+
}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/Query9.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/Query9.h
index 47eef89336e..62906230c47 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/Query9.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/Query9.h
@@ -21,10 +21,11 @@ class Query9 : public QueryImpl
Query9(rx::Renderer9 *renderer, GLenum type);
virtual ~Query9();
- void begin();
- void end();
- GLuint getResult();
- GLboolean isResultAvailable();
+ virtual void begin();
+ virtual void end();
+ virtual GLuint getResult();
+ virtual GLboolean isResultAvailable();
+ virtual bool isStarted() const;
private:
DISALLOW_COPY_AND_ASSIGN(Query9);
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/RenderTarget9.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/RenderTarget9.cpp
new file mode 100644
index 00000000000..a3f2e709d3a
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/RenderTarget9.cpp
@@ -0,0 +1,141 @@
+#include "precompiled.h"
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// RenderTarget9.cpp: Implements a D3D9-specific wrapper for IDirect3DSurface9
+// pointers retained by renderbuffers.
+
+#include "libGLESv2/renderer/d3d9/RenderTarget9.h"
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
+
+#include "libGLESv2/renderer/d3d9/renderer9_utils.h"
+#include "libGLESv2/renderer/d3d9/formatutils9.h"
+#include "libGLESv2/main.h"
+
+namespace rx
+{
+
+// TODO: AddRef the incoming surface to take ownership instead of expecting that its ref is being given.
+RenderTarget9::RenderTarget9(Renderer *renderer, IDirect3DSurface9 *surface)
+{
+ mRenderer = Renderer9::makeRenderer9(renderer);
+ mRenderTarget = surface;
+
+ if (mRenderTarget)
+ {
+ D3DSURFACE_DESC description;
+ mRenderTarget->GetDesc(&description);
+
+ mWidth = description.Width;
+ mHeight = description.Height;
+ mDepth = 1;
+
+ mInternalFormat = d3d9_gl::GetInternalFormat(description.Format);
+ mActualFormat = d3d9_gl::GetInternalFormat(description.Format);
+ mSamples = d3d9_gl::GetSamplesCount(description.MultiSampleType);
+ }
+}
+
+RenderTarget9::RenderTarget9(Renderer *renderer, GLsizei width, GLsizei height, GLenum internalFormat, GLsizei samples)
+{
+ mRenderer = Renderer9::makeRenderer9(renderer);
+ mRenderTarget = NULL;
+
+ D3DFORMAT renderFormat = gl_d3d9::GetRenderFormat(internalFormat, mRenderer);
+ int supportedSamples = mRenderer->getNearestSupportedSamples(renderFormat, samples);
+
+ if (supportedSamples == -1)
+ {
+ gl::error(GL_OUT_OF_MEMORY);
+
+ return;
+ }
+
+ HRESULT result = D3DERR_INVALIDCALL;
+
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+
+ if (width > 0 && height > 0)
+ {
+ IDirect3DDevice9 *device = mRenderer->getDevice();
+
+ bool requiresInitialization = false;
+
+ if (gl::GetDepthBits(internalFormat, clientVersion) > 0 ||
+ gl::GetStencilBits(internalFormat, clientVersion) > 0)
+ {
+ result = device->CreateDepthStencilSurface(width, height, renderFormat,
+ gl_d3d9::GetMultisampleType(supportedSamples),
+ 0, FALSE, &mRenderTarget, NULL);
+ }
+ else
+ {
+ requiresInitialization = gl_d3d9::RequiresTextureDataInitialization(internalFormat);
+
+ result = device->CreateRenderTarget(width, height, renderFormat,
+ gl_d3d9::GetMultisampleType(supportedSamples),
+ 0, FALSE, &mRenderTarget, NULL);
+ }
+
+ if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY)
+ {
+ gl::error(GL_OUT_OF_MEMORY);
+
+ return;
+ }
+
+ ASSERT(SUCCEEDED(result));
+
+ if (requiresInitialization)
+ {
+ // This format requires that the data be initialized before the render target can be used
+ // Unfortunately this requires a Get call on the d3d device but it is far better than having
+ // to mark the render target as lockable and copy data to the gpu.
+ IDirect3DSurface9 *prevRenderTarget = NULL;
+ device->GetRenderTarget(0, &prevRenderTarget);
+ device->SetRenderTarget(0, mRenderTarget);
+ device->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_RGBA(0, 0, 0, 255), 0.0f, 0);
+ device->SetRenderTarget(0, prevRenderTarget);
+ }
+ }
+
+ mWidth = width;
+ mHeight = height;
+ mDepth = 1;
+ mInternalFormat = internalFormat;
+ mSamples = supportedSamples;
+ mActualFormat = d3d9_gl::GetInternalFormat(renderFormat);
+}
+
+RenderTarget9::~RenderTarget9()
+{
+ SafeRelease(mRenderTarget);
+}
+
+RenderTarget9 *RenderTarget9::makeRenderTarget9(RenderTarget *target)
+{
+ ASSERT(HAS_DYNAMIC_TYPE(rx::RenderTarget9*, target));
+ return static_cast<rx::RenderTarget9*>(target);
+}
+
+void RenderTarget9::invalidate(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ // Currently a no-op
+}
+
+IDirect3DSurface9 *RenderTarget9::getSurface()
+{
+ // Caller is responsible for releasing the returned surface reference.
+ // TODO: remove the AddRef to match RenderTarget11
+ if (mRenderTarget)
+ {
+ mRenderTarget->AddRef();
+ }
+
+ return mRenderTarget;
+}
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/RenderTarget9.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/RenderTarget9.h
index faf8ad1c6d2..68d7adb49ef 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/RenderTarget9.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/RenderTarget9.h
@@ -21,10 +21,13 @@ class RenderTarget9 : public RenderTarget
{
public:
RenderTarget9(Renderer *renderer, IDirect3DSurface9 *surface);
- RenderTarget9(Renderer *renderer, GLsizei width, GLsizei height, GLenum format, GLsizei samples);
+ RenderTarget9(Renderer *renderer, GLsizei width, GLsizei height, GLenum internalFormat, GLsizei samples);
virtual ~RenderTarget9();
static RenderTarget9 *makeRenderTarget9(RenderTarget *renderTarget);
+
+ virtual void invalidate(GLint x, GLint y, GLsizei width, GLsizei height);
+
IDirect3DSurface9 *getSurface();
private:
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/Renderer9.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/Renderer9.cpp
index c46d82b335a..7d6dd7a6703 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/Renderer9.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/Renderer9.cpp
@@ -1,12 +1,14 @@
#include "precompiled.h"
//
-// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2012-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Renderer9.cpp: Implements a back-end specific class for the D3D9 renderer.
+#include "common/utilities.h"
+
#include "libGLESv2/main.h"
#include "libGLESv2/Buffer.h"
#include "libGLESv2/Texture.h"
@@ -14,23 +16,26 @@
#include "libGLESv2/Renderbuffer.h"
#include "libGLESv2/ProgramBinary.h"
#include "libGLESv2/renderer/IndexDataManager.h"
-#include "libGLESv2/renderer/Renderer9.h"
-#include "libGLESv2/renderer/renderer9_utils.h"
-#include "libGLESv2/renderer/ShaderExecutable9.h"
-#include "libGLESv2/renderer/SwapChain9.h"
-#include "libGLESv2/renderer/TextureStorage9.h"
-#include "libGLESv2/renderer/Image9.h"
-#include "libGLESv2/renderer/Blit.h"
-#include "libGLESv2/renderer/RenderTarget9.h"
-#include "libGLESv2/renderer/VertexBuffer9.h"
-#include "libGLESv2/renderer/IndexBuffer9.h"
-#include "libGLESv2/renderer/BufferStorage9.h"
-#include "libGLESv2/renderer/Query9.h"
-#include "libGLESv2/renderer/Fence9.h"
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
+#include "libGLESv2/renderer/d3d9/renderer9_utils.h"
+#include "libGLESv2/renderer/d3d9/formatutils9.h"
+#include "libGLESv2/renderer/d3d9/ShaderExecutable9.h"
+#include "libGLESv2/renderer/d3d9/SwapChain9.h"
+#include "libGLESv2/renderer/d3d9/TextureStorage9.h"
+#include "libGLESv2/renderer/d3d9/Image9.h"
+#include "libGLESv2/renderer/d3d9/Blit9.h"
+#include "libGLESv2/renderer/d3d9/RenderTarget9.h"
+#include "libGLESv2/renderer/d3d9/VertexBuffer9.h"
+#include "libGLESv2/renderer/d3d9/IndexBuffer9.h"
+#include "libGLESv2/renderer/d3d9/BufferStorage9.h"
+#include "libGLESv2/renderer/d3d9/Query9.h"
+#include "libGLESv2/renderer/d3d9/Fence9.h"
+#include "libGLESv2/angletypes.h"
#include "libEGL/Display.h"
#include "third_party/trace_event/trace_event.h"
+#include "third_party/systeminfo/SystemInfo.h"
// Can also be enabled by defining FORCE_REF_RAST in the project's predefined macros
#define REF_RAST 0
@@ -43,6 +48,13 @@
#define ANGLE_ENABLE_D3D9EX 1
#endif // !defined(ANGLE_ENABLE_D3D9EX)
+#if !defined(ANGLE_COMPILE_OPTIMIZATION_LEVEL)
+#define ANGLE_COMPILE_OPTIMIZATION_LEVEL D3DCOMPILE_OPTIMIZATION_LEVEL3
+#endif
+
+const D3DFORMAT D3DFMT_INTZ = ((D3DFORMAT)(MAKEFOURCC('I','N','T','Z')));
+const D3DFORMAT D3DFMT_NULL = ((D3DFORMAT)(MAKEFOURCC('N','U','L','L')));
+
namespace rx
{
static const D3DFORMAT RenderTargetFormats[] =
@@ -80,7 +92,7 @@ enum
MAX_TEXTURE_IMAGE_UNITS_VTF_SM3 = 4
};
-Renderer9::Renderer9(egl::Display *display, HDC hDc, bool softwareDevice) : Renderer(display), mDc(hDc), mSoftwareDevice(softwareDevice)
+Renderer9::Renderer9(egl::Display *display, HDC hDc) : Renderer(display), mDc(hDc)
{
mD3d9Module = NULL;
@@ -117,6 +129,10 @@ Renderer9::Renderer9(egl::Display *display, HDC hDc, bool softwareDevice) : Rend
mNullColorbufferCache[i].height = 0;
mNullColorbufferCache[i].buffer = NULL;
}
+
+ mAppliedVertexShader = NULL;
+ mAppliedPixelShader = NULL;
+ mAppliedProgramSerial = 0;
}
Renderer9::~Renderer9()
@@ -142,22 +158,15 @@ void Renderer9::deinitialize()
SafeRelease(mD3d9);
SafeRelease(mD3d9Ex);
+ mCompiler.release();
+
if (mDeviceWindow)
{
DestroyWindow(mDeviceWindow);
mDeviceWindow = NULL;
}
- if (mD3d9Module)
- {
- mD3d9Module = NULL;
- }
-
- while (!mMultiSampleSupport.empty())
- {
- delete [] mMultiSampleSupport.begin()->second;
- mMultiSampleSupport.erase(mMultiSampleSupport.begin());
- }
+ mD3d9Module = NULL;
}
Renderer9 *Renderer9::makeRenderer9(Renderer *renderer)
@@ -168,21 +177,13 @@ Renderer9 *Renderer9::makeRenderer9(Renderer *renderer)
EGLint Renderer9::initialize()
{
- if (!initializeCompiler())
+ if (!mCompiler.initialize())
{
return EGL_NOT_INITIALIZED;
}
- if (mSoftwareDevice)
- {
- TRACE_EVENT0("gpu", "GetModuleHandle_swiftshader");
- mD3d9Module = GetModuleHandle(TEXT("swiftshader_d3d9.dll"));
- }
- else
- {
- TRACE_EVENT0("gpu", "GetModuleHandle_d3d9");
- mD3d9Module = GetModuleHandle(TEXT("d3d9.dll"));
- }
+ TRACE_EVENT0("gpu", "GetModuleHandle_d3d9");
+ mD3d9Module = GetModuleHandle(TEXT("d3d9.dll"));
if (mD3d9Module == NULL)
{
@@ -200,7 +201,7 @@ EGLint Renderer9::initialize()
{
TRACE_EVENT0("gpu", "D3d9Ex_QueryInterface");
ASSERT(mD3d9Ex);
- mD3d9Ex->QueryInterface(IID_IDirect3D9, reinterpret_cast<void**>(&mD3d9));
+ mD3d9Ex->QueryInterface(__uuidof(IDirect3D9), reinterpret_cast<void**>(&mD3d9));
ASSERT(mD3d9);
}
else
@@ -251,7 +252,7 @@ EGLint Renderer9::initialize()
}
// When DirectX9 is running with an older DirectX8 driver, a StretchRect from a regular texture to a render target texture is not supported.
- // This is required by Texture2D::convertToRenderTarget.
+ // This is required by Texture2D::ensureRenderTarget.
if ((mDeviceCaps.DevCaps2 & D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES) == 0)
{
ERR("Renderer does not support stretctrect from textures!\n");
@@ -267,7 +268,7 @@ EGLint Renderer9::initialize()
mSupportsNonPower2Textures = !(mDeviceCaps.TextureCaps & D3DPTEXTURECAPS_POW2) &&
!(mDeviceCaps.TextureCaps & D3DPTEXTURECAPS_CUBEMAP_POW2) &&
!(mDeviceCaps.TextureCaps & D3DPTEXTURECAPS_NONPOW2CONDITIONAL) &&
- !(getComparableOSVersion() < versionWindowsVista && mAdapterIdentifier.VendorId == VENDOR_ID_AMD);
+ !(!isWindowsVistaOrGreater() && mAdapterIdentifier.VendorId == VENDOR_ID_AMD);
// Must support a minimum of 2:1 anisotropy for max anisotropy to be considered supported, per the spec
mSupportsTextureFilterAnisotropy = ((mDeviceCaps.RasterCaps & D3DPRASTERCAPS_ANISOTROPY) && (mDeviceCaps.MaxAnisotropy >= 2));
@@ -301,48 +302,17 @@ EGLint Renderer9::initialize()
mMaxSwapInterval = std::max(mMaxSwapInterval, 4);
}
- int max = 0;
- {
- TRACE_EVENT0("gpu", "getMultiSampleSupport");
- for (unsigned int i = 0; i < ArraySize(RenderTargetFormats); ++i)
- {
- bool *multisampleArray = new bool[D3DMULTISAMPLE_16_SAMPLES + 1];
- getMultiSampleSupport(RenderTargetFormats[i], multisampleArray);
- mMultiSampleSupport[RenderTargetFormats[i]] = multisampleArray;
-
- for (int j = D3DMULTISAMPLE_16_SAMPLES; j >= 0; --j)
- {
- if (multisampleArray[j] && j != D3DMULTISAMPLE_NONMASKABLE && j > max)
- {
- max = j;
- }
- }
- }
- }
+ mMaxSupportedSamples = 0;
+ const d3d9::D3DFormatSet &d3d9Formats = d3d9::GetAllUsedD3DFormats();
+ for (d3d9::D3DFormatSet::const_iterator i = d3d9Formats.begin(); i != d3d9Formats.end(); ++i)
{
- TRACE_EVENT0("gpu", "getMultiSampleSupport2");
- for (unsigned int i = 0; i < ArraySize(DepthStencilFormats); ++i)
- {
- if (DepthStencilFormats[i] == D3DFMT_UNKNOWN)
- continue;
-
- bool *multisampleArray = new bool[D3DMULTISAMPLE_16_SAMPLES + 1];
- getMultiSampleSupport(DepthStencilFormats[i], multisampleArray);
- mMultiSampleSupport[DepthStencilFormats[i]] = multisampleArray;
-
- for (int j = D3DMULTISAMPLE_16_SAMPLES; j >= 0; --j)
- {
- if (multisampleArray[j] && j != D3DMULTISAMPLE_NONMASKABLE && j > max)
- {
- max = j;
- }
- }
- }
+ TRACE_EVENT0("gpu", "getMultiSampleSupport");
+ MultisampleSupportInfo support = getMultiSampleSupport(*i);
+ mMultiSampleSupport[*i] = support;
+ mMaxSupportedSamples = std::max(mMaxSupportedSamples, support.maxSupportedSamples);
}
- mMaxSupportedSamples = max;
-
static const TCHAR windowName[] = TEXT("AngleHiddenWindow");
static const TCHAR className[] = TEXT("STATIC");
@@ -378,7 +348,7 @@ EGLint Renderer9::initialize()
if (mD3d9Ex)
{
TRACE_EVENT0("gpu", "mDevice_QueryInterface");
- result = mDevice->QueryInterface(IID_IDirect3DDevice9Ex, (void**) &mDeviceEx);
+ result = mDevice->QueryInterface(__uuidof(IDirect3DDevice9Ex), (void**)&mDeviceEx);
ASSERT(SUCCEEDED(result));
}
@@ -394,7 +364,7 @@ EGLint Renderer9::initialize()
TRACE_EVENT0("gpu", "device_CreateQuery");
if (SUCCEEDED(mDevice->CreateQuery(D3DQUERYTYPE_OCCLUSION, &occlusionQuery)) && occlusionQuery)
{
- occlusionQuery->Release();
+ SafeRelease(occlusionQuery);
mOcclusionQuerySupport = true;
}
else
@@ -409,7 +379,7 @@ EGLint Renderer9::initialize()
TRACE_EVENT0("gpu", "device_CreateQuery2");
if (SUCCEEDED(mDevice->CreateQuery(D3DQUERYTYPE_EVENT, &eventQuery)) && eventQuery)
{
- eventQuery->Release();
+ SafeRelease(eventQuery);
mEventQuerySupport = true;
}
else
@@ -428,6 +398,10 @@ EGLint Renderer9::initialize()
SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format,
D3DUSAGE_QUERY_VERTEXTEXTURE, D3DRTYPE_TEXTURE, D3DFMT_R16F));
+ // Check RGB565 texture support
+ mRGB565TextureSupport = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format,
+ D3DUSAGE_RENDERTARGET, D3DRTYPE_TEXTURE, D3DFMT_R5G6B5));
+
// Check depth texture support
// we use INTZ for depth textures in Direct3D9
// we also want NULL texture support to ensure the we can make depth-only FBOs
@@ -483,6 +457,25 @@ EGLint Renderer9::initialize()
mFloat16TextureSupport = true;
}
+ D3DFORMAT rgTextureFormats[] =
+ {
+ D3DFMT_R16F,
+ D3DFMT_G16R16F,
+ D3DFMT_R32F,
+ D3DFMT_G32R32F,
+ };
+
+ mRGTextureSupport = true;
+ for (unsigned int i = 0; i < ArraySize(rgTextureFormats); i++)
+ {
+ D3DFORMAT fmt = rgTextureFormats[i];
+ mRGTextureSupport = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_QUERY_FILTER, D3DRTYPE_TEXTURE, fmt)) &&
+ SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_RENDERTARGET, D3DRTYPE_TEXTURE, fmt)) &&
+ SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_QUERY_FILTER, D3DRTYPE_CUBETEXTURE, fmt)) &&
+ SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_RENDERTARGET, D3DRTYPE_CUBETEXTURE, fmt));
+ }
+
+
// Check DXT texture support
mDXT1TextureSupport = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_DXT1));
mDXT3TextureSupport = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_DXT3));
@@ -494,6 +487,8 @@ EGLint Renderer9::initialize()
initializeDevice();
+ d3d9::InitializeVertexTranslations(this);
+
return EGL_SUCCESS;
}
@@ -520,7 +515,7 @@ void Renderer9::initializeDevice()
mSceneStarted = false;
ASSERT(!mBlit && !mVertexDataManager && !mIndexDataManager);
- mBlit = new Blit(this);
+ mBlit = new Blit9(this);
mVertexDataManager = new rx::VertexDataManager(this);
mIndexDataManager = new rx::IndexDataManager(this);
}
@@ -585,10 +580,11 @@ int Renderer9::generateConfigs(ConfigDesc **configDescList)
if (SUCCEEDED(result))
{
ConfigDesc newConfig;
- newConfig.renderTargetFormat = d3d9_gl::ConvertBackBufferFormat(renderTargetFormat);
- newConfig.depthStencilFormat = d3d9_gl::ConvertDepthStencilFormat(depthStencilFormat);
+ newConfig.renderTargetFormat = d3d9_gl::GetInternalFormat(renderTargetFormat);
+ newConfig.depthStencilFormat = d3d9_gl::GetInternalFormat(depthStencilFormat);
newConfig.multiSample = 0; // FIXME: enumerate multi-sampling
newConfig.fastConfig = (currentDisplayMode.Format == renderTargetFormat);
+ newConfig.es3Capable = false;
(*configDescList)[numConfigs++] = newConfig;
}
@@ -681,6 +677,7 @@ IDirect3DQuery9* Renderer9::allocateEventQuery()
if (mEventQueryPool.empty())
{
HRESULT result = mDevice->CreateQuery(D3DQUERYTYPE_EVENT, &query);
+ UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
}
else
@@ -696,7 +693,7 @@ void Renderer9::freeEventQuery(IDirect3DQuery9* query)
{
if (mEventQueryPool.size() > 1000)
{
- query->Release();
+ SafeRelease(query);
}
else
{
@@ -751,6 +748,26 @@ FenceImpl *Renderer9::createFence()
return new Fence9(this);
}
+bool Renderer9::supportsFastCopyBufferToTexture(GLenum internalFormat) const
+{
+ // Pixel buffer objects are not supported in D3D9, since D3D9 is ES2-only and PBOs are ES3.
+ return false;
+}
+
+bool Renderer9::fastCopyBufferToTexture(const gl::PixelUnpackState &unpack, unsigned int offset, RenderTarget *destRenderTarget,
+ GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &destArea)
+{
+ // Pixel buffer objects are not supported in D3D9, since D3D9 is ES2-only and PBOs are ES3.
+ UNREACHABLE();
+ return false;
+}
+
+void Renderer9::generateSwizzle(gl::Texture *texture)
+{
+ // Swizzled textures are not available in ES2 or D3D9
+ UNREACHABLE();
+}
+
void Renderer9::setSamplerState(gl::SamplerType type, int index, const gl::SamplerState &samplerState)
{
bool *forceSetSamplers = (type == gl::SAMPLER_PIXEL) ? mForceSetPixelSamplerStates : mForceSetVertexSamplerStates;
@@ -769,7 +786,7 @@ void Renderer9::setSamplerState(gl::SamplerType type, int index, const gl::Sampl
gl_d3d9::ConvertMinFilter(samplerState.minFilter, &d3dMinFilter, &d3dMipFilter, samplerState.maxAnisotropy);
mDevice->SetSamplerState(d3dSampler, D3DSAMP_MINFILTER, d3dMinFilter);
mDevice->SetSamplerState(d3dSampler, D3DSAMP_MIPFILTER, d3dMipFilter);
- mDevice->SetSamplerState(d3dSampler, D3DSAMP_MAXMIPLEVEL, samplerState.lodOffset);
+ mDevice->SetSamplerState(d3dSampler, D3DSAMP_MAXMIPLEVEL, samplerState.baseLevel);
if (mSupportsTextureFilterAnisotropy)
{
mDevice->SetSamplerState(d3dSampler, D3DSAMP_MAXANISOTROPY, (DWORD)samplerState.maxAnisotropy);
@@ -814,6 +831,12 @@ void Renderer9::setTexture(gl::SamplerType type, int index, gl::Texture *texture
appliedSerials[index] = serial;
}
+bool Renderer9::setUniformBuffers(const gl::Buffer* /*vertexUniformBuffers*/[], const gl::Buffer* /*fragmentUniformBuffers*/[])
+{
+ // No effect in ES2/D3D9
+ return true;
+}
+
void Renderer9::setRasterizerState(const gl::RasterizerState &rasterState)
{
bool rasterStateChanged = mForceSetRasterState || memcmp(&rasterState, &mCurRasterState, sizeof(gl::RasterizerState)) != 0;
@@ -852,10 +875,11 @@ void Renderer9::setRasterizerState(const gl::RasterizerState &rasterState)
mForceSetRasterState = false;
}
-void Renderer9::setBlendState(const gl::BlendState &blendState, const gl::Color &blendColor, unsigned int sampleMask)
+void Renderer9::setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState, const gl::ColorF &blendColor,
+ unsigned int sampleMask)
{
bool blendStateChanged = mForceSetBlendState || memcmp(&blendState, &mCurBlendState, sizeof(gl::BlendState)) != 0;
- bool blendColorChanged = mForceSetBlendState || memcmp(&blendColor, &mCurBlendColor, sizeof(gl::Color)) != 0;
+ bool blendColorChanged = mForceSetBlendState || memcmp(&blendColor, &mCurBlendColor, sizeof(gl::ColorF)) != 0;
bool sampleMaskChanged = mForceSetBlendState || sampleMask != mCurSampleMask;
if (blendStateChanged || blendColorChanged)
@@ -906,6 +930,10 @@ void Renderer9::setBlendState(const gl::BlendState &blendState, const gl::Color
FIXME("Sample alpha to coverage is unimplemented.");
}
+ gl::FramebufferAttachment *attachment = framebuffer->getFirstColorbuffer();
+ GLenum internalFormat = attachment ? attachment->getInternalFormat() : GL_NONE;
+ GLuint clientVersion = getCurrentClientVersion();
+
// Set the color mask
bool zeroColorMaskAllowed = getAdapterVendor() != VENDOR_ID_AMD;
// Apparently some ATI cards have a bug where a draw with a zero color
@@ -914,8 +942,10 @@ void Renderer9::setBlendState(const gl::BlendState &blendState, const gl::Color
// drawing is done.
// http://code.google.com/p/angleproject/issues/detail?id=169
- DWORD colorMask = gl_d3d9::ConvertColorMask(blendState.colorMaskRed, blendState.colorMaskGreen,
- blendState.colorMaskBlue, blendState.colorMaskAlpha);
+ DWORD colorMask = gl_d3d9::ConvertColorMask(gl::GetRedBits(internalFormat, clientVersion) > 0 && blendState.colorMaskRed,
+ gl::GetGreenBits(internalFormat, clientVersion) > 0 && blendState.colorMaskGreen,
+ gl::GetBlueBits(internalFormat, clientVersion) > 0 && blendState.colorMaskBlue,
+ gl::GetAlphaBits(internalFormat, clientVersion) > 0 && blendState.colorMaskAlpha);
if (colorMask == 0 && !zeroColorMaskAllowed)
{
// Enable green channel, but set blending so nothing will be drawn.
@@ -1195,7 +1225,7 @@ bool Renderer9::applyPrimitiveType(GLenum mode, GLsizei count)
}
-gl::Renderbuffer *Renderer9::getNullColorbuffer(gl::Renderbuffer *depthbuffer)
+gl::FramebufferAttachment *Renderer9::getNullColorbuffer(gl::FramebufferAttachment *depthbuffer)
{
if (!depthbuffer)
{
@@ -1218,7 +1248,7 @@ gl::Renderbuffer *Renderer9::getNullColorbuffer(gl::Renderbuffer *depthbuffer)
}
}
- gl::Renderbuffer *nullbuffer = new gl::Renderbuffer(this, 0, new gl::Colorbuffer(this, width, height, GL_NONE, 0));
+ gl::FramebufferAttachment *nullbuffer = new gl::FramebufferAttachment(this, 0, new gl::Colorbuffer(this, width, height, GL_NONE, 0));
// add nullbuffer to the cache
NullColorbufferCacheEntry *oldest = &mNullColorbufferCache[0];
@@ -1243,7 +1273,7 @@ bool Renderer9::applyRenderTarget(gl::Framebuffer *framebuffer)
{
// if there is no color attachment we must synthesize a NULL colorattachment
// to keep the D3D runtime happy. This should only be possible if depth texturing.
- gl::Renderbuffer *renderbufferObject = NULL;
+ gl::FramebufferAttachment *renderbufferObject = NULL;
if (framebuffer->getColorbufferType(0) != GL_NONE)
{
renderbufferObject = framebuffer->getColorbuffer(0);
@@ -1278,13 +1308,13 @@ bool Renderer9::applyRenderTarget(gl::Framebuffer *framebuffer)
}
mDevice->SetRenderTarget(0, renderTargetSurface);
- renderTargetSurface->Release();
+ SafeRelease(renderTargetSurface);
mAppliedRenderTargetSerial = renderTargetSerial;
renderTargetChanged = true;
}
- gl::Renderbuffer *depthStencil = NULL;
+ gl::FramebufferAttachment *depthStencil = NULL;
unsigned int depthbufferSerial = 0;
unsigned int stencilbufferSerial = 0;
if (framebuffer->getDepthbufferType() != GL_NONE)
@@ -1335,7 +1365,7 @@ bool Renderer9::applyRenderTarget(gl::Framebuffer *framebuffer)
}
mDevice->SetDepthStencilSurface(depthStencilSurface);
- depthStencilSurface->Release();
+ SafeRelease(depthStencilSurface);
depthSize = depthStencil->getDepthSize();
stencilSize = depthStencil->getStencilSize();
@@ -1366,6 +1396,7 @@ bool Renderer9::applyRenderTarget(gl::Framebuffer *framebuffer)
{
mForceSetScissor = true;
mForceSetViewport = true;
+ mForceSetBlendState = true;
mRenderTargetDesc.width = renderbufferObject->getWidth();
mRenderTargetDesc.height = renderbufferObject->getHeight();
@@ -1376,15 +1407,16 @@ bool Renderer9::applyRenderTarget(gl::Framebuffer *framebuffer)
return true;
}
-GLenum Renderer9::applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances)
+GLenum Renderer9::applyVertexBuffer(gl::ProgramBinary *programBinary, const gl::VertexAttribute vertexAttributes[], gl::VertexAttribCurrentValueData currentValues[],
+ GLint first, GLsizei count, GLsizei instances)
{
TranslatedAttribute attributes[gl::MAX_VERTEX_ATTRIBS];
- GLenum err = mVertexDataManager->prepareVertexData(vertexAttributes, programBinary, first, count, attributes, instances);
+ GLenum err = mVertexDataManager->prepareVertexData(vertexAttributes, currentValues, programBinary, first, count, attributes, instances);
if (err != GL_NO_ERROR)
{
return err;
}
-
+
return mVertexDeclarationCache.applyDeclaration(mDevice, attributes, programBinary, instances, &mRepeatDraw);
}
@@ -1410,10 +1442,17 @@ GLenum Renderer9::applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArr
return err;
}
-void Renderer9::drawArrays(GLenum mode, GLsizei count, GLsizei instances)
+void Renderer9::applyTransformFeedbackBuffers(gl::Buffer *transformFeedbackBuffers[], GLintptr offsets[])
{
+ UNREACHABLE();
+}
+
+void Renderer9::drawArrays(GLenum mode, GLsizei count, GLsizei instances, bool transformFeedbackActive)
+{
+ ASSERT(!transformFeedbackActive);
+
startScene();
-
+
if (mode == GL_LINE_LOOP)
{
drawLineLoop(count, GL_NONE, NULL, 0, NULL);
@@ -1448,13 +1487,14 @@ void Renderer9::drawArrays(GLenum mode, GLsizei count, GLsizei instances)
}
}
-void Renderer9::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo, GLsizei /*instances*/)
+void Renderer9::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices,
+ gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo, GLsizei /*instances*/)
{
startScene();
if (mode == GL_POINTS)
{
- drawIndexedPoints(count, type, indices, elementArrayBuffer);
+ drawIndexedPoints(count, type, indices, indexInfo.minIndex, elementArrayBuffer);
}
else if (mode == GL_LINE_LOOP)
{
@@ -1498,15 +1538,15 @@ void Renderer9::drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices,
}
}
+ // Checked by Renderer9::applyPrimitiveType
+ ASSERT(count >= 0);
+
if (static_cast<unsigned int>(count) + 1 > (std::numeric_limits<unsigned int>::max() / sizeof(unsigned int)))
{
ERR("Could not create a 32-bit looping index buffer for GL_LINE_LOOP, too many indices required.");
return gl::error(GL_OUT_OF_MEMORY);
}
- // Checked by Renderer9::applyPrimitiveType
- ASSERT(count >= 0);
-
const unsigned int spaceNeeded = (static_cast<unsigned int>(count) + 1) * sizeof(unsigned int);
if (!mLineLoopIB->reserveBufferSpace(spaceNeeded, GL_UNSIGNED_INT))
{
@@ -1658,16 +1698,16 @@ void Renderer9::drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices,
}
template <typename T>
-static void drawPoints(IDirect3DDevice9* device, GLsizei count, const GLvoid *indices)
+static void drawPoints(IDirect3DDevice9* device, GLsizei count, const GLvoid *indices, int minIndex)
{
for (int i = 0; i < count; i++)
{
- unsigned int indexValue = static_cast<unsigned int>(static_cast<const T*>(indices)[i]);
+ unsigned int indexValue = static_cast<unsigned int>(static_cast<const T*>(indices)[i]) - minIndex;
device->DrawPrimitive(D3DPT_POINTLIST, indexValue, 1);
}
}
-void Renderer9::drawIndexedPoints(GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer)
+void Renderer9::drawIndexedPoints(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer)
{
// Drawing index point lists is unsupported in d3d9, fall back to a regular DrawPrimitive call
// for each individual point. This call is not expected to happen often.
@@ -1681,41 +1721,57 @@ void Renderer9::drawIndexedPoints(GLsizei count, GLenum type, const GLvoid *indi
switch (type)
{
- case GL_UNSIGNED_BYTE: drawPoints<GLubyte>(mDevice, count, indices); break;
- case GL_UNSIGNED_SHORT: drawPoints<GLushort>(mDevice, count, indices); break;
- case GL_UNSIGNED_INT: drawPoints<GLuint>(mDevice, count, indices); break;
+ case GL_UNSIGNED_BYTE: drawPoints<GLubyte>(mDevice, count, indices, minIndex); break;
+ case GL_UNSIGNED_SHORT: drawPoints<GLushort>(mDevice, count, indices, minIndex); break;
+ case GL_UNSIGNED_INT: drawPoints<GLuint>(mDevice, count, indices, minIndex); break;
default: UNREACHABLE();
}
}
-void Renderer9::applyShaders(gl::ProgramBinary *programBinary)
+void Renderer9::applyShaders(gl::ProgramBinary *programBinary, bool rasterizerDiscard, bool transformFeedbackActive, const gl::VertexFormat inputLayout[])
{
- unsigned int programBinarySerial = programBinary->getSerial();
- if (programBinarySerial != mAppliedProgramBinarySerial)
- {
- ShaderExecutable *vertexExe = programBinary->getVertexExecutable();
- ShaderExecutable *pixelExe = programBinary->getPixelExecutable();
+ ASSERT(!transformFeedbackActive);
+ ASSERT(!rasterizerDiscard);
- IDirect3DVertexShader9 *vertexShader = NULL;
- if (vertexExe) vertexShader = ShaderExecutable9::makeShaderExecutable9(vertexExe)->getVertexShader();
+ ShaderExecutable *vertexExe = programBinary->getVertexExecutableForInputLayout(inputLayout);
+ ShaderExecutable *pixelExe = programBinary->getPixelExecutable();
- IDirect3DPixelShader9 *pixelShader = NULL;
- if (pixelExe) pixelShader = ShaderExecutable9::makeShaderExecutable9(pixelExe)->getPixelShader();
+ IDirect3DVertexShader9 *vertexShader = (vertexExe ? ShaderExecutable9::makeShaderExecutable9(vertexExe)->getVertexShader() : NULL);
+ IDirect3DPixelShader9 *pixelShader = (pixelExe ? ShaderExecutable9::makeShaderExecutable9(pixelExe)->getPixelShader() : NULL);
- mDevice->SetPixelShader(pixelShader);
+ if (vertexShader != mAppliedVertexShader)
+ {
mDevice->SetVertexShader(vertexShader);
+ mAppliedVertexShader = vertexShader;
+ }
+
+ if (pixelShader != mAppliedPixelShader)
+ {
+ mDevice->SetPixelShader(pixelShader);
+ mAppliedPixelShader = pixelShader;
+ }
+
+ // D3D9 has a quirk where creating multiple shaders with the same content
+ // can return the same shader pointer. Because GL programs store different data
+ // per-program, checking the program serial guarantees we upload fresh
+ // uniform data even if our shader pointers are the same.
+ // https://code.google.com/p/angleproject/issues/detail?id=661
+ unsigned int programSerial = programBinary->getSerial();
+ if (programSerial != mAppliedProgramSerial)
+ {
programBinary->dirtyAllUniforms();
mDxUniformsDirty = true;
-
- mAppliedProgramBinarySerial = programBinarySerial;
+ mAppliedProgramSerial = programSerial;
}
}
-void Renderer9::applyUniforms(gl::ProgramBinary *programBinary, gl::UniformArray *uniformArray)
+void Renderer9::applyUniforms(const gl::ProgramBinary &programBinary)
{
- for (std::vector<gl::Uniform*>::const_iterator ub = uniformArray->begin(), ue = uniformArray->end(); ub != ue; ++ub)
+ const std::vector<gl::LinkedUniform*> &uniformArray = programBinary.getUniforms();
+
+ for (size_t uniformIndex = 0; uniformIndex < uniformArray.size(); uniformIndex++)
{
- gl::Uniform *targetUniform = *ub;
+ gl::LinkedUniform *targetUniform = uniformArray[uniformIndex];
if (targetUniform->dirty)
{
@@ -1751,8 +1807,6 @@ void Renderer9::applyUniforms(gl::ProgramBinary *programBinary, gl::UniformArray
default:
UNREACHABLE();
}
-
- targetUniform->dirty = false;
}
}
@@ -1765,20 +1819,20 @@ void Renderer9::applyUniforms(gl::ProgramBinary *programBinary, gl::UniformArray
}
}
-void Renderer9::applyUniformnfv(gl::Uniform *targetUniform, const GLfloat *v)
+void Renderer9::applyUniformnfv(gl::LinkedUniform *targetUniform, const GLfloat *v)
{
- if (targetUniform->psRegisterIndex >= 0)
+ if (targetUniform->isReferencedByFragmentShader())
{
mDevice->SetPixelShaderConstantF(targetUniform->psRegisterIndex, v, targetUniform->registerCount);
}
- if (targetUniform->vsRegisterIndex >= 0)
+ if (targetUniform->isReferencedByVertexShader())
{
mDevice->SetVertexShaderConstantF(targetUniform->vsRegisterIndex, v, targetUniform->registerCount);
}
}
-void Renderer9::applyUniformniv(gl::Uniform *targetUniform, const GLint *v)
+void Renderer9::applyUniformniv(gl::LinkedUniform *targetUniform, const GLint *v)
{
ASSERT(targetUniform->registerCount <= MAX_VERTEX_CONSTANT_VECTORS_D3D9);
GLfloat vector[MAX_VERTEX_CONSTANT_VECTORS_D3D9][4];
@@ -1794,7 +1848,7 @@ void Renderer9::applyUniformniv(gl::Uniform *targetUniform, const GLint *v)
applyUniformnfv(targetUniform, (GLfloat*)vector);
}
-void Renderer9::applyUniformnbv(gl::Uniform *targetUniform, const GLint *v)
+void Renderer9::applyUniformnbv(gl::LinkedUniform *targetUniform, const GLint *v)
{
ASSERT(targetUniform->registerCount <= MAX_VERTEX_CONSTANT_VECTORS_D3D9);
GLfloat vector[MAX_VERTEX_CONSTANT_VECTORS_D3D9][4];
@@ -1812,27 +1866,70 @@ void Renderer9::applyUniformnbv(gl::Uniform *targetUniform, const GLint *v)
void Renderer9::clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer)
{
- D3DCOLOR color = D3DCOLOR_ARGB(gl::unorm<8>(clearParams.colorClearValue.alpha),
- gl::unorm<8>(clearParams.colorClearValue.red),
- gl::unorm<8>(clearParams.colorClearValue.green),
- gl::unorm<8>(clearParams.colorClearValue.blue));
+ if (clearParams.colorClearType != GL_FLOAT)
+ {
+ // Clearing buffers with non-float values is not supported by Renderer9 and ES 2.0
+ UNREACHABLE();
+ return;
+ }
+
+ bool clearColor = clearParams.clearColor[0];
+ for (unsigned int i = 0; i < ArraySize(clearParams.clearColor); i++)
+ {
+ if (clearParams.clearColor[i] != clearColor)
+ {
+ // Clearing individual buffers other than buffer zero is not supported by Renderer9 and ES 2.0
+ UNREACHABLE();
+ return;
+ }
+ }
+
float depth = gl::clamp01(clearParams.depthClearValue);
- int stencil = clearParams.stencilClearValue & 0x000000FF;
+ DWORD stencil = clearParams.stencilClearValue & 0x000000FF;
unsigned int stencilUnmasked = 0x0;
- if ((clearParams.mask & GL_STENCIL_BUFFER_BIT) && frameBuffer->hasStencil())
+ if (clearParams.clearStencil && frameBuffer->hasStencil())
{
- unsigned int stencilSize = gl::GetStencilSize(frameBuffer->getStencilbuffer()->getActualFormat());
+ unsigned int stencilSize = gl::GetStencilBits(frameBuffer->getStencilbuffer()->getActualFormat(),
+ getCurrentClientVersion());
stencilUnmasked = (0x1 << stencilSize) - 1;
}
- bool alphaUnmasked = (gl::GetAlphaSize(mRenderTargetDesc.format) == 0) || clearParams.colorMaskAlpha;
-
- const bool needMaskedStencilClear = (clearParams.mask & GL_STENCIL_BUFFER_BIT) &&
+ const bool needMaskedStencilClear = clearParams.clearStencil &&
(clearParams.stencilWriteMask & stencilUnmasked) != stencilUnmasked;
- const bool needMaskedColorClear = (clearParams.mask & GL_COLOR_BUFFER_BIT) &&
- !(clearParams.colorMaskRed && clearParams.colorMaskGreen &&
- clearParams.colorMaskBlue && alphaUnmasked);
+
+ bool needMaskedColorClear = false;
+ D3DCOLOR color = D3DCOLOR_ARGB(255, 0, 0, 0);
+ if (clearColor)
+ {
+ gl::FramebufferAttachment *attachment = frameBuffer->getFirstColorbuffer();
+ GLenum internalFormat = attachment->getInternalFormat();
+ GLenum actualFormat = attachment->getActualFormat();
+
+ GLuint clientVersion = getCurrentClientVersion();
+ GLuint internalRedBits = gl::GetRedBits(internalFormat, clientVersion);
+ GLuint internalGreenBits = gl::GetGreenBits(internalFormat, clientVersion);
+ GLuint internalBlueBits = gl::GetBlueBits(internalFormat, clientVersion);
+ GLuint internalAlphaBits = gl::GetAlphaBits(internalFormat, clientVersion);
+
+ GLuint actualRedBits = gl::GetRedBits(actualFormat, clientVersion);
+ GLuint actualGreenBits = gl::GetGreenBits(actualFormat, clientVersion);
+ GLuint actualBlueBits = gl::GetBlueBits(actualFormat, clientVersion);
+ GLuint actualAlphaBits = gl::GetAlphaBits(actualFormat, clientVersion);
+
+ color = D3DCOLOR_ARGB(gl::unorm<8>((internalAlphaBits == 0 && actualAlphaBits > 0) ? 1.0f : clearParams.colorFClearValue.alpha),
+ gl::unorm<8>((internalRedBits == 0 && actualRedBits > 0) ? 0.0f : clearParams.colorFClearValue.red),
+ gl::unorm<8>((internalGreenBits == 0 && actualGreenBits > 0) ? 0.0f : clearParams.colorFClearValue.green),
+ gl::unorm<8>((internalBlueBits == 0 && actualBlueBits > 0) ? 0.0f : clearParams.colorFClearValue.blue));
+
+ if ((internalRedBits > 0 && !clearParams.colorMaskRed) ||
+ (internalGreenBits > 0 && !clearParams.colorMaskGreen) ||
+ (internalBlueBits > 0 && !clearParams.colorMaskBlue) ||
+ (internalAlphaBits > 0 && !clearParams.colorMaskAlpha))
+ {
+ needMaskedColorClear = true;
+ }
+ }
if (needMaskedColorClear || needMaskedStencilClear)
{
@@ -1893,7 +1990,7 @@ void Renderer9::clear(const gl::ClearParameters &clearParams, gl::Framebuffer *f
mDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
mDevice->SetRenderState(D3DRS_CLIPPLANEENABLE, 0);
- if (clearParams.mask & GL_COLOR_BUFFER_BIT)
+ if (clearColor)
{
mDevice->SetRenderState(D3DRS_COLORWRITEENABLE,
gl_d3d9::ConvertColorMask(clearParams.colorMaskRed,
@@ -1906,7 +2003,7 @@ void Renderer9::clear(const gl::ClearParameters &clearParams, gl::Framebuffer *f
mDevice->SetRenderState(D3DRS_COLORWRITEENABLE, 0);
}
- if (stencilUnmasked != 0x0 && (clearParams.mask & GL_STENCIL_BUFFER_BIT))
+ if (stencilUnmasked != 0x0 && clearParams.clearStencil)
{
mDevice->SetRenderState(D3DRS_STENCILENABLE, TRUE);
mDevice->SetRenderState(D3DRS_TWOSIDEDSTENCILMODE, FALSE);
@@ -1962,7 +2059,7 @@ void Renderer9::clear(const gl::ClearParameters &clearParams, gl::Framebuffer *f
startScene();
mDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, quad, sizeof(float[4]));
- if (clearParams.mask & GL_DEPTH_BUFFER_BIT)
+ if (clearParams.clearDepth)
{
mDevice->SetRenderState(D3DRS_ZENABLE, TRUE);
mDevice->SetRenderState(D3DRS_ZWRITEENABLE, TRUE);
@@ -1974,18 +2071,18 @@ void Renderer9::clear(const gl::ClearParameters &clearParams, gl::Framebuffer *f
mMaskedClearSavedState->Apply();
}
}
- else if (clearParams.mask)
+ else if (clearColor || clearParams.clearDepth || clearParams.clearStencil)
{
DWORD dxClearFlags = 0;
- if (clearParams.mask & GL_COLOR_BUFFER_BIT)
+ if (clearColor)
{
dxClearFlags |= D3DCLEAR_TARGET;
}
- if (clearParams.mask & GL_DEPTH_BUFFER_BIT)
+ if (clearParams.clearDepth)
{
dxClearFlags |= D3DCLEAR_ZBUFFER;
}
- if (clearParams.mask & GL_STENCIL_BUFFER_BIT)
+ if (clearParams.clearStencil)
{
dxClearFlags |= D3DCLEAR_STENCIL;
}
@@ -2020,7 +2117,9 @@ void Renderer9::markAllStateDirty()
}
mAppliedIBSerial = 0;
- mAppliedProgramBinarySerial = 0;
+ mAppliedVertexShader = NULL;
+ mAppliedPixelShader = NULL;
+ mAppliedProgramSerial = 0;
mDxUniformsDirty = true;
mVertexDeclarationCache.markStateDirty();
@@ -2028,11 +2127,11 @@ void Renderer9::markAllStateDirty()
void Renderer9::releaseDeviceResources()
{
- while (!mEventQueryPool.empty())
+ for (size_t i = 0; i < mEventQueryPool.size(); i++)
{
- mEventQueryPool.back()->Release();
- mEventQueryPool.pop_back();
+ SafeRelease(mEventQueryPool[i]);
}
+ mEventQueryPool.clear();
SafeRelease(mMaskedClearSavedState);
@@ -2048,10 +2147,8 @@ void Renderer9::releaseDeviceResources()
{
SafeDelete(mNullColorbufferCache[i].buffer);
}
-
}
-
void Renderer9::notifyDeviceLost()
{
mDeviceLost = true;
@@ -2067,7 +2164,7 @@ bool Renderer9::isDeviceLost()
bool Renderer9::testDeviceLost(bool notify)
{
HRESULT status = getDeviceStatusCode();
- bool isLost = (FAILED(status) || d3d9::isDeviceLostError(status));
+ bool isLost = FAILED(status);
if (isLost)
{
@@ -2255,15 +2352,30 @@ GUID Renderer9::getAdapterIdentifier() const
return mAdapterIdentifier.DeviceIdentifier;
}
-void Renderer9::getMultiSampleSupport(D3DFORMAT format, bool *multiSampleArray)
+Renderer9::MultisampleSupportInfo Renderer9::getMultiSampleSupport(D3DFORMAT format)
{
- for (int multiSampleIndex = 0; multiSampleIndex <= D3DMULTISAMPLE_16_SAMPLES; multiSampleIndex++)
+ MultisampleSupportInfo support = { 0 };
+
+ for (unsigned int multiSampleIndex = 0; multiSampleIndex < ArraySize(support.supportedSamples); multiSampleIndex++)
{
- HRESULT result = mD3d9->CheckDeviceMultiSampleType(mAdapter, mDeviceType, format,
- TRUE, (D3DMULTISAMPLE_TYPE)multiSampleIndex, NULL);
+ HRESULT result = mD3d9->CheckDeviceMultiSampleType(mAdapter, mDeviceType, format, TRUE,
+ (D3DMULTISAMPLE_TYPE)multiSampleIndex, NULL);
- multiSampleArray[multiSampleIndex] = SUCCEEDED(result);
+ if (SUCCEEDED(result))
+ {
+ support.supportedSamples[multiSampleIndex] = true;
+ if (multiSampleIndex != D3DMULTISAMPLE_NONMASKABLE)
+ {
+ support.maxSupportedSamples = std::max(support.maxSupportedSamples, multiSampleIndex);
+ }
+ }
+ else
+ {
+ support.supportedSamples[multiSampleIndex] = false;
+ }
}
+
+ return support;
}
bool Renderer9::getBGRATextureSupport() const
@@ -2272,17 +2384,17 @@ bool Renderer9::getBGRATextureSupport() const
return true;
}
-bool Renderer9::getDXT1TextureSupport()
+bool Renderer9::getDXT1TextureSupport() const
{
return mDXT1TextureSupport;
}
-bool Renderer9::getDXT3TextureSupport()
+bool Renderer9::getDXT3TextureSupport() const
{
return mDXT3TextureSupport;
}
-bool Renderer9::getDXT5TextureSupport()
+bool Renderer9::getDXT5TextureSupport() const
{
return mDXT5TextureSupport;
}
@@ -2292,35 +2404,67 @@ bool Renderer9::getDepthTextureSupport() const
return mDepthTextureSupport;
}
-bool Renderer9::getFloat32TextureSupport(bool *filtering, bool *renderable)
+bool Renderer9::getFloat32TextureSupport() const
{
- *filtering = mFloat32FilterSupport;
- *renderable = mFloat32RenderSupport;
return mFloat32TextureSupport;
}
-bool Renderer9::getFloat16TextureSupport(bool *filtering, bool *renderable)
+bool Renderer9::getFloat32TextureFilteringSupport() const
+{
+ return mFloat32FilterSupport;
+}
+
+bool Renderer9::getFloat32TextureRenderingSupport() const
+{
+ return mFloat32RenderSupport;
+}
+
+bool Renderer9::getFloat16TextureSupport() const
{
- *filtering = mFloat16FilterSupport;
- *renderable = mFloat16RenderSupport;
return mFloat16TextureSupport;
}
-bool Renderer9::getLuminanceTextureSupport()
+bool Renderer9::getFloat16TextureFilteringSupport() const
+{
+ return mFloat16FilterSupport;
+}
+
+bool Renderer9::getFloat16TextureRenderingSupport() const
+{
+ return mFloat16RenderSupport;
+}
+
+bool Renderer9::getRGB565TextureSupport() const
+{
+ return mRGB565TextureSupport;
+}
+
+bool Renderer9::getLuminanceTextureSupport() const
{
return mLuminanceTextureSupport;
}
-bool Renderer9::getLuminanceAlphaTextureSupport()
+bool Renderer9::getLuminanceAlphaTextureSupport() const
{
return mLuminanceAlphaTextureSupport;
}
+bool Renderer9::getRGTextureSupport() const
+{
+ return mRGTextureSupport;
+}
+
bool Renderer9::getTextureFilterAnisotropySupport() const
{
return mSupportsTextureFilterAnisotropy;
}
+bool Renderer9::getPBOSupport() const
+{
+ // D3D9 cannot support PBOs
+ return false;
+}
+
float Renderer9::getTextureMaxAnisotropy() const
{
if (mSupportsTextureFilterAnisotropy)
@@ -2330,7 +2474,7 @@ float Renderer9::getTextureMaxAnisotropy() const
return 1.0f;
}
-bool Renderer9::getEventQuerySupport()
+bool Renderer9::getEventQuerySupport() const
{
return mEventQuerySupport;
}
@@ -2373,6 +2517,46 @@ unsigned int Renderer9::getMaxVaryingVectors() const
return (getMajorShaderModel() >= 3) ? MAX_VARYING_VECTORS_SM3 : MAX_VARYING_VECTORS_SM2;
}
+unsigned int Renderer9::getMaxVertexShaderUniformBuffers() const
+{
+ return 0;
+}
+
+unsigned int Renderer9::getMaxFragmentShaderUniformBuffers() const
+{
+ return 0;
+}
+
+unsigned int Renderer9::getReservedVertexUniformBuffers() const
+{
+ return 0;
+}
+
+unsigned int Renderer9::getReservedFragmentUniformBuffers() const
+{
+ return 0;
+}
+
+unsigned int Renderer9::getMaxTransformFeedbackBuffers() const
+{
+ return 0;
+}
+
+unsigned int Renderer9::getMaxTransformFeedbackSeparateComponents() const
+{
+ return 0;
+}
+
+unsigned int Renderer9::getMaxTransformFeedbackInterleavedComponents() const
+{
+ return 0;
+}
+
+unsigned int Renderer9::getMaxUniformBufferSize() const
+{
+ return 0;
+}
+
bool Renderer9::getNonPower2TextureSupport() const
{
return mSupportsNonPower2Textures;
@@ -2404,6 +2588,20 @@ bool Renderer9::getPostSubBufferSupport() const
return true;
}
+int Renderer9::getMaxRecommendedElementsIndices() const
+{
+ // ES3 only
+ UNREACHABLE();
+ return 0;
+}
+
+int Renderer9::getMaxRecommendedElementsVertices() const
+{
+ // ES3 only
+ UNREACHABLE();
+ return 0;
+}
+
int Renderer9::getMajorShaderModel() const
{
return D3DSHADER_VERSION_MAJOR(mDeviceCaps.PixelShaderVersion);
@@ -2418,7 +2616,7 @@ float Renderer9::getMaxPointSize() const
int Renderer9::getMaxViewportDimension() const
{
int maxTextureDimension = std::min(std::min(getMaxTextureWidth(), getMaxTextureHeight()),
- (int)gl::IMPLEMENTATION_MAX_TEXTURE_SIZE);
+ (int)gl::IMPLEMENTATION_MAX_2D_TEXTURE_SIZE);
return maxTextureDimension;
}
@@ -2432,6 +2630,18 @@ int Renderer9::getMaxTextureHeight() const
return (int)mDeviceCaps.MaxTextureHeight;
}
+int Renderer9::getMaxTextureDepth() const
+{
+ // 3D textures are not available in the D3D9 backend.
+ return 1;
+}
+
+int Renderer9::getMaxTextureArrayLayers() const
+{
+ // 2D array textures are not available in the D3D9 backend.
+ return 1;
+}
+
bool Renderer9::get32BitIndexSupport() const
{
return mDeviceCaps.MaxVertexIndex >= (1 << 16);
@@ -2457,6 +2667,53 @@ int Renderer9::getMaxSupportedSamples() const
return mMaxSupportedSamples;
}
+GLsizei Renderer9::getMaxSupportedFormatSamples(GLenum internalFormat) const
+{
+ D3DFORMAT format = gl_d3d9::GetTextureFormat(internalFormat, this);
+ MultisampleSupportMap::const_iterator itr = mMultiSampleSupport.find(format);
+ return (itr != mMultiSampleSupport.end()) ? mMaxSupportedSamples : 0;
+}
+
+GLsizei Renderer9::getNumSampleCounts(GLenum internalFormat) const
+{
+ D3DFORMAT format = gl_d3d9::GetTextureFormat(internalFormat, this);
+ MultisampleSupportMap::const_iterator iter = mMultiSampleSupport.find(format);
+
+ unsigned int numCounts = 0;
+ if (iter != mMultiSampleSupport.end())
+ {
+ const MultisampleSupportInfo& info = iter->second;
+ for (int i = 0; i < D3DMULTISAMPLE_16_SAMPLES; i++)
+ {
+ if (i != D3DMULTISAMPLE_NONMASKABLE && info.supportedSamples[i])
+ {
+ numCounts++;
+ }
+ }
+ }
+
+ return numCounts;
+}
+
+void Renderer9::getSampleCounts(GLenum internalFormat, GLsizei bufSize, GLint *params) const
+{
+ D3DFORMAT format = gl_d3d9::GetTextureFormat(internalFormat, this);
+ MultisampleSupportMap::const_iterator iter = mMultiSampleSupport.find(format);
+
+ if (iter != mMultiSampleSupport.end())
+ {
+ const MultisampleSupportInfo& info = iter->second;
+ int bufPos = 0;
+ for (int i = D3DMULTISAMPLE_16_SAMPLES; i >= 0 && bufPos < bufSize; i--)
+ {
+ if (i != D3DMULTISAMPLE_NONMASKABLE && info.supportedSamples[i])
+ {
+ params[bufPos++] = i;
+ }
+ }
+ }
+}
+
int Renderer9::getNearestSupportedSamples(D3DFORMAT format, int requested) const
{
if (requested == 0)
@@ -2464,7 +2721,7 @@ int Renderer9::getNearestSupportedSamples(D3DFORMAT format, int requested) const
return requested;
}
- std::map<D3DFORMAT, bool *>::const_iterator itr = mMultiSampleSupport.find(format);
+ MultisampleSupportMap::const_iterator itr = mMultiSampleSupport.find(format);
if (itr == mMultiSampleSupport.end())
{
if (format == D3DFMT_UNKNOWN)
@@ -2472,9 +2729,9 @@ int Renderer9::getNearestSupportedSamples(D3DFORMAT format, int requested) const
return -1;
}
- for (int i = requested; i <= D3DMULTISAMPLE_16_SAMPLES; ++i)
+ for (unsigned int i = requested; i < ArraySize(itr->second.supportedSamples); ++i)
{
- if (itr->second[i] && i != D3DMULTISAMPLE_NONMASKABLE)
+ if (itr->second.supportedSamples[i] && i != D3DMULTISAMPLE_NONMASKABLE)
{
return i;
}
@@ -2489,7 +2746,7 @@ unsigned int Renderer9::getMaxRenderTargets() const
return 1;
}
-D3DFORMAT Renderer9::ConvertTextureInternalFormat(GLint internalformat)
+D3DFORMAT Renderer9::ConvertTextureInternalFormat(GLenum internalformat)
{
switch (internalformat)
{
@@ -2545,19 +2802,21 @@ bool Renderer9::copyToRenderTarget(TextureStorageInterface2D *dest, TextureStora
TextureStorage9_2D *source9 = TextureStorage9_2D::makeTextureStorage9_2D(source->getStorageInstance());
TextureStorage9_2D *dest9 = TextureStorage9_2D::makeTextureStorage9_2D(dest->getStorageInstance());
- int levels = source9->levelCount();
+ int levels = source9->getLevelCount();
for (int i = 0; i < levels; ++i)
{
IDirect3DSurface9 *srcSurf = source9->getSurfaceLevel(i, false);
IDirect3DSurface9 *dstSurf = dest9->getSurfaceLevel(i, false);
-
+
result = copyToRenderTarget(dstSurf, srcSurf, source9->isManaged());
- if (srcSurf) srcSurf->Release();
- if (dstSurf) dstSurf->Release();
+ SafeRelease(srcSurf);
+ SafeRelease(dstSurf);
if (!result)
+ {
return false;
+ }
}
}
@@ -2572,7 +2831,7 @@ bool Renderer9::copyToRenderTarget(TextureStorageInterfaceCube *dest, TextureSto
{
TextureStorage9_Cube *source9 = TextureStorage9_Cube::makeTextureStorage9_Cube(source->getStorageInstance());
TextureStorage9_Cube *dest9 = TextureStorage9_Cube::makeTextureStorage9_Cube(dest->getStorageInstance());
- int levels = source9->levelCount();
+ int levels = source9->getLevelCount();
for (int f = 0; f < 6; f++)
{
for (int i = 0; i < levels; i++)
@@ -2582,11 +2841,13 @@ bool Renderer9::copyToRenderTarget(TextureStorageInterfaceCube *dest, TextureSto
result = copyToRenderTarget(dstSurf, srcSurf, source9->isManaged());
- if (srcSurf) srcSurf->Release();
- if (dstSurf) dstSurf->Release();
+ SafeRelease(srcSurf);
+ SafeRelease(dstSurf);
if (!result)
+ {
return false;
+ }
}
}
}
@@ -2594,6 +2855,20 @@ bool Renderer9::copyToRenderTarget(TextureStorageInterfaceCube *dest, TextureSto
return result;
}
+bool Renderer9::copyToRenderTarget(TextureStorageInterface3D *dest, TextureStorageInterface3D *source)
+{
+ // 3D textures are not available in the D3D9 backend.
+ UNREACHABLE();
+ return false;
+}
+
+bool Renderer9::copyToRenderTarget(TextureStorageInterface2DArray *dest, TextureStorageInterface2DArray *source)
+{
+ // 2D array textures are not supported by the D3D9 backend.
+ UNREACHABLE();
+ return false;
+}
+
D3DPOOL Renderer9::getBufferPool(DWORD usage) const
{
if (mD3d9Ex != NULL)
@@ -2635,15 +2910,33 @@ bool Renderer9::copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sou
return mBlit->copy(framebuffer, rect, destFormat, xoffset, yoffset, storage, target, level);
}
+bool Renderer9::copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
+ GLint xoffset, GLint yoffset, GLint zOffset, TextureStorageInterface3D *storage, GLint level)
+{
+ // 3D textures are not available in the D3D9 backend.
+ UNREACHABLE();
+ return false;
+}
+
+bool Renderer9::copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
+ GLint xoffset, GLint yoffset, GLint zOffset, TextureStorageInterface2DArray *storage, GLint level)
+{
+ // 2D array textures are not available in the D3D9 backend.
+ UNREACHABLE();
+ return false;
+}
+
bool Renderer9::blitRect(gl::Framebuffer *readFramebuffer, const gl::Rectangle &readRect, gl::Framebuffer *drawFramebuffer, const gl::Rectangle &drawRect,
- bool blitRenderTarget, bool blitDepthStencil)
+ const gl::Rectangle *scissor, bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter)
{
+ ASSERT(filter == GL_NEAREST);
+
endScene();
if (blitRenderTarget)
{
- gl::Renderbuffer *readBuffer = readFramebuffer->getColorbuffer(0);
- gl::Renderbuffer *drawBuffer = drawFramebuffer->getColorbuffer(0);
+ gl::FramebufferAttachment *readBuffer = readFramebuffer->getColorbuffer(0);
+ gl::FramebufferAttachment *drawBuffer = drawFramebuffer->getColorbuffer(0);
RenderTarget9 *readRenderTarget = NULL;
RenderTarget9 *drawRenderTarget = NULL;
IDirect3DSurface9* readSurface = NULL;
@@ -2673,6 +2966,9 @@ bool Renderer9::blitRect(gl::Framebuffer *readFramebuffer, const gl::Rectangle &
return gl::error(GL_OUT_OF_MEMORY, false);
}
+ gl::Extents srcSize(readRenderTarget->getWidth(), readRenderTarget->getHeight(), 1);
+ gl::Extents dstSize(drawRenderTarget->getWidth(), drawRenderTarget->getHeight(), 1);
+
RECT srcRect;
srcRect.left = readRect.x;
srcRect.right = readRect.x + readRect.width;
@@ -2685,10 +2981,79 @@ bool Renderer9::blitRect(gl::Framebuffer *readFramebuffer, const gl::Rectangle &
dstRect.top = drawRect.y;
dstRect.bottom = drawRect.y + drawRect.height;
+ // Clip the rectangles to the scissor rectangle
+ if (scissor)
+ {
+ if (dstRect.left < scissor->x)
+ {
+ srcRect.left += (scissor->x - dstRect.left);
+ dstRect.left = scissor->x;
+ }
+ if (dstRect.top < scissor->y)
+ {
+ srcRect.top += (scissor->y - dstRect.top);
+ dstRect.top = scissor->y;
+ }
+ if (dstRect.right > scissor->x + scissor->width)
+ {
+ srcRect.right -= (dstRect.right - (scissor->x + scissor->width));
+ dstRect.right = scissor->x + scissor->width;
+ }
+ if (dstRect.bottom > scissor->y + scissor->height)
+ {
+ srcRect.bottom -= (dstRect.bottom - (scissor->y + scissor->height));
+ dstRect.bottom = scissor->y + scissor->height;
+ }
+ }
+
+ // Clip the rectangles to the destination size
+ if (dstRect.left < 0)
+ {
+ srcRect.left += -dstRect.left;
+ dstRect.left = 0;
+ }
+ if (dstRect.right > dstSize.width)
+ {
+ srcRect.right -= (dstRect.right - dstSize.width);
+ dstRect.right = dstSize.width;
+ }
+ if (dstRect.top < 0)
+ {
+ srcRect.top += -dstRect.top;
+ dstRect.top = 0;
+ }
+ if (dstRect.bottom > dstSize.height)
+ {
+ srcRect.bottom -= (dstRect.bottom - dstSize.height);
+ dstRect.bottom = dstSize.height;
+ }
+
+ // Clip the rectangles to the source size
+ if (srcRect.left < 0)
+ {
+ dstRect.left += -srcRect.left;
+ srcRect.left = 0;
+ }
+ if (srcRect.right > srcSize.width)
+ {
+ dstRect.right -= (srcRect.right - srcSize.width);
+ srcRect.right = srcSize.width;
+ }
+ if (srcRect.top < 0)
+ {
+ dstRect.top += -srcRect.top;
+ srcRect.top = 0;
+ }
+ if (srcRect.bottom > srcSize.height)
+ {
+ dstRect.bottom -= (srcRect.bottom - srcSize.height);
+ srcRect.bottom = srcSize.height;
+ }
+
HRESULT result = mDevice->StretchRect(readSurface, &srcRect, drawSurface, &dstRect, D3DTEXF_NONE);
- readSurface->Release();
- drawSurface->Release();
+ SafeRelease(readSurface);
+ SafeRelease(drawSurface);
if (FAILED(result))
{
@@ -2697,10 +3062,10 @@ bool Renderer9::blitRect(gl::Framebuffer *readFramebuffer, const gl::Rectangle &
}
}
- if (blitDepthStencil)
+ if (blitDepth || blitStencil)
{
- gl::Renderbuffer *readBuffer = readFramebuffer->getDepthOrStencilbuffer();
- gl::Renderbuffer *drawBuffer = drawFramebuffer->getDepthOrStencilbuffer();
+ gl::FramebufferAttachment *readBuffer = readFramebuffer->getDepthOrStencilbuffer();
+ gl::FramebufferAttachment *drawBuffer = drawFramebuffer->getDepthOrStencilbuffer();
RenderTarget9 *readDepthStencil = NULL;
RenderTarget9 *drawDepthStencil = NULL;
IDirect3DSurface9* readSurface = NULL;
@@ -2732,8 +3097,8 @@ bool Renderer9::blitRect(gl::Framebuffer *readFramebuffer, const gl::Rectangle &
HRESULT result = mDevice->StretchRect(readSurface, NULL, drawSurface, NULL, D3DTEXF_NONE);
- readSurface->Release();
- drawSurface->Release();
+ SafeRelease(readSurface);
+ SafeRelease(drawSurface);
if (FAILED(result))
{
@@ -2745,18 +3110,20 @@ bool Renderer9::blitRect(gl::Framebuffer *readFramebuffer, const gl::Rectangle &
return true;
}
-void Renderer9::readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
- GLsizei outputPitch, bool packReverseRowOrder, GLint packAlignment, void* pixels)
+void Renderer9::readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format,
+ GLenum type, GLuint outputPitch, const gl::PixelPackState &pack, void* pixels)
{
+ ASSERT(pack.pixelBuffer.get() == NULL);
+
RenderTarget9 *renderTarget = NULL;
IDirect3DSurface9 *surface = NULL;
- gl::Renderbuffer *colorbuffer = framebuffer->getColorbuffer(0);
+ gl::FramebufferAttachment *colorbuffer = framebuffer->getColorbuffer(0);
if (colorbuffer)
{
renderTarget = RenderTarget9::makeRenderTarget9(colorbuffer->getRenderTarget());
}
-
+
if (renderTarget)
{
surface = renderTarget->getSurface();
@@ -2774,13 +3141,13 @@ void Renderer9::readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsiz
if (desc.MultiSampleType != D3DMULTISAMPLE_NONE)
{
UNIMPLEMENTED(); // FIXME: Requires resolve using StretchRect into non-multisampled render target
- surface->Release();
+ SafeRelease(surface);
return gl::error(GL_OUT_OF_MEMORY);
}
HRESULT result;
IDirect3DSurface9 *systemSurface = NULL;
- bool directToPixels = !packReverseRowOrder && packAlignment <= 4 && getShareHandleSupport() &&
+ bool directToPixels = !pack.reverseRowOrder && pack.alignment <= 4 && getShareHandleSupport() &&
x == 0 && y == 0 && UINT(width) == desc.Width && UINT(height) == desc.Height &&
desc.Format == D3DFMT_A8R8G8B8 && format == GL_BGRA_EXT && type == GL_UNSIGNED_BYTE;
if (directToPixels)
@@ -2802,18 +3169,17 @@ void Renderer9::readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsiz
if (FAILED(result))
{
ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
- surface->Release();
+ SafeRelease(surface);
return gl::error(GL_OUT_OF_MEMORY);
}
}
result = mDevice->GetRenderTargetData(surface, systemSurface);
- surface->Release();
- surface = NULL;
+ SafeRelease(surface);
if (FAILED(result))
{
- systemSurface->Release();
+ SafeRelease(systemSurface);
// It turns out that D3D will sometimes produce more error
// codes than those documented.
@@ -2832,7 +3198,7 @@ void Renderer9::readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsiz
if (directToPixels)
{
- systemSurface->Release();
+ SafeRelease(systemSurface);
return;
}
@@ -2848,17 +3214,14 @@ void Renderer9::readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsiz
if (FAILED(result))
{
UNREACHABLE();
- systemSurface->Release();
+ SafeRelease(systemSurface);
return; // No sensible error to generate
}
- unsigned char *dest = (unsigned char*)pixels;
- unsigned short *dest16 = (unsigned short*)pixels;
-
unsigned char *source;
int inputPitch;
- if (packReverseRowOrder)
+ if (pack.reverseRowOrder)
{
source = ((unsigned char*)lock.pBits) + lock.Pitch * (rect.bottom - rect.top - 1);
inputPitch = -lock.Pitch;
@@ -2869,231 +3232,69 @@ void Renderer9::readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsiz
inputPitch = lock.Pitch;
}
- unsigned int fastPixelSize = 0;
+ GLuint clientVersion = getCurrentClientVersion();
- if (desc.Format == D3DFMT_A8R8G8B8 &&
- format == GL_BGRA_EXT &&
- type == GL_UNSIGNED_BYTE)
- {
- fastPixelSize = 4;
- }
- else if ((desc.Format == D3DFMT_A4R4G4B4 &&
- format == GL_BGRA_EXT &&
- type == GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT) ||
- (desc.Format == D3DFMT_A1R5G5B5 &&
- format == GL_BGRA_EXT &&
- type == GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT))
- {
- fastPixelSize = 2;
- }
- else if (desc.Format == D3DFMT_A16B16G16R16F &&
- format == GL_RGBA &&
- type == GL_HALF_FLOAT_OES)
- {
- fastPixelSize = 8;
- }
- else if (desc.Format == D3DFMT_A32B32G32R32F &&
- format == GL_RGBA &&
- type == GL_FLOAT)
- {
- fastPixelSize = 16;
- }
+ GLenum sourceInternalFormat = d3d9_gl::GetInternalFormat(desc.Format);
+ GLenum sourceFormat = gl::GetFormat(sourceInternalFormat, clientVersion);
+ GLenum sourceType = gl::GetType(sourceInternalFormat, clientVersion);
- for (int j = 0; j < rect.bottom - rect.top; j++)
+ GLuint sourcePixelSize = gl::GetPixelBytes(sourceInternalFormat, clientVersion);
+
+ if (sourceFormat == format && sourceType == type)
{
- if (fastPixelSize != 0)
- {
- // Fast path for formats which require no translation:
- // D3DFMT_A8R8G8B8 to BGRA/UNSIGNED_BYTE
- // D3DFMT_A4R4G4B4 to BGRA/UNSIGNED_SHORT_4_4_4_4_REV_EXT
- // D3DFMT_A1R5G5B5 to BGRA/UNSIGNED_SHORT_1_5_5_5_REV_EXT
- // D3DFMT_A16B16G16R16F to RGBA/HALF_FLOAT_OES
- // D3DFMT_A32B32G32R32F to RGBA/FLOAT
- //
- // Note that buffers with no alpha go through the slow path below.
- memcpy(dest + j * outputPitch,
- source + j * inputPitch,
- (rect.right - rect.left) * fastPixelSize);
- continue;
- }
- else if (desc.Format == D3DFMT_A8R8G8B8 &&
- format == GL_RGBA &&
- type == GL_UNSIGNED_BYTE)
+ // Direct copy possible
+ unsigned char *dest = static_cast<unsigned char*>(pixels);
+ for (int y = 0; y < rect.bottom - rect.top; y++)
{
- // Fast path for swapping red with blue
- for (int i = 0; i < rect.right - rect.left; i++)
- {
- unsigned int argb = *(unsigned int*)(source + 4 * i + j * inputPitch);
- *(unsigned int*)(dest + 4 * i + j * outputPitch) =
- (argb & 0xFF00FF00) | // Keep alpha and green
- (argb & 0x00FF0000) >> 16 | // Move red to blue
- (argb & 0x000000FF) << 16; // Move blue to red
- }
- continue;
+ memcpy(dest + y * outputPitch, source + y * inputPitch, (rect.right - rect.left) * sourcePixelSize);
}
+ }
+ else
+ {
+ GLenum destInternalFormat = gl::GetSizedInternalFormat(format, type, clientVersion);
+ GLuint destPixelSize = gl::GetPixelBytes(destInternalFormat, clientVersion);
+ GLuint sourcePixelSize = gl::GetPixelBytes(sourceInternalFormat, clientVersion);
- for (int i = 0; i < rect.right - rect.left; i++)
+ ColorCopyFunction fastCopyFunc = d3d9::GetFastCopyFunction(desc.Format, format, type, getCurrentClientVersion());
+ if (fastCopyFunc)
{
- float r;
- float g;
- float b;
- float a;
-
- switch (desc.Format)
+ // Fast copy is possible through some special function
+ for (int y = 0; y < rect.bottom - rect.top; y++)
{
- case D3DFMT_R5G6B5:
+ for (int x = 0; x < rect.right - rect.left; x++)
{
- unsigned short rgb = *(unsigned short*)(source + 2 * i + j * inputPitch);
+ void *dest = static_cast<unsigned char*>(pixels) + y * outputPitch + x * destPixelSize;
+ void *src = static_cast<unsigned char*>(source) + y * inputPitch + x * sourcePixelSize;
- a = 1.0f;
- b = (rgb & 0x001F) * (1.0f / 0x001F);
- g = (rgb & 0x07E0) * (1.0f / 0x07E0);
- r = (rgb & 0xF800) * (1.0f / 0xF800);
+ fastCopyFunc(src, dest);
}
- break;
- case D3DFMT_A1R5G5B5:
- {
- unsigned short argb = *(unsigned short*)(source + 2 * i + j * inputPitch);
-
- a = (argb & 0x8000) ? 1.0f : 0.0f;
- b = (argb & 0x001F) * (1.0f / 0x001F);
- g = (argb & 0x03E0) * (1.0f / 0x03E0);
- r = (argb & 0x7C00) * (1.0f / 0x7C00);
- }
- break;
- case D3DFMT_A8R8G8B8:
- {
- unsigned int argb = *(unsigned int*)(source + 4 * i + j * inputPitch);
+ }
+ }
+ else
+ {
+ ColorReadFunction readFunc = d3d9::GetColorReadFunction(desc.Format);
+ ColorWriteFunction writeFunc = gl::GetColorWriteFunction(format, type, clientVersion);
- a = (argb & 0xFF000000) * (1.0f / 0xFF000000);
- b = (argb & 0x000000FF) * (1.0f / 0x000000FF);
- g = (argb & 0x0000FF00) * (1.0f / 0x0000FF00);
- r = (argb & 0x00FF0000) * (1.0f / 0x00FF0000);
- }
- break;
- case D3DFMT_X8R8G8B8:
- {
- unsigned int xrgb = *(unsigned int*)(source + 4 * i + j * inputPitch);
+ gl::ColorF temp;
- a = 1.0f;
- b = (xrgb & 0x000000FF) * (1.0f / 0x000000FF);
- g = (xrgb & 0x0000FF00) * (1.0f / 0x0000FF00);
- r = (xrgb & 0x00FF0000) * (1.0f / 0x00FF0000);
- }
- break;
- case D3DFMT_A2R10G10B10:
+ for (int y = 0; y < rect.bottom - rect.top; y++)
+ {
+ for (int x = 0; x < rect.right - rect.left; x++)
{
- unsigned int argb = *(unsigned int*)(source + 4 * i + j * inputPitch);
+ void *dest = reinterpret_cast<unsigned char*>(pixels) + y * outputPitch + x * destPixelSize;
+ void *src = source + y * inputPitch + x * sourcePixelSize;
- a = (argb & 0xC0000000) * (1.0f / 0xC0000000);
- b = (argb & 0x000003FF) * (1.0f / 0x000003FF);
- g = (argb & 0x000FFC00) * (1.0f / 0x000FFC00);
- r = (argb & 0x3FF00000) * (1.0f / 0x3FF00000);
- }
- break;
- case D3DFMT_A32B32G32R32F:
- {
- // float formats in D3D are stored rgba, rather than the other way round
- r = *((float*)(source + 16 * i + j * inputPitch) + 0);
- g = *((float*)(source + 16 * i + j * inputPitch) + 1);
- b = *((float*)(source + 16 * i + j * inputPitch) + 2);
- a = *((float*)(source + 16 * i + j * inputPitch) + 3);
+ // readFunc and writeFunc will be using the same type of color, CopyTexImage
+ // will not allow the copy otherwise.
+ readFunc(src, &temp);
+ writeFunc(&temp, dest);
}
- break;
- case D3DFMT_A16B16G16R16F:
- {
- // float formats in D3D are stored rgba, rather than the other way round
- r = gl::float16ToFloat32(*((unsigned short*)(source + 8 * i + j * inputPitch) + 0));
- g = gl::float16ToFloat32(*((unsigned short*)(source + 8 * i + j * inputPitch) + 1));
- b = gl::float16ToFloat32(*((unsigned short*)(source + 8 * i + j * inputPitch) + 2));
- a = gl::float16ToFloat32(*((unsigned short*)(source + 8 * i + j * inputPitch) + 3));
- }
- break;
- default:
- UNIMPLEMENTED(); // FIXME
- UNREACHABLE();
- return;
- }
-
- switch (format)
- {
- case GL_RGBA:
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- dest[4 * i + j * outputPitch + 0] = (unsigned char)(255 * r + 0.5f);
- dest[4 * i + j * outputPitch + 1] = (unsigned char)(255 * g + 0.5f);
- dest[4 * i + j * outputPitch + 2] = (unsigned char)(255 * b + 0.5f);
- dest[4 * i + j * outputPitch + 3] = (unsigned char)(255 * a + 0.5f);
- break;
- default: UNREACHABLE();
- }
- break;
- case GL_BGRA_EXT:
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- dest[4 * i + j * outputPitch + 0] = (unsigned char)(255 * b + 0.5f);
- dest[4 * i + j * outputPitch + 1] = (unsigned char)(255 * g + 0.5f);
- dest[4 * i + j * outputPitch + 2] = (unsigned char)(255 * r + 0.5f);
- dest[4 * i + j * outputPitch + 3] = (unsigned char)(255 * a + 0.5f);
- break;
- case GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT:
- // According to the desktop GL spec in the "Transfer of Pixel Rectangles" section
- // this type is packed as follows:
- // 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
- // --------------------------------------------------------------------------------
- // | 4th | 3rd | 2nd | 1st component |
- // --------------------------------------------------------------------------------
- // in the case of BGRA_EXT, B is the first component, G the second, and so forth.
- dest16[i + j * outputPitch / sizeof(unsigned short)] =
- ((unsigned short)(15 * a + 0.5f) << 12)|
- ((unsigned short)(15 * r + 0.5f) << 8) |
- ((unsigned short)(15 * g + 0.5f) << 4) |
- ((unsigned short)(15 * b + 0.5f) << 0);
- break;
- case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT:
- // According to the desktop GL spec in the "Transfer of Pixel Rectangles" section
- // this type is packed as follows:
- // 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
- // --------------------------------------------------------------------------------
- // | 4th | 3rd | 2nd | 1st component |
- // --------------------------------------------------------------------------------
- // in the case of BGRA_EXT, B is the first component, G the second, and so forth.
- dest16[i + j * outputPitch / sizeof(unsigned short)] =
- ((unsigned short)( a + 0.5f) << 15) |
- ((unsigned short)(31 * r + 0.5f) << 10) |
- ((unsigned short)(31 * g + 0.5f) << 5) |
- ((unsigned short)(31 * b + 0.5f) << 0);
- break;
- default: UNREACHABLE();
- }
- break;
- case GL_RGB:
- switch (type)
- {
- case GL_UNSIGNED_SHORT_5_6_5:
- dest16[i + j * outputPitch / sizeof(unsigned short)] =
- ((unsigned short)(31 * b + 0.5f) << 0) |
- ((unsigned short)(63 * g + 0.5f) << 5) |
- ((unsigned short)(31 * r + 0.5f) << 11);
- break;
- case GL_UNSIGNED_BYTE:
- dest[3 * i + j * outputPitch + 0] = (unsigned char)(255 * r + 0.5f);
- dest[3 * i + j * outputPitch + 1] = (unsigned char)(255 * g + 0.5f);
- dest[3 * i + j * outputPitch + 2] = (unsigned char)(255 * b + 0.5f);
- break;
- default: UNREACHABLE();
- }
- break;
- default: UNREACHABLE();
}
}
}
systemSurface->UnlockRect();
-
- systemSurface->Release();
+ SafeRelease(systemSurface);
}
RenderTarget *Renderer9::createRenderTarget(SwapChain *swapChain, bool depth)
@@ -3114,14 +3315,19 @@ RenderTarget *Renderer9::createRenderTarget(SwapChain *swapChain, bool depth)
return renderTarget;
}
-RenderTarget *Renderer9::createRenderTarget(int width, int height, GLenum format, GLsizei samples, bool depth)
+RenderTarget *Renderer9::createRenderTarget(int width, int height, GLenum format, GLsizei samples)
{
RenderTarget9 *renderTarget = new RenderTarget9(this, width, height, format, samples);
return renderTarget;
}
-ShaderExecutable *Renderer9::loadExecutable(const void *function, size_t length, rx::ShaderType type)
+ShaderExecutable *Renderer9::loadExecutable(const void *function, size_t length, rx::ShaderType type,
+ const std::vector<gl::LinkedVarying> &transformFeedbackVaryings,
+ bool separatedOutputBuffers)
{
+ // Transform feedback is not supported in ES2 or D3D9
+ ASSERT(transformFeedbackVaryings.size() == 0);
+
ShaderExecutable9 *executable = NULL;
switch (type)
@@ -3152,8 +3358,13 @@ ShaderExecutable *Renderer9::loadExecutable(const void *function, size_t length,
return executable;
}
-ShaderExecutable *Renderer9::compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type, D3DWorkaroundType workaround)
+ShaderExecutable *Renderer9::compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type,
+ const std::vector<gl::LinkedVarying> &transformFeedbackVaryings,
+ bool separatedOutputBuffers, D3DWorkaroundType workaround)
{
+ // Transform feedback is not supported in ES2 or D3D9
+ ASSERT(transformFeedbackVaryings.size() == 0);
+
const char *profile = NULL;
switch (type)
@@ -3169,20 +3380,67 @@ ShaderExecutable *Renderer9::compileToExecutable(gl::InfoLog &infoLog, const cha
return NULL;
}
- // ANGLE issue 486:
- // Work-around a D3D9 compiler bug that presents itself when using conditional discard, by disabling optimization
- UINT optimizationFlags = (workaround == ANGLE_D3D_WORKAROUND_SM3_OPTIMIZER ? D3DCOMPILE_SKIP_OPTIMIZATION : ANGLE_COMPILE_OPTIMIZATION_LEVEL);
+ UINT flags = ANGLE_COMPILE_OPTIMIZATION_LEVEL;
+
+ if (workaround == ANGLE_D3D_WORKAROUND_SKIP_OPTIMIZATION)
+ {
+ flags = D3DCOMPILE_SKIP_OPTIMIZATION;
+ }
+ else if (workaround == ANGLE_D3D_WORKAROUND_MAX_OPTIMIZATION)
+ {
+ flags = D3DCOMPILE_OPTIMIZATION_LEVEL3;
+ }
+ else ASSERT(workaround == ANGLE_D3D_WORKAROUND_NONE);
+
+ if (gl::perfActive())
+ {
+#ifndef NDEBUG
+ flags = D3DCOMPILE_SKIP_OPTIMIZATION;
+#endif
+
+ flags |= D3DCOMPILE_DEBUG;
+
+ std::string sourcePath = getTempPath();
+ std::string sourceText = std::string("#line 2 \"") + sourcePath + std::string("\"\n\n") + std::string(shaderHLSL);
+ writeFile(sourcePath.c_str(), sourceText.c_str(), sourceText.size());
+ }
+
+ // Sometimes D3DCompile will fail with the default compilation flags for complicated shaders when it would otherwise pass with alternative options.
+ // Try the default flags first and if compilation fails, try some alternatives.
+ const UINT extraFlags[] =
+ {
+ flags,
+ flags | D3DCOMPILE_AVOID_FLOW_CONTROL,
+ flags | D3DCOMPILE_PREFER_FLOW_CONTROL
+ };
+
+ const static char *extraFlagNames[] =
+ {
+ "default",
+ "avoid flow control",
+ "prefer flow control"
+ };
+
+ int attempts = ArraySize(extraFlags);
- ID3DBlob *binary = (ID3DBlob*)compileToBinary(infoLog, shaderHLSL, profile, optimizationFlags, true);
+ ID3DBlob *binary = (ID3DBlob*)mCompiler.compileToBinary(infoLog, shaderHLSL, profile, extraFlags, extraFlagNames, attempts);
if (!binary)
+ {
return NULL;
+ }
- ShaderExecutable *executable = loadExecutable(binary->GetBufferPointer(), binary->GetBufferSize(), type);
- binary->Release();
+ ShaderExecutable *executable = loadExecutable(binary->GetBufferPointer(), binary->GetBufferSize(), type,
+ transformFeedbackVaryings, separatedOutputBuffers);
+ SafeRelease(binary);
return executable;
}
+rx::UniformStorage *Renderer9::createUniformStorage(size_t storageSize)
+{
+ return new UniformStorage(storageSize);
+}
+
bool Renderer9::boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest)
{
return mBlit->boxFilter(source, dest);
@@ -3223,7 +3481,7 @@ bool Renderer9::copyToRenderTarget(IDirect3DSurface9 *dest, IDirect3DSurface9 *s
{
Image9::copyLockableSurfaces(surf, source);
result = mDevice->UpdateSurface(surf, NULL, dest, NULL);
- surf->Release();
+ SafeRelease(surf);
}
}
else
@@ -3260,14 +3518,30 @@ TextureStorage *Renderer9::createTextureStorage2D(SwapChain *swapChain)
return new TextureStorage9_2D(this, swapChain9);
}
-TextureStorage *Renderer9::createTextureStorage2D(int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height)
+TextureStorage *Renderer9::createTextureStorage2D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels)
+{
+ return new TextureStorage9_2D(this, internalformat, renderTarget, width, height, levels);
+}
+
+TextureStorage *Renderer9::createTextureStorageCube(GLenum internalformat, bool renderTarget, int size, int levels)
+{
+ return new TextureStorage9_Cube(this, internalformat, renderTarget, size, levels);
+}
+
+TextureStorage *Renderer9::createTextureStorage3D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, GLsizei depth, int levels)
{
- return new TextureStorage9_2D(this, levels, internalformat, usage, forceRenderable, width, height);
+ // 3D textures are not supported by the D3D9 backend.
+ UNREACHABLE();
+
+ return NULL;
}
-TextureStorage *Renderer9::createTextureStorageCube(int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size)
+TextureStorage *Renderer9::createTextureStorage2DArray(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, GLsizei depth, int levels)
{
- return new TextureStorage9_Cube(this, levels, internalformat, usage, forceRenderable, size);
+ // 2D array textures are not supported by the D3D9 backend.
+ UNREACHABLE();
+
+ return NULL;
}
bool Renderer9::getLUID(LUID *adapterLuid) const
@@ -3284,4 +3558,20 @@ bool Renderer9::getLUID(LUID *adapterLuid) const
return false;
}
+GLenum Renderer9::getNativeTextureFormat(GLenum internalFormat) const
+{
+ return d3d9_gl::GetInternalFormat(gl_d3d9::GetTextureFormat(internalFormat, this));
+}
+
+rx::VertexConversionType Renderer9::getVertexConversionType(const gl::VertexFormat &vertexFormat) const
+{
+ return d3d9::GetVertexConversionType(vertexFormat);
+}
+
+GLenum Renderer9::getVertexComponentType(const gl::VertexFormat &vertexFormat) const
+{
+ D3DDECLTYPE declType = d3d9::GetNativeVertexFormat(vertexFormat);
+ return d3d9::GetDeclTypeComponentType(declType);
+}
+
}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/Renderer9.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/Renderer9.h
index 1fac9b7fac6..d3ea314f1a6 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/Renderer9.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/Renderer9.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2012-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -10,15 +10,16 @@
#define LIBGLESV2_RENDERER_RENDERER9_H_
#include "common/angleutils.h"
-#include "libGLESv2/mathutil.h"
-#include "libGLESv2/renderer/ShaderCache.h"
-#include "libGLESv2/renderer/VertexDeclarationCache.h"
+#include "common/mathutil.h"
+#include "libGLESv2/renderer/d3d/HLSLCompiler.h"
+#include "libGLESv2/renderer/d3d9/ShaderCache.h"
+#include "libGLESv2/renderer/d3d9/VertexDeclarationCache.h"
#include "libGLESv2/renderer/Renderer.h"
#include "libGLESv2/renderer/RenderTarget.h"
namespace gl
{
-class Renderbuffer;
+class FramebufferAttachment;
}
namespace rx
@@ -27,11 +28,12 @@ class VertexDataManager;
class IndexDataManager;
class StreamingIndexBufferInterface;
struct TranslatedAttribute;
+class Blit9;
class Renderer9 : public Renderer
{
public:
- Renderer9(egl::Display *display, HDC hDc, bool softwareDevice);
+ Renderer9(egl::Display *display, HDC hDc);
virtual ~Renderer9();
static Renderer9 *makeRenderer9(Renderer *renderer);
@@ -57,22 +59,14 @@ class Renderer9 : public Renderer
IDirect3DPixelShader9 *createPixelShader(const DWORD *function, size_t length);
HRESULT createVertexBuffer(UINT Length, DWORD Usage, IDirect3DVertexBuffer9 **ppVertexBuffer);
HRESULT createIndexBuffer(UINT Length, DWORD Usage, D3DFORMAT Format, IDirect3DIndexBuffer9 **ppIndexBuffer);
-#if 0
- void *createTexture2D();
- void *createTextureCube();
- void *createQuery();
- void *createIndexBuffer();
- void *createVertexbuffer();
-
- // state setup
- void applyShaders();
- void applyConstants();
-#endif
+ virtual void generateSwizzle(gl::Texture *texture);
virtual void setSamplerState(gl::SamplerType type, int index, const gl::SamplerState &sampler);
virtual void setTexture(gl::SamplerType type, int index, gl::Texture *texture);
+ virtual bool setUniformBuffers(const gl::Buffer *vertexUniformBuffers[], const gl::Buffer *fragmentUniformBuffers[]);
+
virtual void setRasterizerState(const gl::RasterizerState &rasterState);
- virtual void setBlendState(const gl::BlendState &blendState, const gl::Color &blendColor,
+ virtual void setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState, const gl::ColorF &blendColor,
unsigned int sampleMask);
virtual void setDepthStencilState(const gl::DepthStencilState &depthStencilState, int stencilRef,
int stencilBackRef, bool frontFaceCCW);
@@ -82,14 +76,18 @@ class Renderer9 : public Renderer
bool ignoreViewport);
virtual bool applyRenderTarget(gl::Framebuffer *frameBuffer);
- virtual void applyShaders(gl::ProgramBinary *programBinary);
- virtual void applyUniforms(gl::ProgramBinary *programBinary, gl::UniformArray *uniformArray);
+ virtual void applyShaders(gl::ProgramBinary *programBinary, bool rasterizerDiscard, bool transformFeedbackActive, const gl::VertexFormat inputLayout[]);
+ virtual void applyUniforms(const gl::ProgramBinary &programBinary);
virtual bool applyPrimitiveType(GLenum primitiveType, GLsizei elementCount);
- virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances);
+ virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, const gl::VertexAttribute vertexAttributes[], gl::VertexAttribCurrentValueData currentValues[],
+ GLint first, GLsizei count, GLsizei instances);
virtual GLenum applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo);
- virtual void drawArrays(GLenum mode, GLsizei count, GLsizei instances);
- virtual void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo, GLsizei instances);
+ virtual void applyTransformFeedbackBuffers(gl::Buffer *transformFeedbackBuffers[], GLintptr offsets[]);
+
+ virtual void drawArrays(GLenum mode, GLsizei count, GLsizei instances, bool transformFeedbackActive);
+ virtual void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices,
+ gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo, GLsizei instances);
virtual void clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer);
@@ -108,14 +106,20 @@ class Renderer9 : public Renderer
virtual GUID getAdapterIdentifier() const;
virtual bool getBGRATextureSupport() const;
- virtual bool getDXT1TextureSupport();
- virtual bool getDXT3TextureSupport();
- virtual bool getDXT5TextureSupport();
- virtual bool getEventQuerySupport();
- virtual bool getFloat32TextureSupport(bool *filtering, bool *renderable);
- virtual bool getFloat16TextureSupport(bool *filtering, bool *renderable);
- virtual bool getLuminanceTextureSupport();
- virtual bool getLuminanceAlphaTextureSupport();
+ virtual bool getDXT1TextureSupport() const;
+ virtual bool getDXT3TextureSupport() const;
+ virtual bool getDXT5TextureSupport() const;
+ virtual bool getEventQuerySupport() const;
+ virtual bool getFloat32TextureSupport() const;
+ virtual bool getFloat32TextureFilteringSupport() const;
+ virtual bool getFloat32TextureRenderingSupport() const;
+ virtual bool getFloat16TextureSupport() const;
+ virtual bool getFloat16TextureFilteringSupport() const;
+ virtual bool getFloat16TextureRenderingSupport() const;
+ virtual bool getRGB565TextureSupport() const;
+ virtual bool getLuminanceTextureSupport() const;
+ virtual bool getLuminanceAlphaTextureSupport() const;
+ virtual bool getRGTextureSupport() const;
virtual unsigned int getMaxVertexTextureImageUnits() const;
virtual unsigned int getMaxCombinedTextureImageUnits() const;
virtual unsigned int getReservedVertexUniformVectors() const;
@@ -123,61 +127,90 @@ class Renderer9 : public Renderer
virtual unsigned int getMaxVertexUniformVectors() const;
virtual unsigned int getMaxFragmentUniformVectors() const;
virtual unsigned int getMaxVaryingVectors() const;
+ virtual unsigned int getMaxVertexShaderUniformBuffers() const;
+ virtual unsigned int getMaxFragmentShaderUniformBuffers() const;
+ virtual unsigned int getReservedVertexUniformBuffers() const;
+ virtual unsigned int getReservedFragmentUniformBuffers() const;
+ virtual unsigned int getMaxTransformFeedbackBuffers() const;
+ virtual unsigned int getMaxTransformFeedbackSeparateComponents() const;
+ virtual unsigned int getMaxTransformFeedbackInterleavedComponents() const;
+ virtual unsigned int getMaxUniformBufferSize() const;
virtual bool getNonPower2TextureSupport() const;
virtual bool getDepthTextureSupport() const;
virtual bool getOcclusionQuerySupport() const;
virtual bool getInstancingSupport() const;
virtual bool getTextureFilterAnisotropySupport() const;
+ virtual bool getPBOSupport() const;
virtual float getTextureMaxAnisotropy() const;
virtual bool getShareHandleSupport() const;
virtual bool getDerivativeInstructionSupport() const;
virtual bool getPostSubBufferSupport() const;
+ virtual int getMaxRecommendedElementsIndices() const;
+ virtual int getMaxRecommendedElementsVertices() const;
virtual int getMajorShaderModel() const;
virtual float getMaxPointSize() const;
virtual int getMaxViewportDimension() const;
virtual int getMaxTextureWidth() const;
virtual int getMaxTextureHeight() const;
+ virtual int getMaxTextureDepth() const;
+ virtual int getMaxTextureArrayLayers() const;
virtual bool get32BitIndexSupport() const;
DWORD getCapsDeclTypes() const;
virtual int getMinSwapInterval() const;
virtual int getMaxSwapInterval() const;
virtual GLsizei getMaxSupportedSamples() const;
+ virtual GLsizei getMaxSupportedFormatSamples(GLenum internalFormat) const;
+ virtual GLsizei getNumSampleCounts(GLenum internalFormat) const;
+ virtual void getSampleCounts(GLenum internalFormat, GLsizei bufSize, GLint *params) const;
int getNearestSupportedSamples(D3DFORMAT format, int requested) const;
virtual unsigned int getMaxRenderTargets() const;
- D3DFORMAT ConvertTextureInternalFormat(GLint internalformat);
+ D3DFORMAT ConvertTextureInternalFormat(GLenum internalformat);
// Pixel operations
virtual bool copyToRenderTarget(TextureStorageInterface2D *dest, TextureStorageInterface2D *source);
virtual bool copyToRenderTarget(TextureStorageInterfaceCube *dest, TextureStorageInterfaceCube *source);
+ virtual bool copyToRenderTarget(TextureStorageInterface3D *dest, TextureStorageInterface3D *source);
+ virtual bool copyToRenderTarget(TextureStorageInterface2DArray *dest, TextureStorageInterface2DArray *source);
virtual bool copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, TextureStorageInterface2D *storage, GLint level);
virtual bool copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, TextureStorageInterfaceCube *storage, GLenum target, GLint level);
+ virtual bool copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
+ GLint xoffset, GLint yoffset, GLint zOffset, TextureStorageInterface3D *storage, GLint level);
+ virtual bool copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
+ GLint xoffset, GLint yoffset, GLint zOffset, TextureStorageInterface2DArray *storage, GLint level);
virtual bool blitRect(gl::Framebuffer *readTarget, const gl::Rectangle &readRect, gl::Framebuffer *drawTarget, const gl::Rectangle &drawRect,
- bool blitRenderTarget, bool blitDepthStencil);
- virtual void readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
- GLsizei outputPitch, bool packReverseRowOrder, GLint packAlignment, void* pixels);
+ const gl::Rectangle *scissor, bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter);
+ virtual void readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format,
+ GLenum type, GLuint outputPitch, const gl::PixelPackState &pack, void* pixels);
// RenderTarget creation
virtual RenderTarget *createRenderTarget(SwapChain *swapChain, bool depth);
- virtual RenderTarget *createRenderTarget(int width, int height, GLenum format, GLsizei samples, bool depth);
+ virtual RenderTarget *createRenderTarget(int width, int height, GLenum format, GLsizei samples);
// Shader operations
- virtual ShaderExecutable *loadExecutable(const void *function, size_t length, rx::ShaderType type);
- virtual ShaderExecutable *compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type, D3DWorkaroundType workaround);
+ virtual ShaderExecutable *loadExecutable(const void *function, size_t length, rx::ShaderType type,
+ const std::vector<gl::LinkedVarying> &transformFeedbackVaryings,
+ bool separatedOutputBuffers);
+ virtual ShaderExecutable *compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type,
+ const std::vector<gl::LinkedVarying> &transformFeedbackVaryings,
+ bool separatedOutputBuffers, D3DWorkaroundType workaround);
+ virtual UniformStorage *createUniformStorage(size_t storageSize);
// Image operations
virtual Image *createImage();
virtual void generateMipmap(Image *dest, Image *source);
virtual TextureStorage *createTextureStorage2D(SwapChain *swapChain);
- virtual TextureStorage *createTextureStorage2D(int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height);
- virtual TextureStorage *createTextureStorageCube(int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size);
+ virtual TextureStorage *createTextureStorage2D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels);
+ virtual TextureStorage *createTextureStorageCube(GLenum internalformat, bool renderTarget, int size, int levels);
+ virtual TextureStorage *createTextureStorage3D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, GLsizei depth, int levels);
+ virtual TextureStorage *createTextureStorage2DArray(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, GLsizei depth, int levels);
// Buffer creation
virtual VertexBuffer *createVertexBuffer();
@@ -188,28 +221,35 @@ class Renderer9 : public Renderer
virtual QueryImpl *createQuery(GLenum type);
virtual FenceImpl *createFence();
+ // Buffer-to-texture and Texture-to-buffer copies
+ virtual bool supportsFastCopyBufferToTexture(GLenum internalFormat) const;
+ virtual bool fastCopyBufferToTexture(const gl::PixelUnpackState &unpack, unsigned int offset, RenderTarget *destRenderTarget,
+ GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &destArea);
+
// D3D9-renderer specific methods
bool boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest);
D3DPOOL getTexturePool(DWORD usage) const;
virtual bool getLUID(LUID *adapterLuid) const;
+ virtual GLenum getNativeTextureFormat(GLenum internalFormat) const;
+ virtual rx::VertexConversionType getVertexConversionType(const gl::VertexFormat &vertexFormat) const;
+ virtual GLenum getVertexComponentType(const gl::VertexFormat &vertexFormat) const;
private:
DISALLOW_COPY_AND_ASSIGN(Renderer9);
void deinitialize();
- void applyUniformnfv(gl::Uniform *targetUniform, const GLfloat *v);
- void applyUniformniv(gl::Uniform *targetUniform, const GLint *v);
- void applyUniformnbv(gl::Uniform *targetUniform, const GLint *v);
+ void applyUniformnfv(gl::LinkedUniform *targetUniform, const GLfloat *v);
+ void applyUniformniv(gl::LinkedUniform *targetUniform, const GLint *v);
+ void applyUniformnbv(gl::LinkedUniform *targetUniform, const GLint *v);
void drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer);
- void drawIndexedPoints(GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer);
+ void drawIndexedPoints(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer);
- void getMultiSampleSupport(D3DFORMAT format, bool *multiSampleArray);
bool copyToRenderTarget(IDirect3DSurface9 *dest, IDirect3DSurface9 *source, bool fromManaged);
- gl::Renderbuffer *getNullColorbuffer(gl::Renderbuffer *depthbuffer);
+ gl::FramebufferAttachment *getNullColorbuffer(gl::FramebufferAttachment *depthbuffer);
D3DPOOL getBufferPool(DWORD usage) const;
@@ -226,13 +266,14 @@ class Renderer9 : public Renderer
UINT mAdapter;
D3DDEVTYPE mDeviceType;
- bool mSoftwareDevice; // FIXME: Deprecate
IDirect3D9 *mD3d9; // Always valid after successful initialization.
IDirect3D9Ex *mD3d9Ex; // Might be null if D3D9Ex is not supported.
IDirect3DDevice9 *mDevice;
IDirect3DDevice9Ex *mDeviceEx; // Might be null if D3D9Ex is not supported.
- Blit *mBlit;
+ HLSLCompiler mCompiler;
+
+ Blit9 *mBlit;
HWND mDeviceWindow;
@@ -256,6 +297,8 @@ class Renderer9 : public Renderer
bool mDepthTextureSupport;
+ bool mRGB565TextureSupport;
+
bool mFloat32TextureSupport;
bool mFloat32FilterSupport;
bool mFloat32RenderSupport;
@@ -271,8 +314,18 @@ class Renderer9 : public Renderer
bool mLuminanceTextureSupport;
bool mLuminanceAlphaTextureSupport;
- std::map<D3DFORMAT, bool *> mMultiSampleSupport;
- GLsizei mMaxSupportedSamples;
+ bool mRGTextureSupport;
+
+ struct MultisampleSupportInfo
+ {
+ bool supportedSamples[D3DMULTISAMPLE_16_SAMPLES + 1];
+ unsigned int maxSupportedSamples;
+ };
+ typedef std::map<D3DFORMAT, MultisampleSupportInfo> MultisampleSupportMap;
+ MultisampleSupportMap mMultiSampleSupport;
+ unsigned int mMaxSupportedSamples;
+
+ MultisampleSupportInfo getMultiSampleSupport(D3DFORMAT format);
// current render target states
unsigned int mAppliedRenderTargetSerial;
@@ -308,7 +361,7 @@ class Renderer9 : public Renderer
bool mForceSetBlendState;
gl::BlendState mCurBlendState;
- gl::Color mCurBlendColor;
+ gl::ColorF mCurBlendColor;
GLuint mCurSampleMask;
// Currently applied sampler states
@@ -323,8 +376,10 @@ class Renderer9 : public Renderer
unsigned int mCurPixelTextureSerials[gl::MAX_TEXTURE_IMAGE_UNITS];
unsigned int mAppliedIBSerial;
- unsigned int mAppliedProgramBinarySerial;
-
+ IDirect3DVertexShader9 *mAppliedVertexShader;
+ IDirect3DPixelShader9 *mAppliedPixelShader;
+ unsigned int mAppliedProgramSerial;
+
rx::dx_VertexConstants mVertexConstants;
rx::dx_PixelConstants mPixelConstants;
bool mDxUniformsDirty;
@@ -346,7 +401,7 @@ class Renderer9 : public Renderer
UINT lruCount;
int width;
int height;
- gl::Renderbuffer *buffer;
+ gl::FramebufferAttachment *buffer;
} mNullColorbufferCache[NUM_NULL_COLORBUFFER_CACHE_ENTRIES];
UINT mMaxNullColorbufferLRU;
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/ShaderCache.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/ShaderCache.h
index 4391ac271a3..a03528c9b55 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/ShaderCache.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/ShaderCache.h
@@ -53,7 +53,7 @@ class ShaderCache
// Random eviction policy.
if (mMap.size() >= kMaxMapSize)
{
- mMap.begin()->second->Release();
+ SafeRelease(mMap.begin()->second);
mMap.erase(mMap.begin());
}
@@ -67,7 +67,7 @@ class ShaderCache
{
for (typename Map::iterator it = mMap.begin(); it != mMap.end(); ++it)
{
- it->second->Release();
+ SafeRelease(it->second);
}
mMap.clear();
@@ -88,15 +88,7 @@ class ShaderCache
return mDevice->CreatePixelShader(function, shader);
}
-#ifndef HASH_MAP
-# ifdef _MSC_VER
-# define HASH_MAP stdext::hash_map
-# else
-# define HASH_MAP std::unordered_map
-# endif
-#endif
-
- typedef HASH_MAP<std::string, ShaderObject*> Map;
+ typedef std::unordered_map<std::string, ShaderObject*> Map;
Map mMap;
IDirect3DDevice9 *mDevice;
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/ShaderExecutable9.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/ShaderExecutable9.cpp
index 98868a3fbf3..115ed0823c7 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/ShaderExecutable9.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/ShaderExecutable9.cpp
@@ -8,7 +8,7 @@
// ShaderExecutable9.cpp: Implements a D3D9-specific class to contain shader
// executable implementation details.
-#include "libGLESv2/renderer/ShaderExecutable9.h"
+#include "libGLESv2/renderer/d3d9/ShaderExecutable9.h"
#include "common/debug.h"
@@ -31,14 +31,8 @@ ShaderExecutable9::ShaderExecutable9(const void *function, size_t length, IDirec
ShaderExecutable9::~ShaderExecutable9()
{
- if (mVertexExecutable)
- {
- mVertexExecutable->Release();
- }
- if (mPixelExecutable)
- {
- mPixelExecutable->Release();
- }
+ SafeRelease(mVertexExecutable);
+ SafeRelease(mPixelExecutable);
}
ShaderExecutable9 *ShaderExecutable9::makeShaderExecutable9(ShaderExecutable *executable)
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/ShaderExecutable9.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/ShaderExecutable9.h
index fa1e6c2844a..fa1e6c2844a 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/ShaderExecutable9.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/ShaderExecutable9.h
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/SwapChain9.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/SwapChain9.cpp
index 7b9b32b412f..bfb34594c52 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/SwapChain9.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/SwapChain9.cpp
@@ -7,9 +7,10 @@
// SwapChain9.cpp: Implements a back-end specific class for the D3D9 swap chain.
-#include "libGLESv2/renderer/SwapChain9.h"
-#include "libGLESv2/renderer/renderer9_utils.h"
-#include "libGLESv2/renderer/Renderer9.h"
+#include "libGLESv2/renderer/d3d9/SwapChain9.h"
+#include "libGLESv2/renderer/d3d9/renderer9_utils.h"
+#include "libGLESv2/renderer/d3d9/formatutils9.h"
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
namespace rx
{
@@ -35,38 +36,16 @@ SwapChain9::~SwapChain9()
void SwapChain9::release()
{
- if (mSwapChain)
- {
- mSwapChain->Release();
- mSwapChain = NULL;
- }
-
- if (mBackBuffer)
- {
- mBackBuffer->Release();
- mBackBuffer = NULL;
- }
-
- if (mDepthStencil)
- {
- mDepthStencil->Release();
- mDepthStencil = NULL;
- }
-
- if (mRenderTarget)
- {
- mRenderTarget->Release();
- mRenderTarget = NULL;
- }
-
- if (mOffscreenTexture)
- {
- mOffscreenTexture->Release();
- mOffscreenTexture = NULL;
- }
+ SafeRelease(mSwapChain);
+ SafeRelease(mBackBuffer);
+ SafeRelease(mDepthStencil);
+ SafeRelease(mRenderTarget);
+ SafeRelease(mOffscreenTexture);
if (mWindow)
+ {
mShareHandle = NULL;
+ }
}
static DWORD convertInterval(EGLint interval)
@@ -111,29 +90,10 @@ EGLint SwapChain9::reset(int backbufferWidth, int backbufferHeight, EGLint swapI
// Release specific resources to free up memory for the new render target, while the
// old render target still exists for the purpose of preserving its contents.
- if (mSwapChain)
- {
- mSwapChain->Release();
- mSwapChain = NULL;
- }
-
- if (mBackBuffer)
- {
- mBackBuffer->Release();
- mBackBuffer = NULL;
- }
-
- if (mOffscreenTexture)
- {
- mOffscreenTexture->Release();
- mOffscreenTexture = NULL;
- }
-
- if (mDepthStencil)
- {
- mDepthStencil->Release();
- mDepthStencil = NULL;
- }
+ SafeRelease(mSwapChain);
+ SafeRelease(mBackBuffer);
+ SafeRelease(mOffscreenTexture);
+ SafeRelease(mDepthStencil);
HANDLE *pShareHandle = NULL;
if (!mWindow && mRenderer->getShareHandleSupport())
@@ -142,8 +102,8 @@ EGLint SwapChain9::reset(int backbufferWidth, int backbufferHeight, EGLint swapI
}
result = device->CreateTexture(backbufferWidth, backbufferHeight, 1, D3DUSAGE_RENDERTARGET,
- gl_d3d9::ConvertRenderbufferFormat(mBackBufferFormat), D3DPOOL_DEFAULT,
- &mOffscreenTexture, pShareHandle);
+ gl_d3d9::GetTextureFormat(mBackBufferFormat, mRenderer),
+ D3DPOOL_DEFAULT, &mOffscreenTexture, pShareHandle);
if (FAILED(result))
{
ERR("Could not create offscreen texture: %08lX", result);
@@ -187,15 +147,15 @@ EGLint SwapChain9::reset(int backbufferWidth, int backbufferHeight, EGLint swapI
result = device->StretchRect(oldRenderTarget, &rect, mRenderTarget, &rect, D3DTEXF_NONE);
ASSERT(SUCCEEDED(result));
- oldRenderTarget->Release();
+ SafeRelease(oldRenderTarget);
}
if (mWindow)
{
D3DPRESENT_PARAMETERS presentParameters = {0};
- presentParameters.AutoDepthStencilFormat = gl_d3d9::ConvertRenderbufferFormat(mDepthBufferFormat);
+ presentParameters.AutoDepthStencilFormat = gl_d3d9::GetRenderFormat(mDepthBufferFormat, mRenderer);
presentParameters.BackBufferCount = 1;
- presentParameters.BackBufferFormat = gl_d3d9::ConvertRenderbufferFormat(mBackBufferFormat);
+ presentParameters.BackBufferFormat = gl_d3d9::GetRenderFormat(mBackBufferFormat, mRenderer);
presentParameters.EnableAutoDepthStencil = FALSE;
presentParameters.Flags = 0;
presentParameters.hDeviceWindow = mWindow;
@@ -247,7 +207,7 @@ EGLint SwapChain9::reset(int backbufferWidth, int backbufferHeight, EGLint swapI
if (mDepthBufferFormat != GL_NONE)
{
result = device->CreateDepthStencilSurface(backbufferWidth, backbufferHeight,
- gl_d3d9::ConvertRenderbufferFormat(mDepthBufferFormat),
+ gl_d3d9::GetRenderFormat(mDepthBufferFormat, mRenderer),
D3DMULTISAMPLE_NONE, 0, FALSE, &mDepthStencil, NULL);
if (FAILED(result))
@@ -351,23 +311,34 @@ EGLint SwapChain9::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
mRenderer->markAllStateDirty();
- if (d3d9::isDeviceLostError(result))
+ if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_DRIVERINTERNALERROR)
{
- return EGL_CONTEXT_LOST;
+ return EGL_BAD_ALLOC;
}
- if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_DRIVERINTERNALERROR)
+ // On Windows 8 systems, IDirect3DSwapChain9::Present sometimes returns 0x88760873 when the windows is
+ // in the process of entering/exiting fullscreen. This code doesn't seem to have any documentation. The
+ // device appears to be ok after emitting this error so simply return a failure to swap.
+ if (result == 0x88760873)
{
- return EGL_BAD_ALLOC;
+ return EGL_BAD_MATCH;
}
- ASSERT(SUCCEEDED(result));
+ // http://crbug.com/313210
+ // If our swap failed, trigger a device lost event. Resetting will work around an AMD-specific
+ // device removed bug with lost contexts when reinstalling drivers.
+ if (FAILED(result))
+ {
+ mRenderer->notifyDeviceLost();
+ return EGL_CONTEXT_LOST;
+ }
return EGL_SUCCESS;
}
// Increments refcount on surface.
// caller must Release() the returned surface
+// TODO: remove the AddRef to match SwapChain11
IDirect3DSurface9 *SwapChain9::getRenderTarget()
{
if (mRenderTarget)
@@ -380,6 +351,7 @@ IDirect3DSurface9 *SwapChain9::getRenderTarget()
// Increments refcount on surface.
// caller must Release() the returned surface
+// TODO: remove the AddRef to match SwapChain11
IDirect3DSurface9 *SwapChain9::getDepthStencil()
{
if (mDepthStencil)
@@ -392,6 +364,7 @@ IDirect3DSurface9 *SwapChain9::getDepthStencil()
// Increments refcount on texture.
// caller must Release() the returned texture
+// TODO: remove the AddRef to match SwapChain11
IDirect3DTexture9 *SwapChain9::getOffscreenTexture()
{
if (mOffscreenTexture)
@@ -432,10 +405,10 @@ void SwapChain9::recreate()
return;
}
- mSwapChain->Release();
+ SafeRelease(mSwapChain);
mSwapChain = newSwapChain;
- mBackBuffer->Release();
+ SafeRelease(mBackBuffer);
result = mSwapChain->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &mBackBuffer);
ASSERT(SUCCEEDED(result));
}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/SwapChain9.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/SwapChain9.h
index 16a62bd86f6..16a62bd86f6 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/SwapChain9.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/SwapChain9.h
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/TextureStorage9.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/TextureStorage9.cpp
index 8aa74a7cba1..a8efca7fb4b 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/TextureStorage9.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/TextureStorage9.cpp
@@ -1,6 +1,6 @@
#include "precompiled.h"
//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -10,17 +10,18 @@
// D3D9 texture.
#include "libGLESv2/main.h"
-#include "libGLESv2/renderer/Renderer9.h"
-#include "libGLESv2/renderer/TextureStorage9.h"
-#include "libGLESv2/renderer/SwapChain9.h"
-#include "libGLESv2/renderer/RenderTarget9.h"
-#include "libGLESv2/renderer/renderer9_utils.h"
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
+#include "libGLESv2/renderer/d3d9/TextureStorage9.h"
+#include "libGLESv2/renderer/d3d9/SwapChain9.h"
+#include "libGLESv2/renderer/d3d9/RenderTarget9.h"
+#include "libGLESv2/renderer/d3d9/renderer9_utils.h"
+#include "libGLESv2/renderer/d3d9/formatutils9.h"
#include "libGLESv2/Texture.h"
namespace rx
{
TextureStorage9::TextureStorage9(Renderer *renderer, DWORD usage)
- : mLodOffset(0),
+ : mTopLevel(0),
mRenderer(Renderer9::makeRenderer9(renderer)),
mD3DUsage(usage),
mD3DPool(mRenderer->getTexturePool(usage))
@@ -37,46 +38,25 @@ TextureStorage9 *TextureStorage9::makeTextureStorage9(TextureStorage *storage)
return static_cast<TextureStorage9*>(storage);
}
-DWORD TextureStorage9::GetTextureUsage(D3DFORMAT d3dfmt, GLenum glusage, bool forceRenderable)
+DWORD TextureStorage9::GetTextureUsage(GLenum internalformat, Renderer9 *renderer, bool renderTarget)
{
+ GLuint clientVersion = renderer->getCurrentClientVersion();
+
DWORD d3dusage = 0;
- if (d3dfmt == D3DFMT_INTZ)
+ if (gl::GetDepthBits(internalformat, clientVersion) > 0 ||
+ gl::GetStencilBits(internalformat, clientVersion) > 0)
{
d3dusage |= D3DUSAGE_DEPTHSTENCIL;
}
- else if(forceRenderable || (TextureStorage9::IsTextureFormatRenderable(d3dfmt) && (glusage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE)))
+ else if (renderTarget && (gl_d3d9::GetRenderFormat(internalformat, renderer) != D3DFMT_UNKNOWN))
{
d3dusage |= D3DUSAGE_RENDERTARGET;
}
+
return d3dusage;
}
-bool TextureStorage9::IsTextureFormatRenderable(D3DFORMAT format)
-{
- if (format == D3DFMT_INTZ)
- {
- return true;
- }
- switch(format)
- {
- case D3DFMT_L8:
- case D3DFMT_A8L8:
- case D3DFMT_DXT1:
- case D3DFMT_DXT3:
- case D3DFMT_DXT5:
- return false;
- case D3DFMT_A8R8G8B8:
- case D3DFMT_X8R8G8B8:
- case D3DFMT_A16B16G16R16F:
- case D3DFMT_A32B32G32R32F:
- return true;
- default:
- UNREACHABLE();
- }
-
- return false;
-}
bool TextureStorage9::isRenderTarget() const
{
@@ -98,17 +78,18 @@ DWORD TextureStorage9::getUsage() const
return mD3DUsage;
}
-int TextureStorage9::getLodOffset() const
+int TextureStorage9::getTopLevel() const
{
- return mLodOffset;
+ return mTopLevel;
}
-int TextureStorage9::levelCount()
+int TextureStorage9::getLevelCount() const
{
- return getBaseTexture() ? getBaseTexture()->GetLevelCount() - getLodOffset() : 0;
+ return getBaseTexture() ? (getBaseTexture()->GetLevelCount() - getTopLevel()) : 0;
}
-TextureStorage9_2D::TextureStorage9_2D(Renderer *renderer, SwapChain9 *swapchain) : TextureStorage9(renderer, D3DUSAGE_RENDERTARGET)
+TextureStorage9_2D::TextureStorage9_2D(Renderer *renderer, SwapChain9 *swapchain)
+ : TextureStorage9(renderer, D3DUSAGE_RENDERTARGET)
{
IDirect3DTexture9 *surfaceTexture = swapchain->getOffscreenTexture();
mTexture = surfaceTexture;
@@ -117,8 +98,8 @@ TextureStorage9_2D::TextureStorage9_2D(Renderer *renderer, SwapChain9 *swapchain
initializeRenderTarget();
}
-TextureStorage9_2D::TextureStorage9_2D(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height)
- : TextureStorage9(renderer, GetTextureUsage(Renderer9::makeRenderer9(renderer)->ConvertTextureInternalFormat(internalformat), usage, forceRenderable))
+TextureStorage9_2D::TextureStorage9_2D(Renderer *renderer, GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels)
+ : TextureStorage9(renderer, GetTextureUsage(internalformat, Renderer9::makeRenderer9(renderer), renderTarget))
{
mTexture = NULL;
mRenderTarget = NULL;
@@ -127,9 +108,11 @@ TextureStorage9_2D::TextureStorage9_2D(Renderer *renderer, int levels, GLenum in
if (width > 0 && height > 0)
{
IDirect3DDevice9 *device = mRenderer->getDevice();
- gl::MakeValidSize(false, gl::IsCompressed(internalformat), &width, &height, &mLodOffset);
- HRESULT result = device->CreateTexture(width, height, levels ? levels + mLodOffset : 0, getUsage(),
- mRenderer->ConvertTextureInternalFormat(internalformat), getPool(), &mTexture, NULL);
+ D3DFORMAT format = gl_d3d9::GetTextureFormat(internalformat, mRenderer);
+ d3d9::MakeValidSize(false, format, &width, &height, &mTopLevel);
+ UINT creationLevels = (levels == 0) ? 0 : mTopLevel + levels;
+
+ HRESULT result = device->CreateTexture(width, height, creationLevels, getUsage(), format, getPool(), &mTexture, NULL);
if (FAILED(result))
{
@@ -143,12 +126,8 @@ TextureStorage9_2D::TextureStorage9_2D(Renderer *renderer, int levels, GLenum in
TextureStorage9_2D::~TextureStorage9_2D()
{
- if (mTexture)
- {
- mTexture->Release();
- }
-
- delete mRenderTarget;
+ SafeRelease(mTexture);
+ SafeDelete(mRenderTarget);
}
TextureStorage9_2D *TextureStorage9_2D::makeTextureStorage9_2D(TextureStorage *storage)
@@ -165,11 +144,12 @@ IDirect3DSurface9 *TextureStorage9_2D::getSurfaceLevel(int level, bool dirty)
if (mTexture)
{
- HRESULT result = mTexture->GetSurfaceLevel(level + mLodOffset, &surface);
+ HRESULT result = mTexture->GetSurfaceLevel(level + mTopLevel, &surface);
+ UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
// With managed textures the driver needs to be informed of updates to the lower mipmap levels
- if (level + mLodOffset != 0 && isManaged() && dirty)
+ if (level + mTopLevel != 0 && isManaged() && dirty)
{
mTexture->AddDirtyRect(NULL);
}
@@ -178,7 +158,7 @@ IDirect3DSurface9 *TextureStorage9_2D::getSurfaceLevel(int level, bool dirty)
return surface;
}
-RenderTarget *TextureStorage9_2D::getRenderTarget()
+RenderTarget *TextureStorage9_2D::getRenderTarget(int level)
{
return mRenderTarget;
}
@@ -193,8 +173,8 @@ void TextureStorage9_2D::generateMipmap(int level)
mRenderer->boxFilter(upper, lower);
}
- if (upper != NULL) upper->Release();
- if (lower != NULL) lower->Release();
+ SafeRelease(upper);
+ SafeRelease(lower);
}
IDirect3DBaseTexture9 *TextureStorage9_2D::getBaseTexture() const
@@ -214,8 +194,8 @@ void TextureStorage9_2D::initializeRenderTarget()
}
}
-TextureStorage9_Cube::TextureStorage9_Cube(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size)
- : TextureStorage9(renderer, GetTextureUsage(Renderer9::makeRenderer9(renderer)->ConvertTextureInternalFormat(internalformat), usage, forceRenderable))
+TextureStorage9_Cube::TextureStorage9_Cube(Renderer *renderer, GLenum internalformat, bool renderTarget, int size, int levels)
+ : TextureStorage9(renderer, GetTextureUsage(internalformat, Renderer9::makeRenderer9(renderer), renderTarget))
{
mTexture = NULL;
for (int i = 0; i < 6; ++i)
@@ -229,9 +209,11 @@ TextureStorage9_Cube::TextureStorage9_Cube(Renderer *renderer, int levels, GLenu
{
IDirect3DDevice9 *device = mRenderer->getDevice();
int height = size;
- gl::MakeValidSize(false, gl::IsCompressed(internalformat), &size, &height, &mLodOffset);
- HRESULT result = device->CreateCubeTexture(size, levels ? levels + mLodOffset : 0, getUsage(),
- mRenderer->ConvertTextureInternalFormat(internalformat), getPool(), &mTexture, NULL);
+ D3DFORMAT format = gl_d3d9::GetTextureFormat(internalformat, mRenderer);
+ d3d9::MakeValidSize(false, format, &size, &height, &mTopLevel);
+ UINT creationLevels = (levels == 0) ? 0 : mTopLevel + levels;
+
+ HRESULT result = device->CreateCubeTexture(size, creationLevels, getUsage(), format, getPool(), &mTexture, NULL);
if (FAILED(result))
{
@@ -245,14 +227,11 @@ TextureStorage9_Cube::TextureStorage9_Cube(Renderer *renderer, int levels, GLenu
TextureStorage9_Cube::~TextureStorage9_Cube()
{
- if (mTexture)
- {
- mTexture->Release();
- }
+ SafeRelease(mTexture);
for (int i = 0; i < 6; ++i)
{
- delete mRenderTarget[i];
+ SafeDelete(mRenderTarget[i]);
}
}
@@ -271,7 +250,8 @@ IDirect3DSurface9 *TextureStorage9_Cube::getCubeMapSurface(GLenum faceTarget, in
if (mTexture)
{
D3DCUBEMAP_FACES face = gl_d3d9::ConvertCubeFace(faceTarget);
- HRESULT result = mTexture->GetCubeMapSurface(face, level + mLodOffset, &surface);
+ HRESULT result = mTexture->GetCubeMapSurface(face, level + mTopLevel, &surface);
+ UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
// With managed textures the driver needs to be informed of updates to the lower mipmap levels
@@ -284,23 +264,23 @@ IDirect3DSurface9 *TextureStorage9_Cube::getCubeMapSurface(GLenum faceTarget, in
return surface;
}
-RenderTarget *TextureStorage9_Cube::getRenderTarget(GLenum faceTarget)
+RenderTarget *TextureStorage9_Cube::getRenderTargetFace(GLenum faceTarget, int level)
{
- return mRenderTarget[gl::TextureCubeMap::faceIndex(faceTarget)];
+ return mRenderTarget[gl::TextureCubeMap::targetToIndex(faceTarget)];
}
-void TextureStorage9_Cube::generateMipmap(int face, int level)
+void TextureStorage9_Cube::generateMipmap(int faceIndex, int level)
{
- IDirect3DSurface9 *upper = getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level - 1, false);
- IDirect3DSurface9 *lower = getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level, true);
+ IDirect3DSurface9 *upper = getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level - 1, false);
+ IDirect3DSurface9 *lower = getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level, true);
if (upper != NULL && lower != NULL)
{
mRenderer->boxFilter(upper, lower);
}
- if (upper != NULL) upper->Release();
- if (lower != NULL) lower->Release();
+ SafeRelease(upper);
+ SafeRelease(lower);
}
IDirect3DBaseTexture9 *TextureStorage9_Cube::getBaseTexture() const
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/TextureStorage9.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/TextureStorage9.h
index 86f551a1315..1f4975f48e5 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/TextureStorage9.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/TextureStorage9.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -20,37 +20,37 @@ class Renderer9;
class SwapChain9;
class RenderTarget;
class RenderTarget9;
-class Blit;
class TextureStorage9 : public TextureStorage
{
public:
- TextureStorage9(Renderer *renderer, DWORD usage);
virtual ~TextureStorage9();
static TextureStorage9 *makeTextureStorage9(TextureStorage *storage);
- static DWORD GetTextureUsage(D3DFORMAT d3dfmt, GLenum glusage, bool forceRenderable);
- static bool IsTextureFormatRenderable(D3DFORMAT format);
+ static DWORD GetTextureUsage(GLenum internalformat, Renderer9 *renderer, bool renderTarget);
D3DPOOL getPool() const;
DWORD getUsage() const;
virtual IDirect3DBaseTexture9 *getBaseTexture() const = 0;
- virtual RenderTarget *getRenderTarget() { return NULL; }
- virtual RenderTarget *getRenderTarget(GLenum faceTarget) { return NULL; }
+ virtual RenderTarget *getRenderTarget(int level) { return NULL; }
+ virtual RenderTarget *getRenderTargetFace(GLenum faceTarget, int level) { return NULL; }
+ virtual RenderTarget *getRenderTargetLayer(int mipLevel, int layer) { return NULL; }
virtual void generateMipmap(int level) {};
virtual void generateMipmap(int face, int level) {};
- virtual int getLodOffset() const;
+ virtual int getTopLevel() const;
virtual bool isRenderTarget() const;
virtual bool isManaged() const;
- virtual int levelCount();
+ virtual int getLevelCount() const;
protected:
- int mLodOffset;
+ int mTopLevel;
Renderer9 *mRenderer;
+ TextureStorage9(Renderer *renderer, DWORD usage);
+
private:
DISALLOW_COPY_AND_ASSIGN(TextureStorage9);
@@ -62,13 +62,13 @@ class TextureStorage9_2D : public TextureStorage9
{
public:
TextureStorage9_2D(Renderer *renderer, SwapChain9 *swapchain);
- TextureStorage9_2D(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height);
+ TextureStorage9_2D(Renderer *renderer, GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels);
virtual ~TextureStorage9_2D();
static TextureStorage9_2D *makeTextureStorage9_2D(TextureStorage *storage);
IDirect3DSurface9 *getSurfaceLevel(int level, bool dirty);
- virtual RenderTarget *getRenderTarget();
+ virtual RenderTarget *getRenderTarget(int level);
virtual IDirect3DBaseTexture9 *getBaseTexture() const;
virtual void generateMipmap(int level);
@@ -84,15 +84,15 @@ class TextureStorage9_2D : public TextureStorage9
class TextureStorage9_Cube : public TextureStorage9
{
public:
- TextureStorage9_Cube(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size);
+ TextureStorage9_Cube(Renderer *renderer, GLenum internalformat, bool renderTarget, int size, int levels);
virtual ~TextureStorage9_Cube();
static TextureStorage9_Cube *makeTextureStorage9_Cube(TextureStorage *storage);
IDirect3DSurface9 *getCubeMapSurface(GLenum faceTarget, int level, bool dirty);
- virtual RenderTarget *getRenderTarget(GLenum faceTarget);
+ virtual RenderTarget *getRenderTargetFace(GLenum faceTarget, int level);
virtual IDirect3DBaseTexture9 *getBaseTexture() const;
- virtual void generateMipmap(int face, int level);
+ virtual void generateMipmap(int faceIndex, int level);
private:
DISALLOW_COPY_AND_ASSIGN(TextureStorage9_Cube);
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/VertexBuffer9.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/VertexBuffer9.cpp
new file mode 100644
index 00000000000..42ddfcae1cb
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/VertexBuffer9.cpp
@@ -0,0 +1,252 @@
+#include "precompiled.h"
+//
+// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// VertexBuffer9.cpp: Defines the D3D9 VertexBuffer implementation.
+
+#include "libGLESv2/renderer/d3d9/VertexBuffer9.h"
+#include "libGLESv2/renderer/vertexconversion.h"
+#include "libGLESv2/renderer/BufferStorage.h"
+#include "libGLESv2/VertexAttribute.h"
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
+#include "libGLESv2/renderer/d3d9/formatutils9.h"
+
+#include "libGLESv2/Buffer.h"
+
+namespace rx
+{
+
+VertexBuffer9::VertexBuffer9(rx::Renderer9 *const renderer) : mRenderer(renderer)
+{
+ mVertexBuffer = NULL;
+ mBufferSize = 0;
+ mDynamicUsage = false;
+}
+
+VertexBuffer9::~VertexBuffer9()
+{
+ SafeRelease(mVertexBuffer);
+}
+
+bool VertexBuffer9::initialize(unsigned int size, bool dynamicUsage)
+{
+ SafeRelease(mVertexBuffer);
+
+ updateSerial();
+
+ if (size > 0)
+ {
+ DWORD flags = D3DUSAGE_WRITEONLY;
+ if (dynamicUsage)
+ {
+ flags |= D3DUSAGE_DYNAMIC;
+ }
+
+ HRESULT result = mRenderer->createVertexBuffer(size, flags, &mVertexBuffer);
+
+ if (FAILED(result))
+ {
+ ERR("Out of memory allocating a vertex buffer of size %lu.", size);
+ return false;
+ }
+ }
+
+ mBufferSize = size;
+ mDynamicUsage = dynamicUsage;
+ return true;
+}
+
+VertexBuffer9 *VertexBuffer9::makeVertexBuffer9(VertexBuffer *vertexBuffer)
+{
+ ASSERT(HAS_DYNAMIC_TYPE(VertexBuffer9*, vertexBuffer));
+ return static_cast<VertexBuffer9*>(vertexBuffer);
+}
+
+bool VertexBuffer9::storeVertexAttributes(const gl::VertexAttribute &attrib, const gl::VertexAttribCurrentValueData &currentValue,
+ GLint start, GLsizei count, GLsizei instances, unsigned int offset)
+{
+ if (mVertexBuffer)
+ {
+ gl::Buffer *buffer = attrib.mBoundBuffer.get();
+
+ int inputStride = attrib.stride();
+ int elementSize = attrib.typeSize();
+
+ DWORD lockFlags = mDynamicUsage ? D3DLOCK_NOOVERWRITE : 0;
+
+ void *mapPtr = NULL;
+
+ unsigned int mapSize;
+ if (!spaceRequired(attrib, count, instances, &mapSize))
+ {
+ return false;
+ }
+
+ HRESULT result = mVertexBuffer->Lock(offset, mapSize, &mapPtr, lockFlags);
+
+ if (FAILED(result))
+ {
+ ERR("Lock failed with error 0x%08x", result);
+ return false;
+ }
+
+ const char *input = NULL;
+ if (attrib.mArrayEnabled)
+ {
+ if (buffer)
+ {
+ BufferStorage *storage = buffer->getStorage();
+ input = static_cast<const char*>(storage->getData()) + static_cast<int>(attrib.mOffset);
+ }
+ else
+ {
+ input = static_cast<const char*>(attrib.mPointer);
+ }
+ }
+ else
+ {
+ input = reinterpret_cast<const char*>(currentValue.FloatValues);
+ }
+
+ if (instances == 0 || attrib.mDivisor == 0)
+ {
+ input += inputStride * start;
+ }
+
+ gl::VertexFormat vertexFormat(attrib, currentValue.Type);
+ bool needsConversion = (d3d9::GetVertexConversionType(vertexFormat) & VERTEX_CONVERT_CPU) > 0;
+
+ if (!needsConversion && inputStride == elementSize)
+ {
+ size_t copySize = static_cast<size_t>(count) * static_cast<size_t>(inputStride);
+ memcpy(mapPtr, input, copySize);
+ }
+ else
+ {
+ VertexCopyFunction copyFunction = d3d9::GetVertexCopyFunction(vertexFormat);
+ copyFunction(input, inputStride, count, mapPtr);
+ }
+
+ mVertexBuffer->Unlock();
+
+ return true;
+ }
+ else
+ {
+ ERR("Vertex buffer not initialized.");
+ return false;
+ }
+}
+
+bool VertexBuffer9::getSpaceRequired(const gl::VertexAttribute &attrib, GLsizei count, GLsizei instances,
+ unsigned int *outSpaceRequired) const
+{
+ return spaceRequired(attrib, count, instances, outSpaceRequired);
+}
+
+unsigned int VertexBuffer9::getBufferSize() const
+{
+ return mBufferSize;
+}
+
+bool VertexBuffer9::setBufferSize(unsigned int size)
+{
+ if (size > mBufferSize)
+ {
+ return initialize(size, mDynamicUsage);
+ }
+ else
+ {
+ return true;
+ }
+}
+
+bool VertexBuffer9::discard()
+{
+ if (mVertexBuffer)
+ {
+ void *dummy;
+ HRESULT result;
+
+ result = mVertexBuffer->Lock(0, 1, &dummy, D3DLOCK_DISCARD);
+ if (FAILED(result))
+ {
+ ERR("Discard lock failed with error 0x%08x", result);
+ return false;
+ }
+
+ result = mVertexBuffer->Unlock();
+ if (FAILED(result))
+ {
+ ERR("Discard unlock failed with error 0x%08x", result);
+ return false;
+ }
+
+ return true;
+ }
+ else
+ {
+ ERR("Vertex buffer not initialized.");
+ return false;
+ }
+}
+
+IDirect3DVertexBuffer9 * VertexBuffer9::getBuffer() const
+{
+ return mVertexBuffer;
+}
+
+bool VertexBuffer9::spaceRequired(const gl::VertexAttribute &attrib, std::size_t count, GLsizei instances,
+ unsigned int *outSpaceRequired)
+{
+ gl::VertexFormat vertexFormat(attrib, GL_FLOAT);
+ unsigned int elementSize = d3d9::GetVertexElementSize(vertexFormat);
+
+ if (attrib.mArrayEnabled)
+ {
+ unsigned int elementCount = 0;
+ if (instances == 0 || attrib.mDivisor == 0)
+ {
+ elementCount = count;
+ }
+ else
+ {
+ if (static_cast<unsigned int>(instances) < std::numeric_limits<unsigned int>::max() - (attrib.mDivisor - 1))
+ {
+ // Round up
+ elementCount = (static_cast<unsigned int>(instances) + (attrib.mDivisor - 1)) / attrib.mDivisor;
+ }
+ else
+ {
+ elementCount = static_cast<unsigned int>(instances) / attrib.mDivisor;
+ }
+ }
+
+ if (elementSize <= std::numeric_limits<unsigned int>::max() / elementCount)
+ {
+ if (outSpaceRequired)
+ {
+ *outSpaceRequired = elementSize * elementCount;
+ }
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ const unsigned int elementSize = 4;
+ if (outSpaceRequired)
+ {
+ *outSpaceRequired = elementSize * 4;
+ }
+ return true;
+ }
+}
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/VertexBuffer9.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/VertexBuffer9.h
new file mode 100644
index 00000000000..2fb5a36b37b
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/VertexBuffer9.h
@@ -0,0 +1,54 @@
+//
+// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// VertexBuffer9.h: Defines the D3D9 VertexBuffer implementation.
+
+#ifndef LIBGLESV2_RENDERER_VERTEXBUFFER9_H_
+#define LIBGLESV2_RENDERER_VERTEXBUFFER9_H_
+
+#include "libGLESv2/renderer/VertexBuffer.h"
+
+namespace rx
+{
+class Renderer9;
+
+class VertexBuffer9 : public VertexBuffer
+{
+ public:
+ explicit VertexBuffer9(rx::Renderer9 *const renderer);
+ virtual ~VertexBuffer9();
+
+ virtual bool initialize(unsigned int size, bool dynamicUsage);
+
+ static VertexBuffer9 *makeVertexBuffer9(VertexBuffer *vertexBuffer);
+
+ virtual bool storeVertexAttributes(const gl::VertexAttribute &attrib, const gl::VertexAttribCurrentValueData &currentValue,
+ GLint start, GLsizei count, GLsizei instances, unsigned int offset);
+
+ virtual bool getSpaceRequired(const gl::VertexAttribute &attrib, GLsizei count, GLsizei instances, unsigned int *outSpaceRequired) const;
+
+ virtual unsigned int getBufferSize() const;
+ virtual bool setBufferSize(unsigned int size);
+ virtual bool discard();
+
+ IDirect3DVertexBuffer9 *getBuffer() const;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(VertexBuffer9);
+
+ rx::Renderer9 *const mRenderer;
+
+ IDirect3DVertexBuffer9 *mVertexBuffer;
+ unsigned int mBufferSize;
+ bool mDynamicUsage;
+
+ static bool spaceRequired(const gl::VertexAttribute &attrib, std::size_t count, GLsizei instances,
+ unsigned int *outSpaceRequired);
+};
+
+}
+
+#endif // LIBGLESV2_RENDERER_VERTEXBUFFER9_H_
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/VertexDeclarationCache.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/VertexDeclarationCache.cpp
index 9b83a6476eb..30c023378a1 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/VertexDeclarationCache.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/VertexDeclarationCache.cpp
@@ -8,9 +8,10 @@
// VertexDeclarationCache.cpp: Implements a helper class to construct and cache vertex declarations.
#include "libGLESv2/ProgramBinary.h"
-#include "libGLESv2/Context.h"
-#include "libGLESv2/renderer/VertexBuffer9.h"
-#include "libGLESv2/renderer/VertexDeclarationCache.h"
+#include "libGLESv2/VertexAttribute.h"
+#include "libGLESv2/renderer/d3d9/VertexBuffer9.h"
+#include "libGLESv2/renderer/d3d9/VertexDeclarationCache.h"
+#include "libGLESv2/renderer/d3d9/formatutils9.h"
namespace rx
{
@@ -36,10 +37,7 @@ VertexDeclarationCache::~VertexDeclarationCache()
{
for (int i = 0; i < NUM_VERTEX_DECL_CACHE_ENTRIES; i++)
{
- if (mVertexDeclCache[i].vertexDeclaration)
- {
- mVertexDeclCache[i].vertexDeclaration->Release();
- }
+ SafeRelease(mVertexDeclCache[i].vertexDeclaration);
}
}
@@ -134,9 +132,11 @@ GLenum VertexDeclarationCache::applyDeclaration(IDirect3DDevice9 *device, Transl
mAppliedVBs[stream].offset = attributes[i].offset;
}
+ gl::VertexFormat vertexFormat(*attributes[i].attribute, GL_FLOAT);
+
element->Stream = stream;
element->Offset = 0;
- element->Type = attributes[i].attribute->mArrayEnabled ? vertexBuffer->getDeclType(*attributes[i].attribute) : D3DDECLTYPE_FLOAT4;
+ element->Type = d3d9::GetNativeVertexFormat(vertexFormat);
element->Method = D3DDECLMETHOD_DEFAULT;
element->Usage = D3DDECLUSAGE_TEXCOORD;
element->UsageIndex = programBinary->getSemanticIndex(i);
@@ -188,8 +188,7 @@ GLenum VertexDeclarationCache::applyDeclaration(IDirect3DDevice9 *device, Transl
if (lastCache->vertexDeclaration != NULL)
{
- lastCache->vertexDeclaration->Release();
- lastCache->vertexDeclaration = NULL;
+ SafeRelease(lastCache->vertexDeclaration);
// mLastSetVDecl is set to the replacement, so we don't have to worry
// about it.
}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/VertexDeclarationCache.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/VertexDeclarationCache.h
index 3fc024a9bab..3fc024a9bab 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/VertexDeclarationCache.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/VertexDeclarationCache.h
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/formatutils9.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/formatutils9.cpp
new file mode 100644
index 00000000000..141bcc7c958
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/formatutils9.cpp
@@ -0,0 +1,864 @@
+#include "precompiled.h"
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// formatutils9.cpp: Queries for GL image formats and their translations to D3D9
+// formats.
+
+#include "libGLESv2/renderer/d3d9/formatutils9.h"
+#include "libGLESv2/renderer/d3d9/Renderer9.h"
+#include "libGLESv2/renderer/generatemip.h"
+#include "libGLESv2/renderer/loadimage.h"
+#include "libGLESv2/renderer/copyimage.h"
+#include "libGLESv2/renderer/vertexconversion.h"
+
+namespace rx
+{
+
+// Each GL internal format corresponds to one D3D format and data loading function.
+// Due to not all formats being available all the time, some of the function/format types are wrapped
+// in templates that perform format support queries on a Renderer9 object which is supplied
+// when requesting the function or format.
+
+typedef bool ((Renderer9::*Renderer9FormatCheckFunction)(void) const);
+typedef LoadImageFunction (*RendererCheckLoadFunction)(const Renderer9 *renderer);
+
+template <Renderer9FormatCheckFunction pred, LoadImageFunction prefered, LoadImageFunction fallback>
+LoadImageFunction RendererCheckLoad(const Renderer9 *renderer)
+{
+ return ((renderer->*pred)()) ? prefered : fallback;
+}
+
+template <LoadImageFunction loadFunc>
+LoadImageFunction SimpleLoad(const Renderer9 *renderer)
+{
+ return loadFunc;
+}
+
+LoadImageFunction UnreachableLoad(const Renderer9 *renderer)
+{
+ UNREACHABLE();
+ return NULL;
+}
+
+typedef bool (*FallbackPredicateFunction)(void);
+
+template <FallbackPredicateFunction pred, LoadImageFunction prefered, LoadImageFunction fallback>
+LoadImageFunction FallbackLoadFunction(const Renderer9 *renderer)
+{
+ return pred() ? prefered : fallback;
+}
+
+typedef D3DFORMAT (*FormatQueryFunction)(const rx::Renderer9 *renderer);
+
+template <Renderer9FormatCheckFunction pred, D3DFORMAT prefered, D3DFORMAT fallback>
+D3DFORMAT CheckFormatSupport(const rx::Renderer9 *renderer)
+{
+ return (renderer->*pred)() ? prefered : fallback;
+}
+
+template <D3DFORMAT format>
+D3DFORMAT D3D9Format(const rx::Renderer9 *renderer)
+{
+ return format;
+}
+
+struct D3D9FormatInfo
+{
+ FormatQueryFunction mTexFormat;
+ FormatQueryFunction mRenderFormat;
+ RendererCheckLoadFunction mLoadFunction;
+
+ D3D9FormatInfo()
+ : mTexFormat(NULL), mRenderFormat(NULL), mLoadFunction(NULL)
+ { }
+
+ D3D9FormatInfo(FormatQueryFunction textureFormat, FormatQueryFunction renderFormat, RendererCheckLoadFunction loadFunc)
+ : mTexFormat(textureFormat), mRenderFormat(renderFormat), mLoadFunction(loadFunc)
+ { }
+};
+
+const D3DFORMAT D3DFMT_INTZ = ((D3DFORMAT)(MAKEFOURCC('I','N','T','Z')));
+const D3DFORMAT D3DFMT_NULL = ((D3DFORMAT)(MAKEFOURCC('N','U','L','L')));
+
+typedef std::pair<GLenum, D3D9FormatInfo> D3D9FormatPair;
+typedef std::map<GLenum, D3D9FormatInfo> D3D9FormatMap;
+
+static D3D9FormatMap BuildD3D9FormatMap()
+{
+ D3D9FormatMap map;
+
+ // | Internal format | Texture format | Render format | Load function |
+ map.insert(D3D9FormatPair(GL_NONE, D3D9FormatInfo(D3D9Format<D3DFMT_NULL>, D3D9Format<D3DFMT_NULL>, UnreachableLoad )));
+
+ map.insert(D3D9FormatPair(GL_DEPTH_COMPONENT16, D3D9FormatInfo(D3D9Format<D3DFMT_INTZ>, D3D9Format<D3DFMT_D24S8>, UnreachableLoad )));
+ map.insert(D3D9FormatPair(GL_DEPTH_COMPONENT32_OES, D3D9FormatInfo(D3D9Format<D3DFMT_INTZ>, D3D9Format<D3DFMT_D32>, UnreachableLoad )));
+ map.insert(D3D9FormatPair(GL_DEPTH24_STENCIL8_OES, D3D9FormatInfo(D3D9Format<D3DFMT_INTZ>, D3D9Format<D3DFMT_D24S8>, UnreachableLoad )));
+ map.insert(D3D9FormatPair(GL_STENCIL_INDEX8, D3D9FormatInfo(D3D9Format<D3DFMT_UNKNOWN>, D3D9Format<D3DFMT_D24S8>, UnreachableLoad ))); // TODO: What's the texture format?
+
+ map.insert(D3D9FormatPair(GL_RGBA32F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A32B32G32R32F>, D3D9Format<D3DFMT_A32B32G32R32F>, SimpleLoad<loadToNative<GLfloat, 4> > )));
+ map.insert(D3D9FormatPair(GL_RGB32F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A32B32G32R32F>, D3D9Format<D3DFMT_A32B32G32R32F>, SimpleLoad<loadToNative3To4<GLfloat, gl::Float32One> >)));
+ map.insert(D3D9FormatPair(GL_RG32F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_G32R32F>, D3D9Format<D3DFMT_G32R32F>, SimpleLoad<loadToNative<GLfloat, 2> > )));
+ map.insert(D3D9FormatPair(GL_R32F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_R32F>, D3D9Format<D3DFMT_R32F>, SimpleLoad<loadToNative<GLfloat, 1> > )));
+ map.insert(D3D9FormatPair(GL_ALPHA32F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A32B32G32R32F>, D3D9Format<D3DFMT_UNKNOWN>, SimpleLoad<loadAlphaFloatDataToRGBA> )));
+ map.insert(D3D9FormatPair(GL_LUMINANCE32F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A32B32G32R32F>, D3D9Format<D3DFMT_UNKNOWN>, SimpleLoad<loadLuminanceFloatDataToRGBA> )));
+ map.insert(D3D9FormatPair(GL_LUMINANCE_ALPHA32F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A32B32G32R32F>, D3D9Format<D3DFMT_UNKNOWN>, SimpleLoad<loadLuminanceAlphaFloatDataToRGBA> )));
+
+ map.insert(D3D9FormatPair(GL_RGBA16F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A16B16G16R16F>, D3D9Format<D3DFMT_A16B16G16R16F>, SimpleLoad<loadToNative<GLhalf, 4> > )));
+ map.insert(D3D9FormatPair(GL_RGB16F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A16B16G16R16F>, D3D9Format<D3DFMT_A16B16G16R16F>, SimpleLoad<loadToNative3To4<GLhalf, gl::Float16One> >)));
+ map.insert(D3D9FormatPair(GL_RG16F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_G16R16F>, D3D9Format<D3DFMT_G16R16F>, SimpleLoad<loadToNative<GLhalf, 2> > )));
+ map.insert(D3D9FormatPair(GL_R16F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_R16F>, D3D9Format<D3DFMT_R16F>, SimpleLoad<loadToNative<GLhalf, 1> > )));
+ map.insert(D3D9FormatPair(GL_ALPHA16F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A16B16G16R16F>, D3D9Format<D3DFMT_UNKNOWN>, SimpleLoad<loadAlphaHalfFloatDataToRGBA> )));
+ map.insert(D3D9FormatPair(GL_LUMINANCE16F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A16B16G16R16F>, D3D9Format<D3DFMT_UNKNOWN>, SimpleLoad<loadLuminanceHalfFloatDataToRGBA> )));
+ map.insert(D3D9FormatPair(GL_LUMINANCE_ALPHA16F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A16B16G16R16F>, D3D9Format<D3DFMT_UNKNOWN>, SimpleLoad<loadLuminanceAlphaHalfFloatDataToRGBA>)));
+
+ map.insert(D3D9FormatPair(GL_ALPHA8_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A8R8G8B8>, D3D9Format<D3DFMT_A8R8G8B8>, FallbackLoadFunction<gl::supportsSSE2, loadAlphaDataToBGRASSE2, loadAlphaDataToBGRA>)));
+
+ map.insert(D3D9FormatPair(GL_RGB8_OES, D3D9FormatInfo(D3D9Format<D3DFMT_X8R8G8B8>, D3D9Format<D3DFMT_X8R8G8B8>, SimpleLoad<loadRGBUByteDataToBGRX> )));
+ map.insert(D3D9FormatPair(GL_RGB565, D3D9FormatInfo(CheckFormatSupport<&Renderer9::getRGB565TextureSupport, D3DFMT_R5G6B5, D3DFMT_X8R8G8B8>, CheckFormatSupport<&Renderer9::getRGB565TextureSupport, D3DFMT_R5G6B5, D3DFMT_X8R8G8B8>, RendererCheckLoad<&Renderer9::getRGB565TextureSupport, loadToNative<GLushort, 1>, loadRGB565DataToBGRA>)));
+ map.insert(D3D9FormatPair(GL_RGBA8_OES, D3D9FormatInfo(D3D9Format<D3DFMT_A8R8G8B8>, D3D9Format<D3DFMT_A8R8G8B8>, FallbackLoadFunction<gl::supportsSSE2, loadRGBAUByteDataToBGRASSE2, loadRGBAUByteDataToBGRA>)));
+ map.insert(D3D9FormatPair(GL_RGBA4, D3D9FormatInfo(D3D9Format<D3DFMT_A8R8G8B8>, D3D9Format<D3DFMT_A8R8G8B8>, SimpleLoad<loadRGBA4444DataToBGRA> )));
+ map.insert(D3D9FormatPair(GL_RGB5_A1, D3D9FormatInfo(D3D9Format<D3DFMT_A8R8G8B8>, D3D9Format<D3DFMT_A8R8G8B8>, SimpleLoad<loadRGBA5551DataToBGRA> )));
+ map.insert(D3D9FormatPair(GL_R8_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_X8R8G8B8>, D3D9Format<D3DFMT_X8R8G8B8>, SimpleLoad<loadRUByteDataToBGRX> )));
+ map.insert(D3D9FormatPair(GL_RG8_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_X8R8G8B8>, D3D9Format<D3DFMT_X8R8G8B8>, SimpleLoad<loadRGUByteDataToBGRX> )));
+
+ map.insert(D3D9FormatPair(GL_BGRA8_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A8R8G8B8>, D3D9Format<D3DFMT_A8R8G8B8>, SimpleLoad<loadToNative<GLubyte, 4> > )));
+ map.insert(D3D9FormatPair(GL_BGRA4_ANGLEX, D3D9FormatInfo(D3D9Format<D3DFMT_A8R8G8B8>, D3D9Format<D3DFMT_A8R8G8B8>, SimpleLoad<loadRGBA4444DataToRGBA> )));
+ map.insert(D3D9FormatPair(GL_BGR5_A1_ANGLEX, D3D9FormatInfo(D3D9Format<D3DFMT_A8R8G8B8>, D3D9Format<D3DFMT_A8R8G8B8>, SimpleLoad<loadRGBA5551DataToRGBA> )));
+
+ map.insert(D3D9FormatPair(GL_COMPRESSED_RGB_S3TC_DXT1_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_DXT1>, D3D9Format<D3DFMT_UNKNOWN>, SimpleLoad<loadCompressedBlockDataToNative<4, 4, 8> >)));
+ map.insert(D3D9FormatPair(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_DXT1>, D3D9Format<D3DFMT_UNKNOWN>, SimpleLoad<loadCompressedBlockDataToNative<4, 4, 8> >)));
+ map.insert(D3D9FormatPair(GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, D3D9FormatInfo(D3D9Format<D3DFMT_DXT3>, D3D9Format<D3DFMT_UNKNOWN>, SimpleLoad<loadCompressedBlockDataToNative<4, 4, 16> >)));
+ map.insert(D3D9FormatPair(GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, D3D9FormatInfo(D3D9Format<D3DFMT_DXT5>, D3D9Format<D3DFMT_UNKNOWN>, SimpleLoad<loadCompressedBlockDataToNative<4, 4, 16> >)));
+
+ // These formats require checking if the renderer supports D3DFMT_L8 or D3DFMT_A8L8 and
+ // then changing the format and loading function appropriately.
+ map.insert(D3D9FormatPair(GL_LUMINANCE8_EXT, D3D9FormatInfo(CheckFormatSupport<&Renderer9::getLuminanceTextureSupport, D3DFMT_L8, D3DFMT_A8R8G8B8>, D3D9Format<D3DFMT_UNKNOWN>, RendererCheckLoad<&Renderer9::getLuminanceTextureSupport, loadToNative<GLubyte, 1>, loadLuminanceDataToBGRA>)));
+ map.insert(D3D9FormatPair(GL_LUMINANCE8_ALPHA8_EXT, D3D9FormatInfo(CheckFormatSupport<&Renderer9::getLuminanceAlphaTextureSupport, D3DFMT_A8L8, D3DFMT_A8R8G8B8>, D3D9Format<D3DFMT_UNKNOWN>, RendererCheckLoad<&Renderer9::getLuminanceTextureSupport, loadToNative<GLubyte, 2>, loadLuminanceAlphaDataToBGRA>)));
+
+ return map;
+}
+
+static bool GetD3D9FormatInfo(GLenum internalFormat, D3D9FormatInfo *outFormatInfo)
+{
+ static const D3D9FormatMap formatMap = BuildD3D9FormatMap();
+ D3D9FormatMap::const_iterator iter = formatMap.find(internalFormat);
+ if (iter != formatMap.end())
+ {
+ if (outFormatInfo)
+ {
+ *outFormatInfo = iter->second;
+ }
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+// A map to determine the pixel size and mip generation function of a given D3D format
+struct D3DFormatInfo
+{
+ GLuint mPixelBits;
+ GLuint mBlockWidth;
+ GLuint mBlockHeight;
+ GLenum mInternalFormat;
+
+ MipGenerationFunction mMipGenerationFunction;
+ ColorReadFunction mColorReadFunction;
+
+ D3DFormatInfo()
+ : mPixelBits(0), mBlockWidth(0), mBlockHeight(0), mInternalFormat(GL_NONE), mMipGenerationFunction(NULL),
+ mColorReadFunction(NULL)
+ { }
+
+ D3DFormatInfo(GLuint pixelBits, GLuint blockWidth, GLuint blockHeight, GLenum internalFormat,
+ MipGenerationFunction mipFunc, ColorReadFunction readFunc)
+ : mPixelBits(pixelBits), mBlockWidth(blockWidth), mBlockHeight(blockHeight), mInternalFormat(internalFormat),
+ mMipGenerationFunction(mipFunc), mColorReadFunction(readFunc)
+ { }
+};
+
+typedef std::pair<D3DFORMAT, D3DFormatInfo> D3D9FormatInfoPair;
+typedef std::map<D3DFORMAT, D3DFormatInfo> D3D9FormatInfoMap;
+
+static D3D9FormatInfoMap BuildD3D9FormatInfoMap()
+{
+ D3D9FormatInfoMap map;
+
+ // | D3DFORMAT | | S |W |H | Internal format | Mip generation function | Color read function |
+ map.insert(D3D9FormatInfoPair(D3DFMT_NULL, D3DFormatInfo( 0, 0, 0, GL_NONE, NULL, NULL )));
+ map.insert(D3D9FormatInfoPair(D3DFMT_UNKNOWN, D3DFormatInfo( 0, 0, 0, GL_NONE, NULL, NULL )));
+
+ map.insert(D3D9FormatInfoPair(D3DFMT_L8, D3DFormatInfo( 8, 1, 1, GL_LUMINANCE8_EXT, GenerateMip<L8>, ReadColor<L8, GLfloat> )));
+ map.insert(D3D9FormatInfoPair(D3DFMT_A8, D3DFormatInfo( 8, 1, 1, GL_ALPHA8_EXT, GenerateMip<A8>, ReadColor<A8, GLfloat> )));
+ map.insert(D3D9FormatInfoPair(D3DFMT_A8L8, D3DFormatInfo( 16, 1, 1, GL_LUMINANCE8_ALPHA8_EXT, GenerateMip<A8L8>, ReadColor<A8L8, GLfloat> )));
+ map.insert(D3D9FormatInfoPair(D3DFMT_A4R4G4B4, D3DFormatInfo( 16, 1, 1, GL_BGRA4_ANGLEX, GenerateMip<B4G4R4A4>, ReadColor<B4G4R4A4, GLfloat> )));
+ map.insert(D3D9FormatInfoPair(D3DFMT_A1R5G5B5, D3DFormatInfo( 16, 1, 1, GL_BGR5_A1_ANGLEX, GenerateMip<B5G5R5A1>, ReadColor<B5G5R5A1, GLfloat> )));
+ map.insert(D3D9FormatInfoPair(D3DFMT_R5G6B5, D3DFormatInfo( 16, 1, 1, GL_RGB565, GenerateMip<R5G6B5>, ReadColor<R5G6B5, GLfloat> )));
+ map.insert(D3D9FormatInfoPair(D3DFMT_X8R8G8B8, D3DFormatInfo( 32, 1, 1, GL_BGRA8_EXT, GenerateMip<B8G8R8X8>, ReadColor<B8G8R8X8, GLfloat> )));
+ map.insert(D3D9FormatInfoPair(D3DFMT_A8R8G8B8, D3DFormatInfo( 32, 1, 1, GL_BGRA8_EXT, GenerateMip<B8G8R8A8>, ReadColor<B8G8R8A8, GLfloat> )));
+ map.insert(D3D9FormatInfoPair(D3DFMT_R16F, D3DFormatInfo( 16, 1, 1, GL_R16F_EXT, GenerateMip<R16F>, ReadColor<R16F, GLfloat> )));
+ map.insert(D3D9FormatInfoPair(D3DFMT_G16R16F, D3DFormatInfo( 32, 1, 1, GL_RG16F_EXT, GenerateMip<R16G16F>, ReadColor<R16G16F, GLfloat> )));
+ map.insert(D3D9FormatInfoPair(D3DFMT_A16B16G16R16F, D3DFormatInfo( 64, 1, 1, GL_RGBA16F_EXT, GenerateMip<R16G16B16A16F>, ReadColor<R16G16B16A16F, GLfloat>)));
+ map.insert(D3D9FormatInfoPair(D3DFMT_R32F, D3DFormatInfo( 32, 1, 1, GL_R32F_EXT, GenerateMip<R32F>, ReadColor<R32F, GLfloat> )));
+ map.insert(D3D9FormatInfoPair(D3DFMT_G32R32F, D3DFormatInfo( 64, 1, 1, GL_RG32F_EXT, GenerateMip<R32G32F>, ReadColor<R32G32F, GLfloat> )));
+ map.insert(D3D9FormatInfoPair(D3DFMT_A32B32G32R32F, D3DFormatInfo(128, 1, 1, GL_RGBA32F_EXT, GenerateMip<R32G32B32A32F>, ReadColor<R32G32B32A32F, GLfloat>)));
+
+ map.insert(D3D9FormatInfoPair(D3DFMT_D16, D3DFormatInfo( 16, 1, 1, GL_DEPTH_COMPONENT16, NULL, NULL )));
+ map.insert(D3D9FormatInfoPair(D3DFMT_D24S8, D3DFormatInfo( 32, 1, 1, GL_DEPTH24_STENCIL8_OES, NULL, NULL )));
+ map.insert(D3D9FormatInfoPair(D3DFMT_D24X8, D3DFormatInfo( 32, 1, 1, GL_DEPTH_COMPONENT16, NULL, NULL )));
+ map.insert(D3D9FormatInfoPair(D3DFMT_D32, D3DFormatInfo( 32, 1, 1, GL_DEPTH_COMPONENT32_OES, NULL, NULL )));
+
+ map.insert(D3D9FormatInfoPair(D3DFMT_INTZ, D3DFormatInfo( 32, 1, 1, GL_DEPTH24_STENCIL8_OES, NULL, NULL )));
+
+ map.insert(D3D9FormatInfoPair(D3DFMT_DXT1, D3DFormatInfo( 64, 4, 4, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, NULL, NULL )));
+ map.insert(D3D9FormatInfoPair(D3DFMT_DXT3, D3DFormatInfo(128, 4, 4, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, NULL, NULL )));
+ map.insert(D3D9FormatInfoPair(D3DFMT_DXT5, D3DFormatInfo(128, 4, 4, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, NULL, NULL )));
+
+ return map;
+}
+
+static const D3D9FormatInfoMap &GetD3D9FormatInfoMap()
+{
+ static const D3D9FormatInfoMap infoMap = BuildD3D9FormatInfoMap();
+ return infoMap;
+}
+
+static bool GetD3D9FormatInfo(D3DFORMAT format, D3DFormatInfo *outFormatInfo)
+{
+ const D3D9FormatInfoMap &infoMap = GetD3D9FormatInfoMap();
+ D3D9FormatInfoMap::const_iterator iter = infoMap.find(format);
+ if (iter != infoMap.end())
+ {
+ if (outFormatInfo)
+ {
+ *outFormatInfo = iter->second;
+ }
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+static d3d9::D3DFormatSet BuildAllD3DFormatSet()
+{
+ d3d9::D3DFormatSet set;
+
+ const D3D9FormatInfoMap &infoMap = GetD3D9FormatInfoMap();
+ for (D3D9FormatInfoMap::const_iterator i = infoMap.begin(); i != infoMap.end(); ++i)
+ {
+ set.insert(i->first);
+ }
+
+ return set;
+}
+
+struct D3D9FastCopyFormat
+{
+ D3DFORMAT mSourceFormat;
+ GLenum mDestFormat;
+ GLenum mDestType;
+
+ D3D9FastCopyFormat(D3DFORMAT sourceFormat, GLenum destFormat, GLenum destType)
+ : mSourceFormat(sourceFormat), mDestFormat(destFormat), mDestType(destType)
+ { }
+
+ bool operator<(const D3D9FastCopyFormat& other) const
+ {
+ return memcmp(this, &other, sizeof(D3D9FastCopyFormat)) < 0;
+ }
+};
+
+typedef std::map<D3D9FastCopyFormat, ColorCopyFunction> D3D9FastCopyMap;
+typedef std::pair<D3D9FastCopyFormat, ColorCopyFunction> D3D9FastCopyPair;
+
+static D3D9FastCopyMap BuildFastCopyMap()
+{
+ D3D9FastCopyMap map;
+
+ map.insert(D3D9FastCopyPair(D3D9FastCopyFormat(D3DFMT_A8R8G8B8, GL_RGBA, GL_UNSIGNED_BYTE), CopyBGRAUByteToRGBAUByte));
+
+ return map;
+}
+
+typedef std::pair<GLint, InitializeTextureDataFunction> InternalFormatInitialzerPair;
+typedef std::map<GLint, InitializeTextureDataFunction> InternalFormatInitialzerMap;
+
+static InternalFormatInitialzerMap BuildInternalFormatInitialzerMap()
+{
+ InternalFormatInitialzerMap map;
+
+ map.insert(InternalFormatInitialzerPair(GL_RGB16F, initialize4ComponentData<GLhalf, 0x0000, 0x0000, 0x0000, gl::Float16One>));
+ map.insert(InternalFormatInitialzerPair(GL_RGB32F, initialize4ComponentData<GLfloat, 0x00000000, 0x00000000, 0x00000000, gl::Float32One>));
+
+ return map;
+}
+
+static const InternalFormatInitialzerMap &GetInternalFormatInitialzerMap()
+{
+ static const InternalFormatInitialzerMap map = BuildInternalFormatInitialzerMap();
+ return map;
+}
+
+namespace d3d9
+{
+
+MipGenerationFunction GetMipGenerationFunction(D3DFORMAT format)
+{
+ D3DFormatInfo d3dFormatInfo;
+ if (GetD3D9FormatInfo(format, &d3dFormatInfo))
+ {
+ return d3dFormatInfo.mMipGenerationFunction;
+ }
+ else
+ {
+ UNREACHABLE();
+ return NULL;
+ }
+}
+
+LoadImageFunction GetImageLoadFunction(GLenum internalFormat, const Renderer9 *renderer)
+{
+ if (!renderer)
+ {
+ return NULL;
+ }
+
+ ASSERT(renderer->getCurrentClientVersion() == 2);
+
+ D3D9FormatInfo d3d9FormatInfo;
+ if (GetD3D9FormatInfo(internalFormat, &d3d9FormatInfo))
+ {
+ return d3d9FormatInfo.mLoadFunction(renderer);
+ }
+ else
+ {
+ UNREACHABLE();
+ return NULL;
+ }
+}
+
+GLuint GetFormatPixelBytes(D3DFORMAT format)
+{
+ D3DFormatInfo d3dFormatInfo;
+ if (GetD3D9FormatInfo(format, &d3dFormatInfo))
+ {
+ return d3dFormatInfo.mPixelBits / 8;
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+GLuint GetBlockWidth(D3DFORMAT format)
+{
+ D3DFormatInfo d3dFormatInfo;
+ if (GetD3D9FormatInfo(format, &d3dFormatInfo))
+ {
+ return d3dFormatInfo.mBlockWidth;
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+GLuint GetBlockHeight(D3DFORMAT format)
+{
+ D3DFormatInfo d3dFormatInfo;
+ if (GetD3D9FormatInfo(format, &d3dFormatInfo))
+ {
+ return d3dFormatInfo.mBlockHeight;
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+GLuint GetBlockSize(D3DFORMAT format, GLuint width, GLuint height)
+{
+ D3DFormatInfo d3dFormatInfo;
+ if (GetD3D9FormatInfo(format, &d3dFormatInfo))
+ {
+ GLuint numBlocksWide = (width + d3dFormatInfo.mBlockWidth - 1) / d3dFormatInfo.mBlockWidth;
+ GLuint numBlocksHight = (height + d3dFormatInfo.mBlockHeight - 1) / d3dFormatInfo.mBlockHeight;
+
+ return (d3dFormatInfo.mPixelBits * numBlocksWide * numBlocksHight) / 8;
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+void MakeValidSize(bool isImage, D3DFORMAT format, GLsizei *requestWidth, GLsizei *requestHeight, int *levelOffset)
+{
+ D3DFormatInfo d3dFormatInfo;
+ if (GetD3D9FormatInfo(format, &d3dFormatInfo))
+ {
+ int upsampleCount = 0;
+
+ GLsizei blockWidth = d3dFormatInfo.mBlockWidth;
+ GLsizei blockHeight = d3dFormatInfo.mBlockHeight;
+
+ // Don't expand the size of full textures that are at least (blockWidth x blockHeight) already.
+ if (isImage || *requestWidth < blockWidth || *requestHeight < blockHeight)
+ {
+ while (*requestWidth % blockWidth != 0 || *requestHeight % blockHeight != 0)
+ {
+ *requestWidth <<= 1;
+ *requestHeight <<= 1;
+ upsampleCount++;
+ }
+ }
+ *levelOffset = upsampleCount;
+ }
+}
+
+const D3DFormatSet &GetAllUsedD3DFormats()
+{
+ static const D3DFormatSet formatSet = BuildAllD3DFormatSet();
+ return formatSet;
+}
+
+ColorReadFunction GetColorReadFunction(D3DFORMAT format)
+{
+ D3DFormatInfo d3dFormatInfo;
+ if (GetD3D9FormatInfo(format, &d3dFormatInfo))
+ {
+ return d3dFormatInfo.mColorReadFunction;
+ }
+ else
+ {
+ UNREACHABLE();
+ return NULL;
+ }
+}
+
+ColorCopyFunction GetFastCopyFunction(D3DFORMAT sourceFormat, GLenum destFormat, GLenum destType, GLuint clientVersion)
+{
+ static const D3D9FastCopyMap fastCopyMap = BuildFastCopyMap();
+ D3D9FastCopyMap::const_iterator iter = fastCopyMap.find(D3D9FastCopyFormat(sourceFormat, destFormat, destType));
+ return (iter != fastCopyMap.end()) ? iter->second : NULL;
+}
+
+GLenum GetDeclTypeComponentType(D3DDECLTYPE declType)
+{
+ switch (declType)
+ {
+ case D3DDECLTYPE_FLOAT1: return GL_FLOAT;
+ case D3DDECLTYPE_FLOAT2: return GL_FLOAT;
+ case D3DDECLTYPE_FLOAT3: return GL_FLOAT;
+ case D3DDECLTYPE_FLOAT4: return GL_FLOAT;
+ case D3DDECLTYPE_UBYTE4: return GL_UNSIGNED_INT;
+ case D3DDECLTYPE_SHORT2: return GL_INT;
+ case D3DDECLTYPE_SHORT4: return GL_INT;
+ case D3DDECLTYPE_UBYTE4N: return GL_UNSIGNED_NORMALIZED;
+ case D3DDECLTYPE_SHORT4N: return GL_SIGNED_NORMALIZED;
+ case D3DDECLTYPE_USHORT4N: return GL_UNSIGNED_NORMALIZED;
+ case D3DDECLTYPE_SHORT2N: return GL_SIGNED_NORMALIZED;
+ case D3DDECLTYPE_USHORT2N: return GL_UNSIGNED_NORMALIZED;
+ default: UNREACHABLE(); return GL_NONE;
+ }
+}
+
+// Attribute format conversion
+enum { NUM_GL_VERTEX_ATTRIB_TYPES = 6 };
+
+struct FormatConverter
+{
+ bool identity;
+ std::size_t outputElementSize;
+ void (*convertArray)(const void *in, std::size_t stride, std::size_t n, void *out);
+ D3DDECLTYPE d3dDeclType;
+};
+
+struct TranslationDescription
+{
+ DWORD capsFlag;
+ FormatConverter preferredConversion;
+ FormatConverter fallbackConversion;
+};
+
+static unsigned int typeIndex(GLenum type);
+static const FormatConverter &formatConverter(const gl::VertexAttribute &attribute);
+
+bool mTranslationsInitialized = false;
+FormatConverter mFormatConverters[NUM_GL_VERTEX_ATTRIB_TYPES][2][4];
+
+// Mapping from OpenGL-ES vertex attrib type to D3D decl type:
+//
+// BYTE SHORT (Cast)
+// BYTE-norm FLOAT (Normalize) (can't be exactly represented as SHORT-norm)
+// UNSIGNED_BYTE UBYTE4 (Identity) or SHORT (Cast)
+// UNSIGNED_BYTE-norm UBYTE4N (Identity) or FLOAT (Normalize)
+// SHORT SHORT (Identity)
+// SHORT-norm SHORT-norm (Identity) or FLOAT (Normalize)
+// UNSIGNED_SHORT FLOAT (Cast)
+// UNSIGNED_SHORT-norm USHORT-norm (Identity) or FLOAT (Normalize)
+// FIXED (not in WebGL) FLOAT (FixedToFloat)
+// FLOAT FLOAT (Identity)
+
+// GLToCType maps from GL type (as GLenum) to the C typedef.
+template <GLenum GLType> struct GLToCType { };
+
+template <> struct GLToCType<GL_BYTE> { typedef GLbyte type; };
+template <> struct GLToCType<GL_UNSIGNED_BYTE> { typedef GLubyte type; };
+template <> struct GLToCType<GL_SHORT> { typedef GLshort type; };
+template <> struct GLToCType<GL_UNSIGNED_SHORT> { typedef GLushort type; };
+template <> struct GLToCType<GL_FIXED> { typedef GLuint type; };
+template <> struct GLToCType<GL_FLOAT> { typedef GLfloat type; };
+
+// This differs from D3DDECLTYPE in that it is unsized. (Size expansion is applied last.)
+enum D3DVertexType
+{
+ D3DVT_FLOAT,
+ D3DVT_SHORT,
+ D3DVT_SHORT_NORM,
+ D3DVT_UBYTE,
+ D3DVT_UBYTE_NORM,
+ D3DVT_USHORT_NORM
+};
+
+// D3DToCType maps from D3D vertex type (as enum D3DVertexType) to the corresponding C type.
+template <unsigned int D3DType> struct D3DToCType { };
+
+template <> struct D3DToCType<D3DVT_FLOAT> { typedef float type; };
+template <> struct D3DToCType<D3DVT_SHORT> { typedef short type; };
+template <> struct D3DToCType<D3DVT_SHORT_NORM> { typedef short type; };
+template <> struct D3DToCType<D3DVT_UBYTE> { typedef unsigned char type; };
+template <> struct D3DToCType<D3DVT_UBYTE_NORM> { typedef unsigned char type; };
+template <> struct D3DToCType<D3DVT_USHORT_NORM> { typedef unsigned short type; };
+
+// Encode the type/size combinations that D3D permits. For each type/size it expands to a widener that will provide the appropriate final size.
+template <unsigned int type, int size> struct WidenRule { };
+
+template <int size> struct WidenRule<D3DVT_FLOAT, size> : NoWiden<size> { };
+template <int size> struct WidenRule<D3DVT_SHORT, size> : WidenToEven<size> { };
+template <int size> struct WidenRule<D3DVT_SHORT_NORM, size> : WidenToEven<size> { };
+template <int size> struct WidenRule<D3DVT_UBYTE, size> : WidenToFour<size> { };
+template <int size> struct WidenRule<D3DVT_UBYTE_NORM, size> : WidenToFour<size> { };
+template <int size> struct WidenRule<D3DVT_USHORT_NORM, size> : WidenToEven<size> { };
+
+// VertexTypeFlags encodes the D3DCAPS9::DeclType flag and vertex declaration flag for each D3D vertex type & size combination.
+template <unsigned int d3dtype, int size> struct VertexTypeFlags { };
+
+template <unsigned int _capflag, unsigned int _declflag>
+struct VertexTypeFlagsHelper
+{
+ enum { capflag = _capflag };
+ enum { declflag = _declflag };
+};
+
+template <> struct VertexTypeFlags<D3DVT_FLOAT, 1> : VertexTypeFlagsHelper<0, D3DDECLTYPE_FLOAT1> { };
+template <> struct VertexTypeFlags<D3DVT_FLOAT, 2> : VertexTypeFlagsHelper<0, D3DDECLTYPE_FLOAT2> { };
+template <> struct VertexTypeFlags<D3DVT_FLOAT, 3> : VertexTypeFlagsHelper<0, D3DDECLTYPE_FLOAT3> { };
+template <> struct VertexTypeFlags<D3DVT_FLOAT, 4> : VertexTypeFlagsHelper<0, D3DDECLTYPE_FLOAT4> { };
+template <> struct VertexTypeFlags<D3DVT_SHORT, 2> : VertexTypeFlagsHelper<0, D3DDECLTYPE_SHORT2> { };
+template <> struct VertexTypeFlags<D3DVT_SHORT, 4> : VertexTypeFlagsHelper<0, D3DDECLTYPE_SHORT4> { };
+template <> struct VertexTypeFlags<D3DVT_SHORT_NORM, 2> : VertexTypeFlagsHelper<D3DDTCAPS_SHORT2N, D3DDECLTYPE_SHORT2N> { };
+template <> struct VertexTypeFlags<D3DVT_SHORT_NORM, 4> : VertexTypeFlagsHelper<D3DDTCAPS_SHORT4N, D3DDECLTYPE_SHORT4N> { };
+template <> struct VertexTypeFlags<D3DVT_UBYTE, 4> : VertexTypeFlagsHelper<D3DDTCAPS_UBYTE4, D3DDECLTYPE_UBYTE4> { };
+template <> struct VertexTypeFlags<D3DVT_UBYTE_NORM, 4> : VertexTypeFlagsHelper<D3DDTCAPS_UBYTE4N, D3DDECLTYPE_UBYTE4N> { };
+template <> struct VertexTypeFlags<D3DVT_USHORT_NORM, 2> : VertexTypeFlagsHelper<D3DDTCAPS_USHORT2N, D3DDECLTYPE_USHORT2N> { };
+template <> struct VertexTypeFlags<D3DVT_USHORT_NORM, 4> : VertexTypeFlagsHelper<D3DDTCAPS_USHORT4N, D3DDECLTYPE_USHORT4N> { };
+
+
+// VertexTypeMapping maps GL type & normalized flag to preferred and fallback D3D vertex types (as D3DVertexType enums).
+template <GLenum GLtype, bool normalized> struct VertexTypeMapping { };
+
+template <D3DVertexType Preferred, D3DVertexType Fallback = Preferred>
+struct VertexTypeMappingBase
+{
+ enum { preferred = Preferred };
+ enum { fallback = Fallback };
+};
+
+template <> struct VertexTypeMapping<GL_BYTE, false> : VertexTypeMappingBase<D3DVT_SHORT> { }; // Cast
+template <> struct VertexTypeMapping<GL_BYTE, true> : VertexTypeMappingBase<D3DVT_FLOAT> { }; // Normalize
+template <> struct VertexTypeMapping<GL_UNSIGNED_BYTE, false> : VertexTypeMappingBase<D3DVT_UBYTE, D3DVT_FLOAT> { }; // Identity, Cast
+template <> struct VertexTypeMapping<GL_UNSIGNED_BYTE, true> : VertexTypeMappingBase<D3DVT_UBYTE_NORM, D3DVT_FLOAT> { }; // Identity, Normalize
+template <> struct VertexTypeMapping<GL_SHORT, false> : VertexTypeMappingBase<D3DVT_SHORT> { }; // Identity
+template <> struct VertexTypeMapping<GL_SHORT, true> : VertexTypeMappingBase<D3DVT_SHORT_NORM, D3DVT_FLOAT> { }; // Cast, Normalize
+template <> struct VertexTypeMapping<GL_UNSIGNED_SHORT, false> : VertexTypeMappingBase<D3DVT_FLOAT> { }; // Cast
+template <> struct VertexTypeMapping<GL_UNSIGNED_SHORT, true> : VertexTypeMappingBase<D3DVT_USHORT_NORM, D3DVT_FLOAT> { }; // Cast, Normalize
+template <bool normalized> struct VertexTypeMapping<GL_FIXED, normalized> : VertexTypeMappingBase<D3DVT_FLOAT> { }; // FixedToFloat
+template <bool normalized> struct VertexTypeMapping<GL_FLOAT, normalized> : VertexTypeMappingBase<D3DVT_FLOAT> { }; // Identity
+
+
+// Given a GL type & norm flag and a D3D type, ConversionRule provides the type conversion rule (Cast, Normalize, Identity, FixedToFloat).
+// The conversion rules themselves are defined in vertexconversion.h.
+
+// Almost all cases are covered by Cast (including those that are actually Identity since Cast<T,T> knows it's an identity mapping).
+template <GLenum fromType, bool normalized, unsigned int toType>
+struct ConversionRule : Cast<typename GLToCType<fromType>::type, typename D3DToCType<toType>::type> { };
+
+// All conversions from normalized types to float use the Normalize operator.
+template <GLenum fromType> struct ConversionRule<fromType, true, D3DVT_FLOAT> : Normalize<typename GLToCType<fromType>::type> { };
+
+// Use a full specialization for this so that it preferentially matches ahead of the generic normalize-to-float rules.
+template <> struct ConversionRule<GL_FIXED, true, D3DVT_FLOAT> : FixedToFloat<GLint, 16> { };
+template <> struct ConversionRule<GL_FIXED, false, D3DVT_FLOAT> : FixedToFloat<GLint, 16> { };
+
+// A 2-stage construction is used for DefaultVertexValues because float must use SimpleDefaultValues (i.e. 0/1)
+// whether it is normalized or not.
+template <class T, bool normalized> struct DefaultVertexValuesStage2 { };
+
+template <class T> struct DefaultVertexValuesStage2<T, true> : NormalizedDefaultValues<T> { };
+template <class T> struct DefaultVertexValuesStage2<T, false> : SimpleDefaultValues<T> { };
+
+// Work out the default value rule for a D3D type (expressed as the C type) and
+template <class T, bool normalized> struct DefaultVertexValues : DefaultVertexValuesStage2<T, normalized> { };
+template <bool normalized> struct DefaultVertexValues<float, normalized> : SimpleDefaultValues<float> { };
+
+// Policy rules for use with Converter, to choose whether to use the preferred or fallback conversion.
+// The fallback conversion produces an output that all D3D9 devices must support.
+template <class T> struct UsePreferred { enum { type = T::preferred }; };
+template <class T> struct UseFallback { enum { type = T::fallback }; };
+
+// Converter ties it all together. Given an OpenGL type/norm/size and choice of preferred/fallback conversion,
+// it provides all the members of the appropriate VertexDataConverter, the D3DCAPS9::DeclTypes flag in cap flag
+// and the D3DDECLTYPE member needed for the vertex declaration in declflag.
+template <GLenum fromType, bool normalized, int size, template <class T> class PreferenceRule>
+struct Converter
+ : VertexDataConverter<typename GLToCType<fromType>::type,
+ WidenRule<PreferenceRule< VertexTypeMapping<fromType, normalized> >::type, size>,
+ ConversionRule<fromType,
+ normalized,
+ PreferenceRule< VertexTypeMapping<fromType, normalized> >::type>,
+ DefaultVertexValues<typename D3DToCType<PreferenceRule< VertexTypeMapping<fromType, normalized> >::type>::type, normalized > >
+{
+private:
+ enum { d3dtype = PreferenceRule< VertexTypeMapping<fromType, normalized> >::type };
+ enum { d3dsize = WidenRule<d3dtype, size>::finalWidth };
+
+public:
+ enum { capflag = VertexTypeFlags<d3dtype, d3dsize>::capflag };
+ enum { declflag = VertexTypeFlags<d3dtype, d3dsize>::declflag };
+};
+
+// Initialize a TranslationInfo
+#define TRANSLATION(type, norm, size, preferred) \
+ { \
+ Converter<type, norm, size, preferred>::identity, \
+ Converter<type, norm, size, preferred>::finalSize, \
+ Converter<type, norm, size, preferred>::convertArray, \
+ static_cast<D3DDECLTYPE>(Converter<type, norm, size, preferred>::declflag) \
+ }
+
+#define TRANSLATION_FOR_TYPE_NORM_SIZE(type, norm, size) \
+ { \
+ Converter<type, norm, size, UsePreferred>::capflag, \
+ TRANSLATION(type, norm, size, UsePreferred), \
+ TRANSLATION(type, norm, size, UseFallback) \
+ }
+
+#define TRANSLATIONS_FOR_TYPE(type) \
+ { \
+ { TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 1), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 2), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 3), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 4) }, \
+ { TRANSLATION_FOR_TYPE_NORM_SIZE(type, true, 1), TRANSLATION_FOR_TYPE_NORM_SIZE(type, true, 2), TRANSLATION_FOR_TYPE_NORM_SIZE(type, true, 3), TRANSLATION_FOR_TYPE_NORM_SIZE(type, true, 4) }, \
+ }
+
+#define TRANSLATIONS_FOR_TYPE_NO_NORM(type) \
+ { \
+ { TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 1), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 2), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 3), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 4) }, \
+ { TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 1), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 2), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 3), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 4) }, \
+ }
+
+const TranslationDescription mPossibleTranslations[NUM_GL_VERTEX_ATTRIB_TYPES][2][4] = // [GL types as enumerated by typeIndex()][normalized][size-1]
+{
+ TRANSLATIONS_FOR_TYPE(GL_BYTE),
+ TRANSLATIONS_FOR_TYPE(GL_UNSIGNED_BYTE),
+ TRANSLATIONS_FOR_TYPE(GL_SHORT),
+ TRANSLATIONS_FOR_TYPE(GL_UNSIGNED_SHORT),
+ TRANSLATIONS_FOR_TYPE_NO_NORM(GL_FIXED),
+ TRANSLATIONS_FOR_TYPE_NO_NORM(GL_FLOAT)
+};
+
+void InitializeVertexTranslations(const rx::Renderer9 *renderer)
+{
+ DWORD declTypes = renderer->getCapsDeclTypes();
+
+ for (unsigned int i = 0; i < NUM_GL_VERTEX_ATTRIB_TYPES; i++)
+ {
+ for (unsigned int j = 0; j < 2; j++)
+ {
+ for (unsigned int k = 0; k < 4; k++)
+ {
+ if (mPossibleTranslations[i][j][k].capsFlag == 0 || (declTypes & mPossibleTranslations[i][j][k].capsFlag) != 0)
+ {
+ mFormatConverters[i][j][k] = mPossibleTranslations[i][j][k].preferredConversion;
+ }
+ else
+ {
+ mFormatConverters[i][j][k] = mPossibleTranslations[i][j][k].fallbackConversion;
+ }
+ }
+ }
+ }
+}
+
+unsigned int typeIndex(GLenum type)
+{
+ switch (type)
+ {
+ case GL_BYTE: return 0;
+ case GL_UNSIGNED_BYTE: return 1;
+ case GL_SHORT: return 2;
+ case GL_UNSIGNED_SHORT: return 3;
+ case GL_FIXED: return 4;
+ case GL_FLOAT: return 5;
+
+ default: UNREACHABLE(); return 5;
+ }
+}
+
+const FormatConverter &formatConverter(const gl::VertexFormat &vertexFormat)
+{
+ // Pure integer attributes only supported in ES3.0
+ ASSERT(!vertexFormat.mPureInteger);
+ return mFormatConverters[typeIndex(vertexFormat.mType)][vertexFormat.mNormalized][vertexFormat.mComponents - 1];
+}
+
+VertexCopyFunction GetVertexCopyFunction(const gl::VertexFormat &vertexFormat)
+{
+ return formatConverter(vertexFormat).convertArray;
+}
+
+size_t GetVertexElementSize(const gl::VertexFormat &vertexFormat)
+{
+ return formatConverter(vertexFormat).outputElementSize;
+}
+
+VertexConversionType GetVertexConversionType(const gl::VertexFormat &vertexFormat)
+{
+ return (formatConverter(vertexFormat).identity ? VERTEX_CONVERT_NONE : VERTEX_CONVERT_CPU);
+}
+
+D3DDECLTYPE GetNativeVertexFormat(const gl::VertexFormat &vertexFormat)
+{
+ return formatConverter(vertexFormat).d3dDeclType;
+}
+
+}
+
+namespace gl_d3d9
+{
+
+D3DFORMAT GetTextureFormat(GLenum internalFormat, const Renderer9 *renderer)
+{
+ if (!renderer)
+ {
+ UNREACHABLE();
+ return D3DFMT_UNKNOWN;
+ }
+
+ ASSERT(renderer->getCurrentClientVersion() == 2);
+
+ D3D9FormatInfo d3d9FormatInfo;
+ if (GetD3D9FormatInfo(internalFormat, &d3d9FormatInfo))
+ {
+ return d3d9FormatInfo.mTexFormat(renderer);
+ }
+ else
+ {
+ UNREACHABLE();
+ return D3DFMT_UNKNOWN;
+ }
+}
+
+D3DFORMAT GetRenderFormat(GLenum internalFormat, const Renderer9 *renderer)
+{
+ if (!renderer)
+ {
+ UNREACHABLE();
+ return D3DFMT_UNKNOWN;
+ }
+
+ ASSERT(renderer->getCurrentClientVersion() == 2);
+
+ D3D9FormatInfo d3d9FormatInfo;
+ if (GetD3D9FormatInfo(internalFormat, &d3d9FormatInfo))
+ {
+ return d3d9FormatInfo.mRenderFormat(renderer);
+ }
+ else
+ {
+ UNREACHABLE();
+ return D3DFMT_UNKNOWN;
+ }
+}
+
+D3DMULTISAMPLE_TYPE GetMultisampleType(GLsizei samples)
+{
+ return (samples > 1) ? static_cast<D3DMULTISAMPLE_TYPE>(samples) : D3DMULTISAMPLE_NONE;
+}
+
+bool RequiresTextureDataInitialization(GLint internalFormat)
+{
+ const InternalFormatInitialzerMap &map = GetInternalFormatInitialzerMap();
+ return map.find(internalFormat) != map.end();
+}
+
+InitializeTextureDataFunction GetTextureDataInitializationFunction(GLint internalFormat)
+{
+ const InternalFormatInitialzerMap &map = GetInternalFormatInitialzerMap();
+ InternalFormatInitialzerMap::const_iterator iter = map.find(internalFormat);
+ if (iter != map.end())
+ {
+ return iter->second;
+ }
+ else
+ {
+ UNREACHABLE();
+ return NULL;
+ }
+}
+
+}
+
+namespace d3d9_gl
+{
+
+GLenum GetInternalFormat(D3DFORMAT format)
+{
+ static const D3D9FormatInfoMap infoMap = BuildD3D9FormatInfoMap();
+ D3D9FormatInfoMap::const_iterator iter = infoMap.find(format);
+ if (iter != infoMap.end())
+ {
+ return iter->second.mInternalFormat;
+ }
+ else
+ {
+ UNREACHABLE();
+ return GL_NONE;
+ }
+}
+
+GLsizei GetSamplesCount(D3DMULTISAMPLE_TYPE type)
+{
+ return (type != D3DMULTISAMPLE_NONMASKABLE) ? type : 0;
+}
+
+bool IsFormatChannelEquivalent(D3DFORMAT d3dformat, GLenum format, GLuint clientVersion)
+{
+ GLenum internalFormat = d3d9_gl::GetInternalFormat(d3dformat);
+ GLenum convertedFormat = gl::GetFormat(internalFormat, clientVersion);
+ return convertedFormat == format;
+}
+
+}
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/formatutils9.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/formatutils9.h
new file mode 100644
index 00000000000..5b40c105443
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/formatutils9.h
@@ -0,0 +1,77 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// formatutils9.h: Queries for GL image formats and their translations to D3D9
+// formats.
+
+#ifndef LIBGLESV2_RENDERER_FORMATUTILS9_H_
+#define LIBGLESV2_RENDERER_FORMATUTILS9_H_
+
+#include "libGLESv2/formatutils.h"
+
+namespace rx
+{
+
+class Renderer9;
+
+namespace d3d9
+{
+
+typedef std::set<D3DFORMAT> D3DFormatSet;
+
+MipGenerationFunction GetMipGenerationFunction(D3DFORMAT format);
+LoadImageFunction GetImageLoadFunction(GLenum internalFormat, const Renderer9 *renderer);
+
+GLuint GetFormatPixelBytes(D3DFORMAT format);
+GLuint GetBlockWidth(D3DFORMAT format);
+GLuint GetBlockHeight(D3DFORMAT format);
+GLuint GetBlockSize(D3DFORMAT format, GLuint width, GLuint height);
+
+void MakeValidSize(bool isImage, D3DFORMAT format, GLsizei *requestWidth, GLsizei *requestHeight, int *levelOffset);
+
+const D3DFormatSet &GetAllUsedD3DFormats();
+
+ColorReadFunction GetColorReadFunction(D3DFORMAT format);
+ColorCopyFunction GetFastCopyFunction(D3DFORMAT sourceFormat, GLenum destFormat, GLenum destType, GLuint clientVersion);
+
+VertexCopyFunction GetVertexCopyFunction(const gl::VertexFormat &vertexFormat);
+size_t GetVertexElementSize(const gl::VertexFormat &vertexFormat);
+VertexConversionType GetVertexConversionType(const gl::VertexFormat &vertexFormat);
+D3DDECLTYPE GetNativeVertexFormat(const gl::VertexFormat &vertexFormat);
+
+GLenum GetDeclTypeComponentType(D3DDECLTYPE declType);
+int GetDeclTypeComponentCount(D3DDECLTYPE declType);
+bool IsDeclTypeNormalized(D3DDECLTYPE declType);
+
+void InitializeVertexTranslations(const rx::Renderer9 *renderer);
+
+}
+
+namespace gl_d3d9
+{
+
+D3DFORMAT GetTextureFormat(GLenum internalFormat, const Renderer9 *renderer);
+D3DFORMAT GetRenderFormat(GLenum internalFormat, const Renderer9 *renderer);
+
+D3DMULTISAMPLE_TYPE GetMultisampleType(GLsizei samples);
+
+bool RequiresTextureDataInitialization(GLint internalFormat);
+InitializeTextureDataFunction GetTextureDataInitializationFunction(GLint internalFormat);
+
+}
+
+namespace d3d9_gl
+{
+
+GLenum GetInternalFormat(D3DFORMAT format);
+GLsizei GetSamplesCount(D3DMULTISAMPLE_TYPE type);
+bool IsFormatChannelEquivalent(D3DFORMAT d3dformat, GLenum format, GLuint clientVersion);
+
+}
+
+}
+
+#endif // LIBGLESV2_RENDERER_FORMATUTILS9_H_
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/renderer9_utils.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/renderer9_utils.cpp
index da75d465e3c..48c378838d6 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/renderer9_utils.cpp
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/renderer9_utils.cpp
@@ -8,12 +8,15 @@
// renderer9_utils.cpp: Conversion functions and other utility routines
// specific to the D3D9 renderer.
-#include "libGLESv2/renderer/renderer9_utils.h"
-#include "libGLESv2/mathutil.h"
+#include "libGLESv2/renderer/d3d9/renderer9_utils.h"
+#include "common/mathutil.h"
#include "libGLESv2/Context.h"
#include "common/debug.h"
+namespace rx
+{
+
namespace gl_d3d9
{
@@ -36,7 +39,7 @@ D3DCMPFUNC ConvertComparison(GLenum comparison)
return d3dComp;
}
-D3DCOLOR ConvertColor(gl::Color color)
+D3DCOLOR ConvertColor(gl::ColorF color)
{
return D3DCOLOR_RGBA(gl::unorm<8>(color.red),
gl::unorm<8>(color.green),
@@ -80,6 +83,8 @@ D3DBLENDOP ConvertBlendOp(GLenum blendOp)
case GL_FUNC_ADD: d3dBlendOp = D3DBLENDOP_ADD; break;
case GL_FUNC_SUBTRACT: d3dBlendOp = D3DBLENDOP_SUBTRACT; break;
case GL_FUNC_REVERSE_SUBTRACT: d3dBlendOp = D3DBLENDOP_REVSUBTRACT; break;
+ case GL_MIN_EXT: d3dBlendOp = D3DBLENDOP_MIN; break;
+ case GL_MAX_EXT: d3dBlendOp = D3DBLENDOP_MAX; break;
default: UNREACHABLE();
}
@@ -237,264 +242,6 @@ void ConvertMinFilter(GLenum minFilter, D3DTEXTUREFILTERTYPE *d3dMinFilter, D3DT
}
}
-D3DFORMAT ConvertRenderbufferFormat(GLenum format)
-{
- switch (format)
- {
- case GL_NONE: return D3DFMT_NULL;
- case GL_RGBA4:
- case GL_RGB5_A1:
- case GL_RGBA8_OES: return D3DFMT_A8R8G8B8;
- case GL_RGB565: return D3DFMT_R5G6B5;
- case GL_RGB8_OES: return D3DFMT_X8R8G8B8;
- case GL_DEPTH_COMPONENT16:
- case GL_STENCIL_INDEX8:
- case GL_DEPTH24_STENCIL8_OES: return D3DFMT_D24S8;
- default: UNREACHABLE(); return D3DFMT_A8R8G8B8;
- }
-}
-
-D3DMULTISAMPLE_TYPE GetMultisampleTypeFromSamples(GLsizei samples)
-{
- if (samples <= 1)
- return D3DMULTISAMPLE_NONE;
- else
- return (D3DMULTISAMPLE_TYPE)samples;
-}
-
-}
-
-namespace d3d9_gl
-{
-
-unsigned int GetStencilSize(D3DFORMAT stencilFormat)
-{
- if (stencilFormat == D3DFMT_INTZ)
- {
- return 8;
- }
- switch(stencilFormat)
- {
- case D3DFMT_D24FS8:
- case D3DFMT_D24S8:
- return 8;
- case D3DFMT_D24X4S4:
- return 4;
- case D3DFMT_D15S1:
- return 1;
- case D3DFMT_D16_LOCKABLE:
- case D3DFMT_D32:
- case D3DFMT_D24X8:
- case D3DFMT_D32F_LOCKABLE:
- case D3DFMT_D16:
- return 0;
- //case D3DFMT_D32_LOCKABLE: return 0; // DirectX 9Ex only
- //case D3DFMT_S8_LOCKABLE: return 8; // DirectX 9Ex only
- default:
- return 0;
- }
-}
-
-unsigned int GetAlphaSize(D3DFORMAT colorFormat)
-{
- switch (colorFormat)
- {
- case D3DFMT_A16B16G16R16F:
- return 16;
- case D3DFMT_A32B32G32R32F:
- return 32;
- case D3DFMT_A2R10G10B10:
- return 2;
- case D3DFMT_A8R8G8B8:
- return 8;
- case D3DFMT_A1R5G5B5:
- return 1;
- case D3DFMT_X8R8G8B8:
- case D3DFMT_R5G6B5:
- return 0;
- default:
- return 0;
- }
-}
-
-GLsizei GetSamplesFromMultisampleType(D3DMULTISAMPLE_TYPE type)
-{
- if (type == D3DMULTISAMPLE_NONMASKABLE)
- return 0;
- else
- return type;
-}
-
-bool IsFormatChannelEquivalent(D3DFORMAT d3dformat, GLenum format)
-{
- switch (d3dformat)
- {
- case D3DFMT_L8:
- return (format == GL_LUMINANCE);
- case D3DFMT_A8L8:
- return (format == GL_LUMINANCE_ALPHA);
- case D3DFMT_DXT1:
- return (format == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT || format == GL_COMPRESSED_RGB_S3TC_DXT1_EXT);
- case D3DFMT_DXT3:
- return (format == GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE);
- case D3DFMT_DXT5:
- return (format == GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE);
- case D3DFMT_A8R8G8B8:
- case D3DFMT_A16B16G16R16F:
- case D3DFMT_A32B32G32R32F:
- return (format == GL_RGBA || format == GL_BGRA_EXT);
- case D3DFMT_X8R8G8B8:
- return (format == GL_RGB);
- default:
- if (d3dformat == D3DFMT_INTZ && gl::IsDepthTexture(format))
- return true;
- return false;
- }
-}
-
-GLenum ConvertBackBufferFormat(D3DFORMAT format)
-{
- switch (format)
- {
- case D3DFMT_A4R4G4B4: return GL_RGBA4;
- case D3DFMT_A8R8G8B8: return GL_RGBA8_OES;
- case D3DFMT_A1R5G5B5: return GL_RGB5_A1;
- case D3DFMT_R5G6B5: return GL_RGB565;
- case D3DFMT_X8R8G8B8: return GL_RGB8_OES;
- default:
- UNREACHABLE();
- }
-
- return GL_RGBA4;
-}
-
-GLenum ConvertDepthStencilFormat(D3DFORMAT format)
-{
- if (format == D3DFMT_INTZ)
- {
- return GL_DEPTH24_STENCIL8_OES;
- }
- switch (format)
- {
- case D3DFMT_D16:
- case D3DFMT_D24X8:
- return GL_DEPTH_COMPONENT16;
- case D3DFMT_D24S8:
- return GL_DEPTH24_STENCIL8_OES;
- case D3DFMT_UNKNOWN:
- return GL_NONE;
- default:
- UNREACHABLE();
- }
-
- return GL_DEPTH24_STENCIL8_OES;
-}
-
-GLenum ConvertRenderTargetFormat(D3DFORMAT format)
-{
- if (format == D3DFMT_INTZ)
- {
- return GL_DEPTH24_STENCIL8_OES;
- }
-
- switch (format)
- {
- case D3DFMT_A4R4G4B4: return GL_RGBA4;
- case D3DFMT_A8R8G8B8: return GL_RGBA8_OES;
- case D3DFMT_A1R5G5B5: return GL_RGB5_A1;
- case D3DFMT_R5G6B5: return GL_RGB565;
- case D3DFMT_X8R8G8B8: return GL_RGB8_OES;
- case D3DFMT_D16:
- case D3DFMT_D24X8:
- return GL_DEPTH_COMPONENT16;
- case D3DFMT_D24S8:
- return GL_DEPTH24_STENCIL8_OES;
- case D3DFMT_UNKNOWN:
- return GL_NONE;
- default:
- UNREACHABLE();
- }
-
- return GL_RGBA4;
-}
-
-GLenum GetEquivalentFormat(D3DFORMAT format)
-{
- if (format == D3DFMT_INTZ)
- return GL_DEPTH24_STENCIL8_OES;
- if (format == D3DFMT_NULL)
- return GL_NONE;
-
- switch (format)
- {
- case D3DFMT_A4R4G4B4: return GL_RGBA4;
- case D3DFMT_A8R8G8B8: return GL_RGBA8_OES;
- case D3DFMT_A1R5G5B5: return GL_RGB5_A1;
- case D3DFMT_R5G6B5: return GL_RGB565;
- case D3DFMT_X8R8G8B8: return GL_RGB8_OES;
- case D3DFMT_D16: return GL_DEPTH_COMPONENT16;
- case D3DFMT_D24S8: return GL_DEPTH24_STENCIL8_OES;
- case D3DFMT_UNKNOWN: return GL_NONE;
- case D3DFMT_DXT1: return GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
- case D3DFMT_DXT3: return GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE;
- case D3DFMT_DXT5: return GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE;
- case D3DFMT_A32B32G32R32F: return GL_RGBA32F_EXT;
- case D3DFMT_A16B16G16R16F: return GL_RGBA16F_EXT;
- case D3DFMT_L8: return GL_LUMINANCE8_EXT;
- case D3DFMT_A8L8: return GL_LUMINANCE8_ALPHA8_EXT;
- default: UNREACHABLE();
- return GL_NONE;
- }
-}
-
-}
-
-namespace d3d9
-{
-
-bool IsCompressedFormat(D3DFORMAT surfaceFormat)
-{
- switch(surfaceFormat)
- {
- case D3DFMT_DXT1:
- case D3DFMT_DXT2:
- case D3DFMT_DXT3:
- case D3DFMT_DXT4:
- case D3DFMT_DXT5:
- return true;
- default:
- return false;
- }
-}
-
-size_t ComputeRowSize(D3DFORMAT format, unsigned int width)
-{
- if (format == D3DFMT_INTZ)
- {
- return 4 * width;
- }
- switch (format)
- {
- case D3DFMT_L8:
- return 1 * width;
- case D3DFMT_A8L8:
- return 2 * width;
- case D3DFMT_X8R8G8B8:
- case D3DFMT_A8R8G8B8:
- return 4 * width;
- case D3DFMT_A16B16G16R16F:
- return 8 * width;
- case D3DFMT_A32B32G32R32F:
- return 16 * width;
- case D3DFMT_DXT1:
- return 8 * ((width + 3) / 4);
- case D3DFMT_DXT3:
- case D3DFMT_DXT5:
- return 16 * ((width + 3) / 4);
- default:
- UNREACHABLE();
- return 0;
- }
}
}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/renderer9_utils.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/renderer9_utils.h
index bf6cdf1ea65..a115f9e3b9c 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/renderer9_utils.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/renderer9_utils.h
@@ -10,16 +10,16 @@
#ifndef LIBGLESV2_RENDERER_RENDERER9_UTILS_H
#define LIBGLESV2_RENDERER_RENDERER9_UTILS_H
-#include "libGLESv2/utilities.h"
+#include "libGLESv2/angletypes.h"
-const D3DFORMAT D3DFMT_INTZ = ((D3DFORMAT)(MAKEFOURCC('I','N','T','Z')));
-const D3DFORMAT D3DFMT_NULL = ((D3DFORMAT)(MAKEFOURCC('N','U','L','L')));
+namespace rx
+{
namespace gl_d3d9
{
D3DCMPFUNC ConvertComparison(GLenum comparison);
-D3DCOLOR ConvertColor(gl::Color color);
+D3DCOLOR ConvertColor(gl::ColorF color);
D3DBLEND ConvertBlendFunc(GLenum blend);
D3DBLENDOP ConvertBlendOp(GLenum blendOp);
D3DSTENCILOP ConvertStencilOp(GLenum stencilOp);
@@ -29,31 +29,11 @@ D3DCUBEMAP_FACES ConvertCubeFace(GLenum cubeFace);
DWORD ConvertColorMask(bool red, bool green, bool blue, bool alpha);
D3DTEXTUREFILTERTYPE ConvertMagFilter(GLenum magFilter, float maxAnisotropy);
void ConvertMinFilter(GLenum minFilter, D3DTEXTUREFILTERTYPE *d3dMinFilter, D3DTEXTUREFILTERTYPE *d3dMipFilter, float maxAnisotropy);
-D3DFORMAT ConvertRenderbufferFormat(GLenum format);
-D3DMULTISAMPLE_TYPE GetMultisampleTypeFromSamples(GLsizei samples);
-
-}
-
-namespace d3d9_gl
-{
-
-GLuint GetAlphaSize(D3DFORMAT colorFormat);
-GLuint GetStencilSize(D3DFORMAT stencilFormat);
-
-GLsizei GetSamplesFromMultisampleType(D3DMULTISAMPLE_TYPE type);
-
-bool IsFormatChannelEquivalent(D3DFORMAT d3dformat, GLenum format);
-GLenum ConvertBackBufferFormat(D3DFORMAT format);
-GLenum ConvertDepthStencilFormat(D3DFORMAT format);
-GLenum ConvertRenderTargetFormat(D3DFORMAT format);
-GLenum GetEquivalentFormat(D3DFORMAT format);
}
namespace d3d9
{
-bool IsCompressedFormat(D3DFORMAT format);
-size_t ComputeRowSize(D3DFORMAT format, unsigned int width);
inline bool isDeviceLostError(HRESULT errorCode)
{
@@ -71,4 +51,6 @@ inline bool isDeviceLostError(HRESULT errorCode)
}
+}
+
#endif // LIBGLESV2_RENDERER_RENDERER9_UTILS_H
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/shaders/Blit.ps b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/shaders/Blit.ps
new file mode 100644
index 00000000000..dc357d0fa6a
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/shaders/Blit.ps
@@ -0,0 +1,33 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+sampler2D tex : s0;
+
+uniform float4 mult : c0;
+uniform float4 add : c1;
+
+// Passthrough Pixel Shader
+// Outputs texture 0 sampled at texcoord 0.
+float4 passthroughps(float4 texcoord : TEXCOORD0) : COLOR
+{
+ return tex2D(tex, texcoord.xy);
+};
+
+// Luminance Conversion Pixel Shader
+// Performs a mad operation using the LA data from the texture with mult.xw and add.xw.
+// Returns data in the form of llla
+float4 luminanceps(float4 texcoord : TEXCOORD0) : COLOR
+{
+ return (tex2D(tex, texcoord.xy).xw * mult.xw + add.xw).xxxy;
+};
+
+// RGB/A Component Mask Pixel Shader
+// Performs a mad operation using the texture's RGBA data with mult.xyzw and add.xyzw.
+// Returns data in the form of rgba
+float4 componentmaskps(float4 texcoord : TEXCOORD0) : COLOR
+{
+ return tex2D(tex, texcoord.xy) * mult + add;
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/Blit.vs b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/shaders/Blit.vs
index 3a36980b935..3a36980b935 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/Blit.vs
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/shaders/Blit.vs
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/luminanceps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/shaders/compiled/componentmaskps.h
index f32d3f2f290..f370c47ebbb 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/luminanceps.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/shaders/compiled/componentmaskps.h
@@ -5,7 +5,8 @@
///
// Parameters:
//
-// float4 mode;
+// float4 add;
+// float4 mult;
// sampler2D tex;
//
//
@@ -13,7 +14,8 @@
//
// Name Reg Size
// ------------ ----- ----
-// mode c0 1
+// mult c0 1
+// add c1 1
// tex s0 1
//
@@ -21,33 +23,37 @@
dcl t0.xy
dcl_2d s0
texld r0, t0, s0
- mad r1.w, r0.w, c0.x, c0.y
- mov r1.xyz, r0.x
- mov oC0, r1
+ mov r1, c0
+ mad r0, r0, r1, c1
+ mov oC0, r0
// approximately 4 instruction slots used (1 texture, 3 arithmetic)
#endif
-const BYTE g_ps20_luminanceps[] =
+const BYTE g_ps20_componentmaskps[] =
{
0, 2, 255, 255, 254, 255,
- 44, 0, 67, 84, 65, 66,
- 28, 0, 0, 0, 119, 0,
+ 50, 0, 67, 84, 65, 66,
+ 28, 0, 0, 0, 143, 0,
0, 0, 0, 2, 255, 255,
- 2, 0, 0, 0, 28, 0,
+ 3, 0, 0, 0, 28, 0,
0, 0, 0, 1, 0, 0,
- 112, 0, 0, 0, 68, 0,
- 0, 0, 2, 0, 0, 0,
- 1, 0, 0, 0, 76, 0,
+ 136, 0, 0, 0, 88, 0,
+ 0, 0, 2, 0, 1, 0,
+ 1, 0, 0, 0, 92, 0,
0, 0, 0, 0, 0, 0,
- 92, 0, 0, 0, 3, 0,
+ 108, 0, 0, 0, 2, 0,
0, 0, 1, 0, 0, 0,
- 96, 0, 0, 0, 0, 0,
- 0, 0, 109, 111, 100, 101,
- 0, 171, 171, 171, 1, 0,
- 3, 0, 1, 0, 4, 0,
- 1, 0, 0, 0, 0, 0,
- 0, 0, 116, 101, 120, 0,
+ 92, 0, 0, 0, 0, 0,
+ 0, 0, 113, 0, 0, 0,
+ 3, 0, 0, 0, 1, 0,
+ 0, 0, 120, 0, 0, 0,
+ 0, 0, 0, 0, 97, 100,
+ 100, 0, 1, 0, 3, 0,
+ 1, 0, 4, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 109, 117, 108, 116, 0, 116,
+ 101, 120, 0, 171, 171, 171,
4, 0, 12, 0, 1, 0,
1, 0, 1, 0, 0, 0,
0, 0, 0, 0, 112, 115,
@@ -67,13 +73,13 @@ const BYTE g_ps20_luminanceps[] =
0, 8, 15, 160, 66, 0,
0, 3, 0, 0, 15, 128,
0, 0, 228, 176, 0, 8,
+ 228, 160, 1, 0, 0, 2,
+ 1, 0, 15, 128, 0, 0,
228, 160, 4, 0, 0, 4,
- 1, 0, 8, 128, 0, 0,
- 255, 128, 0, 0, 0, 160,
- 0, 0, 85, 160, 1, 0,
- 0, 2, 1, 0, 7, 128,
- 0, 0, 0, 128, 1, 0,
+ 0, 0, 15, 128, 0, 0,
+ 228, 128, 1, 0, 228, 128,
+ 1, 0, 228, 160, 1, 0,
0, 2, 0, 8, 15, 128,
- 1, 0, 228, 128, 255, 255,
+ 0, 0, 228, 128, 255, 255,
0, 0
};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/flipyvs.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/shaders/compiled/flipyvs.h
index 27d84c9f346..27d84c9f346 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/flipyvs.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/shaders/compiled/flipyvs.h
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/shaders/compiled/luminanceps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/shaders/compiled/luminanceps.h
new file mode 100644
index 00000000000..0c9a14edf66
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/shaders/compiled/luminanceps.h
@@ -0,0 +1,95 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
+//
+///
+// Parameters:
+//
+// float4 add;
+// float4 mult;
+// sampler2D tex;
+//
+//
+// Registers:
+//
+// Name Reg Size
+// ------------ ----- ----
+// mult c0 1
+// add c1 1
+// tex s0 1
+//
+
+ ps_2_0
+ dcl t0.xy
+ dcl_2d s0
+ texld r0, t0, s0
+ mov r1.xw, c0
+ mad r0.x, r0.x, r1.x, c1.x
+ mad r0.y, r0.w, r1.w, c1.w
+ mov r1.xyz, r0.x
+ mov r1.w, r0.y
+ mov oC0, r1
+
+// approximately 7 instruction slots used (1 texture, 6 arithmetic)
+#endif
+
+const BYTE g_ps20_luminanceps[] =
+{
+ 0, 2, 255, 255, 254, 255,
+ 50, 0, 67, 84, 65, 66,
+ 28, 0, 0, 0, 143, 0,
+ 0, 0, 0, 2, 255, 255,
+ 3, 0, 0, 0, 28, 0,
+ 0, 0, 0, 1, 0, 0,
+ 136, 0, 0, 0, 88, 0,
+ 0, 0, 2, 0, 1, 0,
+ 1, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0,
+ 108, 0, 0, 0, 2, 0,
+ 0, 0, 1, 0, 0, 0,
+ 92, 0, 0, 0, 0, 0,
+ 0, 0, 113, 0, 0, 0,
+ 3, 0, 0, 0, 1, 0,
+ 0, 0, 120, 0, 0, 0,
+ 0, 0, 0, 0, 97, 100,
+ 100, 0, 1, 0, 3, 0,
+ 1, 0, 4, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 109, 117, 108, 116, 0, 116,
+ 101, 120, 0, 171, 171, 171,
+ 4, 0, 12, 0, 1, 0,
+ 1, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 112, 115,
+ 95, 50, 95, 48, 0, 77,
+ 105, 99, 114, 111, 115, 111,
+ 102, 116, 32, 40, 82, 41,
+ 32, 72, 76, 83, 76, 32,
+ 83, 104, 97, 100, 101, 114,
+ 32, 67, 111, 109, 112, 105,
+ 108, 101, 114, 32, 57, 46,
+ 51, 48, 46, 57, 50, 48,
+ 48, 46, 49, 54, 51, 56,
+ 52, 0, 171, 171, 31, 0,
+ 0, 2, 0, 0, 0, 128,
+ 0, 0, 3, 176, 31, 0,
+ 0, 2, 0, 0, 0, 144,
+ 0, 8, 15, 160, 66, 0,
+ 0, 3, 0, 0, 15, 128,
+ 0, 0, 228, 176, 0, 8,
+ 228, 160, 1, 0, 0, 2,
+ 1, 0, 9, 128, 0, 0,
+ 228, 160, 4, 0, 0, 4,
+ 0, 0, 1, 128, 0, 0,
+ 0, 128, 1, 0, 0, 128,
+ 1, 0, 0, 160, 4, 0,
+ 0, 4, 0, 0, 2, 128,
+ 0, 0, 255, 128, 1, 0,
+ 255, 128, 1, 0, 255, 160,
+ 1, 0, 0, 2, 1, 0,
+ 7, 128, 0, 0, 0, 128,
+ 1, 0, 0, 2, 1, 0,
+ 8, 128, 0, 0, 85, 128,
+ 1, 0, 0, 2, 0, 8,
+ 15, 128, 1, 0, 228, 128,
+ 255, 255, 0, 0
+};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/passthroughps.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/shaders/compiled/passthroughps.h
index 66059b84c37..66059b84c37 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/passthroughps.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/shaders/compiled/passthroughps.h
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/standardvs.h b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/shaders/compiled/standardvs.h
index 0841cfb32e4..0841cfb32e4 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/standardvs.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/shaders/compiled/standardvs.h
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/shaders/generate_shaders.bat b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/shaders/generate_shaders.bat
new file mode 100644
index 00000000000..d9c4ec1167f
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/d3d9/shaders/generate_shaders.bat
@@ -0,0 +1,63 @@
+@ECHO OFF
+REM
+REM Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+REM Use of this source code is governed by a BSD-style license that can be
+REM found in the LICENSE file.
+REM
+
+PATH %PATH%;%ProgramFiles(x86)%\Windows Kits\8.0\bin\x86;%DXSDK_DIR%\Utilities\bin\x86
+
+setlocal
+set errorCount=0
+set successCount=0
+set debug=0
+
+if "%1" == "debug" (
+ set debug=1
+)
+if "%1" == "release" (
+ set debug=0
+)
+
+:: | Input file | Entry point | Type | Output file | Debug |
+call:BuildShader Blit.vs standardvs vs_2_0 compiled\standardvs.h %debug%
+call:BuildShader Blit.vs flipyvs vs_2_0 compiled\flipyvs.h %debug%
+call:BuildShader Blit.ps passthroughps ps_2_0 compiled\passthroughps.h %debug%
+call:BuildShader Blit.ps luminanceps ps_2_0 compiled\luminanceps.h %debug%
+call:BuildShader Blit.ps componentmaskps ps_2_0 compiled\componentmaskps.h %debug%
+
+echo.
+
+if %successCount% GTR 0 (
+ echo %successCount% shaders compiled successfully.
+)
+if %errorCount% GTR 0 (
+ echo There were %errorCount% shader compilation errors.
+)
+
+endlocal
+exit /b
+
+:BuildShader
+set input=%~1
+set entry=%~2
+set type=%~3
+set output=%~4
+set debug=%~5
+
+if %debug% == 0 (
+ set "buildCMD=fxc /nologo /E %entry% /T %type% /Fh %output% %input%"
+) else (
+ set "buildCMD=fxc /nologo /Zi /Od /E %entry% /T %type% /Fh %output% %input%"
+)
+
+set error=0
+%buildCMD% || set error=1
+
+if %error% == 0 (
+ set /a successCount=%successCount%+1
+) else (
+ set /a errorCount=%errorCount%+1
+)
+
+exit /b
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/generatemip.h b/chromium/third_party/angle/src/libGLESv2/renderer/generatemip.h
index 8e1973605b8..3177a2b1f39 100644
--- a/chromium/third_party/angle/src/libGLESv2/renderer/generatemip.h
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/generatemip.h
@@ -10,194 +10,260 @@
#ifndef LIBGLESV2_RENDERER_GENERATEMIP_H_
#define LIBGLESV2_RENDERER_GENERATEMIP_H_
-#include "libGLESv2/mathutil.h"
+#include "common/mathutil.h"
+#include "imageformats.h"
namespace rx
{
-struct L8
+
+namespace priv
{
- unsigned char L;
- static void average(L8 *dst, const L8 *src1, const L8 *src2)
- {
- dst->L = ((src1->L ^ src2->L) >> 1) + (src1->L & src2->L);
- }
-};
+template <typename T>
+static inline T *GetPixel(void *data, unsigned int x, unsigned int y, unsigned int z, unsigned int rowPitch, unsigned int depthPitch)
+{
+ return reinterpret_cast<T*>(reinterpret_cast<unsigned char*>(data) + (x * sizeof(T)) + (y * rowPitch) + (z * depthPitch));
+}
-typedef L8 R8; // R8 type is functionally equivalent for mip purposes
-typedef L8 A8; // A8 type is functionally equivalent for mip purposes
+template <typename T>
+static inline const T *GetPixel(const void *data, unsigned int x, unsigned int y, unsigned int z, unsigned int rowPitch, unsigned int depthPitch)
+{
+ return reinterpret_cast<const T*>(reinterpret_cast<const unsigned char*>(data) + (x * sizeof(T)) + (y * rowPitch) + (z * depthPitch));
+}
-struct A8L8
+template <typename T>
+static void GenerateMip_Y(unsigned int sourceWidth, unsigned int sourceHeight, unsigned int sourceDepth,
+ const unsigned char *sourceData, int sourceRowPitch, int sourceDepthPitch,
+ unsigned int destWidth, unsigned int destHeight, unsigned int destDepth,
+ unsigned char *destData, int destRowPitch, int destDepthPitch)
{
- unsigned char L;
- unsigned char A;
+ ASSERT(sourceWidth == 1);
+ ASSERT(sourceHeight > 1);
+ ASSERT(sourceDepth == 1);
- static void average(A8L8 *dst, const A8L8 *src1, const A8L8 *src2)
+ for (unsigned int y = 0; y < destHeight; y++)
{
- *(unsigned short*)dst = (((*(unsigned short*)src1 ^ *(unsigned short*)src2) & 0xFEFE) >> 1) + (*(unsigned short*)src1 & *(unsigned short*)src2);
- }
-};
+ const T *src0 = GetPixel<T>(sourceData, 0, y * 2, 0, sourceRowPitch, sourceDepthPitch);
+ const T *src1 = GetPixel<T>(sourceData, 0, y * 2 + 1, 0, sourceRowPitch, sourceDepthPitch);
+ T *dst = GetPixel<T>(destData, 0, y, 0, destRowPitch, destDepthPitch);
-typedef A8L8 R8G8; // R8G8 type is functionally equivalent for mip purposes
+ T::average(dst, src0, src1);
+ }
+}
-struct A8R8G8B8
+template <typename T>
+static void GenerateMip_X(unsigned int sourceWidth, unsigned int sourceHeight, unsigned int sourceDepth,
+ const unsigned char *sourceData, int sourceRowPitch, int sourceDepthPitch,
+ unsigned int destWidth, unsigned int destHeight, unsigned int destDepth,
+ unsigned char *destData, int destRowPitch, int destDepthPitch)
{
- unsigned char B;
- unsigned char G;
- unsigned char R;
- unsigned char A;
+ ASSERT(sourceWidth > 1);
+ ASSERT(sourceHeight == 1);
+ ASSERT(sourceDepth == 1);
- static void average(A8R8G8B8 *dst, const A8R8G8B8 *src1, const A8R8G8B8 *src2)
+ for (unsigned int x = 0; x < destWidth; x++)
{
- *(unsigned int*)dst = (((*(unsigned int*)src1 ^ *(unsigned int*)src2) & 0xFEFEFEFE) >> 1) + (*(unsigned int*)src1 & *(unsigned int*)src2);
- }
-};
+ const T *src0 = GetPixel<T>(sourceData, x * 2, 0, 0, sourceRowPitch, sourceDepthPitch);
+ const T *src1 = GetPixel<T>(sourceData, x * 2 + 1, 0, 0, sourceRowPitch, sourceDepthPitch);
+ T *dst = GetPixel<T>(destData, x, 0, 0, destRowPitch, destDepthPitch);
-typedef A8R8G8B8 R8G8B8A8; // R8G8B8A8 type is functionally equivalent for mip purposes
+ T::average(dst, src0, src1);
+ }
+}
-struct A16B16G16R16F
+template <typename T>
+static void GenerateMip_Z(unsigned int sourceWidth, unsigned int sourceHeight, unsigned int sourceDepth,
+ const unsigned char *sourceData, int sourceRowPitch, int sourceDepthPitch,
+ unsigned int destWidth, unsigned int destHeight, unsigned int destDepth,
+ unsigned char *destData, int destRowPitch, int destDepthPitch)
{
- unsigned short R;
- unsigned short G;
- unsigned short B;
- unsigned short A;
+ ASSERT(sourceWidth == 1);
+ ASSERT(sourceHeight == 1);
+ ASSERT(sourceDepth > 1);
- static void average(A16B16G16R16F *dst, const A16B16G16R16F *src1, const A16B16G16R16F *src2)
+ for (unsigned int z = 0; z < destDepth; z++)
{
- dst->R = gl::float32ToFloat16((gl::float16ToFloat32(src1->R) + gl::float16ToFloat32(src2->R)) * 0.5f);
- dst->G = gl::float32ToFloat16((gl::float16ToFloat32(src1->G) + gl::float16ToFloat32(src2->G)) * 0.5f);
- dst->B = gl::float32ToFloat16((gl::float16ToFloat32(src1->B) + gl::float16ToFloat32(src2->B)) * 0.5f);
- dst->A = gl::float32ToFloat16((gl::float16ToFloat32(src1->A) + gl::float16ToFloat32(src2->A)) * 0.5f);
+ const T *src0 = GetPixel<T>(sourceData, 0, 0, z * 2, sourceRowPitch, sourceDepthPitch);
+ const T *src1 = GetPixel<T>(sourceData, 0, 0, z * 2 + 1, sourceRowPitch, sourceDepthPitch);
+ T *dst = GetPixel<T>(destData, 0, 0, z, destRowPitch, destDepthPitch);
+
+ T::average(dst, src0, src1);
}
-};
+}
-struct R16F
+template <typename T>
+static void GenerateMip_XY(unsigned int sourceWidth, unsigned int sourceHeight, unsigned int sourceDepth,
+ const unsigned char *sourceData, int sourceRowPitch, int sourceDepthPitch,
+ unsigned int destWidth, unsigned int destHeight, unsigned int destDepth,
+ unsigned char *destData, int destRowPitch, int destDepthPitch)
{
- unsigned short R;
+ ASSERT(sourceWidth > 1);
+ ASSERT(sourceHeight > 1);
+ ASSERT(sourceDepth == 1);
- static void average(R16F *dst, const R16F *src1, const R16F *src2)
+ for (unsigned int y = 0; y < destHeight; y++)
{
- dst->R = gl::float32ToFloat16((gl::float16ToFloat32(src1->R) + gl::float16ToFloat32(src2->R)) * 0.5f);
- }
-};
+ for (unsigned int x = 0; x < destWidth; x++)
+ {
+ const T *src0 = GetPixel<T>(sourceData, x * 2, y * 2, 0, sourceRowPitch, sourceDepthPitch);
+ const T *src1 = GetPixel<T>(sourceData, x * 2, y * 2 + 1, 0, sourceRowPitch, sourceDepthPitch);
+ const T *src2 = GetPixel<T>(sourceData, x * 2 + 1, y * 2, 0, sourceRowPitch, sourceDepthPitch);
+ const T *src3 = GetPixel<T>(sourceData, x * 2 + 1, y * 2 + 1, 0, sourceRowPitch, sourceDepthPitch);
+ T *dst = GetPixel<T>(destData, x, y, 0, destRowPitch, destDepthPitch);
-struct R16G16F
-{
- unsigned short R;
- unsigned short G;
+ T tmp0, tmp1;
- static void average(R16G16F *dst, const R16G16F *src1, const R16G16F *src2)
- {
- dst->R = gl::float32ToFloat16((gl::float16ToFloat32(src1->R) + gl::float16ToFloat32(src2->R)) * 0.5f);
- dst->G = gl::float32ToFloat16((gl::float16ToFloat32(src1->G) + gl::float16ToFloat32(src2->G)) * 0.5f);
+ T::average(&tmp0, src0, src1);
+ T::average(&tmp1, src2, src3);
+ T::average(dst, &tmp0, &tmp1);
+ }
}
-};
+}
-struct A32B32G32R32F
+template <typename T>
+static void GenerateMip_YZ(unsigned int sourceWidth, unsigned int sourceHeight, unsigned int sourceDepth,
+ const unsigned char *sourceData, int sourceRowPitch, int sourceDepthPitch,
+ unsigned int destWidth, unsigned int destHeight, unsigned int destDepth,
+ unsigned char *destData, int destRowPitch, int destDepthPitch)
{
- float R;
- float G;
- float B;
- float A;
+ ASSERT(sourceWidth == 1);
+ ASSERT(sourceHeight > 1);
+ ASSERT(sourceDepth > 1);
- static void average(A32B32G32R32F *dst, const A32B32G32R32F *src1, const A32B32G32R32F *src2)
+ for (unsigned int z = 0; z < destDepth; z++)
{
- dst->R = (src1->R + src2->R) * 0.5f;
- dst->G = (src1->G + src2->G) * 0.5f;
- dst->B = (src1->B + src2->B) * 0.5f;
- dst->A = (src1->A + src2->A) * 0.5f;
- }
-};
+ for (unsigned int y = 0; y < destHeight; y++)
+ {
+ const T *src0 = GetPixel<T>(sourceData, 0, y * 2, z * 2, sourceRowPitch, sourceDepthPitch);
+ const T *src1 = GetPixel<T>(sourceData, 0, y * 2, z * 2 + 1, sourceRowPitch, sourceDepthPitch);
+ const T *src2 = GetPixel<T>(sourceData, 0, y * 2 + 1, z * 2, sourceRowPitch, sourceDepthPitch);
+ const T *src3 = GetPixel<T>(sourceData, 0, y * 2 + 1, z * 2 + 1, sourceRowPitch, sourceDepthPitch);
+ T *dst = GetPixel<T>(destData, 0, y, z, destRowPitch, destDepthPitch);
-struct R32F
-{
- float R;
+ T tmp0, tmp1;
- static void average(R32F *dst, const R32F *src1, const R32F *src2)
- {
- dst->R = (src1->R + src2->R) * 0.5f;
+ T::average(&tmp0, src0, src1);
+ T::average(&tmp1, src2, src3);
+ T::average(dst, &tmp0, &tmp1);
+ }
}
-};
+}
-struct R32G32F
+template <typename T>
+static void GenerateMip_XZ(unsigned int sourceWidth, unsigned int sourceHeight, unsigned int sourceDepth,
+ const unsigned char *sourceData, int sourceRowPitch, int sourceDepthPitch,
+ unsigned int destWidth, unsigned int destHeight, unsigned int destDepth,
+ unsigned char *destData, int destRowPitch, int destDepthPitch)
{
- float R;
- float G;
+ ASSERT(sourceWidth > 1);
+ ASSERT(sourceHeight == 1);
+ ASSERT(sourceDepth > 1);
- static void average(R32G32F *dst, const R32G32F *src1, const R32G32F *src2)
+ for (unsigned int z = 0; z < destDepth; z++)
{
- dst->R = (src1->R + src2->R) * 0.5f;
- dst->G = (src1->G + src2->G) * 0.5f;
- }
-};
+ for (unsigned int x = 0; x < destWidth; x++)
+ {
+ const T *src0 = GetPixel<T>(sourceData, x * 2, 0, z * 2, sourceRowPitch, sourceDepthPitch);
+ const T *src1 = GetPixel<T>(sourceData, x * 2, 0, z * 2 + 1, sourceRowPitch, sourceDepthPitch);
+ const T *src2 = GetPixel<T>(sourceData, x * 2 + 1, 0, z * 2, sourceRowPitch, sourceDepthPitch);
+ const T *src3 = GetPixel<T>(sourceData, x * 2 + 1, 0, z * 2 + 1, sourceRowPitch, sourceDepthPitch);
+ T *dst = GetPixel<T>(destData, x, 0, z, destRowPitch, destDepthPitch);
-struct R32G32B32F
-{
- float R;
- float G;
- float B;
+ T tmp0, tmp1;
- static void average(R32G32B32F *dst, const R32G32B32F *src1, const R32G32B32F *src2)
- {
- dst->R = (src1->R + src2->R) * 0.5f;
- dst->G = (src1->G + src2->G) * 0.5f;
- dst->B = (src1->B + src2->B) * 0.5f;
+ T::average(&tmp0, src0, src1);
+ T::average(&tmp1, src2, src3);
+ T::average(dst, &tmp0, &tmp1);
+ }
}
-};
+}
template <typename T>
-static void GenerateMip(unsigned int sourceWidth, unsigned int sourceHeight,
- const unsigned char *sourceData, int sourcePitch,
- unsigned char *destData, int destPitch)
+static void GenerateMip_XYZ(unsigned int sourceWidth, unsigned int sourceHeight, unsigned int sourceDepth,
+ const unsigned char *sourceData, int sourceRowPitch, int sourceDepthPitch,
+ unsigned int destWidth, unsigned int destHeight, unsigned int destDepth,
+ unsigned char *destData, int destRowPitch, int destDepthPitch)
{
- unsigned int mipWidth = std::max(1U, sourceWidth >> 1);
- unsigned int mipHeight = std::max(1U, sourceHeight >> 1);
+ ASSERT(sourceWidth > 1);
+ ASSERT(sourceHeight > 1);
+ ASSERT(sourceDepth > 1);
- if (sourceHeight == 1)
+ for (unsigned int z = 0; z < destDepth; z++)
{
- ASSERT(sourceWidth != 1);
-
- const T *src = (const T*)sourceData;
- T *dst = (T*)destData;
-
- for (unsigned int x = 0; x < mipWidth; x++)
+ for (unsigned int y = 0; y < destHeight; y++)
{
- T::average(&dst[x], &src[x * 2], &src[x * 2 + 1]);
+ for (unsigned int x = 0; x < destWidth; x++)
+ {
+ const T *src0 = GetPixel<T>(sourceData, x * 2, y * 2, z * 2, sourceRowPitch, sourceDepthPitch);
+ const T *src1 = GetPixel<T>(sourceData, x * 2, y * 2, z * 2 + 1, sourceRowPitch, sourceDepthPitch);
+ const T *src2 = GetPixel<T>(sourceData, x * 2, y * 2 + 1, z * 2, sourceRowPitch, sourceDepthPitch);
+ const T *src3 = GetPixel<T>(sourceData, x * 2, y * 2 + 1, z * 2 + 1, sourceRowPitch, sourceDepthPitch);
+ const T *src4 = GetPixel<T>(sourceData, x * 2 + 1, y * 2, z * 2, sourceRowPitch, sourceDepthPitch);
+ const T *src5 = GetPixel<T>(sourceData, x * 2 + 1, y * 2, z * 2 + 1, sourceRowPitch, sourceDepthPitch);
+ const T *src6 = GetPixel<T>(sourceData, x * 2 + 1, y * 2 + 1, z * 2, sourceRowPitch, sourceDepthPitch);
+ const T *src7 = GetPixel<T>(sourceData, x * 2 + 1, y * 2 + 1, z * 2 + 1, sourceRowPitch, sourceDepthPitch);
+ T *dst = GetPixel<T>(destData, x, y, z, destRowPitch, destDepthPitch);
+
+ T tmp0, tmp1, tmp2, tmp3, tmp4, tmp5;
+
+ T::average(&tmp0, src0, src1);
+ T::average(&tmp1, src2, src3);
+ T::average(&tmp2, src4, src5);
+ T::average(&tmp3, src6, src7);
+
+ T::average(&tmp4, &tmp0, &tmp1);
+ T::average(&tmp5, &tmp2, &tmp3);
+
+ T::average(dst, &tmp4, &tmp5);
+ }
}
}
- else if (sourceWidth == 1)
- {
- ASSERT(sourceHeight != 1);
+}
- for (unsigned int y = 0; y < mipHeight; y++)
- {
- const T *src0 = (const T*)(sourceData + y * 2 * sourcePitch);
- const T *src1 = (const T*)(sourceData + y * 2 * sourcePitch + sourcePitch);
- T *dst = (T*)(destData + y * destPitch);
- T::average(dst, src0, src1);
- }
- }
- else
- {
- for (unsigned int y = 0; y < mipHeight; y++)
- {
- const T *src0 = (const T*)(sourceData + y * 2 * sourcePitch);
- const T *src1 = (const T*)(sourceData + y * 2 * sourcePitch + sourcePitch);
- T *dst = (T*)(destData + y * destPitch);
+typedef void (*MipGenerationFunction)(unsigned int sourceWidth, unsigned int sourceHeight, unsigned int sourceDepth,
+ const unsigned char *sourceData, int sourceRowPitch, int sourceDepthPitch,
+ unsigned int destWidth, unsigned int destHeight, unsigned int destDepth,
+ unsigned char *destData, int destRowPitch, int destDepthPitch);
- for (unsigned int x = 0; x < mipWidth; x++)
- {
- T tmp0;
- T tmp1;
+template <typename T>
+static MipGenerationFunction GetMipGenerationFunction(unsigned int sourceWidth, unsigned int sourceHeight, unsigned int sourceDepth)
+{
+ unsigned char index = ((sourceWidth > 1) ? 1 : 0) |
+ ((sourceHeight > 1) ? 2 : 0) |
+ ((sourceDepth > 1) ? 4 : 0);
- T::average(&tmp0, &src0[x * 2], &src0[x * 2 + 1]);
- T::average(&tmp1, &src1[x * 2], &src1[x * 2 + 1]);
- T::average(&dst[x], &tmp0, &tmp1);
- }
- }
+ switch (index)
+ {
+ case 1: return GenerateMip_X<T>; // W x 1 x 1
+ case 2: return GenerateMip_Y<T>; // 1 x H x 1
+ case 3: return GenerateMip_XY<T>; // W x H x 1
+ case 4: return GenerateMip_Z<T>; // 1 x 1 x D
+ case 5: return GenerateMip_XZ<T>; // W x 1 x D
+ case 6: return GenerateMip_YZ<T>; // 1 x H x D
+ case 7: return GenerateMip_XYZ<T>; // W x H x D
+ default: return NULL;
}
}
+
+}
+
+template <typename T>
+static void GenerateMip(unsigned int sourceWidth, unsigned int sourceHeight, unsigned int sourceDepth,
+ const unsigned char *sourceData, int sourceRowPitch, int sourceDepthPitch,
+ unsigned char *destData, int destRowPitch, int destDepthPitch)
+{
+ unsigned int mipWidth = std::max(1U, sourceWidth >> 1);
+ unsigned int mipHeight = std::max(1U, sourceHeight >> 1);
+ unsigned int mipDepth = std::max(1U, sourceDepth >> 1);
+
+ priv::MipGenerationFunction generationFunction = priv::GetMipGenerationFunction<T>(sourceWidth, sourceHeight, sourceDepth);
+ ASSERT(generationFunction != NULL);
+
+ generationFunction(sourceWidth, sourceHeight, sourceDepth, sourceData, sourceRowPitch, sourceDepthPitch,
+ mipWidth, mipHeight, mipDepth, destData, destRowPitch, destDepthPitch);
+}
+
}
#endif // LIBGLESV2_RENDERER_GENERATEMIP_H_
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/imageformats.h b/chromium/third_party/angle/src/libGLESv2/renderer/imageformats.h
new file mode 100644
index 00000000000..1fd93fe56e1
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/imageformats.h
@@ -0,0 +1,2029 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// imageformats.h: Defines image format types with functions for mip generation
+// and copying.
+
+#ifndef LIBGLESV2_RENDERER_IMAGEFORMATS_H_
+#define LIBGLESV2_RENDERER_IMAGEFORMATS_H_
+
+#include "libGLESv2/angletypes.h"
+
+namespace rx
+{
+
+// Several structures share functionality for reading, writing or mipmapping but the layout
+// must match the texture format which the structure represents. If collapsing or typedefing
+// structs in this header, make sure the functionality and memory layout is exactly the same.
+
+struct L8
+{
+ unsigned char L;
+
+ static void readColor(gl::ColorF *dst, const L8 *src)
+ {
+ const float lum = gl::normalizedToFloat(src->L);
+ dst->red = lum;
+ dst->green = lum;
+ dst->blue = lum;
+ dst->alpha = 1.0f;
+ }
+
+ static void writeColor(L8 *dst, const gl::ColorF *src)
+ {
+ dst->L = gl::floatToNormalized<unsigned char>((src->red + src->green + src->blue) / 3.0f);
+ }
+
+ static void average(L8 *dst, const L8 *src1, const L8 *src2)
+ {
+ dst->L = gl::average(src1->L, src2->L);
+ }
+};
+
+struct R8
+{
+ unsigned char R;
+
+ static void readColor(gl::ColorF *dst, const R8 *src)
+ {
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = 0.0f;
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+ }
+
+ static void readColor(gl::ColorUI *dst, const R8 *src)
+ {
+ dst->red = src->R;
+ dst->green = 0;
+ dst->blue = 0;
+ dst->alpha = 1;
+ }
+
+ static void writeColor(R8 *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<unsigned char>(src->red);
+ }
+
+ static void writeColor(R8 *dst, const gl::ColorUI *src)
+ {
+ dst->R = static_cast<unsigned char>(src->red);
+ }
+
+ static void average(R8 *dst, const R8 *src1, const R8 *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ }
+};
+
+struct A8
+{
+ unsigned char A;
+
+ static void readColor(gl::ColorF *dst, const A8 *src)
+ {
+ dst->red = 0.0f;
+ dst->green = 0.0f;
+ dst->blue = 0.0f;
+ dst->alpha = gl::normalizedToFloat(src->A);
+ }
+
+ static void writeColor(A8 *dst, const gl::ColorF *src)
+ {
+ dst->A = gl::floatToNormalized<unsigned char>(src->alpha);
+ }
+
+ static void average(A8 *dst, const A8 *src1, const A8 *src2)
+ {
+ dst->A = gl::average(src1->A, src2->A);
+ }
+};
+
+struct L8A8
+{
+ unsigned char L;
+ unsigned char A;
+
+ static void readColor(gl::ColorF *dst, const L8A8 *src)
+ {
+ const float lum = gl::normalizedToFloat(src->L);
+ dst->red = lum;
+ dst->green = lum;
+ dst->blue = lum;
+ dst->alpha = gl::normalizedToFloat(src->A);
+ }
+
+ static void writeColor(L8A8 *dst, const gl::ColorF *src)
+ {
+ dst->L = gl::floatToNormalized<unsigned char>((src->red + src->green + src->blue) / 3.0f);
+ dst->A = gl::floatToNormalized<unsigned char>(src->alpha);
+ }
+
+ static void average(L8A8 *dst, const L8A8 *src1, const L8A8 *src2)
+ {
+ *(unsigned short*)dst = (((*(unsigned short*)src1 ^ *(unsigned short*)src2) & 0xFEFE) >> 1) + (*(unsigned short*)src1 & *(unsigned short*)src2);
+ }
+};
+
+struct A8L8
+{
+ unsigned char A;
+ unsigned char L;
+
+ static void readColor(gl::ColorF *dst, const A8L8 *src)
+ {
+ const float lum = gl::normalizedToFloat(src->L);
+ dst->red = lum;
+ dst->green = lum;
+ dst->blue = lum;
+ dst->alpha = gl::normalizedToFloat(src->A);
+ }
+
+ static void writeColor(A8L8 *dst, const gl::ColorF *src)
+ {
+ dst->L = gl::floatToNormalized<unsigned char>((src->red + src->green + src->blue) / 3.0f);
+ dst->A = gl::floatToNormalized<unsigned char>(src->alpha);
+ }
+
+ static void average(A8L8 *dst, const A8L8 *src1, const A8L8 *src2)
+ {
+ *(unsigned short*)dst = (((*(unsigned short*)src1 ^ *(unsigned short*)src2) & 0xFEFE) >> 1) + (*(unsigned short*)src1 & *(unsigned short*)src2);
+ }
+};
+
+struct R8G8
+{
+ unsigned char R;
+ unsigned char G;
+
+ static void readColor(gl::ColorF *dst, const R8G8 *src)
+ {
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+ }
+
+ static void readColor(gl::ColorUI *dst, const R8G8 *src)
+ {
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = 0;
+ dst->alpha = 1;
+ }
+
+ static void writeColor(R8G8 *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<unsigned char>(src->red);
+ dst->G = gl::floatToNormalized<unsigned char>(src->green);
+ }
+
+ static void writeColor(R8G8 *dst, const gl::ColorUI *src)
+ {
+ dst->R = static_cast<unsigned char>(src->red);
+ dst->G = static_cast<unsigned char>(src->green);
+ }
+
+ static void average(R8G8 *dst, const R8G8 *src1, const R8G8 *src2)
+ {
+ *(unsigned short*)dst = (((*(unsigned short*)src1 ^ *(unsigned short*)src2) & 0xFEFE) >> 1) + (*(unsigned short*)src1 & *(unsigned short*)src2);
+ }
+};
+
+struct R8G8B8
+{
+ unsigned char R;
+ unsigned char G;
+ unsigned char B;
+
+ static void readColor(gl::ColorF *dst, const R8G8B8 *src)
+ {
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = 1.0f;
+ }
+
+ static void readColor(gl::ColorUI *dst, const R8G8B8 *src)
+ {
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->G;
+ dst->alpha = 1;
+ }
+
+ static void writeColor(R8G8B8 *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<unsigned char>(src->red);
+ dst->G = gl::floatToNormalized<unsigned char>(src->green);
+ dst->B = gl::floatToNormalized<unsigned char>(src->blue);
+ }
+
+ static void writeColor(R8G8B8 *dst, const gl::ColorUI *src)
+ {
+ dst->R = static_cast<unsigned char>(src->red);
+ dst->G = static_cast<unsigned char>(src->green);
+ dst->B = static_cast<unsigned char>(src->blue);
+ }
+
+ static void average(R8G8B8 *dst, const R8G8B8 *src1, const R8G8B8 *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+ }
+};
+
+struct B8G8R8
+{
+ unsigned char B;
+ unsigned char G;
+ unsigned char R;
+
+ static void readColor(gl::ColorF *dst, const B8G8R8 *src)
+ {
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = 1.0f;
+ }
+
+ static void readColor(gl::ColorUI *dst, const B8G8R8 *src)
+ {
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->G;
+ dst->alpha = 1;
+ }
+
+ static void writeColor(B8G8R8 *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<unsigned char>(src->red);
+ dst->G = gl::floatToNormalized<unsigned char>(src->green);
+ dst->B = gl::floatToNormalized<unsigned char>(src->blue);
+ }
+
+ static void writeColor(B8G8R8 *dst, const gl::ColorUI *src)
+ {
+ dst->R = static_cast<unsigned char>(src->red);
+ dst->G = static_cast<unsigned char>(src->green);
+ dst->B = static_cast<unsigned char>(src->blue);
+ }
+
+ static void average(B8G8R8 *dst, const B8G8R8 *src1, const B8G8R8 *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+ }
+};
+
+struct R5G6B5
+{
+ unsigned short RGB;
+
+ static void readColor(gl::ColorF *dst, const R5G6B5 *src)
+ {
+ dst->red = gl::normalizedToFloat<5>(gl::getShiftedData<5, 11>(src->RGB));
+ dst->green = gl::normalizedToFloat<6>(gl::getShiftedData<6, 5>(src->RGB));
+ dst->blue = gl::normalizedToFloat<5>(gl::getShiftedData<5, 0>(src->RGB));
+ dst->alpha = 1.0f;
+ }
+
+ static void writeColor(R5G6B5 *dst, const gl::ColorF *src)
+ {
+ dst->RGB = gl::shiftData<5, 11>(gl::floatToNormalized<5, unsigned short>(src->red)) |
+ gl::shiftData<6, 5>(gl::floatToNormalized<6, unsigned short>(src->green)) |
+ gl::shiftData<5, 0>(gl::floatToNormalized<5, unsigned short>(src->blue));
+ }
+
+ static void average(R5G6B5 *dst, const R5G6B5 *src1, const R5G6B5 *src2)
+ {
+ dst->RGB = gl::shiftData<5, 11>(gl::average(gl::getShiftedData<5, 11>(src1->RGB), gl::getShiftedData<5, 11>(src2->RGB))) |
+ gl::shiftData<6, 5>(gl::average(gl::getShiftedData<6, 5>(src1->RGB), gl::getShiftedData<6, 5>(src2->RGB))) |
+ gl::shiftData<5, 0>(gl::average(gl::getShiftedData<5, 0>(src1->RGB), gl::getShiftedData<5, 0>(src2->RGB)));
+ }
+};
+
+struct A8R8G8B8
+{
+ unsigned char A;
+ unsigned char R;
+ unsigned char G;
+ unsigned char B;
+
+ static void readColor(gl::ColorF *dst, const A8R8G8B8 *src)
+ {
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = gl::normalizedToFloat(src->A);
+ }
+
+ static void readColor(gl::ColorUI *dst, const A8R8G8B8 *src)
+ {
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = src->A;
+ }
+
+ static void writeColor(A8R8G8B8 *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<unsigned char>(src->red);
+ dst->G = gl::floatToNormalized<unsigned char>(src->green);
+ dst->B = gl::floatToNormalized<unsigned char>(src->blue);
+ dst->A = gl::floatToNormalized<unsigned char>(src->alpha);
+ }
+
+ static void writeColor(A8R8G8B8 *dst, const gl::ColorUI *src)
+ {
+ dst->R = static_cast<unsigned char>(src->red);
+ dst->G = static_cast<unsigned char>(src->green);
+ dst->B = static_cast<unsigned char>(src->blue);
+ dst->A = static_cast<unsigned char>(src->alpha);
+ }
+
+ static void average(A8R8G8B8 *dst, const A8R8G8B8 *src1, const A8R8G8B8 *src2)
+ {
+ *(unsigned int*)dst = (((*(unsigned int*)src1 ^ *(unsigned int*)src2) & 0xFEFEFEFE) >> 1) + (*(unsigned int*)src1 & *(unsigned int*)src2);
+ }
+};
+
+struct R8G8B8A8
+{
+ unsigned char R;
+ unsigned char G;
+ unsigned char B;
+ unsigned char A;
+
+ static void readColor(gl::ColorF *dst, const R8G8B8A8 *src)
+ {
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = gl::normalizedToFloat(src->A);
+ }
+
+ static void readColor(gl::ColorUI *dst, const R8G8B8A8 *src)
+ {
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = src->A;
+ }
+
+ static void writeColor(R8G8B8A8 *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<unsigned char>(src->red);
+ dst->G = gl::floatToNormalized<unsigned char>(src->green);
+ dst->B = gl::floatToNormalized<unsigned char>(src->blue);
+ dst->A = gl::floatToNormalized<unsigned char>(src->alpha);
+ }
+
+ static void writeColor(R8G8B8A8 *dst, const gl::ColorUI *src)
+ {
+ dst->R = static_cast<unsigned char>(src->red);
+ dst->G = static_cast<unsigned char>(src->green);
+ dst->B = static_cast<unsigned char>(src->blue);
+ dst->A = static_cast<unsigned char>(src->alpha);
+ }
+
+ static void average(R8G8B8A8 *dst, const R8G8B8A8 *src1, const R8G8B8A8 *src2)
+ {
+ *(unsigned int*)dst = (((*(unsigned int*)src1 ^ *(unsigned int*)src2) & 0xFEFEFEFE) >> 1) + (*(unsigned int*)src1 & *(unsigned int*)src2);
+ }
+};
+
+struct B8G8R8A8
+{
+ unsigned char B;
+ unsigned char G;
+ unsigned char R;
+ unsigned char A;
+
+ static void readColor(gl::ColorF *dst, const B8G8R8A8 *src)
+ {
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = gl::normalizedToFloat(src->A);
+ }
+
+ static void readColor(gl::ColorUI *dst, const B8G8R8A8 *src)
+ {
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = src->A;
+ }
+
+ static void writeColor(B8G8R8A8 *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<unsigned char>(src->red);
+ dst->G = gl::floatToNormalized<unsigned char>(src->green);
+ dst->B = gl::floatToNormalized<unsigned char>(src->blue);
+ dst->A = gl::floatToNormalized<unsigned char>(src->alpha);
+ }
+
+ static void writeColor(B8G8R8A8 *dst, const gl::ColorUI *src)
+ {
+ dst->R = static_cast<unsigned char>(src->red);
+ dst->G = static_cast<unsigned char>(src->green);
+ dst->B = static_cast<unsigned char>(src->blue);
+ dst->A = static_cast<unsigned char>(src->alpha);
+ }
+
+ static void average(B8G8R8A8 *dst, const B8G8R8A8 *src1, const B8G8R8A8 *src2)
+ {
+ *(unsigned int*)dst = (((*(unsigned int*)src1 ^ *(unsigned int*)src2) & 0xFEFEFEFE) >> 1) + (*(unsigned int*)src1 & *(unsigned int*)src2);
+ }
+};
+
+struct B8G8R8X8
+{
+ unsigned char B;
+ unsigned char G;
+ unsigned char R;
+ unsigned char X;
+
+ static void readColor(gl::ColorF *dst, const B8G8R8X8 *src)
+ {
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = 1.0f;
+ }
+
+ static void readColor(gl::ColorUI *dst, const B8G8R8X8 *src)
+ {
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = 1;
+ }
+
+ static void writeColor(B8G8R8X8 *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<unsigned char>(src->red);
+ dst->G = gl::floatToNormalized<unsigned char>(src->green);
+ dst->B = gl::floatToNormalized<unsigned char>(src->blue);
+ dst->X = 255;
+ }
+
+ static void writeColor(B8G8R8X8 *dst, const gl::ColorUI *src)
+ {
+ dst->R = static_cast<unsigned char>(src->red);
+ dst->G = static_cast<unsigned char>(src->green);
+ dst->B = static_cast<unsigned char>(src->blue);
+ dst->X = 255;
+ }
+
+ static void average(B8G8R8X8 *dst, const B8G8R8X8 *src1, const B8G8R8X8 *src2)
+ {
+ *(unsigned int*)dst = (((*(unsigned int*)src1 ^ *(unsigned int*)src2) & 0xFEFEFEFE) >> 1) + (*(unsigned int*)src1 & *(unsigned int*)src2);
+ dst->X = 255;
+ }
+};
+
+struct B5G5R5A1
+{
+ unsigned short BGRA;
+
+ static void readColor(gl::ColorF *dst, const B5G5R5A1 *src)
+ {
+ dst->alpha = gl::normalizedToFloat<1>(gl::getShiftedData<1, 15>(src->BGRA));
+ dst->red = gl::normalizedToFloat<5>(gl::getShiftedData<5, 10>(src->BGRA));
+ dst->green = gl::normalizedToFloat<5>(gl::getShiftedData<5, 5>(src->BGRA));
+ dst->blue = gl::normalizedToFloat<5>(gl::getShiftedData<5, 0>(src->BGRA));
+ }
+
+ static void writeColor(B5G5R5A1 *dst, const gl::ColorF *src)
+ {
+ dst->BGRA = gl::shiftData<1, 15>(gl::floatToNormalized<1, unsigned short>(src->alpha)) |
+ gl::shiftData<5, 10>(gl::floatToNormalized<5, unsigned short>(src->red)) |
+ gl::shiftData<5, 5>(gl::floatToNormalized<5, unsigned short>(src->green)) |
+ gl::shiftData<5, 0>(gl::floatToNormalized<5, unsigned short>(src->blue));
+ }
+
+ static void average(B5G5R5A1 *dst, const B5G5R5A1 *src1, const B5G5R5A1 *src2)
+ {
+ dst->BGRA = gl::shiftData<1, 15>(gl::average(gl::getShiftedData<1, 15>(src1->BGRA), gl::getShiftedData<1, 15>(src2->BGRA))) |
+ gl::shiftData<5, 10>(gl::average(gl::getShiftedData<5, 10>(src1->BGRA), gl::getShiftedData<5, 10>(src2->BGRA))) |
+ gl::shiftData<5, 5>(gl::average(gl::getShiftedData<5, 5>(src1->BGRA), gl::getShiftedData<5, 5>(src2->BGRA))) |
+ gl::shiftData<5, 0>(gl::average(gl::getShiftedData<5, 0>(src1->BGRA), gl::getShiftedData<5, 0>(src2->BGRA)));
+ }
+};
+
+struct R5G5B5A1
+{
+ unsigned short RGBA;
+
+ static void readColor(gl::ColorF *dst, const R5G5B5A1 *src)
+ {
+ dst->alpha = gl::normalizedToFloat<1>(gl::getShiftedData<1, 15>(src->RGBA));
+ dst->blue = gl::normalizedToFloat<5>(gl::getShiftedData<5, 10>(src->RGBA));
+ dst->green = gl::normalizedToFloat<5>(gl::getShiftedData<5, 5>(src->RGBA));
+ dst->red = gl::normalizedToFloat<5>(gl::getShiftedData<5, 0>(src->RGBA));
+ }
+
+ static void writeColor(R5G5B5A1 *dst, const gl::ColorF *src)
+ {
+ dst->RGBA = gl::shiftData<1, 15>(gl::floatToNormalized<1, unsigned short>(src->alpha)) |
+ gl::shiftData<5, 10>(gl::floatToNormalized<5, unsigned short>(src->blue)) |
+ gl::shiftData<5, 5>(gl::floatToNormalized<5, unsigned short>(src->green)) |
+ gl::shiftData<5, 0>(gl::floatToNormalized<5, unsigned short>(src->red));
+ }
+
+ static void average(R5G5B5A1 *dst, const R5G5B5A1 *src1, const R5G5B5A1 *src2)
+ {
+ dst->RGBA = gl::shiftData<1, 15>(gl::average(gl::getShiftedData<1, 15>(src1->RGBA), gl::getShiftedData<1, 15>(src2->RGBA))) |
+ gl::shiftData<5, 10>(gl::average(gl::getShiftedData<5, 10>(src1->RGBA), gl::getShiftedData<5, 10>(src2->RGBA))) |
+ gl::shiftData<5, 5>(gl::average(gl::getShiftedData<5, 5>(src1->RGBA), gl::getShiftedData<5, 5>(src2->RGBA))) |
+ gl::shiftData<5, 0>(gl::average(gl::getShiftedData<5, 0>(src1->RGBA), gl::getShiftedData<5, 0>(src2->RGBA)));
+ }
+};
+
+struct R4G4B4A4
+{
+ unsigned char R : 4;
+ unsigned char G : 4;
+ unsigned char B : 4;
+ unsigned char A : 4;
+
+ static void readColor(gl::ColorF *dst, const R4G4B4A4 *src)
+ {
+ dst->red = gl::normalizedToFloat<4>(src->R);
+ dst->green = gl::normalizedToFloat<4>(src->G);
+ dst->blue = gl::normalizedToFloat<4>(src->B);
+ dst->alpha = gl::normalizedToFloat<4>(src->A);
+ }
+
+ static void writeColor(R4G4B4A4 *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<4, unsigned char>(src->red);
+ dst->G = gl::floatToNormalized<4, unsigned char>(src->green);
+ dst->B = gl::floatToNormalized<4, unsigned char>(src->blue);
+ dst->A = gl::floatToNormalized<4, unsigned char>(src->alpha);
+ }
+
+ static void average(R4G4B4A4 *dst, const R4G4B4A4 *src1, const R4G4B4A4 *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+ dst->A = gl::average(src1->A, src2->A);
+ }
+};
+
+struct A4R4G4B4
+{
+ unsigned char A : 4;
+ unsigned char R : 4;
+ unsigned char G : 4;
+ unsigned char B : 4;
+
+ static void readColor(gl::ColorF *dst, const A4R4G4B4 *src)
+ {
+ dst->red = gl::normalizedToFloat<4>(src->R);
+ dst->green = gl::normalizedToFloat<4>(src->G);
+ dst->blue = gl::normalizedToFloat<4>(src->B);
+ dst->alpha = gl::normalizedToFloat<4>(src->A);
+ }
+
+ static void writeColor(A4R4G4B4 *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<4, unsigned char>(src->red);
+ dst->G = gl::floatToNormalized<4, unsigned char>(src->green);
+ dst->B = gl::floatToNormalized<4, unsigned char>(src->blue);
+ dst->A = gl::floatToNormalized<4, unsigned char>(src->alpha);
+ }
+
+ static void average(A4R4G4B4 *dst, const A4R4G4B4 *src1, const A4R4G4B4 *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+ dst->A = gl::average(src1->A, src2->A);
+ }
+};
+
+struct B4G4R4A4
+{
+ unsigned char B : 4;
+ unsigned char G : 4;
+ unsigned char R : 4;
+ unsigned char A : 4;
+
+ static void readColor(gl::ColorF *dst, const B4G4R4A4 *src)
+ {
+ dst->red = gl::normalizedToFloat<4>(src->R);
+ dst->green = gl::normalizedToFloat<4>(src->G);
+ dst->blue = gl::normalizedToFloat<4>(src->B);
+ dst->alpha = gl::normalizedToFloat<4>(src->A);
+ }
+
+ static void writeColor(B4G4R4A4 *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<4, unsigned char>(src->red);
+ dst->G = gl::floatToNormalized<4, unsigned char>(src->green);
+ dst->B = gl::floatToNormalized<4, unsigned char>(src->blue);
+ dst->A = gl::floatToNormalized<4, unsigned char>(src->alpha);
+ }
+
+ static void average(B4G4R4A4 *dst, const B4G4R4A4 *src1, const B4G4R4A4 *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+ dst->A = gl::average(src1->A, src2->A);
+ }
+};
+
+struct R16
+{
+ unsigned short R;
+
+ static void readColor(gl::ColorF *dst, const R16 *src)
+ {
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = 0.0f;
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+ }
+
+ static void readColor(gl::ColorUI *dst, const R16 *src)
+ {
+ dst->red = src->R;
+ dst->green = 0;
+ dst->blue = 0;
+ dst->alpha = 1;
+ }
+
+ static void writeColor(R16 *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<unsigned short>(src->red);
+ }
+
+ static void writeColor(R16 *dst, const gl::ColorUI *src)
+ {
+ dst->R = static_cast<unsigned short>(src->red);
+ }
+
+ static void average(R16 *dst, const R16 *src1, const R16 *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ }
+};
+
+struct R16G16
+{
+ unsigned short R;
+ unsigned short G;
+
+ static void readColor(gl::ColorF *dst, const R16G16 *src)
+ {
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+ }
+
+ static void readColor(gl::ColorUI *dst, const R16G16 *src)
+ {
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = 0;
+ dst->alpha = 1;
+ }
+
+ static void writeColor(R16G16 *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<unsigned short>(src->red);
+ dst->G = gl::floatToNormalized<unsigned short>(src->green);
+ }
+
+ static void writeColor(R16G16 *dst, const gl::ColorUI *src)
+ {
+ dst->R = static_cast<unsigned short>(src->red);
+ dst->G = static_cast<unsigned short>(src->green);
+ }
+
+ static void average(R16G16 *dst, const R16G16 *src1, const R16G16 *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ }
+};
+
+struct R16G16B16
+{
+ unsigned short R;
+ unsigned short G;
+ unsigned short B;
+
+ static void readColor(gl::ColorF *dst, const R16G16B16 *src)
+ {
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = 1.0f;
+ }
+
+ static void readColor(gl::ColorUI *dst, const R16G16B16 *src)
+ {
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = 1;
+ }
+
+ static void writeColor(R16G16B16 *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<unsigned short>(src->red);
+ dst->G = gl::floatToNormalized<unsigned short>(src->green);
+ dst->B = gl::floatToNormalized<unsigned short>(src->blue);
+ }
+
+ static void writeColor(R16G16B16 *dst, const gl::ColorUI *src)
+ {
+ dst->R = static_cast<unsigned short>(src->red);
+ dst->G = static_cast<unsigned short>(src->green);
+ dst->B = static_cast<unsigned short>(src->blue);
+ }
+
+ static void average(R16G16B16 *dst, const R16G16B16 *src1, const R16G16B16 *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+ }
+};
+
+struct R16G16B16A16
+{
+ unsigned short R;
+ unsigned short G;
+ unsigned short B;
+ unsigned short A;
+
+ static void readColor(gl::ColorF *dst, const R16G16B16A16 *src)
+ {
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = gl::normalizedToFloat(src->A);
+ }
+
+ static void readColor(gl::ColorUI *dst, const R16G16B16A16 *src)
+ {
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = src->A;
+ }
+
+ static void writeColor(R16G16B16A16 *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<unsigned short>(src->red);
+ dst->G = gl::floatToNormalized<unsigned short>(src->green);
+ dst->B = gl::floatToNormalized<unsigned short>(src->blue);
+ dst->A = gl::floatToNormalized<unsigned short>(src->alpha);
+ }
+
+ static void writeColor(R16G16B16A16 *dst, const gl::ColorUI *src)
+ {
+ dst->R = static_cast<unsigned short>(src->red);
+ dst->G = static_cast<unsigned short>(src->green);
+ dst->B = static_cast<unsigned short>(src->blue);
+ dst->A = static_cast<unsigned short>(src->alpha);
+ }
+
+ static void average(R16G16B16A16 *dst, const R16G16B16A16 *src1, const R16G16B16A16 *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+ dst->A = gl::average(src1->A, src2->A);
+ }
+};
+
+struct R32
+{
+ unsigned int R;
+
+ static void readColor(gl::ColorF *dst, const R32 *src)
+ {
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = 0.0f;
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+ }
+
+ static void readColor(gl::ColorUI *dst, const R32 *src)
+ {
+ dst->red = src->R;
+ dst->green = 0;
+ dst->blue = 0;
+ dst->alpha = 1;
+ }
+
+ static void writeColor(R32 *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<unsigned int>(src->red);
+ }
+
+ static void writeColor(R32 *dst, const gl::ColorUI *src)
+ {
+ dst->R = static_cast<unsigned int>(src->red);
+ }
+
+ static void average(R32 *dst, const R32 *src1, const R32 *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ }
+};
+
+struct R32G32
+{
+ unsigned int R;
+ unsigned int G;
+
+ static void readColor(gl::ColorF *dst, const R32G32 *src)
+ {
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+ }
+
+ static void readColor(gl::ColorUI *dst, const R32G32 *src)
+ {
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = 0;
+ dst->alpha = 1;
+ }
+
+ static void writeColor(R32G32 *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<unsigned int>(src->red);
+ dst->G = gl::floatToNormalized<unsigned int>(src->green);
+ }
+
+ static void writeColor(R32G32 *dst, const gl::ColorUI *src)
+ {
+ dst->R = static_cast<unsigned int>(src->red);
+ dst->G = static_cast<unsigned int>(src->green);
+ }
+
+ static void average(R32G32 *dst, const R32G32 *src1, const R32G32 *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ }
+};
+
+struct R32G32B32
+{
+ unsigned int R;
+ unsigned int G;
+ unsigned int B;
+
+ static void readColor(gl::ColorF *dst, const R32G32B32 *src)
+ {
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = 1.0f;
+ }
+
+ static void readColor(gl::ColorUI *dst, const R32G32B32 *src)
+ {
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = 1;
+ }
+
+ static void writeColor(R32G32B32 *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<unsigned int>(src->red);
+ dst->G = gl::floatToNormalized<unsigned int>(src->green);
+ dst->B = gl::floatToNormalized<unsigned int>(src->blue);
+ }
+
+ static void writeColor(R32G32B32 *dst, const gl::ColorUI *src)
+ {
+ dst->R = static_cast<unsigned int>(src->red);
+ dst->G = static_cast<unsigned int>(src->green);
+ dst->B = static_cast<unsigned int>(src->blue);
+ }
+
+ static void average(R32G32B32 *dst, const R32G32B32 *src1, const R32G32B32 *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+ }
+};
+
+struct R32G32B32A32
+{
+ unsigned int R;
+ unsigned int G;
+ unsigned int B;
+ unsigned int A;
+
+ static void readColor(gl::ColorF *dst, const R32G32B32A32 *src)
+ {
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = gl::normalizedToFloat(src->A);
+ }
+
+ static void readColor(gl::ColorUI *dst, const R32G32B32A32 *src)
+ {
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = src->A;
+ }
+
+ static void writeColor(R32G32B32A32 *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<unsigned int>(src->red);
+ dst->G = gl::floatToNormalized<unsigned int>(src->green);
+ dst->B = gl::floatToNormalized<unsigned int>(src->blue);
+ dst->A = gl::floatToNormalized<unsigned int>(src->alpha);
+ }
+
+ static void writeColor(R32G32B32A32 *dst, const gl::ColorUI *src)
+ {
+ dst->R = static_cast<unsigned int>(src->red);
+ dst->G = static_cast<unsigned int>(src->green);
+ dst->B = static_cast<unsigned int>(src->blue);
+ dst->A = static_cast<unsigned int>(src->alpha);
+ }
+
+ static void average(R32G32B32A32 *dst, const R32G32B32A32 *src1, const R32G32B32A32 *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+ dst->A = gl::average(src1->A, src2->A);
+ }
+};
+
+struct R8S
+{
+ char R;
+
+ static void readColor(gl::ColorF *dst, const R8S *src)
+ {
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = 0.0f;
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+ }
+
+ static void readColor(gl::ColorI *dst, const R8S *src)
+ {
+ dst->red = src->R;
+ dst->green = 0;
+ dst->blue = 0;
+ dst->alpha = 1;
+ }
+
+ static void writeColor(R8S *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<char>(src->red);
+ }
+
+ static void writeColor(R8S *dst, const gl::ColorI *src)
+ {
+ dst->R = static_cast<char>(src->red);
+ }
+
+ static void average(R8S *dst, const R8S *src1, const R8S *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ }
+};
+
+struct R8G8S
+{
+ char R;
+ char G;
+
+ static void readColor(gl::ColorF *dst, const R8G8S *src)
+ {
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+ }
+
+ static void readColor(gl::ColorI *dst, const R8G8S *src)
+ {
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = 0;
+ dst->alpha = 1;
+ }
+
+ static void writeColor(R8G8S *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<char>(src->red);
+ dst->G = gl::floatToNormalized<char>(src->green);
+ }
+
+ static void writeColor(R8G8S *dst, const gl::ColorI *src)
+ {
+ dst->R = static_cast<char>(src->red);
+ dst->G = static_cast<char>(src->green);
+ }
+
+ static void average(R8G8S *dst, const R8G8S *src1, const R8G8S *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ }
+};
+
+struct R8G8B8S
+{
+ char R;
+ char G;
+ char B;
+
+ static void readColor(gl::ColorF *dst, const R8G8B8S *src)
+ {
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = 1.0f;
+ }
+
+ static void readColor(gl::ColorI *dst, const R8G8B8S *src)
+ {
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = 1;
+ }
+
+ static void writeColor(R8G8B8S *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<char>(src->red);
+ dst->G = gl::floatToNormalized<char>(src->green);
+ dst->B = gl::floatToNormalized<char>(src->blue);
+ }
+
+ static void writeColor(R8G8B8S *dst, const gl::ColorI *src)
+ {
+ dst->R = static_cast<char>(src->red);
+ dst->G = static_cast<char>(src->green);
+ dst->B = static_cast<char>(src->blue);
+ }
+
+ static void average(R8G8B8S *dst, const R8G8B8S *src1, const R8G8B8S *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+ }
+};
+
+struct R8G8B8A8S
+{
+ char R;
+ char G;
+ char B;
+ char A;
+
+ static void readColor(gl::ColorF *dst, const R8G8B8A8S *src)
+ {
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = gl::normalizedToFloat(src->A);
+ }
+
+ static void readColor(gl::ColorI *dst, const R8G8B8A8S *src)
+ {
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = src->A;
+ }
+
+ static void writeColor(R8G8B8A8S *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<char>(src->red);
+ dst->G = gl::floatToNormalized<char>(src->green);
+ dst->B = gl::floatToNormalized<char>(src->blue);
+ dst->A = gl::floatToNormalized<char>(src->alpha);
+ }
+
+ static void writeColor(R8G8B8A8S *dst, const gl::ColorI *src)
+ {
+ dst->R = static_cast<char>(src->red);
+ dst->G = static_cast<char>(src->green);
+ dst->B = static_cast<char>(src->blue);
+ dst->A = static_cast<char>(src->alpha);
+ }
+
+ static void average(R8G8B8A8S *dst, const R8G8B8A8S *src1, const R8G8B8A8S *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+ dst->A = gl::average(src1->A, src2->A);
+ }
+};
+
+struct R16S
+{
+ short R;
+
+ static void readColor(gl::ColorF *dst, const R16S *src)
+ {
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = 0.0f;
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+ }
+
+ static void readColor(gl::ColorI *dst, const R16S *src)
+ {
+ dst->red = src->R;
+ dst->green = 0;
+ dst->blue = 0;
+ dst->alpha = 1;
+ }
+
+ static void writeColor(R16S *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<short>(src->red);
+ }
+
+ static void writeColor(R16S *dst, const gl::ColorI *src)
+ {
+ dst->R = static_cast<short>(src->red);
+ }
+
+ static void average(R16S *dst, const R16S *src1, const R16S *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ }
+};
+
+struct R16G16S
+{
+ short R;
+ short G;
+
+ static void readColor(gl::ColorF *dst, const R16G16S *src)
+ {
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+ }
+
+ static void readColor(gl::ColorI *dst, const R16G16S *src)
+ {
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = 0;
+ dst->alpha = 1;
+ }
+
+ static void writeColor(R16G16S *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<short>(src->red);
+ dst->G = gl::floatToNormalized<short>(src->green);
+ }
+
+ static void writeColor(R16G16S *dst, const gl::ColorI *src)
+ {
+ dst->R = static_cast<short>(src->red);
+ dst->G = static_cast<short>(src->green);
+ }
+
+ static void average(R16G16S *dst, const R16G16S *src1, const R16G16S *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ }
+};
+
+struct R16G16B16S
+{
+ short R;
+ short G;
+ short B;
+
+ static void readColor(gl::ColorF *dst, const R16G16B16S *src)
+ {
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = 1.0f;
+ }
+
+ static void readColor(gl::ColorI *dst, const R16G16B16S *src)
+ {
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = 1;
+ }
+
+ static void writeColor(R16G16B16S *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<short>(src->red);
+ dst->G = gl::floatToNormalized<short>(src->green);
+ dst->B = gl::floatToNormalized<short>(src->blue);
+ }
+
+ static void writeColor(R16G16B16S *dst, const gl::ColorI *src)
+ {
+ dst->R = static_cast<short>(src->red);
+ dst->G = static_cast<short>(src->green);
+ dst->B = static_cast<short>(src->blue);
+ }
+
+ static void average(R16G16B16S *dst, const R16G16B16S *src1, const R16G16B16S *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+ }
+};
+
+struct R16G16B16A16S
+{
+ short R;
+ short G;
+ short B;
+ short A;
+
+ static void readColor(gl::ColorF *dst, const R16G16B16A16S *src)
+ {
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = gl::normalizedToFloat(src->A);
+ }
+
+ static void readColor(gl::ColorI *dst, const R16G16B16A16S *src)
+ {
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = src->A;
+ }
+
+ static void writeColor(R16G16B16A16S *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<short>(src->red);
+ dst->G = gl::floatToNormalized<short>(src->green);
+ dst->B = gl::floatToNormalized<short>(src->blue);
+ dst->A = gl::floatToNormalized<short>(src->alpha);
+ }
+
+ static void writeColor(R16G16B16A16S *dst, const gl::ColorI *src)
+ {
+ dst->R = static_cast<short>(src->red);
+ dst->G = static_cast<short>(src->green);
+ dst->B = static_cast<short>(src->blue);
+ dst->A = static_cast<short>(src->alpha);
+ }
+
+ static void average(R16G16B16A16S *dst, const R16G16B16A16S *src1, const R16G16B16A16S *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+ dst->A = gl::average(src1->A, src2->A);
+ }
+};
+
+struct R32S
+{
+ int R;
+
+ static void readColor(gl::ColorF *dst, const R32S *src)
+ {
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = 0.0f;
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+ }
+
+ static void readColor(gl::ColorI *dst, const R32S *src)
+ {
+ dst->red = src->R;
+ dst->green = 0;
+ dst->blue = 0;
+ dst->alpha = 1;
+ }
+
+ static void writeColor(R32S *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<int>(src->red);
+ }
+
+ static void writeColor(R32S *dst, const gl::ColorI *src)
+ {
+ dst->R = static_cast<int>(src->red);
+ }
+
+ static void average(R32S *dst, const R32S *src1, const R32S *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ }
+};
+
+struct R32G32S
+{
+ int R;
+ int G;
+
+ static void readColor(gl::ColorF *dst, const R32G32S *src)
+ {
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+ }
+
+ static void readColor(gl::ColorI *dst, const R32G32S *src)
+ {
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = 0;
+ dst->alpha = 1;
+ }
+
+ static void writeColor(R32G32S *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<int>(src->red);
+ dst->G = gl::floatToNormalized<int>(src->green);
+ }
+
+ static void writeColor(R32G32S *dst, const gl::ColorI *src)
+ {
+ dst->R = static_cast<int>(src->red);
+ dst->G = static_cast<int>(src->green);
+ }
+
+ static void average(R32G32S *dst, const R32G32S *src1, const R32G32S *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ }
+};
+
+struct R32G32B32S
+{
+ int R;
+ int G;
+ int B;
+
+ static void readColor(gl::ColorF *dst, const R32G32B32S *src)
+ {
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = 1.0f;
+ }
+
+ static void readColor(gl::ColorI *dst, const R32G32B32S *src)
+ {
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = 1;
+ }
+
+ static void writeColor(R32G32B32S *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<int>(src->red);
+ dst->G = gl::floatToNormalized<int>(src->green);
+ dst->B = gl::floatToNormalized<int>(src->blue);
+ }
+
+ static void writeColor(R32G32B32S *dst, const gl::ColorI *src)
+ {
+ dst->R = static_cast<int>(src->red);
+ dst->G = static_cast<int>(src->green);
+ dst->B = static_cast<int>(src->blue);
+ }
+
+ static void average(R32G32B32S *dst, const R32G32B32S *src1, const R32G32B32S *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+ }
+};
+
+struct R32G32B32A32S
+{
+ int R;
+ int G;
+ int B;
+ int A;
+
+ static void readColor(gl::ColorF *dst, const R32G32B32A32S *src)
+ {
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = gl::normalizedToFloat(src->A);
+ }
+
+ static void readColor(gl::ColorI *dst, const R32G32B32A32S *src)
+ {
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = src->A;
+ }
+
+ static void writeColor(R32G32B32A32S *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<int>(src->red);
+ dst->G = gl::floatToNormalized<int>(src->green);
+ dst->B = gl::floatToNormalized<int>(src->blue);
+ dst->A = gl::floatToNormalized<int>(src->alpha);
+ }
+
+ static void writeColor(R32G32B32A32S *dst, const gl::ColorI *src)
+ {
+ dst->R = static_cast<int>(src->red);
+ dst->G = static_cast<int>(src->green);
+ dst->B = static_cast<int>(src->blue);
+ dst->A = static_cast<int>(src->alpha);
+ }
+
+ static void average(R32G32B32A32S *dst, const R32G32B32A32S *src1, const R32G32B32A32S *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+ dst->A = gl::average(src1->A, src2->A);
+ }
+};
+
+struct A16B16G16R16F
+{
+ unsigned short A;
+ unsigned short R;
+ unsigned short G;
+ unsigned short B;
+
+ static void readColor(gl::ColorF *dst, const A16B16G16R16F *src)
+ {
+ dst->red = gl::float16ToFloat32(src->R);
+ dst->green = gl::float16ToFloat32(src->G);
+ dst->blue = gl::float16ToFloat32(src->B);
+ dst->alpha = gl::float16ToFloat32(src->A);
+ }
+
+ static void writeColor(A16B16G16R16F *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::float32ToFloat16(src->red);
+ dst->G = gl::float32ToFloat16(src->green);
+ dst->B = gl::float32ToFloat16(src->blue);
+ dst->A = gl::float32ToFloat16(src->alpha);
+ }
+
+ static void average(A16B16G16R16F *dst, const A16B16G16R16F *src1, const A16B16G16R16F *src2)
+ {
+ dst->R = gl::averageHalfFloat(src1->R, src2->R);
+ dst->G = gl::averageHalfFloat(src1->G, src2->G);
+ dst->B = gl::averageHalfFloat(src1->B, src2->B);
+ dst->A = gl::averageHalfFloat(src1->A, src2->A);
+ }
+};
+
+struct R16G16B16A16F
+{
+ unsigned short R;
+ unsigned short G;
+ unsigned short B;
+ unsigned short A;
+
+ static void readColor(gl::ColorF *dst, const R16G16B16A16F *src)
+ {
+ dst->red = gl::float16ToFloat32(src->R);
+ dst->green = gl::float16ToFloat32(src->G);
+ dst->blue = gl::float16ToFloat32(src->B);
+ dst->alpha = gl::float16ToFloat32(src->A);
+ }
+
+ static void writeColor(R16G16B16A16F *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::float32ToFloat16(src->red);
+ dst->G = gl::float32ToFloat16(src->green);
+ dst->B = gl::float32ToFloat16(src->blue);
+ dst->A = gl::float32ToFloat16(src->alpha);
+ }
+
+ static void average(R16G16B16A16F *dst, const R16G16B16A16F *src1, const R16G16B16A16F *src2)
+ {
+ dst->R = gl::averageHalfFloat(src1->R, src2->R);
+ dst->G = gl::averageHalfFloat(src1->G, src2->G);
+ dst->B = gl::averageHalfFloat(src1->B, src2->B);
+ dst->A = gl::averageHalfFloat(src1->A, src2->A);
+ }
+};
+
+struct R16F
+{
+ unsigned short R;
+
+ static void readColor(gl::ColorF *dst, const R16F *src)
+ {
+ dst->red = gl::float16ToFloat32(src->R);
+ dst->green = 0.0f;
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+ }
+
+ static void writeColor(R16F *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::float32ToFloat16(src->red);
+ }
+
+ static void average(R16F *dst, const R16F *src1, const R16F *src2)
+ {
+ dst->R = gl::averageHalfFloat(src1->R, src2->R);
+ }
+};
+
+struct A16F
+{
+ unsigned short A;
+
+ static void readColor(gl::ColorF *dst, const A16F *src)
+ {
+ dst->red = 0.0f;
+ dst->green = 0.0f;
+ dst->blue = 0.0f;
+ dst->alpha = gl::float16ToFloat32(src->A);
+ }
+
+ static void writeColor(A16F *dst, const gl::ColorF *src)
+ {
+ dst->A = gl::float32ToFloat16(src->alpha);
+ }
+
+ static void average(A16F *dst, const A16F *src1, const A16F *src2)
+ {
+ dst->A = gl::averageHalfFloat(src1->A, src2->A);
+ }
+};
+
+struct L16F
+{
+ unsigned short L;
+
+ static void readColor(gl::ColorF *dst, const L16F *src)
+ {
+ float lum = gl::float16ToFloat32(src->L);
+ dst->red = lum;
+ dst->green = lum;
+ dst->blue = lum;
+ dst->alpha = 1.0f;
+ }
+
+ static void writeColor(L16F *dst, const gl::ColorF *src)
+ {
+ dst->L = gl::float32ToFloat16((src->red + src->green + src->blue) / 3.0f);
+ }
+
+ static void average(L16F *dst, const L16F *src1, const L16F *src2)
+ {
+ dst->L = gl::averageHalfFloat(src1->L, src2->L);
+ }
+};
+
+struct L16A16F
+{
+ unsigned short L;
+ unsigned short A;
+
+ static void readColor(gl::ColorF *dst, const L16A16F *src)
+ {
+ float lum = gl::float16ToFloat32(src->L);
+ dst->red = lum;
+ dst->green = lum;
+ dst->blue = lum;
+ dst->alpha = gl::float16ToFloat32(src->A);
+ }
+
+ static void writeColor(L16A16F *dst, const gl::ColorF *src)
+ {
+ dst->L = gl::float32ToFloat16((src->red + src->green + src->blue) / 3.0f);
+ dst->A = gl::float32ToFloat16(src->alpha);
+ }
+
+ static void average(L16A16F *dst, const L16A16F *src1, const L16A16F *src2)
+ {
+ dst->L = gl::averageHalfFloat(src1->L, src2->L);
+ dst->A = gl::averageHalfFloat(src1->A, src2->A);
+ }
+};
+
+struct R16G16F
+{
+ unsigned short R;
+ unsigned short G;
+
+ static void readColor(gl::ColorF *dst, const R16G16F *src)
+ {
+ dst->red = gl::float16ToFloat32(src->R);
+ dst->green = gl::float16ToFloat32(src->G);
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+ }
+
+ static void writeColor(R16G16F *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::float32ToFloat16(src->red);
+ dst->G = gl::float32ToFloat16(src->green);
+ }
+
+ static void average(R16G16F *dst, const R16G16F *src1, const R16G16F *src2)
+ {
+ dst->R = gl::averageHalfFloat(src1->R, src2->R);
+ dst->G = gl::averageHalfFloat(src1->G, src2->G);
+ }
+};
+
+struct R16G16B16F
+{
+ unsigned short R;
+ unsigned short G;
+ unsigned short B;
+
+ static void readColor(gl::ColorF *dst, const R16G16B16F *src)
+ {
+ dst->red = gl::float16ToFloat32(src->R);
+ dst->green = gl::float16ToFloat32(src->G);
+ dst->blue = gl::float16ToFloat32(src->B);
+ dst->alpha = 1.0f;
+ }
+
+ static void writeColor(R16G16B16F *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::float32ToFloat16(src->red);
+ dst->G = gl::float32ToFloat16(src->green);
+ dst->B = gl::float32ToFloat16(src->blue);
+ }
+
+ static void average(R16G16B16F *dst, const R16G16B16F *src1, const R16G16B16F *src2)
+ {
+ dst->R = gl::averageHalfFloat(src1->R, src2->R);
+ dst->G = gl::averageHalfFloat(src1->G, src2->G);
+ dst->B = gl::averageHalfFloat(src1->B, src2->B);
+ }
+};
+
+struct A32B32G32R32F
+{
+ float A;
+ float R;
+ float G;
+ float B;
+
+ static void readColor(gl::ColorF *dst, const A32B32G32R32F *src)
+ {
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = src->A;
+ }
+
+ static void writeColor(A32B32G32R32F *dst, const gl::ColorF *src)
+ {
+ dst->R = src->red;
+ dst->G = src->green;
+ dst->B = src->blue;
+ dst->A = src->alpha;
+ }
+
+ static void average(A32B32G32R32F *dst, const A32B32G32R32F *src1, const A32B32G32R32F *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+ dst->A = gl::average(src1->A, src2->A);
+ }
+};
+
+struct R32G32B32A32F
+{
+ float R;
+ float G;
+ float B;
+ float A;
+
+ static void readColor(gl::ColorF *dst, const R32G32B32A32F *src)
+ {
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = src->A;
+ }
+
+ static void writeColor(R32G32B32A32F *dst, const gl::ColorF *src)
+ {
+ dst->R = src->red;
+ dst->G = src->green;
+ dst->B = src->blue;
+ dst->A = src->alpha;
+ }
+
+ static void average(R32G32B32A32F *dst, const R32G32B32A32F *src1, const R32G32B32A32F *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+ dst->A = gl::average(src1->A, src2->A);
+ }
+};
+
+struct R32F
+{
+ float R;
+
+ static void readColor(gl::ColorF *dst, const R32F *src)
+ {
+ dst->red = src->R;
+ dst->green = 0.0f;
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+ }
+
+ static void writeColor(R32F *dst, const gl::ColorF *src)
+ {
+ dst->R = src->red;
+ }
+
+ static void average(R32F *dst, const R32F *src1, const R32F *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ }
+};
+
+struct A32F
+{
+ float A;
+
+ static void readColor(gl::ColorF *dst, const A32F *src)
+ {
+ dst->red = 0.0f;
+ dst->green = 0.0f;
+ dst->blue = 0.0f;
+ dst->alpha = src->A;
+ }
+
+ static void writeColor(A32F *dst, const gl::ColorF *src)
+ {
+ dst->A = src->alpha;
+ }
+
+ static void average(A32F *dst, const A32F *src1, const A32F *src2)
+ {
+ dst->A = gl::average(src1->A, src2->A);
+ }
+};
+
+struct L32F
+{
+ float L;
+
+ static void readColor(gl::ColorF *dst, const L32F *src)
+ {
+ dst->red = src->L;
+ dst->green = src->L;
+ dst->blue = src->L;
+ dst->alpha = 1.0f;
+ }
+
+ static void writeColor(L32F *dst, const gl::ColorF *src)
+ {
+ dst->L = (src->red + src->green + src->blue) / 3.0f;
+ }
+
+ static void average(L32F *dst, const L32F *src1, const L32F *src2)
+ {
+ dst->L = gl::average(src1->L, src2->L);
+ }
+};
+
+struct L32A32F
+{
+ float L;
+ float A;
+
+ static void readColor(gl::ColorF *dst, const L32A32F *src)
+ {
+ dst->red = src->L;
+ dst->green = src->L;
+ dst->blue = src->L;
+ dst->alpha = src->A;
+ }
+
+ static void writeColor(L32A32F *dst, const gl::ColorF *src)
+ {
+ dst->L = (src->red + src->green + src->blue) / 3.0f;
+ dst->A = src->alpha;
+ }
+
+ static void average(L32A32F *dst, const L32A32F *src1, const L32A32F *src2)
+ {
+ dst->L = gl::average(src1->L, src2->L);
+ dst->A = gl::average(src1->A, src2->A);
+ }
+};
+
+struct R32G32F
+{
+ float R;
+ float G;
+
+ static void readColor(gl::ColorF *dst, const R32G32F *src)
+ {
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+ }
+
+ static void writeColor(R32G32F *dst, const gl::ColorF *src)
+ {
+ dst->R = src->red;
+ dst->G = src->green;
+ }
+
+ static void average(R32G32F *dst, const R32G32F *src1, const R32G32F *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ }
+};
+
+struct R32G32B32F
+{
+ float R;
+ float G;
+ float B;
+
+ static void readColor(gl::ColorF *dst, const R32G32B32F *src)
+ {
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = 1.0f;
+ }
+
+ static void writeColor(R32G32B32F *dst, const gl::ColorF *src)
+ {
+ dst->R = src->red;
+ dst->G = src->green;
+ dst->B = src->blue;
+ }
+
+ static void average(R32G32B32F *dst, const R32G32B32F *src1, const R32G32B32F *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+ }
+};
+
+struct R10G10B10A2
+{
+ unsigned int R : 10;
+ unsigned int G : 10;
+ unsigned int B : 10;
+ unsigned int A : 2;
+
+ static void readColor(gl::ColorF *dst, const R10G10B10A2 *src)
+ {
+ dst->red = gl::normalizedToFloat<10>(src->R);
+ dst->green = gl::normalizedToFloat<10>(src->G);
+ dst->blue = gl::normalizedToFloat<10>(src->B);
+ dst->alpha = gl::normalizedToFloat< 2>(src->A);
+ }
+
+ static void readColor(gl::ColorUI *dst, const R10G10B10A2 *src)
+ {
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = src->A;
+ }
+
+ static void writeColor(R10G10B10A2 *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::floatToNormalized<10, unsigned int>(src->red);
+ dst->G = gl::floatToNormalized<10, unsigned int>(src->green);
+ dst->B = gl::floatToNormalized<10, unsigned int>(src->blue);
+ dst->A = gl::floatToNormalized< 2, unsigned int>(src->alpha);
+ }
+
+ static void writeColor(R10G10B10A2 *dst, const gl::ColorUI *src)
+ {
+ dst->R = static_cast<unsigned int>(src->red);
+ dst->G = static_cast<unsigned int>(src->green);
+ dst->B = static_cast<unsigned int>(src->blue);
+ dst->A = static_cast<unsigned int>(src->alpha);
+ }
+
+ static void average(R10G10B10A2 *dst, const R10G10B10A2 *src1, const R10G10B10A2 *src2)
+ {
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+ dst->A = gl::average(src1->A, src2->A);
+ }
+};
+
+struct R9G9B9E5
+{
+ unsigned int R : 9;
+ unsigned int G : 9;
+ unsigned int B : 9;
+ unsigned int E : 5;
+
+ static void readColor(gl::ColorF *dst, const R9G9B9E5 *src)
+ {
+ gl::convert999E5toRGBFloats(gl::bitCast<unsigned int>(*src), &dst->red, &dst->green, &dst->blue);
+ dst->alpha = 1.0f;
+ }
+
+ static void writeColor(R9G9B9E5 *dst, const gl::ColorF *src)
+ {
+ *reinterpret_cast<unsigned int*>(dst) = gl::convertRGBFloatsTo999E5(src->red,
+ src->green,
+ src->blue);
+ }
+
+ static void average(R9G9B9E5 *dst, const R9G9B9E5 *src1, const R9G9B9E5 *src2)
+ {
+ float r1, g1, b1;
+ gl::convert999E5toRGBFloats(*reinterpret_cast<const unsigned int*>(src1), &r1, &g1, &b1);
+
+ float r2, g2, b2;
+ gl::convert999E5toRGBFloats(*reinterpret_cast<const unsigned int*>(src2), &r2, &g2, &b2);
+
+ *reinterpret_cast<unsigned int*>(dst) = gl::convertRGBFloatsTo999E5(gl::average(r1, r2),
+ gl::average(g1, g2),
+ gl::average(b1, b2));
+ }
+};
+
+struct R11G11B10F
+{
+ unsigned int R : 11;
+ unsigned int G : 11;
+ unsigned int B : 10;
+
+ static void readColor(gl::ColorF *dst, const R11G11B10F *src)
+ {
+ dst->red = gl::float11ToFloat32(src->R);
+ dst->green = gl::float11ToFloat32(src->G);
+ dst->blue = gl::float10ToFloat32(src->B);
+ dst->alpha = 1.0f;
+ }
+
+ static void writeColor(R11G11B10F *dst, const gl::ColorF *src)
+ {
+ dst->R = gl::float32ToFloat11(src->red);
+ dst->G = gl::float32ToFloat11(src->green);
+ dst->B = gl::float32ToFloat10(src->blue);
+ }
+
+ static void average(R11G11B10F *dst, const R11G11B10F *src1, const R11G11B10F *src2)
+ {
+ dst->R = gl::averageFloat11(src1->R, src2->R);
+ dst->G = gl::averageFloat11(src1->G, src2->G);
+ dst->B = gl::averageFloat10(src1->B, src2->B);
+ }
+};
+
+}
+
+#endif // LIBGLESV2_RENDERER_IMAGEFORMATS_H_
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/loadimage.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/loadimage.cpp
new file mode 100644
index 00000000000..6e2d2460a52
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/loadimage.cpp
@@ -0,0 +1,951 @@
+#include "precompiled.h"
+//
+// Copyright (c) 0013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// loadimage.cpp: Defines image loading functions.
+
+#include "libGLESv2/renderer/loadimage.h"
+
+namespace rx
+{
+
+void loadAlphaDataToBGRA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const unsigned char *source = NULL;
+ unsigned char *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<unsigned char>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned char>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (int x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = 0;
+ dest[4 * x + 1] = 0;
+ dest[4 * x + 2] = 0;
+ dest[4 * x + 3] = source[x];
+ }
+ }
+ }
+}
+
+void loadAlphaDataToNative(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const unsigned char *source = NULL;
+ unsigned char *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<unsigned char>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned char>(output, y, z, outputRowPitch, outputDepthPitch);
+ memcpy(dest, source, width);
+ }
+ }
+}
+
+void loadAlphaFloatDataToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const float *source = NULL;
+ float *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<float>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<float>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (int x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = 0;
+ dest[4 * x + 1] = 0;
+ dest[4 * x + 2] = 0;
+ dest[4 * x + 3] = source[x];
+ }
+ }
+ }
+}
+
+void loadAlphaHalfFloatDataToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const unsigned short *source = NULL;
+ unsigned short *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<unsigned short>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned short>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (int x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = 0;
+ dest[4 * x + 1] = 0;
+ dest[4 * x + 2] = 0;
+ dest[4 * x + 3] = source[x];
+ }
+ }
+ }
+}
+
+void loadLuminanceDataToNative(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const unsigned char *source = NULL;
+ unsigned char *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<unsigned char>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned char>(output, y, z, outputRowPitch, outputDepthPitch);
+ memcpy(dest, source, width);
+ }
+ }
+}
+
+void loadLuminanceDataToBGRA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const unsigned char *source = NULL;
+ unsigned char *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<unsigned char>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned char>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (int x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = source[x];
+ dest[4 * x + 1] = source[x];
+ dest[4 * x + 2] = source[x];
+ dest[4 * x + 3] = 0xFF;
+ }
+ }
+ }
+}
+
+void loadLuminanceFloatDataToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const float *source = NULL;
+ float *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<float>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<float>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (int x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = source[x];
+ dest[4 * x + 1] = source[x];
+ dest[4 * x + 2] = source[x];
+ dest[4 * x + 3] = 1.0f;
+ }
+ }
+ }
+}
+
+void loadLuminanceFloatDataToRGB(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const float *source = NULL;
+ float *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<float>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<float>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (int x = 0; x < width; x++)
+ {
+ dest[3 * x + 0] = source[x];
+ dest[3 * x + 1] = source[x];
+ dest[3 * x + 2] = source[x];
+ }
+ }
+ }
+}
+
+void loadLuminanceHalfFloatDataToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const unsigned short *source = NULL;
+ unsigned short *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<unsigned short>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned short>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (int x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = source[x];
+ dest[4 * x + 1] = source[x];
+ dest[4 * x + 2] = source[x];
+ dest[4 * x + 3] = gl::Float16One;
+ }
+ }
+ }
+}
+
+void loadLuminanceAlphaDataToNative(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const unsigned char *source = NULL;
+ unsigned char *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<unsigned char>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned char>(output, y, z, outputRowPitch, outputDepthPitch);
+
+ memcpy(dest, source, width * 2);
+ }
+ }
+}
+
+void loadLuminanceAlphaDataToBGRA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const unsigned char *source = NULL;
+ unsigned char *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<unsigned char>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned char>(output, y, z, outputRowPitch, outputDepthPitch);
+
+ for (int x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = source[2*x+0];
+ dest[4 * x + 1] = source[2*x+0];
+ dest[4 * x + 2] = source[2*x+0];
+ dest[4 * x + 3] = source[2*x+1];
+ }
+ }
+ }
+}
+
+void loadLuminanceAlphaFloatDataToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const float *source = NULL;
+ float *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<float>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<float>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (int x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = source[2*x+0];
+ dest[4 * x + 1] = source[2*x+0];
+ dest[4 * x + 2] = source[2*x+0];
+ dest[4 * x + 3] = source[2*x+1];
+ }
+ }
+ }
+}
+
+void loadLuminanceAlphaHalfFloatDataToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const unsigned short *source = NULL;
+ unsigned short *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<unsigned short>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned short>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (int x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = source[2*x+0];
+ dest[4 * x + 1] = source[2*x+0];
+ dest[4 * x + 2] = source[2*x+0];
+ dest[4 * x + 3] = source[2*x+1];
+ }
+ }
+ }
+}
+
+void loadRGBUByteDataToBGRX(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const unsigned char *source = NULL;
+ unsigned char *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<unsigned char>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned char>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (int x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = source[x * 3 + 2];
+ dest[4 * x + 1] = source[x * 3 + 1];
+ dest[4 * x + 2] = source[x * 3 + 0];
+ dest[4 * x + 3] = 0xFF;
+ }
+ }
+ }
+}
+
+void loadRGUByteDataToBGRX(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const unsigned char *source = NULL;
+ unsigned char *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<unsigned char>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned char>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (int x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = 0x00;
+ dest[4 * x + 1] = source[x * 2 + 1];
+ dest[4 * x + 2] = source[x * 2 + 0];
+ dest[4 * x + 3] = 0xFF;
+ }
+ }
+ }
+}
+
+void loadRUByteDataToBGRX(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const unsigned char *source = NULL;
+ unsigned char *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<unsigned char>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned char>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (int x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = 0x00;
+ dest[4 * x + 1] = 0x00;
+ dest[4 * x + 2] = source[x];
+ dest[4 * x + 3] = 0xFF;
+ }
+ }
+ }
+}
+
+void loadRGBUByteDataToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const unsigned char *source = NULL;
+ unsigned char *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<unsigned char>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned char>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (int x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = source[x * 3 + 0];
+ dest[4 * x + 1] = source[x * 3 + 1];
+ dest[4 * x + 2] = source[x * 3 + 2];
+ dest[4 * x + 3] = 0xFF;
+ }
+ }
+ }
+}
+
+void loadRGBSByteDataToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const char *source = NULL;
+ char *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<char>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<char>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (int x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = source[x * 3 + 0];
+ dest[4 * x + 1] = source[x * 3 + 1];
+ dest[4 * x + 2] = source[x * 3 + 2];
+ dest[4 * x + 3] = 0x7F;
+ }
+ }
+ }
+}
+
+void loadRGB565DataToBGRA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const unsigned short *source = NULL;
+ unsigned char *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<unsigned short>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned char>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (int x = 0; x < width; x++)
+ {
+ unsigned short rgba = source[x];
+ dest[4 * x + 0] = ((rgba & 0x001F) << 3) | ((rgba & 0x001F) >> 2);
+ dest[4 * x + 1] = ((rgba & 0x07E0) >> 3) | ((rgba & 0x07E0) >> 9);
+ dest[4 * x + 2] = ((rgba & 0xF800) >> 8) | ((rgba & 0xF800) >> 13);
+ dest[4 * x + 3] = 0xFF;
+ }
+ }
+ }
+}
+
+void loadRGB565DataToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const unsigned short *source = NULL;
+ unsigned char *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<unsigned short>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned char>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (int x = 0; x < width; x++)
+ {
+ unsigned short rgba = source[x];
+ dest[4 * x + 0] = ((rgba & 0xF800) >> 8) | ((rgba & 0xF800) >> 13);
+ dest[4 * x + 1] = ((rgba & 0x07E0) >> 3) | ((rgba & 0x07E0) >> 9);
+ dest[4 * x + 2] = ((rgba & 0x001F) << 3) | ((rgba & 0x001F) >> 2);
+ dest[4 * x + 3] = 0xFF;
+ }
+ }
+ }
+}
+
+void loadRGBFloatDataToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const float *source = NULL;
+ float *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<float>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<float>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (int x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = source[x * 3 + 0];
+ dest[4 * x + 1] = source[x * 3 + 1];
+ dest[4 * x + 2] = source[x * 3 + 2];
+ dest[4 * x + 3] = 1.0f;
+ }
+ }
+ }
+}
+
+void loadRGBFloatDataToNative(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const float *source = NULL;
+ float *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<float>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<float>(output, y, z, outputRowPitch, outputDepthPitch);
+ memcpy(dest, source, width * 12);
+ }
+ }
+}
+
+void loadRGBHalfFloatDataToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const unsigned short *source = NULL;
+ unsigned short *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<unsigned short>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned short>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (int x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = source[x * 3 + 0];
+ dest[4 * x + 1] = source[x * 3 + 1];
+ dest[4 * x + 2] = source[x * 3 + 2];
+ dest[4 * x + 3] = 0x3C00; // SEEEEEMMMMMMMMMM, S = 0, E = 15, M = 0: 16bit flpt representation of 1
+ }
+ }
+ }
+}
+
+void loadRGBAUByteDataToBGRA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const unsigned int *source = NULL;
+ unsigned int *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<unsigned int>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned int>(output, y, z, outputRowPitch, outputDepthPitch);
+
+ for (int x = 0; x < width; x++)
+ {
+ unsigned int rgba = source[x];
+ dest[x] = (_rotl(rgba, 16) & 0x00ff00ff) | (rgba & 0xff00ff00);
+ }
+ }
+ }
+}
+
+void loadRGBAUByteDataToNative(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const unsigned int *source = NULL;
+ unsigned int *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<unsigned int>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned int>(output, y, z, outputRowPitch, outputDepthPitch);
+
+ memcpy(dest, source, width * 4);
+ }
+ }
+}
+
+void loadRGBA4444DataToBGRA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const unsigned short *source = NULL;
+ unsigned char *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<unsigned short>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned char>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (int x = 0; x < width; x++)
+ {
+ unsigned short rgba = source[x];
+ dest[4 * x + 0] = ((rgba & 0x00F0) << 0) | ((rgba & 0x00F0) >> 4);
+ dest[4 * x + 1] = ((rgba & 0x0F00) >> 4) | ((rgba & 0x0F00) >> 8);
+ dest[4 * x + 2] = ((rgba & 0xF000) >> 8) | ((rgba & 0xF000) >> 12);
+ dest[4 * x + 3] = ((rgba & 0x000F) << 4) | ((rgba & 0x000F) >> 0);
+ }
+ }
+ }
+}
+
+void loadRGBA4444DataToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const unsigned short *source = NULL;
+ unsigned char *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<unsigned short>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned char>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (int x = 0; x < width; x++)
+ {
+ unsigned short rgba = source[x];
+ dest[4 * x + 0] = ((rgba & 0xF000) >> 8) | ((rgba & 0xF000) >> 12);
+ dest[4 * x + 1] = ((rgba & 0x0F00) >> 4) | ((rgba & 0x0F00) >> 8);
+ dest[4 * x + 2] = ((rgba & 0x00F0) << 0) | ((rgba & 0x00F0) >> 4);
+ dest[4 * x + 3] = ((rgba & 0x000F) << 4) | ((rgba & 0x000F) >> 0);
+ }
+ }
+ }
+}
+
+void loadRGBA5551DataToBGRA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const unsigned short *source = NULL;
+ unsigned char *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<unsigned short>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned char>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (int x = 0; x < width; x++)
+ {
+ unsigned short rgba = source[x];
+ dest[4 * x + 0] = ((rgba & 0x003E) << 2) | ((rgba & 0x003E) >> 3);
+ dest[4 * x + 1] = ((rgba & 0x07C0) >> 3) | ((rgba & 0x07C0) >> 8);
+ dest[4 * x + 2] = ((rgba & 0xF800) >> 8) | ((rgba & 0xF800) >> 13);
+ dest[4 * x + 3] = (rgba & 0x0001) ? 0xFF : 0;
+ }
+ }
+ }
+}
+void loadRGBA5551DataToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const unsigned short *source = NULL;
+ unsigned char *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<unsigned short>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned char>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (int x = 0; x < width; x++)
+ {
+ unsigned short rgba = source[x];
+ dest[4 * x + 0] = ((rgba & 0xF800) >> 8) | ((rgba & 0xF800) >> 13);
+ dest[4 * x + 1] = ((rgba & 0x07C0) >> 3) | ((rgba & 0x07C0) >> 8);
+ dest[4 * x + 2] = ((rgba & 0x003E) << 2) | ((rgba & 0x003E) >> 3);
+ dest[4 * x + 3] = (rgba & 0x0001) ? 0xFF : 0;
+ }
+ }
+ }
+}
+
+void loadRGBAFloatDataToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const float *source = NULL;
+ float *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<float>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<float>(output, y, z, outputRowPitch, outputDepthPitch);
+ memcpy(dest, source, width * 16);
+ }
+ }
+}
+
+void loadRGBAHalfFloatDataToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const unsigned char *source = NULL;
+ unsigned char *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<unsigned char>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned char>(output, y, z, outputRowPitch, outputDepthPitch);
+ memcpy(dest, source, width * 8);
+ }
+ }
+}
+
+void loadBGRADataToBGRA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const unsigned char *source = NULL;
+ unsigned char *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<unsigned char>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned char>(output, y, z, outputRowPitch, outputDepthPitch);
+ memcpy(dest, source, width*4);
+ }
+ }
+}
+
+void loadRGBA2101010ToNative(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const unsigned int *source = NULL;
+ unsigned int *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<unsigned int>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned int>(output, y, z, outputRowPitch, outputDepthPitch);
+ memcpy(dest, source, width * sizeof(unsigned int));
+ }
+ }
+}
+
+void loadRGBA2101010ToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const unsigned int *source = NULL;
+ unsigned char *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<unsigned int>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned char>(output, y, z, outputRowPitch, outputDepthPitch);
+
+ for (int x = 0; x < width; x++)
+ {
+ unsigned int rgba = source[x];
+ dest[4 * x + 0] = (rgba & 0x000003FF) >> 2;
+ dest[4 * x + 1] = (rgba & 0x000FFC00) >> 12;
+ dest[4 * x + 2] = (rgba & 0x3FF00000) >> 22;
+ dest[4 * x + 3] = ((rgba & 0xC0000000) >> 30) * 0x55;
+ }
+ }
+ }
+}
+
+void loadRGBHalfFloatDataTo999E5(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const unsigned short *source = NULL;
+ unsigned int *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<unsigned short>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned int>(output, y, z, outputRowPitch, outputDepthPitch);
+
+ for (int x = 0; x < width; x++)
+ {
+ dest[x] = gl::convertRGBFloatsTo999E5(gl::float16ToFloat32(source[x * 3 + 0]),
+ gl::float16ToFloat32(source[x * 3 + 1]),
+ gl::float16ToFloat32(source[x * 3 + 2]));
+ }
+ }
+ }
+}
+
+void loadRGBFloatDataTo999E5(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const float *source = NULL;
+ unsigned int *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<float>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned int>(output, y, z, outputRowPitch, outputDepthPitch);
+
+ for (int x = 0; x < width; x++)
+ {
+ dest[x] = gl::convertRGBFloatsTo999E5(source[x * 3 + 0], source[x * 3 + 1], source[x * 3 + 2]);
+ }
+ }
+ }
+}
+
+void loadRGBHalfFloatDataTo111110Float(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const unsigned short *source = NULL;
+ unsigned int *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<unsigned short>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned int>(output, y, z, outputRowPitch, outputDepthPitch);
+
+ for (int x = 0; x < width; x++)
+ {
+ dest[x] = (gl::float32ToFloat11(gl::float16ToFloat32(source[x * 3 + 0])) << 0) |
+ (gl::float32ToFloat11(gl::float16ToFloat32(source[x * 3 + 1])) << 11) |
+ (gl::float32ToFloat10(gl::float16ToFloat32(source[x * 3 + 2])) << 22);
+ }
+ }
+ }
+}
+
+void loadRGBFloatDataTo111110Float(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const float *source = NULL;
+ unsigned int *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<float>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned int>(output, y, z, outputRowPitch, outputDepthPitch);
+
+ for (int x = 0; x < width; x++)
+ {
+ dest[x] = (gl::float32ToFloat11(source[x * 3 + 0]) << 0) |
+ (gl::float32ToFloat11(source[x * 3 + 1]) << 11) |
+ (gl::float32ToFloat10(source[x * 3 + 2]) << 22);
+ }
+ }
+ }
+}
+
+
+void loadG8R24DataToR24G8(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const unsigned int *source = NULL;
+ unsigned int *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<const unsigned int>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned int>(output, y, z, outputRowPitch, outputDepthPitch);
+
+ for (int x = 0; x < width; x++)
+ {
+ unsigned int d = source[x] >> 8;
+ unsigned int s = source[x] & 0xFF;
+ dest[x] = d | (s << 24);
+ }
+ }
+ }
+}
+
+void loadFloatRGBDataToHalfFloatRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const float *source = NULL;
+ unsigned short *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<float>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned short>(output, y, z, outputRowPitch, outputDepthPitch);
+
+ for (int x = 0; x < width; x++)
+ {
+ dest[x * 4 + 0] = gl::float32ToFloat16(source[x * 3 + 0]);
+ dest[x * 4 + 1] = gl::float32ToFloat16(source[x * 3 + 1]);
+ dest[x * 4 + 2] = gl::float32ToFloat16(source[x * 3 + 2]);
+ dest[x * 4 + 3] = gl::Float16One;
+ }
+ }
+ }
+}
+
+void loadUintDataToUshort(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const unsigned int *source = NULL;
+ unsigned short *dest = NULL;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<unsigned int>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned short>(output, y, z, outputRowPitch, outputDepthPitch);
+
+ for (int x = 0; x < width; x++)
+ {
+ dest[x] = source[x] >> 16;
+ }
+ }
+ }
+}
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/loadimage.h b/chromium/third_party/angle/src/libGLESv2/renderer/loadimage.h
new file mode 100644
index 00000000000..537a5e4c170
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/loadimage.h
@@ -0,0 +1,343 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// loadimage.h: Defines image loading functions
+
+#ifndef LIBGLESV2_RENDERER_LOADIMAGE_H_
+#define LIBGLESV2_RENDERER_LOADIMAGE_H_
+
+#include "common/mathutil.h"
+
+namespace rx
+{
+
+template <typename T>
+inline static T *offsetDataPointer(void *data, int y, int z, int rowPitch, int depthPitch)
+{
+ return reinterpret_cast<T*>(reinterpret_cast<unsigned char*>(data) + (y * rowPitch) + (z * depthPitch));
+}
+
+template <typename T>
+inline static const T *offsetDataPointer(const void *data, int y, int z, int rowPitch, int depthPitch)
+{
+ return reinterpret_cast<const T*>(reinterpret_cast<const unsigned char*>(data) + (y * rowPitch) + (z * depthPitch));
+}
+
+void loadAlphaDataToBGRA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadAlphaDataToNative(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadAlphaDataToBGRASSE2(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadAlphaFloatDataToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadAlphaHalfFloatDataToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadLuminanceDataToNative(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadLuminanceDataToBGRA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadLuminanceFloatDataToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadLuminanceFloatDataToRGB(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadLuminanceHalfFloatDataToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadLuminanceAlphaDataToNative(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadLuminanceAlphaDataToBGRA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadLuminanceAlphaFloatDataToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadLuminanceAlphaHalfFloatDataToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadRGBUByteDataToBGRX(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadRGUByteDataToBGRX(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadRUByteDataToBGRX(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadRGBUByteDataToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadRGBSByteDataToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadRGB565DataToBGRA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadRGB565DataToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadRGBFloatDataToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadRGBFloatDataToNative(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadRGBHalfFloatDataToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadRGBAUByteDataToBGRASSE2(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadRGBAUByteDataToBGRA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadRGBAUByteDataToNative(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadRGBA4444DataToBGRA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadRGBA4444DataToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadRGBA5551DataToBGRA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadRGBA5551DataToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadRGBAFloatDataToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadRGBAHalfFloatDataToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadBGRADataToBGRA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadRGBA2101010ToNative(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadRGBA2101010ToRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadRGBHalfFloatDataTo999E5(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadRGBFloatDataTo999E5(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadRGBHalfFloatDataTo111110Float(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadRGBFloatDataTo111110Float(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+void loadG8R24DataToR24G8(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+template <typename type, unsigned int componentCount>
+void loadToNative(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const unsigned int rowSize = width * sizeof(type) * componentCount;
+ const unsigned int layerSize = rowSize * height;
+ const unsigned int imageSize = layerSize * depth;
+
+ if (layerSize == inputDepthPitch && layerSize == outputDepthPitch)
+ {
+ ASSERT(rowSize == inputRowPitch && rowSize == outputRowPitch);
+ memcpy(output, input, imageSize);
+ }
+ else if (rowSize == inputRowPitch && rowSize == outputRowPitch)
+ {
+ for (int z = 0; z < depth; z++)
+ {
+ const type *source = offsetDataPointer<type>(input, 0, z, inputRowPitch, inputDepthPitch);
+ type *dest = offsetDataPointer<type>(output, 0, z, outputRowPitch, outputDepthPitch);
+
+ memcpy(dest, source, layerSize);
+ }
+ }
+ else
+ {
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ const type *source = offsetDataPointer<type>(input, y, z, inputRowPitch, inputDepthPitch);
+ type *dest = offsetDataPointer<type>(output, y, z, outputRowPitch, outputDepthPitch);
+ memcpy(dest, source, width * sizeof(type) * componentCount);
+ }
+ }
+ }
+}
+
+template <typename type, unsigned int fourthComponentBits>
+void loadToNative3To4(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const type *source = NULL;
+ type *dest = NULL;
+
+ const unsigned int fourthBits = fourthComponentBits;
+ const type fourthValue = *reinterpret_cast<const type*>(&fourthBits);
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<type>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<type>(output, y, z, outputRowPitch, outputDepthPitch);
+
+ for (int x = 0; x < width; x++)
+ {
+ dest[x * 4 + 0] = source[x * 3 + 0];
+ dest[x * 4 + 1] = source[x * 3 + 1];
+ dest[x * 4 + 2] = source[x * 3 + 2];
+ dest[x * 4 + 3] = fourthValue;
+ }
+ }
+ }
+}
+
+template <unsigned int componentCount>
+void loadFloatDataToHalfFloat(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ const float *source = NULL;
+ unsigned short *dest = NULL;
+
+ const int elementWidth = componentCount * width;
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = offsetDataPointer<float>(input, y, z, inputRowPitch, inputDepthPitch);
+ dest = offsetDataPointer<unsigned short>(output, y, z, outputRowPitch, outputDepthPitch);
+
+ for (int x = 0; x < elementWidth; x++)
+ {
+ dest[x] = gl::float32ToFloat16(source[x]);
+ }
+ }
+ }
+}
+
+void loadFloatRGBDataToHalfFloatRGBA(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+template <unsigned int blockWidth, unsigned int blockHeight, unsigned int blockSize>
+void loadCompressedBlockDataToNative(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ int columns = (width + (blockWidth - 1)) / blockWidth;
+ int rows = (height + (blockHeight - 1)) / blockHeight;
+
+ for (int z = 0; z < depth; ++z)
+ {
+ for (int y = 0; y < rows; ++y)
+ {
+ void *source = (void*)((char*)input + y * inputRowPitch + z * inputDepthPitch);
+ void *dest = (void*)((char*)output + y * outputRowPitch + z * outputDepthPitch);
+
+ memcpy(dest, source, columns * blockSize);
+ }
+ }
+}
+
+void loadUintDataToUshort(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
+
+template <typename type, unsigned int firstBits, unsigned int secondBits, unsigned int thirdBits, unsigned int fourthBits>
+void initialize4ComponentData(int width, int height, int depth,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+{
+ unsigned int writeBits[4] = { firstBits, secondBits, thirdBits, fourthBits };
+ type writeValues[4] = { *reinterpret_cast<const type*>(&writeBits[0]),
+ *reinterpret_cast<const type*>(&writeBits[1]),
+ *reinterpret_cast<const type*>(&writeBits[2]),
+ *reinterpret_cast<const type*>(&writeBits[3]) };
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ type* destRow = offsetDataPointer<type>(output, y, z, outputRowPitch, outputDepthPitch);
+
+ for (int x = 0; x < width; x++)
+ {
+ type* destPixel = destRow + x * 4;
+
+ // This could potentially be optimized by generating an entire row of initialization
+ // data and copying row by row instead of pixel by pixel.
+ memcpy(destPixel, writeValues, sizeof(type) * 4);
+ }
+ }
+ }
+}
+
+}
+
+#endif // LIBGLESV2_RENDERER_LOADIMAGE_H_
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/loadimageSSE2.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/loadimageSSE2.cpp
new file mode 100644
index 00000000000..129e39bbe20
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/renderer/loadimageSSE2.cpp
@@ -0,0 +1,107 @@
+#include "precompiled.h"
+//
+// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// loadimage.cpp: Defines image loading functions. It's
+// in a separated file for GCC, which can enable SSE usage only per-file,
+// not for code blocks that use SSE2 explicitly.
+
+#include "libGLESv2/renderer/loadimage.h"
+
+namespace rx
+{
+
+ void loadAlphaDataToBGRASSE2(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+ {
+ const unsigned char *source = NULL;
+ unsigned int *dest = NULL;
+ __m128i zeroWide = _mm_setzero_si128();
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = static_cast<const unsigned char*>(input) + y * inputRowPitch + z * inputDepthPitch;
+ dest = reinterpret_cast<unsigned int*>(static_cast<unsigned char*>(output) + y * outputRowPitch + z * outputDepthPitch);
+
+ int x;
+ // Make output writes aligned
+ for (x = 0; ((reinterpret_cast<intptr_t>(&dest[x]) & 0xF) != 0 && x < width); x++)
+ {
+ dest[x] = static_cast<unsigned int>(source[x]) << 24;
+ }
+
+ for (; x + 7 < width; x += 8)
+ {
+ __m128i sourceData = _mm_loadl_epi64(reinterpret_cast<const __m128i*>(&source[x]));
+ // Interleave each byte to 16bit, make the lower byte to zero
+ sourceData = _mm_unpacklo_epi8(zeroWide, sourceData);
+ // Interleave each 16bit to 32bit, make the lower 16bit to zero
+ __m128i lo = _mm_unpacklo_epi16(zeroWide, sourceData);
+ __m128i hi = _mm_unpackhi_epi16(zeroWide, sourceData);
+
+ _mm_store_si128(reinterpret_cast<__m128i*>(&dest[x]), lo);
+ _mm_store_si128(reinterpret_cast<__m128i*>(&dest[x + 4]), hi);
+ }
+
+ // Handle the remainder
+ for (; x < width; x++)
+ {
+ dest[x] = static_cast<unsigned int>(source[x]) << 24;
+ }
+ }
+ }
+ }
+
+ void loadRGBAUByteDataToBGRASSE2(int width, int height, int depth,
+ const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
+ void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
+ {
+ const unsigned int *source = NULL;
+ unsigned int *dest = NULL;
+ __m128i brMask = _mm_set1_epi32(0x00ff00ff);
+
+ for (int z = 0; z < depth; z++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ source = reinterpret_cast<const unsigned int*>(static_cast<const unsigned char*>(input) + y * inputRowPitch + z * inputDepthPitch);
+ dest = reinterpret_cast<unsigned int*>(static_cast<unsigned char*>(output) + y * outputRowPitch + z * outputDepthPitch);
+ int x = 0;
+
+ // Make output writes aligned
+ for (x = 0; ((reinterpret_cast<intptr_t>(&dest[x]) & 15) != 0) && x < width; x++)
+ {
+ unsigned int rgba = source[x];
+ dest[x] = (_rotl(rgba, 16) & 0x00ff00ff) | (rgba & 0xff00ff00);
+ }
+
+ for (; x + 3 < width; x += 4)
+ {
+ __m128i sourceData = _mm_loadu_si128(reinterpret_cast<const __m128i*>(&source[x]));
+ // Mask out g and a, which don't change
+ __m128i gaComponents = _mm_andnot_si128(brMask, sourceData);
+ // Mask out b and r
+ __m128i brComponents = _mm_and_si128(sourceData, brMask);
+ // Swap b and r
+ __m128i brSwapped = _mm_shufflehi_epi16(_mm_shufflelo_epi16(brComponents, _MM_SHUFFLE(2, 3, 0, 1)), _MM_SHUFFLE(2, 3, 0, 1));
+ __m128i result = _mm_or_si128(gaComponents, brSwapped);
+ _mm_store_si128(reinterpret_cast<__m128i*>(&dest[x]), result);
+ }
+
+ // Perform leftover writes
+ for (; x < width; x++)
+ {
+ unsigned int rgba = source[x];
+ dest[x] = (_rotl(rgba, 16) & 0x00ff00ff) | (rgba & 0xff00ff00);
+ }
+ }
+ }
+ }
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/renderer11_utils.cpp b/chromium/third_party/angle/src/libGLESv2/renderer/renderer11_utils.cpp
deleted file mode 100644
index 13800da258c..00000000000
--- a/chromium/third_party/angle/src/libGLESv2/renderer/renderer11_utils.cpp
+++ /dev/null
@@ -1,688 +0,0 @@
-#include "precompiled.h"
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// renderer11_utils.cpp: Conversion functions and other utility routines
-// specific to the D3D11 renderer.
-
-#include "libGLESv2/renderer/renderer11_utils.h"
-
-#include "common/debug.h"
-
-namespace gl_d3d11
-{
-
-D3D11_BLEND ConvertBlendFunc(GLenum glBlend, bool isAlpha)
-{
- D3D11_BLEND d3dBlend = D3D11_BLEND_ZERO;
-
- switch (glBlend)
- {
- case GL_ZERO: d3dBlend = D3D11_BLEND_ZERO; break;
- case GL_ONE: d3dBlend = D3D11_BLEND_ONE; break;
- case GL_SRC_COLOR: d3dBlend = (isAlpha ? D3D11_BLEND_SRC_ALPHA : D3D11_BLEND_SRC_COLOR); break;
- case GL_ONE_MINUS_SRC_COLOR: d3dBlend = (isAlpha ? D3D11_BLEND_INV_SRC_ALPHA : D3D11_BLEND_INV_SRC_COLOR); break;
- case GL_DST_COLOR: d3dBlend = (isAlpha ? D3D11_BLEND_DEST_ALPHA : D3D11_BLEND_DEST_COLOR); break;
- case GL_ONE_MINUS_DST_COLOR: d3dBlend = (isAlpha ? D3D11_BLEND_INV_DEST_ALPHA : D3D11_BLEND_INV_DEST_COLOR); break;
- case GL_SRC_ALPHA: d3dBlend = D3D11_BLEND_SRC_ALPHA; break;
- case GL_ONE_MINUS_SRC_ALPHA: d3dBlend = D3D11_BLEND_INV_SRC_ALPHA; break;
- case GL_DST_ALPHA: d3dBlend = D3D11_BLEND_DEST_ALPHA; break;
- case GL_ONE_MINUS_DST_ALPHA: d3dBlend = D3D11_BLEND_INV_DEST_ALPHA; break;
- case GL_CONSTANT_COLOR: d3dBlend = D3D11_BLEND_BLEND_FACTOR; break;
- case GL_ONE_MINUS_CONSTANT_COLOR: d3dBlend = D3D11_BLEND_INV_BLEND_FACTOR; break;
- case GL_CONSTANT_ALPHA: d3dBlend = D3D11_BLEND_BLEND_FACTOR; break;
- case GL_ONE_MINUS_CONSTANT_ALPHA: d3dBlend = D3D11_BLEND_INV_BLEND_FACTOR; break;
- case GL_SRC_ALPHA_SATURATE: d3dBlend = D3D11_BLEND_SRC_ALPHA_SAT; break;
- default: UNREACHABLE();
- }
-
- return d3dBlend;
-}
-
-D3D11_BLEND_OP ConvertBlendOp(GLenum glBlendOp)
-{
- D3D11_BLEND_OP d3dBlendOp = D3D11_BLEND_OP_ADD;
-
- switch (glBlendOp)
- {
- case GL_FUNC_ADD: d3dBlendOp = D3D11_BLEND_OP_ADD; break;
- case GL_FUNC_SUBTRACT: d3dBlendOp = D3D11_BLEND_OP_SUBTRACT; break;
- case GL_FUNC_REVERSE_SUBTRACT: d3dBlendOp = D3D11_BLEND_OP_REV_SUBTRACT; break;
- default: UNREACHABLE();
- }
-
- return d3dBlendOp;
-}
-
-UINT8 ConvertColorMask(bool red, bool green, bool blue, bool alpha)
-{
- UINT8 mask = 0;
- if (red)
- {
- mask |= D3D11_COLOR_WRITE_ENABLE_RED;
- }
- if (green)
- {
- mask |= D3D11_COLOR_WRITE_ENABLE_GREEN;
- }
- if (blue)
- {
- mask |= D3D11_COLOR_WRITE_ENABLE_BLUE;
- }
- if (alpha)
- {
- mask |= D3D11_COLOR_WRITE_ENABLE_ALPHA;
- }
- return mask;
-}
-
-D3D11_CULL_MODE ConvertCullMode(bool cullEnabled, GLenum cullMode)
-{
- D3D11_CULL_MODE cull = D3D11_CULL_NONE;
-
- if (cullEnabled)
- {
- switch (cullMode)
- {
- case GL_FRONT: cull = D3D11_CULL_FRONT; break;
- case GL_BACK: cull = D3D11_CULL_BACK; break;
- case GL_FRONT_AND_BACK: cull = D3D11_CULL_NONE; break;
- default: UNREACHABLE();
- }
- }
- else
- {
- cull = D3D11_CULL_NONE;
- }
-
- return cull;
-}
-
-D3D11_COMPARISON_FUNC ConvertComparison(GLenum comparison)
-{
- D3D11_COMPARISON_FUNC d3dComp = D3D11_COMPARISON_NEVER;
- switch (comparison)
- {
- case GL_NEVER: d3dComp = D3D11_COMPARISON_NEVER; break;
- case GL_ALWAYS: d3dComp = D3D11_COMPARISON_ALWAYS; break;
- case GL_LESS: d3dComp = D3D11_COMPARISON_LESS; break;
- case GL_LEQUAL: d3dComp = D3D11_COMPARISON_LESS_EQUAL; break;
- case GL_EQUAL: d3dComp = D3D11_COMPARISON_EQUAL; break;
- case GL_GREATER: d3dComp = D3D11_COMPARISON_GREATER; break;
- case GL_GEQUAL: d3dComp = D3D11_COMPARISON_GREATER_EQUAL; break;
- case GL_NOTEQUAL: d3dComp = D3D11_COMPARISON_NOT_EQUAL; break;
- default: UNREACHABLE();
- }
-
- return d3dComp;
-}
-
-D3D11_DEPTH_WRITE_MASK ConvertDepthMask(bool depthWriteEnabled)
-{
- return depthWriteEnabled ? D3D11_DEPTH_WRITE_MASK_ALL : D3D11_DEPTH_WRITE_MASK_ZERO;
-}
-
-UINT8 ConvertStencilMask(GLuint stencilmask)
-{
- return static_cast<UINT8>(stencilmask);
-}
-
-D3D11_STENCIL_OP ConvertStencilOp(GLenum stencilOp)
-{
- D3D11_STENCIL_OP d3dStencilOp = D3D11_STENCIL_OP_KEEP;
-
- switch (stencilOp)
- {
- case GL_ZERO: d3dStencilOp = D3D11_STENCIL_OP_ZERO; break;
- case GL_KEEP: d3dStencilOp = D3D11_STENCIL_OP_KEEP; break;
- case GL_REPLACE: d3dStencilOp = D3D11_STENCIL_OP_REPLACE; break;
- case GL_INCR: d3dStencilOp = D3D11_STENCIL_OP_INCR_SAT; break;
- case GL_DECR: d3dStencilOp = D3D11_STENCIL_OP_DECR_SAT; break;
- case GL_INVERT: d3dStencilOp = D3D11_STENCIL_OP_INVERT; break;
- case GL_INCR_WRAP: d3dStencilOp = D3D11_STENCIL_OP_INCR; break;
- case GL_DECR_WRAP: d3dStencilOp = D3D11_STENCIL_OP_DECR; break;
- default: UNREACHABLE();
- }
-
- return d3dStencilOp;
-}
-
-D3D11_FILTER ConvertFilter(GLenum minFilter, GLenum magFilter, float maxAnisotropy)
-{
- if (maxAnisotropy > 1.0f)
- {
- return D3D11_ENCODE_ANISOTROPIC_FILTER(false);
- }
- else
- {
- D3D11_FILTER_TYPE dxMin = D3D11_FILTER_TYPE_POINT;
- D3D11_FILTER_TYPE dxMip = D3D11_FILTER_TYPE_POINT;
- switch (minFilter)
- {
- case GL_NEAREST: dxMin = D3D11_FILTER_TYPE_POINT; dxMip = D3D11_FILTER_TYPE_POINT; break;
- case GL_LINEAR: dxMin = D3D11_FILTER_TYPE_LINEAR; dxMip = D3D11_FILTER_TYPE_POINT; break;
- case GL_NEAREST_MIPMAP_NEAREST: dxMin = D3D11_FILTER_TYPE_POINT; dxMip = D3D11_FILTER_TYPE_POINT; break;
- case GL_LINEAR_MIPMAP_NEAREST: dxMin = D3D11_FILTER_TYPE_LINEAR; dxMip = D3D11_FILTER_TYPE_POINT; break;
- case GL_NEAREST_MIPMAP_LINEAR: dxMin = D3D11_FILTER_TYPE_POINT; dxMip = D3D11_FILTER_TYPE_LINEAR; break;
- case GL_LINEAR_MIPMAP_LINEAR: dxMin = D3D11_FILTER_TYPE_LINEAR; dxMip = D3D11_FILTER_TYPE_LINEAR; break;
- default: UNREACHABLE();
- }
-
- D3D11_FILTER_TYPE dxMag = D3D11_FILTER_TYPE_POINT;
- switch (magFilter)
- {
- case GL_NEAREST: dxMag = D3D11_FILTER_TYPE_POINT; break;
- case GL_LINEAR: dxMag = D3D11_FILTER_TYPE_LINEAR; break;
- default: UNREACHABLE();
- }
-
- return D3D11_ENCODE_BASIC_FILTER(dxMin, dxMag, dxMip, false);
- }
-}
-
-D3D11_TEXTURE_ADDRESS_MODE ConvertTextureWrap(GLenum wrap)
-{
- switch (wrap)
- {
- case GL_REPEAT: return D3D11_TEXTURE_ADDRESS_WRAP;
- case GL_CLAMP_TO_EDGE: return D3D11_TEXTURE_ADDRESS_CLAMP;
- case GL_MIRRORED_REPEAT: return D3D11_TEXTURE_ADDRESS_MIRROR;
- default: UNREACHABLE();
- }
-
- return D3D11_TEXTURE_ADDRESS_WRAP;
-}
-
-FLOAT ConvertMinLOD(GLenum minFilter, unsigned int lodOffset)
-{
- return (minFilter == GL_NEAREST || minFilter == GL_LINEAR) ? static_cast<float>(lodOffset) : -FLT_MAX;
-}
-
-FLOAT ConvertMaxLOD(GLenum minFilter, unsigned int lodOffset)
-{
- return (minFilter == GL_NEAREST || minFilter == GL_LINEAR) ? static_cast<float>(lodOffset) : FLT_MAX;
-}
-
-}
-
-namespace d3d11_gl
-{
-
-GLenum ConvertBackBufferFormat(DXGI_FORMAT format)
-{
- switch (format)
- {
- case DXGI_FORMAT_R8G8B8A8_UNORM: return GL_RGBA8_OES;
- case DXGI_FORMAT_B8G8R8A8_UNORM: return GL_BGRA8_EXT;
- default:
- UNREACHABLE();
- }
-
- return GL_RGBA8_OES;
-}
-
-GLenum ConvertDepthStencilFormat(DXGI_FORMAT format)
-{
- switch (format)
- {
- case DXGI_FORMAT_UNKNOWN: return GL_NONE;
- case DXGI_FORMAT_D16_UNORM: return GL_DEPTH_COMPONENT16;
- case DXGI_FORMAT_D24_UNORM_S8_UINT: return GL_DEPTH24_STENCIL8_OES;
- default:
- UNREACHABLE();
- }
-
- return GL_DEPTH24_STENCIL8_OES;
-}
-
-GLenum ConvertRenderbufferFormat(DXGI_FORMAT format)
-{
- switch (format)
- {
- case DXGI_FORMAT_B8G8R8A8_UNORM:
- return GL_BGRA8_EXT;
- case DXGI_FORMAT_R8G8B8A8_UNORM:
- return GL_RGBA8_OES;
- case DXGI_FORMAT_D16_UNORM:
- return GL_DEPTH_COMPONENT16;
- case DXGI_FORMAT_D24_UNORM_S8_UINT:
- return GL_DEPTH24_STENCIL8_OES;
- default:
- UNREACHABLE();
- }
-
- return GL_RGBA8_OES;
-}
-
-GLenum ConvertTextureInternalFormat(DXGI_FORMAT format)
-{
- switch (format)
- {
- case DXGI_FORMAT_R8G8B8A8_UNORM:
- return GL_RGBA8_OES;
- case DXGI_FORMAT_A8_UNORM:
- return GL_ALPHA8_EXT;
- case DXGI_FORMAT_BC1_UNORM:
- return GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
- case DXGI_FORMAT_BC2_UNORM:
- return GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE;
- case DXGI_FORMAT_BC3_UNORM:
- return GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE;
- case DXGI_FORMAT_R32G32B32A32_FLOAT:
- return GL_RGBA32F_EXT;
- case DXGI_FORMAT_R32G32B32_FLOAT:
- return GL_RGB32F_EXT;
- case DXGI_FORMAT_R16G16B16A16_FLOAT:
- return GL_RGBA16F_EXT;
- case DXGI_FORMAT_B8G8R8A8_UNORM:
- return GL_BGRA8_EXT;
- case DXGI_FORMAT_R8_UNORM:
- return GL_R8_EXT;
- case DXGI_FORMAT_R8G8_UNORM:
- return GL_RG8_EXT;
- case DXGI_FORMAT_R16_FLOAT:
- return GL_R16F_EXT;
- case DXGI_FORMAT_R16G16_FLOAT:
- return GL_RG16F_EXT;
- case DXGI_FORMAT_D16_UNORM:
- return GL_DEPTH_COMPONENT16;
- case DXGI_FORMAT_D24_UNORM_S8_UINT:
- return GL_DEPTH24_STENCIL8_OES;
- case DXGI_FORMAT_UNKNOWN:
- return GL_NONE;
- default:
- UNREACHABLE();
- }
-
- return GL_RGBA8_OES;
-}
-
-}
-
-namespace gl_d3d11
-{
-
-DXGI_FORMAT ConvertRenderbufferFormat(GLenum format)
-{
- switch (format)
- {
- case GL_RGBA4:
- case GL_RGB5_A1:
- case GL_RGBA8_OES:
- case GL_RGB565:
- case GL_RGB8_OES:
- return DXGI_FORMAT_R8G8B8A8_UNORM;
- case GL_BGRA8_EXT:
- return DXGI_FORMAT_B8G8R8A8_UNORM;
- case GL_DEPTH_COMPONENT16:
- return DXGI_FORMAT_D16_UNORM;
- case GL_STENCIL_INDEX8:
- case GL_DEPTH24_STENCIL8_OES:
- return DXGI_FORMAT_D24_UNORM_S8_UINT;
- default:
- UNREACHABLE();
- }
-
- return DXGI_FORMAT_R8G8B8A8_UNORM;
-}
-
-DXGI_FORMAT ConvertTextureFormat(GLenum internalformat)
-{
- switch (internalformat)
- {
- case GL_RGB565:
- case GL_RGBA4:
- case GL_RGB5_A1:
- case GL_RGB8_OES:
- case GL_RGBA8_OES:
- case GL_LUMINANCE8_EXT:
- case GL_LUMINANCE8_ALPHA8_EXT:
- return DXGI_FORMAT_R8G8B8A8_UNORM;
- case GL_ALPHA8_EXT:
- return DXGI_FORMAT_A8_UNORM;
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- return DXGI_FORMAT_BC1_UNORM;
- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
- return DXGI_FORMAT_BC2_UNORM;
- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
- return DXGI_FORMAT_BC3_UNORM;
- case GL_RGBA32F_EXT:
- case GL_ALPHA32F_EXT:
- case GL_LUMINANCE_ALPHA32F_EXT:
- return DXGI_FORMAT_R32G32B32A32_FLOAT;
- case GL_RGB32F_EXT:
- case GL_LUMINANCE32F_EXT:
- return DXGI_FORMAT_R32G32B32A32_FLOAT;
- case GL_RGBA16F_EXT:
- case GL_ALPHA16F_EXT:
- case GL_LUMINANCE_ALPHA16F_EXT:
- case GL_RGB16F_EXT:
- case GL_LUMINANCE16F_EXT:
- return DXGI_FORMAT_R16G16B16A16_FLOAT;
- case GL_BGRA8_EXT:
- return DXGI_FORMAT_B8G8R8A8_UNORM;
- case GL_R8_EXT:
- return DXGI_FORMAT_R8_UNORM;
- case GL_RG8_EXT:
- return DXGI_FORMAT_R8G8_UNORM;
- case GL_R16F_EXT:
- return DXGI_FORMAT_R16_FLOAT;
- case GL_RG16F_EXT:
- return DXGI_FORMAT_R16G16_FLOAT;
- case GL_DEPTH_COMPONENT16:
- return DXGI_FORMAT_D16_UNORM;
- case GL_DEPTH_COMPONENT32_OES:
- case GL_DEPTH24_STENCIL8_OES:
- return DXGI_FORMAT_D24_UNORM_S8_UINT;
- case GL_NONE:
- return DXGI_FORMAT_UNKNOWN;
- default:
- UNREACHABLE();
- }
-
- return DXGI_FORMAT_R8G8B8A8_UNORM;
-}
-
-}
-
-namespace d3d11
-{
-
-void SetPositionTexCoordVertex(PositionTexCoordVertex* vertex, float x, float y, float u, float v)
-{
- vertex->x = x;
- vertex->y = y;
- vertex->u = u;
- vertex->v = v;
-}
-
-void SetPositionDepthColorVertex(PositionDepthColorVertex* vertex, float x, float y, float z,
- const gl::Color &color)
-{
- vertex->x = x;
- vertex->y = y;
- vertex->z = z;
- vertex->r = color.red;
- vertex->g = color.green;
- vertex->b = color.blue;
- vertex->a = color.alpha;
-}
-
-size_t ComputePixelSizeBits(DXGI_FORMAT format)
-{
- switch (format)
- {
- case DXGI_FORMAT_R1_UNORM:
- return 1;
-
- case DXGI_FORMAT_A8_UNORM:
- case DXGI_FORMAT_R8_SINT:
- case DXGI_FORMAT_R8_SNORM:
- case DXGI_FORMAT_R8_TYPELESS:
- case DXGI_FORMAT_R8_UINT:
- case DXGI_FORMAT_R8_UNORM:
- return 8;
-
- case DXGI_FORMAT_B5G5R5A1_UNORM:
- case DXGI_FORMAT_B5G6R5_UNORM:
- case DXGI_FORMAT_D16_UNORM:
- case DXGI_FORMAT_R16_FLOAT:
- case DXGI_FORMAT_R16_SINT:
- case DXGI_FORMAT_R16_SNORM:
- case DXGI_FORMAT_R16_TYPELESS:
- case DXGI_FORMAT_R16_UINT:
- case DXGI_FORMAT_R16_UNORM:
- case DXGI_FORMAT_R8G8_SINT:
- case DXGI_FORMAT_R8G8_SNORM:
- case DXGI_FORMAT_R8G8_TYPELESS:
- case DXGI_FORMAT_R8G8_UINT:
- case DXGI_FORMAT_R8G8_UNORM:
- return 16;
-
- case DXGI_FORMAT_B8G8R8X8_TYPELESS:
- case DXGI_FORMAT_B8G8R8X8_UNORM:
- case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
- case DXGI_FORMAT_D24_UNORM_S8_UINT:
- case DXGI_FORMAT_D32_FLOAT:
- case DXGI_FORMAT_D32_FLOAT_S8X24_UINT:
- case DXGI_FORMAT_G8R8_G8B8_UNORM:
- case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM:
- case DXGI_FORMAT_R10G10B10A2_TYPELESS:
- case DXGI_FORMAT_R10G10B10A2_UINT:
- case DXGI_FORMAT_R10G10B10A2_UNORM:
- case DXGI_FORMAT_R11G11B10_FLOAT:
- case DXGI_FORMAT_R16G16_FLOAT:
- case DXGI_FORMAT_R16G16_SINT:
- case DXGI_FORMAT_R16G16_SNORM:
- case DXGI_FORMAT_R16G16_TYPELESS:
- case DXGI_FORMAT_R16G16_UINT:
- case DXGI_FORMAT_R16G16_UNORM:
- case DXGI_FORMAT_R24_UNORM_X8_TYPELESS:
- case DXGI_FORMAT_R24G8_TYPELESS:
- case DXGI_FORMAT_R32_FLOAT:
- case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS:
- case DXGI_FORMAT_R32_SINT:
- case DXGI_FORMAT_R32_TYPELESS:
- case DXGI_FORMAT_R32_UINT:
- case DXGI_FORMAT_R8G8_B8G8_UNORM:
- case DXGI_FORMAT_R8G8B8A8_SINT:
- case DXGI_FORMAT_R8G8B8A8_SNORM:
- case DXGI_FORMAT_R8G8B8A8_TYPELESS:
- case DXGI_FORMAT_R8G8B8A8_UINT:
- case DXGI_FORMAT_R8G8B8A8_UNORM:
- case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
- case DXGI_FORMAT_B8G8R8A8_TYPELESS:
- case DXGI_FORMAT_B8G8R8A8_UNORM:
- case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
- case DXGI_FORMAT_R9G9B9E5_SHAREDEXP:
- case DXGI_FORMAT_X24_TYPELESS_G8_UINT:
- case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT:
- return 32;
-
- case DXGI_FORMAT_R16G16B16A16_FLOAT:
- case DXGI_FORMAT_R16G16B16A16_SINT:
- case DXGI_FORMAT_R16G16B16A16_SNORM:
- case DXGI_FORMAT_R16G16B16A16_TYPELESS:
- case DXGI_FORMAT_R16G16B16A16_UINT:
- case DXGI_FORMAT_R16G16B16A16_UNORM:
- case DXGI_FORMAT_R32G32_FLOAT:
- case DXGI_FORMAT_R32G32_SINT:
- case DXGI_FORMAT_R32G32_TYPELESS:
- case DXGI_FORMAT_R32G32_UINT:
- case DXGI_FORMAT_R32G8X24_TYPELESS:
- return 64;
-
- case DXGI_FORMAT_R32G32B32_FLOAT:
- case DXGI_FORMAT_R32G32B32_SINT:
- case DXGI_FORMAT_R32G32B32_TYPELESS:
- case DXGI_FORMAT_R32G32B32_UINT:
- return 96;
-
- case DXGI_FORMAT_R32G32B32A32_FLOAT:
- case DXGI_FORMAT_R32G32B32A32_SINT:
- case DXGI_FORMAT_R32G32B32A32_TYPELESS:
- case DXGI_FORMAT_R32G32B32A32_UINT:
- return 128;
-
- case DXGI_FORMAT_BC1_TYPELESS:
- case DXGI_FORMAT_BC1_UNORM:
- case DXGI_FORMAT_BC1_UNORM_SRGB:
- case DXGI_FORMAT_BC4_SNORM:
- case DXGI_FORMAT_BC4_TYPELESS:
- case DXGI_FORMAT_BC4_UNORM:
- return 4;
-
- case DXGI_FORMAT_BC2_TYPELESS:
- case DXGI_FORMAT_BC2_UNORM:
- case DXGI_FORMAT_BC2_UNORM_SRGB:
- case DXGI_FORMAT_BC3_TYPELESS:
- case DXGI_FORMAT_BC3_UNORM:
- case DXGI_FORMAT_BC3_UNORM_SRGB:
- case DXGI_FORMAT_BC5_SNORM:
- case DXGI_FORMAT_BC5_TYPELESS:
- case DXGI_FORMAT_BC5_UNORM:
- case DXGI_FORMAT_BC6H_SF16:
- case DXGI_FORMAT_BC6H_TYPELESS:
- case DXGI_FORMAT_BC6H_UF16:
- case DXGI_FORMAT_BC7_TYPELESS:
- case DXGI_FORMAT_BC7_UNORM:
- case DXGI_FORMAT_BC7_UNORM_SRGB:
- return 8;
-
- default:
- return 0;
- }
-}
-
-size_t ComputeBlockSizeBits(DXGI_FORMAT format)
-{
- switch (format)
- {
- case DXGI_FORMAT_BC1_TYPELESS:
- case DXGI_FORMAT_BC1_UNORM:
- case DXGI_FORMAT_BC1_UNORM_SRGB:
- case DXGI_FORMAT_BC4_SNORM:
- case DXGI_FORMAT_BC4_TYPELESS:
- case DXGI_FORMAT_BC4_UNORM:
- case DXGI_FORMAT_BC2_TYPELESS:
- case DXGI_FORMAT_BC2_UNORM:
- case DXGI_FORMAT_BC2_UNORM_SRGB:
- case DXGI_FORMAT_BC3_TYPELESS:
- case DXGI_FORMAT_BC3_UNORM:
- case DXGI_FORMAT_BC3_UNORM_SRGB:
- case DXGI_FORMAT_BC5_SNORM:
- case DXGI_FORMAT_BC5_TYPELESS:
- case DXGI_FORMAT_BC5_UNORM:
- case DXGI_FORMAT_BC6H_SF16:
- case DXGI_FORMAT_BC6H_TYPELESS:
- case DXGI_FORMAT_BC6H_UF16:
- case DXGI_FORMAT_BC7_TYPELESS:
- case DXGI_FORMAT_BC7_UNORM:
- case DXGI_FORMAT_BC7_UNORM_SRGB:
- return ComputePixelSizeBits(format) * 16;
- default:
- UNREACHABLE();
- return 0;
- }
-}
-
-bool IsCompressed(DXGI_FORMAT format)
-{
- switch (format)
- {
- case DXGI_FORMAT_BC1_TYPELESS:
- case DXGI_FORMAT_BC1_UNORM:
- case DXGI_FORMAT_BC1_UNORM_SRGB:
- case DXGI_FORMAT_BC4_SNORM:
- case DXGI_FORMAT_BC4_TYPELESS:
- case DXGI_FORMAT_BC4_UNORM:
- case DXGI_FORMAT_BC2_TYPELESS:
- case DXGI_FORMAT_BC2_UNORM:
- case DXGI_FORMAT_BC2_UNORM_SRGB:
- case DXGI_FORMAT_BC3_TYPELESS:
- case DXGI_FORMAT_BC3_UNORM:
- case DXGI_FORMAT_BC3_UNORM_SRGB:
- case DXGI_FORMAT_BC5_SNORM:
- case DXGI_FORMAT_BC5_TYPELESS:
- case DXGI_FORMAT_BC5_UNORM:
- case DXGI_FORMAT_BC6H_SF16:
- case DXGI_FORMAT_BC6H_TYPELESS:
- case DXGI_FORMAT_BC6H_UF16:
- case DXGI_FORMAT_BC7_TYPELESS:
- case DXGI_FORMAT_BC7_UNORM:
- case DXGI_FORMAT_BC7_UNORM_SRGB:
- return true;
- case DXGI_FORMAT_UNKNOWN:
- UNREACHABLE();
- return false;
- default:
- return false;
- }
-}
-
-unsigned int GetTextureFormatDimensionAlignment(DXGI_FORMAT format)
-{
- switch (format)
- {
- case DXGI_FORMAT_BC1_TYPELESS:
- case DXGI_FORMAT_BC1_UNORM:
- case DXGI_FORMAT_BC1_UNORM_SRGB:
- case DXGI_FORMAT_BC4_SNORM:
- case DXGI_FORMAT_BC4_TYPELESS:
- case DXGI_FORMAT_BC4_UNORM:
- case DXGI_FORMAT_BC2_TYPELESS:
- case DXGI_FORMAT_BC2_UNORM:
- case DXGI_FORMAT_BC2_UNORM_SRGB:
- case DXGI_FORMAT_BC3_TYPELESS:
- case DXGI_FORMAT_BC3_UNORM:
- case DXGI_FORMAT_BC3_UNORM_SRGB:
- case DXGI_FORMAT_BC5_SNORM:
- case DXGI_FORMAT_BC5_TYPELESS:
- case DXGI_FORMAT_BC5_UNORM:
- case DXGI_FORMAT_BC6H_SF16:
- case DXGI_FORMAT_BC6H_TYPELESS:
- case DXGI_FORMAT_BC6H_UF16:
- case DXGI_FORMAT_BC7_TYPELESS:
- case DXGI_FORMAT_BC7_UNORM:
- case DXGI_FORMAT_BC7_UNORM_SRGB:
- return 4;
- case DXGI_FORMAT_UNKNOWN:
- UNREACHABLE();
- return 1;
- default:
- return 1;
- }
-}
-
-bool IsDepthStencilFormat(DXGI_FORMAT format)
-{
- switch (format)
- {
- case DXGI_FORMAT_D32_FLOAT_S8X24_UINT:
- case DXGI_FORMAT_D32_FLOAT:
- case DXGI_FORMAT_D24_UNORM_S8_UINT:
- case DXGI_FORMAT_D16_UNORM:
- return true;
- default:
- return false;
- }
-}
-
-DXGI_FORMAT GetDepthTextureFormat(DXGI_FORMAT format)
-{
- switch (format)
- {
- case DXGI_FORMAT_D32_FLOAT_S8X24_UINT: return DXGI_FORMAT_R32G8X24_TYPELESS;
- case DXGI_FORMAT_D32_FLOAT: return DXGI_FORMAT_R32_TYPELESS;
- case DXGI_FORMAT_D24_UNORM_S8_UINT: return DXGI_FORMAT_R24G8_TYPELESS;
- case DXGI_FORMAT_D16_UNORM: return DXGI_FORMAT_R16_TYPELESS;
- default: UNREACHABLE(); return DXGI_FORMAT_UNKNOWN;
- }
-}
-
-DXGI_FORMAT GetDepthShaderResourceFormat(DXGI_FORMAT format)
-{
- switch (format)
- {
- case DXGI_FORMAT_D32_FLOAT_S8X24_UINT: return DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS;
- case DXGI_FORMAT_D32_FLOAT: return DXGI_FORMAT_R32_UINT;
- case DXGI_FORMAT_D24_UNORM_S8_UINT: return DXGI_FORMAT_R24_UNORM_X8_TYPELESS;
- case DXGI_FORMAT_D16_UNORM: return DXGI_FORMAT_R16_UNORM;
- default: UNREACHABLE(); return DXGI_FORMAT_UNKNOWN;
- }
-}
-
-HRESULT SetDebugName(ID3D11DeviceChild *resource, const char *name)
-{
-#if defined(_DEBUG)
- return resource->SetPrivateData(WKPDID_D3DDebugObjectName, strlen(name), name);
-#else
- return S_OK;
-#endif
-}
-
-}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/renderer11_utils.h b/chromium/third_party/angle/src/libGLESv2/renderer/renderer11_utils.h
deleted file mode 100644
index 1bc48c1a135..00000000000
--- a/chromium/third_party/angle/src/libGLESv2/renderer/renderer11_utils.h
+++ /dev/null
@@ -1,95 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// renderer11_utils.h: Conversion functions and other utility routines
-// specific to the D3D11 renderer.
-
-#ifndef LIBGLESV2_RENDERER_RENDERER11_UTILS_H
-#define LIBGLESV2_RENDERER_RENDERER11_UTILS_H
-
-#include "libGLESv2/angletypes.h"
-
-namespace gl_d3d11
-{
-
-D3D11_BLEND ConvertBlendFunc(GLenum glBlend, bool isAlpha);
-D3D11_BLEND_OP ConvertBlendOp(GLenum glBlendOp);
-UINT8 ConvertColorMask(bool maskRed, bool maskGreen, bool maskBlue, bool maskAlpha);
-
-D3D11_CULL_MODE ConvertCullMode(bool cullEnabled, GLenum cullMode);
-
-D3D11_COMPARISON_FUNC ConvertComparison(GLenum comparison);
-D3D11_DEPTH_WRITE_MASK ConvertDepthMask(bool depthWriteEnabled);
-UINT8 ConvertStencilMask(GLuint stencilmask);
-D3D11_STENCIL_OP ConvertStencilOp(GLenum stencilOp);
-
-D3D11_FILTER ConvertFilter(GLenum minFilter, GLenum magFilter, float maxAnisotropy);
-D3D11_TEXTURE_ADDRESS_MODE ConvertTextureWrap(GLenum wrap);
-FLOAT ConvertMinLOD(GLenum minFilter, unsigned int lodOffset);
-FLOAT ConvertMaxLOD(GLenum minFilter, unsigned int lodOffset);
-
-DXGI_FORMAT ConvertRenderbufferFormat(GLenum format);
-DXGI_FORMAT ConvertTextureFormat(GLenum format);
-}
-
-namespace d3d11_gl
-{
-
-GLenum ConvertBackBufferFormat(DXGI_FORMAT format);
-GLenum ConvertDepthStencilFormat(DXGI_FORMAT format);
-GLenum ConvertRenderbufferFormat(DXGI_FORMAT format);
-GLenum ConvertTextureInternalFormat(DXGI_FORMAT format);
-
-}
-
-namespace d3d11
-{
-
-struct PositionTexCoordVertex
-{
- float x, y;
- float u, v;
-};
-void SetPositionTexCoordVertex(PositionTexCoordVertex* vertex, float x, float y, float u, float v);
-
-struct PositionDepthColorVertex
-{
- float x, y, z;
- float r, g, b, a;
-};
-void SetPositionDepthColorVertex(PositionDepthColorVertex* vertex, float x, float y, float z,
- const gl::Color &color);
-
-size_t ComputePixelSizeBits(DXGI_FORMAT format);
-size_t ComputeBlockSizeBits(DXGI_FORMAT format);
-
-bool IsCompressed(DXGI_FORMAT format);
-unsigned int GetTextureFormatDimensionAlignment(DXGI_FORMAT format);
-
-bool IsDepthStencilFormat(DXGI_FORMAT format);
-DXGI_FORMAT GetDepthTextureFormat(DXGI_FORMAT format);
-DXGI_FORMAT GetDepthShaderResourceFormat(DXGI_FORMAT format);
-
-HRESULT SetDebugName(ID3D11DeviceChild *resource, const char *name);
-
-inline bool isDeviceLostError(HRESULT errorCode)
-{
- switch (errorCode)
- {
- case DXGI_ERROR_DEVICE_HUNG:
- case DXGI_ERROR_DEVICE_REMOVED:
- case DXGI_ERROR_DEVICE_RESET:
- case DXGI_ERROR_DRIVER_INTERNAL_ERROR:
- case DXGI_ERROR_NOT_CURRENTLY_AVAILABLE:
- return true;
- default:
- return false;
- }
-}
-
-}
-
-#endif // LIBGLESV2_RENDERER_RENDERER11_UTILS_H
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/Blit.ps b/chromium/third_party/angle/src/libGLESv2/renderer/shaders/Blit.ps
deleted file mode 100644
index dcb3bd0e76b..00000000000
--- a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/Blit.ps
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-sampler2D tex : s0;
-
-uniform float4 mode : c0;
-
-// Passthrough Pixel Shader
-// Outputs texture 0 sampled at texcoord 0.
-float4 passthroughps(float4 texcoord : TEXCOORD0) : COLOR
-{
- return tex2D(tex, texcoord.xy);
-};
-
-// Luminance Conversion Pixel Shader
-// Outputs sample(tex0, tc0).rrra.
-// For LA output (pass A) set C0.X = 1, C0.Y = 0.
-// For L output (A = 1) set C0.X = 0, C0.Y = 1.
-float4 luminanceps(float4 texcoord : TEXCOORD0) : COLOR
-{
- float4 tmp = tex2D(tex, texcoord.xy);
- tmp.w = tmp.w * mode.x + mode.y;
- return tmp.xxxw;
-};
-
-// RGB/A Component Mask Pixel Shader
-// Outputs sample(tex0, tc0) with options to force RGB = 0 and/or A = 1.
-// To force RGB = 0, set C0.X = 0, otherwise C0.X = 1.
-// To force A = 1, set C0.Z = 0, C0.W = 1, otherwise C0.Z = 1, C0.W = 0.
-float4 componentmaskps(float4 texcoord : TEXCOORD0) : COLOR
-{
- float4 tmp = tex2D(tex, texcoord.xy);
- tmp.xyz = tmp.xyz * mode.x;
- tmp.w = tmp.w * mode.z + mode.w;
- return tmp;
-};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/Clear11.hlsl b/chromium/third_party/angle/src/libGLESv2/renderer/shaders/Clear11.hlsl
deleted file mode 100644
index 042ac699b66..00000000000
--- a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/Clear11.hlsl
+++ /dev/null
@@ -1,38 +0,0 @@
-void VS_Clear( in float3 inPosition : POSITION, in float4 inColor : COLOR,
- out float4 outPosition : SV_POSITION, out float4 outColor : COLOR)
-{
- outPosition = float4(inPosition, 1.0f);
- outColor = inColor;
-}
-
-// Assume we are in SM4+, which has 8 color outputs
-struct PS_OutputMultiple
-{
- float4 color0 : SV_TARGET0;
- float4 color1 : SV_TARGET1;
- float4 color2 : SV_TARGET2;
- float4 color3 : SV_TARGET3;
- float4 color4 : SV_TARGET4;
- float4 color5 : SV_TARGET5;
- float4 color6 : SV_TARGET6;
- float4 color7 : SV_TARGET7;
-};
-
-PS_OutputMultiple PS_ClearMultiple(in float4 inPosition : SV_POSITION, in float4 inColor : COLOR)
-{
- PS_OutputMultiple outColor;
- outColor.color0 = inColor;
- outColor.color1 = inColor;
- outColor.color2 = inColor;
- outColor.color3 = inColor;
- outColor.color4 = inColor;
- outColor.color5 = inColor;
- outColor.color6 = inColor;
- outColor.color7 = inColor;
- return outColor;
-}
-
-float4 PS_ClearSingle(in float4 inPosition : SV_Position, in float4 inColor : COLOR) : SV_Target0
-{
- return inColor;
-}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/Passthrough11.hlsl b/chromium/third_party/angle/src/libGLESv2/renderer/shaders/Passthrough11.hlsl
deleted file mode 100644
index 43b7801efc1..00000000000
--- a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/Passthrough11.hlsl
+++ /dev/null
@@ -1,29 +0,0 @@
-Texture2D Texture : register(t0);
-SamplerState Sampler : register(s0);
-
-void VS_Passthrough( in float2 inPosition : POSITION, in float2 inTexCoord : TEXCOORD0,
- out float4 outPosition : SV_POSITION, out float2 outTexCoord : TEXCOORD0)
-{
- outPosition = float4(inPosition, 0.0f, 1.0f);
- outTexCoord = inTexCoord;
-}
-
-float4 PS_PassthroughRGBA(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- return Texture.Sample(Sampler, inTexCoord).rgba;
-}
-
-float4 PS_PassthroughRGB(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- return float4(Texture.Sample(Sampler, inTexCoord).rgb, 1.0f);
-}
-
-float4 PS_PassthroughLum(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- return float4(Texture.Sample(Sampler, inTexCoord).rrr, 1.0f);
-}
-
-float4 PS_PassthroughLumAlpha(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
-{
- return Texture.Sample(Sampler, inTexCoord).rrra;
-}
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/clearsingle11ps.h b/chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/clearsingle11ps.h
deleted file mode 100644
index dde816a0e85..00000000000
--- a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/clearsingle11ps.h
+++ /dev/null
@@ -1,110 +0,0 @@
-#if 0
-//
-// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
-//
-//
-///
-//
-// Input signature:
-//
-// Name Index Mask Register SysValue Format Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// SV_Position 0 xyzw 0 POS float
-// COLOR 0 xyzw 1 NONE float xyzw
-//
-//
-// Output signature:
-//
-// Name Index Mask Register SysValue Format Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// SV_Target 0 xyzw 0 TARGET float xyzw
-//
-ps_4_0
-dcl_input_ps linear v1.xyzw
-dcl_output o0.xyzw
-mov o0.xyzw, v1.xyzw
-ret
-// Approximately 2 instruction slots used
-#endif
-
-const BYTE g_PS_ClearSingle[] =
-{
- 68, 88, 66, 67, 13, 152,
- 32, 49, 222, 236, 92, 20,
- 188, 71, 88, 46, 163, 241,
- 188, 238, 1, 0, 0, 0,
- 208, 1, 0, 0, 5, 0,
- 0, 0, 52, 0, 0, 0,
- 140, 0, 0, 0, 224, 0,
- 0, 0, 20, 1, 0, 0,
- 84, 1, 0, 0, 82, 68,
- 69, 70, 80, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 28, 0, 0, 0, 0, 4,
- 255, 255, 0, 1, 0, 0,
- 28, 0, 0, 0, 77, 105,
- 99, 114, 111, 115, 111, 102,
- 116, 32, 40, 82, 41, 32,
- 72, 76, 83, 76, 32, 83,
- 104, 97, 100, 101, 114, 32,
- 67, 111, 109, 112, 105, 108,
- 101, 114, 32, 57, 46, 51,
- 48, 46, 57, 50, 48, 48,
- 46, 49, 54, 51, 56, 52,
- 0, 171, 73, 83, 71, 78,
- 76, 0, 0, 0, 2, 0,
- 0, 0, 8, 0, 0, 0,
- 56, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0,
- 3, 0, 0, 0, 0, 0,
- 0, 0, 15, 0, 0, 0,
- 68, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 3, 0, 0, 0, 1, 0,
- 0, 0, 15, 15, 0, 0,
- 83, 86, 95, 80, 111, 115,
- 105, 116, 105, 111, 110, 0,
- 67, 79, 76, 79, 82, 0,
- 171, 171, 79, 83, 71, 78,
- 44, 0, 0, 0, 1, 0,
- 0, 0, 8, 0, 0, 0,
- 32, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 3, 0, 0, 0, 0, 0,
- 0, 0, 15, 0, 0, 0,
- 83, 86, 95, 84, 97, 114,
- 103, 101, 116, 0, 171, 171,
- 83, 72, 68, 82, 56, 0,
- 0, 0, 64, 0, 0, 0,
- 14, 0, 0, 0, 98, 16,
- 0, 3, 242, 16, 16, 0,
- 1, 0, 0, 0, 101, 0,
- 0, 3, 242, 32, 16, 0,
- 0, 0, 0, 0, 54, 0,
- 0, 5, 242, 32, 16, 0,
- 0, 0, 0, 0, 70, 30,
- 16, 0, 1, 0, 0, 0,
- 62, 0, 0, 1, 83, 84,
- 65, 84, 116, 0, 0, 0,
- 2, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 2, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 2, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0
-};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/componentmaskps.h b/chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/componentmaskps.h
deleted file mode 100644
index a6ec1d99d2b..00000000000
--- a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/compiled/componentmaskps.h
+++ /dev/null
@@ -1,79 +0,0 @@
-#if 0
-//
-// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
-//
-///
-// Parameters:
-//
-// float4 mode;
-// sampler2D tex;
-//
-//
-// Registers:
-//
-// Name Reg Size
-// ------------ ----- ----
-// mode c0 1
-// tex s0 1
-//
-
- ps_2_0
- dcl t0.xy
- dcl_2d s0
- texld r0, t0, s0
- mul r1.xyz, r0, c0.x
- mad r1.w, r0.w, c0.z, c0.w
- mov oC0, r1
-
-// approximately 4 instruction slots used (1 texture, 3 arithmetic)
-#endif
-
-const BYTE g_ps20_componentmaskps[] =
-{
- 0, 2, 255, 255, 254, 255,
- 44, 0, 67, 84, 65, 66,
- 28, 0, 0, 0, 119, 0,
- 0, 0, 0, 2, 255, 255,
- 2, 0, 0, 0, 28, 0,
- 0, 0, 0, 1, 0, 0,
- 112, 0, 0, 0, 68, 0,
- 0, 0, 2, 0, 0, 0,
- 1, 0, 0, 0, 76, 0,
- 0, 0, 0, 0, 0, 0,
- 92, 0, 0, 0, 3, 0,
- 0, 0, 1, 0, 0, 0,
- 96, 0, 0, 0, 0, 0,
- 0, 0, 109, 111, 100, 101,
- 0, 171, 171, 171, 1, 0,
- 3, 0, 1, 0, 4, 0,
- 1, 0, 0, 0, 0, 0,
- 0, 0, 116, 101, 120, 0,
- 4, 0, 12, 0, 1, 0,
- 1, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 112, 115,
- 95, 50, 95, 48, 0, 77,
- 105, 99, 114, 111, 115, 111,
- 102, 116, 32, 40, 82, 41,
- 32, 72, 76, 83, 76, 32,
- 83, 104, 97, 100, 101, 114,
- 32, 67, 111, 109, 112, 105,
- 108, 101, 114, 32, 57, 46,
- 51, 48, 46, 57, 50, 48,
- 48, 46, 49, 54, 51, 56,
- 52, 0, 171, 171, 31, 0,
- 0, 2, 0, 0, 0, 128,
- 0, 0, 3, 176, 31, 0,
- 0, 2, 0, 0, 0, 144,
- 0, 8, 15, 160, 66, 0,
- 0, 3, 0, 0, 15, 128,
- 0, 0, 228, 176, 0, 8,
- 228, 160, 5, 0, 0, 3,
- 1, 0, 7, 128, 0, 0,
- 228, 128, 0, 0, 0, 160,
- 4, 0, 0, 4, 1, 0,
- 8, 128, 0, 0, 255, 128,
- 0, 0, 170, 160, 0, 0,
- 255, 160, 1, 0, 0, 2,
- 0, 8, 15, 128, 1, 0,
- 228, 128, 255, 255, 0, 0
-};
diff --git a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/generate_shaders.bat b/chromium/third_party/angle/src/libGLESv2/renderer/shaders/generate_shaders.bat
deleted file mode 100644
index 48fd7ee1835..00000000000
--- a/chromium/third_party/angle/src/libGLESv2/renderer/shaders/generate_shaders.bat
+++ /dev/null
@@ -1,24 +0,0 @@
-@ECHO OFF
-REM
-REM Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-REM Use of this source code is governed by a BSD-style license that can be
-REM found in the LICENSE file.
-REM
-
-PATH %PATH%;%ProgramFiles(x86)%\Windows Kits\8.0\bin\x86;%DXSDK_DIR%\Utilities\bin\x86
-
-fxc /E standardvs /T vs_2_0 /Fh compiled/standardvs.h Blit.vs
-fxc /E flipyvs /T vs_2_0 /Fh compiled/flipyvs.h Blit.vs
-fxc /E passthroughps /T ps_2_0 /Fh compiled/passthroughps.h Blit.ps
-fxc /E luminanceps /T ps_2_0 /Fh compiled/luminanceps.h Blit.ps
-fxc /E componentmaskps /T ps_2_0 /Fh compiled/componentmaskps.h Blit.ps
-
-fxc /E VS_Passthrough /T vs_4_0 /Fh compiled/passthrough11vs.h Passthrough11.hlsl
-fxc /E PS_PassthroughRGBA /T ps_4_0 /Fh compiled/passthroughrgba11ps.h Passthrough11.hlsl
-fxc /E PS_PassthroughRGB /T ps_4_0 /Fh compiled/passthroughrgb11ps.h Passthrough11.hlsl
-fxc /E PS_PassthroughLum /T ps_4_0 /Fh compiled/passthroughlum11ps.h Passthrough11.hlsl
-fxc /E PS_PassthroughLumAlpha /T ps_4_0 /Fh compiled/passthroughlumalpha11ps.h Passthrough11.hlsl
-
-fxc /E VS_Clear /T vs_4_0 /Fh compiled/clear11vs.h Clear11.hlsl
-fxc /E PS_ClearSingle /T ps_4_0 /Fh compiled/clearsingle11ps.h Clear11.hlsl
-fxc /E PS_ClearMultiple /T ps_4_0 /Fh compiled/clearmultiple11ps.h Clear11.hlsl
diff --git a/chromium/third_party/angle/src/libGLESv2/utilities.cpp b/chromium/third_party/angle/src/libGLESv2/utilities.cpp
deleted file mode 100644
index 32df49e672b..00000000000
--- a/chromium/third_party/angle/src/libGLESv2/utilities.cpp
+++ /dev/null
@@ -1,769 +0,0 @@
-#include "precompiled.h"
-//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// utilities.cpp: Conversion functions and other utility routines.
-
-#include "libGLESv2/utilities.h"
-#include "libGLESv2/mathutil.h"
-
-namespace gl
-{
-
-int UniformComponentCount(GLenum type)
-{
- switch (type)
- {
- case GL_BOOL:
- case GL_FLOAT:
- case GL_INT:
- case GL_SAMPLER_2D:
- case GL_SAMPLER_CUBE:
- return 1;
- case GL_BOOL_VEC2:
- case GL_FLOAT_VEC2:
- case GL_INT_VEC2:
- return 2;
- case GL_INT_VEC3:
- case GL_FLOAT_VEC3:
- case GL_BOOL_VEC3:
- return 3;
- case GL_BOOL_VEC4:
- case GL_FLOAT_VEC4:
- case GL_INT_VEC4:
- case GL_FLOAT_MAT2:
- return 4;
- case GL_FLOAT_MAT3:
- return 9;
- case GL_FLOAT_MAT4:
- return 16;
- default:
- UNREACHABLE();
- }
-
- return 0;
-}
-
-GLenum UniformComponentType(GLenum type)
-{
- switch(type)
- {
- case GL_BOOL:
- case GL_BOOL_VEC2:
- case GL_BOOL_VEC3:
- case GL_BOOL_VEC4:
- return GL_BOOL;
- case GL_FLOAT:
- case GL_FLOAT_VEC2:
- case GL_FLOAT_VEC3:
- case GL_FLOAT_VEC4:
- case GL_FLOAT_MAT2:
- case GL_FLOAT_MAT3:
- case GL_FLOAT_MAT4:
- return GL_FLOAT;
- case GL_INT:
- case GL_SAMPLER_2D:
- case GL_SAMPLER_CUBE:
- case GL_INT_VEC2:
- case GL_INT_VEC3:
- case GL_INT_VEC4:
- return GL_INT;
- default:
- UNREACHABLE();
- }
-
- return GL_NONE;
-}
-
-size_t UniformComponentSize(GLenum type)
-{
- switch(type)
- {
- case GL_BOOL: return sizeof(GLint);
- case GL_FLOAT: return sizeof(GLfloat);
- case GL_INT: return sizeof(GLint);
- default: UNREACHABLE();
- }
-
- return 0;
-}
-
-size_t UniformInternalSize(GLenum type)
-{
- // Expanded to 4-element vectors
- return UniformComponentSize(UniformComponentType(type)) * VariableRowCount(type) * 4;
-}
-
-size_t UniformExternalSize(GLenum type)
-{
- return UniformComponentSize(UniformComponentType(type)) * UniformComponentCount(type);
-}
-
-int VariableRowCount(GLenum type)
-{
- switch (type)
- {
- case GL_NONE:
- return 0;
- case GL_BOOL:
- case GL_FLOAT:
- case GL_INT:
- case GL_BOOL_VEC2:
- case GL_FLOAT_VEC2:
- case GL_INT_VEC2:
- case GL_INT_VEC3:
- case GL_FLOAT_VEC3:
- case GL_BOOL_VEC3:
- case GL_BOOL_VEC4:
- case GL_FLOAT_VEC4:
- case GL_INT_VEC4:
- case GL_SAMPLER_2D:
- case GL_SAMPLER_CUBE:
- return 1;
- case GL_FLOAT_MAT2:
- return 2;
- case GL_FLOAT_MAT3:
- return 3;
- case GL_FLOAT_MAT4:
- return 4;
- default:
- UNREACHABLE();
- }
-
- return 0;
-}
-
-int VariableColumnCount(GLenum type)
-{
- switch (type)
- {
- case GL_NONE:
- return 0;
- case GL_BOOL:
- case GL_FLOAT:
- case GL_INT:
- case GL_SAMPLER_2D:
- case GL_SAMPLER_CUBE:
- return 1;
- case GL_BOOL_VEC2:
- case GL_FLOAT_VEC2:
- case GL_INT_VEC2:
- case GL_FLOAT_MAT2:
- return 2;
- case GL_INT_VEC3:
- case GL_FLOAT_VEC3:
- case GL_BOOL_VEC3:
- case GL_FLOAT_MAT3:
- return 3;
- case GL_BOOL_VEC4:
- case GL_FLOAT_VEC4:
- case GL_INT_VEC4:
- case GL_FLOAT_MAT4:
- return 4;
- default:
- UNREACHABLE();
- }
-
- return 0;
-}
-
-int AllocateFirstFreeBits(unsigned int *bits, unsigned int allocationSize, unsigned int bitsSize)
-{
- ASSERT(allocationSize <= bitsSize);
-
- unsigned int mask = std::numeric_limits<unsigned int>::max() >> (std::numeric_limits<unsigned int>::digits - allocationSize);
-
- for (unsigned int i = 0; i < bitsSize - allocationSize + 1; i++)
- {
- if ((*bits & mask) == 0)
- {
- *bits |= mask;
- return i;
- }
-
- mask <<= 1;
- }
-
- return -1;
-}
-
-GLsizei ComputePitch(GLsizei width, GLint internalformat, GLint alignment)
-{
- ASSERT(alignment > 0 && isPow2(alignment));
-
- GLsizei rawPitch = ComputePixelSize(internalformat) * width;
- return (rawPitch + alignment - 1) & ~(alignment - 1);
-}
-
-GLsizei ComputeCompressedPitch(GLsizei width, GLenum internalformat)
-{
- return ComputeCompressedSize(width, 1, internalformat);
-}
-
-GLsizei ComputeCompressedSize(GLsizei width, GLsizei height, GLenum internalformat)
-{
- switch (internalformat)
- {
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- return 8 * ((width + 3) / 4) * ((height + 3) / 4);
- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
- return 16 * ((width + 3) / 4) * ((height + 3) / 4);
- default:
- return 0;
- }
-}
-
-GLsizei ComputeTypeSize(GLenum type)
-{
- switch (type)
- {
- case GL_BYTE: return 1;
- case GL_UNSIGNED_BYTE: return 1;
- case GL_SHORT: return 2;
- case GL_UNSIGNED_SHORT: return 2;
- case GL_INT: return 4;
- case GL_UNSIGNED_INT: return 4;
- case GL_FLOAT: return 4;
- case GL_HALF_FLOAT_OES: return 2;
- case GL_UNSIGNED_SHORT_5_6_5: return 2;
- case GL_UNSIGNED_SHORT_4_4_4_4: return 2;
- case GL_UNSIGNED_SHORT_5_5_5_1: return 2;
- case GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT: return 2;
- case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT: return 2;
- case GL_UNSIGNED_INT_2_10_10_10_REV_EXT: return 4;
- case GL_UNSIGNED_INT_24_8_OES: return 4;
- default: UNREACHABLE(); return 0;
- }
-}
-
-bool IsCompressed(GLenum format)
-{
- if(format == GL_COMPRESSED_RGB_S3TC_DXT1_EXT ||
- format == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT ||
- format == GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE ||
- format == GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE)
- {
- return true;
- }
- else
- {
- return false;
- }
-}
-
-bool IsDepthTexture(GLenum format)
-{
- if (format == GL_DEPTH_COMPONENT ||
- format == GL_DEPTH_STENCIL_OES ||
- format == GL_DEPTH_COMPONENT16 ||
- format == GL_DEPTH_COMPONENT32_OES ||
- format == GL_DEPTH24_STENCIL8_OES)
- {
- return true;
- }
-
- return false;
-}
-
-bool IsStencilTexture(GLenum format)
-{
- if (format == GL_DEPTH_STENCIL_OES ||
- format == GL_DEPTH24_STENCIL8_OES)
- {
- return true;
- }
-
- return false;
-}
-
-void MakeValidSize(bool isImage, bool isCompressed, GLsizei *requestWidth, GLsizei *requestHeight, int *levelOffset)
-{
- int upsampleCount = 0;
-
- if (isCompressed)
- {
- // Don't expand the size of full textures that are at least 4x4
- // already.
- if (isImage || *requestWidth < 4 || *requestHeight < 4)
- {
- while (*requestWidth % 4 != 0 || *requestHeight % 4 != 0)
- {
- *requestWidth <<= 1;
- *requestHeight <<= 1;
- upsampleCount++;
- }
- }
- }
- *levelOffset = upsampleCount;
-}
-
-// Returns the size, in bytes, of a single texel in an Image
-int ComputePixelSize(GLint internalformat)
-{
- switch (internalformat)
- {
- case GL_ALPHA8_EXT: return sizeof(unsigned char);
- case GL_LUMINANCE8_EXT: return sizeof(unsigned char);
- case GL_ALPHA32F_EXT: return sizeof(float);
- case GL_LUMINANCE32F_EXT: return sizeof(float);
- case GL_ALPHA16F_EXT: return sizeof(unsigned short);
- case GL_LUMINANCE16F_EXT: return sizeof(unsigned short);
- case GL_LUMINANCE8_ALPHA8_EXT: return sizeof(unsigned char) * 2;
- case GL_LUMINANCE_ALPHA32F_EXT: return sizeof(float) * 2;
- case GL_LUMINANCE_ALPHA16F_EXT: return sizeof(unsigned short) * 2;
- case GL_RGB8_OES: return sizeof(unsigned char) * 3;
- case GL_RGB565: return sizeof(unsigned short);
- case GL_RGB32F_EXT: return sizeof(float) * 3;
- case GL_RGB16F_EXT: return sizeof(unsigned short) * 3;
- case GL_RGBA8_OES: return sizeof(unsigned char) * 4;
- case GL_RGBA4: return sizeof(unsigned short);
- case GL_RGB5_A1: return sizeof(unsigned short);
- case GL_RGBA32F_EXT: return sizeof(float) * 4;
- case GL_RGBA16F_EXT: return sizeof(unsigned short) * 4;
- case GL_BGRA8_EXT: return sizeof(unsigned char) * 4;
- case GL_BGRA4_ANGLEX: return sizeof(unsigned short);
- case GL_BGR5_A1_ANGLEX: return sizeof(unsigned short);
- default: UNREACHABLE();
- }
-
- return 0;
-}
-
-bool IsCubemapTextureTarget(GLenum target)
-{
- return (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z);
-}
-
-bool IsInternalTextureTarget(GLenum target)
-{
- return target == GL_TEXTURE_2D || IsCubemapTextureTarget(target);
-}
-
-GLint ConvertSizedInternalFormat(GLenum format, GLenum type)
-{
- switch (format)
- {
- case GL_ALPHA:
- switch (type)
- {
- case GL_UNSIGNED_BYTE: return GL_ALPHA8_EXT;
- case GL_FLOAT: return GL_ALPHA32F_EXT;
- case GL_HALF_FLOAT_OES: return GL_ALPHA16F_EXT;
- default: UNIMPLEMENTED();
- }
- break;
- case GL_LUMINANCE:
- switch (type)
- {
- case GL_UNSIGNED_BYTE: return GL_LUMINANCE8_EXT;
- case GL_FLOAT: return GL_LUMINANCE32F_EXT;
- case GL_HALF_FLOAT_OES: return GL_LUMINANCE16F_EXT;
- default: UNIMPLEMENTED();
- }
- break;
- case GL_LUMINANCE_ALPHA:
- switch (type)
- {
- case GL_UNSIGNED_BYTE: return GL_LUMINANCE8_ALPHA8_EXT;
- case GL_FLOAT: return GL_LUMINANCE_ALPHA32F_EXT;
- case GL_HALF_FLOAT_OES: return GL_LUMINANCE_ALPHA16F_EXT;
- default: UNIMPLEMENTED();
- }
- break;
- case GL_RGB:
- switch (type)
- {
- case GL_UNSIGNED_BYTE: return GL_RGB8_OES;
- case GL_UNSIGNED_SHORT_5_6_5: return GL_RGB565;
- case GL_FLOAT: return GL_RGB32F_EXT;
- case GL_HALF_FLOAT_OES: return GL_RGB16F_EXT;
- default: UNIMPLEMENTED();
- }
- break;
- case GL_RGBA:
- switch (type)
- {
- case GL_UNSIGNED_BYTE: return GL_RGBA8_OES;
- case GL_UNSIGNED_SHORT_4_4_4_4: return GL_RGBA4;
- case GL_UNSIGNED_SHORT_5_5_5_1: return GL_RGB5_A1;
- case GL_FLOAT: return GL_RGBA32F_EXT;
- case GL_HALF_FLOAT_OES: return GL_RGBA16F_EXT;
- break;
- default: UNIMPLEMENTED();
- }
- break;
- case GL_BGRA_EXT:
- switch (type)
- {
- case GL_UNSIGNED_BYTE: return GL_BGRA8_EXT;
- case GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT: return GL_BGRA4_ANGLEX;
- case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT: return GL_BGR5_A1_ANGLEX;
- default: UNIMPLEMENTED();
- }
- break;
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
- return format;
- case GL_DEPTH_COMPONENT:
- switch (type)
- {
- case GL_UNSIGNED_SHORT: return GL_DEPTH_COMPONENT16;
- case GL_UNSIGNED_INT: return GL_DEPTH_COMPONENT32_OES;
- default: UNIMPLEMENTED();
- }
- break;
- case GL_DEPTH_STENCIL_OES:
- switch (type)
- {
- case GL_UNSIGNED_INT_24_8_OES: return GL_DEPTH24_STENCIL8_OES;
- default: UNIMPLEMENTED();
- }
- break;
- default:
- UNIMPLEMENTED();
- }
-
- return GL_NONE;
-}
-
-GLenum ExtractFormat(GLenum internalformat)
-{
- switch (internalformat)
- {
- case GL_RGB565: return GL_RGB;
- case GL_RGBA4: return GL_RGBA;
- case GL_RGB5_A1: return GL_RGBA;
- case GL_RGB8_OES: return GL_RGB;
- case GL_RGBA8_OES: return GL_RGBA;
- case GL_LUMINANCE8_ALPHA8_EXT: return GL_LUMINANCE_ALPHA;
- case GL_LUMINANCE8_EXT: return GL_LUMINANCE;
- case GL_ALPHA8_EXT: return GL_ALPHA;
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: return GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: return GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE: return GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE;
- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE: return GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE;
- case GL_RGBA32F_EXT: return GL_RGBA;
- case GL_RGB32F_EXT: return GL_RGB;
- case GL_ALPHA32F_EXT: return GL_ALPHA;
- case GL_LUMINANCE32F_EXT: return GL_LUMINANCE;
- case GL_LUMINANCE_ALPHA32F_EXT: return GL_LUMINANCE_ALPHA;
- case GL_RGBA16F_EXT: return GL_RGBA;
- case GL_RGB16F_EXT: return GL_RGB;
- case GL_ALPHA16F_EXT: return GL_ALPHA;
- case GL_LUMINANCE16F_EXT: return GL_LUMINANCE;
- case GL_LUMINANCE_ALPHA16F_EXT: return GL_LUMINANCE_ALPHA;
- case GL_BGRA8_EXT: return GL_BGRA_EXT;
- case GL_DEPTH_COMPONENT16: return GL_DEPTH_COMPONENT;
- case GL_DEPTH_COMPONENT32_OES: return GL_DEPTH_COMPONENT;
- case GL_DEPTH24_STENCIL8_OES: return GL_DEPTH_STENCIL_OES;
- default: return GL_NONE; // Unsupported
- }
-}
-
-GLenum ExtractType(GLenum internalformat)
-{
- switch (internalformat)
- {
- case GL_RGB565: return GL_UNSIGNED_SHORT_5_6_5;
- case GL_RGBA4: return GL_UNSIGNED_SHORT_4_4_4_4;
- case GL_RGB5_A1: return GL_UNSIGNED_SHORT_5_5_5_1;
- case GL_RGB8_OES: return GL_UNSIGNED_BYTE;
- case GL_RGBA8_OES: return GL_UNSIGNED_BYTE;
- case GL_LUMINANCE8_ALPHA8_EXT: return GL_UNSIGNED_BYTE;
- case GL_LUMINANCE8_EXT: return GL_UNSIGNED_BYTE;
- case GL_ALPHA8_EXT: return GL_UNSIGNED_BYTE;
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: return GL_UNSIGNED_BYTE;
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: return GL_UNSIGNED_BYTE;
- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE: return GL_UNSIGNED_BYTE;
- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE: return GL_UNSIGNED_BYTE;
- case GL_RGBA32F_EXT: return GL_FLOAT;
- case GL_RGB32F_EXT: return GL_FLOAT;
- case GL_ALPHA32F_EXT: return GL_FLOAT;
- case GL_LUMINANCE32F_EXT: return GL_FLOAT;
- case GL_LUMINANCE_ALPHA32F_EXT: return GL_FLOAT;
- case GL_RGBA16F_EXT: return GL_HALF_FLOAT_OES;
- case GL_RGB16F_EXT: return GL_HALF_FLOAT_OES;
- case GL_ALPHA16F_EXT: return GL_HALF_FLOAT_OES;
- case GL_LUMINANCE16F_EXT: return GL_HALF_FLOAT_OES;
- case GL_LUMINANCE_ALPHA16F_EXT: return GL_HALF_FLOAT_OES;
- case GL_BGRA8_EXT: return GL_UNSIGNED_BYTE;
- case GL_DEPTH_COMPONENT16: return GL_UNSIGNED_SHORT;
- case GL_DEPTH_COMPONENT32_OES: return GL_UNSIGNED_INT;
- case GL_DEPTH24_STENCIL8_OES: return GL_UNSIGNED_INT_24_8_OES;
- default: return GL_NONE; // Unsupported
- }
-}
-
-bool IsColorRenderable(GLenum internalformat)
-{
- switch (internalformat)
- {
- case GL_RGBA4:
- case GL_RGB5_A1:
- case GL_RGB565:
- case GL_RGB8_OES:
- case GL_RGBA8_OES:
- return true;
- case GL_DEPTH_COMPONENT16:
- case GL_STENCIL_INDEX8:
- case GL_DEPTH24_STENCIL8_OES:
- return false;
- case GL_BGRA8_EXT:
- return true;
- default:
- UNIMPLEMENTED();
- }
-
- return false;
-}
-
-bool IsDepthRenderable(GLenum internalformat)
-{
- switch (internalformat)
- {
- case GL_DEPTH_COMPONENT16:
- case GL_DEPTH24_STENCIL8_OES:
- return true;
- case GL_STENCIL_INDEX8:
- case GL_RGBA4:
- case GL_RGB5_A1:
- case GL_RGB565:
- case GL_RGB8_OES:
- case GL_RGBA8_OES:
- return false;
- default:
- UNIMPLEMENTED();
- }
-
- return false;
-}
-
-bool IsStencilRenderable(GLenum internalformat)
-{
- switch (internalformat)
- {
- case GL_STENCIL_INDEX8:
- case GL_DEPTH24_STENCIL8_OES:
- return true;
- case GL_RGBA4:
- case GL_RGB5_A1:
- case GL_RGB565:
- case GL_RGB8_OES:
- case GL_RGBA8_OES:
- case GL_DEPTH_COMPONENT16:
- return false;
- default:
- UNIMPLEMENTED();
- }
-
- return false;
-}
-
-bool IsFloat32Format(GLint internalformat)
-{
- switch (internalformat)
- {
- case GL_RGBA32F_EXT:
- case GL_RGB32F_EXT:
- case GL_ALPHA32F_EXT:
- case GL_LUMINANCE32F_EXT:
- case GL_LUMINANCE_ALPHA32F_EXT:
- return true;
- default:
- return false;
- }
-}
-
-bool IsFloat16Format(GLint internalformat)
-{
- switch (internalformat)
- {
- case GL_RGBA16F_EXT:
- case GL_RGB16F_EXT:
- case GL_ALPHA16F_EXT:
- case GL_LUMINANCE16F_EXT:
- case GL_LUMINANCE_ALPHA16F_EXT:
- return true;
- default:
- return false;
- }
-}
-
-unsigned int GetAlphaSize(GLenum colorFormat)
-{
- switch (colorFormat)
- {
- case GL_RGBA16F_EXT:
- return 16;
- case GL_RGBA32F_EXT:
- return 32;
- case GL_RGBA4:
- return 4;
- case GL_RGBA8_OES:
- case GL_BGRA8_EXT:
- return 8;
- case GL_RGB5_A1:
- return 1;
- case GL_RGB8_OES:
- case GL_RGB565:
- case GL_RGB32F_EXT:
- case GL_RGB16F_EXT:
- return 0;
- default:
- return 0;
- }
-}
-
-unsigned int GetRedSize(GLenum colorFormat)
-{
- switch (colorFormat)
- {
- case GL_RGBA16F_EXT:
- case GL_RGB16F_EXT:
- return 16;
- case GL_RGBA32F_EXT:
- case GL_RGB32F_EXT:
- return 32;
- case GL_RGBA4:
- return 4;
- case GL_RGBA8_OES:
- case GL_BGRA8_EXT:
- case GL_RGB8_OES:
- return 8;
- case GL_RGB5_A1:
- case GL_RGB565:
- return 5;
- default:
- return 0;
- }
-}
-
-unsigned int GetGreenSize(GLenum colorFormat)
-{
- switch (colorFormat)
- {
- case GL_RGBA16F_EXT:
- case GL_RGB16F_EXT:
- return 16;
- case GL_RGBA32F_EXT:
- case GL_RGB32F_EXT:
- return 32;
- case GL_RGBA4:
- return 4;
- case GL_RGBA8_OES:
- case GL_BGRA8_EXT:
- case GL_RGB8_OES:
- return 8;
- case GL_RGB5_A1:
- return 5;
- case GL_RGB565:
- return 6;
- default:
- return 0;
- }
-}
-
-unsigned int GetBlueSize(GLenum colorFormat)
-{
- switch (colorFormat)
- {
- case GL_RGBA16F_EXT:
- case GL_RGB16F_EXT:
- return 16;
- case GL_RGBA32F_EXT:
- case GL_RGB32F_EXT:
- return 32;
- case GL_RGBA4:
- return 4;
- case GL_RGBA8_OES:
- case GL_BGRA8_EXT:
- case GL_RGB8_OES:
- return 8;
- case GL_RGB5_A1:
- case GL_RGB565:
- return 5;
- default:
- return 0;
- }
-}
-
-unsigned int GetDepthSize(GLenum depthFormat)
-{
- switch (depthFormat)
- {
- case GL_DEPTH_COMPONENT16: return 16;
- case GL_DEPTH_COMPONENT32_OES: return 32;
- case GL_DEPTH24_STENCIL8_OES: return 24;
- default: return 0;
- }
-}
-
-unsigned int GetStencilSize(GLenum stencilFormat)
-{
- switch (stencilFormat)
- {
- case GL_DEPTH24_STENCIL8_OES: return 8;
- default: return 0;
- }
-}
-
-bool IsTriangleMode(GLenum drawMode)
-{
- switch (drawMode)
- {
- case GL_TRIANGLES:
- case GL_TRIANGLE_FAN:
- case GL_TRIANGLE_STRIP:
- return true;
- case GL_POINTS:
- case GL_LINES:
- case GL_LINE_LOOP:
- case GL_LINE_STRIP:
- return false;
- default: UNREACHABLE();
- }
-
- return false;
-}
-
-}
-
-std::string getTempPath()
-{
- char path[MAX_PATH];
- DWORD pathLen = GetTempPathA(sizeof(path) / sizeof(path[0]), path);
- if (pathLen == 0)
- {
- UNREACHABLE();
- return std::string();
- }
-
- UINT unique = GetTempFileNameA(path, "sh", 0, path);
- if (unique == 0)
- {
- UNREACHABLE();
- return std::string();
- }
-
- return path;
-}
-
-void writeFile(const char* path, const void* content, size_t size)
-{
- FILE* file = fopen(path, "w");
- if (!file)
- {
- UNREACHABLE();
- return;
- }
-
- fwrite(content, sizeof(char), size, file);
- fclose(file);
-}
diff --git a/chromium/third_party/angle/src/libGLESv2/utilities.h b/chromium/third_party/angle/src/libGLESv2/utilities.h
deleted file mode 100644
index ed663ebca20..00000000000
--- a/chromium/third_party/angle/src/libGLESv2/utilities.h
+++ /dev/null
@@ -1,67 +0,0 @@
-//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// utilities.h: Conversion functions and other utility routines.
-
-#ifndef LIBGLESV2_UTILITIES_H
-#define LIBGLESV2_UTILITIES_H
-
-#define GL_APICALL
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include <string>
-
-namespace gl
-{
-
-struct Color;
-
-int UniformComponentCount(GLenum type);
-GLenum UniformComponentType(GLenum type);
-size_t UniformInternalSize(GLenum type);
-size_t UniformExternalSize(GLenum type);
-int VariableRowCount(GLenum type);
-int VariableColumnCount(GLenum type);
-
-int AllocateFirstFreeBits(unsigned int *bits, unsigned int allocationSize, unsigned int bitsSize);
-
-void MakeValidSize(bool isImage, bool isCompressed, GLsizei *requestWidth, GLsizei *requestHeight, int *levelOffset);
-int ComputePixelSize(GLint internalformat);
-GLsizei ComputePitch(GLsizei width, GLint internalformat, GLint alignment);
-GLsizei ComputeCompressedPitch(GLsizei width, GLenum format);
-GLsizei ComputeCompressedSize(GLsizei width, GLsizei height, GLenum format);
-GLsizei ComputeTypeSize(GLenum type);
-bool IsCompressed(GLenum format);
-bool IsDepthTexture(GLenum format);
-bool IsStencilTexture(GLenum format);
-bool IsCubemapTextureTarget(GLenum target);
-bool IsInternalTextureTarget(GLenum target);
-GLint ConvertSizedInternalFormat(GLenum format, GLenum type);
-GLenum ExtractFormat(GLenum internalformat);
-GLenum ExtractType(GLenum internalformat);
-
-bool IsColorRenderable(GLenum internalformat);
-bool IsDepthRenderable(GLenum internalformat);
-bool IsStencilRenderable(GLenum internalformat);
-
-bool IsFloat32Format(GLint internalformat);
-bool IsFloat16Format(GLint internalformat);
-
-GLuint GetAlphaSize(GLenum colorFormat);
-GLuint GetRedSize(GLenum colorFormat);
-GLuint GetGreenSize(GLenum colorFormat);
-GLuint GetBlueSize(GLenum colorFormat);
-GLuint GetDepthSize(GLenum depthFormat);
-GLuint GetStencilSize(GLenum stencilFormat);
-bool IsTriangleMode(GLenum drawMode);
-
-}
-
-std::string getTempPath();
-void writeFile(const char* path, const void* data, size_t size);
-
-#endif // LIBGLESV2_UTILITIES_H
diff --git a/chromium/third_party/angle/src/libGLESv2/validationES.cpp b/chromium/third_party/angle/src/libGLESv2/validationES.cpp
new file mode 100644
index 00000000000..03b8f71b53d
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/validationES.cpp
@@ -0,0 +1,1293 @@
+#include "precompiled.h"
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationES.h: Validation functions for generic OpenGL ES entry point parameters
+
+#include "libGLESv2/validationES.h"
+#include "libGLESv2/validationES2.h"
+#include "libGLESv2/validationES3.h"
+#include "libGLESv2/Context.h"
+#include "libGLESv2/Texture.h"
+#include "libGLESv2/Framebuffer.h"
+#include "libGLESv2/Renderbuffer.h"
+#include "libGLESv2/formatutils.h"
+#include "libGLESv2/main.h"
+#include "libGLESv2/Query.h"
+#include "libGLESv2/ProgramBinary.h"
+
+#include "common/mathutil.h"
+#include "common/utilities.h"
+
+namespace gl
+{
+
+bool ValidCap(const Context *context, GLenum cap)
+{
+ switch (cap)
+ {
+ case GL_CULL_FACE:
+ case GL_POLYGON_OFFSET_FILL:
+ case GL_SAMPLE_ALPHA_TO_COVERAGE:
+ case GL_SAMPLE_COVERAGE:
+ case GL_SCISSOR_TEST:
+ case GL_STENCIL_TEST:
+ case GL_DEPTH_TEST:
+ case GL_BLEND:
+ case GL_DITHER:
+ return true;
+ case GL_PRIMITIVE_RESTART_FIXED_INDEX:
+ case GL_RASTERIZER_DISCARD:
+ return (context->getClientVersion() >= 3);
+ default:
+ return false;
+ }
+}
+
+bool ValidTextureTarget(const Context *context, GLenum target)
+{
+ switch (target)
+ {
+ case GL_TEXTURE_2D:
+ case GL_TEXTURE_CUBE_MAP:
+ return true;
+
+ case GL_TEXTURE_3D:
+ case GL_TEXTURE_2D_ARRAY:
+ return (context->getClientVersion() >= 3);
+
+ default:
+ return false;
+ }
+}
+
+// This function differs from ValidTextureTarget in that the target must be
+// usable as the destination of a 2D operation-- so a cube face is valid, but
+// GL_TEXTURE_CUBE_MAP is not.
+// Note: duplicate of IsInternalTextureTarget
+bool ValidTexture2DDestinationTarget(const Context *context, GLenum target)
+{
+ switch (target)
+ {
+ case GL_TEXTURE_2D:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ return true;
+ case GL_TEXTURE_2D_ARRAY:
+ case GL_TEXTURE_3D:
+ return (context->getClientVersion() >= 3);
+ default:
+ return false;
+ }
+}
+
+bool ValidFramebufferTarget(GLenum target)
+{
+ META_ASSERT(GL_DRAW_FRAMEBUFFER_ANGLE == GL_DRAW_FRAMEBUFFER && GL_READ_FRAMEBUFFER_ANGLE == GL_READ_FRAMEBUFFER);
+
+ switch (target)
+ {
+ case GL_FRAMEBUFFER: return true;
+ case GL_READ_FRAMEBUFFER: return true;
+ case GL_DRAW_FRAMEBUFFER: return true;
+ default: return false;
+ }
+}
+
+bool ValidBufferTarget(const Context *context, GLenum target)
+{
+ switch (target)
+ {
+ case GL_ARRAY_BUFFER:
+ case GL_ELEMENT_ARRAY_BUFFER:
+ return true;
+
+ case GL_PIXEL_PACK_BUFFER:
+ case GL_PIXEL_UNPACK_BUFFER:
+ return context->supportsPBOs();
+
+ case GL_COPY_READ_BUFFER:
+ case GL_COPY_WRITE_BUFFER:
+ case GL_TRANSFORM_FEEDBACK_BUFFER:
+ case GL_UNIFORM_BUFFER:
+ return (context->getClientVersion() >= 3);
+
+ default:
+ return false;
+ }
+}
+
+bool ValidBufferParameter(const Context *context, GLenum pname)
+{
+ switch (pname)
+ {
+ case GL_BUFFER_USAGE:
+ case GL_BUFFER_SIZE:
+ return true;
+
+ // GL_BUFFER_MAP_POINTER is a special case, and may only be
+ // queried with GetBufferPointerv
+ case GL_BUFFER_ACCESS_FLAGS:
+ case GL_BUFFER_MAPPED:
+ case GL_BUFFER_MAP_OFFSET:
+ case GL_BUFFER_MAP_LENGTH:
+ return (context->getClientVersion() >= 3);
+
+ default:
+ return false;
+ }
+}
+
+bool ValidMipLevel(const Context *context, GLenum target, GLint level)
+{
+ int maxLevel = 0;
+ switch (target)
+ {
+ case GL_TEXTURE_2D: maxLevel = context->getMaximum2DTextureLevel(); break;
+ case GL_TEXTURE_CUBE_MAP:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: maxLevel = context->getMaximumCubeTextureLevel(); break;
+ case GL_TEXTURE_3D: maxLevel = context->getMaximum3DTextureLevel(); break;
+ case GL_TEXTURE_2D_ARRAY: maxLevel = context->getMaximum2DArrayTextureLevel(); break;
+ default: UNREACHABLE();
+ }
+
+ return level < maxLevel;
+}
+
+bool ValidImageSize(const gl::Context *context, GLenum target, GLint level,
+ GLsizei width, GLsizei height, GLsizei depth)
+{
+ if (level < 0 || width < 0 || height < 0 || depth < 0)
+ {
+ return false;
+ }
+
+ if (!context->supportsNonPower2Texture() &&
+ (level != 0 && (!gl::isPow2(width) || !gl::isPow2(height) || !gl::isPow2(depth))))
+ {
+ return false;
+ }
+
+ if (!ValidMipLevel(context, target, level))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidCompressedImageSize(const gl::Context *context, GLenum internalFormat, GLsizei width, GLsizei height)
+{
+ GLuint clientVersion = context->getClientVersion();
+ if (!IsFormatCompressed(internalFormat, clientVersion))
+ {
+ return false;
+ }
+
+ GLint blockWidth = GetCompressedBlockWidth(internalFormat, clientVersion);
+ GLint blockHeight = GetCompressedBlockHeight(internalFormat, clientVersion);
+ if (width < 0 || (width > blockWidth && width % blockWidth != 0) ||
+ height < 0 || (height > blockHeight && height % blockHeight != 0))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidQueryType(const Context *context, GLenum queryType)
+{
+ META_ASSERT(GL_ANY_SAMPLES_PASSED == GL_ANY_SAMPLES_PASSED_EXT);
+ META_ASSERT(GL_ANY_SAMPLES_PASSED_CONSERVATIVE == GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT);
+
+ switch (queryType)
+ {
+ case GL_ANY_SAMPLES_PASSED:
+ case GL_ANY_SAMPLES_PASSED_CONSERVATIVE:
+ return true;
+ case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
+ return (context->getClientVersion() >= 3);
+ default:
+ return false;
+ }
+}
+
+bool ValidProgram(const Context *context, GLuint id)
+{
+ // ES3 spec (section 2.11.1) -- "Commands that accept shader or program object names will generate the
+ // error INVALID_VALUE if the provided name is not the name of either a shader or program object and
+ // INVALID_OPERATION if the provided name identifies an object that is not the expected type."
+
+ if (context->getProgram(id) != NULL)
+ {
+ return true;
+ }
+ else if (context->getShader(id) != NULL)
+ {
+ // ID is the wrong type
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ else
+ {
+ // No shader/program object has this ID
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+}
+
+bool ValidateRenderbufferStorageParameters(const gl::Context *context, GLenum target, GLsizei samples,
+ GLenum internalformat, GLsizei width, GLsizei height,
+ bool angleExtension)
+{
+ switch (target)
+ {
+ case GL_RENDERBUFFER:
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ if (width < 0 || height < 0 || samples < 0)
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ if (!gl::IsValidInternalFormat(internalformat, context))
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ // ANGLE_framebuffer_multisample does not explicitly state that the internal format must be
+ // sized but it does state that the format must be in the ES2.0 spec table 4.5 which contains
+ // only sized internal formats. The ES3 spec (section 4.4.2) does, however, state that the
+ // internal format must be sized and not an integer format if samples is greater than zero.
+ if (!gl::IsSizedInternalFormat(internalformat, context->getClientVersion()))
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ GLenum componentType = gl::GetComponentType(internalformat, context->getClientVersion());
+ if ((componentType == GL_UNSIGNED_INT || componentType == GL_INT) && samples > 0)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (!gl::IsColorRenderingSupported(internalformat, context) &&
+ !gl::IsDepthRenderingSupported(internalformat, context) &&
+ !gl::IsStencilRenderingSupported(internalformat, context))
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ if (std::max(width, height) > context->getMaximumRenderbufferDimension())
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ // ANGLE_framebuffer_multisample states that the value of samples must be less than or equal
+ // to MAX_SAMPLES_ANGLE (Context::getMaxSupportedSamples) while the ES3.0 spec (section 4.4.2)
+ // states that samples must be less than or equal to the maximum samples for the specified
+ // internal format.
+ if (angleExtension)
+ {
+ if (samples > context->getMaxSupportedSamples())
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+ }
+ else
+ {
+ if (samples > context->getMaxSupportedFormatSamples(internalformat))
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+ }
+
+ GLuint handle = context->getRenderbufferHandle();
+ if (handle == 0)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ return true;
+}
+
+bool ValidateFramebufferRenderbufferParameters(gl::Context *context, GLenum target, GLenum attachment,
+ GLenum renderbuffertarget, GLuint renderbuffer)
+{
+ gl::Framebuffer *framebuffer = context->getTargetFramebuffer(target);
+ GLuint framebufferHandle = context->getTargetFramebufferHandle(target);
+
+ if (!framebuffer || (framebufferHandle == 0 && renderbuffer != 0))
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT)
+ {
+ const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT);
+
+ if (colorAttachment >= context->getMaximumRenderTargets())
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+ }
+ else
+ {
+ switch (attachment)
+ {
+ case GL_DEPTH_ATTACHMENT:
+ break;
+ case GL_STENCIL_ATTACHMENT:
+ break;
+ case GL_DEPTH_STENCIL_ATTACHMENT:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ }
+
+ // [OpenGL ES 2.0.25] Section 4.4.3 page 112
+ // [OpenGL ES 3.0.2] Section 4.4.2 page 201
+ // 'renderbuffer' must be either zero or the name of an existing renderbuffer object of
+ // type 'renderbuffertarget', otherwise an INVALID_OPERATION error is generated.
+ if (renderbuffer != 0)
+ {
+ if (!context->getRenderbuffer(renderbuffer))
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ }
+
+ return true;
+}
+
+static bool IsPartialBlit(gl::Context *context, gl::FramebufferAttachment *readBuffer, gl::FramebufferAttachment *writeBuffer,
+ GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
+ GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1)
+{
+ if (srcX0 != 0 || srcY0 != 0 || dstX0 != 0 || dstY0 != 0 ||
+ dstX1 != writeBuffer->getWidth() || dstY1 != writeBuffer->getHeight() ||
+ srcX1 != readBuffer->getWidth() || srcY1 != readBuffer->getHeight())
+ {
+ return true;
+ }
+ else if (context->isScissorTestEnabled())
+ {
+ int scissorX, scissorY, scissorWidth, scissorHeight;
+ context->getScissorParams(&scissorX, &scissorY, &scissorWidth, &scissorHeight);
+
+ return scissorX > 0 || scissorY > 0 ||
+ scissorWidth < writeBuffer->getWidth() ||
+ scissorHeight < writeBuffer->getHeight();
+ }
+ else
+ {
+ return false;
+ }
+}
+
+bool ValidateBlitFramebufferParameters(gl::Context *context, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
+ GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask,
+ GLenum filter, bool fromAngleExtension)
+{
+ switch (filter)
+ {
+ case GL_NEAREST:
+ break;
+ case GL_LINEAR:
+ if (fromAngleExtension)
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ if ((mask & ~(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)) != 0)
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ if (mask == 0)
+ {
+ // ES3.0 spec, section 4.3.2 specifies that a mask of zero is valid and no
+ // buffers are copied.
+ return false;
+ }
+
+ if (fromAngleExtension && (srcX1 - srcX0 != dstX1 - dstX0 || srcY1 - srcY0 != dstY1 - dstY0))
+ {
+ ERR("Scaling and flipping in BlitFramebufferANGLE not supported by this implementation.");
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ // ES3.0 spec, section 4.3.2 states that linear filtering is only available for the
+ // color buffer, leaving only nearest being unfiltered from above
+ if ((mask & ~GL_COLOR_BUFFER_BIT) != 0 && filter != GL_NEAREST)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (context->getReadFramebufferHandle() == context->getDrawFramebufferHandle())
+ {
+ if (fromAngleExtension)
+ {
+ ERR("Blits with the same source and destination framebuffer are not supported by this "
+ "implementation.");
+ }
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ gl::Framebuffer *readFramebuffer = context->getReadFramebuffer();
+ gl::Framebuffer *drawFramebuffer = context->getDrawFramebuffer();
+ if (!readFramebuffer || readFramebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE ||
+ !drawFramebuffer || drawFramebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE)
+ {
+ return gl::error(GL_INVALID_FRAMEBUFFER_OPERATION, false);
+ }
+
+ if (drawFramebuffer->getSamples() != 0)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ bool sameBounds = srcX0 == dstX0 && srcY0 == dstY0 && srcX1 == dstX1 && srcY1 == dstY1;
+
+ GLuint clientVersion = context->getClientVersion();
+
+ if (mask & GL_COLOR_BUFFER_BIT)
+ {
+ gl::FramebufferAttachment *readColorBuffer = readFramebuffer->getReadColorbuffer();
+ gl::FramebufferAttachment *drawColorBuffer = drawFramebuffer->getFirstColorbuffer();
+
+ if (readColorBuffer && drawColorBuffer)
+ {
+ GLenum readInternalFormat = readColorBuffer->getActualFormat();
+ GLenum readComponentType = gl::GetComponentType(readInternalFormat, clientVersion);
+
+ for (unsigned int i = 0; i < gl::IMPLEMENTATION_MAX_DRAW_BUFFERS; i++)
+ {
+ if (drawFramebuffer->isEnabledColorAttachment(i))
+ {
+ GLenum drawInternalFormat = drawFramebuffer->getColorbuffer(i)->getActualFormat();
+ GLenum drawComponentType = gl::GetComponentType(drawInternalFormat, clientVersion);
+
+ // The GL ES 3.0.2 spec (pg 193) states that:
+ // 1) If the read buffer is fixed point format, the draw buffer must be as well
+ // 2) If the read buffer is an unsigned integer format, the draw buffer must be as well
+ // 3) If the read buffer is a signed integer format, the draw buffer must be as well
+ if ( (readComponentType == GL_UNSIGNED_NORMALIZED || readComponentType == GL_SIGNED_NORMALIZED) &&
+ !(drawComponentType == GL_UNSIGNED_NORMALIZED || drawComponentType == GL_SIGNED_NORMALIZED))
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (readComponentType == GL_UNSIGNED_INT && drawComponentType != GL_UNSIGNED_INT)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (readComponentType == GL_INT && drawComponentType != GL_INT)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (readColorBuffer->getSamples() > 0 && (readInternalFormat != drawInternalFormat || !sameBounds))
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ }
+ }
+
+ if ((readComponentType == GL_INT || readComponentType == GL_UNSIGNED_INT) && filter == GL_LINEAR)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (fromAngleExtension)
+ {
+ const GLenum readColorbufferType = readFramebuffer->getReadColorbufferType();
+ if (readColorbufferType != GL_TEXTURE_2D && readColorbufferType != GL_RENDERBUFFER)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ for (unsigned int colorAttachment = 0; colorAttachment < gl::IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
+ {
+ if (drawFramebuffer->isEnabledColorAttachment(colorAttachment))
+ {
+ if (drawFramebuffer->getColorbufferType(colorAttachment) != GL_TEXTURE_2D &&
+ drawFramebuffer->getColorbufferType(colorAttachment) != GL_RENDERBUFFER)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (drawFramebuffer->getColorbuffer(colorAttachment)->getActualFormat() != readColorBuffer->getActualFormat())
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ }
+ }
+ if (readFramebuffer->getSamples() != 0 && IsPartialBlit(context, readColorBuffer, drawColorBuffer,
+ srcX0, srcY0, srcX1, srcY1,
+ dstX0, dstY0, dstX1, dstY1))
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ }
+ }
+ }
+
+ if (mask & GL_DEPTH_BUFFER_BIT)
+ {
+ gl::FramebufferAttachment *readDepthBuffer = readFramebuffer->getDepthbuffer();
+ gl::FramebufferAttachment *drawDepthBuffer = drawFramebuffer->getDepthbuffer();
+
+ if (readDepthBuffer && drawDepthBuffer)
+ {
+ if (readDepthBuffer->getActualFormat() != drawDepthBuffer->getActualFormat())
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (readDepthBuffer->getSamples() > 0 && !sameBounds)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (fromAngleExtension)
+ {
+ if (IsPartialBlit(context, readDepthBuffer, drawDepthBuffer,
+ srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1))
+ {
+ ERR("Only whole-buffer depth and stencil blits are supported by this implementation.");
+ return gl::error(GL_INVALID_OPERATION, false); // only whole-buffer copies are permitted
+ }
+
+ if (readDepthBuffer->getSamples() != 0 || drawDepthBuffer->getSamples() != 0)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ }
+ }
+ }
+
+ if (mask & GL_STENCIL_BUFFER_BIT)
+ {
+ gl::FramebufferAttachment *readStencilBuffer = readFramebuffer->getStencilbuffer();
+ gl::FramebufferAttachment *drawStencilBuffer = drawFramebuffer->getStencilbuffer();
+
+ if (readStencilBuffer && drawStencilBuffer)
+ {
+ if (readStencilBuffer->getActualFormat() != drawStencilBuffer->getActualFormat())
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (readStencilBuffer->getSamples() > 0 && !sameBounds)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (fromAngleExtension)
+ {
+ if (IsPartialBlit(context, readStencilBuffer, drawStencilBuffer,
+ srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1))
+ {
+ ERR("Only whole-buffer depth and stencil blits are supported by this implementation.");
+ return gl::error(GL_INVALID_OPERATION, false); // only whole-buffer copies are permitted
+ }
+
+ if (readStencilBuffer->getSamples() != 0 || drawStencilBuffer->getSamples() != 0)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ }
+ }
+ }
+
+ return true;
+}
+
+bool ValidateGetVertexAttribParameters(GLenum pname, int clientVersion)
+{
+ switch (pname)
+ {
+ case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
+ case GL_VERTEX_ATTRIB_ARRAY_SIZE:
+ case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
+ case GL_VERTEX_ATTRIB_ARRAY_TYPE:
+ case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
+ case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
+ case GL_CURRENT_VERTEX_ATTRIB:
+ return true;
+
+ case GL_VERTEX_ATTRIB_ARRAY_DIVISOR:
+ // Don't verify ES3 context because GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE uses
+ // the same constant.
+ META_ASSERT(GL_VERTEX_ATTRIB_ARRAY_DIVISOR == GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE);
+ return true;
+
+ case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
+ return ((clientVersion >= 3) ? true : gl::error(GL_INVALID_ENUM, false));
+
+ default:
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+}
+
+bool ValidateTexParamParameters(gl::Context *context, GLenum pname, GLint param)
+{
+ switch (pname)
+ {
+ case GL_TEXTURE_WRAP_R:
+ case GL_TEXTURE_SWIZZLE_R:
+ case GL_TEXTURE_SWIZZLE_G:
+ case GL_TEXTURE_SWIZZLE_B:
+ case GL_TEXTURE_SWIZZLE_A:
+ case GL_TEXTURE_BASE_LEVEL:
+ case GL_TEXTURE_MAX_LEVEL:
+ case GL_TEXTURE_COMPARE_MODE:
+ case GL_TEXTURE_COMPARE_FUNC:
+ case GL_TEXTURE_MIN_LOD:
+ case GL_TEXTURE_MAX_LOD:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ break;
+
+ default: break;
+ }
+
+ switch (pname)
+ {
+ case GL_TEXTURE_WRAP_S:
+ case GL_TEXTURE_WRAP_T:
+ case GL_TEXTURE_WRAP_R:
+ switch (param)
+ {
+ case GL_REPEAT:
+ case GL_CLAMP_TO_EDGE:
+ case GL_MIRRORED_REPEAT:
+ return true;
+ default:
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ case GL_TEXTURE_MIN_FILTER:
+ switch (param)
+ {
+ case GL_NEAREST:
+ case GL_LINEAR:
+ case GL_NEAREST_MIPMAP_NEAREST:
+ case GL_LINEAR_MIPMAP_NEAREST:
+ case GL_NEAREST_MIPMAP_LINEAR:
+ case GL_LINEAR_MIPMAP_LINEAR:
+ return true;
+ default:
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ break;
+
+ case GL_TEXTURE_MAG_FILTER:
+ switch (param)
+ {
+ case GL_NEAREST:
+ case GL_LINEAR:
+ return true;
+ default:
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ break;
+
+ case GL_TEXTURE_USAGE_ANGLE:
+ switch (param)
+ {
+ case GL_NONE:
+ case GL_FRAMEBUFFER_ATTACHMENT_ANGLE:
+ return true;
+ default:
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ break;
+
+ case GL_TEXTURE_MAX_ANISOTROPY_EXT:
+ if (!context->supportsTextureFilterAnisotropy())
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ // we assume the parameter passed to this validation method is truncated, not rounded
+ if (param < 1)
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+ return true;
+
+ case GL_TEXTURE_MIN_LOD:
+ case GL_TEXTURE_MAX_LOD:
+ // any value is permissible
+ return true;
+
+ case GL_TEXTURE_COMPARE_MODE:
+ // Acceptable mode parameters from GLES 3.0.2 spec, table 3.17
+ switch (param)
+ {
+ case GL_NONE:
+ case GL_COMPARE_REF_TO_TEXTURE:
+ return true;
+ default:
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ break;
+
+ case GL_TEXTURE_COMPARE_FUNC:
+ // Acceptable function parameters from GLES 3.0.2 spec, table 3.17
+ switch (param)
+ {
+ case GL_LEQUAL:
+ case GL_GEQUAL:
+ case GL_LESS:
+ case GL_GREATER:
+ case GL_EQUAL:
+ case GL_NOTEQUAL:
+ case GL_ALWAYS:
+ case GL_NEVER:
+ return true;
+ default:
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ break;
+
+ case GL_TEXTURE_SWIZZLE_R:
+ case GL_TEXTURE_SWIZZLE_G:
+ case GL_TEXTURE_SWIZZLE_B:
+ case GL_TEXTURE_SWIZZLE_A:
+ switch (param)
+ {
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+ case GL_ZERO:
+ case GL_ONE:
+ return true;
+ default:
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ break;
+
+ case GL_TEXTURE_BASE_LEVEL:
+ case GL_TEXTURE_MAX_LEVEL:
+ if (param < 0)
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+ return true;
+
+ default:
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+}
+
+bool ValidateSamplerObjectParameter(GLenum pname)
+{
+ switch (pname)
+ {
+ case GL_TEXTURE_MIN_FILTER:
+ case GL_TEXTURE_MAG_FILTER:
+ case GL_TEXTURE_WRAP_S:
+ case GL_TEXTURE_WRAP_T:
+ case GL_TEXTURE_WRAP_R:
+ case GL_TEXTURE_MIN_LOD:
+ case GL_TEXTURE_MAX_LOD:
+ case GL_TEXTURE_COMPARE_MODE:
+ case GL_TEXTURE_COMPARE_FUNC:
+ return true;
+
+ default:
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+}
+
+bool ValidateReadPixelsParameters(gl::Context *context, GLint x, GLint y, GLsizei width, GLsizei height,
+ GLenum format, GLenum type, GLsizei *bufSize, GLvoid *pixels)
+{
+ gl::Framebuffer *framebuffer = context->getReadFramebuffer();
+ ASSERT(framebuffer);
+
+ if (framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE)
+ {
+ return gl::error(GL_INVALID_FRAMEBUFFER_OPERATION, false);
+ }
+
+ if (context->getReadFramebufferHandle() != 0 && framebuffer->getSamples() != 0)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (!framebuffer->getReadColorbuffer())
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ GLenum currentInternalFormat, currentFormat, currentType;
+ int clientVersion = context->getClientVersion();
+
+ context->getCurrentReadFormatType(&currentInternalFormat, &currentFormat, &currentType);
+
+ bool validReadFormat = (clientVersion < 3) ? ValidES2ReadFormatType(context, format, type) :
+ ValidES3ReadFormatType(context, currentInternalFormat, format, type);
+
+ if (!(currentFormat == format && currentType == type) && !validReadFormat)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ GLenum sizedInternalFormat = IsSizedInternalFormat(format, clientVersion) ? format :
+ GetSizedInternalFormat(format, type, clientVersion);
+
+ GLsizei outputPitch = GetRowPitch(sizedInternalFormat, type, clientVersion, width, context->getPackAlignment());
+ // sized query sanity check
+ if (bufSize)
+ {
+ int requiredSize = outputPitch * height;
+ if (requiredSize > *bufSize)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ }
+
+ return true;
+}
+
+bool ValidateBeginQuery(gl::Context *context, GLenum target, GLuint id)
+{
+ if (!ValidQueryType(context, target))
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ if (id == 0)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ // From EXT_occlusion_query_boolean: If BeginQueryEXT is called with an <id>
+ // of zero, if the active query object name for <target> is non-zero (for the
+ // targets ANY_SAMPLES_PASSED_EXT and ANY_SAMPLES_PASSED_CONSERVATIVE_EXT, if
+ // the active query for either target is non-zero), if <id> is the name of an
+ // existing query object whose type does not match <target>, or if <id> is the
+ // active query object name for any query type, the error INVALID_OPERATION is
+ // generated.
+
+ // Ensure no other queries are active
+ // NOTE: If other queries than occlusion are supported, we will need to check
+ // separately that:
+ // a) The query ID passed is not the current active query for any target/type
+ // b) There are no active queries for the requested target (and in the case
+ // of GL_ANY_SAMPLES_PASSED_EXT and GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT,
+ // no query may be active for either if glBeginQuery targets either.
+ if (context->isQueryActive())
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ Query *queryObject = context->getQuery(id, true, target);
+
+ // check that name was obtained with glGenQueries
+ if (!queryObject)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ // check for type mismatch
+ if (queryObject->getType() != target)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ return true;
+}
+
+bool ValidateEndQuery(gl::Context *context, GLenum target)
+{
+ if (!ValidQueryType(context, target))
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ const Query *queryObject = context->getActiveQuery(target);
+
+ if (queryObject == NULL)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (!queryObject->isStarted())
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ return true;
+}
+
+static bool ValidateUniformCommonBase(gl::Context *context, GLenum targetUniformType,
+ GLint location, GLsizei count, LinkedUniform **uniformOut)
+{
+ if (count < 0)
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ if (!programBinary)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (location == -1)
+ {
+ // Silently ignore the uniform command
+ return false;
+ }
+
+ if (!programBinary->isValidUniformLocation(location))
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ LinkedUniform *uniform = programBinary->getUniformByLocation(location);
+
+ // attempting to write an array to a non-array uniform is an INVALID_OPERATION
+ if (uniform->elementCount() == 1 && count > 1)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ *uniformOut = uniform;
+ return true;
+}
+
+bool ValidateUniform(gl::Context *context, GLenum uniformType, GLint location, GLsizei count)
+{
+ // Check for ES3 uniform entry points
+ if (UniformComponentType(uniformType) == GL_UNSIGNED_INT && context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ LinkedUniform *uniform = NULL;
+ if (!ValidateUniformCommonBase(context, uniformType, location, count, &uniform))
+ {
+ return false;
+ }
+
+ GLenum targetBoolType = UniformBoolVectorType(uniformType);
+ bool samplerUniformCheck = (IsSampler(uniform->type) && uniformType == GL_INT);
+ if (!samplerUniformCheck && uniformType != uniform->type && targetBoolType != uniform->type)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ return true;
+}
+
+bool ValidateUniformMatrix(gl::Context *context, GLenum matrixType, GLint location, GLsizei count,
+ GLboolean transpose)
+{
+ // Check for ES3 uniform entry points
+ int rows = VariableRowCount(matrixType);
+ int cols = VariableColumnCount(matrixType);
+ if (rows != cols && context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (transpose != GL_FALSE && context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ LinkedUniform *uniform = NULL;
+ if (!ValidateUniformCommonBase(context, matrixType, location, count, &uniform))
+ {
+ return false;
+ }
+
+ if (uniform->type != matrixType)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ return true;
+}
+
+bool ValidateStateQuery(gl::Context *context, GLenum pname, GLenum *nativeType, unsigned int *numParams)
+{
+ if (!context->getQueryParameterInfo(pname, nativeType, numParams))
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ if (pname >= GL_DRAW_BUFFER0 && pname <= GL_DRAW_BUFFER15)
+ {
+ unsigned int colorAttachment = (pname - GL_DRAW_BUFFER0);
+
+ if (colorAttachment >= context->getMaximumRenderTargets())
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ }
+
+ switch (pname)
+ {
+ case GL_TEXTURE_BINDING_2D:
+ case GL_TEXTURE_BINDING_CUBE_MAP:
+ case GL_TEXTURE_BINDING_3D:
+ case GL_TEXTURE_BINDING_2D_ARRAY:
+ if (context->getActiveSampler() >= context->getMaximumCombinedTextureImageUnits())
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ break;
+
+ case GL_IMPLEMENTATION_COLOR_READ_TYPE:
+ case GL_IMPLEMENTATION_COLOR_READ_FORMAT:
+ {
+ Framebuffer *framebuffer = context->getReadFramebuffer();
+ ASSERT(framebuffer);
+ if (framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ FramebufferAttachment *attachment = framebuffer->getReadColorbuffer();
+ if (!attachment)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ // pname is valid, but there are no parameters to return
+ if (numParams == 0)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateCopyTexImageParametersBase(gl::Context* context, GLenum target, GLint level, GLenum internalformat, bool isSubImage,
+ GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height,
+ GLint border, GLenum *textureFormatOut)
+{
+
+ if (!ValidTexture2DDestinationTarget(context, target))
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ if (level < 0 || xoffset < 0 || yoffset < 0 || zoffset < 0 || width < 0 || height < 0)
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ if (std::numeric_limits<GLsizei>::max() - xoffset < width || std::numeric_limits<GLsizei>::max() - yoffset < height)
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ if (border != 0)
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ if (!ValidMipLevel(context, target, level))
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ gl::Framebuffer *framebuffer = context->getReadFramebuffer();
+ if (framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE)
+ {
+ return gl::error(GL_INVALID_FRAMEBUFFER_OPERATION, false);
+ }
+
+ if (context->getReadFramebufferHandle() != 0 && framebuffer->getSamples() != 0)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ gl::Texture *texture = NULL;
+ GLenum textureInternalFormat = GL_NONE;
+ bool textureCompressed = false;
+ bool textureIsDepth = false;
+ GLint textureLevelWidth = 0;
+ GLint textureLevelHeight = 0;
+ GLint textureLevelDepth = 0;
+ int maxDimension = 0;
+
+ switch (target)
+ {
+ case GL_TEXTURE_2D:
+ {
+ gl::Texture2D *texture2d = context->getTexture2D();
+ if (texture2d)
+ {
+ textureInternalFormat = texture2d->getInternalFormat(level);
+ textureCompressed = texture2d->isCompressed(level);
+ textureIsDepth = texture2d->isDepth(level);
+ textureLevelWidth = texture2d->getWidth(level);
+ textureLevelHeight = texture2d->getHeight(level);
+ textureLevelDepth = 1;
+ texture = texture2d;
+ maxDimension = context->getMaximum2DTextureDimension();
+ }
+ }
+ break;
+
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ {
+ gl::TextureCubeMap *textureCube = context->getTextureCubeMap();
+ if (textureCube)
+ {
+ textureInternalFormat = textureCube->getInternalFormat(target, level);
+ textureCompressed = textureCube->isCompressed(target, level);
+ textureIsDepth = false;
+ textureLevelWidth = textureCube->getWidth(target, level);
+ textureLevelHeight = textureCube->getHeight(target, level);
+ textureLevelDepth = 1;
+ texture = textureCube;
+ maxDimension = context->getMaximumCubeTextureDimension();
+ }
+ }
+ break;
+
+ case GL_TEXTURE_2D_ARRAY:
+ {
+ gl::Texture2DArray *texture2dArray = context->getTexture2DArray();
+ if (texture2dArray)
+ {
+ textureInternalFormat = texture2dArray->getInternalFormat(level);
+ textureCompressed = texture2dArray->isCompressed(level);
+ textureIsDepth = texture2dArray->isDepth(level);
+ textureLevelWidth = texture2dArray->getWidth(level);
+ textureLevelHeight = texture2dArray->getHeight(level);
+ textureLevelDepth = texture2dArray->getLayers(level);
+ texture = texture2dArray;
+ maxDimension = context->getMaximum2DTextureDimension();
+ }
+ }
+ break;
+
+ case GL_TEXTURE_3D:
+ {
+ gl::Texture3D *texture3d = context->getTexture3D();
+ if (texture3d)
+ {
+ textureInternalFormat = texture3d->getInternalFormat(level);
+ textureCompressed = texture3d->isCompressed(level);
+ textureIsDepth = texture3d->isDepth(level);
+ textureLevelWidth = texture3d->getWidth(level);
+ textureLevelHeight = texture3d->getHeight(level);
+ textureLevelDepth = texture3d->getDepth(level);
+ texture = texture3d;
+ maxDimension = context->getMaximum3DTextureDimension();
+ }
+ }
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ if (!texture)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (texture->isImmutable() && !isSubImage)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (textureIsDepth)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (textureCompressed)
+ {
+ int clientVersion = context->getClientVersion();
+ GLint blockWidth = GetCompressedBlockWidth(textureInternalFormat, clientVersion);
+ GLint blockHeight = GetCompressedBlockHeight(textureInternalFormat, clientVersion);
+
+ if (((width % blockWidth) != 0 && width != textureLevelWidth) ||
+ ((height % blockHeight) != 0 && height != textureLevelHeight))
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ }
+
+ if (isSubImage)
+ {
+ if (xoffset + width > textureLevelWidth ||
+ yoffset + height > textureLevelHeight ||
+ zoffset >= textureLevelDepth)
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+ }
+ else
+ {
+ if (IsCubemapTextureTarget(target) && width != height)
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ if (!IsValidInternalFormat(internalformat, context))
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ int maxLevelDimension = (maxDimension >> level);
+ if (static_cast<int>(width) > maxLevelDimension || static_cast<int>(height) > maxLevelDimension)
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+ }
+
+ *textureFormatOut = textureInternalFormat;
+ return true;
+}
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/validationES.h b/chromium/third_party/angle/src/libGLESv2/validationES.h
new file mode 100644
index 00000000000..2bce2d75efd
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/validationES.h
@@ -0,0 +1,63 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationES.h: Validation functions for generic OpenGL ES entry point parameters
+
+#ifndef LIBGLESV2_VALIDATION_ES_H
+#define LIBGLESV2_VALIDATION_ES_H
+
+namespace gl
+{
+
+class Context;
+
+bool ValidCap(const Context *context, GLenum cap);
+bool ValidTextureTarget(const Context *context, GLenum target);
+bool ValidTexture2DDestinationTarget(const Context *context, GLenum target);
+bool ValidFramebufferTarget(GLenum target);
+bool ValidBufferTarget(const Context *context, GLenum target);
+bool ValidBufferParameter(const Context *context, GLenum pname);
+bool ValidMipLevel(const Context *context, GLenum target, GLint level);
+bool ValidImageSize(const gl::Context *context, GLenum target, GLint level, GLsizei width, GLsizei height, GLsizei depth);
+bool ValidCompressedImageSize(const gl::Context *context, GLenum internalFormat, GLsizei width, GLsizei height);
+bool ValidQueryType(const gl::Context *context, GLenum queryType);
+bool ValidProgram(const gl::Context *context, GLuint id);
+
+bool ValidateRenderbufferStorageParameters(const gl::Context *context, GLenum target, GLsizei samples,
+ GLenum internalformat, GLsizei width, GLsizei height,
+ bool angleExtension);
+bool ValidateFramebufferRenderbufferParameters(gl::Context *context, GLenum target, GLenum attachment,
+ GLenum renderbuffertarget, GLuint renderbuffer);
+
+bool ValidateBlitFramebufferParameters(gl::Context *context, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
+ GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask,
+ GLenum filter, bool fromAngleExtension);
+
+bool ValidateGetVertexAttribParameters(GLenum pname, int clientVersion);
+
+bool ValidateTexParamParameters(gl::Context *context, GLenum pname, GLint param);
+
+bool ValidateSamplerObjectParameter(GLenum pname);
+
+bool ValidateReadPixelsParameters(gl::Context *context, GLint x, GLint y, GLsizei width, GLsizei height,
+ GLenum format, GLenum type, GLsizei *bufSize, GLvoid *pixels);
+
+bool ValidateBeginQuery(gl::Context *context, GLenum target, GLuint id);
+bool ValidateEndQuery(gl::Context *context, GLenum target);
+
+bool ValidateUniform(gl::Context *context, GLenum uniformType, GLint location, GLsizei count);
+bool ValidateUniformMatrix(gl::Context *context, GLenum matrixType, GLint location, GLsizei count,
+ GLboolean transpose);
+
+bool ValidateStateQuery(gl::Context *context, GLenum pname, GLenum *nativeType, unsigned int *numParams);
+
+bool ValidateCopyTexImageParametersBase(gl::Context* context, GLenum target, GLint level, GLenum internalformat, bool isSubImage,
+ GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height,
+ GLint border, GLenum *textureInternalFormatOut);
+
+}
+
+#endif // LIBGLESV2_VALIDATION_ES_H
diff --git a/chromium/third_party/angle/src/libGLESv2/validationES2.cpp b/chromium/third_party/angle/src/libGLESv2/validationES2.cpp
new file mode 100644
index 00000000000..a0ef855e327
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/validationES2.cpp
@@ -0,0 +1,992 @@
+#include "precompiled.h"
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationES2.cpp: Validation functions for OpenGL ES 2.0 entry point parameters
+
+#include "libGLESv2/validationES2.h"
+#include "libGLESv2/validationES.h"
+#include "libGLESv2/Context.h"
+#include "libGLESv2/Texture.h"
+#include "libGLESv2/Framebuffer.h"
+#include "libGLESv2/Renderbuffer.h"
+#include "libGLESv2/formatutils.h"
+#include "libGLESv2/main.h"
+
+#include "common/mathutil.h"
+#include "common/utilities.h"
+
+namespace gl
+{
+
+static bool validateSubImageParams2D(bool compressed, GLsizei width, GLsizei height,
+ GLint xoffset, GLint yoffset, GLint level, GLenum format, GLenum type,
+ gl::Texture2D *texture)
+{
+ if (!texture)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (compressed != texture->isCompressed(level))
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (format != GL_NONE)
+ {
+ GLenum internalformat = gl::GetSizedInternalFormat(format, type, 2);
+ if (internalformat != texture->getInternalFormat(level))
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ }
+
+ if (compressed)
+ {
+ if ((width % 4 != 0 && width != texture->getWidth(level)) ||
+ (height % 4 != 0 && height != texture->getHeight(level)))
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ }
+
+ if (xoffset + width > texture->getWidth(level) ||
+ yoffset + height > texture->getHeight(level))
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ return true;
+}
+
+static bool validateSubImageParamsCube(bool compressed, GLsizei width, GLsizei height,
+ GLint xoffset, GLint yoffset, GLenum target, GLint level, GLenum format, GLenum type,
+ gl::TextureCubeMap *texture)
+{
+ if (!texture)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (compressed != texture->isCompressed(target, level))
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (format != GL_NONE)
+ {
+ GLenum internalformat = gl::GetSizedInternalFormat(format, type, 2);
+ if (internalformat != texture->getInternalFormat(target, level))
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ }
+
+ if (compressed)
+ {
+ if ((width % 4 != 0 && width != texture->getWidth(target, 0)) ||
+ (height % 4 != 0 && height != texture->getHeight(target, 0)))
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ }
+
+ if (xoffset + width > texture->getWidth(target, level) ||
+ yoffset + height > texture->getHeight(target, level))
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ return true;
+}
+
+bool ValidateES2TexImageParameters(gl::Context *context, GLenum target, GLint level, GLenum internalformat, bool isCompressed, bool isSubImage,
+ GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ GLint border, GLenum format, GLenum type, const GLvoid *pixels)
+{
+ if (!ValidTexture2DDestinationTarget(context, target))
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ if (!ValidImageSize(context, target, level, width, height, 1))
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ if (level < 0 || xoffset < 0 ||
+ std::numeric_limits<GLsizei>::max() - xoffset < width ||
+ std::numeric_limits<GLsizei>::max() - yoffset < height)
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ if (!isSubImage && !isCompressed && internalformat != format)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ gl::Texture *texture = NULL;
+ bool textureCompressed = false;
+ GLenum textureInternalFormat = GL_NONE;
+ GLint textureLevelWidth = 0;
+ GLint textureLevelHeight = 0;
+ switch (target)
+ {
+ case GL_TEXTURE_2D:
+ {
+ if (width > (context->getMaximum2DTextureDimension() >> level) ||
+ height > (context->getMaximum2DTextureDimension() >> level))
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ gl::Texture2D *tex2d = context->getTexture2D();
+ if (tex2d)
+ {
+ textureCompressed = tex2d->isCompressed(level);
+ textureInternalFormat = tex2d->getInternalFormat(level);
+ textureLevelWidth = tex2d->getWidth(level);
+ textureLevelHeight = tex2d->getHeight(level);
+ texture = tex2d;
+ }
+
+ if (isSubImage && !validateSubImageParams2D(isCompressed, width, height, xoffset, yoffset,
+ level, format, type, tex2d))
+ {
+ return false;
+ }
+
+ texture = tex2d;
+ }
+ break;
+
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ {
+ if (!isSubImage && width != height)
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ if (width > (context->getMaximumCubeTextureDimension() >> level) ||
+ height > (context->getMaximumCubeTextureDimension() >> level))
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ gl::TextureCubeMap *texCube = context->getTextureCubeMap();
+ if (texCube)
+ {
+ textureCompressed = texCube->isCompressed(target, level);
+ textureInternalFormat = texCube->getInternalFormat(target, level);
+ textureLevelWidth = texCube->getWidth(target, level);
+ textureLevelHeight = texCube->getHeight(target, level);
+ texture = texCube;
+ }
+
+ if (isSubImage && !validateSubImageParamsCube(isCompressed, width, height, xoffset, yoffset,
+ target, level, format, type, texCube))
+ {
+ return false;
+ }
+ }
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ if (!texture)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (!isSubImage && texture->isImmutable())
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ // Verify zero border
+ if (border != 0)
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ GLenum actualInternalFormat = isSubImage ? textureInternalFormat : internalformat;
+ if (isCompressed)
+ {
+ if (!ValidCompressedImageSize(context, actualInternalFormat, width, height))
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ switch (actualInternalFormat)
+ {
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ if (!context->supportsDXT1Textures())
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ break;
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
+ if (!context->supportsDXT3Textures())
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ break;
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
+ if (!context->supportsDXT5Textures())
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ }
+ else
+ {
+ // validate <type> by itself (used as secondary key below)
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT:
+ case GL_UNSIGNED_INT:
+ case GL_UNSIGNED_INT_24_8_OES:
+ case GL_HALF_FLOAT_OES:
+ case GL_FLOAT:
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ // validate <format> + <type> combinations
+ // - invalid <format> -> sets INVALID_ENUM
+ // - invalid <format>+<type> combination -> sets INVALID_OPERATION
+ switch (format)
+ {
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ case GL_LUMINANCE_ALPHA:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ case GL_FLOAT:
+ case GL_HALF_FLOAT_OES:
+ break;
+ default:
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ break;
+ case GL_RED:
+ if (!context->supportsRGTextures())
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ case GL_FLOAT:
+ case GL_HALF_FLOAT_OES:
+ break;
+ default:
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ break;
+ case GL_RG:
+ if (!context->supportsRGTextures())
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ case GL_FLOAT:
+ case GL_HALF_FLOAT_OES:
+ break;
+ default:
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ break;
+ case GL_RGB:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_FLOAT:
+ case GL_HALF_FLOAT_OES:
+ break;
+ default:
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ break;
+ case GL_RGBA:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_FLOAT:
+ case GL_HALF_FLOAT_OES:
+ break;
+ default:
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ break;
+ case GL_BGRA_EXT:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ break;
+ default:
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ break;
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: // error cases for compressed textures are handled below
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
+ break;
+ case GL_DEPTH_COMPONENT:
+ switch (type)
+ {
+ case GL_UNSIGNED_SHORT:
+ case GL_UNSIGNED_INT:
+ break;
+ default:
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ break;
+ case GL_DEPTH_STENCIL_OES:
+ switch (type)
+ {
+ case GL_UNSIGNED_INT_24_8_OES:
+ break;
+ default:
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ switch (format)
+ {
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ if (context->supportsDXT1Textures())
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ else
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ break;
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
+ if (context->supportsDXT3Textures())
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ else
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ break;
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
+ if (context->supportsDXT5Textures())
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ else
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ break;
+ case GL_DEPTH_COMPONENT:
+ case GL_DEPTH_STENCIL_OES:
+ if (!context->supportsDepthTextures())
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+ if (target != GL_TEXTURE_2D)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ // OES_depth_texture supports loading depth data and multiple levels,
+ // but ANGLE_depth_texture does not
+ if (pixels != NULL || level != 0)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (type == GL_FLOAT)
+ {
+ if (!context->supportsFloat32Textures())
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ }
+ else if (type == GL_HALF_FLOAT_OES)
+ {
+ if (!context->supportsFloat16Textures())
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ }
+ }
+
+ return true;
+}
+
+
+
+bool ValidateES2CopyTexImageParameters(gl::Context* context, GLenum target, GLint level, GLenum internalformat, bool isSubImage,
+ GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height,
+ GLint border)
+{
+ GLenum textureInternalFormat = GL_NONE;
+
+ if (!ValidateCopyTexImageParametersBase(context, target, level, internalformat, isSubImage,
+ xoffset, yoffset, 0, x, y, width, height, border, &textureInternalFormat))
+ {
+ return false;
+ }
+
+ gl::Framebuffer *framebuffer = context->getReadFramebuffer();
+ GLenum colorbufferFormat = framebuffer->getReadColorbuffer()->getInternalFormat();
+ GLenum textureFormat = gl::GetFormat(textureInternalFormat, context->getClientVersion());
+
+ // [OpenGL ES 2.0.24] table 3.9
+ if (isSubImage)
+ {
+ switch (textureFormat)
+ {
+ case GL_ALPHA:
+ if (colorbufferFormat != GL_ALPHA8_EXT &&
+ colorbufferFormat != GL_RGBA4 &&
+ colorbufferFormat != GL_RGB5_A1 &&
+ colorbufferFormat != GL_RGBA8_OES)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ break;
+ case GL_LUMINANCE:
+ if (colorbufferFormat != GL_R8_EXT &&
+ colorbufferFormat != GL_RG8_EXT &&
+ colorbufferFormat != GL_RGB565 &&
+ colorbufferFormat != GL_RGB8_OES &&
+ colorbufferFormat != GL_RGBA4 &&
+ colorbufferFormat != GL_RGB5_A1 &&
+ colorbufferFormat != GL_RGBA8_OES)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ break;
+ case GL_RED_EXT:
+ if (colorbufferFormat != GL_R8_EXT &&
+ colorbufferFormat != GL_RG8_EXT &&
+ colorbufferFormat != GL_RGB565 &&
+ colorbufferFormat != GL_RGB8_OES &&
+ colorbufferFormat != GL_RGBA4 &&
+ colorbufferFormat != GL_RGB5_A1 &&
+ colorbufferFormat != GL_RGBA8_OES)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ break;
+ case GL_RG_EXT:
+ if (colorbufferFormat != GL_RG8_EXT &&
+ colorbufferFormat != GL_RGB565 &&
+ colorbufferFormat != GL_RGB8_OES &&
+ colorbufferFormat != GL_RGBA4 &&
+ colorbufferFormat != GL_RGB5_A1 &&
+ colorbufferFormat != GL_RGBA8_OES)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ break;
+ case GL_RGB:
+ if (colorbufferFormat != GL_RGB565 &&
+ colorbufferFormat != GL_RGB8_OES &&
+ colorbufferFormat != GL_RGBA4 &&
+ colorbufferFormat != GL_RGB5_A1 &&
+ colorbufferFormat != GL_RGBA8_OES)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ break;
+ case GL_LUMINANCE_ALPHA:
+ case GL_RGBA:
+ if (colorbufferFormat != GL_RGBA4 &&
+ colorbufferFormat != GL_RGB5_A1 &&
+ colorbufferFormat != GL_RGBA8_OES)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ break;
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
+ return gl::error(GL_INVALID_OPERATION, false);
+ case GL_DEPTH_COMPONENT:
+ case GL_DEPTH_STENCIL_OES:
+ return gl::error(GL_INVALID_OPERATION, false);
+ default:
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ }
+ else
+ {
+ switch (internalformat)
+ {
+ case GL_ALPHA:
+ if (colorbufferFormat != GL_ALPHA8_EXT &&
+ colorbufferFormat != GL_RGBA4 &&
+ colorbufferFormat != GL_RGB5_A1 &&
+ colorbufferFormat != GL_BGRA8_EXT &&
+ colorbufferFormat != GL_RGBA8_OES)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ break;
+ case GL_LUMINANCE:
+ if (colorbufferFormat != GL_R8_EXT &&
+ colorbufferFormat != GL_RG8_EXT &&
+ colorbufferFormat != GL_RGB565 &&
+ colorbufferFormat != GL_RGB8_OES &&
+ colorbufferFormat != GL_RGBA4 &&
+ colorbufferFormat != GL_RGB5_A1 &&
+ colorbufferFormat != GL_BGRA8_EXT &&
+ colorbufferFormat != GL_RGBA8_OES)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ break;
+ case GL_RED_EXT:
+ if (colorbufferFormat != GL_R8_EXT &&
+ colorbufferFormat != GL_RG8_EXT &&
+ colorbufferFormat != GL_RGB565 &&
+ colorbufferFormat != GL_RGB8_OES &&
+ colorbufferFormat != GL_RGBA4 &&
+ colorbufferFormat != GL_RGB5_A1 &&
+ colorbufferFormat != GL_BGRA8_EXT &&
+ colorbufferFormat != GL_RGBA8_OES)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ break;
+ case GL_RG_EXT:
+ if (colorbufferFormat != GL_RG8_EXT &&
+ colorbufferFormat != GL_RGB565 &&
+ colorbufferFormat != GL_RGB8_OES &&
+ colorbufferFormat != GL_RGBA4 &&
+ colorbufferFormat != GL_RGB5_A1 &&
+ colorbufferFormat != GL_BGRA8_EXT &&
+ colorbufferFormat != GL_RGBA8_OES)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ break;
+ case GL_RGB:
+ if (colorbufferFormat != GL_RGB565 &&
+ colorbufferFormat != GL_RGB8_OES &&
+ colorbufferFormat != GL_RGBA4 &&
+ colorbufferFormat != GL_RGB5_A1 &&
+ colorbufferFormat != GL_BGRA8_EXT &&
+ colorbufferFormat != GL_RGBA8_OES)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ break;
+ case GL_LUMINANCE_ALPHA:
+ case GL_RGBA:
+ if (colorbufferFormat != GL_RGBA4 &&
+ colorbufferFormat != GL_RGB5_A1 &&
+ colorbufferFormat != GL_BGRA8_EXT &&
+ colorbufferFormat != GL_RGBA8_OES)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ break;
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ if (context->supportsDXT1Textures())
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ else
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ break;
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
+ if (context->supportsDXT3Textures())
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ else
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ break;
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
+ if (context->supportsDXT5Textures())
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ else
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ break;
+ case GL_DEPTH_COMPONENT:
+ case GL_DEPTH_COMPONENT16:
+ case GL_DEPTH_COMPONENT32_OES:
+ case GL_DEPTH_STENCIL_OES:
+ case GL_DEPTH24_STENCIL8_OES:
+ if (context->supportsDepthTextures())
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ else
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ default:
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ }
+
+ // If width or height is zero, it is a no-op. Return false without setting an error.
+ return (width > 0 && height > 0);
+}
+
+bool ValidateES2TexStorageParameters(gl::Context *context, GLenum target, GLsizei levels, GLenum internalformat,
+ GLsizei width, GLsizei height)
+{
+ if (target != GL_TEXTURE_2D && target != GL_TEXTURE_CUBE_MAP)
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ if (width < 1 || height < 1 || levels < 1)
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ if (target == GL_TEXTURE_CUBE_MAP && width != height)
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ if (levels != 1 && levels != gl::log2(std::max(width, height)) + 1)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ GLenum format = gl::GetFormat(internalformat, context->getClientVersion());
+ GLenum type = gl::GetType(internalformat, context->getClientVersion());
+
+ if (format == GL_NONE || type == GL_NONE)
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ switch (target)
+ {
+ case GL_TEXTURE_2D:
+ if (width > context->getMaximum2DTextureDimension() ||
+ height > context->getMaximum2DTextureDimension())
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+ break;
+ case GL_TEXTURE_CUBE_MAP:
+ if (width > context->getMaximumCubeTextureDimension() ||
+ height > context->getMaximumCubeTextureDimension())
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ if (levels != 1 && !context->supportsNonPower2Texture())
+ {
+ if (!gl::isPow2(width) || !gl::isPow2(height))
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ }
+
+ switch (internalformat)
+ {
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ if (!context->supportsDXT1Textures())
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ break;
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
+ if (!context->supportsDXT3Textures())
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ break;
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
+ if (!context->supportsDXT5Textures())
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ break;
+ case GL_RGBA32F_EXT:
+ case GL_RGB32F_EXT:
+ case GL_ALPHA32F_EXT:
+ case GL_LUMINANCE32F_EXT:
+ case GL_LUMINANCE_ALPHA32F_EXT:
+ if (!context->supportsFloat32Textures())
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ break;
+ case GL_RGBA16F_EXT:
+ case GL_RGB16F_EXT:
+ case GL_ALPHA16F_EXT:
+ case GL_LUMINANCE16F_EXT:
+ case GL_LUMINANCE_ALPHA16F_EXT:
+ if (!context->supportsFloat16Textures())
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ break;
+ case GL_R8_EXT:
+ case GL_RG8_EXT:
+ case GL_R16F_EXT:
+ case GL_RG16F_EXT:
+ case GL_R32F_EXT:
+ case GL_RG32F_EXT:
+ if (!context->supportsRGTextures())
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ break;
+ case GL_DEPTH_COMPONENT16:
+ case GL_DEPTH_COMPONENT32_OES:
+ case GL_DEPTH24_STENCIL8_OES:
+ if (!context->supportsDepthTextures())
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ if (target != GL_TEXTURE_2D)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ // ANGLE_depth_texture only supports 1-level textures
+ if (levels != 1)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ break;
+ default:
+ break;
+ }
+
+ gl::Texture *texture = NULL;
+ switch(target)
+ {
+ case GL_TEXTURE_2D:
+ texture = context->getTexture2D();
+ break;
+ case GL_TEXTURE_CUBE_MAP:
+ texture = context->getTextureCubeMap();
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ if (!texture || texture->id() == 0)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (texture->isImmutable())
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ return true;
+}
+
+bool ValidateES2FramebufferTextureParameters(gl::Context *context, GLenum target, GLenum attachment,
+ GLenum textarget, GLuint texture, GLint level)
+{
+ META_ASSERT(GL_DRAW_FRAMEBUFFER == GL_DRAW_FRAMEBUFFER_ANGLE && GL_READ_FRAMEBUFFER == GL_READ_FRAMEBUFFER_ANGLE);
+
+ if (target != GL_FRAMEBUFFER && target != GL_DRAW_FRAMEBUFFER && target != GL_READ_FRAMEBUFFER)
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ if (attachment >= GL_COLOR_ATTACHMENT0 && attachment <= GL_COLOR_ATTACHMENT15)
+ {
+ const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0);
+ if (colorAttachment >= context->getMaximumRenderTargets())
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+ }
+ else
+ {
+ switch (attachment)
+ {
+ case GL_DEPTH_ATTACHMENT:
+ case GL_STENCIL_ATTACHMENT:
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ }
+
+ if (texture != 0)
+ {
+ gl::Texture *tex = context->getTexture(texture);
+
+ if (tex == NULL)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ switch (textarget)
+ {
+ case GL_TEXTURE_2D:
+ {
+ if (tex->getTarget() != GL_TEXTURE_2D)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ gl::Texture2D *tex2d = static_cast<gl::Texture2D *>(tex);
+ if (tex2d->isCompressed(level))
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ break;
+ }
+
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ {
+ if (tex->getTarget() != GL_TEXTURE_CUBE_MAP)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ gl::TextureCubeMap *texcube = static_cast<gl::TextureCubeMap *>(tex);
+ if (texcube->isCompressed(textarget, level))
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ break;
+ }
+
+ default:
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ if (level != 0)
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+ }
+
+ gl::Framebuffer *framebuffer = NULL;
+ GLuint framebufferHandle = 0;
+ if (target == GL_READ_FRAMEBUFFER)
+ {
+ framebuffer = context->getReadFramebuffer();
+ framebufferHandle = context->getReadFramebufferHandle();
+ }
+ else
+ {
+ framebuffer = context->getDrawFramebuffer();
+ framebufferHandle = context->getDrawFramebufferHandle();
+ }
+
+ if (framebufferHandle == 0 || !framebuffer)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ return true;
+}
+
+// check for combinations of format and type that are valid for ReadPixels
+bool ValidES2ReadFormatType(gl::Context *context, GLenum format, GLenum type)
+{
+ switch (format)
+ {
+ case GL_RGBA:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ break;
+ default:
+ return false;
+ }
+ break;
+ case GL_BGRA_EXT:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT:
+ break;
+ default:
+ return false;
+ }
+ break;
+ case GL_RG_EXT:
+ case GL_RED_EXT:
+ if (!context->supportsRGTextures())
+ {
+ return false;
+ }
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ break;
+ default:
+ return false;
+ }
+ break;
+
+ default:
+ return false;
+ }
+ return true;
+}
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/validationES2.h b/chromium/third_party/angle/src/libGLESv2/validationES2.h
new file mode 100644
index 00000000000..02775ff012b
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/validationES2.h
@@ -0,0 +1,35 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationES2.h: Validation functions for OpenGL ES 2.0 entry point parameters
+
+#ifndef LIBGLESV2_VALIDATION_ES2_H
+#define LIBGLESV2_VALIDATION_ES2_H
+
+namespace gl
+{
+
+class Context;
+
+bool ValidateES2TexImageParameters(gl::Context *context, GLenum target, GLint level, GLenum internalformat, bool isCompressed, bool isSubImage,
+ GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+ GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+
+bool ValidateES2CopyTexImageParameters(gl::Context* context, GLenum target, GLint level, GLenum internalformat, bool isSubImage,
+ GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height,
+ GLint border);
+
+bool ValidateES2TexStorageParameters(gl::Context *context, GLenum target, GLsizei levels, GLenum internalformat,
+ GLsizei width, GLsizei height);
+
+bool ValidateES2FramebufferTextureParameters(gl::Context *context, GLenum target, GLenum attachment,
+ GLenum textarget, GLuint texture, GLint level);
+
+bool ValidES2ReadFormatType(gl::Context *context, GLenum format, GLenum type);
+
+}
+
+#endif // LIBGLESV2_VALIDATION_ES2_H
diff --git a/chromium/third_party/angle/src/libGLESv2/validationES3.cpp b/chromium/third_party/angle/src/libGLESv2/validationES3.cpp
new file mode 100644
index 00000000000..a45a5a31d3f
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/validationES3.cpp
@@ -0,0 +1,760 @@
+#include "precompiled.h"
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationES3.cpp: Validation functions for OpenGL ES 3.0 entry point parameters
+
+#include "libGLESv2/validationES3.h"
+#include "libGLESv2/validationES.h"
+#include "libGLESv2/Context.h"
+#include "libGLESv2/Texture.h"
+#include "libGLESv2/Framebuffer.h"
+#include "libGLESv2/Renderbuffer.h"
+#include "libGLESv2/formatutils.h"
+#include "libGLESv2/main.h"
+
+#include "common/mathutil.h"
+
+namespace gl
+{
+
+bool ValidateES3TexImageParameters(gl::Context *context, GLenum target, GLint level, GLenum internalformat, bool isCompressed, bool isSubImage,
+ GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
+ GLint border, GLenum format, GLenum type, const GLvoid *pixels)
+{
+ if (!ValidTexture2DDestinationTarget(context, target))
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ // Validate image size
+ if (!ValidImageSize(context, target, level, width, height, depth))
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ // Verify zero border
+ if (border != 0)
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ if (xoffset < 0 || yoffset < 0 || zoffset < 0 ||
+ std::numeric_limits<GLsizei>::max() - xoffset < width ||
+ std::numeric_limits<GLsizei>::max() - yoffset < height ||
+ std::numeric_limits<GLsizei>::max() - zoffset < depth)
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ gl::Texture *texture = NULL;
+ bool textureCompressed = false;
+ GLenum textureInternalFormat = GL_NONE;
+ GLint textureLevelWidth = 0;
+ GLint textureLevelHeight = 0;
+ GLint textureLevelDepth = 0;
+ switch (target)
+ {
+ case GL_TEXTURE_2D:
+ {
+ if (width > (context->getMaximum2DTextureDimension() >> level) ||
+ height > (context->getMaximum2DTextureDimension() >> level))
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ gl::Texture2D *texture2d = context->getTexture2D();
+ if (texture2d)
+ {
+ textureCompressed = texture2d->isCompressed(level);
+ textureInternalFormat = texture2d->getInternalFormat(level);
+ textureLevelWidth = texture2d->getWidth(level);
+ textureLevelHeight = texture2d->getHeight(level);
+ textureLevelDepth = 1;
+ texture = texture2d;
+ }
+ }
+ break;
+
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ {
+ if (!isSubImage && width != height)
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ if (width > (context->getMaximumCubeTextureDimension() >> level))
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ gl::TextureCubeMap *textureCube = context->getTextureCubeMap();
+ if (textureCube)
+ {
+ textureCompressed = textureCube->isCompressed(target, level);
+ textureInternalFormat = textureCube->getInternalFormat(target, level);
+ textureLevelWidth = textureCube->getWidth(target, level);
+ textureLevelHeight = textureCube->getHeight(target, level);
+ textureLevelDepth = 1;
+ texture = textureCube;
+ }
+ }
+ break;
+
+ case GL_TEXTURE_3D:
+ {
+ if (width > (context->getMaximum3DTextureDimension() >> level) ||
+ height > (context->getMaximum3DTextureDimension() >> level) ||
+ depth > (context->getMaximum3DTextureDimension() >> level))
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ gl::Texture3D *texture3d = context->getTexture3D();
+ if (texture3d)
+ {
+ textureCompressed = texture3d->isCompressed(level);
+ textureInternalFormat = texture3d->getInternalFormat(level);
+ textureLevelWidth = texture3d->getWidth(level);
+ textureLevelHeight = texture3d->getHeight(level);
+ textureLevelDepth = texture3d->getDepth(level);
+ texture = texture3d;
+ }
+ }
+ break;
+
+ case GL_TEXTURE_2D_ARRAY:
+ {
+ if (width > (context->getMaximum2DTextureDimension() >> level) ||
+ height > (context->getMaximum2DTextureDimension() >> level) ||
+ depth > (context->getMaximum2DArrayTextureLayers() >> level))
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ gl::Texture2DArray *texture2darray = context->getTexture2DArray();
+ if (texture2darray)
+ {
+ textureCompressed = texture2darray->isCompressed(level);
+ textureInternalFormat = texture2darray->getInternalFormat(level);
+ textureLevelWidth = texture2darray->getWidth(level);
+ textureLevelHeight = texture2darray->getHeight(level);
+ textureLevelDepth = texture2darray->getLayers(level);
+ texture = texture2darray;
+ }
+ }
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ if (!texture)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (texture->isImmutable() && !isSubImage)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ // Validate texture formats
+ GLenum actualInternalFormat = isSubImage ? textureInternalFormat : internalformat;
+ int clientVersion = context->getClientVersion();
+ if (isCompressed)
+ {
+ if (!ValidCompressedImageSize(context, actualInternalFormat, width, height))
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (!gl::IsFormatCompressed(actualInternalFormat, clientVersion))
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ if (target == GL_TEXTURE_3D)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ }
+ else
+ {
+ // Note: dEQP 2013.4 expects an INVALID_VALUE error for TexImage3D with an invalid
+ // internal format. (dEQP-GLES3.functional.negative_api.texture.teximage3d)
+ if (!gl::IsValidInternalFormat(actualInternalFormat, context) ||
+ !gl::IsValidFormat(format, clientVersion) ||
+ !gl::IsValidType(type, clientVersion))
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ if (!gl::IsValidFormatCombination(actualInternalFormat, format, type, clientVersion))
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (target == GL_TEXTURE_3D && (format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL))
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ }
+
+ // Validate sub image parameters
+ if (isSubImage)
+ {
+ if (isCompressed != textureCompressed)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (isCompressed)
+ {
+ if ((width % 4 != 0 && width != textureLevelWidth) ||
+ (height % 4 != 0 && height != textureLevelHeight))
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ }
+
+ if (width == 0 || height == 0 || depth == 0)
+ {
+ return false;
+ }
+
+ if (xoffset < 0 || yoffset < 0 || zoffset < 0)
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ if (std::numeric_limits<GLsizei>::max() - xoffset < width ||
+ std::numeric_limits<GLsizei>::max() - yoffset < height ||
+ std::numeric_limits<GLsizei>::max() - zoffset < depth)
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ if (xoffset + width > textureLevelWidth ||
+ yoffset + height > textureLevelHeight ||
+ zoffset + depth > textureLevelDepth)
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+ }
+
+ // Check for pixel unpack buffer related API errors
+ gl::Buffer *pixelUnpackBuffer = context->getPixelUnpackBuffer();
+ if (pixelUnpackBuffer != NULL)
+ {
+ // ...the data would be unpacked from the buffer object such that the memory reads required
+ // would exceed the data store size.
+ size_t widthSize = static_cast<size_t>(width);
+ size_t heightSize = static_cast<size_t>(height);
+ size_t depthSize = static_cast<size_t>(depth);
+ GLenum sizedFormat = gl::IsSizedInternalFormat(actualInternalFormat, clientVersion) ?
+ actualInternalFormat :
+ gl::GetSizedInternalFormat(actualInternalFormat, type, clientVersion);
+
+ size_t pixelBytes = static_cast<size_t>(gl::GetPixelBytes(sizedFormat, clientVersion));
+
+ if (!rx::IsUnsignedMultiplicationSafe(widthSize, heightSize) ||
+ !rx::IsUnsignedMultiplicationSafe(widthSize * heightSize, depthSize) ||
+ !rx::IsUnsignedMultiplicationSafe(widthSize * heightSize * depthSize, pixelBytes))
+ {
+ // Overflow past the end of the buffer
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ size_t copyBytes = widthSize * heightSize * depthSize * pixelBytes;
+ size_t offset = reinterpret_cast<size_t>(pixels);
+
+ if (!rx::IsUnsignedAdditionSafe(offset, copyBytes) ||
+ ((offset + copyBytes) > static_cast<size_t>(pixelUnpackBuffer->size())))
+ {
+ // Overflow past the end of the buffer
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ // ...data is not evenly divisible into the number of bytes needed to store in memory a datum
+ // indicated by type.
+ size_t dataBytesPerPixel = static_cast<size_t>(gl::GetTypeBytes(type));
+
+ if ((offset % dataBytesPerPixel) != 0)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ // ...the buffer object's data store is currently mapped.
+ if (pixelUnpackBuffer->mapped())
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ }
+
+ return true;
+}
+
+bool ValidateES3CopyTexImageParameters(gl::Context *context, GLenum target, GLint level, GLenum internalformat,
+ bool isSubImage, GLint xoffset, GLint yoffset, GLint zoffset,
+ GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
+{
+ GLenum textureInternalFormat;
+ if (!ValidateCopyTexImageParametersBase(context, target, level, internalformat, isSubImage,
+ xoffset, yoffset, zoffset, x, y, width, height,
+ border, &textureInternalFormat))
+ {
+ return false;
+ }
+
+ gl::Framebuffer *framebuffer = context->getReadFramebuffer();
+
+ if (framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE)
+ {
+ return gl::error(GL_INVALID_FRAMEBUFFER_OPERATION, false);
+ }
+
+ if (context->getReadFramebufferHandle() != 0 && framebuffer->getSamples() != 0)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ gl::FramebufferAttachment *source = framebuffer->getReadColorbuffer();
+ GLenum colorbufferInternalFormat = source->getInternalFormat();
+
+ if (isSubImage)
+ {
+ if (!gl::IsValidCopyTexImageCombination(textureInternalFormat, colorbufferInternalFormat,
+ context->getReadFramebufferHandle(),
+ context->getClientVersion()))
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ }
+ else
+ {
+ if (!gl::IsValidCopyTexImageCombination(internalformat, colorbufferInternalFormat,
+ context->getReadFramebufferHandle(),
+ context->getClientVersion()))
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ }
+
+ // If width or height is zero, it is a no-op. Return false without setting an error.
+ return (width > 0 && height > 0);
+}
+
+bool ValidateES3TexStorageParameters(gl::Context *context, GLenum target, GLsizei levels, GLenum internalformat,
+ GLsizei width, GLsizei height, GLsizei depth)
+{
+ if (width < 1 || height < 1 || depth < 1 || levels < 1)
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ if (levels > gl::log2(std::max(std::max(width, height), depth)) + 1)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ gl::Texture *texture = NULL;
+ switch (target)
+ {
+ case GL_TEXTURE_2D:
+ {
+ texture = context->getTexture2D();
+
+ if (width > (context->getMaximum2DTextureDimension()) ||
+ height > (context->getMaximum2DTextureDimension()))
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+ }
+ break;
+
+ case GL_TEXTURE_CUBE_MAP:
+ {
+ texture = context->getTextureCubeMap();
+
+ if (width != height)
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ if (width > (context->getMaximumCubeTextureDimension()))
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+ }
+ break;
+
+ case GL_TEXTURE_3D:
+ {
+ texture = context->getTexture3D();
+
+ if (width > (context->getMaximum3DTextureDimension()) ||
+ height > (context->getMaximum3DTextureDimension()) ||
+ depth > (context->getMaximum3DTextureDimension()))
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+ }
+ break;
+
+ case GL_TEXTURE_2D_ARRAY:
+ {
+ texture = context->getTexture2DArray();
+
+ if (width > (context->getMaximum2DTextureDimension()) ||
+ height > (context->getMaximum2DTextureDimension()) ||
+ depth > (context->getMaximum2DArrayTextureLayers()))
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+ }
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ if (!texture || texture->id() == 0)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (texture->isImmutable())
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (!gl::IsValidInternalFormat(internalformat, context))
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ if (!gl::IsSizedInternalFormat(internalformat, context->getClientVersion()))
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ return true;
+}
+
+bool ValidateES3FramebufferTextureParameters(gl::Context *context, GLenum target, GLenum attachment,
+ GLenum textarget, GLuint texture, GLint level, GLint layer,
+ bool layerCall)
+{
+ if (target != GL_FRAMEBUFFER && target != GL_DRAW_FRAMEBUFFER && target != GL_READ_FRAMEBUFFER)
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ if (attachment >= GL_COLOR_ATTACHMENT0 && attachment <= GL_COLOR_ATTACHMENT15)
+ {
+ const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0);
+ if (colorAttachment >= context->getMaximumRenderTargets())
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+ }
+ else
+ {
+ switch (attachment)
+ {
+ case GL_DEPTH_ATTACHMENT:
+ case GL_STENCIL_ATTACHMENT:
+ case GL_DEPTH_STENCIL_ATTACHMENT:
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ }
+
+ if (texture != 0)
+ {
+ gl::Texture *tex = context->getTexture(texture);
+
+ if (tex == NULL)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ if (level < 0)
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ if (layer < 0)
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ if (!layerCall)
+ {
+ switch (textarget)
+ {
+ case GL_TEXTURE_2D:
+ {
+ if (level > gl::log2(context->getMaximum2DTextureDimension()))
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+ if (tex->getTarget() != GL_TEXTURE_2D)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ gl::Texture2D *tex2d = static_cast<gl::Texture2D *>(tex);
+ if (tex2d->isCompressed(level))
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ break;
+ }
+
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ {
+ if (level > gl::log2(context->getMaximumCubeTextureDimension()))
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+ if (tex->getTarget() != GL_TEXTURE_CUBE_MAP)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ gl::TextureCubeMap *texcube = static_cast<gl::TextureCubeMap *>(tex);
+ if (texcube->isCompressed(textarget, level))
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ break;
+ }
+
+ default:
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ }
+ else
+ {
+ switch (tex->getTarget())
+ {
+ case GL_TEXTURE_2D_ARRAY:
+ {
+ if (level > gl::log2(context->getMaximum2DTextureDimension()))
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ if (layer >= context->getMaximum2DArrayTextureLayers())
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ gl::Texture2DArray *texArray = static_cast<gl::Texture2DArray *>(tex);
+ if (texArray->isCompressed(level))
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ break;
+ }
+
+ case GL_TEXTURE_3D:
+ {
+ if (level > gl::log2(context->getMaximum3DTextureDimension()))
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ if (layer >= context->getMaximum3DTextureDimension())
+ {
+ return gl::error(GL_INVALID_VALUE, false);
+ }
+
+ gl::Texture3D *tex3d = static_cast<gl::Texture3D *>(tex);
+ if (tex3d->isCompressed(level))
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ break;
+ }
+
+ default:
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ }
+ }
+
+ gl::Framebuffer *framebuffer = NULL;
+ GLuint framebufferHandle = 0;
+ if (target == GL_READ_FRAMEBUFFER)
+ {
+ framebuffer = context->getReadFramebuffer();
+ framebufferHandle = context->getReadFramebufferHandle();
+ }
+ else
+ {
+ framebuffer = context->getDrawFramebuffer();
+ framebufferHandle = context->getDrawFramebufferHandle();
+ }
+
+ if (framebufferHandle == 0 || !framebuffer)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ return true;
+}
+
+bool ValidES3ReadFormatType(gl::Context *context, GLenum internalFormat, GLenum format, GLenum type)
+{
+ switch (format)
+ {
+ case GL_RGBA:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ break;
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ if (internalFormat != GL_RGB10_A2)
+ {
+ return false;
+ }
+ break;
+ case GL_FLOAT:
+ if (gl::GetComponentType(internalFormat, 3) != GL_FLOAT)
+ {
+ return false;
+ }
+ break;
+ default:
+ return false;
+ }
+ break;
+ case GL_RGBA_INTEGER:
+ switch (type)
+ {
+ case GL_INT:
+ if (gl::GetComponentType(internalFormat, 3) != GL_INT)
+ {
+ return false;
+ }
+ break;
+ case GL_UNSIGNED_INT:
+ if (gl::GetComponentType(internalFormat, 3) != GL_UNSIGNED_INT)
+ {
+ return false;
+ }
+ break;
+ default:
+ return false;
+ }
+ break;
+ case GL_BGRA_EXT:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT:
+ break;
+ default:
+ return false;
+ }
+ break;
+ case GL_RG_EXT:
+ case GL_RED_EXT:
+ if (!context->supportsRGTextures())
+ {
+ return false;
+ }
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ break;
+ default:
+ return false;
+ }
+ break;
+ default:
+ return false;
+ }
+ return true;
+}
+
+bool ValidateInvalidateFramebufferParameters(gl::Context *context, GLenum target, GLsizei numAttachments,
+ const GLenum* attachments)
+{
+ bool defaultFramebuffer = false;
+
+ switch (target)
+ {
+ case GL_DRAW_FRAMEBUFFER:
+ case GL_FRAMEBUFFER:
+ defaultFramebuffer = context->getDrawFramebufferHandle() == 0;
+ break;
+ case GL_READ_FRAMEBUFFER:
+ defaultFramebuffer = context->getReadFramebufferHandle() == 0;
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ for (int i = 0; i < numAttachments; ++i)
+ {
+ if (attachments[i] >= GL_COLOR_ATTACHMENT0 && attachments[i] <= GL_COLOR_ATTACHMENT15)
+ {
+ if (defaultFramebuffer)
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
+ if (attachments[i] >= GL_COLOR_ATTACHMENT0 + context->getMaximumRenderTargets())
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+ }
+ else
+ {
+ switch (attachments[i])
+ {
+ case GL_DEPTH_ATTACHMENT:
+ case GL_STENCIL_ATTACHMENT:
+ case GL_DEPTH_STENCIL_ATTACHMENT:
+ if (defaultFramebuffer)
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ break;
+ case GL_COLOR:
+ case GL_DEPTH:
+ case GL_STENCIL:
+ if (!defaultFramebuffer)
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+ }
+ }
+
+ return true;
+}
+
+}
diff --git a/chromium/third_party/angle/src/libGLESv2/validationES3.h b/chromium/third_party/angle/src/libGLESv2/validationES3.h
new file mode 100644
index 00000000000..93917c26bae
--- /dev/null
+++ b/chromium/third_party/angle/src/libGLESv2/validationES3.h
@@ -0,0 +1,39 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationES3.h: Validation functions for OpenGL ES 3.0 entry point parameters
+
+#ifndef LIBGLESV2_VALIDATION_ES3_H
+#define LIBGLESV2_VALIDATION_ES3_H
+
+namespace gl
+{
+
+class Context;
+
+bool ValidateES3TexImageParameters(gl::Context *context, GLenum target, GLint level, GLenum internalformat, bool isCompressed, bool isSubImage,
+ GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
+ GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+
+bool ValidateES3CopyTexImageParameters(gl::Context *context, GLenum target, GLint level, GLenum internalformat,
+ bool isSubImage, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y,
+ GLsizei width, GLsizei height, GLint border);
+
+bool ValidateES3TexStorageParameters(gl::Context *context, GLenum target, GLsizei levels, GLenum internalformat,
+ GLsizei width, GLsizei height, GLsizei depth);
+
+bool ValidateES3FramebufferTextureParameters(gl::Context *context, GLenum target, GLenum attachment,
+ GLenum textarget, GLuint texture, GLint level, GLint layer,
+ bool layerCall);
+
+bool ValidES3ReadFormatType(gl::Context *context, GLenum internalFormat, GLenum format, GLenum type);
+
+bool ValidateInvalidateFramebufferParameters(gl::Context *context, GLenum target, GLsizei numAttachments,
+ const GLenum* attachments);
+
+}
+
+#endif // LIBGLESV2_VALIDATION_ES3_H
diff --git a/chromium/third_party/angle/src/third_party/compiler/ArrayBoundsClamper.h b/chromium/third_party/angle/src/third_party/compiler/ArrayBoundsClamper.h
index 0d4e1a374ca..7d06a6c70d9 100644
--- a/chromium/third_party/angle/src/third_party/compiler/ArrayBoundsClamper.h
+++ b/chromium/third_party/angle/src/third_party/compiler/ArrayBoundsClamper.h
@@ -26,10 +26,8 @@
#ifndef THIRD_PARTY_COMPILER_ARRAY_BOUNDS_CLAMPER_H_
#define THIRD_PARTY_COMPILER_ARRAY_BOUNDS_CLAMPER_H_
-#include "GLSLANG/ShaderLang.h"
-
-#include "compiler/InfoSink.h"
-#include "compiler/intermediate.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/intermediate.h"
class ArrayBoundsClamper {
public:
diff --git a/chromium/third_party/angle/src/third_party/murmurhash/MurmurHash3.h b/chromium/third_party/angle/src/third_party/murmurhash/MurmurHash3.h
index c08f4f25852..adb52004e2f 100644
--- a/chromium/third_party/angle/src/third_party/murmurhash/MurmurHash3.h
+++ b/chromium/third_party/angle/src/third_party/murmurhash/MurmurHash3.h
@@ -8,22 +8,8 @@
//-----------------------------------------------------------------------------
// Platform-specific functions and macros
-// Microsoft Visual Studio
-
-#if defined(_MSC_VER)
-
-typedef unsigned char uint8_t;
-typedef unsigned long uint32_t;
-typedef unsigned __int64 uint64_t;
-
-// Other compilers
-
-#else // defined(_MSC_VER)
-
#include <stdint.h>
-#endif // !defined(_MSC_VER)
-
//-----------------------------------------------------------------------------
void MurmurHash3_x86_32 ( const void * key, int len, uint32_t seed, void * out );
diff --git a/chromium/third_party/angle/src/third_party/systeminfo/SystemInfo.cpp b/chromium/third_party/angle/src/third_party/systeminfo/SystemInfo.cpp
new file mode 100644
index 00000000000..19a9644d709
--- /dev/null
+++ b/chromium/third_party/angle/src/third_party/systeminfo/SystemInfo.cpp
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <windows.h>
+
+#if _WIN32_WINNT_WINBLUE
+#include <versionhelpers.h>
+#endif
+
+namespace rx {
+
+#ifndef _WIN32_WINNT_WINBLUE
+static bool IsWindowsVistaOrGreater()
+{
+ OSVERSIONINFOEXW osvi = { };
+ osvi.dwOSVersionInfoSize = sizeof(osvi);
+ osvi.dwMajorVersion = HIBYTE(_WIN32_WINNT_VISTA);
+ osvi.dwMinorVersion = LOBYTE(_WIN32_WINNT_VISTA);
+ DWORDLONG condition = 0;
+ VER_SET_CONDITION(condition, VER_MAJORVERSION, VER_GREATER_EQUAL);
+ VER_SET_CONDITION(condition, VER_MINORVERSION, VER_GREATER_EQUAL);
+ return !!::VerifyVersionInfoW(&osvi, VER_MAJORVERSION | VER_MINORVERSION, condition);
+}
+#endif
+
+bool isWindowsVistaOrGreater()
+{
+ static bool initialized = false;
+ static bool cachedIsWindowsVistaOrGreater;
+
+ if (!initialized) {
+ initialized = true;
+ cachedIsWindowsVistaOrGreater = IsWindowsVistaOrGreater();
+ }
+ return cachedIsWindowsVistaOrGreater;
+}
+
+} // namespace rx
diff --git a/chromium/third_party/angle/src/third_party/systeminfo/SystemInfo.h b/chromium/third_party/angle/src/third_party/systeminfo/SystemInfo.h
new file mode 100644
index 00000000000..65005ee9c62
--- /dev/null
+++ b/chromium/third_party/angle/src/third_party/systeminfo/SystemInfo.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SystemInfo_h
+#define SystemInfo_h
+
+namespace rx {
+
+bool isWindowsVistaOrGreater();
+
+} // namespace rx
+
+#endif // SystemInfo_h
diff --git a/chromium/third_party/angle/tests/build_tests.gyp b/chromium/third_party/angle/tests/build_tests.gyp
deleted file mode 100644
index d485c834138..00000000000
--- a/chromium/third_party/angle/tests/build_tests.gyp
+++ /dev/null
@@ -1,100 +0,0 @@
-# Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-{
- 'targets': [
- {
- 'target_name': 'gtest',
- 'type': 'static_library',
- 'include_dirs': [
- '../third_party/googletest',
- '../third_party/googletest/include',
- ],
- 'sources': [
- '../third_party/googletest/src/gtest-all.cc',
- ],
- 'defines': [
- '_VARIADIC_MAX=10',
- ],
- 'direct_dependent_settings': {
- 'defines': [
- '_VARIADIC_MAX=10',
- ],
- },
- },
- {
- 'target_name': 'gmock',
- 'type': 'static_library',
- 'include_dirs': [
- '../third_party/googlemock',
- '../third_party/googlemock/include',
- '../third_party/googletest/include',
- ],
- 'sources': [
- '../third_party/googlemock/src/gmock-all.cc',
- ],
- 'defines': [
- '_VARIADIC_MAX=10',
- ],
- 'direct_dependent_settings': {
- 'defines': [
- '_VARIADIC_MAX=10',
- ],
- },
- },
- {
- 'target_name': 'preprocessor_tests',
- 'type': 'executable',
- 'dependencies': [
- '../src/build_angle.gyp:preprocessor',
- 'gtest',
- 'gmock',
- ],
- 'variables': {
- 'ANGLE_DIR': '..',
- },
- 'includes': [
- 'preprocessor_tests/preprocessor_tests.gypi',
- ],
- 'include_dirs': [
- '../src/compiler/preprocessor',
- '../third_party/googletest/include',
- '../third_party/googlemock/include',
- ],
- 'sources': [
- '../third_party/googlemock/src/gmock_main.cc',
- ],
- },
- {
- 'target_name': 'compiler_tests',
- 'type': 'executable',
- 'dependencies': [
- '../src/build_angle.gyp:translator_static',
- 'gtest',
- 'gmock',
- ],
- 'variables': {
- 'ANGLE_DIR': '..',
- },
- 'includes': [
- 'compiler_tests/compiler_tests.gypi',
- ],
- 'include_dirs': [
- '../include',
- '../src',
- '../third_party/googletest/include',
- '../third_party/googlemock/include',
- ],
- 'sources': [
- 'compiler_tests/compiler_test_main.cpp',
- ],
- },
- ],
-}
-
-# Local Variables:
-# tab-width:2
-# indent-tabs-mode:nil
-# End:
-# vim: set expandtab tabstop=2 shiftwidth=2:
diff --git a/chromium/third_party/angle/tests/compiler_tests/compiler_tests.gypi b/chromium/third_party/angle/tests/compiler_tests/compiler_tests.gypi
index 2a5e85db8fb..44a22125513 100644
--- a/chromium/third_party/angle/tests/compiler_tests/compiler_tests.gypi
+++ b/chromium/third_party/angle/tests/compiler_tests/compiler_tests.gypi
@@ -1,18 +1,13 @@
-# Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+# Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
- 'sources': [
- '<(ANGLE_DIR)/tests/compiler_tests/ExpressionLimit_test.cpp',
- '<(ANGLE_DIR)/tests/compiler_tests/VariablePacker_test.cpp',
- ],
+ 'sources':
+ [
+ '<!@(python <(angle_path)/enumerate_files.py \
+ -dirs <(angle_path)/tests/compiler_tests \
+ -types *.cpp *.h \
+ -excludes <(angle_path)/tests/compiler_tests/compiler_test_main.cpp)'
+ ],
}
-
-
-# Local Variables:
-# tab-width:2
-# indent-tabs-mode:nil
-# End:
-# vim: set expandtab tabstop=2 shiftwidth=2:
-
diff --git a/chromium/third_party/angle/tests/preprocessor_tests/preprocessor_tests.gypi b/chromium/third_party/angle/tests/preprocessor_tests/preprocessor_tests.gypi
index daf560dc965..1d7c7a3da85 100644
--- a/chromium/third_party/angle/tests/preprocessor_tests/preprocessor_tests.gypi
+++ b/chromium/third_party/angle/tests/preprocessor_tests/preprocessor_tests.gypi
@@ -1,35 +1,13 @@
-# Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+# Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
- 'sources': [
- '<(ANGLE_DIR)/tests/preprocessor_tests/char_test.cpp',
- '<(ANGLE_DIR)/tests/preprocessor_tests/comment_test.cpp',
- '<(ANGLE_DIR)/tests/preprocessor_tests/define_test.cpp',
- '<(ANGLE_DIR)/tests/preprocessor_tests/error_test.cpp',
- '<(ANGLE_DIR)/tests/preprocessor_tests/extension_test.cpp',
- '<(ANGLE_DIR)/tests/preprocessor_tests/identifier_test.cpp',
- '<(ANGLE_DIR)/tests/preprocessor_tests/if_test.cpp',
- '<(ANGLE_DIR)/tests/preprocessor_tests/input_test.cpp',
- '<(ANGLE_DIR)/tests/preprocessor_tests/location_test.cpp',
- '<(ANGLE_DIR)/tests/preprocessor_tests/MockDiagnostics.h',
- '<(ANGLE_DIR)/tests/preprocessor_tests/MockDirectiveHandler.h',
- '<(ANGLE_DIR)/tests/preprocessor_tests/number_test.cpp',
- '<(ANGLE_DIR)/tests/preprocessor_tests/operator_test.cpp',
- '<(ANGLE_DIR)/tests/preprocessor_tests/pragma_test.cpp',
- '<(ANGLE_DIR)/tests/preprocessor_tests/PreprocessorTest.cpp',
- '<(ANGLE_DIR)/tests/preprocessor_tests/PreprocessorTest.h',
- '<(ANGLE_DIR)/tests/preprocessor_tests/space_test.cpp',
- '<(ANGLE_DIR)/tests/preprocessor_tests/token_test.cpp',
- '<(ANGLE_DIR)/tests/preprocessor_tests/version_test.cpp',
- ],
+ 'sources':
+ [
+ '<!@(python <(angle_path)/enumerate_files.py \
+ -dirs <(angle_path)/tests/preprocessor_tests \
+ -types *.cpp *.h \
+ -excludes <(angle_path)/tests/preprocessor_tests/preprocessor_test_main.cpp)'
+ ],
}
-
-
-# Local Variables:
-# tab-width:2
-# indent-tabs-mode:nil
-# End:
-# vim: set expandtab tabstop=2 shiftwidth=2:
-
diff --git a/chromium/third_party/angle/tests/tests.gyp b/chromium/third_party/angle/tests/tests.gyp
new file mode 100644
index 00000000000..17f8dabb4f6
--- /dev/null
+++ b/chromium/third_party/angle/tests/tests.gyp
@@ -0,0 +1,364 @@
+# Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'variables':
+ {
+ 'angle_build_conformance_tests%': '0',
+ 'angle_build_deqp_tests%': '0',
+ },
+ 'targets':
+ [
+ {
+ 'target_name': 'gtest',
+ 'type': 'static_library',
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'include_dirs':
+ [
+ 'third_party/googletest',
+ 'third_party/googletest/include',
+ ],
+ 'sources':
+ [
+ 'third_party/googletest/src/gtest-all.cc',
+ ],
+ 'defines':
+ [
+ '_VARIADIC_MAX=10',
+ ],
+ 'direct_dependent_settings':
+ {
+ 'defines':
+ [
+ '_VARIADIC_MAX=10',
+ ],
+ },
+ },
+
+ {
+ 'target_name': 'gmock',
+ 'type': 'static_library',
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'include_dirs':
+ [
+ 'third_party/googlemock',
+ 'third_party/googlemock/include',
+ 'third_party/googletest/include',
+ ],
+ 'sources':
+ [
+ 'third_party/googlemock/src/gmock-all.cc',
+ ],
+ 'defines':
+ [
+ '_VARIADIC_MAX=10',
+ ],
+ 'direct_dependent_settings':
+ {
+ 'defines':
+ [
+ '_VARIADIC_MAX=10',
+ ],
+ },
+ },
+
+ {
+ 'target_name': 'preprocessor_tests',
+ 'type': 'executable',
+ 'dependencies':
+ [
+ '../src/angle.gyp:preprocessor',
+ 'gtest',
+ 'gmock',
+ ],
+ 'include_dirs':
+ [
+ '../src/compiler/preprocessor',
+ 'third_party/googletest/include',
+ 'third_party/googlemock/include',
+ ],
+ 'includes':
+ [
+ '../build/common_defines.gypi',
+ 'preprocessor_tests/preprocessor_tests.gypi',
+ ],
+ 'sources':
+ [
+ 'preprocessor_tests/preprocessor_test_main.cpp',
+ ],
+ },
+
+ {
+ 'target_name': 'compiler_tests',
+ 'type': 'executable',
+ 'dependencies':
+ [
+ '../src/angle.gyp:translator_static',
+ 'gtest',
+ ],
+ 'include_dirs':
+ [
+ '../include',
+ '../src',
+ 'third_party/googletest/include',
+ ],
+ 'includes':
+ [
+ '../build/common_defines.gypi',
+ 'compiler_tests/compiler_tests.gypi',
+ ],
+ 'sources':
+ [
+ 'compiler_tests/compiler_test_main.cpp',
+ ],
+ },
+ ],
+
+ 'conditions':
+ [
+ ['OS=="win"',
+ {
+ 'targets':
+ [
+ {
+ 'target_name': 'angle_tests',
+ 'type': 'executable',
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'dependencies':
+ [
+ '../src/angle.gyp:libGLESv2',
+ '../src/angle.gyp:libEGL',
+ 'gtest',
+ ],
+ 'include_dirs':
+ [
+ '../include',
+ 'angle_tests',
+ 'third_party/googletest/include',
+ ],
+ 'sources':
+ [
+ '<!@(python <(angle_path)/enumerate_files.py angle_tests -types *.cpp *.h *.inl)'
+ ],
+ },
+ {
+ 'target_name': 'standalone_tests',
+ 'type': 'executable',
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'dependencies':
+ [
+ 'gtest',
+ 'gmock',
+ ],
+ 'include_dirs':
+ [
+ '../include',
+ 'angle_tests',
+ 'third_party/googletest/include',
+ 'third_party/googlemock/include',
+ ],
+ 'sources':
+ [
+ '<!@(python <(angle_path)/enumerate_files.py standalone_tests -types *.cpp *.h)'
+ ],
+ },
+ ],
+ 'conditions':
+ [
+ ['angle_build_conformance_tests',
+ {
+ 'variables':
+ {
+ 'gles_conformance_tests_output_dir': '<(SHARED_INTERMEDIATE_DIR)/conformance_tests',
+ 'gles_conformance_tests_input_dir': 'third_party/gles_conformance_tests/conform/GTF_ES/glsl/GTF',
+ 'gles_conformance_tests_generator_script': 'gles_conformance_tests/generate_gles_conformance_tests.py',
+ },
+ 'targets':
+ [
+ {
+ 'target_name': 'gles2_conformance_tests',
+ 'type': 'executable',
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'dependencies':
+ [
+ '../src/angle.gyp:libGLESv2',
+ '../src/angle.gyp:libEGL',
+ 'gtest',
+ 'third_party/gles_conformance_tests/conform/GTF_ES/glsl/GTF/es_cts.gyp:es_cts_test_data',
+ 'third_party/gles_conformance_tests/conform/GTF_ES/glsl/GTF/es_cts.gyp:es2_cts',
+ ],
+ 'variables':
+ {
+ 'gles2_conformance_tests_input_file': '<(gles_conformance_tests_input_dir)/mustpass_es20.run',
+ 'gles2_conformance_tests_generated_file': '<(gles_conformance_tests_output_dir)/generated_gles2_conformance_tests.cpp',
+ },
+ 'sources':
+ [
+ '<!@(python <(angle_path)/enumerate_files.py gles_conformance_tests -types *.cpp *.h *.inl)',
+ '<(gles2_conformance_tests_generated_file)',
+ ],
+ 'include_dirs':
+ [
+ '../include',
+ 'gles_conformance_tests',
+ 'third_party/googletest/include',
+ ],
+ 'defines':
+ [
+ 'CONFORMANCE_TESTS_TYPE=CONFORMANCE_TESTS_ES2',
+ ],
+ 'actions':
+ [
+ {
+ 'action_name': 'generate_gles2_conformance_tests',
+ 'message': 'Generating ES2 conformance tests...',
+ 'msvs_cygwin_shell': 0,
+ 'inputs':
+ [
+ '<(gles_conformance_tests_generator_script)',
+ '<(gles2_conformance_tests_input_file)',
+ ],
+ 'outputs':
+ [
+ '<(gles2_conformance_tests_generated_file)',
+ ],
+ 'action':
+ [
+ 'python',
+ '<(gles_conformance_tests_generator_script)',
+ '<(gles2_conformance_tests_input_file)',
+ '<(gles_conformance_tests_input_dir)',
+ '<(gles2_conformance_tests_generated_file)',
+ ],
+ },
+ ],
+ },
+ {
+ 'target_name': 'gles3_conformance_tests',
+ 'type': 'executable',
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'dependencies':
+ [
+ '../src/angle.gyp:libGLESv2',
+ '../src/angle.gyp:libEGL',
+ 'gtest',
+ 'third_party/gles_conformance_tests/conform/GTF_ES/glsl/GTF/es_cts.gyp:es_cts_test_data',
+ 'third_party/gles_conformance_tests/conform/GTF_ES/glsl/GTF/es_cts.gyp:es3_cts',
+ ],
+ 'variables':
+ {
+ 'gles3_conformance_tests_input_file': '<(gles_conformance_tests_input_dir)/mustpass_es30.run',
+ 'gles3_conformance_tests_generated_file': '<(gles_conformance_tests_output_dir)/generated_gles3_conformance_tests.cpp',
+ },
+ 'sources':
+ [
+ '<!@(python <(angle_path)/enumerate_files.py gles_conformance_tests -types *.cpp *.h *.inl)',
+ '<(gles3_conformance_tests_generated_file)',
+ ],
+ 'include_dirs':
+ [
+ '../include',
+ 'gles_conformance_tests',
+ 'third_party/googletest/include',
+ ],
+ 'defines':
+ [
+ 'CONFORMANCE_TESTS_TYPE=CONFORMANCE_TESTS_ES3',
+ ],
+ 'actions':
+ [
+ {
+ 'action_name': 'generate_gles3_conformance_tests',
+ 'message': 'Generating ES3 conformance tests...',
+ 'msvs_cygwin_shell': 0,
+ 'inputs':
+ [
+ '<(gles_conformance_tests_generator_script)',
+ '<(gles3_conformance_tests_input_file)',
+ ],
+ 'outputs':
+ [
+ '<(gles3_conformance_tests_generated_file)',
+ ],
+ 'action':
+ [
+ 'python',
+ '<(gles_conformance_tests_generator_script)',
+ '<(gles3_conformance_tests_input_file)',
+ '<(gles_conformance_tests_input_dir)',
+ '<(gles3_conformance_tests_generated_file)',
+ ],
+ },
+ ],
+ },
+ ],
+ }],
+ ['angle_build_deqp_tests',
+ {
+ 'targets':
+ [
+ {
+ 'target_name': 'deqp_tests',
+ 'type': 'executable',
+ 'includes': [ '../build/common_defines.gypi', ],
+ 'dependencies':
+ [
+ '../src/angle.gyp:libGLESv2',
+ '../src/angle.gyp:libEGL',
+ 'gtest',
+ 'third_party/deqp/src/deqp/modules/gles3/gles3.gyp:deqp-gles3',
+ 'third_party/deqp/src/deqp/framework/platform/platform.gyp:tcutil-platform',
+ ],
+ 'include_dirs':
+ [
+ '../include',
+ 'third_party/googletest/include',
+ 'deqp_tests',
+ ],
+ 'variables':
+ {
+ 'deqp_tests_output_dir': '<(SHARED_INTERMEDIATE_DIR)/deqp_tests',
+ 'deqp_tests_input_file': 'deqp_tests/deqp_tests.txt',
+ 'deqp_tests_generated_file': '<(deqp_tests_output_dir)/generated_deqp_tests.cpp',
+ },
+ 'sources':
+ [
+ '<!@(python <(angle_path)/enumerate_files.py deqp_tests -types *.cpp *.h *.inl)',
+ '<(deqp_tests_generated_file)',
+ ],
+ 'actions':
+ [
+ {
+ 'action_name': 'generate_deqp_tests',
+ 'message': 'Generating dEQP tests...',
+ 'msvs_cygwin_shell': 0,
+ 'variables':
+ {
+ 'deqp_tests_generator_script': 'deqp_tests/generate_deqp_tests.py',
+ },
+ 'inputs':
+ [
+ '<(deqp_tests_generator_script)',
+ '<(deqp_tests_input_file)',
+ ],
+ 'outputs':
+ [
+ '<(deqp_tests_generated_file)',
+ ],
+ 'action':
+ [
+ 'python',
+ '<(deqp_tests_generator_script)',
+ '<(deqp_tests_input_file)',
+ '<(deqp_tests_generated_file)',
+ ],
+ },
+ ],
+ },
+ ],
+ }],
+ ],
+ }],
+ ],
+}