diff options
author | android-autoroll <android-autoroll@skia-public.iam.gserviceaccount.com> | 2022-04-14 17:39:06 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-04-14 17:39:06 +0000 |
commit | 81a6937f61e959091cc3c975d07aad90c22870ee (patch) | |
tree | f02737d0f4fa3d1a53db006e1c8adfda43a41db2 | |
parent | f53f9dab3c3ab3fe5d5a06476ce5b0c9fe00e0d0 (diff) | |
parent | f03371f25e2796a75cd824794ce8702fdf31130f (diff) | |
download | swiftshader-81a6937f61e959091cc3c975d07aad90c22870ee.tar.gz |
Roll SwiftShader from 6190d1fc7e14 to 598c7cddf07f (3 revisions) am: f03371f25e
Original change: https://android-review.googlesource.com/c/platform/external/swiftshader/+/2064808
Change-Id: I6be22cb9b808610b03b36f9a6b5f72090c334181
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | BUILD.gn | 9 | ||||
-rw-r--r-- | CMakeLists.txt | 6 | ||||
-rw-r--r-- | extensions/CHROMIUM_texture_filtering_hint.txt | 85 | ||||
-rw-r--r-- | extensions/EGL_ANGLE_iosurface_client_buffer.txt | 124 | ||||
-rw-r--r-- | src/Main/BUILD.gn | 86 | ||||
-rw-r--r-- | src/OpenGL/common/BUILD.gn | 43 | ||||
-rw-r--r-- | src/OpenGL/compiler/BUILD.gn | 92 | ||||
-rw-r--r-- | src/OpenGL/libEGL/BUILD.gn | 105 | ||||
-rw-r--r-- | src/OpenGL/libGLESv2/BUILD.gn | 146 | ||||
-rw-r--r-- | src/Renderer/BUILD.gn | 61 | ||||
-rw-r--r-- | src/Shader/BUILD.gn | 59 | ||||
-rw-r--r-- | src/WSI/XcbSurfaceKHR.cpp | 73 | ||||
-rw-r--r-- | src/WSI/XcbSurfaceKHR.hpp | 14 | ||||
-rw-r--r-- | src/WSI/libXCB.cpp | 4 | ||||
-rw-r--r-- | src/WSI/libXCB.hpp | 4 | ||||
-rw-r--r-- | tests/GLESUnitTests/BUILD.gn | 65 |
16 files changed, 56 insertions, 920 deletions
@@ -84,8 +84,8 @@ config("swiftshader_config") { group("swiftshader") { data_deps = [ - "src/OpenGL/libEGL:swiftshader_libEGL", - "src/OpenGL/libGLESv2:swiftshader_libGLESv2", + "src/Vulkan:icd_file", + "src/Vulkan:swiftshader_libvulkan", ] } @@ -93,10 +93,7 @@ if (build_with_chromium) { group("swiftshader_tests") { testonly = true - data_deps = [ - "tests/GLESUnitTests:swiftshader_unittests", - "tests/SystemUnitTests:swiftshader_system_unittests", - ] + data_deps = [ "tests/SystemUnitTests:swiftshader_system_unittests" ] if (supports_llvm) { data_deps += diff --git a/CMakeLists.txt b/CMakeLists.txt index 70499958b..deb0c05aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -111,10 +111,10 @@ if(LINUX) check_symbol_exists(mallinfo2 malloc.h HAVE_MALLINFO2) include(CheckIncludeFiles) - CHECK_INCLUDE_FILES("xcb/xcb.h" HAVE_XCB_H) + CHECK_INCLUDE_FILES("xcb/xcb.h;xcb/shm.h" HAVE_XCB_H) if(NOT HAVE_XCB_H) - message(WARNING "xcb/xcb.h was not found. Install the libx11-xcb-dev package " - "to build with WSI support for XCB surfaces.") + message(WARNING "xcb/xcb.h or xcb/shm.h was not found. Install the libx11-xcb-dev and " + "libxcb-shm0-dev packages to build with WSI support for XCB surfaces.") endif() endif() diff --git a/extensions/CHROMIUM_texture_filtering_hint.txt b/extensions/CHROMIUM_texture_filtering_hint.txt deleted file mode 100644 index 38af6e010..000000000 --- a/extensions/CHROMIUM_texture_filtering_hint.txt +++ /dev/null @@ -1,85 +0,0 @@ -Name - - CHROMIUM_texture_filtering_hint - -Name Strings - - GL_CHROMIUM_texture_filtering_hint - -Contributors - - Alexis Hetu, Google Inc. - Nicolas Capens, Google Inc. - Shannon Woods, Google Inc. - -Contact - - Alexis Hetu, Google Inc. (sugoi 'at' chromium 'dot' org) - -Version - - Last Modifed Date: July 18, 2017 - -Dependencies - - This extension is written against the OpenGL ES 2.0 specification. - - OpenGL ES 2.0 is required. - -Overview - - This extension defines a way to request high precision texture filtering - using a new value to Hint. - - When this extension is enabled, TEXTURE_FILTERING_HINT_CHROMIUM can be used - by the implementation as a means to distinguish between a performance - focused implementation, using FASTEST, or a precision focused - implementation, using NICEST. - - Like other hints, either option is spec compliant and the behavior of - DONT_CARE is implementation specific. - -New Tokens - - Accepted by the <pname> parameter of GetIntegerv, GetFloatv and GetBooleanv - and by the <target> parameter of Hint: - - TEXTURE_FILTERING_HINT_CHROMIUM 0x8AF0 - -New Procedures and Functions - - None. - -Errors - - None. - -New State - - None. - -Issues - - 1) When does the hint take effect? - - At the time of the next draw call, and all subsequent draw calls. - - 2) Does the first draw call after the filtering hint is changed use the - updated filtering method? - - Yes - - 3) Can I switch it back and forth between every draw call, multiple times - during a single frame? - - Yes - - 4) Do program objects which were created before the filtering hint was - changed and which contain sampling instructions use the filtering method - from when they were created, or the method at the time of draw call? - - At the time of draw call. - -Revision History - - 2/7/2014 Documented the extension diff --git a/extensions/EGL_ANGLE_iosurface_client_buffer.txt b/extensions/EGL_ANGLE_iosurface_client_buffer.txt deleted file mode 100644 index 8206eab38..000000000 --- a/extensions/EGL_ANGLE_iosurface_client_buffer.txt +++ /dev/null @@ -1,124 +0,0 @@ -Name - - ANGLE_iosurface_client_buffer - -Name Strings - - EGL_ANGLE_iosurface_client_buffer - -Contributors - - Corentin Wallez - Geoff Lang - James Darpinian - -Contacts - - Corentin Wallez, Google Inc. (cwallez 'at' google.com) - -Status - - Draft - -Version - Version 3, Aug 13, 2019 - -Number - - EGL Extension #?? - -Dependencies - - This extension is written against the wording of the EGL 1.4 - Specification. - -Overview - - This extension allows creating EGL surfaces from IOSurface objects. - -New Types - - None - -New Procedures and Functions - - None - -New Tokens - - Accepted in the <buftype> parameter of eglCreatePbufferFromClientBuffer: - - EGL_IOSURFACE_ANGLE 0x3454 - EGL_IOSURFACE_PLANE_ANGLE 0x345A - EGL_TEXTURE_RECTANGLE_ANGLE 0x345B - EGL_TEXTURE_TYPE_ANGLE 0x345C - EGL_TEXTURE_INTERNAL_FORMAT_ANGLE 0x345D - -Additions to Chapter 3 of the EGL 1.4 Specification (EGL Functions and Errors) - - Replace the last sentence of paragraph 1 of Section 3.5.3 with the - following text. - "Currently, the only client API resources which may be bound in this - fashion are OpenVG VGImage objects and IOSurface objects." - - Replace the third paragraph of Section 3.5.3 with the following text. - "<buftype> specifies the type of buffer to be bound. The only allowed values - of <buftype> are EGL_OPENVG_IMAGE and EGL_IOSURFACE_ANGLE". - - Append the following text to the fourth paragraph of Section 3.5.3. - "When <buftype> is EGL_IOSURFACE_ANGLE, <buffer> must be a valid IOSurface - object case into the type EGLClientBuffer." - - Append to the end of Section 3.5.3. - "When <buftype> is EGL_IOSURFACE_ANGLE, <attrib_list> must contain all the - following attributes otherwise EGL_BAD_PARAMETER is generated. The - attributes must satisfy the following constraints otherwise - EGL_BAD_ATTRIBUTE is generated: - - EGL_TEXTURE_TYPE_ANGLE, and EGL_TEXTURE_INTERNAL_FORMAT_ANGLE followed - by OpenGL enums for texture types, and texture internal format - respectively. - - EGL_TEXTURE_FORMAT with a value of EGL_TEXTURE_RGBA - - EGL_WIDTH with a value between 1 and the width of <buffer>. - - EGL_HEIGHT with a value between 1 and the height of <buffer>. - - EGL_TEXTURE_TARGET with a value of EGL_TEXTURE_RECTANGLE_ANGLE - - EGL_IOSURFACE_PLANE_ANGLE with a value between 0 and the number of - planes of <buffer> (exclusive). - - In addition the EGL_TEXTURE_TYPE_ANGLE and - EGL_TEXTURE_INTERNAL_FORMAT_ANGLE attributes must be one of the - combinations listed in table egl.iosurface.formats or an - EGL_BAD_PARAMETER is generated. The combination must also be a valid - combinations for glTexImage2D or EGL_BAD_PARAMETER is generated." - - --------------------------------------------------------------------------- - Texture Type Texture Internal Format - --------------------------------------------------------------------------- - GL_UNSIGNED_BYTE GL_RED - GL_UNSIGNED_SHORT GL_R16UI - GL_UNSIGNED_BYTE GL_RG - GL_UNSIGNED_BYTE GL_RGB - GL_UNSIGNED_BYTE GL_BGRA_EXT - GL_HALF_FLOAT GL_RGBA - --------------------------------------------------------------------------- - Table egl.iosurface.formats - Valid combinations of format, type and - internal format for IOSurface-backed pbuffers. - --------------------------------------------------------------------------- - - Append to the end of Section 3.5.3. - "When a pbuffer is created with type EGL_IOSURFACE_ANGLE, the contents - of the associcated IOSurface object are undefined while the pbuffer is - bound to a client texture." - -Issues - - 1. Can RGB formats be supported? - - RESOLVED: Support for RGB internal formats is added in version 3. Surfaces - with an RGB format will ensure that the alpha channel of the IOSurface is - reset to 1.0 when it is used. - -Revision History - - Version 1, 2017/12/06 - first draft. - Version 2, 2019/04/01 - Allow MakeCurrent. - Version 3, 2019/08/13 - Allow RGB internal formats diff --git a/src/Main/BUILD.gn b/src/Main/BUILD.gn deleted file mode 100644 index 136de9385..000000000 --- a/src/Main/BUILD.gn +++ /dev/null @@ -1,86 +0,0 @@ -# Copyright 2016 The SwiftShader Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//build/config/ui.gni") -import("../swiftshader.gni") - -# Need a separate config to ensure the warnings are added to the end. -config("swiftshader_main_private_config") { - if (is_win) { - cflags = [ - "/wd4201", # nameless struct/union - "/wd5030", # attribute is not recognized - ] - - if (is_clang) { - cflags += [ - "-Wno-string-conversion", - "-Wno-sign-compare", - ] - } - } -} - -swiftshader_source_set("swiftshader_main") { - deps = [ - "../Common:swiftshader_common", - ] - - sources = [ - "Config.cpp", - "FrameBuffer.cpp", - "SwiftConfig.cpp", - ] - - defines = [] - - if (use_ozone && !is_win) { - sources += [ - "FrameBufferOzone.cpp", - "FrameBufferFactoryOzone.cpp", - ] - } else if (is_mac) { - sources += [ "FrameBufferOSX.mm" ] - } else if (is_win) { - sources += [ - "FrameBufferDD.cpp", - "FrameBufferGDI.cpp", - "FrameBufferWin.cpp", - ] - } - - if (ozone_platform_x11) { - sources += [ - "FrameBufferX11.cpp", - "libX11.cpp", - ] - defines += [ "SWIFTSHADER_USE_X11" ] - } - - if (is_win) { - libs = [ "dxguid.lib" ] # For FrameBufferDD - } - - configs = [ ":swiftshader_main_private_config" ] - - include_dirs = [ ".." ] - - if (is_mac) { - include_dirs += [ "../../include" ] - frameworks = [ - "Quartz.framework", - "Cocoa.framework", - ] - } -} diff --git a/src/OpenGL/common/BUILD.gn b/src/OpenGL/common/BUILD.gn deleted file mode 100644 index 9cc22bfb5..000000000 --- a/src/OpenGL/common/BUILD.gn +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright 2016 The SwiftShader Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("../../swiftshader.gni") - -# Need a separate config to ensure the warnings are added to the end. -config("swiftshader_opengl_common_private_config") { - if (is_win) { - cflags = [ - "/wd4201", # nameless struct/union - "/wd4324", # structure was padded due to alignment specifier - "/wd5030", # attribute is not recognized - ] - } -} - -swiftshader_source_set("swiftshader_opengl_common") { - sources = [ - "Image.cpp", - "MatrixStack.cpp", - "Object.cpp", - "debug.cpp", - ] - - configs = [ ":swiftshader_opengl_common_private_config" ] - - include_dirs = [ - "..", - "../..", - "../../../include", - ] -} diff --git a/src/OpenGL/compiler/BUILD.gn b/src/OpenGL/compiler/BUILD.gn deleted file mode 100644 index 67b2739e8..000000000 --- a/src/OpenGL/compiler/BUILD.gn +++ /dev/null @@ -1,92 +0,0 @@ -# Copyright 2016 The SwiftShader Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("../../swiftshader.gni") -import("//testing/libfuzzer/fuzzer_test.gni") - -# Need a separate config to ensure the warnings are added to the end. -config("swiftshader_opengl_compiler_private_config") { - if (is_win) { - cflags = [ - "/wd4005", # macro redefinition (in autogenerated code) - "/wd4201", # nameless struct/union - "/wd4267", # conversion from size_t to int/unsigned int - "/wd4702", # unreachable code (in autogenerated code) - "/wd5030", # attribute is not recognized - ] - - if (!is_debug) { - cflags += [ "/wd4189" ] # local variable is initialized but not referenced (variables only used in ASSERTS) - } - } else { - cflags = [ "-Wno-sign-compare" ] - - if (!is_debug) { - cflags += [ "-Wno-unused-variable" ] # local variable is initialized but not referenced (variables only used in ASSERTS) - } - } -} - -config("swiftshader_translator_disable_pool_alloc") { - defines = [ "SWIFTSHADER_TRANSLATOR_DISABLE_POOL_ALLOC" ] -} - -swiftshader_source_set("swiftshader_opengl_compiler") { - deps = [ - "preprocessor:swiftshader_opengl_preprocessor", - ] - - sources = [ - "AnalyzeCallDepth.cpp", - "Compiler.cpp", - "Diagnostics.cpp", - "DirectiveHandler.cpp", - "InfoSink.cpp", - "Initialize.cpp", - "InitializeParseContext.cpp", - "IntermTraverse.cpp", - "Intermediate.cpp", - "OutputASM.cpp", - "ParseHelper.cpp", - "PoolAlloc.cpp", - "SymbolTable.cpp", - "TranslatorASM.cpp", - "ValidateLimitations.cpp", - "ValidateSwitch.cpp", - "debug.cpp", - "glslang_lex.cpp", - "glslang_tab.cpp", - "intermOut.cpp", - "parseConst.cpp", - "util.cpp", - ] - - if (use_fuzzing_engine) { - all_dependent_configs = [ ":swiftshader_translator_disable_pool_alloc" ] - } - - if (is_linux || is_chromeos || is_mac || is_fuchsia) { - sources += [ "ossource_posix.cpp" ] - } else if (is_win) { - sources += [ "ossource_win.cpp" ] - } - - configs = [ ":swiftshader_opengl_compiler_private_config" ] - - include_dirs = [ - "..", - "../..", - "../../../include", - ] -} diff --git a/src/OpenGL/libEGL/BUILD.gn b/src/OpenGL/libEGL/BUILD.gn deleted file mode 100644 index 5363c5185..000000000 --- a/src/OpenGL/libEGL/BUILD.gn +++ /dev/null @@ -1,105 +0,0 @@ -# Copyright 2016 The SwiftShader Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//build/config/ui.gni") -import("//build/config/ozone.gni") -import("../../swiftshader.gni") - -# Need a separate config to ensure the warnings are added to the end. -config("swiftshader_libEGL_private_config") { - defines = [ "EGL_EGLEXT_PROTOTYPES" ] - - if (is_win) { - cflags = [ - "/wd4201", # nameless struct/union - "/wd4065", # switch statement contains 'default' but no 'case' labels - "/wd5030", # attribute is not recognized - ] - - defines += [ "EGLAPI=" ] - } else { - cflags = [ - "-Wno-sign-compare", - "-Wno-unused-function", - ] - - if (is_mac) { - cflags += [ "-fvisibility=default" ] - defines += [ "EGLAPI=__attribute__((no_sanitize(\"function\")))" ] - } else if (is_clang) { - defines += [ "EGLAPI=__attribute__((visibility(\"protected\"))) __attribute__((no_sanitize(\"function\")))" ] - } else { - defines += [ "EGLAPI=__attribute__((visibility(\"protected\")))" ] - } - } -} - -swiftshader_shared_library("swiftshader_libEGL") { - if (!is_mac && !is_fuchsia) { - output_name = "libEGL" - output_dir = "$root_out_dir/swiftshader" - } - - sources = [ - "../../Common/SharedLibrary.cpp", - "../common/Object.cpp", - "../common/debug.cpp", - "Config.cpp", - "Display.cpp", - "Surface.cpp", - "libEGL.cpp", - "main.cpp", - "resource.h", - ] - - if (is_win) { - sources += [ - "libEGL.def", - "libEGL.rc", - ] - } - - defines = [] - - if (is_mac) { - sources += [ "OSXUtils.mm" ] - frameworks = [ - "Quartz.framework", - "Cocoa.framework", - "CoreFoundation.framework", - "IOSurface.framework", - ] - ldflags = [ - "-Wl,-install_name,@rpath/libswiftshader_libEGL.dylib", - "-Wl,-exported_symbols_list," + - rebase_path("libEGL_deprecated.exports", root_build_dir), - ] - } else if (is_linux || is_chromeos) { - if (ozone_platform_x11) { - sources += [ "../../Main/libX11.cpp" ] - defines += [ "SWIFTSHADER_USE_X11" ] - } - inputs = [ "libEGL_deprecated.lds" ] - ldflags = - [ "-Wl,--version-script=" + rebase_path("libEGL_deprecated.lds", root_build_dir) ] - } - - configs = [ ":swiftshader_libEGL_private_config" ] - - include_dirs = [ - "../../../include", - "../..", - "..", - ] -} diff --git a/src/OpenGL/libGLESv2/BUILD.gn b/src/OpenGL/libGLESv2/BUILD.gn deleted file mode 100644 index 65668f26b..000000000 --- a/src/OpenGL/libGLESv2/BUILD.gn +++ /dev/null @@ -1,146 +0,0 @@ -# Copyright 2016 The SwiftShader Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("../../swiftshader.gni") - -# Need a separate config to ensure the warnings are added to the end. -config("swiftshader_libGLESv2_private_config") { - defines = [ - "GL_API=", - "GL_GLEXT_PROTOTYPES", - ] - - if (is_win) { - cflags = [ - "/wd4201", # nameless struct/union - "/wd4324", # structure was padded due to alignment specifier - "/wd5030", # attribute is not recognized - ] - - defines += [ - "GL_APICALL=", - "GLAPI=", - ] - - if (is_clang) { - defines += [ - "__STDC_CONSTANT_MACROS", - "__STDC_LIMIT_MACROS", - ] - } - } else { - cflags = [ "-Wno-sign-compare" ] - - defines += [ - "__STDC_CONSTANT_MACROS", - "__STDC_LIMIT_MACROS", - "GLAPI=GL_APICALL", - ] - - if (is_mac) { - cflags += [ "-fvisibility=default" ] - defines += [ "GL_APICALL=__attribute__((no_sanitize(\"function\")))" ] - } else if (is_clang) { - defines += [ "GL_APICALL=__attribute__((visibility(\"protected\"))) __attribute__((no_sanitize(\"function\")))" ] - } else { - defines += [ "GL_APICALL=__attribute__((visibility(\"protected\")))" ] - } - } -} - -swiftshader_static_library("swiftshader_libGLESv2_static") { - deps = [ - "../../OpenGL/common:swiftshader_opengl_common", - "../../OpenGL/compiler:swiftshader_opengl_compiler", - "../../Reactor:swiftshader_reactor", - "../../Renderer:swiftshader_renderer", - ] - - sources = [ - "../../Common/SharedLibrary.cpp", - "Buffer.cpp", - "Context.cpp", - "Device.cpp", - "Fence.cpp", - "Framebuffer.cpp", - "IndexDataManager.cpp", - "Program.cpp", - "Query.cpp", - "Renderbuffer.cpp", - "ResourceManager.cpp", - "Shader.cpp", - "Texture.cpp", - "TransformFeedback.cpp", - "VertexArray.cpp", - "VertexDataManager.cpp", - "libGLESv2.cpp", - "libGLESv3.cpp", - "main.cpp", - "resource.h", - "utilities.cpp", - ] - - if (is_mac) { - frameworks = [ - "CoreFoundation.framework", - "IOSurface.framework", - ] - } - - configs = [ ":swiftshader_libGLESv2_private_config" ] - - include_dirs = [ - "../../../include", - "../..", - "..", - ] -} - -swiftshader_shared_library("swiftshader_libGLESv2") { - if (!is_mac && !is_fuchsia) { - output_name = "libGLESv2" - output_dir = "$root_out_dir/swiftshader" - } - - deps = [ ":swiftshader_libGLESv2_static" ] - - sources = [ "entry_points.cpp" ] - - if (is_win) { - sources += [ - "libGLESv2.def", - "libGLESv2.rc", - ] - } - - if (is_mac) { - ldflags = [ - "-Wl,-install_name,@rpath/libswiftshader_libGLESv2.dylib", - "-Wl,-exported_symbols_list," + - rebase_path("libGLESv2_deprecated.exports", root_build_dir), - ] - } else if (is_linux || is_chromeos) { - inputs = [ "libGLESv2_deprecated.lds" ] - ldflags = [ "-Wl,--version-script=" + - rebase_path("libGLESv2_deprecated.lds", root_build_dir) ] - } - - configs = [ ":swiftshader_libGLESv2_private_config" ] - - include_dirs = [ - "../../../include", - "../..", - "..", - ] -} diff --git a/src/Renderer/BUILD.gn b/src/Renderer/BUILD.gn deleted file mode 100644 index deda918e1..000000000 --- a/src/Renderer/BUILD.gn +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright 2016 The SwiftShader Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("../swiftshader.gni") - -# Need a separate config to ensure the warnings are added to the end. -config("swiftshader_renderer_private_config") { - if (is_win) { - cflags = [ - "/wd4201", # nameless struct/union - "/wd4324", # structure was padded due to alignment specifier - "/wd5030", # attribute is not recognized - ] - } else if (current_cpu == "x86" || current_cpu == "x64") { - cflags = [ "-Wno-sign-compare" ] - } -} - -swiftshader_source_set("swiftshader_renderer") { - deps = [ - "../Shader:swiftshader_shader", - ] - - sources = [ - "Blitter.cpp", - "Clipper.cpp", - "Color.cpp", - "Context.cpp", - "ETC_Decoder.cpp", - "Matrix.cpp", - "PixelProcessor.cpp", - "Plane.cpp", - "Point.cpp", - "QuadRasterizer.cpp", - "Renderer.cpp", - "Sampler.cpp", - "SetupProcessor.cpp", - "Surface.cpp", - "TextureStage.cpp", - "Vector.cpp", - "VertexProcessor.cpp", - ] - - configs = [ ":swiftshader_renderer_private_config" ] - - include_dirs = [ - ".", - "..", - ] -} diff --git a/src/Shader/BUILD.gn b/src/Shader/BUILD.gn deleted file mode 100644 index baf12338b..000000000 --- a/src/Shader/BUILD.gn +++ /dev/null @@ -1,59 +0,0 @@ -# Copyright 2016 The SwiftShader Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("../swiftshader.gni") - -# Need a separate config to ensure the warnings are added to the end. -config("swiftshader_shader_private_config") { - if (is_win) { - cflags = [ - "/wd4201", # nameless struct/union - "/wd4324", # structure was padded due to alignment specifier - "/wd5030", # attribute is not recognized - ] - - if (is_clang) { - cflags += [ "-Wno-sign-compare" ] - } - } -} - -swiftshader_source_set("swiftshader_shader") { - deps = [ - "../Main:swiftshader_main", - ] - - sources = [ - "Constants.cpp", - "PixelPipeline.cpp", - "PixelProgram.cpp", - "PixelRoutine.cpp", - "PixelShader.cpp", - "SamplerCore.cpp", - "SetupRoutine.cpp", - "Shader.cpp", - "ShaderCore.cpp", - "VertexPipeline.cpp", - "VertexProgram.cpp", - "VertexRoutine.cpp", - "VertexShader.cpp", - ] - - configs = [ ":swiftshader_shader_private_config" ] - - include_dirs = [ - ".", - "..", - ] -} diff --git a/src/WSI/XcbSurfaceKHR.cpp b/src/WSI/XcbSurfaceKHR.cpp index 1a4102a2a..3af964bbc 100644 --- a/src/WSI/XcbSurfaceKHR.cpp +++ b/src/WSI/XcbSurfaceKHR.cpp @@ -45,13 +45,13 @@ bool XcbSurfaceKHR::isSupported() } XcbSurfaceKHR::XcbSurfaceKHR(const VkXcbSurfaceCreateInfoKHR *pCreateInfo, void *mem) - : connection(pCreateInfo->connection) - , window(pCreateInfo->window) + : connection(pCreateInfo->connection) + , window(pCreateInfo->window) { ASSERT(isSupported()); gc = libXCB->xcb_generate_id(connection); - uint32_t values[2] = { 0, 0xffffffff }; + uint32_t values[2] = { 0, 0xFFFFFFFF }; libXCB->xcb_create_gc(connection, gc, window, XCB_GC_FOREGROUND | XCB_GC_BACKGROUND, values); auto shmQuery = libXCB->xcb_get_extension_data(connection, libXCB->xcb_shm_id); @@ -89,7 +89,7 @@ size_t XcbSurfaceKHR::ComputeRequiredAllocationSize(const VkXcbSurfaceCreateInfo VkResult XcbSurfaceKHR::getSurfaceCapabilities(VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) const { - if (surfaceLost) + if(surfaceLost) { return VK_ERROR_SURFACE_LOST_KHR; } @@ -110,12 +110,14 @@ VkResult XcbSurfaceKHR::getSurfaceCapabilities(VkSurfaceCapabilitiesKHR *pSurfac return VK_SUCCESS; } -void* XcbSurfaceKHR::allocateImageMemory(PresentImage *image, const VkMemoryAllocateInfo &allocateInfo) +void *XcbSurfaceKHR::allocateImageMemory(PresentImage *image, const VkMemoryAllocateInfo &allocateInfo) { - if (!mitSHM) + if(!mitSHM) + { return nullptr; + } - SHMPixmap& pixmap = pixmaps[image]; + SHMPixmap &pixmap = pixmaps[image]; int shmid = shmget(IPC_PRIVATE, allocateInfo.allocationSize, IPC_CREAT | SHM_R | SHM_W); pixmap.shmaddr = shmat(shmid, 0, 0); pixmap.shmseg = libXCB->xcb_generate_id(connection); @@ -129,20 +131,20 @@ void* XcbSurfaceKHR::allocateImageMemory(PresentImage *image, const VkMemoryAllo pixmap.pixmap = libXCB->xcb_generate_id(connection); libXCB->xcb_shm_create_pixmap( - connection, - pixmap.pixmap, - window, - width, height, - windowDepth, - pixmap.shmseg, - 0); + connection, + pixmap.pixmap, + window, + width, height, + windowDepth, + pixmap.shmseg, + 0); return pixmap.shmaddr; } void XcbSurfaceKHR::releaseImageMemory(PresentImage *image) { - if (mitSHM) + if(mitSHM) { auto it = pixmaps.find(image); assert(it != pixmaps.end()); @@ -179,7 +181,8 @@ VkResult XcbSurfaceKHR::present(PresentImage *image) return VK_ERROR_OUT_OF_DATE_KHR; } - if (!mitSHM) { + if(!mitSHM) + { // TODO: Convert image if not RGB888. int stride = image->getImage()->rowPitchBytes(VK_IMAGE_ASPECT_COLOR_BIT, 0); int bytesPerPixel = static_cast<int>(image->getImage()->getFormat(VK_IMAGE_ASPECT_COLOR_BIT).bytes()); @@ -187,17 +190,17 @@ VkResult XcbSurfaceKHR::present(PresentImage *image) auto buffer = reinterpret_cast<uint8_t *>(image->getImageMemory()->getOffsetPointer(0)); size_t bufferSize = extent.height * stride; libXCB->xcb_put_image( - connection, - XCB_IMAGE_FORMAT_Z_PIXMAP, - window, - gc, - width, - extent.height, - 0, 0, // dst x, y - 0, // left_pad - depth, - bufferSize, // data_len - buffer // data + connection, + XCB_IMAGE_FORMAT_Z_PIXMAP, + window, + gc, + width, + extent.height, + 0, 0, // dst x, y + 0, // left_pad + depth, + bufferSize, // data_len + buffer // data ); } else @@ -205,14 +208,14 @@ VkResult XcbSurfaceKHR::present(PresentImage *image) auto it = pixmaps.find(image); assert(it != pixmaps.end()); libXCB->xcb_copy_area( - connection, - it->second.pixmap, - window, - gc, - 0, 0, // src x, y - 0, 0, // dst x, y - extent.width, - extent.height); + connection, + it->second.pixmap, + window, + gc, + 0, 0, // src x, y + 0, 0, // dst x, y + extent.width, + extent.height); } libXCB->xcb_flush(connection); diff --git a/src/WSI/XcbSurfaceKHR.hpp b/src/WSI/XcbSurfaceKHR.hpp index a6892d4d0..eae92572f 100644 --- a/src/WSI/XcbSurfaceKHR.hpp +++ b/src/WSI/XcbSurfaceKHR.hpp @@ -18,9 +18,10 @@ #include "VkSurfaceKHR.hpp" #include "Vulkan/VkObject.hpp" -#include <vulkan/vulkan_xcb.h> -#include <xcb/xcb.h> #include <xcb/shm.h> +#include <xcb/xcb.h> +// XCB headers must be included before the Vulkan header. +#include <vulkan/vulkan_xcb.h> #include <unordered_map> @@ -38,7 +39,7 @@ public: VkResult getSurfaceCapabilities(VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) const override; - virtual void* allocateImageMemory(PresentImage *image, const VkMemoryAllocateInfo &allocateInfo) override; + virtual void *allocateImageMemory(PresentImage *image, const VkMemoryAllocateInfo &allocateInfo) override; virtual void releaseImageMemory(PresentImage *image) override; virtual void attachImage(PresentImage *image) override; virtual void detachImage(PresentImage *image) override; @@ -51,9 +52,10 @@ private: xcb_gcontext_t gc = XCB_NONE; int windowDepth = 0; mutable bool surfaceLost = false; - struct SHMPixmap { - xcb_shm_seg_t shmseg = XCB_NONE; - void *shmaddr = nullptr; + struct SHMPixmap + { + xcb_shm_seg_t shmseg = XCB_NONE; + void *shmaddr = nullptr; xcb_pixmap_t pixmap = XCB_NONE; }; std::unordered_map<PresentImage *, SHMPixmap> pixmaps; diff --git a/src/WSI/libXCB.cpp b/src/WSI/libXCB.cpp index 60be41ecf..212884cb6 100644 --- a/src/WSI/libXCB.cpp +++ b/src/WSI/libXCB.cpp @@ -54,7 +54,7 @@ LibXcbExports *LibXCB::loadExports() libxcb = RTLD_DEFAULT; } else - { + { libxcb = loadLibrary("libxcb.so.1"); } @@ -63,7 +63,7 @@ LibXcbExports *LibXCB::loadExports() libshm = RTLD_DEFAULT; } else - { + { libshm = loadLibrary("libxcb-shm.so.0"); } diff --git a/src/WSI/libXCB.hpp b/src/WSI/libXCB.hpp index 50a943cd6..ad957ca9f 100644 --- a/src/WSI/libXCB.hpp +++ b/src/WSI/libXCB.hpp @@ -34,10 +34,10 @@ struct LibXcbExports xcb_void_cookie_t (*xcb_free_pixmap)(xcb_connection_t *conn, xcb_pixmap_t pixmap); xcb_query_extension_reply_t *(*xcb_get_extension_data)(xcb_connection_t *c, xcb_extension_t *extension) = nullptr; - xcb_shm_query_version_cookie_t (*xcb_shm_query_version)(xcb_connection_t *c); + xcb_shm_query_version_cookie_t (*xcb_shm_query_version)(xcb_connection_t *c); xcb_shm_query_version_reply_t *(*xcb_shm_query_version_reply)(xcb_connection_t *c, xcb_shm_query_version_cookie_t cookie, xcb_generic_error_t **e); xcb_void_cookie_t (*xcb_shm_attach)(xcb_connection_t *c, xcb_shm_seg_t shmseg, uint32_t shmid, uint8_t read_only); - xcb_void_cookie_t (*xcb_shm_detach)(xcb_connection_t * c, xcb_shm_seg_t shmseg); + xcb_void_cookie_t (*xcb_shm_detach)(xcb_connection_t *c, xcb_shm_seg_t shmseg); xcb_void_cookie_t (*xcb_shm_create_pixmap)(xcb_connection_t *c, xcb_pixmap_t pid, xcb_drawable_t drawable, uint16_t width, uint16_t height, uint8_t depth, xcb_shm_seg_t shmseg, uint32_t offset); xcb_extension_t *xcb_shm_id; }; diff --git a/tests/GLESUnitTests/BUILD.gn b/tests/GLESUnitTests/BUILD.gn deleted file mode 100644 index b6c9d5c22..000000000 --- a/tests/GLESUnitTests/BUILD.gn +++ /dev/null @@ -1,65 +0,0 @@ -# Copyright 2016 The SwiftShader Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//testing/test.gni") -import("../../src/swiftshader.gni") - -if (build_with_chromium) { - test("swiftshader_unittests") { - deps = [ - "//base", - "//base/test:test_support", - "//testing/gmock", - "//testing/gtest", - "//third_party/googletest:gmock", - "//third_party/googletest:gtest", - "//third_party/swiftshader/src/OpenGL/libEGL:swiftshader_libEGL", - "//third_party/swiftshader/src/OpenGL/libGLESv2:swiftshader_libGLESv2", - ] - - sources = [ - "//gpu/swiftshader_tests_main.cc", - "unittests.cpp", - ] - - include_dirs = [ "../../include" ] # Khronos headers - - defines = [ - "GL_GLEXT_PROTOTYPES", - "GL_APICALL=", - "GLAPI=", - ] - - # Make sure we're loading SwiftShader's libraries, not ANGLE's or the system - # provided ones. On Windows an explicit LoadLibrary("swiftshader\lib*.dll") - # is required before making the first EGL or OpenGL ES call. - if (is_win) { - ldflags = [ - "/DELAYLOAD:libEGL.dll", - "/DELAYLOAD:libGLESv2.dll", - ] - } else if (is_mac) { - ldflags = [ - "-rpath", - "@executable_path/", - ] - frameworks = [ - "CoreFoundation.framework", - "IOSurface.framework", - ] - } else { - ldflags = [ "-Wl,-rpath=\$ORIGIN/swiftshader" ] - } - } -} |