Added OpenGL 2.1 as a graphics backend
This commit is contained in:
parent
ca0a04bf1d
commit
33a03a382b
7 changed files with 6787 additions and 2204 deletions
|
|
@ -5,9 +5,15 @@ project(infinipaint)
|
|||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
# Options to set
|
||||
option(USE_VULKAN "Set to use Vulkan" OFF)
|
||||
option(USE_GRAPHITE "Set to use Skia graphite for backends that support it" OFF)
|
||||
option(USE_OPENGLES "Use OpenGL ES 3.1 instead of OpenGL 3.3" OFF)
|
||||
set(availableGraphicsBackends OpenGL3.3 OpenGL2.1 OpenGLES3.0 Vulkan)
|
||||
set(GRAPHICS_BACKEND OpenGL3.3 CACHE STRING "Graphics backend to use")
|
||||
set_property(CACHE GRAPHICS_BACKEND PROPERTY STRINGS ${availableGraphicsBackends})
|
||||
list(FIND availableGraphicsBackends ${GRAPHICS_BACKEND} graphicsBackendIndex)
|
||||
if(graphicsBackendIndex EQUAL -1)
|
||||
message(FATAL_ERROR "Graphics backend must be one of: ${availableGraphicsBackends}")
|
||||
endif()
|
||||
|
||||
option(USE_GRAPHITE "Use Skia Graphite Backend (only works for Vulkan graphics backend)" OFF)
|
||||
|
||||
option(USE_ASAN "Enable Address Sanitizer" OFF)
|
||||
option(USE_UBSAN "Enable Undefined Behaviour Sanitizer" OFF)
|
||||
|
|
@ -95,7 +101,7 @@ set(sources "src/main.cpp"
|
|||
"include/Helpers/Serializers.cpp"
|
||||
)
|
||||
|
||||
if(USE_VULKAN)
|
||||
if((NOT EMSCRIPTEN) AND (GRAPHICS_BACKEND STREQUAL "Vulkan"))
|
||||
list(APPEND sources
|
||||
"include/VkBootstrap.cpp"
|
||||
"src/VulkanContext/VkTestMemoryAllocator.cpp"
|
||||
|
|
@ -109,12 +115,6 @@ if(USE_VULKAN)
|
|||
"src/VulkanContext/GraphiteToolUtils.cpp"
|
||||
)
|
||||
endif()
|
||||
elseif(NOT EMSCRIPTEN)
|
||||
if(USE_OPENGLES)
|
||||
list(APPEND sources "include/glad/gles2.c")
|
||||
else()
|
||||
list(APPEND sources "include/glad/gl.c")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
|
|
@ -238,9 +238,9 @@ if(WIN32)
|
|||
target_compile_definitions(infinipaint PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX)
|
||||
endif()
|
||||
|
||||
if((NOT USE_VULKAN) AND (NOT EMSCRIPTEN))
|
||||
if(NOT EMSCRIPTEN AND ((GRAPHICS_BACKEND STREQUAL "OpenGL3.3") OR (GRAPHICS_BACKEND STREQUAL "OpenGLES3.0") OR (GRAPHICS_BACKEND STREQUAL "OpenGL2.1")))
|
||||
find_package(OpenGL REQUIRED)
|
||||
if(USE_OPENGLES)
|
||||
if(GRAPHICS_BACKEND STREQUAL "OpenGLES3.0")
|
||||
target_link_libraries(infinipaint OpenGL::GLES3)
|
||||
else()
|
||||
target_link_libraries(infinipaint OpenGL::GL)
|
||||
|
|
@ -271,11 +271,11 @@ else()
|
|||
target_link_libraries(infinipaint skia::skia)
|
||||
endif()
|
||||
|
||||
if((NOT USE_VULKAN) AND (NOT EMSCRIPTEN) AND LINUX)
|
||||
if((NOT (GRAPHICS_BACKEND STREQUAL "Vulkan")) AND (NOT EMSCRIPTEN) AND LINUX)
|
||||
target_link_libraries(infinipaint OpenGL::GLX)
|
||||
endif()
|
||||
|
||||
if(USE_VULKAN)
|
||||
if(GRAPHICS_BACKEND STREQUAL "Vulkan")
|
||||
target_compile_definitions(infinipaint PRIVATE USE_BACKEND_VULKAN SK_VULKAN)
|
||||
if(USE_GRAPHITE)
|
||||
target_compile_definitions(infinipaint PRIVATE SK_GRAPHITE USE_SKIA_BACKEND_GRAPHITE)
|
||||
|
|
@ -285,11 +285,15 @@ if(USE_VULKAN)
|
|||
message("Using Vulkan Ganesh Backend")
|
||||
endif()
|
||||
else()
|
||||
if(USE_OPENGLES)
|
||||
target_compile_definitions(infinipaint PRIVATE USING_OPENGLES)
|
||||
message("Using OpenGL ES")
|
||||
if(GRAPHICS_BACKEND STREQUAL "OpenGLES3.0")
|
||||
target_compile_definitions(infinipaint PRIVATE USE_BACKEND_OPENGLES_3_0)
|
||||
message("Using OpenGL ES 3.0")
|
||||
elseif(GRAPHICS_BACKEND STREQUAL "OpenGL2.1")
|
||||
target_compile_definitions(infinipaint PRIVATE USE_BACKEND_OPENGL_2_1)
|
||||
message("Using OpenGL 2.1")
|
||||
else()
|
||||
message("Using OpenGL")
|
||||
target_compile_definitions(infinipaint PRIVATE USE_BACKEND_OPENGL_3_3)
|
||||
message("Using OpenGL 3.3")
|
||||
endif()
|
||||
target_compile_definitions(infinipaint PRIVATE USE_BACKEND_OPENGL USE_SKIA_BACKEND_GANESH)
|
||||
endif()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue