2019-03-28 04:03:35 +00:00
|
|
|
cmake_minimum_required(VERSION 3.0)
|
2021-07-08 01:45:54 +00:00
|
|
|
project(renderer_EGL LANGUAGES C CXX)
|
2019-03-28 00:02:36 +00:00
|
|
|
|
2019-03-28 04:01:52 +00:00
|
|
|
find_package(PkgConfig)
|
2021-07-24 01:47:54 +00:00
|
|
|
pkg_check_modules(RENDERER_EGL REQUIRED IMPORTED_TARGET
|
2022-05-28 18:45:13 +00:00
|
|
|
egl
|
|
|
|
gl
|
2019-03-28 00:02:36 +00:00
|
|
|
)
|
|
|
|
|
2021-07-24 01:47:54 +00:00
|
|
|
pkg_check_modules(RENDERER_EGL_OPT IMPORTED_TARGET
|
2022-05-28 18:45:13 +00:00
|
|
|
wayland-egl
|
2019-10-26 00:23:04 +00:00
|
|
|
)
|
|
|
|
|
2021-10-09 23:36:26 +00:00
|
|
|
find_program(AWK NAMES gawk mawk original-awk awk)
|
2021-08-09 20:13:30 +00:00
|
|
|
|
|
|
|
if(AWK MATCHES ".+-NOTFOUND")
|
2022-05-28 18:45:13 +00:00
|
|
|
message(FATAL_ERROR "FATAL: some known version of awk couldn't be found (${AWK}).")
|
2021-08-09 20:13:30 +00:00
|
|
|
else()
|
2022-05-28 18:45:13 +00:00
|
|
|
message(STATUS "Using awk: ${AWK}")
|
2021-08-09 20:13:30 +00:00
|
|
|
endif()
|
|
|
|
|
2019-03-28 04:01:52 +00:00
|
|
|
include(MakeObject)
|
2021-08-09 09:15:42 +00:00
|
|
|
function(build_shaders header_dir)
|
2022-05-28 18:45:13 +00:00
|
|
|
file(GLOB headers "${header_dir}/*.h")
|
|
|
|
set(EGL_SHADER_PROCESSED)
|
|
|
|
foreach(shader ${ARGN})
|
|
|
|
set(out_f "${CMAKE_CURRENT_BINARY_DIR}/${shader}")
|
|
|
|
add_custom_command(OUTPUT "${out_f}"
|
|
|
|
COMMAND "${AWK}" -f "${CMAKE_CURRENT_SOURCE_DIR}/glsl.include.awk"
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/${shader}" > "${out_f}"
|
|
|
|
MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/${shader}"
|
|
|
|
DEPENDS ${headers}
|
|
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/shader"
|
|
|
|
COMMENT "Preprocessing shader ${shader}"
|
|
|
|
VERBATIM
|
|
|
|
)
|
|
|
|
endforeach()
|
2021-08-09 09:15:42 +00:00
|
|
|
|
2022-05-28 18:45:13 +00:00
|
|
|
set(CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}")
|
|
|
|
make_object(
|
|
|
|
EGL_SHADER
|
|
|
|
${ARGN}
|
|
|
|
)
|
2021-08-09 09:15:42 +00:00
|
|
|
|
2022-05-28 18:45:13 +00:00
|
|
|
set(EGL_SHADER_OBJS "${EGL_SHADER_OBJS}" PARENT_SCOPE)
|
|
|
|
set(EGL_SHADER_INCS "${EGL_SHADER_INCS}" PARENT_SCOPE)
|
2021-08-09 09:15:42 +00:00
|
|
|
endfunction()
|
|
|
|
|
|
|
|
build_shaders(
|
2022-05-28 18:45:13 +00:00
|
|
|
shader
|
|
|
|
shader/desktop.vert
|
|
|
|
shader/desktop_rgb.frag
|
|
|
|
shader/cursor.vert
|
|
|
|
shader/cursor_rgb.frag
|
|
|
|
shader/cursor_mono.frag
|
|
|
|
shader/damage.vert
|
|
|
|
shader/damage.frag
|
|
|
|
shader/basic.vert
|
2023-11-02 20:03:32 +00:00
|
|
|
shader/convert_bgr_bgra.frag
|
2022-05-28 18:45:13 +00:00
|
|
|
shader/ffx_cas.frag
|
|
|
|
shader/ffx_fsr1_easu.frag
|
|
|
|
shader/ffx_fsr1_rcas.frag
|
|
|
|
shader/downscale.frag
|
|
|
|
shader/downscale_lanczos2.frag
|
|
|
|
shader/downscale_linear.frag
|
2019-03-28 03:59:54 +00:00
|
|
|
)
|
|
|
|
|
2021-02-21 02:26:23 +00:00
|
|
|
make_defines(
|
2022-05-28 18:45:13 +00:00
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/shader/desktop_rgb.frag"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/shader/desktop_rgb.def.h"
|
2021-02-21 02:26:23 +00:00
|
|
|
)
|
|
|
|
|
2019-03-28 08:56:14 +00:00
|
|
|
add_library(renderer_EGL STATIC
|
2022-05-28 18:45:13 +00:00
|
|
|
egl.c
|
|
|
|
egldebug.c
|
|
|
|
shader.c
|
|
|
|
texture_util.c
|
|
|
|
texture.c
|
|
|
|
texture_buffer.c
|
|
|
|
texture_framebuffer.c
|
|
|
|
texture_dmabuf.c
|
|
|
|
model.c
|
|
|
|
desktop.c
|
|
|
|
desktop_rects.c
|
|
|
|
cursor.c
|
|
|
|
damage.c
|
|
|
|
framebuffer.c
|
|
|
|
postprocess.c
|
|
|
|
ffx.c
|
|
|
|
filter.c
|
2023-11-02 20:03:32 +00:00
|
|
|
filter_bgr_bgra.c
|
2022-05-28 18:45:13 +00:00
|
|
|
filter_ffx_cas.c
|
|
|
|
filter_ffx_fsr1.c
|
|
|
|
filter_downscale.c
|
|
|
|
${EGL_SHADER_OBJS}
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/shader/desktop_rgb.def.h"
|
|
|
|
${PROJECT_TOP}/repos/cimgui/imgui/backends/imgui_impl_opengl3.cpp
|
2019-03-28 00:02:36 +00:00
|
|
|
)
|
|
|
|
|
2021-07-18 06:38:37 +00:00
|
|
|
target_compile_definitions(renderer_EGL PRIVATE CIMGUI_DEFINE_ENUMS_AND_STRUCTS=1 IMGUI_IMPL_OPENGL_ES3)
|
2021-07-08 01:45:54 +00:00
|
|
|
|
2019-03-28 08:56:14 +00:00
|
|
|
target_link_libraries(renderer_EGL
|
2022-05-28 18:45:13 +00:00
|
|
|
PkgConfig::RENDERER_EGL
|
|
|
|
lg_common
|
2021-07-08 01:45:54 +00:00
|
|
|
|
2022-05-28 18:45:13 +00:00
|
|
|
cimgui
|
2019-03-28 00:02:36 +00:00
|
|
|
)
|
2021-07-24 01:47:54 +00:00
|
|
|
if(RENDERER_EGL_OPT_FOUND)
|
2022-05-28 18:45:13 +00:00
|
|
|
target_link_libraries(renderer_EGL
|
|
|
|
PkgConfig::RENDERER_EGL_OPT
|
|
|
|
)
|
2021-07-24 01:47:54 +00:00
|
|
|
endif()
|
2019-03-28 00:02:36 +00:00
|
|
|
|
2019-03-28 08:56:14 +00:00
|
|
|
target_include_directories(renderer_EGL
|
2022-05-28 18:45:13 +00:00
|
|
|
PRIVATE
|
|
|
|
src
|
|
|
|
${EGL_SHADER_INCS}
|
2019-03-28 00:02:36 +00:00
|
|
|
)
|