Commit b02a708c by Antonio Maiorano

CMake: split out atsc-encoder into its own CMakeLists

Also remove dependency of third_party/astc-encoder on src/System/Debug.hpp. Bug: b/145758253 Change-Id: I329928d9221c99a416fcdb1b0dd44d2578a22cb8 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43269Reviewed-by: 's avatarBen Clayton <bclayton@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarAntonio Maiorano <amaiorano@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
parent 6636f143
...@@ -311,7 +311,6 @@ set(OPENGL_DIR ${SOURCE_DIR}/OpenGL) ...@@ -311,7 +311,6 @@ set(OPENGL_DIR ${SOURCE_DIR}/OpenGL)
set(OPENGL_COMPILER_DIR ${OPENGL_DIR}/compiler) set(OPENGL_COMPILER_DIR ${OPENGL_DIR}/compiler)
set(VULKAN_DIR ${SOURCE_DIR}/Vulkan) set(VULKAN_DIR ${SOURCE_DIR}/Vulkan)
set(THIRD_PARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party) set(THIRD_PARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party)
set(ASTC_DIR ${THIRD_PARTY_DIR}/astc-encoder)
set(TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tests) set(TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tests)
set(HELLO2_DIR ${THIRD_PARTY_DIR}/PowerVR_SDK/Examples/Beginner/01_HelloAPI/OGLES2) set(HELLO2_DIR ${THIRD_PARTY_DIR}/PowerVR_SDK/Examples/Beginner/01_HelloAPI/OGLES2)
...@@ -600,7 +599,6 @@ if(BUILD_MARL) ...@@ -600,7 +599,6 @@ if(BUILD_MARL)
add_subdirectory(third_party/marl) add_subdirectory(third_party/marl)
endif() endif()
########################################################### ###########################################################
# cppdap # cppdap
########################################################### ###########################################################
...@@ -609,6 +607,12 @@ if(SWIFTSHADER_BUILD_CPPDAP) ...@@ -609,6 +607,12 @@ if(SWIFTSHADER_BUILD_CPPDAP)
add_subdirectory(third_party/cppdap) add_subdirectory(third_party/cppdap)
endif() endif()
###########################################################
# astc-encoder
###########################################################
if(SWIFTSHADER_ENABLE_ASTC)
add_subdirectory(third_party/astc-encoder)
endif()
########################################################### ###########################################################
# Include Directories # Include Directories
...@@ -753,15 +757,6 @@ if(SWIFTSHADER_ENABLE_VULKAN_DEBUGGER) ...@@ -753,15 +757,6 @@ if(SWIFTSHADER_ENABLE_VULKAN_DEBUGGER)
list(APPEND SWIFTSHADER_COMPILE_OPTIONS "-DENABLE_VK_DEBUGGER") list(APPEND SWIFTSHADER_COMPILE_OPTIONS "-DENABLE_VK_DEBUGGER")
endif() endif()
if(SWIFTSHADER_ENABLE_ASTC)
file(GLOB_RECURSE VULKAN_ASTC_LIST
${ASTC_DIR}/Source/*.cpp
${ASTC_DIR}/Source/*.h
)
list(APPEND VULKAN_LIST ${VULKAN_ASTC_LIST})
list(APPEND SWIFTSHADER_COMPILE_OPTIONS "-DSWIFTSHADER_ENABLE_ASTC")
endif()
if(LINUX OR ANDROID) if(LINUX OR ANDROID)
list(APPEND VULKAN_LIST list(APPEND VULKAN_LIST
${SOURCE_DIR}/System/Linux/MemFd.cpp ${SOURCE_DIR}/System/Linux/MemFd.cpp
...@@ -1050,6 +1045,9 @@ if(SWIFTSHADER_BUILD_VULKAN) ...@@ -1050,6 +1045,9 @@ if(SWIFTSHADER_BUILD_VULKAN)
if(SWIFTSHADER_ENABLE_VULKAN_DEBUGGER) if(SWIFTSHADER_ENABLE_VULKAN_DEBUGGER)
list(APPEND VK_SWIFTSHADER_LIBS cppdap) list(APPEND VK_SWIFTSHADER_LIBS cppdap)
endif() endif()
if(SWIFTSHADER_ENABLE_ASTC)
list(APPEND VK_SWIFTSHADER_LIBS astc-encoder)
endif()
target_link_libraries(vk_swiftshader ${VK_SWIFTSHADER_LIBS}) target_link_libraries(vk_swiftshader ${VK_SWIFTSHADER_LIBS})
add_custom_command( add_custom_command(
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include "System/Math.hpp" #include "System/Math.hpp"
#ifdef SWIFTSHADER_ENABLE_ASTC #ifdef SWIFTSHADER_ENABLE_ASTC
# include "../third_party/astc-encoder/Source/astc_codec_internals.h" # include "astc_codec_internals.h"
#endif #endif
#include <memory> #include <memory>
......
# Copyright 2020 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.
set(ROOT_PROJECT_COMPILE_OPTIONS
${SWIFTSHADER_COMPILE_OPTIONS}
${WARNINGS_AS_ERRORS}
)
set(ASTC_ENCODER_SRC_FILES
Source/astc_block_sizes2.cpp
Source/astc_codec_internals.h
Source/astc_color_unquantize.cpp
Source/astc_decompress_symbolic.cpp
Source/astc_image_load_store.cpp
Source/astc_integer_sequence.cpp
Source/astc_mathlib.cpp
Source/astc_mathlib.h
Source/astc_mathlib_softfloat.cpp
Source/astc_partition_tables.cpp
Source/astc_percentile_tables.cpp
Source/astc_quantization.cpp
Source/astc_symbolic_physical.cpp
Source/astc_weight_quant_xfer_tables.cpp
)
add_library(astc-encoder STATIC EXCLUDE_FROM_ALL
${ASTC_ENCODER_SRC_FILES}
)
set_target_properties(astc-encoder PROPERTIES
POSITION_INDEPENDENT_CODE 1
FOLDER "Core"
)
target_include_directories(astc-encoder
PUBLIC
"Source"
)
target_compile_definitions(astc-encoder
PUBLIC
# TODO: Remove SWIFTSHADER from the name
"SWIFTSHADER_ENABLE_ASTC"
)
target_compile_options(astc-encoder
PUBLIC
${ROOT_PROJECT_COMPILE_OPTIONS}
)
...@@ -20,7 +20,8 @@ ...@@ -20,7 +20,8 @@
*/ */
#include "astc_codec_internals.h" #include "astc_codec_internals.h"
#include "System/Debug.hpp"
#include <cassert>
static int rgb_delta_unpack( static int rgb_delta_unpack(
const int input[6], const int input[6],
...@@ -907,7 +908,8 @@ void unpack_color_endpoints( ...@@ -907,7 +908,8 @@ void unpack_color_endpoints(
break; break;
default: default:
UNREACHABLE("endpoint_format %d", int(format)); assert(false && "Unreachable");
break;
} }
if (*alpha_hdr == -1) if (*alpha_hdr == -1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment