├── .clang-format ├── .gitattributes ├── .gitignore ├── AUTHORS ├── BUILD.gn ├── CONTRIBUTORS ├── DEPS ├── LICENSE ├── README.chromium ├── README.md ├── angle.isolate ├── angle_on_all_platforms.isolate ├── build ├── ANGLE.gyp ├── angle_common.gni ├── common.gypi ├── common_defines.gypi ├── gyp_angle └── standalone.gypi ├── codereview.settings ├── doc ├── 64BitSafety.md ├── BranchingAndRolling.md ├── BufferImplementation.md ├── BuildingAngleForChromiumDevelopment.md ├── BuildingAngleForWindowsStore.md ├── ChoosingANGLEBranch.md ├── CodeReviewProcess.md ├── CodingStandard.md ├── CompilingTranslatorWithEmscripten.md ├── ContributingCode.md ├── DebuggingTips.md ├── DevSetup.md ├── DynamicShaderCompilation.md ├── ExtensionSupport.md ├── MANGLE.md ├── ResourceLimits.md ├── SourceAccess.md ├── Update20120704.md ├── Update20130618.md ├── Update20131120.md ├── Update20140325.md ├── Update20150105.md ├── VTF.md └── dEQP.md ├── extensions ├── ANGLE_depth_texture.txt ├── ANGLE_framebuffer_blit.txt ├── ANGLE_framebuffer_multisample.txt ├── ANGLE_instanced_arrays.txt ├── ANGLE_lossy_etc_decode.txt ├── ANGLE_pack_reverse_row_order.txt ├── ANGLE_platform_angle.txt ├── ANGLE_platform_angle_d3d.txt ├── ANGLE_platform_angle_opengl.txt ├── ANGLE_program_binary.txt ├── ANGLE_robust_resource_initialization.txt ├── ANGLE_texture_compression_dxt.txt ├── ANGLE_texture_usage.txt ├── ANGLE_timer_query.txt ├── ANGLE_translated_shader_source.txt ├── EGL_ANGLE_d3d_share_handle_client_buffer.txt ├── EGL_ANGLE_device_creation.txt ├── EGL_ANGLE_device_creation_d3d11.txt ├── EGL_ANGLE_device_d3d.txt ├── EGL_ANGLE_direct3d_display.txt ├── EGL_ANGLE_direct_composition.txt ├── EGL_ANGLE_experimental_present_path.txt ├── EGL_ANGLE_flexible_surface_compatibility.txt ├── EGL_ANGLE_keyed_mutex.txt ├── EGL_ANGLE_query_surface_pointer.txt ├── EGL_ANGLE_robust_resource_initialization.txt ├── EGL_ANGLE_software_display.txt ├── EGL_ANGLE_surface_d3d_texture_2d_share_handle.txt ├── EGL_ANGLE_surface_orientation.txt ├── EGL_ANGLE_window_fixed_size.txt ├── EGL_ANGLE_x11_visual.txt ├── EGL_EXT_create_context_robustness.txt ├── EGL_EXT_device_query.txt ├── EXT_blend_func_extended.txt ├── EXT_blend_minmax.txt ├── EXT_color_buffer_float.txt ├── EXT_draw_buffers.txt ├── EXT_robustness.txt ├── EXT_shader_framebuffer_fetch.txt ├── EXT_texture_rg.txt └── EXT_texture_storage.txt ├── include ├── EGL │ ├── egl.h │ ├── eglext.h │ └── eglplatform.h ├── GLES2 │ ├── gl2.h │ ├── gl2ext.h │ └── gl2platform.h ├── GLES3 │ ├── gl3.h │ ├── gl31.h │ ├── gl32.h │ └── gl3platform.h ├── GLSLANG │ ├── ShaderLang.h │ └── ShaderVars.h ├── KHR │ └── khrplatform.h ├── angle_gl.h ├── angle_windowsstore.h ├── export.h └── platform │ └── Platform.h ├── infra └── config │ ├── OWNERS │ ├── README.md │ └── cq.cfg ├── samples ├── WindowTest │ └── WindowTest.cpp ├── hello_triangle │ └── HelloTriangle.cpp ├── mip_map_2d │ └── MipMap2D.cpp ├── multi_texture │ ├── MultiTexture.cpp │ ├── basemap.tga │ └── lightmap.tga ├── multi_window │ └── MultiWindow.cpp ├── multiple_draw_buffers │ ├── MultipleDrawBuffers.cpp │ ├── multiple_draw_buffers_copy_fs.glsl │ ├── multiple_draw_buffers_fs.glsl │ └── multiple_draw_buffers_vs.glsl ├── particle_system │ ├── ParticleSystem.cpp │ └── smoke.tga ├── post_sub_buffer │ └── PostSubBuffer.cpp ├── sample_util │ ├── SampleApplication.cpp │ ├── SampleApplication.h │ ├── texture_utils.cpp │ ├── texture_utils.h │ ├── tga_utils.cpp │ └── tga_utils.h ├── samples.gyp ├── shader_translator │ └── shader_translator.cpp ├── simple_instancing │ └── SimpleInstancing.cpp ├── simple_texture_2d │ └── SimpleTexture2D.cpp ├── simple_texture_cubemap │ └── SimpleTextureCubemap.cpp ├── simple_vertex_shader │ └── SimpleVertexShader.cpp ├── stencil_operations │ └── StencilOperations.cpp ├── tex_redef_microbench │ └── TexRedefMicroBench.cpp ├── texture_wrap │ └── TextureWrap.cpp └── tri_fan_microbench │ └── TriFanMicroBench.cpp ├── scripts ├── bootstrap.py └── perf_test_runner.py ├── src ├── angle.gyp ├── commit.h ├── commit_id.py ├── common │ ├── BitSetIterator.h │ ├── BitSetIterator_unittest.cpp │ ├── Float16ToFloat32.cpp │ ├── Float16ToFloat32.py │ ├── MemoryBuffer.cpp │ ├── MemoryBuffer.h │ ├── Optional.h │ ├── Optional_unittest.cpp │ ├── angleutils.cpp │ ├── angleutils.h │ ├── debug.cpp │ ├── debug.h │ ├── event_tracer.cpp │ ├── event_tracer.h │ ├── mathutil.cpp │ ├── mathutil.h │ ├── mathutil_unittest.cpp │ ├── matrix_utils.h │ ├── matrix_utils_unittest.cpp │ ├── platform.h │ ├── string_utils.cpp │ ├── string_utils.h │ ├── string_utils_unittest.cpp │ ├── tls.cpp │ ├── tls.h │ ├── utilities.cpp │ ├── utilities.h │ ├── utilities_unittest.cpp │ └── version.h ├── compiler.gypi ├── compiler │ ├── preprocessor │ │ ├── 64bit-tokenizer-safety.patch │ │ ├── DiagnosticsBase.cpp │ │ ├── DiagnosticsBase.h │ │ ├── DirectiveHandlerBase.cpp │ │ ├── DirectiveHandlerBase.h │ │ ├── DirectiveParser.cpp │ │ ├── DirectiveParser.h │ │ ├── ExpressionParser.cpp │ │ ├── ExpressionParser.h │ │ ├── ExpressionParser.y │ │ ├── Input.cpp │ │ ├── Input.h │ │ ├── Lexer.cpp │ │ ├── Lexer.h │ │ ├── Macro.cpp │ │ ├── Macro.h │ │ ├── MacroExpander.cpp │ │ ├── MacroExpander.h │ │ ├── Preprocessor.cpp │ │ ├── Preprocessor.h │ │ ├── SourceLocation.h │ │ ├── Token.cpp │ │ ├── Token.h │ │ ├── Tokenizer.cpp │ │ ├── Tokenizer.h │ │ ├── Tokenizer.l │ │ ├── generate_parser.sh │ │ ├── numeric_lex.h │ │ └── pp_utils.h │ └── translator │ │ ├── 64bit-lexer-safety.patch │ │ ├── ASTMetadataHLSL.cpp │ │ ├── ASTMetadataHLSL.h │ │ ├── ArrayReturnValueToOutParameter.cpp │ │ ├── ArrayReturnValueToOutParameter.h │ │ ├── BaseTypes.h │ │ ├── BuiltInFunctionEmulator.cpp │ │ ├── BuiltInFunctionEmulator.h │ │ ├── BuiltInFunctionEmulatorGLSL.cpp │ │ ├── BuiltInFunctionEmulatorGLSL.h │ │ ├── BuiltInFunctionEmulatorHLSL.cpp │ │ ├── BuiltInFunctionEmulatorHLSL.h │ │ ├── Cache.cpp │ │ ├── Cache.h │ │ ├── CallDAG.cpp │ │ ├── CallDAG.h │ │ ├── CodeGen.cpp │ │ ├── Common.h │ │ ├── Compiler.cpp │ │ ├── Compiler.h │ │ ├── ConstantUnion.h │ │ ├── Diagnostics.cpp │ │ ├── Diagnostics.h │ │ ├── DirectiveHandler.cpp │ │ ├── DirectiveHandler.h │ │ ├── EmulatePrecision.cpp │ │ ├── EmulatePrecision.h │ │ ├── ExtensionBehavior.h │ │ ├── ExtensionGLSL.cpp │ │ ├── ExtensionGLSL.h │ │ ├── FlagStd140Structs.cpp │ │ ├── FlagStd140Structs.h │ │ ├── ForLoopUnroll.cpp │ │ ├── ForLoopUnroll.h │ │ ├── HashNames.h │ │ ├── InfoSink.cpp │ │ ├── InfoSink.h │ │ ├── Initialize.cpp │ │ ├── Initialize.h │ │ ├── InitializeDll.cpp │ │ ├── InitializeDll.h │ │ ├── InitializeGlobals.h │ │ ├── InitializeParseContext.cpp │ │ ├── InitializeParseContext.h │ │ ├── InitializeVariables.cpp │ │ ├── InitializeVariables.h │ │ ├── IntermNode.cpp │ │ ├── IntermNode.h │ │ ├── IntermTraverse.cpp │ │ ├── Intermediate.cpp │ │ ├── Intermediate.h │ │ ├── LoopInfo.cpp │ │ ├── LoopInfo.h │ │ ├── MMap.h │ │ ├── NodeSearch.h │ │ ├── Operator.cpp │ │ ├── Operator.h │ │ ├── OutputESSL.cpp │ │ ├── OutputESSL.h │ │ ├── OutputGLSL.cpp │ │ ├── OutputGLSL.h │ │ ├── OutputGLSLBase.cpp │ │ ├── OutputGLSLBase.h │ │ ├── OutputHLSL.cpp │ │ ├── OutputHLSL.h │ │ ├── ParseContext.cpp │ │ ├── ParseContext.h │ │ ├── PoolAlloc.cpp │ │ ├── PoolAlloc.h │ │ ├── Pragma.h │ │ ├── PruneEmptyDeclarations.cpp │ │ ├── PruneEmptyDeclarations.h │ │ ├── RecordConstantPrecision.cpp │ │ ├── RecordConstantPrecision.h │ │ ├── RegenerateStructNames.cpp │ │ ├── RegenerateStructNames.h │ │ ├── RemoveDynamicIndexing.cpp │ │ ├── RemoveDynamicIndexing.h │ │ ├── RemovePow.cpp │ │ ├── RemovePow.h │ │ ├── RemoveSwitchFallThrough.cpp │ │ ├── RemoveSwitchFallThrough.h │ │ ├── RenameFunction.h │ │ ├── RewriteDoWhile.cpp │ │ ├── RewriteDoWhile.h │ │ ├── RewriteElseBlocks.cpp │ │ ├── RewriteElseBlocks.h │ │ ├── ScalarizeVecAndMatConstructorArgs.cpp │ │ ├── ScalarizeVecAndMatConstructorArgs.h │ │ ├── SearchSymbol.cpp │ │ ├── SearchSymbol.h │ │ ├── SeparateArrayInitialization.cpp │ │ ├── SeparateArrayInitialization.h │ │ ├── SeparateDeclarations.cpp │ │ ├── SeparateDeclarations.h │ │ ├── SeparateExpressionsReturningArrays.cpp │ │ ├── SeparateExpressionsReturningArrays.h │ │ ├── ShaderLang.cpp │ │ ├── ShaderVars.cpp │ │ ├── StructureHLSL.cpp │ │ ├── StructureHLSL.h │ │ ├── SymbolTable.cpp │ │ ├── SymbolTable.h │ │ ├── TranslatorESSL.cpp │ │ ├── TranslatorESSL.h │ │ ├── TranslatorGLSL.cpp │ │ ├── TranslatorGLSL.h │ │ ├── TranslatorHLSL.cpp │ │ ├── TranslatorHLSL.h │ │ ├── Types.cpp │ │ ├── Types.h │ │ ├── UnfoldShortCircuitAST.cpp │ │ ├── UnfoldShortCircuitAST.h │ │ ├── UnfoldShortCircuitToIf.cpp │ │ ├── UnfoldShortCircuitToIf.h │ │ ├── UniformHLSL.cpp │ │ ├── UniformHLSL.h │ │ ├── UtilsHLSL.cpp │ │ ├── UtilsHLSL.h │ │ ├── ValidateGlobalInitializer.cpp │ │ ├── ValidateGlobalInitializer.h │ │ ├── ValidateLimitations.cpp │ │ ├── ValidateLimitations.h │ │ ├── ValidateMaxParameters.cpp │ │ ├── ValidateMaxParameters.h │ │ ├── ValidateOutputs.cpp │ │ ├── ValidateOutputs.h │ │ ├── ValidateSwitch.cpp │ │ ├── ValidateSwitch.h │ │ ├── VariableInfo.cpp │ │ ├── VariableInfo.h │ │ ├── VariablePacker.cpp │ │ ├── VariablePacker.h │ │ ├── VersionGLSL.cpp │ │ ├── VersionGLSL.h │ │ ├── blocklayout.cpp │ │ ├── blocklayout.h │ │ ├── blocklayoutHLSL.cpp │ │ ├── blocklayoutHLSL.h │ │ ├── depgraph │ │ ├── DependencyGraph.cpp │ │ ├── DependencyGraph.h │ │ ├── DependencyGraphBuilder.cpp │ │ ├── DependencyGraphBuilder.h │ │ ├── DependencyGraphOutput.cpp │ │ ├── DependencyGraphOutput.h │ │ └── DependencyGraphTraverse.cpp │ │ ├── generate_parser.sh │ │ ├── glslang.h │ │ ├── glslang.l │ │ ├── glslang.y │ │ ├── glslang_lex.cpp │ │ ├── glslang_tab.cpp │ │ ├── glslang_tab.h │ │ ├── intermOut.cpp │ │ ├── length_limits.h │ │ ├── timing │ │ ├── RestrictFragmentShaderTiming.cpp │ │ ├── RestrictFragmentShaderTiming.h │ │ ├── RestrictVertexShaderTiming.cpp │ │ └── RestrictVertexShaderTiming.h │ │ ├── util.cpp │ │ └── util.h ├── copy_compiler_dll.bat ├── libANGLE │ ├── AttributeMap.cpp │ ├── AttributeMap.h │ ├── BinaryStream.h │ ├── BinaryStream_unittest.cpp │ ├── Buffer.cpp │ ├── Buffer.h │ ├── Caps.cpp │ ├── Caps.h │ ├── Compiler.cpp │ ├── Compiler.h │ ├── Config.cpp │ ├── Config.h │ ├── Config_unittest.cpp │ ├── Constants.h │ ├── Context.cpp │ ├── Context.h │ ├── Data.cpp │ ├── Data.h │ ├── Debug.cpp │ ├── Debug.h │ ├── Device.cpp │ ├── Device.h │ ├── Display.cpp │ ├── Display.h │ ├── Error.cpp │ ├── Error.h │ ├── Error.inl │ ├── Fence.cpp │ ├── Fence.h │ ├── Fence_unittest.cpp │ ├── Framebuffer.cpp │ ├── Framebuffer.h │ ├── FramebufferAttachment.cpp │ ├── FramebufferAttachment.h │ ├── HandleAllocator.cpp │ ├── HandleAllocator.h │ ├── HandleAllocator_unittest.cpp │ ├── Image.cpp │ ├── Image.h │ ├── ImageIndex.cpp │ ├── ImageIndex.h │ ├── ImageIndexIterator_unittest.cpp │ ├── Image_unittest.cpp │ ├── IndexRangeCache.cpp │ ├── IndexRangeCache.h │ ├── Platform.cpp │ ├── Program.cpp │ ├── Program.h │ ├── Program_unittest.cpp │ ├── Query.cpp │ ├── Query.h │ ├── RefCountObject.h │ ├── Renderbuffer.cpp │ ├── Renderbuffer.h │ ├── ResourceManager.cpp │ ├── ResourceManager.h │ ├── ResourceManager_unittest.cpp │ ├── Sampler.cpp │ ├── Sampler.h │ ├── Shader.cpp │ ├── Shader.h │ ├── State.cpp │ ├── State.h │ ├── Stream.cpp │ ├── Stream.h │ ├── Surface.cpp │ ├── Surface.h │ ├── Surface_unittest.cpp │ ├── Texture.cpp │ ├── Texture.h │ ├── TransformFeedback.cpp │ ├── TransformFeedback.h │ ├── TransformFeedback_unittest.cpp │ ├── Uniform.cpp │ ├── Uniform.h │ ├── Version.h │ ├── Version.inl │ ├── VertexArray.cpp │ ├── VertexArray.h │ ├── VertexAttribute.cpp │ ├── VertexAttribute.h │ ├── VertexAttribute.inl │ ├── angletypes.cpp │ ├── angletypes.h │ ├── angletypes.inl │ ├── features.h │ ├── formatutils.cpp │ ├── formatutils.h │ ├── histogram_macros.h │ ├── queryconversions.cpp │ ├── queryconversions.h │ ├── renderer │ │ ├── BufferImpl.h │ │ ├── BufferImpl_mock.h │ │ ├── CompilerImpl.h │ │ ├── DeviceImpl.cpp │ │ ├── DeviceImpl.h │ │ ├── DisplayImpl.cpp │ │ ├── DisplayImpl.h │ │ ├── FenceNVImpl.h │ │ ├── FenceSyncImpl.h │ │ ├── FramebufferImpl.h │ │ ├── FramebufferImpl_mock.h │ │ ├── ImageImpl.h │ │ ├── ImageImpl_mock.h │ │ ├── ImplFactory.h │ │ ├── ProgramImpl.h │ │ ├── ProgramImpl_mock.h │ │ ├── QueryImpl.h │ │ ├── RenderbufferImpl.h │ │ ├── RenderbufferImpl_mock.h │ │ ├── Renderer.cpp │ │ ├── Renderer.h │ │ ├── SamplerImpl.h │ │ ├── ShaderImpl.h │ │ ├── StreamImpl.h │ │ ├── SurfaceImpl.cpp │ │ ├── SurfaceImpl.h │ │ ├── TextureImpl.h │ │ ├── TextureImpl_mock.h │ │ ├── TransformFeedbackImpl.h │ │ ├── TransformFeedbackImpl_mock.h │ │ ├── VertexArrayImpl.h │ │ ├── d3d │ │ │ ├── BufferD3D.cpp │ │ │ ├── BufferD3D.h │ │ │ ├── CompilerD3D.cpp │ │ │ ├── CompilerD3D.h │ │ │ ├── DeviceD3D.cpp │ │ │ ├── DeviceD3D.h │ │ │ ├── DisplayD3D.cpp │ │ │ ├── DisplayD3D.h │ │ │ ├── DynamicHLSL.cpp │ │ │ ├── DynamicHLSL.h │ │ │ ├── EGLImageD3D.cpp │ │ │ ├── EGLImageD3D.h │ │ │ ├── FramebufferD3D.cpp │ │ │ ├── FramebufferD3D.h │ │ │ ├── HLSLCompiler.cpp │ │ │ ├── HLSLCompiler.h │ │ │ ├── ImageD3D.cpp │ │ │ ├── ImageD3D.h │ │ │ ├── IndexBuffer.cpp │ │ │ ├── IndexBuffer.h │ │ │ ├── IndexDataManager.cpp │ │ │ ├── IndexDataManager.h │ │ │ ├── ProgramD3D.cpp │ │ │ ├── ProgramD3D.h │ │ │ ├── RenderTargetD3D.cpp │ │ │ ├── RenderTargetD3D.h │ │ │ ├── RenderbufferD3D.cpp │ │ │ ├── RenderbufferD3D.h │ │ │ ├── RendererD3D.cpp │ │ │ ├── RendererD3D.h │ │ │ ├── SamplerD3D.h │ │ │ ├── ShaderD3D.cpp │ │ │ ├── ShaderD3D.h │ │ │ ├── ShaderExecutableD3D.cpp │ │ │ ├── ShaderExecutableD3D.h │ │ │ ├── SurfaceD3D.cpp │ │ │ ├── SurfaceD3D.h │ │ │ ├── SwapChainD3D.h │ │ │ ├── TextureD3D.cpp │ │ │ ├── TextureD3D.h │ │ │ ├── TextureStorage.h │ │ │ ├── TransformFeedbackD3D.cpp │ │ │ ├── TransformFeedbackD3D.h │ │ │ ├── VaryingPacking.cpp │ │ │ ├── VaryingPacking.h │ │ │ ├── VertexBuffer.cpp │ │ │ ├── VertexBuffer.h │ │ │ ├── VertexDataManager.cpp │ │ │ ├── VertexDataManager.h │ │ │ ├── WorkaroundsD3D.h │ │ │ ├── copyimage.cpp │ │ │ ├── copyimage.h │ │ │ ├── copyimage.inl │ │ │ ├── d3d11 │ │ │ │ ├── Blit11.cpp │ │ │ │ ├── Blit11.h │ │ │ │ ├── Buffer11.cpp │ │ │ │ ├── Buffer11.h │ │ │ │ ├── Clear11.cpp │ │ │ │ ├── Clear11.h │ │ │ │ ├── DebugAnnotator11.cpp │ │ │ │ ├── DebugAnnotator11.h │ │ │ │ ├── Fence11.cpp │ │ │ │ ├── Fence11.h │ │ │ │ ├── Framebuffer11.cpp │ │ │ │ ├── Framebuffer11.h │ │ │ │ ├── Image11.cpp │ │ │ │ ├── Image11.h │ │ │ │ ├── IndexBuffer11.cpp │ │ │ │ ├── IndexBuffer11.h │ │ │ │ ├── InputLayoutCache.cpp │ │ │ │ ├── InputLayoutCache.h │ │ │ │ ├── NativeWindow.h │ │ │ │ ├── PixelTransfer11.cpp │ │ │ │ ├── PixelTransfer11.h │ │ │ │ ├── Query11.cpp │ │ │ │ ├── Query11.h │ │ │ │ ├── RenderStateCache.cpp │ │ │ │ ├── RenderStateCache.h │ │ │ │ ├── RenderTarget11.cpp │ │ │ │ ├── RenderTarget11.h │ │ │ │ ├── Renderer11.cpp │ │ │ │ ├── Renderer11.h │ │ │ │ ├── ShaderExecutable11.cpp │ │ │ │ ├── ShaderExecutable11.h │ │ │ │ ├── StateManager11.cpp │ │ │ │ ├── StateManager11.h │ │ │ │ ├── Stream11.cpp │ │ │ │ ├── Stream11.h │ │ │ │ ├── SwapChain11.cpp │ │ │ │ ├── SwapChain11.h │ │ │ │ ├── TextureStorage11.cpp │ │ │ │ ├── TextureStorage11.h │ │ │ │ ├── Trim11.cpp │ │ │ │ ├── Trim11.h │ │ │ │ ├── VertexArray11.cpp │ │ │ │ ├── VertexArray11.h │ │ │ │ ├── VertexBuffer11.cpp │ │ │ │ ├── VertexBuffer11.h │ │ │ │ ├── copyvertex.h │ │ │ │ ├── copyvertex.inl │ │ │ │ ├── dxgi_support_data.json │ │ │ │ ├── dxgi_support_table.cpp │ │ │ │ ├── dxgi_support_table.h │ │ │ │ ├── formatutils11.cpp │ │ │ │ ├── formatutils11.h │ │ │ │ ├── gen_dxgi_support_tables.py │ │ │ │ ├── gen_load_functions_table.py │ │ │ │ ├── gen_texture_format_table.py │ │ │ │ ├── load_functions_data.json │ │ │ │ ├── load_functions_table.h │ │ │ │ ├── load_functions_table_autogen.cpp │ │ │ │ ├── renderer11_utils.cpp │ │ │ │ ├── renderer11_utils.h │ │ │ │ ├── shaders │ │ │ │ │ ├── BufferToTexture11.hlsl │ │ │ │ │ ├── Clear11.hlsl │ │ │ │ │ ├── Passthrough2D11.hlsl │ │ │ │ │ ├── Passthrough3D11.hlsl │ │ │ │ │ ├── Swizzle11.hlsl │ │ │ │ │ ├── compiled │ │ │ │ │ │ ├── buffertotexture11_gs.h │ │ │ │ │ │ ├── buffertotexture11_ps_4f.h │ │ │ │ │ │ ├── buffertotexture11_ps_4i.h │ │ │ │ │ │ ├── buffertotexture11_ps_4ui.h │ │ │ │ │ │ ├── buffertotexture11_vs.h │ │ │ │ │ │ ├── clearfloat11_fl9ps.h │ │ │ │ │ │ ├── clearfloat11ps.h │ │ │ │ │ │ ├── clearfloat11vs.h │ │ │ │ │ │ ├── clearsint11ps.h │ │ │ │ │ │ ├── clearsint11vs.h │ │ │ │ │ │ ├── clearuint11ps.h │ │ │ │ │ │ ├── clearuint11vs.h │ │ │ │ │ │ ├── passthrough2d11vs.h │ │ │ │ │ │ ├── passthrough3d11gs.h │ │ │ │ │ │ ├── passthrough3d11vs.h │ │ │ │ │ │ ├── passthroughdepth2d11ps.h │ │ │ │ │ │ ├── passthroughlum2d11ps.h │ │ │ │ │ │ ├── passthroughlum3d11ps.h │ │ │ │ │ │ ├── passthroughlumalpha2d11ps.h │ │ │ │ │ │ ├── passthroughlumalpha3d11ps.h │ │ │ │ │ │ ├── passthroughr2d11ps.h │ │ │ │ │ │ ├── passthroughr2di11ps.h │ │ │ │ │ │ ├── passthroughr2dui11ps.h │ │ │ │ │ │ ├── passthroughr3d11ps.h │ │ │ │ │ │ ├── passthroughr3di11ps.h │ │ │ │ │ │ ├── passthroughr3dui11ps.h │ │ │ │ │ │ ├── passthroughrg2d11ps.h │ │ │ │ │ │ ├── passthroughrg2di11ps.h │ │ │ │ │ │ ├── passthroughrg2dui11ps.h │ │ │ │ │ │ ├── passthroughrg3d11ps.h │ │ │ │ │ │ ├── passthroughrg3di11ps.h │ │ │ │ │ │ ├── passthroughrg3dui11ps.h │ │ │ │ │ │ ├── passthroughrgb2d11ps.h │ │ │ │ │ │ ├── passthroughrgb2di11ps.h │ │ │ │ │ │ ├── passthroughrgb2dui11ps.h │ │ │ │ │ │ ├── passthroughrgb3d11ps.h │ │ │ │ │ │ ├── passthroughrgb3di11ps.h │ │ │ │ │ │ ├── passthroughrgb3dui11ps.h │ │ │ │ │ │ ├── passthroughrgba2d11ps.h │ │ │ │ │ │ ├── passthroughrgba2di11ps.h │ │ │ │ │ │ ├── passthroughrgba2dui11ps.h │ │ │ │ │ │ ├── passthroughrgba3d11ps.h │ │ │ │ │ │ ├── passthroughrgba3di11ps.h │ │ │ │ │ │ ├── passthroughrgba3dui11ps.h │ │ │ │ │ │ ├── swizzlef2darrayps.h │ │ │ │ │ │ ├── swizzlef2dps.h │ │ │ │ │ │ ├── swizzlef3dps.h │ │ │ │ │ │ ├── swizzlei2darrayps.h │ │ │ │ │ │ ├── swizzlei2dps.h │ │ │ │ │ │ ├── swizzlei3dps.h │ │ │ │ │ │ ├── swizzleui2darrayps.h │ │ │ │ │ │ ├── swizzleui2dps.h │ │ │ │ │ │ └── swizzleui3dps.h │ │ │ │ │ └── generate_shaders.bat │ │ │ │ ├── texture_format_data.json │ │ │ │ ├── texture_format_map.json │ │ │ │ ├── texture_format_table.h │ │ │ │ ├── texture_format_table_autogen.cpp │ │ │ │ ├── texture_format_table_autogen.h │ │ │ │ ├── win32 │ │ │ │ │ └── NativeWindow.cpp │ │ │ │ └── winrt │ │ │ │ │ ├── CoreWindowNativeWindow.cpp │ │ │ │ │ ├── CoreWindowNativeWindow.h │ │ │ │ │ ├── CoreWindowNativeWindow_unittest.cpp │ │ │ │ │ ├── InspectableNativeWindow.cpp │ │ │ │ │ ├── InspectableNativeWindow.h │ │ │ │ │ ├── SwapChainPanelNativeWindow.cpp │ │ │ │ │ ├── SwapChainPanelNativeWindow.h │ │ │ │ │ └── SwapChainPanelNativeWindow_unittest.cpp │ │ │ ├── d3d9 │ │ │ │ ├── Blit9.cpp │ │ │ │ ├── Blit9.h │ │ │ │ ├── Buffer9.cpp │ │ │ │ ├── Buffer9.h │ │ │ │ ├── DebugAnnotator9.cpp │ │ │ │ ├── DebugAnnotator9.h │ │ │ │ ├── Fence9.cpp │ │ │ │ ├── Fence9.h │ │ │ │ ├── Framebuffer9.cpp │ │ │ │ ├── Framebuffer9.h │ │ │ │ ├── Image9.cpp │ │ │ │ ├── Image9.h │ │ │ │ ├── IndexBuffer9.cpp │ │ │ │ ├── IndexBuffer9.h │ │ │ │ ├── Query9.cpp │ │ │ │ ├── Query9.h │ │ │ │ ├── RenderTarget9.cpp │ │ │ │ ├── RenderTarget9.h │ │ │ │ ├── Renderer9.cpp │ │ │ │ ├── Renderer9.h │ │ │ │ ├── ShaderCache.h │ │ │ │ ├── ShaderExecutable9.cpp │ │ │ │ ├── ShaderExecutable9.h │ │ │ │ ├── StateManager9.cpp │ │ │ │ ├── StateManager9.h │ │ │ │ ├── SwapChain9.cpp │ │ │ │ ├── SwapChain9.h │ │ │ │ ├── TextureStorage9.cpp │ │ │ │ ├── TextureStorage9.h │ │ │ │ ├── VertexArray9.h │ │ │ │ ├── VertexBuffer9.cpp │ │ │ │ ├── VertexBuffer9.h │ │ │ │ ├── VertexDeclarationCache.cpp │ │ │ │ ├── VertexDeclarationCache.h │ │ │ │ ├── formatutils9.cpp │ │ │ │ ├── formatutils9.h │ │ │ │ ├── renderer9_utils.cpp │ │ │ │ ├── renderer9_utils.h │ │ │ │ ├── shaders │ │ │ │ │ ├── Blit.ps │ │ │ │ │ ├── Blit.vs │ │ │ │ │ ├── compiled │ │ │ │ │ │ ├── componentmaskps.h │ │ │ │ │ │ ├── flipyvs.h │ │ │ │ │ │ ├── luminanceps.h │ │ │ │ │ │ ├── passthroughps.h │ │ │ │ │ │ └── standardvs.h │ │ │ │ │ └── generate_shaders.bat │ │ │ │ └── vertexconversion.h │ │ │ ├── formatutilsD3D.cpp │ │ │ ├── formatutilsD3D.h │ │ │ ├── generatemip.h │ │ │ ├── generatemip.inl │ │ │ ├── imageformats.h │ │ │ ├── loadimage.cpp │ │ │ ├── loadimage.h │ │ │ ├── loadimage.inl │ │ │ ├── loadimageSSE2.cpp │ │ │ ├── loadimage_etc.cpp │ │ │ └── loadimage_etc.h │ │ ├── generate_new_renderer.py │ │ └── gl │ │ │ ├── BlitGL.cpp │ │ │ ├── BlitGL.h │ │ │ ├── BufferGL.cpp │ │ │ ├── BufferGL.h │ │ │ ├── CompilerGL.cpp │ │ │ ├── CompilerGL.h │ │ │ ├── DisplayGL.cpp │ │ │ ├── DisplayGL.h │ │ │ ├── FeatureSupportGL.md │ │ │ ├── FenceNVGL.cpp │ │ │ ├── FenceNVGL.h │ │ │ ├── FenceSyncGL.cpp │ │ │ ├── FenceSyncGL.h │ │ │ ├── FramebufferGL.cpp │ │ │ ├── FramebufferGL.h │ │ │ ├── FunctionsGL.cpp │ │ │ ├── FunctionsGL.h │ │ │ ├── ProgramGL.cpp │ │ │ ├── ProgramGL.h │ │ │ ├── QueryGL.cpp │ │ │ ├── QueryGL.h │ │ │ ├── RenderbufferGL.cpp │ │ │ ├── RenderbufferGL.h │ │ │ ├── RendererGL.cpp │ │ │ ├── RendererGL.h │ │ │ ├── SamplerGL.cpp │ │ │ ├── SamplerGL.h │ │ │ ├── ShaderGL.cpp │ │ │ ├── ShaderGL.h │ │ │ ├── StateManagerGL.cpp │ │ │ ├── StateManagerGL.h │ │ │ ├── SurfaceGL.cpp │ │ │ ├── SurfaceGL.h │ │ │ ├── TextureGL.cpp │ │ │ ├── TextureGL.h │ │ │ ├── TransformFeedbackGL.cpp │ │ │ ├── TransformFeedbackGL.h │ │ │ ├── VertexArrayGL.cpp │ │ │ ├── VertexArrayGL.h │ │ │ ├── WorkaroundsGL.h │ │ │ ├── cgl │ │ │ ├── DisplayCGL.h │ │ │ ├── DisplayCGL.mm │ │ │ ├── PbufferSurfaceCGL.h │ │ │ ├── PbufferSurfaceCGL.mm │ │ │ ├── WindowSurfaceCGL.h │ │ │ └── WindowSurfaceCGL.mm │ │ │ ├── formatutilsgl.cpp │ │ │ ├── formatutilsgl.h │ │ │ ├── functionsgl_enums.h │ │ │ ├── functionsgl_typedefs.h │ │ │ ├── glx │ │ │ ├── DisplayGLX.cpp │ │ │ ├── DisplayGLX.h │ │ │ ├── FBConfigCompatibility.md │ │ │ ├── FunctionsGLX.cpp │ │ │ ├── FunctionsGLX.h │ │ │ ├── PbufferSurfaceGLX.cpp │ │ │ ├── PbufferSurfaceGLX.h │ │ │ ├── SurfaceGLX.h │ │ │ ├── WindowSurfaceGLX.cpp │ │ │ ├── WindowSurfaceGLX.h │ │ │ ├── functionsglx_typedefs.h │ │ │ └── platform_glx.h │ │ │ ├── renderergl_utils.cpp │ │ │ ├── renderergl_utils.h │ │ │ └── wgl │ │ │ ├── DXGISwapChainWindowSurfaceWGL.cpp │ │ │ ├── DXGISwapChainWindowSurfaceWGL.h │ │ │ ├── DisplayWGL.cpp │ │ │ ├── DisplayWGL.h │ │ │ ├── FunctionsWGL.cpp │ │ │ ├── FunctionsWGL.h │ │ │ ├── PbufferSurfaceWGL.cpp │ │ │ ├── PbufferSurfaceWGL.h │ │ │ ├── WindowSurfaceWGL.cpp │ │ │ ├── WindowSurfaceWGL.h │ │ │ ├── functionswgl_typedefs.h │ │ │ ├── wgl_utils.cpp │ │ │ └── wgl_utils.h │ ├── validationEGL.cpp │ ├── validationEGL.h │ ├── validationES.cpp │ ├── validationES.h │ ├── validationES2.cpp │ ├── validationES2.h │ ├── validationES3.cpp │ ├── validationES3.h │ └── validationES_unittest.cpp ├── libEGL.gypi ├── libEGL │ ├── libEGL.cpp │ ├── libEGL.def │ ├── libEGL.rc │ └── resource.h ├── libGLESv2.gypi ├── libGLESv2 │ ├── entry_points_egl.cpp │ ├── entry_points_egl.h │ ├── entry_points_egl_ext.cpp │ ├── entry_points_egl_ext.h │ ├── entry_points_gles_2_0.cpp │ ├── entry_points_gles_2_0.h │ ├── entry_points_gles_2_0_ext.cpp │ ├── entry_points_gles_2_0_ext.h │ ├── entry_points_gles_3_0.cpp │ ├── entry_points_gles_3_0.h │ ├── global_state.cpp │ ├── global_state.h │ ├── libGLESv2.cpp │ ├── libGLESv2.def │ ├── libGLESv2.rc │ └── resource.h ├── tests │ ├── BUILD.gn │ ├── WebGL-CTS-known-failures.txt │ ├── angle_end2end_tests.gypi │ ├── angle_end2end_tests_main.cpp │ ├── angle_perftests.gypi │ ├── angle_perftests_main.cpp │ ├── angle_unittests.gypi │ ├── angle_unittests_main.cpp │ ├── angle_unittests_utils.h │ ├── compiler_tests │ │ ├── API_test.cpp │ │ ├── BuiltInFunctionEmulator_test.cpp │ │ ├── CollectVariables_test.cpp │ │ ├── ConstantFolding_test.cpp │ │ ├── DebugShaderPrecision_test.cpp │ │ ├── EXT_blend_func_extended_test.cpp │ │ ├── ExpressionLimit_test.cpp │ │ ├── FragDepth_test.cpp │ │ ├── GLSLCompatibilityOutput_test.cpp │ │ ├── IntermNode_test.cpp │ │ ├── MalformedShader_test.cpp │ │ ├── NV_draw_buffers_test.cpp │ │ ├── Pack_Unpack_test.cpp │ │ ├── PruneUnusedFunctions_test.cpp │ │ ├── RecordConstantPrecision_test.cpp │ │ ├── RemovePow_test.cpp │ │ ├── ShCompile_test.cpp │ │ ├── ShaderExtension_test.cpp │ │ ├── ShaderVariable_test.cpp │ │ ├── TypeTracking_test.cpp │ │ ├── UnrollFlatten_test.cpp │ │ └── VariablePacker_test.cpp │ ├── deqp.gypi │ ├── deqp_support │ │ ├── angle_deqp_gtest.cpp │ │ ├── angle_deqp_gtest_main.cpp │ │ ├── angle_deqp_libtester.h │ │ ├── angle_deqp_libtester_main.cpp │ │ ├── angle_deqp_tests_main.cpp │ │ ├── deqp_egl_test_expectations.txt │ │ ├── deqp_gles2_test_expectations.txt │ │ ├── deqp_gles3_test_expectations.txt │ │ ├── tcuANGLENativeDisplayFactory.cpp │ │ ├── tcuANGLENativeDisplayFactory.h │ │ ├── tcuANGLEPlatform.cpp │ │ ├── tcuANGLEPlatform.h │ │ ├── tcuRandomOrderExecutor.cpp │ │ └── tcuRandomOrderExecutor.h │ ├── egl_tests │ │ ├── EGLContextCompatibilityTest.cpp │ │ ├── EGLDeviceTest.cpp │ │ ├── EGLPresentPathD3D11Test.cpp │ │ ├── EGLQueryContextTest.cpp │ │ ├── EGLSanityCheckTest.cpp │ │ ├── EGLStreamTest.cpp │ │ ├── EGLSurfaceTest.cpp │ │ ├── EGLThreadTest.cpp │ │ └── EGLX11VisualTest.cpp │ ├── gl_tests │ │ ├── BlendMinMaxTest.cpp │ │ ├── BlitFramebufferANGLETest.cpp │ │ ├── BufferDataTest.cpp │ │ ├── ClearTest.cpp │ │ ├── CompressedTextureTest.cpp │ │ ├── CopyTexImageTest.cpp │ │ ├── CubeMapTextureTest.cpp │ │ ├── D3D11EmulatedIndexedBufferTest.cpp │ │ ├── D3D11FormatTablesTest.cpp │ │ ├── D3D11InputLayoutCacheTest.cpp │ │ ├── D3DImageFormatConversionTest.cpp │ │ ├── DebugMarkerTest.cpp │ │ ├── DebugTest.cpp │ │ ├── DepthStencilFormatsTest.cpp │ │ ├── DifferentStencilMasksTest.cpp │ │ ├── DiscardFramebufferEXTTest.cpp │ │ ├── DrawBuffersTest.cpp │ │ ├── DrawElementsTest.cpp │ │ ├── ETCTextureTest.cpp │ │ ├── FenceSyncTests.cpp │ │ ├── FramebufferRenderMipmapTest.cpp │ │ ├── FramebufferTest.cpp │ │ ├── GLSLTest.cpp │ │ ├── ImageTest.cpp │ │ ├── IncompleteTextureTest.cpp │ │ ├── IndexBufferOffsetTest.cpp │ │ ├── IndexedPointsTest.cpp │ │ ├── InstancingTest.cpp │ │ ├── LineLoopTest.cpp │ │ ├── MaxTextureSizeTest.cpp │ │ ├── MipmapTest.cpp │ │ ├── ObjectAllocationTest.cpp │ │ ├── OcclusionQueriesTest.cpp │ │ ├── PBOExtensionTest.cpp │ │ ├── PackUnpackTest.cpp │ │ ├── PbufferTest.cpp │ │ ├── PointSpritesTest.cpp │ │ ├── ProgramBinaryTest.cpp │ │ ├── ProvokingVertexTest.cpp │ │ ├── ReadPixelsTest.cpp │ │ ├── RendererTest.cpp │ │ ├── SRGBTextureTest.cpp │ │ ├── SimpleOperationTest.cpp │ │ ├── SixteenBppTextureTest.cpp │ │ ├── StateChangeTest.cpp │ │ ├── SwizzleTest.cpp │ │ ├── TextureTest.cpp │ │ ├── TimerQueriesTest.cpp │ │ ├── TransformFeedbackTest.cpp │ │ ├── UniformBufferTest.cpp │ │ ├── UniformTest.cpp │ │ ├── UnpackAlignmentTest.cpp │ │ ├── UnpackRowLength.cpp │ │ ├── VertexAttributeTest.cpp │ │ ├── ViewportTest.cpp │ │ └── media │ │ │ └── pixel.inl │ ├── gles_conformance_tests │ │ ├── generate_gles_conformance_tests.py │ │ ├── gles_conformance_tests.cpp │ │ ├── gles_conformance_tests.h │ │ └── gles_conformance_tests_main.cpp │ ├── perf_tests │ │ ├── ANGLEPerfTest.cpp │ │ ├── ANGLEPerfTest.h │ │ ├── BufferSubData.cpp │ │ ├── DrawCallPerf.cpp │ │ ├── DynamicPromotionPerfTest.cpp │ │ ├── EGLInitializePerf.cpp │ │ ├── IndexConversionPerf.cpp │ │ ├── IndexDataManagerTest.cpp │ │ ├── InstancingPerf.cpp │ │ ├── InterleavedAttributeData.cpp │ │ ├── PointSprites.cpp │ │ ├── TexSubImage.cpp │ │ ├── TextureSampling.cpp │ │ └── third_party │ │ │ └── perf │ │ │ ├── angle-mods.patch │ │ │ ├── perf_test.cc │ │ │ └── perf_test.h │ ├── preprocessor_tests │ │ ├── MockDiagnostics.h │ │ ├── MockDirectiveHandler.h │ │ ├── PreprocessorTest.cpp │ │ ├── PreprocessorTest.h │ │ ├── char_test.cpp │ │ ├── comment_test.cpp │ │ ├── define_test.cpp │ │ ├── error_test.cpp │ │ ├── extension_test.cpp │ │ ├── identifier_test.cpp │ │ ├── if_test.cpp │ │ ├── input_test.cpp │ │ ├── location_test.cpp │ │ ├── number_test.cpp │ │ ├── operator_test.cpp │ │ ├── pragma_test.cpp │ │ ├── space_test.cpp │ │ ├── token_test.cpp │ │ └── version_test.cpp │ ├── test_utils │ │ ├── ANGLETest.cpp │ │ ├── ANGLETest.h │ │ ├── angle_test_configs.cpp │ │ ├── angle_test_configs.h │ │ ├── angle_test_instantiate.cpp │ │ ├── angle_test_instantiate.h │ │ ├── compiler_test.cpp │ │ └── compiler_test.h │ ├── tests.gyp │ └── third_party │ │ ├── gpu_test_expectations │ │ ├── HowToMakeChanges.md │ │ ├── angle-mods.patch │ │ ├── angle_config.h │ │ ├── gpu_info.cc │ │ ├── gpu_info.h │ │ ├── gpu_test_config.cc │ │ ├── gpu_test_config.h │ │ ├── gpu_test_config_mac.h │ │ ├── gpu_test_config_mac.mm │ │ ├── gpu_test_expectations_parser.cc │ │ └── gpu_test_expectations_parser.h │ │ └── rapidjson │ │ ├── LICENSE │ │ ├── README.chromium │ │ └── include │ │ └── rapidjson │ │ ├── allocators.h │ │ ├── document.h │ │ ├── encodedstream.h │ │ ├── encodings.h │ │ ├── error │ │ ├── en.h │ │ └── error.h │ │ ├── filereadstream.h │ │ ├── filestream.h │ │ ├── filewritestream.h │ │ ├── internal │ │ ├── biginteger.h │ │ ├── diyfp.h │ │ ├── dtoa.h │ │ ├── ieee754.h │ │ ├── itoa.h │ │ ├── meta.h │ │ ├── pow10.h │ │ ├── stack.h │ │ ├── strfunc.h │ │ └── strtod.h │ │ ├── memorybuffer.h │ │ ├── memorystream.h │ │ ├── msinttypes │ │ ├── inttypes.h │ │ └── stdint.h │ │ ├── prettywriter.h │ │ ├── rapidjson.h │ │ ├── reader.h │ │ ├── stringbuffer.h │ │ └── writer.h └── third_party │ ├── compiler │ ├── ArrayBoundsClamper.cpp │ ├── ArrayBoundsClamper.h │ ├── LICENSE │ └── README.angle │ ├── khronos │ └── GL │ │ └── wglext.h │ ├── libXNVCtrl │ ├── BUILD.gn │ ├── LICENSE │ ├── NVCtrl.c │ ├── NVCtrl.h │ ├── NVCtrlLib.h │ ├── README.angle │ ├── libXNVCtrl.gyp │ └── nv_control.h │ ├── murmurhash │ ├── LICENSE │ ├── MurmurHash3.cpp │ └── MurmurHash3.h │ ├── systeminfo │ ├── SystemInfo.cpp │ └── SystemInfo.h │ └── trace_event │ └── trace_event.h └── util ├── EGLWindow.cpp ├── EGLWindow.h ├── Event.h ├── Matrix.cpp ├── Matrix.h ├── OSPixmap.h ├── OSWindow.cpp ├── OSWindow.h ├── Timer.h ├── Vector.cpp ├── Vector.h ├── com_utils.h ├── geometry_utils.cpp ├── geometry_utils.h ├── keyboard.h ├── linux ├── LinuxTimer.cpp ├── LinuxTimer.h └── Linux_system_utils.cpp ├── mouse.h ├── osx ├── OSXPixmap.h ├── OSXPixmap.mm ├── OSXTimer.cpp ├── OSXTimer.h ├── OSXWindow.h ├── OSXWindow.mm └── OSX_system_utils.cpp ├── posix └── Posix_system_utils.cpp ├── random_utils.cpp ├── random_utils.h ├── shader_utils.cpp ├── shader_utils.h ├── system_utils.h ├── util.gyp ├── windows ├── WindowsTimer.cpp ├── WindowsTimer.h ├── Windows_system_utils.cpp ├── win32 │ ├── Win32Pixmap.cpp │ ├── Win32Pixmap.h │ ├── Win32Window.cpp │ ├── Win32Window.h │ └── Win32_system_utils.cpp └── winrt │ ├── WinRTPixmap.cpp │ ├── WinRTWindow.cpp │ ├── WinRTWindow.h │ └── WinRT_system_utils.cpp └── x11 ├── X11Pixmap.cpp ├── X11Pixmap.h ├── X11Window.cpp └── X11Window.h /.clang-format: -------------------------------------------------------------------------------- 1 | # Defines the ANGLE style for automatic reformatting. 2 | # https://code.google.com/p/angleproject/wiki/CodingStandard 3 | # See Clang docs: http://clang.llvm.org/docs/ClangFormatStyleOptions.html 4 | BasedOnStyle: Chromium 5 | 6 | # Allow double brackets such as std::vector>. 7 | Standard: Cpp11 8 | 9 | # Indent 4 spaces at a time. 10 | IndentWidth: 4 11 | 12 | # Keep lines under 100 columns long. 13 | ColumnLimit: 100 14 | 15 | # Always break before braces 16 | BreakBeforeBraces: Allman 17 | 18 | # Indent case labels. 19 | IndentCaseLabels: true 20 | 21 | # Right-align pointers and references 22 | PointerAlignment: Right 23 | 24 | # ANGLE likes to align things as much as possible. 25 | AlignOperands: true 26 | AlignConsecutiveAssignments: true 27 | 28 | # Use 2 space negative offset for access modifiers 29 | AccessModifierOffset: -2 30 | 31 | # TODO(jmadill): Decide if we want this on. Doesn't have an "all or none" mode. 32 | AllowShortCaseLabelsOnASingleLine: false 33 | 34 | # Useful for spacing out functions in classes 35 | KeepEmptyLinesAtTheStartOfBlocks: true 36 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.sln eol=crlf 3 | *.vcxproj eol=crlf 4 | *.vcxproj.filters eol=crlf 5 | *.bat eol=crlf 6 | *.rc eol=crlf 7 | **/compiled/*.h eol=crlf 8 | *.sh eol=lf 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Debug/ 2 | Debug_Win32/ 3 | Debug_x64/ 4 | Debug_ARM/ 5 | Release/ 6 | Release_Win32/ 7 | Release_x64/ 8 | Release_ARM/ 9 | *.sdf 10 | *.ncb 11 | *.suo 12 | *.sln 13 | *.vcxproj 14 | *.vcxproj.filters 15 | *.vcxproj.user 16 | *.VC.opendb 17 | patches-* 18 | *.target.mk 19 | ipch 20 | debug.txt 21 | *.opensdf 22 | *.orig 23 | *.rej 24 | .gclient_entries 25 | /third_party 26 | /src/tests/third_party/googlemock 27 | /src/tests/third_party/googletest 28 | /third_party/libpng 29 | /third_party/zlib 30 | /third_party/deqp/src 31 | /src/tests/third_party/gles_conformance_tests 32 | out 33 | lib/* 34 | Makefile 35 | *.Makefile 36 | *~ 37 | .gclient 38 | angle_internal 39 | TestResults.qpa 40 | *.psess 41 | *.vsp 42 | *.nvuser 43 | buildtools/ 44 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | # This is the official list of The ANGLE Project Authors 2 | # for copyright purposes. 3 | # This file is distinct from the CONTRIBUTORS files. 4 | # See the latter for an explanation. 5 | 6 | # Names should be added to this file as 7 | # Name or Organization 8 | # Email addresses for individuals are tracked elsewhere to avoid spam. 9 | 10 | Google Inc. 11 | TransGaming Inc. 12 | 3DLabs Inc. Ltd. 13 | 14 | Adobe Systems Inc. 15 | Autodesk, Inc. 16 | BlackBerry Limited 17 | Cable Television Laboratories, Inc. 18 | Cloud Party, Inc. 19 | Imagination Technologies Ltd. 20 | Intel Corporation 21 | Mozilla Corporation 22 | Turbulenz 23 | Klarälvdalens Datakonsult AB 24 | Microsoft Corporation 25 | Microsoft Open Technologies, Inc. 26 | NVIDIA Corporation 27 | Opera Software ASA 28 | The Qt Company Ltd. 29 | Advanced Micro Devices, Inc. 30 | 31 | Jacek Caban 32 | Mark Callow 33 | Ginn Chen 34 | Tibor den Ouden 35 | Régis Fénéon 36 | James Hauxwell 37 | Sam Hocevar 38 | Pierre Leveille 39 | Jonathan Liu 40 | Boying Lu 41 | Aitor Moreno 42 | Yuri O'Donnell 43 | Josh Soref 44 | Maks Naumov 45 | Jinyoung Hur 46 | Sebastian Bergstein 47 | -------------------------------------------------------------------------------- /README.chromium: -------------------------------------------------------------------------------- 1 | Name: ANGLE 2 | URL: https://code.google.com/p/angleproject/ 3 | Version: 2422 4 | License: BSD 5 | License File: LICENSE 6 | 7 | Description: 8 | ANGLE is a conformant implementation of the OpenGL ES 2.0 9 | specification that is hardware‐accelerated via Direct3D. 10 | 11 | -------------------------------------------------------------------------------- /angle.isolate: -------------------------------------------------------------------------------- 1 | # Copyright 2015 The ANGLE Project Authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | # This isolate expresses the Chromium project's default runtime 6 | # dependencies. 7 | { 8 | 'conditions': [ 9 | ['OS=="win"', { 10 | 'variables': { 11 | 'files': [ 12 | '<(PRODUCT_DIR)/d3dcompiler_47.dll', 13 | '<(PRODUCT_DIR)/libEGL.dll', 14 | '<(PRODUCT_DIR)/libGLESv2.dll', 15 | ], 16 | }, 17 | }], 18 | ], 19 | } 20 | -------------------------------------------------------------------------------- /angle_on_all_platforms.isolate: -------------------------------------------------------------------------------- 1 | # Copyright 2015 The ANGLE Project Authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | # This isolate expresses ANGLE's runtime dependencies on all platforms 6 | # on which it can currently compile. 7 | { 8 | 'includes': [ 9 | 'angle.isolate', 10 | ], 11 | 'conditions': [ 12 | ['OS=="linux"', { 13 | 'variables': { 14 | 'files': [ 15 | '<(PRODUCT_DIR)/lib/libEGL.so', 16 | '<(PRODUCT_DIR)/lib/libGLESv2.so', 17 | ], 18 | }, 19 | }], 20 | ], 21 | } 22 | -------------------------------------------------------------------------------- /build/ANGLE.gyp: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2010 The ANGLE Project Authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | { 6 | 'targets': 7 | [ 8 | { 9 | 'target_name': 'All', 10 | 'type': 'none', 11 | 'dependencies': 12 | [ 13 | '../src/angle.gyp:*', 14 | '../src/tests/tests.gyp:*', 15 | ], 16 | 'conditions': 17 | [ 18 | # Don't generate samples for WinRT 19 | ['angle_build_winrt==0', 20 | { 21 | 'dependencies': 22 | [ 23 | '../samples/samples.gyp:*', 24 | ], 25 | }], 26 | ], 27 | }, 28 | ], 29 | } 30 | -------------------------------------------------------------------------------- /build/angle_common.gni: -------------------------------------------------------------------------------- 1 | # Copyright 2015 The Chromium Authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | angle_enable_d3d9 = false 6 | angle_enable_d3d11 = false 7 | angle_enable_gl = false 8 | 9 | if (is_win) { 10 | angle_enable_d3d9 = true 11 | angle_enable_d3d11 = true 12 | angle_enable_gl = true 13 | 14 | import("//build/config/win/visual_studio_version.gni") 15 | } # is_win 16 | 17 | if (is_linux) { 18 | angle_enable_gl = true 19 | } 20 | 21 | angle_enable_essl = true 22 | angle_enable_glsl = true 23 | angle_enable_hlsl = false 24 | 25 | if (angle_enable_d3d9 || angle_enable_d3d11) { 26 | angle_enable_hlsl = true 27 | } 28 | -------------------------------------------------------------------------------- /build/standalone.gypi: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | { 6 | 'variables': 7 | { 8 | # Assume for the time being that we're never compiling 9 | # standalone ANGLE on Chrome OS. 10 | 'chromeos': 0, 11 | 12 | # Chromium puts the pkg-config command in a variable because 13 | # calling pkg-config directly doesn't work in a sysroot image. 14 | # See Chromium bug 569947 for more information. 15 | # For standalone builds we don't have this problem so we use 16 | # the regular command. 17 | 'pkg-config': 'pkg-config', 18 | 19 | # Use a nested variable trick to get use_x11 evaluated more 20 | # eagerly than other conditional variables. 21 | 'variables': 22 | { 23 | 'conditions': 24 | [ 25 | ['OS=="linux"', 26 | { 27 | 'use_x11': 1, 28 | }, 29 | { 30 | 'use_x11': 0, 31 | }], 32 | ], 33 | }, 34 | 35 | # Copy conditionally-set variables out one scope. 36 | 'use_x11%': '<(use_x11)', 37 | }, 38 | } 39 | -------------------------------------------------------------------------------- /codereview.settings: -------------------------------------------------------------------------------- 1 | # This file is used by git cl to get repository specific information. 2 | CODE_REVIEW_SERVER: https://chromium-review.googlesource.com 3 | GERRIT_HOST: True 4 | TRYSERVER_GERRIT_URL: https://chromium-review.googlesource.com 5 | -------------------------------------------------------------------------------- /doc/64BitSafety.md: -------------------------------------------------------------------------------- 1 | # 64-bit Safety In the Compiler 2 | 3 | An issue that has arisen recently for contributors making changes to the GLSL ES 4 | grammar files has been that certain versions of flex, the lexer on which ANGLE 5 | relies, produce outputs which are not safe in 64-bit builds. 6 | 7 | To address this issue, ANGLE has added a step to its generation scripts to apply 8 | 64-bit safety fixes to newly regenerated outputs. This should be unnoticeable to 9 | developers invoking flex via the generate\_parser.sh scripts in the relevant 10 | compiler directories, as the fixes will be applied by the patch utility as part 11 | of that script. 12 | 13 | When making code contributions that affect the grammar files, please ensure that 14 | you've generated the outputs using the script, to make certain that the 64-bit 15 | safety fixes are applied. 16 | -------------------------------------------------------------------------------- /doc/DynamicShaderCompilation.md: -------------------------------------------------------------------------------- 1 | # About 2 | 3 | Because ANGLE can only generate full HLSL programs after we known the signatures 4 | between the vertex and pixel stages, we can not immediately call the D3D 5 | compiler at GL shader compile time. Moreover, we can insert additional 6 | optimization code right at draw-time. 7 | 8 | ESSL 1.00 shaders treat all vertex inputs as floating point. We insert a 9 | conversion routine to transform un-normalized integer vertex attributes in the 10 | shader preamble to floating point, saving CPU conversion time. 11 | 12 | At draw-time, we also optimize out any unused render target outputs. This 13 | improved draw call performance significantly on lower spec and integrated 14 | devices. Changing render target setups may trigger a shader recompile at draw 15 | time. 16 | 17 | # Addendum 18 | 19 | ANGLE is not the only program to do this kind of draw-time optimization. A 20 | common complaint from application developers is that draw calls sometimes 21 | perform very slowly due to dynamic shader re-compilation. A future design 22 | direction for ANGLE, when targeting a more modern API, is to perform the vertex 23 | conversion in a separate shader pass, which would then be linked with another 24 | compiled shader. 25 | -------------------------------------------------------------------------------- /doc/MANGLE.md: -------------------------------------------------------------------------------- 1 | # M(ulti-platform)ANGLE effort 2 | 3 | Starting in early 2014, the ANGLE team has begun work on refactoring the code 4 | with the goal of supporting translation to desktop OpenGL. The new purpose of 5 | ANGLE will be provide a consistent OpenGL ES and EGL context on as many 6 | platforms as possible. 7 | 8 | The design doc is available [here] 9 | (https://docs.google.com/document/d/17mxRfzXuEWyvGM3t2KqVY4svvfRj_GzysOEpmnDpqeo/edit?usp=sharing). 10 | -------------------------------------------------------------------------------- /doc/SourceAccess.md: -------------------------------------------------------------------------------- 1 | # ANGLE Source Code 2 | 3 | # Browsing 4 | 5 | ANGLE's source no longer resides at code.google.com! To browse the ANGLE source, 6 | please visit https://chromium.googlesource.com/angle/angle 7 | 8 | # Checkout 9 | 10 | You may clone the ANGLE repository with: 11 | 12 | > `git clone https://chromium.googlesource.com/angle/angle` 13 | 14 | For full instructions on setting up your system with the necessary prerequisites 15 | for development with ANGLE, please see the DevSetup page. 16 | -------------------------------------------------------------------------------- /doc/Update20130618.md: -------------------------------------------------------------------------------- 1 | # ANGLE Development Update - June 18, 2013 2 | 3 | This week brings some significant changes to ANGLE, which we think are worth 4 | covering in a development update. 5 | 6 | ## Migration from svn to git 7 | 8 | We've changed our backing version control system from svn to git. Projects and 9 | contributors pulling from the svn repository will continue to be able to do so, 10 | but please note that this repository is now read-only, and no further updates 11 | will be made there. To continue tracking new development and issue fixes, you'll 12 | need to watch the git repository. Instructions on checking out code from the git 13 | repository can be found on the [Source Checkout] 14 | (https://code.google.com/p/angleproject/source/checkout) page. 15 | 16 | ## DirectX 11 Support 17 | 18 | ANGLE now provides both a DirectX 9 and a DirectX 11-backed renderer in the same 19 | code base. By default, support for the DirectX 11 renderer is disabled, but it 20 | can be enabled by toggling the value of ANGLE\_ENABLE\_D3D11 as described on the 21 | DevSetup page. On systems without DirectX 11 support, ANGLE will fall back to 22 | DirectX 9. 23 | 24 | This work originally appeared in our dx11proto branch, which, with the move to 25 | the new repository, has been promoted to master. Code previously located in the 26 | trunk of the svn repository will now be located in the git legacy branch, and 27 | active development will now move to the newly promoted master. 28 | -------------------------------------------------------------------------------- /doc/Update20131120.md: -------------------------------------------------------------------------------- 1 | # ANGLE Development Update - November 20, 2013 2 | 3 | ANGLE has undergone a few further migrations in the past week, which we thought 4 | it important to mention in a front-page update. 5 | 6 | The review process for contributed code has moved from [Rietveld] 7 | (https://codereview.appspot.com/) to [Gerrit] 8 | (https://chromium-review.googlesource.com). This migration allows us to more 9 | easily support a Git-centric workflow, and eases the process of accepting 10 | changes submitted by contributors without commit access to our repositories. 11 | 12 | As a result of this change, our repository has also moved from its prior 13 | location at code.google.com to https://chromium.googlesource.com/angle/angle. 14 | The repository may still be pulled from its old location, but no further changes 15 | will be committed there. Updates will be made only to the repository's new 16 | location. 17 | -------------------------------------------------------------------------------- /extensions/EGL_ANGLE_software_display.txt: -------------------------------------------------------------------------------- 1 | Name 2 | 3 | ANGLE_software_display 4 | 5 | Name Strings 6 | 7 | EGL_ANGLE_software_display 8 | 9 | Contributors 10 | 11 | John Bauman 12 | Daniel Koch 13 | 14 | Contacts 15 | 16 | John Bauman, Google Inc. (jbauman 'at' chromium.org) 17 | 18 | Status 19 | 20 | In progress 21 | 22 | Version 23 | 24 | Version 2, October 19, 2011 25 | 26 | Number 27 | 28 | EGL Extension #?? 29 | 30 | Dependencies 31 | 32 | This extension is written against the wording of the EGL 1.4 33 | Specification. 34 | 35 | Overview 36 | 37 | This extension allows for receiving a device that uses software rendering. 38 | 39 | New Types 40 | 41 | None 42 | 43 | New Procedures and Functions 44 | 45 | None 46 | 47 | New Tokens 48 | 49 | EGL_SOFTWARE_DISPLAY_ANGLE (EGLNativeDisplayType)-1 50 | 51 | Additions to Chapter 3 of the EGL 1.4 Specification (EGL Functions and Errors) 52 | 53 | Add before the last sentence of the first paragraph of section 3.2, 54 | "Initialization": 55 | 56 | "If is EGL_SOFTWARE_DISPLAY_ANGLE, a display that will render 57 | everything in software will be returned." 58 | 59 | Issues 60 | 61 | Revision History 62 | 63 | Version 1, 2011/07/12 - first draft. 64 | Version 2, 2011/10/18 - add token definition 65 | 66 | -------------------------------------------------------------------------------- /include/GLES2/gl2platform.h: -------------------------------------------------------------------------------- 1 | #ifndef __gl2platform_h_ 2 | #define __gl2platform_h_ 3 | 4 | /* $Revision: 23328 $ on $Date:: 2013-10-02 02:28:28 -0700 #$ */ 5 | 6 | /* 7 | * This document is licensed under the SGI Free Software B License Version 8 | * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . 9 | */ 10 | 11 | /* Platform-specific types and definitions for OpenGL ES 2.X gl2.h 12 | * 13 | * Adopters may modify khrplatform.h and this file to suit their platform. 14 | * You are encouraged to submit all modifications to the Khronos group so that 15 | * they can be included in future versions of this file. Please submit changes 16 | * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) 17 | * by filing a bug against product "OpenGL-ES" component "Registry". 18 | */ 19 | 20 | #include 21 | 22 | #ifndef GL_APICALL 23 | #define GL_APICALL KHRONOS_APICALL 24 | #endif 25 | 26 | #ifndef GL_APIENTRY 27 | #define GL_APIENTRY KHRONOS_APIENTRY 28 | #endif 29 | 30 | #endif /* __gl2platform_h_ */ 31 | -------------------------------------------------------------------------------- /include/GLES3/gl3platform.h: -------------------------------------------------------------------------------- 1 | #ifndef __gl3platform_h_ 2 | #define __gl3platform_h_ 3 | 4 | /* $Revision: 23328 $ on $Date:: 2013-10-02 02:28:28 -0700 #$ */ 5 | 6 | /* 7 | * This document is licensed under the SGI Free Software B License Version 8 | * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . 9 | */ 10 | 11 | /* Platform-specific types and definitions for OpenGL ES 3.X gl3.h 12 | * 13 | * Adopters may modify khrplatform.h and this file to suit their platform. 14 | * You are encouraged to submit all modifications to the Khronos group so that 15 | * they can be included in future versions of this file. Please submit changes 16 | * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) 17 | * by filing a bug against product "OpenGL-ES" component "Registry". 18 | */ 19 | 20 | #include 21 | 22 | #ifndef GL_APICALL 23 | #define GL_APICALL KHRONOS_APICALL 24 | #endif 25 | 26 | #ifndef GL_APIENTRY 27 | #define GL_APIENTRY KHRONOS_APIENTRY 28 | #endif 29 | 30 | #endif /* __gl3platform_h_ */ 31 | -------------------------------------------------------------------------------- /include/angle_gl.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // angle_gl.h: 7 | // Includes all necessary GL headers and definitions for ANGLE. 8 | // 9 | 10 | #ifndef ANGLEGL_H_ 11 | #define ANGLEGL_H_ 12 | 13 | #include "GLES2/gl2.h" 14 | #include "GLES2/gl2ext.h" 15 | #include "GLES3/gl3.h" 16 | #include "GLES3/gl31.h" 17 | #include "GLES3/gl32.h" 18 | 19 | // The following enum is used in ANGLE, but is from desktop GL 20 | #ifndef GL_SAMPLER_2D_RECT_ARB 21 | #define GL_SAMPLER_2D_RECT_ARB 0x8B63 22 | #endif 23 | 24 | #endif // ANGLEGL_H_ 25 | -------------------------------------------------------------------------------- /include/export.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // export.h : Defines ANGLE_EXPORT, a macro for exporting functions from the DLL 8 | 9 | #ifndef LIBGLESV2_EXPORT_H_ 10 | #define LIBGLESV2_EXPORT_H_ 11 | 12 | #if defined(_WIN32) 13 | # if defined(LIBGLESV2_IMPLEMENTATION) || defined(LIBANGLE_IMPLEMENTATION) 14 | # define ANGLE_EXPORT __declspec(dllexport) 15 | # else 16 | # define ANGLE_EXPORT __declspec(dllimport) 17 | # endif 18 | #elif defined(__GNUC__) 19 | # if defined(LIBGLESV2_IMPLEMENTATION) || defined(LIBANGLE_IMPLEMENTATION) 20 | # define ANGLE_EXPORT __attribute__((visibility ("default"))) 21 | # else 22 | # define ANGLE_EXPORT 23 | # endif 24 | #else 25 | # define ANGLE_EXPORT 26 | #endif 27 | 28 | #endif // LIBGLESV2_EXPORT_H_ 29 | -------------------------------------------------------------------------------- /infra/config/OWNERS: -------------------------------------------------------------------------------- 1 | geofflang@chromium.org 2 | phajdan.jr@chromium.org 3 | sergiyb@chromium.org 4 | tandrii@chromium.org 5 | -------------------------------------------------------------------------------- /infra/config/README.md: -------------------------------------------------------------------------------- 1 | This directory contains configuration files for chrome infrastructure services. 2 | -------------------------------------------------------------------------------- /infra/config/cq.cfg: -------------------------------------------------------------------------------- 1 | # See http://luci-config.appspot.com/schemas/projects/refs:cq.cfg for the 2 | # documentation of this file format. 3 | version: 1 4 | cq_name: "angle" 5 | cq_status_url: "https://chromium-cq-status.appspot.com" 6 | git_repo_url: "https://chromium.googlesource.com/angle/angle" 7 | gerrit { 8 | } 9 | verifiers { 10 | try_job { 11 | buckets { 12 | name: "tryserver.chromium.angle" 13 | builders { name: "linux_angle_rel_ng" } 14 | builders { name: "linux_angle_dbg_ng" } 15 | builders { name: "mac_angle_rel_ng" } 16 | builders { name: "mac_angle_dbg_ng" } 17 | builders { name: "win_angle_rel_ng" } 18 | builders { name: "win_angle_dbg_ng" } 19 | builders { name: "win_angle_x64_rel_ng" } 20 | builders { name: "win_angle_x64_dbg_ng" } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /samples/multi_texture/basemap.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikolalysenko/angle/9216e68641b39b6509ef8358d8b022f87d74338b/samples/multi_texture/basemap.tga -------------------------------------------------------------------------------- /samples/multi_texture/lightmap.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikolalysenko/angle/9216e68641b39b6509ef8358d8b022f87d74338b/samples/multi_texture/lightmap.tga -------------------------------------------------------------------------------- /samples/multiple_draw_buffers/multiple_draw_buffers_copy_fs.glsl: -------------------------------------------------------------------------------- 1 | precision mediump float; 2 | varying vec2 v_texCoord; 3 | uniform sampler2D s_texture; 4 | void main() 5 | { 6 | vec4 color = texture2D(s_texture, v_texCoord); 7 | gl_FragColor = color; 8 | } 9 | -------------------------------------------------------------------------------- /samples/multiple_draw_buffers/multiple_draw_buffers_fs.glsl: -------------------------------------------------------------------------------- 1 | #extension GL_EXT_draw_buffers : enable 2 | precision mediump float; 3 | varying vec2 v_texCoord; 4 | uniform sampler2D s_texture; 5 | void main() 6 | { 7 | vec4 color = texture2D(s_texture, v_texCoord); 8 | gl_FragData[0] = color; 9 | gl_FragData[1] = vec4(1.0, 1.0, 1.0, 1.0) - color.brga; 10 | gl_FragData[2] = vec4(0.2, 1.0, 0.5, 1.0) * color.gbra; 11 | gl_FragData[3] = color.rrra; 12 | } 13 | -------------------------------------------------------------------------------- /samples/multiple_draw_buffers/multiple_draw_buffers_vs.glsl: -------------------------------------------------------------------------------- 1 | attribute vec4 a_position; 2 | attribute vec2 a_texCoord; 3 | varying vec2 v_texCoord; 4 | void main() 5 | { 6 | gl_Position = a_position; 7 | v_texCoord = a_texCoord; 8 | } 9 | -------------------------------------------------------------------------------- /samples/particle_system/smoke.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikolalysenko/angle/9216e68641b39b6509ef8358d8b022f87d74338b/samples/particle_system/smoke.tga -------------------------------------------------------------------------------- /samples/sample_util/texture_utils.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef SAMPLE_UTIL_TEXTURE_UTILS_H 8 | #define SAMPLE_UTIL_TEXTURE_UTILS_H 9 | 10 | #include 11 | 12 | GLuint CreateSimpleTexture2D(); 13 | GLuint CreateSimpleTextureCubemap(); 14 | 15 | GLuint CreateMipMappedTexture2D(); 16 | 17 | #endif // SAMPLE_UTIL_TEXTURE_UTILS_H 18 | -------------------------------------------------------------------------------- /samples/sample_util/tga_utils.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef SAMPLE_UTIL_TGA_UTILS_HPP 8 | #define SAMPLE_UTIL_TGA_UTILS_HPP 9 | 10 | #include 11 | #include 12 | 13 | #include 14 | 15 | typedef std::array Byte4; 16 | 17 | struct TGAImage 18 | { 19 | size_t width; 20 | size_t height; 21 | std::vector data; 22 | 23 | TGAImage(); 24 | }; 25 | 26 | bool LoadTGAImageFromFile(const std::string &path, TGAImage *image); 27 | GLuint LoadTextureFromTGAImage(const TGAImage &image); 28 | 29 | #endif // SAMPLE_UTIL_TGA_UTILS_HPP 30 | -------------------------------------------------------------------------------- /scripts/bootstrap.py: -------------------------------------------------------------------------------- 1 | # Copyright 2015 Google Inc. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | """Generate .gclient file for Angle. 6 | 7 | Because gclient won't accept "--name ." use a different name then edit. 8 | """ 9 | 10 | import subprocess 11 | import sys 12 | 13 | 14 | def main(): 15 | gclient_cmd = ('gclient config --name change2dot --unmanaged ' 16 | 'https://chromium.googlesource.com/angle/angle.git') 17 | try: 18 | rc = subprocess.call(gclient_cmd, shell=True) 19 | except OSError: 20 | print 'could not run "%s" via shell' % gclient_cmd 21 | sys.exit(1) 22 | 23 | if rc: 24 | print 'failed command: "%s"' % gclient_cmd 25 | sys.exit(1) 26 | 27 | with open('.gclient') as gclient_file: 28 | content = gclient_file.read() 29 | 30 | with open('.gclient', 'w') as gclient_file: 31 | gclient_file.write(content.replace('change2dot', '.')) 32 | 33 | print 'created .gclient' 34 | 35 | if __name__ == '__main__': 36 | main() 37 | -------------------------------------------------------------------------------- /src/commit.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // commit.h: 7 | // This is a default commit hash header, when git is not available. 8 | // 9 | 10 | #define ANGLE_COMMIT_HASH "unknown hash" 11 | #define ANGLE_COMMIT_HASH_SIZE 12 12 | #define ANGLE_COMMIT_DATE "unknown date" 13 | 14 | #define ANGLE_DISABLE_PROGRAM_BINARY_LOAD 15 | -------------------------------------------------------------------------------- /src/commit_id.py: -------------------------------------------------------------------------------- 1 | import subprocess as sp 2 | import sys 3 | import os 4 | 5 | # Usage: commit_id.py check (checks if git is present) 6 | # Usage: commit_id.py gen (generates commit id) 7 | 8 | def grab_output(command, cwd): 9 | return sp.Popen(command, stdout=sp.PIPE, shell=True, cwd=cwd).communicate()[0].strip() 10 | 11 | operation = sys.argv[1] 12 | cwd = sys.argv[2] 13 | 14 | if operation == 'check': 15 | index_path = os.path.join(cwd, '.git', 'index') 16 | if os.path.exists(index_path): 17 | print("1") 18 | else: 19 | print("0") 20 | sys.exit(0) 21 | 22 | output_file = sys.argv[3] 23 | commit_id_size = 12 24 | 25 | try: 26 | commit_id = grab_output('git rev-parse --short=%d HEAD' % commit_id_size, cwd) 27 | commit_date = grab_output('git show -s --format=%ci HEAD', cwd) 28 | except: 29 | commit_id = 'invalid-hash' 30 | commit_date = 'invalid-date' 31 | 32 | hfile = open(output_file, 'w') 33 | 34 | hfile.write('#define ANGLE_COMMIT_HASH "%s"\n' % commit_id) 35 | hfile.write('#define ANGLE_COMMIT_HASH_SIZE %d\n' % commit_id_size) 36 | hfile.write('#define ANGLE_COMMIT_DATE "%s"\n' % commit_date) 37 | 38 | hfile.close() 39 | -------------------------------------------------------------------------------- /src/common/MemoryBuffer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef COMMON_MEMORYBUFFER_H_ 8 | #define COMMON_MEMORYBUFFER_H_ 9 | 10 | #include "common/angleutils.h" 11 | 12 | #include 13 | #include 14 | 15 | namespace rx 16 | { 17 | 18 | class MemoryBuffer : angle::NonCopyable 19 | { 20 | public: 21 | MemoryBuffer(); 22 | ~MemoryBuffer(); 23 | 24 | bool resize(size_t size); 25 | size_t size() const; 26 | bool empty() const { return mSize == 0; } 27 | 28 | const uint8_t *data() const; 29 | uint8_t *data(); 30 | 31 | private: 32 | size_t mSize; 33 | uint8_t *mData; 34 | }; 35 | 36 | } 37 | 38 | #endif // COMMON_MEMORYBUFFER_H_ 39 | -------------------------------------------------------------------------------- /src/common/Optional_unittest.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // Unit tests for ANGLE's Optional helper class. 7 | // 8 | 9 | #include "gmock/gmock.h" 10 | #include "gtest/gtest.h" 11 | 12 | #include "common/Optional.h" 13 | 14 | namespace 15 | { 16 | 17 | TEST(OptionalTest, BasicInvalid) 18 | { 19 | Optional testInvalid; 20 | ASSERT_FALSE(testInvalid.valid()); 21 | ASSERT_EQ(Optional::Invalid(), testInvalid); 22 | } 23 | 24 | TEST(OptionalTest, BasicValid) 25 | { 26 | Optional testValid(3); 27 | ASSERT_TRUE(testValid.valid()); 28 | ASSERT_EQ(3, testValid.value()); 29 | ASSERT_NE(Optional::Invalid(), testValid); 30 | } 31 | 32 | TEST(OptionalTest, Copies) 33 | { 34 | Optional testValid(3); 35 | Optional testInvalid; 36 | 37 | Optional testCopy = testInvalid; 38 | ASSERT_FALSE(testCopy.valid()); 39 | ASSERT_EQ(testInvalid, testCopy); 40 | 41 | testCopy = testValid; 42 | ASSERT_TRUE(testCopy.valid()); 43 | ASSERT_EQ(3, testCopy.value()); 44 | ASSERT_EQ(testValid, testCopy); 45 | } 46 | 47 | } // namespace 48 | -------------------------------------------------------------------------------- /src/common/event_tracer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef COMMON_EVENT_TRACER_H_ 6 | #define COMMON_EVENT_TRACER_H_ 7 | 8 | #include "common/platform.h" 9 | #include "platform/Platform.h" 10 | 11 | namespace angle 12 | { 13 | 14 | const unsigned char *GetTraceCategoryEnabledFlag(const char* name); 15 | Platform::TraceEventHandle AddTraceEvent(char phase, const unsigned char* categoryGroupEnabled, const char* name, 16 | unsigned long long id, int numArgs, const char** argNames, 17 | const unsigned char* argTypes, const unsigned long long* argValues, 18 | unsigned char flags); 19 | 20 | } 21 | 22 | #endif // COMMON_EVENT_TRACER_H_ 23 | -------------------------------------------------------------------------------- /src/common/string_utils.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // string_utils: 7 | // String helper functions. 8 | // 9 | 10 | #ifndef LIBANGLE_STRING_UTILS_H_ 11 | #define LIBANGLE_STRING_UTILS_H_ 12 | 13 | #include 14 | #include 15 | 16 | namespace angle 17 | { 18 | 19 | extern const char kWhitespaceASCII[]; 20 | 21 | enum WhitespaceHandling 22 | { 23 | KEEP_WHITESPACE, 24 | TRIM_WHITESPACE, 25 | }; 26 | 27 | enum SplitResult 28 | { 29 | SPLIT_WANT_ALL, 30 | SPLIT_WANT_NONEMPTY, 31 | }; 32 | 33 | std::vector SplitString(const std::string &input, 34 | const std::string &delimiters, 35 | WhitespaceHandling whitespace, 36 | SplitResult resultType); 37 | 38 | void SplitStringAlongWhitespace(const std::string &input, 39 | std::vector *tokensOut); 40 | 41 | std::string TrimString(const std::string &input, const std::string &trimChars); 42 | 43 | bool HexStringToUInt(const std::string &input, unsigned int *uintOut); 44 | 45 | bool ReadFileToString(const std::string &path, std::string *stringOut); 46 | 47 | } 48 | 49 | #endif // LIBANGLE_STRING_UTILS_H_ 50 | -------------------------------------------------------------------------------- /src/common/version.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef COMMON_VERSION_H_ 8 | #define COMMON_VERSION_H_ 9 | 10 | #include "id/commit.h" 11 | 12 | #define ANGLE_MAJOR_VERSION 2 13 | #define ANGLE_MINOR_VERSION 1 14 | 15 | #ifndef ANGLE_REVISION 16 | #define ANGLE_REVISION 0 17 | #endif 18 | 19 | #define ANGLE_STRINGIFY(x) #x 20 | #define ANGLE_MACRO_STRINGIFY(x) ANGLE_STRINGIFY(x) 21 | 22 | #define ANGLE_VERSION_STRING \ 23 | ANGLE_MACRO_STRINGIFY(ANGLE_MAJOR_VERSION) "." \ 24 | ANGLE_MACRO_STRINGIFY(ANGLE_MINOR_VERSION) "." \ 25 | ANGLE_MACRO_STRINGIFY(ANGLE_REVISION) "." \ 26 | ANGLE_COMMIT_HASH 27 | 28 | #endif // COMMON_VERSION_H_ 29 | -------------------------------------------------------------------------------- /src/compiler/preprocessor/64bit-tokenizer-safety.patch: -------------------------------------------------------------------------------- 1 | --- a/src/compiler/preprocessor/Tokenizer.cpp 2 | +++ b/src/compiler/preprocessor/Tokenizer.cpp 3 | @@ -56,6 +56,7 @@ typedef int16_t flex_int16_t; 4 | typedef uint16_t flex_uint16_t; 5 | typedef int32_t flex_int32_t; 6 | typedef uint32_t flex_uint32_t; 7 | +typedef uint64_t flex_uint64_t; 8 | #else 9 | typedef signed char flex_int8_t; 10 | typedef short int flex_int16_t; 11 | @@ -179,6 +180,11 @@ typedef void* yyscan_t; 12 | typedef struct yy_buffer_state *YY_BUFFER_STATE; 13 | #endif 14 | 15 | +#ifndef YY_TYPEDEF_YY_SIZE_T 16 | +#define YY_TYPEDEF_YY_SIZE_T 17 | +typedef size_t yy_size_t; 18 | +#endif 19 | + 20 | #define EOB_ACT_CONTINUE_SCAN 0 21 | #define EOB_ACT_END_OF_FILE 1 22 | #define EOB_ACT_LAST_MATCH 2 23 | @@ -353,7 +354,7 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); 24 | */ 25 | #define YY_DO_BEFORE_ACTION \ 26 | yyg->yytext_ptr = yy_bp; \ 27 | - yyleng = (size_t) (yy_cp - yy_bp); \ 28 | + yyleng = (yy_size_t) (yy_cp - yy_bp); \ 29 | yyg->yy_hold_char = *yy_cp; \ 30 | *yy_cp = '\0'; \ 31 | yyg->yy_c_buf_p = yy_cp; 32 | -------------------------------------------------------------------------------- /src/compiler/preprocessor/DirectiveHandlerBase.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #include "DirectiveHandlerBase.h" 8 | 9 | namespace pp 10 | { 11 | 12 | DirectiveHandler::~DirectiveHandler() 13 | { 14 | } 15 | 16 | } // namespace pp 17 | -------------------------------------------------------------------------------- /src/compiler/preprocessor/ExpressionParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef COMPILER_PREPROCESSOR_EXPRESSIONPARSER_H_ 8 | #define COMPILER_PREPROCESSOR_EXPRESSIONPARSER_H_ 9 | 10 | #include "DiagnosticsBase.h" 11 | #include "pp_utils.h" 12 | 13 | namespace pp 14 | { 15 | 16 | class Lexer; 17 | struct Token; 18 | 19 | class ExpressionParser 20 | { 21 | public: 22 | struct ErrorSettings 23 | { 24 | Diagnostics::ID unexpectedIdentifier; 25 | bool integerLiteralsMustFit32BitSignedRange; 26 | }; 27 | 28 | ExpressionParser(Lexer *lexer, Diagnostics *diagnostics); 29 | 30 | bool parse(Token *token, 31 | int *result, 32 | bool parsePresetToken, 33 | const ErrorSettings &errorSettings, 34 | bool *valid); 35 | 36 | private: 37 | PP_DISALLOW_COPY_AND_ASSIGN(ExpressionParser); 38 | 39 | Lexer *mLexer; 40 | Diagnostics *mDiagnostics; 41 | }; 42 | 43 | } // namespace pp 44 | 45 | #endif // COMPILER_PREPROCESSOR_EXPRESSIONPARSER_H_ 46 | -------------------------------------------------------------------------------- /src/compiler/preprocessor/Lexer.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #include "Lexer.h" 8 | 9 | namespace pp 10 | { 11 | 12 | Lexer::~Lexer() 13 | { 14 | } 15 | 16 | } // namespace pp 17 | -------------------------------------------------------------------------------- /src/compiler/preprocessor/Lexer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef COMPILER_PREPROCESSOR_LEXER_H_ 8 | #define COMPILER_PREPROCESSOR_LEXER_H_ 9 | 10 | namespace pp 11 | { 12 | 13 | struct Token; 14 | 15 | class Lexer 16 | { 17 | public: 18 | virtual ~Lexer(); 19 | 20 | virtual void lex(Token *token) = 0; 21 | }; 22 | 23 | } // namespace pp 24 | 25 | #endif // COMPILER_PREPROCESSOR_LEXER_H_ 26 | -------------------------------------------------------------------------------- /src/compiler/preprocessor/Macro.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2011 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #include "Macro.h" 8 | 9 | #include 10 | 11 | #include "Token.h" 12 | 13 | namespace pp 14 | { 15 | 16 | bool Macro::equals(const Macro &other) const 17 | { 18 | return (type == other.type) && 19 | (name == other.name) && 20 | (parameters == other.parameters) && 21 | (replacements == other.replacements); 22 | } 23 | 24 | void PredefineMacro(MacroSet *macroSet, const char *name, int value) 25 | { 26 | std::ostringstream stream; 27 | stream << value; 28 | 29 | Token token; 30 | token.type = Token::CONST_INT; 31 | token.text = stream.str(); 32 | 33 | Macro macro; 34 | macro.predefined = true; 35 | macro.type = Macro::kTypeObj; 36 | macro.name = name; 37 | macro.replacements.push_back(token); 38 | 39 | (*macroSet)[name] = macro; 40 | } 41 | 42 | } // namespace pp 43 | 44 | -------------------------------------------------------------------------------- /src/compiler/preprocessor/Macro.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef COMPILER_PREPROCESSOR_MACRO_H_ 8 | #define COMPILER_PREPROCESSOR_MACRO_H_ 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | namespace pp 15 | { 16 | 17 | struct Token; 18 | 19 | struct Macro 20 | { 21 | enum Type 22 | { 23 | kTypeObj, 24 | kTypeFunc 25 | }; 26 | typedef std::vector Parameters; 27 | typedef std::vector Replacements; 28 | 29 | Macro() 30 | : predefined(false), 31 | disabled(false), 32 | type(kTypeObj) 33 | { 34 | } 35 | bool equals(const Macro &other) const; 36 | 37 | bool predefined; 38 | mutable bool disabled; 39 | 40 | Type type; 41 | std::string name; 42 | Parameters parameters; 43 | Replacements replacements; 44 | }; 45 | 46 | typedef std::map MacroSet; 47 | 48 | void PredefineMacro(MacroSet *macroSet, const char *name, int value); 49 | 50 | } // namespace pp 51 | 52 | #endif // COMPILER_PREPROCESSOR_MACRO_H_ 53 | -------------------------------------------------------------------------------- /src/compiler/preprocessor/SourceLocation.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef COMPILER_PREPROCESSOR_SOURCELOCATION_H_ 8 | #define COMPILER_PREPROCESSOR_SOURCELOCATION_H_ 9 | 10 | namespace pp 11 | { 12 | 13 | struct SourceLocation 14 | { 15 | SourceLocation() 16 | : file(0), 17 | line(0) 18 | { 19 | } 20 | SourceLocation(int f, int l) 21 | : file(f), 22 | line(l) 23 | { 24 | } 25 | 26 | bool equals(const SourceLocation &other) const 27 | { 28 | return (file == other.file) && (line == other.line); 29 | } 30 | 31 | int file; 32 | int line; 33 | }; 34 | 35 | inline bool operator==(const SourceLocation &lhs, const SourceLocation &rhs) 36 | { 37 | return lhs.equals(rhs); 38 | } 39 | 40 | inline bool operator!=(const SourceLocation &lhs, const SourceLocation &rhs) 41 | { 42 | return !lhs.equals(rhs); 43 | } 44 | 45 | } // namespace pp 46 | 47 | #endif // COMPILER_PREPROCESSOR_SOURCELOCATION_H_ 48 | -------------------------------------------------------------------------------- /src/compiler/preprocessor/generate_parser.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | # Generates various components of GLSL ES preprocessor. 7 | 8 | run_flex() 9 | { 10 | input_file=$script_dir/$1 11 | output_source=$script_dir/$2 12 | flex --noline --nounistd --outfile=$output_source $input_file 13 | } 14 | 15 | run_bison() 16 | { 17 | input_file=$script_dir/$1 18 | output_source=$script_dir/$2 19 | bison --no-lines --skeleton=yacc.c --output=$output_source $input_file 20 | } 21 | 22 | script_dir=$(dirname $0) 23 | 24 | # Generate preprocessor 25 | run_flex Tokenizer.l Tokenizer.cpp 26 | run_bison ExpressionParser.y ExpressionParser.cpp 27 | patch --silent --forward < 64bit-tokenizer-safety.patch 28 | -------------------------------------------------------------------------------- /src/compiler/preprocessor/pp_utils.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // pp_utils.h: Common preprocessor utilities 8 | 9 | #ifndef COMPILER_PREPROCESSOR_PPUTILS_H_ 10 | #define COMPILER_PREPROCESSOR_PPUTILS_H_ 11 | 12 | // A macro to disallow the copy constructor and operator= functions 13 | // This must be used in the private: declarations for a class. 14 | #define PP_DISALLOW_COPY_AND_ASSIGN(TypeName) \ 15 | TypeName(const TypeName &); \ 16 | void operator=(const TypeName &) 17 | 18 | #endif // COMPILER_PREPROCESSOR_PPUTILS_H_ 19 | -------------------------------------------------------------------------------- /src/compiler/translator/64bit-lexer-safety.patch: -------------------------------------------------------------------------------- 1 | --- a/src/compiler/glslang_lex.cpp 2 | +++ b/src/compiler/glslang_lex.cpp 3 | @@ -68,6 +68,7 @@ typedef int16_t flex_int16_t; 4 | typedef uint16_t flex_uint16_t; 5 | typedef int32_t flex_int32_t; 6 | typedef uint32_t flex_uint32_t; 7 | +typedef uint64_t flex_uint64_t; 8 | #else 9 | typedef signed char flex_int8_t; 10 | typedef short int flex_int16_t; 11 | @@ -191,6 +192,11 @@ typedef void* yyscan_t; 12 | typedef struct yy_buffer_state *YY_BUFFER_STATE; 13 | #endif 14 | 15 | +#ifndef YY_TYPEDEF_YY_SIZE_T 16 | +#define YY_TYPEDEF_YY_SIZE_T 17 | +typedef size_t yy_size_t; 18 | +#endif 19 | + 20 | #define EOB_ACT_CONTINUE_SCAN 0 21 | #define EOB_ACT_END_OF_FILE 1 22 | #define EOB_ACT_LAST_MATCH 2 23 | @@ -204,7 +210,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; 24 | */ 25 | #define YY_LESS_LINENO(n) \ 26 | do { \ 27 | - int yyl;\ 28 | + yy_size_t yyl;\ 29 | for ( yyl = n; yyl < yyleng; ++yyl )\ 30 | if ( yytext[yyl] == '\n' )\ 31 | --yylineno;\ 32 | @@ -378,7 +379,7 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); 33 | */ 34 | #define YY_DO_BEFORE_ACTION \ 35 | yyg->yytext_ptr = yy_bp; \ 36 | - yyleng = (size_t) (yy_cp - yy_bp); \ 37 | + yyleng = (yy_size_t) (yy_cp - yy_bp); \ 38 | yyg->yy_hold_char = *yy_cp; \ 39 | *yy_cp = '\0'; \ 40 | yyg->yy_c_buf_p = yy_cp; 41 | -------------------------------------------------------------------------------- /src/compiler/translator/ArrayReturnValueToOutParameter.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // The ArrayReturnValueToOutParameter function changes return values of an array type to out parameters in 7 | // function definitions, prototypes and call sites. 8 | 9 | #ifndef COMPILER_TRANSLATOR_ARRAYRETURNVALUETOOUTPARAMETER_H_ 10 | #define COMPILER_TRANSLATOR_ARRAYRETURNVALUETOOUTPARAMETER_H_ 11 | 12 | class TIntermNode; 13 | 14 | void ArrayReturnValueToOutParameter(TIntermNode *root, unsigned int *temporaryIndex); 15 | 16 | #endif // COMPILER_TRANSLATOR_ARRAYRETURNVALUETOOUTPARAMETER_H_ 17 | -------------------------------------------------------------------------------- /src/compiler/translator/BuiltInFunctionEmulatorGLSL.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2011 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef COMPILER_TRANSLATOR_BUILTINFUNCTIONEMULATORGLSL_H_ 8 | #define COMPILER_TRANSLATOR_BUILTINFUNCTIONEMULATORGLSL_H_ 9 | 10 | #include "GLSLANG/ShaderLang.h" 11 | 12 | class BuiltInFunctionEmulator; 13 | 14 | // 15 | // This is only a workaround for OpenGL driver bugs, and isn't needed in general. 16 | // 17 | void InitBuiltInFunctionEmulatorForGLSLWorkarounds(BuiltInFunctionEmulator *emu, sh::GLenum shaderType); 18 | 19 | // 20 | // This function is emulating built-in functions missing from GLSL 1.30 and higher. 21 | // 22 | void InitBuiltInFunctionEmulatorForGLSLMissingFunctions(BuiltInFunctionEmulator *emu, sh::GLenum shaderType, 23 | int targetGLSLVersion); 24 | 25 | #endif // COMPILER_TRANSLATOR_BUILTINFUNCTIONEMULATORGLSL_H_ 26 | -------------------------------------------------------------------------------- /src/compiler/translator/BuiltInFunctionEmulatorHLSL.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef COMPILER_TRANSLATOR_BUILTINFUNCTIONEMULATORHLSL_H_ 8 | #define COMPILER_TRANSLATOR_BUILTINFUNCTIONEMULATORHLSL_H_ 9 | 10 | #include "GLSLANG/ShaderLang.h" 11 | 12 | class BuiltInFunctionEmulator; 13 | 14 | void InitBuiltInFunctionEmulatorForHLSL(BuiltInFunctionEmulator *emu); 15 | 16 | #endif // COMPILER_TRANSLATOR_BUILTINFUNCTIONEMULATORHLSL_H_ 17 | -------------------------------------------------------------------------------- /src/compiler/translator/Diagnostics.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef COMPILER_TRANSLATOR_DIAGNOSTICS_H_ 8 | #define COMPILER_TRANSLATOR_DIAGNOSTICS_H_ 9 | 10 | #include "common/angleutils.h" 11 | #include "compiler/preprocessor/DiagnosticsBase.h" 12 | 13 | class TInfoSink; 14 | 15 | class TDiagnostics : public pp::Diagnostics, angle::NonCopyable 16 | { 17 | public: 18 | TDiagnostics(TInfoSink& infoSink); 19 | ~TDiagnostics() override; 20 | 21 | TInfoSink& infoSink() { return mInfoSink; } 22 | 23 | int numErrors() const { return mNumErrors; } 24 | int numWarnings() const { return mNumWarnings; } 25 | 26 | void writeInfo(Severity severity, 27 | const pp::SourceLocation& loc, 28 | const std::string& reason, 29 | const std::string& token, 30 | const std::string& extra); 31 | 32 | protected: 33 | void print(ID id, const pp::SourceLocation &loc, const std::string &text) override; 34 | 35 | private: 36 | TInfoSink& mInfoSink; 37 | int mNumErrors; 38 | int mNumWarnings; 39 | }; 40 | 41 | #endif // COMPILER_TRANSLATOR_DIAGNOSTICS_H_ 42 | -------------------------------------------------------------------------------- /src/compiler/translator/ExtensionBehavior.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef COMPILER_TRANSLATOR_EXTENSIONBEHAVIOR_H_ 8 | #define COMPILER_TRANSLATOR_EXTENSIONBEHAVIOR_H_ 9 | 10 | #include 11 | #include 12 | 13 | typedef enum 14 | { 15 | EBhRequire, 16 | EBhEnable, 17 | EBhWarn, 18 | EBhDisable, 19 | EBhUndefined 20 | } TBehavior; 21 | 22 | inline const char* getBehaviorString(TBehavior b) 23 | { 24 | switch(b) 25 | { 26 | case EBhRequire: return "require"; 27 | case EBhEnable: return "enable"; 28 | case EBhWarn: return "warn"; 29 | case EBhDisable: return "disable"; 30 | default: return NULL; 31 | } 32 | } 33 | 34 | // Mapping between extension name and behavior. 35 | typedef std::map TExtensionBehavior; 36 | 37 | inline bool IsExtensionEnabled(const TExtensionBehavior &extBehavior, const char *extension) 38 | { 39 | auto iter = extBehavior.find(extension); 40 | return iter != extBehavior.end() && (iter->second == EBhEnable || iter->second == EBhRequire); 41 | } 42 | 43 | #endif // COMPILER_TRANSLATOR_EXTENSIONBEHAVIOR_H_ 44 | -------------------------------------------------------------------------------- /src/compiler/translator/ExtensionGLSL.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // ExtensionGLSL.h: Defines the TExtensionGLSL class that tracks GLSL extension requirements of 7 | // shaders. 8 | 9 | #ifndef COMPILER_TRANSLATOR_EXTENSIONGLSL_H_ 10 | #define COMPILER_TRANSLATOR_EXTENSIONGLSL_H_ 11 | 12 | #include 13 | #include 14 | 15 | #include "compiler/translator/IntermNode.h" 16 | 17 | // Traverses the intermediate tree to determine which GLSL extensions are required 18 | // to support the shader. 19 | class TExtensionGLSL : public TIntermTraverser 20 | { 21 | public: 22 | TExtensionGLSL(ShShaderOutput output); 23 | 24 | const std::set &getEnabledExtensions() const; 25 | const std::set &getRequiredExtensions() const; 26 | 27 | bool visitUnary(Visit visit, TIntermUnary *node) override; 28 | bool visitAggregate(Visit visit, TIntermAggregate *node) override; 29 | 30 | private: 31 | void checkOperator(TIntermOperator *node); 32 | 33 | int mTargetVersion; 34 | 35 | std::set mEnabledExtensions; 36 | std::set mRequiredExtensions; 37 | }; 38 | 39 | #endif // COMPILER_TRANSLATOR_EXTENSIONGLSL_H_ 40 | -------------------------------------------------------------------------------- /src/compiler/translator/FlagStd140Structs.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2013 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef COMPILER_TRANSLATOR_FLAGSTD140STRUCTS_H_ 8 | #define COMPILER_TRANSLATOR_FLAGSTD140STRUCTS_H_ 9 | 10 | #include "compiler/translator/IntermNode.h" 11 | 12 | namespace sh 13 | { 14 | 15 | // This class finds references to nested structs of std140 blocks that access 16 | // the nested struct "by value", where the padding added in the translator 17 | // conflicts with the "natural" unpadded type. 18 | class FlagStd140Structs : public TIntermTraverser 19 | { 20 | public: 21 | 22 | FlagStd140Structs() 23 | : TIntermTraverser(true, false, false) 24 | { 25 | } 26 | 27 | const std::vector getFlaggedNodes() const { return mFlaggedNodes; } 28 | 29 | protected: 30 | bool visitBinary(Visit visit, TIntermBinary *binaryNode) override; 31 | void visitSymbol(TIntermSymbol *symbol) override; 32 | 33 | private: 34 | bool isInStd140InterfaceBlock(TIntermTyped *node) const; 35 | 36 | std::vector mFlaggedNodes; 37 | }; 38 | 39 | std::vector FlagStd140ValueStructs(TIntermNode *node); 40 | 41 | } 42 | 43 | #endif // COMPILER_TRANSLATOR_FLAGSTD140STRUCTS_H_ 44 | -------------------------------------------------------------------------------- /src/compiler/translator/HashNames.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef COMPILER_TRANSLATOR_HASHNAMES_H_ 8 | #define COMPILER_TRANSLATOR_HASHNAMES_H_ 9 | 10 | #include 11 | 12 | #include "compiler/translator/IntermNode.h" 13 | 14 | #define HASHED_NAME_PREFIX "webgl_" 15 | 16 | typedef std::map NameMap; 17 | 18 | #endif // COMPILER_TRANSLATOR_HASHNAMES_H_ 19 | -------------------------------------------------------------------------------- /src/compiler/translator/Initialize.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef COMPILER_TRANSLATOR_INITIALIZE_H_ 8 | #define COMPILER_TRANSLATOR_INITIALIZE_H_ 9 | 10 | #include "compiler/translator/Common.h" 11 | #include "compiler/translator/Compiler.h" 12 | #include "compiler/translator/SymbolTable.h" 13 | 14 | void InsertBuiltInFunctions(sh::GLenum type, ShShaderSpec spec, const ShBuiltInResources &resources, TSymbolTable &table); 15 | 16 | void IdentifyBuiltIns(sh::GLenum type, ShShaderSpec spec, 17 | const ShBuiltInResources& resources, 18 | TSymbolTable& symbolTable); 19 | 20 | void InitExtensionBehavior(const ShBuiltInResources& resources, 21 | TExtensionBehavior& extensionBehavior); 22 | 23 | // Resets the behavior of the extensions listed in |extensionBehavior| to the 24 | // undefined state. These extensions will only be those initially supported in 25 | // the ShBuiltInResources object for this compiler instance. All other 26 | // extensions will remain unsupported. 27 | void ResetExtensionBehavior(TExtensionBehavior &extensionBehavior); 28 | 29 | #endif // COMPILER_TRANSLATOR_INITIALIZE_H_ 30 | -------------------------------------------------------------------------------- /src/compiler/translator/InitializeDll.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #include "compiler/translator/Cache.h" 8 | #include "compiler/translator/InitializeDll.h" 9 | #include "compiler/translator/InitializeGlobals.h" 10 | #include "compiler/translator/InitializeParseContext.h" 11 | 12 | #include "common/platform.h" 13 | 14 | #include 15 | 16 | bool InitProcess() 17 | { 18 | if (!InitializePoolIndex()) { 19 | assert(0 && "InitProcess(): Failed to initalize global pool"); 20 | return false; 21 | } 22 | 23 | if (!InitializeParseContextIndex()) { 24 | assert(0 && "InitProcess(): Failed to initalize parse context"); 25 | return false; 26 | } 27 | 28 | TCache::initialize(); 29 | 30 | return true; 31 | } 32 | 33 | void DetachProcess() 34 | { 35 | FreeParseContextIndex(); 36 | FreePoolIndex(); 37 | TCache::destroy(); 38 | } 39 | -------------------------------------------------------------------------------- /src/compiler/translator/InitializeDll.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | #ifndef COMPILER_TRANSLATOR_INITIALIZEDLL_H_ 7 | #define COMPILER_TRANSLATOR_INITIALIZEDLL_H_ 8 | 9 | bool InitProcess(); 10 | void DetachProcess(); 11 | 12 | #endif // COMPILER_TRANSLATOR_INITIALIZEDLL_H_ 13 | 14 | -------------------------------------------------------------------------------- /src/compiler/translator/InitializeGlobals.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef COMPILER_TRANSLATOR_INITIALIZEGLOBALS_H_ 8 | #define COMPILER_TRANSLATOR_INITIALIZEGLOBALS_H_ 9 | 10 | bool InitializePoolIndex(); 11 | void FreePoolIndex(); 12 | 13 | #endif // COMPILER_TRANSLATOR_INITIALIZEGLOBALS_H_ 14 | -------------------------------------------------------------------------------- /src/compiler/translator/InitializeParseContext.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #include "compiler/translator/InitializeParseContext.h" 8 | 9 | #include "common/tls.h" 10 | 11 | #include 12 | 13 | TLSIndex GlobalParseContextIndex = TLS_INVALID_INDEX; 14 | 15 | bool InitializeParseContextIndex() 16 | { 17 | assert(GlobalParseContextIndex == TLS_INVALID_INDEX); 18 | 19 | GlobalParseContextIndex = CreateTLSIndex(); 20 | return GlobalParseContextIndex != TLS_INVALID_INDEX; 21 | } 22 | 23 | void FreeParseContextIndex() 24 | { 25 | assert(GlobalParseContextIndex != TLS_INVALID_INDEX); 26 | 27 | DestroyTLSIndex(GlobalParseContextIndex); 28 | GlobalParseContextIndex = TLS_INVALID_INDEX; 29 | } 30 | 31 | void SetGlobalParseContext(TParseContext* context) 32 | { 33 | assert(GlobalParseContextIndex != TLS_INVALID_INDEX); 34 | SetTLSValue(GlobalParseContextIndex, context); 35 | } 36 | 37 | TParseContext* GetGlobalParseContext() 38 | { 39 | assert(GlobalParseContextIndex != TLS_INVALID_INDEX); 40 | return static_cast(GetTLSValue(GlobalParseContextIndex)); 41 | } 42 | 43 | -------------------------------------------------------------------------------- /src/compiler/translator/InitializeParseContext.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef COMPILER_TRANSLATOR_INITIALIZEPARSECONTEXT_H_ 8 | #define COMPILER_TRANSLATOR_INITIALIZEPARSECONTEXT_H_ 9 | 10 | bool InitializeParseContextIndex(); 11 | void FreeParseContextIndex(); 12 | 13 | class TParseContext; 14 | extern void SetGlobalParseContext(TParseContext* context); 15 | extern TParseContext* GetGlobalParseContext(); 16 | 17 | #endif // COMPILER_TRANSLATOR_INITIALIZEPARSECONTEXT_H_ 18 | -------------------------------------------------------------------------------- /src/compiler/translator/OutputESSL.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #include "compiler/translator/OutputESSL.h" 8 | 9 | TOutputESSL::TOutputESSL(TInfoSinkBase &objSink, 10 | ShArrayIndexClampingStrategy clampingStrategy, 11 | ShHashFunction64 hashFunction, 12 | NameMap &nameMap, 13 | TSymbolTable &symbolTable, 14 | int shaderVersion, 15 | bool forceHighp) 16 | : TOutputGLSLBase(objSink, 17 | clampingStrategy, 18 | hashFunction, 19 | nameMap, 20 | symbolTable, 21 | shaderVersion, 22 | SH_ESSL_OUTPUT), 23 | mForceHighp(forceHighp) 24 | { 25 | } 26 | 27 | bool TOutputESSL::writeVariablePrecision(TPrecision precision) 28 | { 29 | if (precision == EbpUndefined) 30 | return false; 31 | 32 | TInfoSinkBase& out = objSink(); 33 | if (mForceHighp) 34 | out << getPrecisionString(EbpHigh); 35 | else 36 | out << getPrecisionString(precision); 37 | return true; 38 | } 39 | -------------------------------------------------------------------------------- /src/compiler/translator/OutputESSL.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef COMPILER_TRANSLATOR_OUTPUTESSL_H_ 8 | #define COMPILER_TRANSLATOR_OUTPUTESSL_H_ 9 | 10 | #include "compiler/translator/OutputGLSLBase.h" 11 | 12 | class TOutputESSL : public TOutputGLSLBase 13 | { 14 | public: 15 | TOutputESSL(TInfoSinkBase& objSink, 16 | ShArrayIndexClampingStrategy clampingStrategy, 17 | ShHashFunction64 hashFunction, 18 | NameMap& nameMap, 19 | TSymbolTable& symbolTable, 20 | int shaderVersion, 21 | bool forceHighp); 22 | 23 | protected: 24 | bool writeVariablePrecision(TPrecision precision) override; 25 | 26 | private: 27 | bool mForceHighp; 28 | }; 29 | 30 | #endif // COMPILER_TRANSLATOR_OUTPUTESSL_H_ 31 | -------------------------------------------------------------------------------- /src/compiler/translator/OutputGLSL.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef COMPILER_TRANSLATOR_OUTPUTGLSL_H_ 8 | #define COMPILER_TRANSLATOR_OUTPUTGLSL_H_ 9 | 10 | #include "compiler/translator/OutputGLSLBase.h" 11 | 12 | class TOutputGLSL : public TOutputGLSLBase 13 | { 14 | public: 15 | TOutputGLSL(TInfoSinkBase& objSink, 16 | ShArrayIndexClampingStrategy clampingStrategy, 17 | ShHashFunction64 hashFunction, 18 | NameMap& nameMap, 19 | TSymbolTable& symbolTable, 20 | int shaderVersion, 21 | ShShaderOutput output); 22 | 23 | protected: 24 | bool writeVariablePrecision(TPrecision) override; 25 | void visitSymbol(TIntermSymbol *node) override; 26 | TString translateTextureFunction(TString &name) override; 27 | }; 28 | 29 | #endif // COMPILER_TRANSLATOR_OUTPUTGLSL_H_ 30 | -------------------------------------------------------------------------------- /src/compiler/translator/Pragma.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef COMPILER_TRANSLATOR_PRAGMA_H_ 8 | #define COMPILER_TRANSLATOR_PRAGMA_H_ 9 | 10 | struct TPragma 11 | { 12 | struct STDGL 13 | { 14 | STDGL() : invariantAll(false) { } 15 | 16 | bool invariantAll; 17 | }; 18 | 19 | 20 | // By default optimization is turned on and debug is turned off. 21 | // Precision emulation is turned on by default, but has no effect unless 22 | // the extension is enabled. 23 | TPragma() : optimize(true), debug(false), debugShaderPrecision(true) { } 24 | TPragma(bool o, bool d) : optimize(o), debug(d), debugShaderPrecision(true) { } 25 | 26 | bool optimize; 27 | bool debug; 28 | bool debugShaderPrecision; 29 | STDGL stdgl; 30 | }; 31 | 32 | #endif // COMPILER_TRANSLATOR_PRAGMA_H_ 33 | -------------------------------------------------------------------------------- /src/compiler/translator/PruneEmptyDeclarations.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // The PruneEmptyDeclarations function prunes unnecessary empty declarations and declarators from the AST. 7 | 8 | #ifndef COMPILER_TRANSLATOR_PRUNEEMPTYDECLARATIONS_H_ 9 | #define COMPILER_TRANSLATOR_PRUNEEMPTYDECLARATIONS_H_ 10 | 11 | class TIntermNode; 12 | 13 | void PruneEmptyDeclarations(TIntermNode *root); 14 | 15 | #endif // COMPILER_TRANSLATOR_PRUNEEMPTYDECLARATIONS_H_ 16 | -------------------------------------------------------------------------------- /src/compiler/translator/RecordConstantPrecision.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // During parsing, all constant expressions are folded to constant union nodes. The expressions that have been 7 | // folded may have had precision qualifiers, which should affect the precision of the consuming operation. 8 | // If the folded constant union nodes are written to output as such they won't have any precision qualifiers, 9 | // and their effect on the precision of the consuming operation is lost. 10 | // 11 | // RecordConstantPrecision is an AST traverser that inspects the precision qualifiers of constants and hoists 12 | // the constants outside the containing expression as precision qualified named variables in case that is 13 | // required for correct precision propagation. 14 | // 15 | 16 | #ifndef COMPILER_TRANSLATOR_RECORDCONSTANTPRECISION_H_ 17 | #define COMPILER_TRANSLATOR_RECORDCONSTANTPRECISION_H_ 18 | 19 | class TIntermNode; 20 | 21 | void RecordConstantPrecision(TIntermNode *root, unsigned int *temporaryIndex); 22 | 23 | #endif // COMPILER_TRANSLATOR_RECORDCONSTANTPRECISION_H_ 24 | -------------------------------------------------------------------------------- /src/compiler/translator/RegenerateStructNames.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef COMPILER_TRANSLATOR_REGENERATESTRUCTNAMES_H_ 8 | #define COMPILER_TRANSLATOR_REGENERATESTRUCTNAMES_H_ 9 | 10 | #include "compiler/translator/Intermediate.h" 11 | #include "compiler/translator/SymbolTable.h" 12 | 13 | #include 14 | 15 | class RegenerateStructNames : public TIntermTraverser 16 | { 17 | public: 18 | RegenerateStructNames(const TSymbolTable &symbolTable, 19 | int shaderVersion) 20 | : TIntermTraverser(true, false, false), 21 | mSymbolTable(symbolTable), 22 | mShaderVersion(shaderVersion), 23 | mScopeDepth(0) {} 24 | 25 | protected: 26 | void visitSymbol(TIntermSymbol *) override; 27 | bool visitAggregate(Visit, TIntermAggregate *) override; 28 | 29 | private: 30 | const TSymbolTable &mSymbolTable; 31 | int mShaderVersion; 32 | 33 | // Indicating the depth of the current scope. 34 | // The global scope is 1. 35 | int mScopeDepth; 36 | 37 | // If a struct's declared globally, push its ID in this set. 38 | std::set mDeclaredGlobalStructs; 39 | }; 40 | 41 | #endif // COMPILER_TRANSLATOR_REGENERATESTRUCTNAMES_H_ 42 | -------------------------------------------------------------------------------- /src/compiler/translator/RemoveDynamicIndexing.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // RemoveDynamicIndexing is an AST traverser to remove dynamic indexing of vectors and matrices, 7 | // replacing them with calls to functions that choose which component to return or write. 8 | // 9 | 10 | #ifndef COMPILER_TRANSLATOR_REMOVEDYNAMICINDEXING_H_ 11 | #define COMPILER_TRANSLATOR_REMOVEDYNAMICINDEXING_H_ 12 | 13 | class TIntermNode; 14 | class TSymbolTable; 15 | 16 | void RemoveDynamicIndexing(TIntermNode *root, 17 | unsigned int *temporaryIndex, 18 | const TSymbolTable &symbolTable, 19 | int shaderVersion); 20 | 21 | #endif // COMPILER_TRANSLATOR_REMOVEDYNAMICINDEXING_H_ 22 | -------------------------------------------------------------------------------- /src/compiler/translator/RemovePow.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // RemovePow is an AST traverser to convert pow(x, y) built-in calls where y is a 7 | // constant to exp2(y * log2(x)). This works around an issue in NVIDIA 311 series 8 | // OpenGL drivers. 9 | // 10 | 11 | #ifndef COMPILER_TRANSLATOR_REMOVEPOW_H_ 12 | #define COMPILER_TRANSLATOR_REMOVEPOW_H_ 13 | 14 | class TIntermNode; 15 | 16 | void RemovePow(TIntermNode *root); 17 | 18 | #endif // COMPILER_TRANSLATOR_REMOVEPOW_H_ 19 | -------------------------------------------------------------------------------- /src/compiler/translator/RenameFunction.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef COMPILER_TRANSLATOR_RENAMEFUNCTION_H_ 8 | #define COMPILER_TRANSLATOR_RENAMEFUNCTION_H_ 9 | 10 | #include "compiler/translator/IntermNode.h" 11 | 12 | // 13 | // Renames a function, including its declaration and any calls to it. 14 | // 15 | class RenameFunction : public TIntermTraverser 16 | { 17 | public: 18 | RenameFunction(const TString& oldFunctionName, const TString& newFunctionName) 19 | : TIntermTraverser(true, false, false) 20 | , mOldFunctionName(oldFunctionName) 21 | , mNewFunctionName(newFunctionName) {} 22 | 23 | bool visitAggregate(Visit visit, TIntermAggregate *node) override 24 | { 25 | TOperator op = node->getOp(); 26 | if ((op == EOpFunction || op == EOpFunctionCall) && node->getName() == mOldFunctionName) 27 | node->setName(mNewFunctionName); 28 | return true; 29 | } 30 | 31 | private: 32 | const TString mOldFunctionName; 33 | const TString mNewFunctionName; 34 | }; 35 | 36 | #endif // COMPILER_TRANSLATOR_RENAMEFUNCTION_H_ 37 | -------------------------------------------------------------------------------- /src/compiler/translator/RewriteDoWhile.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // RewriteDoWhile.h: rewrite do-while loops as while loops to work around 8 | // driver bugs 9 | 10 | #ifndef COMPILER_TRANSLATOR_REWRITEDOWHILE_H_ 11 | #define COMPILER_TRANSLATOR_REWRITEDOWHILE_H_ 12 | 13 | class TIntermNode; 14 | void RewriteDoWhile(TIntermNode *root, unsigned int *temporaryIndex); 15 | 16 | #endif // COMPILER_TRANSLATOR_REWRITEDOWHILE_H_ 17 | -------------------------------------------------------------------------------- /src/compiler/translator/RewriteElseBlocks.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // RewriteElseBlocks.h: Prototype for tree transform to change 7 | // all if-else blocks to if-if blocks. 8 | // 9 | 10 | #ifndef COMPILER_TRANSLATOR_REWRITEELSEBLOCKS_H_ 11 | #define COMPILER_TRANSLATOR_REWRITEELSEBLOCKS_H_ 12 | 13 | #include "compiler/translator/IntermNode.h" 14 | 15 | namespace sh 16 | { 17 | 18 | void RewriteElseBlocks(TIntermNode *node, unsigned int *temporaryIndex); 19 | 20 | } 21 | 22 | #endif // COMPILER_TRANSLATOR_REWRITEELSEBLOCKS_H_ 23 | -------------------------------------------------------------------------------- /src/compiler/translator/SearchSymbol.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // SearchSymbol is an AST traverser to detect the use of a given symbol name 7 | // 8 | 9 | #include "compiler/translator/SearchSymbol.h" 10 | 11 | #include "compiler/translator/InfoSink.h" 12 | 13 | namespace sh 14 | { 15 | SearchSymbol::SearchSymbol(const TString &symbol) 16 | : TIntermTraverser(true, false, false), 17 | mSymbol(symbol) 18 | { 19 | match = false; 20 | } 21 | 22 | void SearchSymbol::traverse(TIntermNode *node) 23 | { 24 | node->traverse(this); 25 | } 26 | 27 | void SearchSymbol::visitSymbol(TIntermSymbol *symbolNode) 28 | { 29 | if (symbolNode->getSymbol() == mSymbol) 30 | { 31 | match = true; 32 | } 33 | } 34 | 35 | bool SearchSymbol::foundMatch() const 36 | { 37 | return match; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/compiler/translator/SearchSymbol.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // SearchSymbol is an AST traverser to detect the use of a given symbol name 7 | // 8 | 9 | #ifndef COMPILER_TRANSLATOR_SEARCHSYMBOL_H_ 10 | #define COMPILER_TRANSLATOR_SEARCHSYMBOL_H_ 11 | 12 | #include "compiler/translator/IntermNode.h" 13 | #include "compiler/translator/ParseContext.h" 14 | 15 | namespace sh 16 | { 17 | class SearchSymbol : public TIntermTraverser 18 | { 19 | public: 20 | SearchSymbol(const TString &symbol); 21 | 22 | void traverse(TIntermNode *node); 23 | void visitSymbol(TIntermSymbol *symbolNode) override; 24 | 25 | bool foundMatch() const; 26 | 27 | protected: 28 | const TString &mSymbol; 29 | bool match; 30 | }; 31 | } 32 | 33 | #endif // COMPILER_TRANSLATOR_SEARCHSYMBOL_H_ 34 | -------------------------------------------------------------------------------- /src/compiler/translator/SeparateArrayInitialization.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // The SeparateArrayInitialization function splits each array initialization into a declaration and an assignment. 7 | // Example: 8 | // type[n] a = initializer; 9 | // will effectively become 10 | // type[n] a; 11 | // a = initializer; 12 | // 13 | // Note that if the array is declared as const, the initialization may still be split, making the 14 | // AST technically invalid. Because of that this transformation should only be used when subsequent 15 | // stages don't care about const qualifiers. However, the initialization will not be split if the 16 | // initializer can be written as a HLSL literal. 17 | 18 | #ifndef COMPILER_TRANSLATOR_SEPARATEARRAYINITIALIZATION_H_ 19 | #define COMPILER_TRANSLATOR_SEPARATEARRAYINITIALIZATION_H_ 20 | 21 | class TIntermNode; 22 | 23 | void SeparateArrayInitialization(TIntermNode *root); 24 | 25 | #endif // COMPILER_TRANSLATOR_SEPARATEARRAYINITIALIZATION_H_ 26 | -------------------------------------------------------------------------------- /src/compiler/translator/SeparateDeclarations.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // The SeparateDeclarations function processes declarations, so that in the end each declaration 7 | // contains only one declarator. 8 | // This is useful as an intermediate step when initialization needs to be separated from declaration, 9 | // or when things need to be unfolded out of the initializer. 10 | // Example: 11 | // int a[1] = int[1](1), b[1] = int[1](2); 12 | // gets transformed when run through this class into the AST equivalent of: 13 | // int a[1] = int[1](1); 14 | // int b[1] = int[1](2); 15 | 16 | #ifndef COMPILER_TRANSLATOR_SEPARATEDECLARATIONS_H_ 17 | #define COMPILER_TRANSLATOR_SEPARATEDECLARATIONS_H_ 18 | 19 | class TIntermNode; 20 | 21 | void SeparateDeclarations(TIntermNode *root); 22 | 23 | #endif // COMPILER_TRANSLATOR_SEPARATEDECLARATIONS_H_ 24 | -------------------------------------------------------------------------------- /src/compiler/translator/SeparateExpressionsReturningArrays.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // SeparateExpressionsReturningArrays splits array-returning expressions that are not array names from more complex 7 | // expressions, assigning them to a temporary variable a#. 8 | // Examples where a, b and c are all arrays: 9 | // (a = b) == (a = c) is split into a = b; type[n] a1 = a; a = c; type[n] a2 = a; a1 == a2; 10 | // type d = type[n](...)[i]; is split into type[n] a1 = type[n](...); type d = a1[i]; 11 | 12 | #ifndef COMPILER_TRANSLATOR_SEPARATEEXPRESSIONSRETURNINGARRAYS_H_ 13 | #define COMPILER_TRANSLATOR_SEPARATEEXPRESSIONSRETURNINGARRAYS_H_ 14 | 15 | class TIntermNode; 16 | 17 | void SeparateExpressionsReturningArrays(TIntermNode *root, unsigned int *temporaryIndex); 18 | 19 | #endif // COMPILER_TRANSLATOR_SEPARATEEXPRESSIONSRETURNINGARRAYS_H_ 20 | -------------------------------------------------------------------------------- /src/compiler/translator/TranslatorESSL.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef COMPILER_TRANSLATOR_TRANSLATORESSL_H_ 8 | #define COMPILER_TRANSLATOR_TRANSLATORESSL_H_ 9 | 10 | #include "compiler/translator/Compiler.h" 11 | 12 | class TranslatorESSL : public TCompiler 13 | { 14 | public: 15 | TranslatorESSL(sh::GLenum type, ShShaderSpec spec); 16 | 17 | protected: 18 | void initBuiltInFunctionEmulator(BuiltInFunctionEmulator *emu, int compileOptions) override; 19 | 20 | void translate(TIntermNode *root, int compileOptions) override; 21 | 22 | private: 23 | void writeExtensionBehavior(); 24 | }; 25 | 26 | #endif // COMPILER_TRANSLATOR_TRANSLATORESSL_H_ 27 | -------------------------------------------------------------------------------- /src/compiler/translator/TranslatorGLSL.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef COMPILER_TRANSLATOR_TRANSLATORGLSL_H_ 8 | #define COMPILER_TRANSLATOR_TRANSLATORGLSL_H_ 9 | 10 | #include "compiler/translator/Compiler.h" 11 | 12 | class TranslatorGLSL : public TCompiler 13 | { 14 | public: 15 | TranslatorGLSL(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output); 16 | 17 | protected: 18 | void initBuiltInFunctionEmulator(BuiltInFunctionEmulator *emu, int compileOptions) override; 19 | 20 | void translate(TIntermNode *root, int compileOptions) override; 21 | 22 | private: 23 | void writeVersion(TIntermNode *root); 24 | void writeExtensionBehavior(TIntermNode *root); 25 | }; 26 | 27 | #endif // COMPILER_TRANSLATOR_TRANSLATORGLSL_H_ 28 | -------------------------------------------------------------------------------- /src/compiler/translator/TranslatorHLSL.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef COMPILER_TRANSLATOR_TRANSLATORHLSL_H_ 8 | #define COMPILER_TRANSLATOR_TRANSLATORHLSL_H_ 9 | 10 | #include "compiler/translator/Compiler.h" 11 | 12 | class TranslatorHLSL : public TCompiler 13 | { 14 | public: 15 | TranslatorHLSL(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output); 16 | TranslatorHLSL *getAsTranslatorHLSL() override { return this; } 17 | 18 | bool hasInterfaceBlock(const std::string &interfaceBlockName) const; 19 | unsigned int getInterfaceBlockRegister(const std::string &interfaceBlockName) const; 20 | 21 | bool hasUniform(const std::string &uniformName) const; 22 | unsigned int getUniformRegister(const std::string &uniformName) const; 23 | 24 | protected: 25 | void translate(TIntermNode *root, int compileOptions) override; 26 | 27 | // collectVariables needs to be run always so registers can be assigned. 28 | bool shouldCollectVariables(int compileOptions) override { return true; } 29 | 30 | std::map mInterfaceBlockRegisterMap; 31 | std::map mUniformRegisterMap; 32 | }; 33 | 34 | #endif // COMPILER_TRANSLATOR_TRANSLATORHLSL_H_ 35 | -------------------------------------------------------------------------------- /src/compiler/translator/UnfoldShortCircuitAST.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // UnfoldShortCircuitAST is an AST traverser to replace short-circuiting 7 | // operations with ternary operations. 8 | // 9 | 10 | #ifndef COMPILER_TRANSLATOR_UNFOLDSHORTCIRCUITAST_H_ 11 | #define COMPILER_TRANSLATOR_UNFOLDSHORTCIRCUITAST_H_ 12 | 13 | #include "common/angleutils.h" 14 | #include "compiler/translator/IntermNode.h" 15 | 16 | // This traverser identifies all the short circuit binary nodes that need to 17 | // be replaced, and creates the corresponding replacement nodes. However, 18 | // the actual replacements happen after the traverse through updateTree(). 19 | 20 | class UnfoldShortCircuitAST : public TIntermTraverser 21 | { 22 | public: 23 | UnfoldShortCircuitAST() 24 | : TIntermTraverser(true, false, false) 25 | { 26 | } 27 | 28 | bool visitBinary(Visit visit, TIntermBinary *) override; 29 | }; 30 | 31 | #endif // COMPILER_TRANSLATOR_UNFOLDSHORTCIRCUITAST_H_ 32 | -------------------------------------------------------------------------------- /src/compiler/translator/UnfoldShortCircuitToIf.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // UnfoldShortCircuitToIf is an AST traverser to convert short-circuiting operators to if-else statements. 7 | // The results are assigned to s# temporaries, which are used by the main translator instead of 8 | // the original expression. 9 | // 10 | 11 | #ifndef COMPILER_TRANSLATOR_UNFOLDSHORTCIRCUIT_H_ 12 | #define COMPILER_TRANSLATOR_UNFOLDSHORTCIRCUIT_H_ 13 | 14 | class TIntermNode; 15 | 16 | void UnfoldShortCircuitToIf(TIntermNode *root, unsigned int *temporaryIndex); 17 | 18 | #endif // COMPILER_TRANSLATOR_UNFOLDSHORTCIRCUIT_H_ 19 | -------------------------------------------------------------------------------- /src/compiler/translator/ValidateGlobalInitializer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef COMPILER_TRANSLATOR_VALIDATEGLOBALINITIALIZER_H_ 8 | #define COMPILER_TRANSLATOR_VALIDATEGLOBALINITIALIZER_H_ 9 | 10 | class TIntermTyped; 11 | class TParseContext; 12 | 13 | // Returns true if the initializer is valid. 14 | bool ValidateGlobalInitializer(TIntermTyped *initializer, const TParseContext *context, bool *warning); 15 | 16 | #endif // COMPILER_TRANSLATOR_VALIDATEGLOBALINITIALIZER_H_ 17 | -------------------------------------------------------------------------------- /src/compiler/translator/ValidateMaxParameters.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2016 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // ValidateMaxParameters checks if function definitions have more than a set number of parameters. 7 | 8 | #include "compiler/translator/ValidateMaxParameters.h" 9 | 10 | ValidateMaxParameters::ValidateMaxParameters(unsigned int maxParameters) 11 | : TIntermTraverser(true, false, false), mMaxParameters(maxParameters), mValid(true) 12 | { 13 | } 14 | 15 | bool ValidateMaxParameters::visitAggregate(Visit visit, TIntermAggregate *node) 16 | { 17 | if (!mValid) 18 | { 19 | return false; 20 | } 21 | 22 | if (node->getOp() == EOpParameters && node->getSequence()->size() > mMaxParameters) 23 | { 24 | mValid = false; 25 | } 26 | 27 | return mValid; 28 | } 29 | 30 | bool ValidateMaxParameters::validate(TIntermNode *root, unsigned int maxParameters) 31 | { 32 | ValidateMaxParameters argsTraverser(maxParameters); 33 | root->traverse(&argsTraverser); 34 | return argsTraverser.mValid; 35 | } 36 | -------------------------------------------------------------------------------- /src/compiler/translator/ValidateMaxParameters.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2016 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // ValidateMaxParameters checks if function definitions have more than a set number of parameters. 7 | 8 | #ifndef COMPILER_TRANSLATOR_VALIDATEMAXPARAMETERS_H_ 9 | #define COMPILER_TRANSLATOR_VALIDATEMAXPARAMETERS_H_ 10 | 11 | #include "compiler/translator/IntermNode.h" 12 | 13 | class ValidateMaxParameters : public TIntermTraverser 14 | { 15 | public: 16 | // Returns false if maxParameters is exceeded. 17 | static bool validate(TIntermNode *root, unsigned int maxParameters); 18 | 19 | protected: 20 | bool visitAggregate(Visit visit, TIntermAggregate *node) override; 21 | 22 | private: 23 | ValidateMaxParameters(unsigned int maxParameters); 24 | 25 | unsigned int mMaxParameters; 26 | bool mValid; 27 | }; 28 | 29 | #endif // COMPILER_TRANSLATOR_VALIDATEMAXPARAMETERS_H_ 30 | -------------------------------------------------------------------------------- /src/compiler/translator/ValidateOutputs.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2013 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef COMPILER_TRANSLATOR_VALIDATEOUTPUTS_H_ 8 | #define COMPILER_TRANSLATOR_VALIDATEOUTPUTS_H_ 9 | 10 | #include "compiler/translator/ExtensionBehavior.h" 11 | #include "compiler/translator/IntermNode.h" 12 | 13 | #include 14 | 15 | class TInfoSinkBase; 16 | 17 | class ValidateOutputs : public TIntermTraverser 18 | { 19 | public: 20 | ValidateOutputs(const TExtensionBehavior &extBehavior, int maxDrawBuffers); 21 | 22 | int validateAndCountErrors(TInfoSinkBase &sink) const; 23 | 24 | void visitSymbol(TIntermSymbol *) override; 25 | 26 | private: 27 | int mMaxDrawBuffers; 28 | bool mAllowUnspecifiedOutputLocationResolution; 29 | 30 | typedef std::vector OutputVector; 31 | OutputVector mOutputs; 32 | OutputVector mUnspecifiedLocationOutputs; 33 | std::set mVisitedSymbols; 34 | }; 35 | 36 | #endif // COMPILER_TRANSLATOR_VALIDATEOUTPUTS_H_ 37 | -------------------------------------------------------------------------------- /src/compiler/translator/depgraph/DependencyGraphOutput.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef COMPILER_TRANSLATOR_DEPGRAPH_DEPENDENCYGRAPHOUTPUT_H_ 8 | #define COMPILER_TRANSLATOR_DEPGRAPH_DEPENDENCYGRAPHOUTPUT_H_ 9 | 10 | #include "compiler/translator/depgraph/DependencyGraph.h" 11 | #include "compiler/translator/InfoSink.h" 12 | 13 | class TDependencyGraphOutput : public TDependencyGraphTraverser 14 | { 15 | public: 16 | TDependencyGraphOutput(TInfoSinkBase& sink) : mSink(sink) {} 17 | void visitSymbol(TGraphSymbol* symbol) override; 18 | void visitArgument(TGraphArgument* parameter) override; 19 | void visitFunctionCall(TGraphFunctionCall* functionCall) override; 20 | void visitSelection(TGraphSelection* selection) override; 21 | void visitLoop(TGraphLoop* loop) override; 22 | void visitLogicalOp(TGraphLogicalOp* logicalOp) override; 23 | 24 | void outputAllSpanningTrees(TDependencyGraph& graph); 25 | private: 26 | void outputIndentation(); 27 | 28 | TInfoSinkBase& mSink; 29 | }; 30 | 31 | #endif // COMPILER_TRANSLATOR_DEPGRAPH_DEPENDENCYGRAPHOUTPUT_H_ 32 | -------------------------------------------------------------------------------- /src/compiler/translator/generate_parser.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2010 The ANGLE Project Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | # Generates GLSL ES parser - glslang_lex.cpp, glslang_tab.h, and glslang_tab.cpp 7 | 8 | run_flex() 9 | { 10 | input_file=./$1.l 11 | output_source=./$1_lex.cpp 12 | flex --noline --nounistd --outfile=$output_source $input_file 13 | } 14 | 15 | run_bison() 16 | { 17 | input_file=./$1.y 18 | output_header=./$1_tab.h 19 | output_source=./$1_tab.cpp 20 | bison --no-lines --skeleton=yacc.c --defines=$output_header --output=$output_source $input_file 21 | } 22 | 23 | script_dir=$(dirname $0) 24 | 25 | # Generate Parser 26 | cd $script_dir 27 | run_flex glslang 28 | run_bison glslang 29 | patch --silent --forward < 64bit-lexer-safety.patch 30 | -------------------------------------------------------------------------------- /src/compiler/translator/glslang.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef COMPILER_TRANSLATOR_GLSLANG_H_ 8 | #define COMPILER_TRANSLATOR_GLSLANG_H_ 9 | 10 | class TParseContext; 11 | extern int glslang_initialize(TParseContext* context); 12 | extern int glslang_finalize(TParseContext* context); 13 | 14 | extern int glslang_scan(size_t count, 15 | const char* const string[], 16 | const int length[], 17 | TParseContext* context); 18 | extern int glslang_parse(TParseContext* context); 19 | 20 | #endif // COMPILER_TRANSLATOR_GLSLANG_H_ 21 | -------------------------------------------------------------------------------- /src/compiler/translator/length_limits.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2011-2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // 8 | // length_limits.h 9 | // 10 | 11 | #ifndef COMPILER_TRANSLATOR_LENGTHLIMITS_H_ 12 | #define COMPILER_TRANSLATOR_LENGTHLIMITS_H_ 13 | 14 | #include "GLSLANG/ShaderLang.h" 15 | 16 | // These constants are factored out from the rest of the headers to 17 | // make it easier to reference them from the compiler sources. 18 | 19 | size_t GetGlobalMaxTokenSize(ShShaderSpec spec); 20 | 21 | #endif // COMPILER_TRANSLATOR_LENGTHLIMITS_H_ 22 | -------------------------------------------------------------------------------- /src/compiler/translator/timing/RestrictVertexShaderTiming.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #include "compiler/translator/timing/RestrictVertexShaderTiming.h" 8 | 9 | void RestrictVertexShaderTiming::visitSymbol(TIntermSymbol* node) 10 | { 11 | if (IsSampler(node->getBasicType())) { 12 | ++mNumErrors; 13 | mSink.message(EPrefixError, 14 | node->getLine(), 15 | "Samplers are not permitted in vertex shaders.\n"); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/compiler/translator/timing/RestrictVertexShaderTiming.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef COMPILER_TRANSLATOR_TIMING_RESTRICTVERTEXSHADERTIMING_H_ 8 | #define COMPILER_TRANSLATOR_TIMING_RESTRICTVERTEXSHADERTIMING_H_ 9 | 10 | #include "compiler/translator/IntermNode.h" 11 | #include "compiler/translator/InfoSink.h" 12 | 13 | class TInfoSinkBase; 14 | 15 | class RestrictVertexShaderTiming : public TIntermTraverser { 16 | public: 17 | RestrictVertexShaderTiming(TInfoSinkBase& sink) 18 | : TIntermTraverser(true, false, false) 19 | , mSink(sink) 20 | , mNumErrors(0) {} 21 | 22 | void enforceRestrictions(TIntermNode* root) { root->traverse(this); } 23 | int numErrors() { return mNumErrors; } 24 | 25 | void visitSymbol(TIntermSymbol *) override; 26 | 27 | private: 28 | TInfoSinkBase& mSink; 29 | int mNumErrors; 30 | }; 31 | 32 | #endif // COMPILER_TRANSLATOR_TIMING_RESTRICTVERTEXSHADERTIMING_H_ 33 | -------------------------------------------------------------------------------- /src/copy_compiler_dll.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set _arch=%1 3 | set _arch=%_arch:Win32=x86% 4 | copy %2"\Redist\D3D\"%_arch%"\d3dcompiler_47.dll" %3 > NUL 5 | :: This is equivalent to `touch', see: 6 | :: https://technet.microsoft.com/en-us/library/bb490886.aspx 7 | :: This avoids rerunning because this batch file is also copied to the gen dir, 8 | :: so it's timestamp would otherwise be newer than the dll. 9 | copy /b %3\d3dcompiler_47.dll+,, %3\d3dcompiler_47.dll > NUL 10 | -------------------------------------------------------------------------------- /src/libANGLE/AttributeMap.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #include "libANGLE/AttributeMap.h" 8 | 9 | namespace egl 10 | { 11 | 12 | AttributeMap::AttributeMap() 13 | { 14 | } 15 | 16 | AttributeMap::AttributeMap(const EGLint *attributes) 17 | { 18 | if (attributes) 19 | { 20 | for (const EGLint *curAttrib = attributes; curAttrib[0] != EGL_NONE; curAttrib += 2) 21 | { 22 | insert(curAttrib[0], curAttrib[1]); 23 | } 24 | } 25 | } 26 | 27 | void AttributeMap::insert(EGLint key, EGLint value) 28 | { 29 | mAttributes[key] = value; 30 | } 31 | 32 | bool AttributeMap::contains(EGLint key) const 33 | { 34 | return (mAttributes.find(key) != mAttributes.end()); 35 | } 36 | 37 | EGLint AttributeMap::get(EGLint key, EGLint defaultValue) const 38 | { 39 | std::map::const_iterator iter = mAttributes.find(key); 40 | return (mAttributes.find(key) != mAttributes.end()) ? iter->second : defaultValue; 41 | } 42 | 43 | AttributeMap::const_iterator AttributeMap::begin() const 44 | { 45 | return mAttributes.begin(); 46 | } 47 | 48 | AttributeMap::const_iterator AttributeMap::end() const 49 | { 50 | return mAttributes.end(); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/libANGLE/AttributeMap.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef LIBANGLE_ATTRIBUTEMAP_H_ 8 | #define LIBANGLE_ATTRIBUTEMAP_H_ 9 | 10 | 11 | #include 12 | 13 | #include 14 | 15 | namespace egl 16 | { 17 | 18 | class AttributeMap final 19 | { 20 | public: 21 | AttributeMap(); 22 | explicit AttributeMap(const EGLint *attributes); 23 | 24 | void insert(EGLint key, EGLint value); 25 | bool contains(EGLint key) const; 26 | EGLint get(EGLint key, EGLint defaultValue) const; 27 | 28 | typedef std::map::const_iterator const_iterator; 29 | 30 | const_iterator begin() const; 31 | const_iterator end() const; 32 | 33 | private: 34 | std::map mAttributes; 35 | }; 36 | 37 | } 38 | 39 | #endif // LIBANGLE_ATTRIBUTEMAP_H_ 40 | -------------------------------------------------------------------------------- /src/libANGLE/Compiler.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // Compiler.h: Defines the gl::Compiler class, abstracting the ESSL compiler 8 | // that a GL context holds. 9 | 10 | #ifndef LIBANGLE_COMPILER_H_ 11 | #define LIBANGLE_COMPILER_H_ 12 | 13 | #include "libANGLE/Error.h" 14 | #include "GLSLANG/ShaderLang.h" 15 | 16 | namespace rx 17 | { 18 | class CompilerImpl; 19 | class ImplFactory; 20 | } 21 | 22 | namespace gl 23 | { 24 | struct Data; 25 | 26 | class Compiler final : angle::NonCopyable 27 | { 28 | public: 29 | Compiler(rx::ImplFactory *implFactory, const Data &data); 30 | ~Compiler(); 31 | 32 | Error release(); 33 | 34 | ShHandle getCompilerHandle(GLenum type); 35 | ShShaderOutput getShaderOutputType() const { return mOutputType; } 36 | 37 | private: 38 | rx::CompilerImpl *mImplementation; 39 | ShShaderSpec mSpec; 40 | ShShaderOutput mOutputType; 41 | ShBuiltInResources mResources; 42 | 43 | ShHandle mFragmentCompiler; 44 | ShHandle mVertexCompiler; 45 | }; 46 | 47 | } // namespace gl 48 | 49 | #endif // LIBANGLE_COMPILER_H_ 50 | -------------------------------------------------------------------------------- /src/libANGLE/Platform.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // Platform.cpp: Implementation methods for angle::Platform. 8 | 9 | #include 10 | 11 | #include "common/debug.h" 12 | 13 | namespace 14 | { 15 | angle::Platform *currentPlatform = nullptr; 16 | } 17 | 18 | // static 19 | angle::Platform *ANGLE_APIENTRY ANGLEPlatformCurrent() 20 | { 21 | return currentPlatform; 22 | } 23 | 24 | // static 25 | void ANGLE_APIENTRY ANGLEPlatformInitialize(angle::Platform *platformImpl) 26 | { 27 | ASSERT(platformImpl != nullptr); 28 | currentPlatform = platformImpl; 29 | } 30 | 31 | // static 32 | void ANGLE_APIENTRY ANGLEPlatformShutdown() 33 | { 34 | currentPlatform = nullptr; 35 | } 36 | -------------------------------------------------------------------------------- /src/libANGLE/Program_unittest.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // Unit tests for Program and related classes. 7 | // 8 | 9 | #include 10 | 11 | #include "tests/angle_unittests_utils.h" 12 | #include "libANGLE/Program.h" 13 | 14 | using namespace gl; 15 | 16 | namespace 17 | { 18 | 19 | // Tests that the log length properly counts the terminating \0. 20 | TEST(InfoLogTest, LogLengthCountsTerminator) 21 | { 22 | InfoLog infoLog; 23 | EXPECT_EQ(0u, infoLog.getLength()); 24 | infoLog << " "; 25 | 26 | // " \n\0" = 3 characters 27 | EXPECT_EQ(3u, infoLog.getLength()); 28 | } 29 | 30 | // Tests that newlines get appended to the info log properly. 31 | TEST(InfoLogTest, AppendingNewline) 32 | { 33 | InfoLog infoLog; 34 | 35 | infoLog << "First" << 1 << 'x'; 36 | infoLog << "Second" << 2 << 'y'; 37 | 38 | std::string expected = "First1x\nSecond2y\n"; 39 | 40 | EXPECT_EQ(expected, infoLog.str()); 41 | } 42 | 43 | } // namespace 44 | -------------------------------------------------------------------------------- /src/libANGLE/Query.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // Query.h: Defines the gl::Query class 8 | 9 | #ifndef LIBANGLE_QUERY_H_ 10 | #define LIBANGLE_QUERY_H_ 11 | 12 | #include "libANGLE/Debug.h" 13 | #include "libANGLE/Error.h" 14 | #include "libANGLE/RefCountObject.h" 15 | 16 | #include "common/angleutils.h" 17 | 18 | #include "angle_gl.h" 19 | 20 | namespace rx 21 | { 22 | class QueryImpl; 23 | } 24 | 25 | namespace gl 26 | { 27 | 28 | class Query final : public RefCountObject, public LabeledObject 29 | { 30 | public: 31 | Query(rx::QueryImpl *impl, GLuint id); 32 | virtual ~Query(); 33 | 34 | void setLabel(const std::string &label) override; 35 | const std::string &getLabel() const override; 36 | 37 | Error begin(); 38 | Error end(); 39 | Error queryCounter(); 40 | Error getResult(GLint *params); 41 | Error getResult(GLuint *params); 42 | Error getResult(GLint64 *params); 43 | Error getResult(GLuint64 *params); 44 | Error isResultAvailable(bool *available); 45 | 46 | GLenum getType() const; 47 | 48 | rx::QueryImpl *getImplementation(); 49 | const rx::QueryImpl *getImplementation() const; 50 | 51 | private: 52 | rx::QueryImpl *mQuery; 53 | 54 | std::string mLabel; 55 | }; 56 | 57 | } 58 | 59 | #endif // LIBANGLE_QUERY_H_ 60 | -------------------------------------------------------------------------------- /src/libANGLE/Stream.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2016 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // Stream.h: Defines the egl::Stream class, representing the stream 8 | // where frames are streamed in. Implements EGLStreanKHR. 9 | 10 | #ifndef LIBANGLE_STREAM_H_ 11 | #define LIBANGLE_STREAM_H_ 12 | 13 | #include 14 | #include 15 | 16 | #include "common/angleutils.h" 17 | #include "libANGLE/AttributeMap.h" 18 | 19 | namespace rx 20 | { 21 | class StreamImpl; 22 | } 23 | 24 | namespace egl 25 | { 26 | 27 | class Stream final : angle::NonCopyable 28 | { 29 | public: 30 | Stream(rx::StreamImpl *impl, const AttributeMap &attribs); 31 | ~Stream(); 32 | 33 | EGLenum getState() const; 34 | 35 | void setConsumerLatency(EGLint latency); 36 | EGLint getConsumerLatency() const; 37 | 38 | EGLuint64KHR getProducerFrame() const; 39 | EGLuint64KHR getConsumerFrame() const; 40 | 41 | private: 42 | // Implementation 43 | rx::StreamImpl *mImplementation; 44 | 45 | // EGL defined attributes 46 | EGLint mState; 47 | EGLuint64KHR mProducerFrame; 48 | EGLuint64KHR mConsumerFrame; 49 | EGLint mConsumerLatency; 50 | }; 51 | } // namespace egl 52 | 53 | #endif // LIBANGLE_STREAM_H_ 54 | -------------------------------------------------------------------------------- /src/libANGLE/Version.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // Version.h: Encapsulation of a GL version. 8 | 9 | #ifndef LIBANGLE_VERSION_H_ 10 | #define LIBANGLE_VERSION_H_ 11 | 12 | #include 13 | 14 | namespace gl 15 | { 16 | 17 | struct Version 18 | { 19 | Version(); 20 | Version(GLuint major, GLuint minor); 21 | 22 | GLuint major; 23 | GLuint minor; 24 | }; 25 | 26 | bool operator>=(const Version &a, const Version &b); 27 | bool operator<(const Version &a, const Version &b); 28 | 29 | } 30 | 31 | #include "Version.inl" 32 | 33 | #endif // LIBANGLE_VERSION_H_ 34 | -------------------------------------------------------------------------------- /src/libANGLE/Version.inl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // Version.inl: Encapsulation of a GL version. 8 | 9 | namespace gl 10 | { 11 | 12 | inline Version::Version() 13 | : Version(0, 0) 14 | { 15 | } 16 | 17 | inline Version::Version(GLuint major_, GLuint minor_) 18 | { 19 | major = major_; 20 | minor = minor_; 21 | } 22 | 23 | inline bool operator>=(const Version &a, const Version &b) 24 | { 25 | return a.major > b.major || (a.major == b.major && a.minor >= b.minor); 26 | } 27 | 28 | inline bool operator<(const Version &a, const Version &b) 29 | { 30 | return !(a >= b); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/libANGLE/queryconversions.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // queryconversions.h: Declaration of state query cast conversions 8 | 9 | #ifndef LIBANGLE_QUERY_CONVERSIONS_H_ 10 | #define LIBANGLE_QUERY_CONVERSIONS_H_ 11 | 12 | #include "angle_gl.h" 13 | #include "common/angleutils.h" 14 | 15 | namespace gl 16 | { 17 | class Context; 18 | 19 | // Helper class for converting a GL type to a GLenum: 20 | // We can't use CastStateValueEnum generally, because of GLboolean + GLubyte overlap. 21 | // We restrict our use to CastStateValue, where it eliminates duplicate parameters. 22 | 23 | template 24 | struct GLTypeToGLenum 25 | { 26 | static GLenum value; 27 | }; 28 | 29 | // The GL state query API types are: bool, int, uint, float, int64 30 | template 31 | void CastStateValues(Context *context, GLenum nativeType, GLenum pname, 32 | unsigned int numParams, QueryT *outParams); 33 | 34 | } 35 | 36 | #endif // LIBANGLE_QUERY_CONVERSIONS_H_ 37 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/BufferImpl_mock.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // BufferImpl_mock.h: Defines a mock of the BufferImpl class. 8 | 9 | #ifndef LIBANGLE_RENDERER_BUFFERIMPLMOCK_H_ 10 | #define LIBANGLE_RENDERER_BUFFERIMPLMOCK_H_ 11 | 12 | #include "gmock/gmock.h" 13 | 14 | #include "libANGLE/renderer/BufferImpl.h" 15 | 16 | namespace rx 17 | { 18 | 19 | class MockBufferImpl : public BufferImpl 20 | { 21 | public: 22 | ~MockBufferImpl() { destructor(); } 23 | 24 | MOCK_METHOD3(setData, gl::Error(const void*, size_t, GLenum)); 25 | MOCK_METHOD3(setSubData, gl::Error(const void*, size_t, size_t)); 26 | MOCK_METHOD4(copySubData, gl::Error(BufferImpl *, GLintptr, GLintptr, GLsizeiptr)); 27 | MOCK_METHOD2(map, gl::Error(GLenum, GLvoid **)); 28 | MOCK_METHOD4(mapRange, gl::Error(size_t, size_t, GLbitfield, GLvoid **)); 29 | MOCK_METHOD1(unmap, gl::Error(GLboolean *result)); 30 | 31 | MOCK_METHOD5(getIndexRange, gl::Error(GLenum, size_t, size_t, bool, gl::IndexRange *)); 32 | 33 | MOCK_METHOD0(destructor, void()); 34 | }; 35 | 36 | } 37 | 38 | #endif // LIBANGLE_RENDERER_BUFFERIMPLMOCK_H_ 39 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/CompilerImpl.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // CompilerImpl.h: Defines the rx::CompilerImpl class, an implementation interface 8 | // for the gl::Compiler object. 9 | 10 | #include "common/angleutils.h" 11 | #include "GLSLANG/ShaderLang.h" 12 | #include "libANGLE/Error.h" 13 | 14 | #ifndef LIBANGLE_RENDERER_COMPILERIMPL_H_ 15 | #define LIBANGLE_RENDERER_COMPILERIMPL_H_ 16 | 17 | namespace rx 18 | { 19 | 20 | class CompilerImpl : angle::NonCopyable 21 | { 22 | public: 23 | CompilerImpl() {} 24 | virtual ~CompilerImpl() {} 25 | 26 | virtual gl::Error release() = 0; 27 | 28 | // TODO(jmadill): Expose translator built-in resources init method. 29 | virtual ShShaderOutput getTranslatorOutputType() const = 0; 30 | }; 31 | 32 | } 33 | 34 | #endif // LIBANGLE_RENDERER_COMPILERIMPL_H_ 35 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/DeviceImpl.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // DeviceImpl.cpp: Implementation methods of egl::Device 8 | 9 | #include "libANGLE/renderer/DeviceImpl.h" 10 | 11 | namespace rx 12 | { 13 | 14 | DeviceImpl::DeviceImpl() 15 | { 16 | } 17 | 18 | DeviceImpl::~DeviceImpl() 19 | { 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/DeviceImpl.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // DeviceImpl.h: Implementation methods of egl::Device 8 | 9 | #ifndef LIBANGLE_RENDERER_DEVICEIMPL_H_ 10 | #define LIBANGLE_RENDERER_DEVICEIMPL_H_ 11 | 12 | #include "common/angleutils.h" 13 | #include "libANGLE/Error.h" 14 | #include "libANGLE/Caps.h" 15 | 16 | namespace egl 17 | { 18 | class Device; 19 | } 20 | 21 | namespace rx 22 | { 23 | class DeviceImpl : angle::NonCopyable 24 | { 25 | public: 26 | DeviceImpl(); 27 | virtual ~DeviceImpl(); 28 | 29 | virtual egl::Error getDevice(void **outValue) = 0; 30 | virtual EGLint getType() = 0; 31 | virtual void generateExtensions(egl::DeviceExtensions *outExtensions) const = 0; 32 | virtual bool deviceExternallySourced() = 0; 33 | }; 34 | 35 | } 36 | 37 | #endif // LIBANGLE_RENDERER_DEVICEIMPL_H_ 38 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/DisplayImpl.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // DisplayImpl.cpp: Implementation methods of egl::Display 8 | 9 | #include "libANGLE/renderer/DisplayImpl.h" 10 | 11 | #include "libANGLE/Surface.h" 12 | 13 | namespace rx 14 | { 15 | 16 | DisplayImpl::DisplayImpl() 17 | : mExtensionsInitialized(false), 18 | mCapsInitialized(false) 19 | { 20 | } 21 | 22 | DisplayImpl::~DisplayImpl() 23 | { 24 | ASSERT(mSurfaceSet.empty()); 25 | } 26 | 27 | void DisplayImpl::destroySurface(egl::Surface *surface) 28 | { 29 | mSurfaceSet.erase(surface); 30 | surface->onDestroy(); 31 | } 32 | 33 | const egl::DisplayExtensions &DisplayImpl::getExtensions() const 34 | { 35 | if (!mExtensionsInitialized) 36 | { 37 | generateExtensions(&mExtensions); 38 | mExtensionsInitialized = true; 39 | } 40 | 41 | return mExtensions; 42 | } 43 | 44 | const egl::Caps &DisplayImpl::getCaps() const 45 | { 46 | if (!mCapsInitialized) 47 | { 48 | generateCaps(&mCaps); 49 | mCapsInitialized = true; 50 | } 51 | 52 | return mCaps; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/FenceNVImpl.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // FenceNVImpl.h: Defines the rx::FenceNVImpl class. 8 | 9 | #ifndef LIBANGLE_RENDERER_FENCENVIMPL_H_ 10 | #define LIBANGLE_RENDERER_FENCENVIMPL_H_ 11 | 12 | #include "libANGLE/Error.h" 13 | 14 | #include "common/angleutils.h" 15 | 16 | #include "angle_gl.h" 17 | 18 | namespace rx 19 | { 20 | 21 | class FenceNVImpl : angle::NonCopyable 22 | { 23 | public: 24 | FenceNVImpl() { }; 25 | virtual ~FenceNVImpl() { }; 26 | 27 | virtual gl::Error set(GLenum condition) = 0; 28 | virtual gl::Error test(GLboolean *outFinished) = 0; 29 | virtual gl::Error finish() = 0; 30 | }; 31 | 32 | } 33 | 34 | #endif // LIBANGLE_RENDERER_FENCENVIMPL_H_ 35 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/FenceSyncImpl.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // FenceSyncImpl.h: Defines the rx::FenceSyncImpl class. 8 | 9 | #ifndef LIBANGLE_RENDERER_FENCESYNCIMPL_H_ 10 | #define LIBANGLE_RENDERER_FENCESYNCIMPL_H_ 11 | 12 | #include "libANGLE/Error.h" 13 | 14 | #include "common/angleutils.h" 15 | 16 | #include "angle_gl.h" 17 | 18 | namespace rx 19 | { 20 | 21 | class FenceSyncImpl : angle::NonCopyable 22 | { 23 | public: 24 | FenceSyncImpl() { }; 25 | virtual ~FenceSyncImpl() { }; 26 | 27 | virtual gl::Error set(GLenum condition, GLbitfield flags) = 0; 28 | virtual gl::Error clientWait(GLbitfield flags, GLuint64 timeout, GLenum *outResult) = 0; 29 | virtual gl::Error serverWait(GLbitfield flags, GLuint64 timeout) = 0; 30 | virtual gl::Error getStatus(GLint *outResult) = 0; 31 | }; 32 | 33 | } 34 | 35 | #endif // LIBANGLE_RENDERER_FENCESYNCIMPL_H_ 36 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/ImageImpl.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // ImageImpl.h: Defines the rx::ImageImpl class representing the EGLimage object. 8 | 9 | #ifndef LIBANGLE_RENDERER_IMAGEIMPL_H_ 10 | #define LIBANGLE_RENDERER_IMAGEIMPL_H_ 11 | 12 | #include "common/angleutils.h" 13 | #include "libANGLE/Error.h" 14 | 15 | namespace egl 16 | { 17 | class ImageSibling; 18 | } 19 | 20 | namespace rx 21 | { 22 | class ImageImpl : angle::NonCopyable 23 | { 24 | public: 25 | virtual ~ImageImpl() {} 26 | virtual egl::Error initialize() = 0; 27 | 28 | virtual gl::Error orphan(egl::ImageSibling *sibling) = 0; 29 | }; 30 | } 31 | 32 | #endif // LIBANGLE_RENDERER_IMAGEIMPL_H_ 33 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/ImageImpl_mock.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // ImageImpl_mock.h: Defines a mock of the ImageImpl class. 8 | 9 | #ifndef LIBANGLE_RENDERER_IMAGEIMPLMOCK_H_ 10 | #define LIBANGLE_RENDERER_IMAGEIMPLMOCK_H_ 11 | 12 | #include "gmock/gmock.h" 13 | 14 | #include "libANGLE/renderer/ImageImpl.h" 15 | 16 | namespace rx 17 | { 18 | class MockImageImpl : public ImageImpl 19 | { 20 | public: 21 | virtual ~MockImageImpl() { destructor(); } 22 | MOCK_METHOD0(initialize, egl::Error(void)); 23 | MOCK_METHOD1(orphan, gl::Error(egl::ImageSibling *)); 24 | MOCK_METHOD0(destructor, void()); 25 | }; 26 | } 27 | 28 | #endif // LIBANGLE_RENDERER_IMAGEIMPLMOCK_H_ 29 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/QueryImpl.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2013 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // QueryImpl.h: Defines the abstract rx::QueryImpl class. 8 | 9 | #ifndef LIBANGLE_RENDERER_QUERYIMPL_H_ 10 | #define LIBANGLE_RENDERER_QUERYIMPL_H_ 11 | 12 | #include "libANGLE/Error.h" 13 | 14 | #include "common/angleutils.h" 15 | 16 | #include 17 | 18 | namespace rx 19 | { 20 | 21 | class QueryImpl : angle::NonCopyable 22 | { 23 | public: 24 | explicit QueryImpl(GLenum type) { mType = type; } 25 | virtual ~QueryImpl() { } 26 | 27 | virtual gl::Error begin() = 0; 28 | virtual gl::Error end() = 0; 29 | virtual gl::Error queryCounter() = 0; 30 | virtual gl::Error getResult(GLint *params) = 0; 31 | virtual gl::Error getResult(GLuint *params) = 0; 32 | virtual gl::Error getResult(GLint64 *params) = 0; 33 | virtual gl::Error getResult(GLuint64 *params) = 0; 34 | virtual gl::Error isResultAvailable(bool *available) = 0; 35 | 36 | GLenum getType() const { return mType; } 37 | 38 | private: 39 | GLenum mType; 40 | }; 41 | 42 | } 43 | 44 | #endif // LIBANGLE_RENDERER_QUERYIMPL_H_ 45 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/RenderbufferImpl.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // RenderbufferImpl.h: Defines the abstract class gl::RenderbufferImpl 8 | 9 | #ifndef LIBANGLE_RENDERER_RENDERBUFFERIMPL_H_ 10 | #define LIBANGLE_RENDERER_RENDERBUFFERIMPL_H_ 11 | 12 | #include "angle_gl.h" 13 | #include "common/angleutils.h" 14 | #include "libANGLE/Error.h" 15 | #include "libANGLE/FramebufferAttachment.h" 16 | 17 | namespace egl 18 | { 19 | class Image; 20 | } 21 | 22 | namespace rx 23 | { 24 | 25 | class RenderbufferImpl : public FramebufferAttachmentObjectImpl 26 | { 27 | public: 28 | RenderbufferImpl() {} 29 | virtual ~RenderbufferImpl() {} 30 | 31 | virtual gl::Error setStorage(GLenum internalformat, size_t width, size_t height) = 0; 32 | virtual gl::Error setStorageMultisample(size_t samples, GLenum internalformat, size_t width, size_t height) = 0; 33 | virtual gl::Error setStorageEGLImageTarget(egl::Image *image) = 0; 34 | }; 35 | 36 | } 37 | 38 | #endif // LIBANGLE_RENDERER_RENDERBUFFERIMPL_H_ 39 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/RenderbufferImpl_mock.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // RenderbufferImpl_mock.h: Defines a mock of the RenderbufferImpl class. 8 | 9 | #ifndef LIBANGLE_RENDERER_RENDERBUFFERIMPLMOCK_H_ 10 | #define LIBANGLE_RENDERER_RENDERBUFFERIMPLMOCK_H_ 11 | 12 | #include "gmock/gmock.h" 13 | 14 | #include "libANGLE/Image.h" 15 | #include "libANGLE/renderer/RenderbufferImpl.h" 16 | 17 | namespace rx 18 | { 19 | 20 | class MockRenderbufferImpl : public RenderbufferImpl 21 | { 22 | public: 23 | virtual ~MockRenderbufferImpl() { destructor(); } 24 | MOCK_METHOD3(setStorage, gl::Error(GLenum, size_t, size_t)); 25 | MOCK_METHOD4(setStorageMultisample, gl::Error(size_t, GLenum, size_t, size_t)); 26 | MOCK_METHOD1(setStorageEGLImageTarget, gl::Error(egl::Image *)); 27 | 28 | MOCK_METHOD2(getAttachmentRenderTarget, gl::Error(const gl::FramebufferAttachment::Target &, FramebufferAttachmentRenderTarget **)); 29 | 30 | MOCK_METHOD0(destructor, void()); 31 | }; 32 | 33 | } 34 | 35 | #endif // LIBANGLE_RENDERER_RENDERBUFFERIMPLMOCK_H_ 36 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/Renderer.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012-2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // Renderer.cpp: Implements EGL dependencies for creating and destroying Renderer instances. 8 | 9 | #include "common/utilities.h" 10 | #include "libANGLE/AttributeMap.h" 11 | #include "libANGLE/renderer/Renderer.h" 12 | 13 | #include 14 | 15 | namespace rx 16 | { 17 | Renderer::Renderer() : mCapsInitialized(false) 18 | { 19 | } 20 | 21 | Renderer::~Renderer() 22 | { 23 | } 24 | 25 | void Renderer::ensureCapsInitialized() const 26 | { 27 | if (!mCapsInitialized) 28 | { 29 | generateCaps(&mCaps, &mTextureCaps, &mExtensions, &mLimitations); 30 | mCapsInitialized = true; 31 | } 32 | } 33 | 34 | const gl::Caps &Renderer::getRendererCaps() const 35 | { 36 | ensureCapsInitialized(); 37 | 38 | return mCaps; 39 | } 40 | 41 | const gl::TextureCapsMap &Renderer::getRendererTextureCaps() const 42 | { 43 | ensureCapsInitialized(); 44 | 45 | return mTextureCaps; 46 | } 47 | 48 | const gl::Extensions &Renderer::getRendererExtensions() const 49 | { 50 | ensureCapsInitialized(); 51 | 52 | return mExtensions; 53 | } 54 | 55 | const gl::Limitations &Renderer::getRendererLimitations() const 56 | { 57 | ensureCapsInitialized(); 58 | 59 | return mLimitations; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/SamplerImpl.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // SamplerImpl.h: Defines the abstract rx::SamplerImpl class. 8 | 9 | #ifndef LIBANGLE_RENDERER_SAMPLERIMPL_H_ 10 | #define LIBANGLE_RENDERER_SAMPLERIMPL_H_ 11 | 12 | #include "common/angleutils.h" 13 | 14 | namespace rx 15 | { 16 | 17 | class SamplerImpl : public angle::NonCopyable 18 | { 19 | public: 20 | SamplerImpl() {} 21 | virtual ~SamplerImpl() {} 22 | }; 23 | } 24 | 25 | #endif // LIBANGLE_RENDERER_SAMPLERIMPL_H_ 26 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/ShaderImpl.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // ShaderImpl.h: Defines the abstract rx::ShaderImpl class. 8 | 9 | #ifndef LIBANGLE_RENDERER_SHADERIMPL_H_ 10 | #define LIBANGLE_RENDERER_SHADERIMPL_H_ 11 | 12 | #include "common/angleutils.h" 13 | #include "libANGLE/Shader.h" 14 | 15 | namespace rx 16 | { 17 | 18 | class ShaderImpl : angle::NonCopyable 19 | { 20 | public: 21 | ShaderImpl(const gl::Shader::Data &data) : mData(data) {} 22 | virtual ~ShaderImpl() { } 23 | 24 | // Returns additional ShCompile options. 25 | virtual int prepareSourceAndReturnOptions(std::stringstream *sourceStream, 26 | std::string *sourcePath) = 0; 27 | // Returns success for compiling on the driver. Returns success. 28 | virtual bool postTranslateCompile(gl::Compiler *compiler, std::string *infoLog) = 0; 29 | 30 | virtual std::string getDebugInfo() const = 0; 31 | 32 | const gl::Shader::Data &getData() const { return mData; } 33 | 34 | protected: 35 | const gl::Shader::Data &mData; 36 | }; 37 | 38 | } 39 | 40 | #endif // LIBANGLE_RENDERER_SHADERIMPL_H_ 41 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/StreamImpl.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2016 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // StreamImpl.h: Defines the abstract rx::StreamImpl class. 8 | 9 | #ifndef LIBANGLE_RENDERER_STREAMIMPL_H_ 10 | #define LIBANGLE_RENDERER_STREAMIMPL_H_ 11 | 12 | #include "common/angleutils.h" 13 | 14 | namespace rx 15 | { 16 | 17 | class StreamImpl : angle::NonCopyable 18 | { 19 | public: 20 | explicit StreamImpl() {} 21 | virtual ~StreamImpl() {} 22 | }; 23 | } // namespace rx 24 | 25 | #endif // LIBANGLE_RENDERER_STREAMIMPL_H_ 26 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/SurfaceImpl.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // SurfaceImpl.cpp: Implementation of Surface stub method class 8 | 9 | #include "libANGLE/renderer/SurfaceImpl.h" 10 | 11 | namespace rx 12 | { 13 | 14 | SurfaceImpl::SurfaceImpl() 15 | { 16 | } 17 | 18 | SurfaceImpl::~SurfaceImpl() 19 | { 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/TransformFeedbackImpl.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // TransformFeedbackImpl.h: Defines the abstract rx::TransformFeedbackImpl class. 8 | 9 | #ifndef LIBANGLE_RENDERER_TRANSFORMFEEDBACKIMPL_H_ 10 | #define LIBANGLE_RENDERER_TRANSFORMFEEDBACKIMPL_H_ 11 | 12 | #include "common/angleutils.h" 13 | #include "libANGLE/TransformFeedback.h" 14 | 15 | namespace rx 16 | { 17 | 18 | class TransformFeedbackImpl : angle::NonCopyable 19 | { 20 | public: 21 | virtual ~TransformFeedbackImpl() { } 22 | 23 | virtual void begin(GLenum primitiveMode) = 0; 24 | virtual void end() = 0; 25 | virtual void pause() = 0; 26 | virtual void resume() = 0; 27 | 28 | virtual void bindGenericBuffer(const BindingPointer &binding) = 0; 29 | virtual void bindIndexedBuffer(size_t index, const OffsetBindingPointer &binding) = 0; 30 | }; 31 | 32 | } 33 | 34 | #endif // LIBANGLE_RENDERER_TRANSFORMFEEDBACKIMPL_H_ 35 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/TransformFeedbackImpl_mock.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // TransformFeedbackImpl_mock.h: Defines a mock of the TransformFeedbackImpl class. 8 | 9 | #ifndef LIBANGLE_RENDERER_TRANSFORMFEEDBACKIMPLMOCK_H_ 10 | #define LIBANGLE_RENDERER_TRANSFORMFEEDBACKIMPLMOCK_H_ 11 | 12 | #include "gmock/gmock.h" 13 | 14 | #include "libANGLE/renderer/TransformFeedbackImpl.h" 15 | 16 | namespace rx 17 | { 18 | 19 | class MockTransformFeedbackImpl : public TransformFeedbackImpl 20 | { 21 | public: 22 | ~MockTransformFeedbackImpl() { destructor(); } 23 | 24 | MOCK_METHOD1(begin, void(GLenum primitiveMode)); 25 | MOCK_METHOD0(end, void()); 26 | MOCK_METHOD0(pause, void()); 27 | MOCK_METHOD0(resume, void()); 28 | 29 | MOCK_METHOD1(bindGenericBuffer, void(const BindingPointer &)); 30 | MOCK_METHOD2(bindIndexedBuffer, void(size_t, const OffsetBindingPointer &)); 31 | 32 | MOCK_METHOD0(destructor, void()); 33 | }; 34 | 35 | } 36 | 37 | #endif // LIBANGLE_RENDERER_TRANSFORMFEEDBACKIMPLMOCK_H_ 38 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/VertexArrayImpl.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // VertexAttribImpl.h: Defines the abstract rx::VertexAttribImpl class. 8 | 9 | #ifndef LIBANGLE_RENDERER_VERTEXARRAYIMPL_H_ 10 | #define LIBANGLE_RENDERER_VERTEXARRAYIMPL_H_ 11 | 12 | #include "common/angleutils.h" 13 | #include "libANGLE/Buffer.h" 14 | #include "libANGLE/VertexArray.h" 15 | 16 | namespace rx 17 | { 18 | 19 | class VertexArrayImpl : angle::NonCopyable 20 | { 21 | public: 22 | VertexArrayImpl(const gl::VertexArray::Data &data) : mData(data) { } 23 | virtual ~VertexArrayImpl() { } 24 | virtual void syncState(const gl::VertexArray::DirtyBits &dirtyBits) {} 25 | protected: 26 | const gl::VertexArray::Data &mData; 27 | }; 28 | 29 | } 30 | 31 | #endif // LIBANGLE_RENDERER_VERTEXARRAYIMPL_H_ 32 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/d3d/CompilerD3D.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // CompilerD3D: 7 | // Implementation of the D3D compiler methods. 8 | // 9 | 10 | #include "libANGLE/renderer/d3d/CompilerD3D.h" 11 | 12 | namespace rx 13 | { 14 | 15 | CompilerD3D::CompilerD3D(ShShaderOutput translatorOutputType) 16 | : mTranslatorOutputType(translatorOutputType) 17 | { 18 | } 19 | 20 | } // namespace rx 21 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/d3d/CompilerD3D.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // CompilerD3D.h: Defines the rx::CompilerD3D class, an implementation of rx::CompilerImpl. 8 | 9 | #ifndef LIBANGLE_RENDERER_COMPILERD3D_H_ 10 | #define LIBANGLE_RENDERER_COMPILERD3D_H_ 11 | 12 | #include "libANGLE/renderer/CompilerImpl.h" 13 | #include "libANGLE/renderer/d3d/RendererD3D.h" 14 | 15 | namespace rx 16 | { 17 | 18 | class CompilerD3D : public CompilerImpl 19 | { 20 | public: 21 | CompilerD3D(ShShaderOutput translatorOutputType); 22 | ~CompilerD3D() override {} 23 | 24 | gl::Error release() override { return gl::Error(GL_NO_ERROR); } 25 | ShShaderOutput getTranslatorOutputType() const override { return mTranslatorOutputType; } 26 | 27 | private: 28 | ShShaderOutput mTranslatorOutputType; 29 | }; 30 | 31 | } 32 | 33 | #endif // LIBANGLE_RENDERER_COMPILERD3D_H_ 34 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/d3d/DeviceD3D.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // DeviceD3D.h: D3D implementation of egl::Device 8 | 9 | #ifndef LIBANGLE_RENDERER_D3D_DEVICED3D_H_ 10 | #define LIBANGLE_RENDERER_D3D_DEVICED3D_H_ 11 | 12 | #include "libANGLE/Device.h" 13 | #include "libANGLE/renderer/DeviceImpl.h" 14 | #include "libANGLE/renderer/d3d/RendererD3D.h" 15 | 16 | namespace rx 17 | { 18 | class DeviceD3D : public DeviceImpl 19 | { 20 | public: 21 | DeviceD3D(); 22 | ~DeviceD3D() override; 23 | 24 | egl::Error initialize(void *device, EGLint deviceType, EGLBoolean external); 25 | egl::Error getDevice(void **outValue) override; 26 | EGLint getType() override; 27 | void generateExtensions(egl::DeviceExtensions *outExtensions) const override; 28 | bool deviceExternallySourced() override { return mDeviceExternallySourced; } 29 | 30 | private: 31 | void *mDevice; 32 | EGLint mDeviceType; 33 | bool mDeviceExternallySourced; 34 | bool mIsInitialized; 35 | }; 36 | 37 | } 38 | 39 | #endif // LIBANGLE_RENDERER_D3D_DEVICED3D_H_ 40 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/d3d/ImageD3D.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // Image.h: Implements the rx::Image class, an abstract base class for the 8 | // renderer-specific classes which will define the interface to the underlying 9 | // surfaces or resources. 10 | 11 | #include "libANGLE/renderer/d3d/ImageD3D.h" 12 | 13 | #include "libANGLE/Framebuffer.h" 14 | #include "libANGLE/FramebufferAttachment.h" 15 | #include "libANGLE/renderer/d3d/FramebufferD3D.h" 16 | #include "libANGLE/renderer/d3d/RenderTargetD3D.h" 17 | 18 | namespace rx 19 | { 20 | 21 | ImageD3D::ImageD3D() 22 | : mWidth(0), 23 | mHeight(0), 24 | mDepth(0), 25 | mInternalFormat(GL_NONE), 26 | mRenderable(false), 27 | mTarget(GL_NONE), 28 | mDirty(false) 29 | { 30 | } 31 | 32 | } // namespace rx 33 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/d3d/RenderTargetD3D.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012-2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // RenderTargetD3D.cpp: Implements serial handling for rx::RenderTargetD3D 8 | 9 | #include "libANGLE/renderer/d3d/RenderTargetD3D.h" 10 | 11 | namespace rx 12 | { 13 | unsigned int RenderTargetD3D::mCurrentSerial = 1; 14 | 15 | RenderTargetD3D::RenderTargetD3D() 16 | : mSerial(issueSerials(1)) 17 | { 18 | } 19 | 20 | RenderTargetD3D::~RenderTargetD3D() 21 | { 22 | } 23 | 24 | unsigned int RenderTargetD3D::getSerial() const 25 | { 26 | return mSerial; 27 | } 28 | 29 | unsigned int RenderTargetD3D::issueSerials(unsigned int count) 30 | { 31 | unsigned int firstSerial = mCurrentSerial; 32 | mCurrentSerial += count; 33 | return firstSerial; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/d3d/SamplerD3D.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // SamplerD3D.h: Defines the rx::SamplerD3D class, an implementation of SamplerImpl. 8 | 9 | #ifndef LIBANGLE_RENDERER_D3D_SAMPLERD3D_H_ 10 | #define LIBANGLE_RENDERER_D3D_SAMPLERD3D_H_ 11 | 12 | #include "libANGLE/renderer/SamplerImpl.h" 13 | 14 | namespace rx 15 | { 16 | 17 | class SamplerD3D : public SamplerImpl 18 | { 19 | public: 20 | SamplerD3D() {} 21 | ~SamplerD3D() override {} 22 | }; 23 | } 24 | 25 | #endif // LIBANGLE_RENDERER_D3D_SAMPLERD3D_H_ 26 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/d3d/ShaderExecutableD3D.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012-2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // ShaderExecutable.h: Defines a class to contain D3D shader executable 8 | // implementation details. 9 | 10 | #ifndef LIBANGLE_RENDERER_D3D_SHADEREXECUTABLED3D_H_ 11 | #define LIBANGLE_RENDERER_D3D_SHADEREXECUTABLED3D_H_ 12 | 13 | #include "common/debug.h" 14 | 15 | #include 16 | #include 17 | 18 | namespace rx 19 | { 20 | 21 | class ShaderExecutableD3D : angle::NonCopyable 22 | { 23 | public: 24 | ShaderExecutableD3D(const void *function, size_t length); 25 | virtual ~ShaderExecutableD3D(); 26 | 27 | const uint8_t *getFunction() const; 28 | 29 | size_t getLength() const; 30 | 31 | const std::string &getDebugInfo() const; 32 | 33 | void appendDebugInfo(const std::string &info); 34 | 35 | private: 36 | std::vector mFunctionBuffer; 37 | std::string mDebugInfo; 38 | }; 39 | 40 | class UniformStorageD3D : angle::NonCopyable 41 | { 42 | public: 43 | UniformStorageD3D(size_t initialSize); 44 | virtual ~UniformStorageD3D(); 45 | 46 | size_t size() const; 47 | 48 | private: 49 | size_t mSize; 50 | }; 51 | 52 | } 53 | 54 | #endif // LIBANGLE_RENDERER_D3D_SHADEREXECUTABLED3D_H_ 55 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/d3d/TransformFeedbackD3D.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // TransformFeedbackD3D.cpp is a no-op implementation for both the D3D9 and D3D11 renderers. 8 | 9 | #include "libANGLE/renderer/d3d/TransformFeedbackD3D.h" 10 | 11 | namespace rx 12 | { 13 | 14 | TransformFeedbackD3D::TransformFeedbackD3D() 15 | { 16 | } 17 | 18 | TransformFeedbackD3D::~TransformFeedbackD3D() 19 | { 20 | } 21 | 22 | void TransformFeedbackD3D::begin(GLenum primitiveMode) 23 | { 24 | } 25 | 26 | void TransformFeedbackD3D::end() 27 | { 28 | } 29 | 30 | void TransformFeedbackD3D::pause() 31 | { 32 | } 33 | 34 | void TransformFeedbackD3D::resume() 35 | { 36 | } 37 | 38 | void TransformFeedbackD3D::bindGenericBuffer(const BindingPointer &binding) 39 | { 40 | } 41 | 42 | void TransformFeedbackD3D::bindIndexedBuffer(size_t index, const OffsetBindingPointer &binding) 43 | { 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/d3d/TransformFeedbackD3D.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // TransformFeedbackD3D.h: Implements the abstract rx::TransformFeedbackImpl class. 8 | 9 | #ifndef LIBANGLE_RENDERER_D3D_TRANSFORMFEEDBACKD3D_H_ 10 | #define LIBANGLE_RENDERER_D3D_TRANSFORMFEEDBACKD3D_H_ 11 | 12 | #include "libANGLE/renderer/TransformFeedbackImpl.h" 13 | #include "libANGLE/angletypes.h" 14 | 15 | namespace rx 16 | { 17 | 18 | class TransformFeedbackD3D : public TransformFeedbackImpl 19 | { 20 | public: 21 | TransformFeedbackD3D(); 22 | virtual ~TransformFeedbackD3D(); 23 | 24 | void begin(GLenum primitiveMode) override; 25 | void end() override; 26 | void pause() override; 27 | void resume() override; 28 | 29 | void bindGenericBuffer(const BindingPointer &binding) override; 30 | void bindIndexedBuffer(size_t index, const OffsetBindingPointer &binding) override; 31 | }; 32 | 33 | } 34 | 35 | #endif // LIBANGLE_RENDERER_D3D_TRANSFORMFEEDBACKD3D_H_ 36 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/d3d/copyimage.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2013 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // copyimage.cpp: Defines image copying functions 8 | 9 | #include "libANGLE/renderer/d3d/copyimage.h" 10 | 11 | namespace rx 12 | { 13 | 14 | void CopyBGRA8ToRGBA8(const uint8_t *source, uint8_t *dest) 15 | { 16 | uint32_t argb = *reinterpret_cast(source); 17 | *reinterpret_cast(dest) = (argb & 0xFF00FF00) | // Keep alpha and green 18 | (argb & 0x00FF0000) >> 16 | // Move red to blue 19 | (argb & 0x000000FF) << 16; // Move blue to red 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/d3d/copyimage.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2013-2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // copyimage.h: Defines image copying functions 8 | 9 | #ifndef LIBANGLE_RENDERER_D3D_COPYIMAGE_H_ 10 | #define LIBANGLE_RENDERER_D3D_COPYIMAGE_H_ 11 | 12 | #include "common/mathutil.h" 13 | #include "libANGLE/angletypes.h" 14 | 15 | #include 16 | 17 | namespace rx 18 | { 19 | 20 | template 21 | void ReadColor(const uint8_t *source, uint8_t *dest); 22 | 23 | template 24 | void WriteColor(const uint8_t *source, uint8_t *dest); 25 | 26 | template 27 | void CopyPixel(const uint8_t *source, uint8_t *dest); 28 | 29 | void CopyBGRA8ToRGBA8(const uint8_t *source, uint8_t *dest); 30 | 31 | } 32 | 33 | #include "copyimage.inl" 34 | 35 | #endif // LIBANGLE_RENDERER_D3D_COPYIMAGE_H_ 36 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/d3d/copyimage.inl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // copyimage.inl: Defines image copying functions 8 | 9 | namespace rx 10 | { 11 | 12 | template 13 | inline void ReadColor(const uint8_t *source, uint8_t *dest) 14 | { 15 | sourceType::readColor(reinterpret_cast*>(dest), reinterpret_cast(source)); 16 | } 17 | 18 | template 19 | inline void WriteColor(const uint8_t *source, uint8_t *dest) 20 | { 21 | destType::writeColor(reinterpret_cast(dest), reinterpret_cast*>(source)); 22 | } 23 | 24 | template 25 | inline void CopyPixel(const uint8_t *source, uint8_t *dest) 26 | { 27 | colorDataType temp; 28 | ReadColor(source, &temp); 29 | WriteColor(&temp, dest); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // DebugAnnotator11.h: D3D11 helpers for adding trace annotations. 7 | // 8 | 9 | #ifndef LIBANGLE_RENDERER_D3D_D3D11_DEBUGANNOTATOR11_H_ 10 | #define LIBANGLE_RENDERER_D3D_D3D11_DEBUGANNOTATOR11_H_ 11 | 12 | #include "common/debug.h" 13 | 14 | namespace rx 15 | { 16 | 17 | class DebugAnnotator11 : public gl::DebugAnnotator 18 | { 19 | public: 20 | DebugAnnotator11(); 21 | ~DebugAnnotator11() override; 22 | void beginEvent(const wchar_t *eventName) override; 23 | void endEvent() override; 24 | void setMarker(const wchar_t *markerName) override; 25 | bool getStatus() override; 26 | 27 | private: 28 | void initializeDevice(); 29 | 30 | bool mInitialized; 31 | HMODULE mD3d11Module; 32 | ID3DUserDefinedAnnotation *mUserDefinedAnnotation; 33 | }; 34 | 35 | } 36 | 37 | #endif // LIBANGLE_RENDERER_D3D_D3D11_DEBUGANNOTATOR11_H_ 38 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/d3d/d3d11/Stream11.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2016 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // Stream11.cpp: Defines the rx::Stream11 class which implements rx::StreamImpl. 8 | 9 | #include "libANGLE/renderer/d3d/d3d11/Stream11.h" 10 | 11 | #include "common/utilities.h" 12 | #include "libANGLE/renderer/d3d/d3d11/Renderer11.h" 13 | #include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h" 14 | 15 | namespace rx 16 | { 17 | 18 | Stream11::Stream11(Renderer11 *renderer) : mRenderer(renderer) 19 | { 20 | UNUSED_VARIABLE(mRenderer); 21 | } 22 | 23 | Stream11::~Stream11() 24 | { 25 | } 26 | } // namespace rx 27 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/d3d/d3d11/Stream11.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2016 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // Stream11.h: Defines the rx::Stream11 class which implements rx::StreamImpl. 8 | 9 | #ifndef LIBANGLE_RENDERER_D3D_D3D11_STREAM11_H_ 10 | #define LIBANGLE_RENDERER_D3D_D3D11_STREAM11_H_ 11 | 12 | #include "libANGLE/renderer/StreamImpl.h" 13 | 14 | namespace rx 15 | { 16 | class Renderer11; 17 | 18 | class Stream11 : public StreamImpl 19 | { 20 | public: 21 | Stream11(Renderer11 *renderer); 22 | ~Stream11() override; 23 | 24 | private: 25 | Renderer11 *mRenderer; 26 | }; 27 | } // namespace rx 28 | 29 | #endif // LIBANGLE_RENDERER_D3D_D3D11_STREAM11_H_ 30 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/d3d/d3d11/Trim11.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // Trim11.h: Trim support utility class. 8 | 9 | #ifndef LIBANGLE_RENDERER_D3D_D3D11_TRIM11_H_ 10 | #define LIBANGLE_RENDERER_D3D_D3D11_TRIM11_H_ 11 | 12 | #include "common/angleutils.h" 13 | #include "libANGLE/angletypes.h" 14 | #include "libANGLE/Error.h" 15 | 16 | #if !defined(ANGLE_ENABLE_WINDOWS_STORE) 17 | typedef void* EventRegistrationToken; 18 | #else 19 | #include 20 | #endif 21 | 22 | namespace rx 23 | { 24 | class Renderer11; 25 | 26 | class Trim11 : angle::NonCopyable 27 | { 28 | public: 29 | explicit Trim11(Renderer11 *renderer); 30 | ~Trim11(); 31 | 32 | private: 33 | Renderer11 *mRenderer; 34 | #if defined (ANGLE_ENABLE_WINDOWS_STORE) 35 | EventRegistrationToken mApplicationSuspendedEventToken; 36 | #endif 37 | 38 | void trim(); 39 | bool registerForRendererTrimRequest(); 40 | void unregisterForRendererTrimRequest(); 41 | }; 42 | 43 | } 44 | 45 | #endif // LIBANGLE_RENDERER_D3D_D3D11_TRIM11_H_ 46 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/d3d/d3d11/dxgi_support_table.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // dxgi_support_table: 7 | // Queries for DXGI support of various texture formats. Depends on DXGI 8 | // version, D3D feature level, and is sometimes guaranteed or optional. 9 | // 10 | 11 | #include "common/platform.h" 12 | 13 | namespace rx 14 | { 15 | 16 | namespace d3d11 17 | { 18 | 19 | struct DXGISupport 20 | { 21 | DXGISupport() 22 | : alwaysSupportedFlags(0), 23 | neverSupportedFlags(0), 24 | optionallySupportedFlags(0) 25 | { 26 | } 27 | 28 | DXGISupport(UINT alwaysSupportedIn, UINT neverSupportedIn, UINT optionallySupportedIn) 29 | : alwaysSupportedFlags(alwaysSupportedIn), 30 | neverSupportedFlags(neverSupportedIn), 31 | optionallySupportedFlags(optionallySupportedIn) 32 | { 33 | } 34 | 35 | UINT alwaysSupportedFlags; 36 | UINT neverSupportedFlags; 37 | UINT optionallySupportedFlags; 38 | }; 39 | 40 | const DXGISupport &GetDXGISupport(DXGI_FORMAT dxgiFormat, D3D_FEATURE_LEVEL featureLevel); 41 | 42 | } // namespace d3d11 43 | 44 | } // namespace rx 45 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/d3d/d3d11/load_functions_table.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // load_functions_table: 7 | // Contains load functions table depending on internal format and dxgi format 8 | // 9 | 10 | #ifndef LIBANGLE_RENDERER_D3D_D3D11_LOADFUNCTIONSTABLE_H_ 11 | #define LIBANGLE_RENDERER_D3D_D3D11_LOADFUNCTIONSTABLE_H_ 12 | 13 | #include 14 | 15 | #include "libANGLE/renderer/d3d/d3d11/Renderer11.h" 16 | #include "libANGLE/renderer/d3d/d3d11/texture_format_table.h" 17 | 18 | namespace rx 19 | { 20 | 21 | namespace d3d11 22 | { 23 | 24 | const std::map &GetLoadFunctionsMap(GLenum internalFormat, 25 | DXGI_FORMAT dxgiFormat); 26 | 27 | } // namespace d3d11 28 | 29 | } // namespace rx 30 | 31 | #endif // LIBANGLE_RENDERER_D3D_D3D11_LOADFUNCTIONSTABLE_H_ 32 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/d3d/d3d9/DebugAnnotator9.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // DebugAnnotator9.h: D3D9 helpers for adding trace annotations. 7 | // 8 | 9 | #include "libANGLE/renderer/d3d/d3d9/DebugAnnotator9.h" 10 | 11 | #include "common/platform.h" 12 | 13 | namespace rx 14 | { 15 | 16 | void DebugAnnotator9::beginEvent(const wchar_t *eventName) 17 | { 18 | D3DPERF_BeginEvent(0, eventName); 19 | } 20 | 21 | void DebugAnnotator9::endEvent() 22 | { 23 | D3DPERF_EndEvent(); 24 | } 25 | 26 | void DebugAnnotator9::setMarker(const wchar_t *markerName) 27 | { 28 | D3DPERF_SetMarker(0, markerName); 29 | } 30 | 31 | bool DebugAnnotator9::getStatus() 32 | { 33 | return !!D3DPERF_GetStatus(); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/d3d/d3d9/DebugAnnotator9.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // DebugAnnotator9.h: D3D9 helpers for adding trace annotations. 7 | // 8 | 9 | #ifndef LIBANGLE_RENDERER_D3D_D3D9_DEBUGANNOTATOR9_H_ 10 | #define LIBANGLE_RENDERER_D3D_D3D9_DEBUGANNOTATOR9_H_ 11 | 12 | #include "common/debug.h" 13 | 14 | namespace rx 15 | { 16 | 17 | class DebugAnnotator9 : public gl::DebugAnnotator 18 | { 19 | public: 20 | DebugAnnotator9() {} 21 | void beginEvent(const wchar_t *eventName) override; 22 | void endEvent() override; 23 | void setMarker(const wchar_t *markerName) override; 24 | bool getStatus() override; 25 | }; 26 | 27 | } 28 | 29 | #endif // LIBANGLE_RENDERER_D3D_D3D9_DEBUGANNOTATOR9_H_ 30 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/d3d/d3d9/Fence9.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2013 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // Fence9.h: Defines the rx::FenceNV9 class which implements rx::FenceNVImpl. 8 | 9 | #ifndef LIBANGLE_RENDERER_D3D_D3D9_FENCE9_H_ 10 | #define LIBANGLE_RENDERER_D3D_D3D9_FENCE9_H_ 11 | 12 | #include "libANGLE/renderer/FenceNVImpl.h" 13 | #include "libANGLE/renderer/FenceSyncImpl.h" 14 | 15 | namespace rx 16 | { 17 | class Renderer9; 18 | 19 | class FenceNV9 : public FenceNVImpl 20 | { 21 | public: 22 | explicit FenceNV9(Renderer9 *renderer); 23 | ~FenceNV9() override; 24 | 25 | gl::Error set(GLenum condition) override; 26 | gl::Error test(GLboolean *outFinished) override; 27 | gl::Error finish() override; 28 | 29 | private: 30 | gl::Error testHelper(bool flushCommandBuffer, GLboolean *outFinished); 31 | 32 | Renderer9 *mRenderer; 33 | IDirect3DQuery9 *mQuery; 34 | }; 35 | 36 | } 37 | 38 | #endif // LIBANGLE_RENDERER_D3D_D3D9_FENCE9_H_ 39 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/d3d/d3d9/Query9.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2013 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // Query9.h: Defines the rx::Query9 class which implements rx::QueryImpl. 8 | 9 | #ifndef LIBANGLE_RENDERER_D3D_D3D9_QUERY9_H_ 10 | #define LIBANGLE_RENDERER_D3D_D3D9_QUERY9_H_ 11 | 12 | #include "libANGLE/renderer/QueryImpl.h" 13 | 14 | namespace rx 15 | { 16 | class Renderer9; 17 | 18 | class Query9 : public QueryImpl 19 | { 20 | public: 21 | Query9(Renderer9 *renderer, GLenum type); 22 | virtual ~Query9(); 23 | 24 | virtual gl::Error begin(); 25 | virtual gl::Error end(); 26 | virtual gl::Error queryCounter(); 27 | virtual gl::Error getResult(GLint *params); 28 | virtual gl::Error getResult(GLuint *params); 29 | virtual gl::Error getResult(GLint64 *params); 30 | virtual gl::Error getResult(GLuint64 *params); 31 | virtual gl::Error isResultAvailable(bool *available); 32 | 33 | private: 34 | gl::Error testQuery(); 35 | 36 | template 37 | gl::Error getResultBase(T *params); 38 | 39 | GLuint64 mResult; 40 | bool mQueryFinished; 41 | 42 | Renderer9 *mRenderer; 43 | IDirect3DQuery9 *mQuery; 44 | }; 45 | 46 | } 47 | 48 | #endif // LIBANGLE_RENDERER_D3D_D3D9_QUERY9_H_ 49 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/d3d/d3d9/ShaderExecutable9.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // ShaderExecutable9.cpp: Implements a D3D9-specific class to contain shader 8 | // executable implementation details. 9 | 10 | #include "libANGLE/renderer/d3d/d3d9/ShaderExecutable9.h" 11 | 12 | #include "common/debug.h" 13 | 14 | namespace rx 15 | { 16 | 17 | ShaderExecutable9::ShaderExecutable9(const void *function, size_t length, IDirect3DPixelShader9 *executable) 18 | : ShaderExecutableD3D(function, length) 19 | { 20 | mPixelExecutable = executable; 21 | mVertexExecutable = NULL; 22 | } 23 | 24 | ShaderExecutable9::ShaderExecutable9(const void *function, size_t length, IDirect3DVertexShader9 *executable) 25 | : ShaderExecutableD3D(function, length) 26 | { 27 | mVertexExecutable = executable; 28 | mPixelExecutable = NULL; 29 | } 30 | 31 | ShaderExecutable9::~ShaderExecutable9() 32 | { 33 | SafeRelease(mVertexExecutable); 34 | SafeRelease(mPixelExecutable); 35 | } 36 | 37 | IDirect3DVertexShader9 *ShaderExecutable9::getVertexShader() const 38 | { 39 | return mVertexExecutable; 40 | } 41 | 42 | IDirect3DPixelShader9 *ShaderExecutable9::getPixelShader() const 43 | { 44 | return mPixelExecutable; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/d3d/d3d9/ShaderExecutable9.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // ShaderExecutable9.h: Defines a D3D9-specific class to contain shader 8 | // executable implementation details. 9 | 10 | #ifndef LIBANGLE_RENDERER_D3D_D3D9_SHADEREXECUTABLE9_H_ 11 | #define LIBANGLE_RENDERER_D3D_D3D9_SHADEREXECUTABLE9_H_ 12 | 13 | #include "libANGLE/renderer/d3d/ShaderExecutableD3D.h" 14 | 15 | namespace rx 16 | { 17 | 18 | class ShaderExecutable9 : public ShaderExecutableD3D 19 | { 20 | public: 21 | ShaderExecutable9(const void *function, size_t length, IDirect3DPixelShader9 *executable); 22 | ShaderExecutable9(const void *function, size_t length, IDirect3DVertexShader9 *executable); 23 | virtual ~ShaderExecutable9(); 24 | 25 | IDirect3DPixelShader9 *getPixelShader() const; 26 | IDirect3DVertexShader9 *getVertexShader() const; 27 | 28 | private: 29 | IDirect3DPixelShader9 *mPixelExecutable; 30 | IDirect3DVertexShader9 *mVertexExecutable; 31 | }; 32 | 33 | } 34 | 35 | #endif // LIBANGLE_RENDERER_D3D_D3D9_SHADEREXECUTABLE9_H_ 36 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/d3d/d3d9/VertexArray9.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // VertexArray9.h: Defines the rx::VertexArray9 class which implements rx::VertexArrayImpl. 8 | 9 | #ifndef LIBANGLE_RENDERER_D3D_D3D9_VERTEXARRAY9_H_ 10 | #define LIBANGLE_RENDERER_D3D_D3D9_VERTEXARRAY9_H_ 11 | 12 | #include "libANGLE/renderer/VertexArrayImpl.h" 13 | #include "libANGLE/renderer/d3d/d3d9/Renderer9.h" 14 | 15 | namespace rx 16 | { 17 | class Renderer9; 18 | 19 | class VertexArray9 : public VertexArrayImpl 20 | { 21 | public: 22 | VertexArray9(const gl::VertexArray::Data &data) 23 | : VertexArrayImpl(data) 24 | { 25 | } 26 | 27 | virtual ~VertexArray9() { } 28 | }; 29 | 30 | } 31 | 32 | #endif // LIBANGLE_RENDERER_D3D_D3D9_VERTEXARRAY9_H_ 33 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/d3d/d3d9/shaders/Blit.ps: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | sampler2D tex : s0; 8 | 9 | uniform float4 mult : c0; 10 | uniform float4 add : c1; 11 | 12 | // Passthrough Pixel Shader 13 | // Outputs texture 0 sampled at texcoord 0. 14 | float4 passthroughps(float4 texcoord : TEXCOORD0) : COLOR 15 | { 16 | return tex2D(tex, texcoord.xy); 17 | }; 18 | 19 | // Luminance Conversion Pixel Shader 20 | // Performs a mad operation using the LA data from the texture with mult.xw and add.xw. 21 | // Returns data in the form of llla 22 | float4 luminanceps(float4 texcoord : TEXCOORD0) : COLOR 23 | { 24 | return (tex2D(tex, texcoord.xy).xw * mult.xw + add.xw).xxxy; 25 | }; 26 | 27 | // RGB/A Component Mask Pixel Shader 28 | // Performs a mad operation using the texture's RGBA data with mult.xyzw and add.xyzw. 29 | // Returns data in the form of rgba 30 | float4 componentmaskps(float4 texcoord : TEXCOORD0) : COLOR 31 | { 32 | return tex2D(tex, texcoord.xy) * mult + add; 33 | }; 34 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/d3d/generatemip.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // generatemip.h: Defines the GenerateMip function, templated on the format 8 | // type of the image for which mip levels are being generated. 9 | 10 | #ifndef LIBANGLE_RENDERER_D3D_GENERATEMIP_H_ 11 | #define LIBANGLE_RENDERER_D3D_GENERATEMIP_H_ 12 | 13 | #include "libANGLE/renderer/d3d/imageformats.h" 14 | #include "libANGLE/angletypes.h" 15 | 16 | namespace rx 17 | { 18 | 19 | template 20 | inline void GenerateMip(size_t sourceWidth, size_t sourceHeight, size_t sourceDepth, 21 | const uint8_t *sourceData, size_t sourceRowPitch, size_t sourceDepthPitch, 22 | uint8_t *destData, size_t destRowPitch, size_t destDepthPitch); 23 | 24 | } 25 | 26 | #include "generatemip.inl" 27 | 28 | #endif // LIBANGLE_RENDERER_D3D_GENERATEMIP_H_ 29 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/gl/CompilerGL.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // CompilerGL.h: Defines the class interface for CompilerGL. 8 | 9 | #ifndef LIBANGLE_RENDERER_GL_COMPILERGL_H_ 10 | #define LIBANGLE_RENDERER_GL_COMPILERGL_H_ 11 | 12 | #include "libANGLE/renderer/CompilerImpl.h" 13 | 14 | namespace rx 15 | { 16 | class FunctionsGL; 17 | 18 | class CompilerGL : public CompilerImpl 19 | { 20 | public: 21 | CompilerGL(const FunctionsGL *functions); 22 | ~CompilerGL() override {} 23 | 24 | gl::Error release() override { return gl::Error(GL_NO_ERROR); } 25 | ShShaderOutput getTranslatorOutputType() const override { return mTranslatorOutputType; } 26 | 27 | private: 28 | ShShaderOutput mTranslatorOutputType; 29 | }; 30 | 31 | } 32 | 33 | #endif // LIBANGLE_RENDERER_GL_COMPILERGL_H_ 34 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/gl/FenceNVGL.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // FenceNVGL.cpp: Implements the class methods for FenceNVGL. 8 | 9 | #include "libANGLE/renderer/gl/FenceNVGL.h" 10 | 11 | #include "common/debug.h" 12 | #include "libANGLE/renderer/gl/FunctionsGL.h" 13 | 14 | 15 | namespace rx 16 | { 17 | 18 | FenceNVGL::FenceNVGL(const FunctionsGL *functions) 19 | : FenceNVImpl(), 20 | mFunctions(functions) 21 | { 22 | mFunctions->genFencesNV(1, &mFence); 23 | } 24 | 25 | FenceNVGL::~FenceNVGL() 26 | { 27 | mFunctions->deleteFencesNV(1, &mFence); 28 | mFence = 0; 29 | } 30 | 31 | gl::Error FenceNVGL::set(GLenum condition) 32 | { 33 | ASSERT(condition == GL_ALL_COMPLETED_NV); 34 | mFunctions->setFenceNV(mFence, condition); 35 | return gl::Error(GL_NO_ERROR); 36 | } 37 | 38 | gl::Error FenceNVGL::test(GLboolean *outFinished) 39 | { 40 | ASSERT(outFinished); 41 | *outFinished = mFunctions->testFenceNV(mFence); 42 | return gl::Error(GL_NO_ERROR); 43 | } 44 | 45 | gl::Error FenceNVGL::finish() 46 | { 47 | mFunctions->finishFenceNV(mFence); 48 | return gl::Error(GL_NO_ERROR); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/gl/FenceNVGL.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // FenceNVGL.h: Defines the class interface for FenceNVGL. 8 | 9 | #ifndef LIBANGLE_RENDERER_GL_FENCENVGL_H_ 10 | #define LIBANGLE_RENDERER_GL_FENCENVGL_H_ 11 | 12 | #include "libANGLE/renderer/FenceNVImpl.h" 13 | 14 | namespace rx 15 | { 16 | class FunctionsGL; 17 | 18 | class FenceNVGL : public FenceNVImpl 19 | { 20 | public: 21 | explicit FenceNVGL(const FunctionsGL *functions); 22 | ~FenceNVGL() override; 23 | 24 | gl::Error set(GLenum condition) override; 25 | gl::Error test(GLboolean *outFinished) override; 26 | gl::Error finish() override; 27 | 28 | private: 29 | GLuint mFence; 30 | 31 | const FunctionsGL *mFunctions; 32 | }; 33 | 34 | } 35 | 36 | #endif // LIBANGLE_RENDERER_GL_FENCENVGL_H_ 37 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/gl/FenceSyncGL.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // FenceSyncGL.h: Defines the class interface for FenceSyncGL. 8 | 9 | #ifndef LIBANGLE_RENDERER_GL_FENCESYNCGL_H_ 10 | #define LIBANGLE_RENDERER_GL_FENCESYNCGL_H_ 11 | 12 | #include "libANGLE/renderer/FenceSyncImpl.h" 13 | 14 | namespace rx 15 | { 16 | class FunctionsGL; 17 | 18 | class FenceSyncGL : public FenceSyncImpl 19 | { 20 | public: 21 | explicit FenceSyncGL(const FunctionsGL *functions); 22 | ~FenceSyncGL() override; 23 | 24 | gl::Error set(GLenum condition, GLbitfield flags) override; 25 | gl::Error clientWait(GLbitfield flags, GLuint64 timeout, GLenum *outResult) override; 26 | gl::Error serverWait(GLbitfield flags, GLuint64 timeout) override; 27 | gl::Error getStatus(GLint *outResult) override; 28 | 29 | private: 30 | const FunctionsGL *mFunctions; 31 | GLsync mSyncObject; 32 | }; 33 | 34 | } 35 | 36 | #endif // LIBANGLE_RENDERER_GL_FENCESYNCGL_H_ 37 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/gl/SamplerGL.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // SamplerGL.h: Defines the rx::SamplerGL class, an implementation of SamplerImpl. 8 | 9 | #ifndef LIBANGLE_RENDERER_GL_SAMPLERGL_H_ 10 | #define LIBANGLE_RENDERER_GL_SAMPLERGL_H_ 11 | 12 | #include "libANGLE/angletypes.h" 13 | #include "libANGLE/renderer/SamplerImpl.h" 14 | 15 | namespace rx 16 | { 17 | 18 | class FunctionsGL; 19 | class StateManagerGL; 20 | 21 | class SamplerGL : public SamplerImpl 22 | { 23 | public: 24 | SamplerGL(const FunctionsGL *functions, StateManagerGL *stateManager); 25 | ~SamplerGL() override; 26 | 27 | void syncState(const gl::SamplerState &samplerState) const; 28 | 29 | GLuint getSamplerID() const; 30 | 31 | private: 32 | const FunctionsGL *mFunctions; 33 | StateManagerGL *mStateManager; 34 | 35 | mutable gl::SamplerState mAppliedSamplerState; 36 | GLuint mSamplerID; 37 | }; 38 | } 39 | 40 | #endif // LIBANGLE_RENDERER_GL_SAMPLERGL_H_ 41 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/gl/ShaderGL.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // ShaderGL.h: Defines the class interface for ShaderGL. 8 | 9 | #ifndef LIBANGLE_RENDERER_GL_SHADERGL_H_ 10 | #define LIBANGLE_RENDERER_GL_SHADERGL_H_ 11 | 12 | #include "libANGLE/renderer/ShaderImpl.h" 13 | 14 | namespace rx 15 | { 16 | class FunctionsGL; 17 | struct WorkaroundsGL; 18 | 19 | class ShaderGL : public ShaderImpl 20 | { 21 | public: 22 | ShaderGL(const gl::Shader::Data &data, 23 | const FunctionsGL *functions, 24 | const WorkaroundsGL &workarounds); 25 | ~ShaderGL() override; 26 | 27 | // ShaderImpl implementation 28 | int prepareSourceAndReturnOptions(std::stringstream *sourceStream, 29 | std::string *sourcePath) override; 30 | bool postTranslateCompile(gl::Compiler *compiler, std::string *infoLog) override; 31 | std::string getDebugInfo() const override; 32 | 33 | GLuint getShaderID() const; 34 | 35 | private: 36 | const FunctionsGL *mFunctions; 37 | const WorkaroundsGL &mWorkarounds; 38 | 39 | GLuint mShaderID; 40 | }; 41 | 42 | } 43 | 44 | #endif // LIBANGLE_RENDERER_GL_SHADERGL_H_ 45 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/gl/SurfaceGL.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // SurfaceGL.cpp: OpenGL implementation of egl::Surface 8 | 9 | #include "libANGLE/renderer/gl/SurfaceGL.h" 10 | 11 | #include "libANGLE/renderer/gl/FramebufferGL.h" 12 | #include "libANGLE/renderer/gl/RendererGL.h" 13 | 14 | namespace rx 15 | { 16 | 17 | SurfaceGL::SurfaceGL(RendererGL *renderer) : SurfaceImpl(), mRenderer(renderer) 18 | { 19 | } 20 | 21 | SurfaceGL::~SurfaceGL() 22 | { 23 | } 24 | 25 | FramebufferImpl *SurfaceGL::createDefaultFramebuffer(const gl::Framebuffer::Data &data) 26 | { 27 | return new FramebufferGL(data, mRenderer->getFunctions(), mRenderer->getStateManager(), 28 | mRenderer->getWorkarounds(), true); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/gl/SurfaceGL.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // SurfaceGL.h: Defines the class interface for SurfaceGL. 8 | 9 | #ifndef LIBANGLE_RENDERER_GL_SURFACEGL_H_ 10 | #define LIBANGLE_RENDERER_GL_SURFACEGL_H_ 11 | 12 | #include "libANGLE/renderer/SurfaceImpl.h" 13 | 14 | namespace rx 15 | { 16 | 17 | class RendererGL; 18 | 19 | class SurfaceGL : public SurfaceImpl 20 | { 21 | public: 22 | SurfaceGL(RendererGL *renderer); 23 | ~SurfaceGL() override; 24 | 25 | gl::Error getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &target, 26 | FramebufferAttachmentRenderTarget **rtOut) override 27 | { 28 | return gl::Error(GL_OUT_OF_MEMORY, "Not supported on OpenGL"); 29 | } 30 | 31 | FramebufferImpl *createDefaultFramebuffer(const gl::Framebuffer::Data &data) override; 32 | 33 | virtual egl::Error makeCurrent() = 0; 34 | 35 | private: 36 | RendererGL *mRenderer; 37 | }; 38 | 39 | } 40 | 41 | #endif // LIBANGLE_RENDERER_GL_SURFACEGL_H_ 42 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/gl/glx/SurfaceGLX.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2016 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // SurfaceGLX.h: common interface for GLX surfaces 8 | 9 | #ifndef LIBANGLE_RENDERER_GL_GLX_SURFACEGLX_H_ 10 | #define LIBANGLE_RENDERER_GL_GLX_SURFACEGLX_H_ 11 | 12 | #include "libANGLE/renderer/gl/SurfaceGL.h" 13 | 14 | namespace rx 15 | { 16 | 17 | class SurfaceGLX : public SurfaceGL 18 | { 19 | public: 20 | SurfaceGLX(RendererGL *renderer) : SurfaceGL(renderer) {} 21 | 22 | virtual egl::Error checkForResize() = 0; 23 | }; 24 | } 25 | 26 | #endif // LIBANGLE_RENDERER_GL_GLX_SURFACEGLX_H_ 27 | -------------------------------------------------------------------------------- /src/libANGLE/renderer/gl/wgl/wgl_utils.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // wgl_utils.h: Utility routines specific to the WGL->EGL implementation. 8 | 9 | #ifndef LIBANGLE_RENDERER_GL_WGL_WGLUTILS_H_ 10 | #define LIBANGLE_RENDERER_GL_WGL_WGLUTILS_H_ 11 | 12 | #include 13 | 14 | #include "common/platform.h" 15 | 16 | namespace rx 17 | { 18 | 19 | class FunctionsWGL; 20 | 21 | namespace wgl 22 | { 23 | 24 | PIXELFORMATDESCRIPTOR GetDefaultPixelFormatDescriptor(); 25 | std::vector GetDefaultPixelFormatAttributes(bool preservedSwap); 26 | 27 | int QueryWGLFormatAttrib(HDC dc, int format, int attribName, const FunctionsWGL *functions); 28 | } 29 | 30 | } 31 | 32 | #endif // LIBANGLE_RENDERER_GL_WGL_WGLUTILS_H_ 33 | -------------------------------------------------------------------------------- /src/libEGL.gypi: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 The ANGLE Project Authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | { 6 | # Everything below this is duplicated in the GN build. If you change 7 | # anything also change angle/BUILD.gn 8 | 'variables': 9 | { 10 | 'angle_standalone%': 0, 11 | }, 12 | 'targets': 13 | [ 14 | { 15 | 'target_name': 'libEGL', 16 | 'type': '<(angle_gl_library_type)', 17 | 'dependencies': 18 | [ 19 | 'libANGLE', 20 | 'libGLESv2', 21 | ], 22 | 'includes': 23 | [ 24 | '../build/common_defines.gypi', 25 | ], 26 | 'include_dirs': 27 | [ 28 | '.', 29 | '../include', 30 | ], 31 | 'sources': 32 | [ 33 | '<@(libegl_sources)', 34 | ], 35 | 'conditions': 36 | [ 37 | ['angle_build_winrt==1', 38 | { 39 | 'msvs_requires_importlibrary' : 'true', 40 | }], 41 | ], 42 | }, 43 | ], 44 | } 45 | -------------------------------------------------------------------------------- /src/libEGL/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by libEGL.rc 4 | 5 | // Next default values for new objects 6 | // 7 | #ifdef APSTUDIO_INVOKED 8 | #ifndef APSTUDIO_READONLY_SYMBOLS 9 | #define _APS_NEXT_RESOURCE_VALUE 101 10 | #define _APS_NEXT_COMMAND_VALUE 40001 11 | #define _APS_NEXT_CONTROL_VALUE 1001 12 | #define _APS_NEXT_SYMED_VALUE 101 13 | #endif 14 | #endif 15 | -------------------------------------------------------------------------------- /src/libGLESv2/global_state.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // global_state.h : Defines functions for querying the thread-local GL and EGL state. 8 | 9 | #ifndef LIBGLESV2_GLOBALSTATE_H_ 10 | #define LIBGLESV2_GLOBALSTATE_H_ 11 | 12 | #include 13 | 14 | namespace gl 15 | { 16 | class Context; 17 | 18 | Context *GetGlobalContext(); 19 | Context *GetValidGlobalContext(); 20 | 21 | } 22 | 23 | namespace egl 24 | { 25 | class Error; 26 | class Display; 27 | class Surface; 28 | 29 | void SetGlobalError(const Error &error); 30 | EGLint GetGlobalError(); 31 | 32 | void SetGlobalAPI(EGLenum API); 33 | EGLenum GetGlobalAPI(); 34 | 35 | void SetGlobalDisplay(Display *dpy); 36 | Display *GetGlobalDisplay(); 37 | 38 | void SetGlobalDrawSurface(Surface *surface); 39 | Surface *GetGlobalDrawSurface(); 40 | 41 | void SetGlobalReadSurface(Surface *surface); 42 | Surface *GetGlobalReadSurface(); 43 | 44 | void SetGlobalContext(gl::Context *context); 45 | gl::Context *GetGlobalContext(); 46 | 47 | } 48 | 49 | #endif // LIBGLESV2_GLOBALSTATE_H_ 50 | -------------------------------------------------------------------------------- /src/libGLESv2/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by libGLESv2.rc 4 | 5 | // Next default values for new objects 6 | // 7 | #ifdef APSTUDIO_INVOKED 8 | #ifndef APSTUDIO_READONLY_SYMBOLS 9 | #define _APS_NEXT_RESOURCE_VALUE 101 10 | #define _APS_NEXT_COMMAND_VALUE 40001 11 | #define _APS_NEXT_CONTROL_VALUE 1001 12 | #define _APS_NEXT_SYMED_VALUE 101 13 | #endif 14 | #endif 15 | -------------------------------------------------------------------------------- /src/tests/WebGL-CTS-known-failures.txt: -------------------------------------------------------------------------------- 1 | Known failures in the WebGL CTS 1.0.4, using Canary 48.0.2547.0 with ANGLE a33475b36f7b0 2 | https://www.khronos.org/registry/webgl/sdk/tests/webgl-conformance-tests.html 3 | 4 | conformance/extensions/ext-sRGB.html: 5 tests failed 5 | conformance/glsl/bugs/pow-of-small-constant-in-user-defined-function.html: 1 tests failed 6 | conformance/glsl/bugs/sampler-struct-function-arg.html: 1 tests failed 7 | conformance/textures/misc/cube-incomplete-fbo.html: 1 tests failed 8 | deqp/data/gles2/shaders/functions.html: 8 tests failed 9 | deqp/data/gles2/shaders/scoping.html: 4 tests failed 10 | -------------------------------------------------------------------------------- /src/tests/angle_end2end_tests_main.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2013 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #include "gtest/gtest.h" 8 | #include "test_utils/ANGLETest.h" 9 | 10 | int main(int argc, char** argv) 11 | { 12 | testing::InitGoogleTest(&argc, argv); 13 | testing::AddGlobalTestEnvironment(new ANGLETestEnvironment()); 14 | int rt = RUN_ALL_TESTS(); 15 | return rt; 16 | } 17 | -------------------------------------------------------------------------------- /src/tests/angle_perftests_main.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // angle_perftests_main.cpp 7 | // Entry point for the gtest-based performance tests. 8 | // 9 | 10 | #include 11 | 12 | int main(int argc, char **argv) 13 | { 14 | testing::InitGoogleTest(&argc, argv); 15 | testing::AddGlobalTestEnvironment(new testing::Environment()); 16 | int rt = RUN_ALL_TESTS(); 17 | return rt; 18 | } 19 | -------------------------------------------------------------------------------- /src/tests/angle_unittests_main.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2013 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #include "gtest/gtest.h" 8 | #include "GLSLANG/ShaderLang.h" 9 | 10 | class CompilerTestEnvironment : public testing::Environment 11 | { 12 | public: 13 | virtual void SetUp() 14 | { 15 | if (!ShInitialize()) 16 | { 17 | FAIL() << "Failed to initialize the compiler."; 18 | } 19 | } 20 | 21 | virtual void TearDown() 22 | { 23 | if (!ShFinalize()) 24 | { 25 | FAIL() << "Failed to finalize the compiler."; 26 | } 27 | } 28 | }; 29 | 30 | int main(int argc, char** argv) 31 | { 32 | testing::InitGoogleTest(&argc, argv); 33 | testing::AddGlobalTestEnvironment(new CompilerTestEnvironment()); 34 | int rt = RUN_ALL_TESTS(); 35 | return rt; 36 | } 37 | -------------------------------------------------------------------------------- /src/tests/compiler_tests/API_test.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // API_test.cpp: 7 | // Some tests for the compiler API. 8 | // 9 | 10 | #include "angle_gl.h" 11 | #include "gtest/gtest.h" 12 | #include "GLSLANG/ShaderLang.h" 13 | 14 | TEST(APITest, CompareShBuiltInResources) 15 | { 16 | ShBuiltInResources a_resources; 17 | memset(&a_resources, 88, sizeof(a_resources)); 18 | ShInitBuiltInResources(&a_resources); 19 | 20 | ShBuiltInResources b_resources; 21 | memset(&b_resources, 77, sizeof(b_resources)); 22 | ShInitBuiltInResources(&b_resources); 23 | 24 | EXPECT_TRUE(memcmp(&a_resources, &b_resources, sizeof(a_resources)) == 0); 25 | } 26 | 27 | -------------------------------------------------------------------------------- /src/tests/deqp_support/angle_deqp_gtest_main.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // angle_deqp_gtest_main: 7 | // Entry point for standalone dEQP tests. 8 | 9 | #include 10 | 11 | #include "angle_deqp_libtester.h" 12 | 13 | int main(int argc, char **argv) 14 | { 15 | testing::InitGoogleTest(&argc, argv); 16 | int rt = RUN_ALL_TESTS(); 17 | deqp_libtester_shutdown_platform(); 18 | return rt; 19 | } 20 | -------------------------------------------------------------------------------- /src/tests/deqp_support/angle_deqp_libtester.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // angle_deqp_libtester.h: 8 | // Exports for the ANGLE dEQP libtester module. 9 | 10 | #ifndef ANGLE_DEQP_LIBTESTER_H_ 11 | #define ANGLE_DEQP_LIBTESTER_H_ 12 | 13 | #if defined(_WIN32) 14 | # if defined(ANGLE_DEQP_LIBTESTER_IMPLEMENTATION) 15 | # define ANGLE_LIBTESTER_EXPORT __declspec(dllexport) 16 | # else 17 | # define ANGLE_LIBTESTER_EXPORT __declspec(dllimport) 18 | # endif 19 | #elif defined(__GNUC__) 20 | # if defined(ANGLE_DEQP_LIBTESTER_IMPLEMENTATION) 21 | # define ANGLE_LIBTESTER_EXPORT __attribute__((visibility ("default"))) 22 | # else 23 | # define ANGLE_LIBTESTER_EXPORT 24 | # endif 25 | #else 26 | # define ANGLE_LIBTESTER_EXPORT 27 | #endif 28 | 29 | // Exported to the tester app. 30 | ANGLE_LIBTESTER_EXPORT int deqp_libtester_main(int argc, const char *argv[]); 31 | ANGLE_LIBTESTER_EXPORT void deqp_libtester_shutdown_platform(); 32 | ANGLE_LIBTESTER_EXPORT bool deqp_libtester_run(const char *caseName); 33 | 34 | #endif // ANGLE_DEQP_LIBTESTER_H_ 35 | -------------------------------------------------------------------------------- /src/tests/deqp_support/angle_deqp_tests_main.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // angle_deqp_tests_main.cpp: Entry point for ANGLE's dEQP tests. 8 | 9 | #include "angle_deqp_libtester.h" 10 | 11 | int main(int argc, const char *argv[]) 12 | { 13 | return deqp_libtester_main(argc, argv); 14 | } 15 | -------------------------------------------------------------------------------- /src/tests/egl_tests/EGLSanityCheckTest.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // EGLSanityCheckTest.cpp: 8 | // tests used to check setup in which tests are run. 9 | 10 | #include 11 | 12 | #include "test_utils/ANGLETest.h" 13 | 14 | // Checks the tests are running against ANGLE 15 | TEST(EGLSanityCheckTest, IsRunningOnANGLE) 16 | { 17 | const char *extensionString = 18 | static_cast(eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS)); 19 | ASSERT_NE(strstr(extensionString, "EGL_ANGLE_platform_angle"), nullptr); 20 | } 21 | 22 | // Checks that getting function pointer works 23 | TEST(EGLSanityCheckTest, HasGetPlatformDisplayEXT) 24 | { 25 | PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT = 26 | reinterpret_cast( 27 | eglGetProcAddress("eglGetPlatformDisplayEXT")); 28 | 29 | ASSERT_NE(eglGetPlatformDisplayEXT, nullptr); 30 | } 31 | -------------------------------------------------------------------------------- /src/tests/gles_conformance_tests/gles_conformance_tests_main.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #include "gles_conformance_tests.h" 8 | 9 | #include "gtest/gtest.h" 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | int main(int argc, char** argv) 19 | { 20 | testing::InitGoogleTest(&argc, argv); 21 | int rt = RUN_ALL_TESTS(); 22 | return rt; 23 | } 24 | -------------------------------------------------------------------------------- /src/tests/preprocessor_tests/MockDiagnostics.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef PREPROCESSOR_TESTS_MOCK_DIAGNOSTICS_H_ 8 | #define PREPROCESSOR_TESTS_MOCK_DIAGNOSTICS_H_ 9 | 10 | #include "gmock/gmock.h" 11 | #include "compiler/preprocessor/DiagnosticsBase.h" 12 | 13 | class MockDiagnostics : public pp::Diagnostics 14 | { 15 | public: 16 | MOCK_METHOD3(print, 17 | void(ID id, const pp::SourceLocation& loc, const std::string& text)); 18 | }; 19 | 20 | #endif // PREPROCESSOR_TESTS_MOCK_DIAGNOSTICS_H_ 21 | -------------------------------------------------------------------------------- /src/tests/preprocessor_tests/MockDirectiveHandler.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef PREPROCESSOR_TESTS_MOCK_DIRECTIVE_HANDLER_H_ 8 | #define PREPROCESSOR_TESTS_MOCK_DIRECTIVE_HANDLER_H_ 9 | 10 | #include "gmock/gmock.h" 11 | #include "compiler/preprocessor/DirectiveHandlerBase.h" 12 | 13 | class MockDirectiveHandler : public pp::DirectiveHandler 14 | { 15 | public: 16 | MOCK_METHOD2(handleError, 17 | void(const pp::SourceLocation& loc, const std::string& msg)); 18 | 19 | MOCK_METHOD4(handlePragma, 20 | void(const pp::SourceLocation& loc, 21 | const std::string& name, 22 | const std::string& value, 23 | bool stdgl)); 24 | 25 | MOCK_METHOD3(handleExtension, 26 | void(const pp::SourceLocation& loc, 27 | const std::string& name, 28 | const std::string& behavior)); 29 | 30 | MOCK_METHOD2(handleVersion, 31 | void(const pp::SourceLocation& loc, int version)); 32 | }; 33 | 34 | #endif // PREPROCESSOR_TESTS_MOCK_DIRECTIVE_HANDLER_H_ 35 | -------------------------------------------------------------------------------- /src/tests/preprocessor_tests/PreprocessorTest.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #include "PreprocessorTest.h" 8 | #include "compiler/preprocessor/Token.h" 9 | 10 | void PreprocessorTest::preprocess(const char* input, const char* expected) 11 | { 12 | ASSERT_TRUE(mPreprocessor.init(1, &input, NULL)); 13 | 14 | int line = 1; 15 | pp::Token token; 16 | std::stringstream stream; 17 | do 18 | { 19 | mPreprocessor.lex(&token); 20 | for (; line < token.location.line; ++line) 21 | { 22 | stream << "\n"; 23 | } 24 | stream << token; 25 | } while (token.type != pp::Token::LAST); 26 | 27 | std::string actual = stream.str(); 28 | EXPECT_STREQ(expected, actual.c_str()); 29 | } 30 | -------------------------------------------------------------------------------- /src/tests/preprocessor_tests/PreprocessorTest.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #include "gtest/gtest.h" 8 | 9 | #include "MockDiagnostics.h" 10 | #include "MockDirectiveHandler.h" 11 | #include "compiler/preprocessor/Preprocessor.h" 12 | 13 | #ifndef PREPROCESSOR_TESTS_PREPROCESSOR_TEST_H_ 14 | #define PREPROCESSOR_TESTS_PREPROCESSOR_TEST_H_ 15 | 16 | class PreprocessorTest : public testing::Test 17 | { 18 | protected: 19 | PreprocessorTest() : mPreprocessor(&mDiagnostics, &mDirectiveHandler) { } 20 | 21 | // Preprocesses the input string and verifies that it matches 22 | // expected output. 23 | void preprocess(const char* input, const char* expected); 24 | 25 | MockDiagnostics mDiagnostics; 26 | MockDirectiveHandler mDirectiveHandler; 27 | pp::Preprocessor mPreprocessor; 28 | }; 29 | 30 | #endif // PREPROCESSOR_TESTS_PREPROCESSOR_TEST_H_ 31 | -------------------------------------------------------------------------------- /src/tests/third_party/gpu_test_expectations/HowToMakeChanges.md: -------------------------------------------------------------------------------- 1 | Because the ```gpu_test_expectations``` directory is based on parts of Chromium's ```gpu/config`` 2 | directory, we want to keep a patch of the changes added to make it compile with ANGLE. This 3 | will allow us to merge Chromium changes easily in our ```gpu_test_expectations```. 4 | 5 | In order to make a change to this directory, do the following: 6 | 7 | * copy the directory somewhere like in ```gpu_test_expectations_reverted``` 8 | * in ```gpu_test_expectations_reverted``` run ```patch -p 1 -R < angle-mods.patch``` 9 | * do your changes in ```gpu_test_expectations``` 10 | * delete angle-mods.patch in both directories 11 | * run ```diff -rupN gpu_test_expectations_reverted gpu_test_expectations > angle-mods.patch``` 12 | * copy ```angle-mods.patch``` in ```gpu_test_expectations``` 13 | 14 | How to update from Chromium: 15 | 16 | * ```git apply -R angle-mods.patch```, ```git add . -u```, ```git commit``` 17 | * Copy over Chromium files, ```git add . -u```, ```git commit``` 18 | * ```git revert HEAD~``` 19 | * ```rm angle-mods.patch``` 20 | * ```git diff HEAD~ (`)ls(`) > angle-mods.patch```,```git add angle-mods.patch```, ```git commit --amend``` 21 | * ```git rebase -i``` to squash the three patches into one. 22 | 23 | -------------------------------------------------------------------------------- /src/tests/third_party/gpu_test_expectations/gpu_test_config_mac.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // gpu_test_config_mac.h: 7 | // Helper functions for gpu_test_config that have to be compiled in ObjectiveC++ 8 | // 9 | 10 | #ifndef GPU_TEST_EXPECTATIONS_GPU_TEST_CONFIG_MAC_H_ 11 | #define GPU_TEST_EXPECTATIONS_GPU_TEST_CONFIG_MAC_H_ 12 | 13 | #include "gpu_info.h" 14 | 15 | namespace base { 16 | 17 | class SysInfo 18 | { 19 | public: 20 | static void OperatingSystemVersionNumbers( 21 | int32 *major_version, int32 *minor_version, int32 *bugfix_version); 22 | }; 23 | 24 | } // namespace base 25 | 26 | gpu::GPUInfo::GPUDevice GetActiveGPU(); 27 | 28 | #endif // GPU_TEST_EXPECTATIONS_GPU_TEST_CONFIG_MAC_H_ 29 | -------------------------------------------------------------------------------- /src/tests/third_party/rapidjson/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2011 Milo Yip 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /src/tests/third_party/rapidjson/README.chromium: -------------------------------------------------------------------------------- 1 | Name: RapidJSON 2 | URL: https://github.com/miloyip/rapidjson 3 | Version: 24dd7ef839b79941d129e833368e913aa9c045da 4 | License: Custom 5 | License File: LICENSE 6 | 7 | Description: 8 | RapidJSON is a JSON parser and generator for C++. -------------------------------------------------------------------------------- /src/third_party/compiler/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2012 Apple Inc. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | 1. Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | 2. Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | 12 | THIS SOFTWARE IS PROVIDED BY APPLE, INC. ``AS IS'' AND ANY 13 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 15 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE, INC. OR 16 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 18 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | -------------------------------------------------------------------------------- /src/third_party/compiler/README.angle: -------------------------------------------------------------------------------- 1 | Name: ANGLE array bounds clamper from WebKit 2 | Short Name: WebKit 3 | URL: http://webkit.org 4 | Version: 0 5 | License: BSD 6 | Security Critical: yes 7 | 8 | Description: 9 | Implements clamping of array indexing expressions during shader translation. 10 | 11 | Local Modifications: 12 | None 13 | -------------------------------------------------------------------------------- /src/third_party/libXNVCtrl/BUILD.gn: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 The ANGLE Project Authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | static_library("libXNVCtrl") { 6 | sources = [ 7 | "NVCtrl.c", 8 | "NVCtrl.h", 9 | "NVCtrlLib.h", 10 | "nv_control.h", 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /src/third_party/libXNVCtrl/LICENSE: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008 NVIDIA, Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice (including the next 12 | * paragraph) shall be included in all copies or substantial portions of the 13 | * Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ -------------------------------------------------------------------------------- /src/third_party/libXNVCtrl/README.angle: -------------------------------------------------------------------------------- 1 | Name: NVidia Control X Extension Library 2 | Short Name: libXNVCtrl 3 | URL: http://cgit.freedesktop.org/~aplattner/nvidia-settings/ 4 | Version: unknown 5 | Date: 2008 6 | License: MIT 7 | Security Critical: no 8 | 9 | Description: 10 | This package provides access to NVidia Control X Extension. It is used to determine the version of the NVIDIA driver in use. 11 | 12 | The current version is pulled from nvidia-settings-302.17. 13 | 14 | Local Modifications: 15 | -------------------------------------------------------------------------------- /src/third_party/libXNVCtrl/libXNVCtrl.gyp: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 The ANGLE Project Authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | { 6 | 'targets': 7 | [{ 8 | 'target_name': 'libXNVCtrl', 9 | 'type': 'static_library', 10 | 'sources': 11 | [ 12 | 'NVCtrl.c', 13 | 'NVCtrl.h', 14 | 'NVCtrlLib.h', 15 | 'nv_control.h', 16 | ], 17 | }], 18 | } 19 | -------------------------------------------------------------------------------- /src/third_party/murmurhash/LICENSE: -------------------------------------------------------------------------------- 1 | // MurmurHash3 was written by Austin Appleby, and is placed in the public 2 | // domain. The author hereby disclaims copyright to this source code. -------------------------------------------------------------------------------- /src/third_party/murmurhash/MurmurHash3.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // MurmurHash3 was written by Austin Appleby, and is placed in the public 3 | // domain. The author hereby disclaims copyright to this source code. 4 | 5 | #ifndef _MURMURHASH3_H_ 6 | #define _MURMURHASH3_H_ 7 | 8 | //----------------------------------------------------------------------------- 9 | // Platform-specific functions and macros 10 | 11 | // Microsoft Visual Studio 12 | 13 | #if defined(_MSC_VER) && (_MSC_VER < 1600) 14 | 15 | typedef unsigned char uint8_t; 16 | typedef unsigned int uint32_t; 17 | typedef unsigned __int64 uint64_t; 18 | 19 | // Other compilers 20 | 21 | #else // defined(_MSC_VER) 22 | 23 | #include 24 | 25 | #endif // !defined(_MSC_VER) 26 | 27 | //----------------------------------------------------------------------------- 28 | 29 | void MurmurHash3_x86_32 ( const void * key, int len, uint32_t seed, void * out ); 30 | 31 | void MurmurHash3_x86_128 ( const void * key, int len, uint32_t seed, void * out ); 32 | 33 | void MurmurHash3_x64_128 ( const void * key, int len, uint32_t seed, void * out ); 34 | 35 | //----------------------------------------------------------------------------- 36 | 37 | #endif // _MURMURHASH3_H_ 38 | -------------------------------------------------------------------------------- /util/OSPixmap.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // OSPixmap.h: Definition of an abstract pixmap class 8 | 9 | #ifndef SAMPLE_UTIL_PIXMAP_H_ 10 | #define SAMPLE_UTIL_PIXMAP_H_ 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | #include "Event.h" 18 | 19 | class OSPixmap 20 | { 21 | public: 22 | OSPixmap() {} 23 | virtual ~OSPixmap() {} 24 | 25 | virtual bool initialize(EGLNativeDisplayType display, size_t width, size_t height, int depth) = 0; 26 | 27 | virtual EGLNativePixmapType getNativePixmap() const = 0; 28 | }; 29 | 30 | OSPixmap *CreateOSPixmap(); 31 | 32 | #endif // SAMPLE_UTIL_PIXMAP_H_ 33 | -------------------------------------------------------------------------------- /util/Timer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef SAMPLE_UTIL_TIMER_H 8 | #define SAMPLE_UTIL_TIMER_H 9 | 10 | class Timer 11 | { 12 | public: 13 | virtual ~Timer() {} 14 | virtual void start() = 0; 15 | virtual void stop() = 0; 16 | virtual double getElapsedTime() const = 0; 17 | }; 18 | 19 | Timer *CreateTimer(); 20 | 21 | #endif // SAMPLE_UTIL_TIMER_H 22 | -------------------------------------------------------------------------------- /util/com_utils.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // com_utils.h: Utility functions for working with COM objects 8 | 9 | #ifndef UTIL_COM_UTILS_H 10 | #define UTIL_COM_UTILS_H 11 | 12 | template 13 | inline outType *DynamicCastComObject(IUnknown *object) 14 | { 15 | outType *outObject = nullptr; 16 | HRESULT result = object->QueryInterface(__uuidof(outType), reinterpret_cast(&outObject)); 17 | if (SUCCEEDED(result)) 18 | { 19 | return outObject; 20 | } 21 | else 22 | { 23 | SafeRelease(outObject); 24 | return nullptr; 25 | } 26 | } 27 | 28 | #endif // UTIL_COM_UTILS_H 29 | -------------------------------------------------------------------------------- /util/geometry_utils.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // geometry_utils: 7 | // Helper library for generating certain sets of geometry. 8 | // 9 | 10 | #ifndef UTIL_GEOMETRY_UTILS_H 11 | #define UTIL_GEOMETRY_UTILS_H 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | #include "Vector.h" 18 | 19 | struct SphereGeometry 20 | { 21 | std::vector positions; 22 | std::vector normals; 23 | std::vector indices; 24 | }; 25 | 26 | void CreateSphereGeometry(size_t sliceCount, float radius, SphereGeometry *result); 27 | 28 | struct CubeGeometry 29 | { 30 | std::vector positions; 31 | std::vector normals; 32 | std::vector texcoords; 33 | std::vector indices; 34 | }; 35 | 36 | void GenerateCubeGeometry(float radius, CubeGeometry *result); 37 | 38 | #endif // UTIL_GEOMETRY_UTILS_H 39 | -------------------------------------------------------------------------------- /util/linux/LinuxTimer.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // LinuxTimer.cpp: Implementation of a high precision timer class on Linux 8 | 9 | #include "linux/LinuxTimer.h" 10 | #include 11 | 12 | LinuxTimer::LinuxTimer() 13 | : mRunning(false) 14 | { 15 | } 16 | 17 | void LinuxTimer::start() 18 | { 19 | clock_gettime(CLOCK_MONOTONIC, &mStartTime); 20 | mRunning = true; 21 | } 22 | 23 | void LinuxTimer::stop() 24 | { 25 | clock_gettime(CLOCK_MONOTONIC, &mStopTime); 26 | mRunning = false; 27 | } 28 | 29 | double LinuxTimer::getElapsedTime() const 30 | { 31 | struct timespec endTime; 32 | if (mRunning) 33 | { 34 | clock_gettime(CLOCK_MONOTONIC, &endTime); 35 | } 36 | else 37 | { 38 | endTime = mStopTime; 39 | } 40 | 41 | double startSeconds = mStartTime.tv_sec + (1.0 / 1000000000) * mStartTime.tv_nsec; 42 | double endSeconds = endTime.tv_sec + (1.0 / 1000000000) * endTime.tv_nsec; 43 | return endSeconds - startSeconds; 44 | } 45 | 46 | Timer *CreateTimer() 47 | { 48 | return new LinuxTimer(); 49 | } 50 | -------------------------------------------------------------------------------- /util/linux/LinuxTimer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // LinuxTimer.h: Definition of a high precision timer class on Linux 8 | 9 | #ifndef UTIL_LINUX_TIMER_H 10 | #define UTIL_LINUX_TIMER_H 11 | 12 | #include 13 | 14 | #include "Timer.h" 15 | 16 | class LinuxTimer : public Timer 17 | { 18 | public: 19 | LinuxTimer(); 20 | 21 | void start() override; 22 | void stop() override; 23 | double getElapsedTime() const override; 24 | 25 | private: 26 | bool mRunning; 27 | struct timespec mStartTime; 28 | struct timespec mStopTime; 29 | }; 30 | 31 | #endif // UTIL_LINUX_TIMER_H 32 | -------------------------------------------------------------------------------- /util/linux/Linux_system_utils.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // Linux_system_utils.cpp: Implementation of OS-specific functions for Linux 8 | 9 | #include "system_utils.h" 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | namespace angle 17 | { 18 | 19 | std::string GetExecutablePath() 20 | { 21 | // We cannot use lstat to get the size of /proc/self/exe as it always returns 0 22 | // so we just use a big buffer and hope the path fits in it. 23 | char path[4096]; 24 | 25 | ssize_t result = readlink("/proc/self/exe", path, sizeof(path) - 1); 26 | if (result < 0 || static_cast(result) >= sizeof(path) - 1) 27 | { 28 | return ""; 29 | } 30 | 31 | path[result] = '\0'; 32 | return path; 33 | } 34 | 35 | std::string GetExecutableDirectory() 36 | { 37 | std::string executablePath = GetExecutablePath(); 38 | size_t lastPathSepLoc = executablePath.find_last_of("/"); 39 | return (lastPathSepLoc != std::string::npos) ? executablePath.substr(0, lastPathSepLoc) : ""; 40 | } 41 | 42 | } // namespace angle 43 | -------------------------------------------------------------------------------- /util/mouse.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef SAMPLE_UTIL_MOUSE_H 8 | #define SAMPLE_UTIL_MOUSE_H 9 | 10 | enum MouseButton 11 | { 12 | MOUSEBUTTON_UNKNOWN, 13 | MOUSEBUTTON_LEFT, 14 | MOUSEBUTTON_RIGHT, 15 | MOUSEBUTTON_MIDDLE, 16 | MOUSEBUTTON_BUTTON4, 17 | MOUSEBUTTON_BUTTON5, 18 | MOUSEBUTTON_COUNT, 19 | }; 20 | 21 | #endif // SAMPLE_UTIL_MOUSE_H 22 | -------------------------------------------------------------------------------- /util/osx/OSXPixmap.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // OSXPixmap.h: Definition of the implementation of OSPixmap for OSX 8 | 9 | #ifndef UTIL_OSX_PIXMAP_H_ 10 | #define UTIL_OSX_PIXMAP_H_ 11 | 12 | #include "OSPixmap.h" 13 | 14 | #endif // UTIL_OSX_PIXMAP_H_ 15 | -------------------------------------------------------------------------------- /util/osx/OSXPixmap.mm: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // OSXPixmap.cpp: Implementation of OSPixmap for OSX 8 | 9 | #include "osx/OSXPixmap.h" 10 | 11 | // TODO(cwallez) find out the native OSX pixmap type and implement this 12 | OSPixmap *CreateOSPixmap() 13 | { 14 | return nullptr; 15 | } 16 | -------------------------------------------------------------------------------- /util/osx/OSXTimer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // OSXTimer.h: Definition of a high precision timer class on OSX 8 | 9 | #ifndef UTIL_OSX_TIMER_H_ 10 | #define UTIL_OSX_TIMER_H_ 11 | 12 | #include 13 | #include 14 | 15 | #include "Timer.h" 16 | 17 | class OSXTimer : public Timer 18 | { 19 | public: 20 | OSXTimer(); 21 | 22 | void start() override; 23 | void stop() override; 24 | double getElapsedTime() const override; 25 | 26 | private: 27 | bool mRunning; 28 | uint64_t mStartTime; 29 | uint64_t mStopTime; 30 | }; 31 | 32 | #endif // UTIL_OSX_TIMER_H_ 33 | -------------------------------------------------------------------------------- /util/osx/OSX_system_utils.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // OSX_system_utils.cpp: Implementation of OS-specific functions for OSX 8 | 9 | #include "system_utils.h" 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace angle 16 | { 17 | 18 | std::string GetExecutablePath() 19 | { 20 | std::string result; 21 | 22 | uint32_t size = 0; 23 | _NSGetExecutablePath(nullptr, &size); 24 | 25 | std::vector buffer; 26 | buffer.resize(size + 1); 27 | 28 | _NSGetExecutablePath(buffer.data(), &size); 29 | buffer[size] = '\0'; 30 | 31 | if (!strrchr(buffer.data(), '/')) 32 | { 33 | return ""; 34 | } 35 | return buffer.data(); 36 | } 37 | 38 | std::string GetExecutableDirectory() 39 | { 40 | std::string executablePath = GetExecutablePath(); 41 | size_t lastPathSepLoc = executablePath.find_last_of("/"); 42 | return (lastPathSepLoc != std::string::npos) ? executablePath.substr(0, lastPathSepLoc) : ""; 43 | } 44 | 45 | } // namespace angle 46 | -------------------------------------------------------------------------------- /util/posix/Posix_system_utils.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // Posix_system_utils.cpp: Implementation of OS-specific functions for Posix systems 8 | 9 | #include "system_utils.h" 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | namespace angle 17 | { 18 | 19 | void Sleep(unsigned int milliseconds) 20 | { 21 | // On Windows Sleep(0) yields while it isn't guaranteed by Posix's sleep 22 | // so we replicate Windows' behavior with an explicit yield. 23 | if (milliseconds == 0) 24 | { 25 | sched_yield(); 26 | } 27 | else 28 | { 29 | timespec sleepTime = 30 | { 31 | .tv_sec = milliseconds / 1000, 32 | .tv_nsec = (milliseconds % 1000) * 1000000, 33 | }; 34 | 35 | nanosleep(&sleepTime, nullptr); 36 | } 37 | } 38 | 39 | void SetLowPriorityProcess() 40 | { 41 | setpriority(PRIO_PROCESS, getpid(), 10); 42 | } 43 | 44 | void WriteDebugMessage(const char *format, ...) 45 | { 46 | // TODO(jmadill): Implement this 47 | } 48 | 49 | } // namespace angle 50 | -------------------------------------------------------------------------------- /util/random_utils.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | // random_utils: 7 | // Helper functions for random number generation. 8 | // 9 | 10 | #ifndef UTIL_RANDOM_UTILS_H 11 | #define UTIL_RANDOM_UTILS_H 12 | 13 | // TODO(jmadill): Rework this if Chromium decides to ban 14 | #include 15 | 16 | namespace angle 17 | { 18 | 19 | class RNG 20 | { 21 | public: 22 | // Seed from clock 23 | RNG(); 24 | // Seed from fixed number. 25 | RNG(unsigned int seed); 26 | ~RNG(); 27 | 28 | void reseed(unsigned int newSeed); 29 | 30 | int randomInt(); 31 | int randomIntBetween(int min, int max); 32 | unsigned int randomUInt(); 33 | float randomFloat(); 34 | float randomFloatBetween(float min, float max); 35 | float randomNegativeOneToOne(); 36 | 37 | private: 38 | std::default_random_engine mGenerator; 39 | }; 40 | 41 | } // namespace angle 42 | 43 | #endif // UTIL_RANDOM_UTILS_H 44 | -------------------------------------------------------------------------------- /util/shader_utils.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | #ifndef SAMPLE_UTIL_SHADER_UTILS_H 8 | #define SAMPLE_UTIL_SHADER_UTILS_H 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include 17 | #include 18 | 19 | #define SHADER_SOURCE(...) #__VA_ARGS__ 20 | 21 | GLuint CompileShader(GLenum type, const std::string &source); 22 | GLuint CompileShaderFromFile(GLenum type, const std::string &sourcePath); 23 | 24 | GLuint CompileProgramWithTransformFeedback( 25 | const std::string &vsSource, 26 | const std::string &fsSource, 27 | const std::vector &transformFeedbackVaryings, 28 | GLenum bufferMode); 29 | GLuint CompileProgram(const std::string &vsSource, const std::string &fsSource); 30 | GLuint CompileProgramFromFiles(const std::string &vsPath, const std::string &fsPath); 31 | 32 | #endif // SAMPLE_UTIL_SHADER_UTILS_H 33 | -------------------------------------------------------------------------------- /util/system_utils.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // system_utils.h: declaration of OS-specific utility functions 8 | 9 | #ifndef SAMPLE_UTIL_PATH_UTILS_H 10 | #define SAMPLE_UTIL_PATH_UTILS_H 11 | 12 | #include 13 | 14 | namespace angle 15 | { 16 | 17 | std::string GetExecutablePath(); 18 | std::string GetExecutableDirectory(); 19 | 20 | // Cross platform equivalent of the Windows Sleep function 21 | void Sleep(unsigned int milliseconds); 22 | 23 | void SetLowPriorityProcess(); 24 | 25 | // Write a debug message, either to a standard output or Debug window. 26 | void WriteDebugMessage(const char *format, ...); 27 | 28 | } // namespace angle 29 | 30 | #endif // SAMPLE_UTIL_PATH_UTILS_H 31 | -------------------------------------------------------------------------------- /util/windows/WindowsTimer.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // WindowsTimer.cpp: Implementation of a high precision timer class on Windows 8 | 9 | #include "windows/WindowsTimer.h" 10 | 11 | WindowsTimer::WindowsTimer() : mRunning(false), mStartTime(0), mStopTime(0) 12 | { 13 | } 14 | 15 | void WindowsTimer::start() 16 | { 17 | LARGE_INTEGER frequency; 18 | QueryPerformanceFrequency(&frequency); 19 | mFrequency = frequency.QuadPart; 20 | 21 | LARGE_INTEGER curTime; 22 | QueryPerformanceCounter(&curTime); 23 | mStartTime = curTime.QuadPart; 24 | 25 | mRunning = true; 26 | } 27 | 28 | void WindowsTimer::stop() 29 | { 30 | LARGE_INTEGER curTime; 31 | QueryPerformanceCounter(&curTime); 32 | mStopTime = curTime.QuadPart; 33 | 34 | mRunning = false; 35 | } 36 | 37 | double WindowsTimer::getElapsedTime() const 38 | { 39 | LONGLONG endTime; 40 | if (mRunning) 41 | { 42 | LARGE_INTEGER curTime; 43 | QueryPerformanceCounter(&curTime); 44 | endTime = curTime.QuadPart; 45 | } 46 | else 47 | { 48 | endTime = mStopTime; 49 | } 50 | 51 | return static_cast(endTime - mStartTime) / mFrequency; 52 | } 53 | 54 | Timer *CreateTimer() 55 | { 56 | return new WindowsTimer(); 57 | } 58 | -------------------------------------------------------------------------------- /util/windows/WindowsTimer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // WindowsTimer.h: Definition of a high precision timer class on Windows 8 | 9 | #ifndef UTIL_WINDOWS_TIMER_H 10 | #define UTIL_WINDOWS_TIMER_H 11 | 12 | #include 13 | 14 | #include "Timer.h" 15 | 16 | class WindowsTimer : public Timer 17 | { 18 | public: 19 | WindowsTimer(); 20 | 21 | void start() override; 22 | void stop() override; 23 | double getElapsedTime() const override; 24 | 25 | private: 26 | bool mRunning; 27 | LONGLONG mStartTime; 28 | LONGLONG mStopTime; 29 | 30 | LONGLONG mFrequency; 31 | }; 32 | 33 | #endif // UTIL_WINDOWS_TIMER_H 34 | -------------------------------------------------------------------------------- /util/windows/win32/Win32Pixmap.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // Win32Pixmap.h: Definition of the implementation of OSPixmap for Win32 (Windows) 8 | 9 | #ifndef UTIL_WIN32_PIXMAP_H_ 10 | #define UTIL_WIN32_PIXMAP_H_ 11 | 12 | #include 13 | 14 | #include "OSPixmap.h" 15 | 16 | class Win32Pixmap : public OSPixmap 17 | { 18 | public: 19 | Win32Pixmap(); 20 | ~Win32Pixmap() override; 21 | 22 | bool initialize(EGLNativeDisplayType display, size_t width, size_t height, int depth) override; 23 | 24 | EGLNativePixmapType getNativePixmap() const override; 25 | 26 | private: 27 | HBITMAP mBitmap; 28 | }; 29 | 30 | #endif // UTIL_WIN32_PIXMAP_H_ 31 | -------------------------------------------------------------------------------- /util/windows/win32/Win32_system_utils.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // Win32_system_utils.cpp: Implementation of OS-specific functions for Win32 (Windows) 8 | 9 | #include "system_utils.h" 10 | 11 | #include 12 | #include 13 | 14 | namespace angle 15 | { 16 | 17 | void SetLowPriorityProcess() 18 | { 19 | SetPriorityClass(GetCurrentProcess(), BELOW_NORMAL_PRIORITY_CLASS); 20 | } 21 | 22 | } // namespace angle 23 | -------------------------------------------------------------------------------- /util/windows/winrt/WinRTPixmap.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // WinRTPixmap.cpp: Stub implementation of OSPixmap functions for WinRT (Windows) 8 | 9 | #include "OSPixmap.h" 10 | 11 | #include "common/debug.h" 12 | 13 | OSPixmap *CreateOSPixmap() 14 | { 15 | UNIMPLEMENTED(); 16 | return nullptr; 17 | } -------------------------------------------------------------------------------- /util/windows/winrt/WinRTWindow.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // WinRTWindow.h: Definition of the implementation of OSWindow for WinRT (Windows) 8 | 9 | #ifndef UTIL_WINRT_WINDOW_H 10 | #define UTIL_WINRT_WINDOW_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include "OSWindow.h" 18 | 19 | class WinRTWindow : public OSWindow 20 | { 21 | public: 22 | WinRTWindow(); 23 | ~WinRTWindow() override; 24 | 25 | bool initialize(const std::string &name, size_t width, size_t height) override; 26 | void destroy() override; 27 | 28 | EGLNativeWindowType getNativeWindow() const override; 29 | EGLNativeDisplayType getNativeDisplay() const override; 30 | 31 | void messageLoop() override; 32 | 33 | void setMousePosition(int x, int y) override; 34 | bool setPosition(int x, int y) override; 35 | bool resize(int width, int height) override; 36 | void setVisible(bool isVisible) override; 37 | 38 | void signalTestEvent() override; 39 | 40 | private: 41 | EGLNativeWindowType mNativeWindow; 42 | Microsoft::WRL::ComPtr mCoreDispatcher; 43 | }; 44 | 45 | #endif // UTIL_WINRT_WINDOW_H 46 | -------------------------------------------------------------------------------- /util/windows/winrt/WinRT_system_utils.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // WinRT_system_utils.cpp: Implementation of OS-specific functions for WinRT (Windows) 8 | 9 | #include "system_utils.h" 10 | 11 | #include 12 | #include 13 | 14 | namespace angle 15 | { 16 | 17 | void SetLowPriorityProcess() 18 | { 19 | // No equivalent to this in WinRT 20 | } 21 | 22 | } // namespace angle 23 | -------------------------------------------------------------------------------- /util/x11/X11Pixmap.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // X11Pixmap.cpp: Implementation of OSPixmap for X11 8 | 9 | #include "x11/X11Pixmap.h" 10 | 11 | X11Pixmap::X11Pixmap() 12 | : mPixmap(0), 13 | mDisplay(nullptr) 14 | { 15 | } 16 | 17 | X11Pixmap::~X11Pixmap() 18 | { 19 | if (mPixmap) 20 | { 21 | XFreePixmap(mDisplay, mPixmap); 22 | } 23 | } 24 | 25 | bool X11Pixmap::initialize(EGLNativeDisplayType display, size_t width, size_t height, int depth) 26 | { 27 | mDisplay = display; 28 | 29 | int screen = DefaultScreen(mDisplay); 30 | Window root = RootWindow(mDisplay, screen); 31 | 32 | mPixmap = XCreatePixmap(mDisplay, root, width, height, depth); 33 | 34 | return mPixmap != 0; 35 | } 36 | 37 | EGLNativePixmapType X11Pixmap::getNativePixmap() const 38 | { 39 | return mPixmap; 40 | } 41 | 42 | OSPixmap *CreateOSPixmap() 43 | { 44 | return new X11Pixmap(); 45 | } 46 | -------------------------------------------------------------------------------- /util/x11/X11Pixmap.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style license that can be 4 | // found in the LICENSE file. 5 | // 6 | 7 | // X11Pixmap.h: Definition of the implementation of OSPixmap for X11 8 | 9 | #ifndef UTIL_X11_PIXMAP_H_ 10 | #define UTIL_X11_PIXMAP_H_ 11 | 12 | #include 13 | #include 14 | 15 | #include "OSPixmap.h" 16 | 17 | class X11Pixmap : public OSPixmap 18 | { 19 | public: 20 | X11Pixmap(); 21 | ~X11Pixmap() override; 22 | 23 | bool initialize(EGLNativeDisplayType display, size_t width, size_t height, int depth) override; 24 | 25 | EGLNativePixmapType getNativePixmap() const override; 26 | 27 | private: 28 | Pixmap mPixmap; 29 | Display *mDisplay; 30 | }; 31 | 32 | #endif // UTIL_X11_PIXMAP_H_ 33 | --------------------------------------------------------------------------------