mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Merge branch 'windows_gles' into android
This commit is contained in:
commit
82464ee4be
94 changed files with 1432 additions and 1233 deletions
|
@ -26,9 +26,11 @@ endif()
|
|||
if (ANDROID OR UWP)
|
||||
option(BUILD_SERVER "Build server components" OFF)
|
||||
option(BUILD_TOOLS "Build tools" OFF)
|
||||
option(BUILD_INSTALLER "Build installer" OFF)
|
||||
else()
|
||||
option(BUILD_SERVER "Build server components" ON)
|
||||
option(BUILD_TOOLS "Build tools" ON)
|
||||
option(BUILD_INSTALLER "Build installer" ON)
|
||||
endif()
|
||||
|
||||
if (SERVER_ONLY)
|
||||
|
@ -39,6 +41,8 @@ else()
|
|||
option(BUILD_TESTS "Build tests" ON)
|
||||
endif()
|
||||
|
||||
option(DISABLE_QML "Disable QML" OFF)
|
||||
option(DISABLE_KTX_CACHE "Disable KTX Cache" OFF)
|
||||
|
||||
|
||||
if (ANDROID)
|
||||
|
@ -64,8 +68,6 @@ foreach(PLATFORM_QT_COMPONENT ${PLATFORM_QT_COMPONENTS})
|
|||
endforeach()
|
||||
|
||||
|
||||
option(BUILD_INSTALLER "Build installer" ON)
|
||||
|
||||
MESSAGE(STATUS "Build server: " ${BUILD_SERVER})
|
||||
MESSAGE(STATUS "Build client: " ${BUILD_CLIENT})
|
||||
MESSAGE(STATUS "Build tests: " ${BUILD_TESTS})
|
||||
|
@ -73,6 +75,16 @@ MESSAGE(STATUS "Build tools: " ${BUILD_TOOLS})
|
|||
MESSAGE(STATUS "Build installer: " ${BUILD_INSTALLER})
|
||||
MESSAGE(STATUS "GL ES: " ${USE_GLES})
|
||||
|
||||
if (DISABLE_QML)
|
||||
MESSAGE(STATUS "QML disabled!")
|
||||
add_definitions(-DDISABLE_QML)
|
||||
endif()
|
||||
|
||||
if (DISABLE_KTX_CACHE)
|
||||
MESSAGE(STATUS "KTX cache disabled!")
|
||||
add_definitions(-DDISABLE_KTX_CACHE)
|
||||
endif()
|
||||
|
||||
if (UNIX AND DEFINED ENV{HIFI_MEMORY_DEBUGGING})
|
||||
MESSAGE(STATUS "Memory debugging is enabled")
|
||||
endif()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
set(TARGET_NAME native-lib)
|
||||
setup_hifi_library()
|
||||
link_hifi_libraries(shared networking gl gpu gpu-gles image fbx render-utils physics entities octree)
|
||||
link_hifi_libraries(shared networking gl gpu image fbx render-utils physics entities octree ${PLATFORM_GL_BACKEND})
|
||||
target_opengl()
|
||||
target_bullet()
|
||||
|
||||
|
|
|
@ -22,7 +22,9 @@ android {
|
|||
'-DHIFI_ANDROID_PRECOMPILED=' + HIFI_ANDROID_PRECOMPILED,
|
||||
'-DRELEASE_NUMBER=' + RELEASE_NUMBER,
|
||||
'-DRELEASE_TYPE=' + RELEASE_TYPE,
|
||||
'-DBUILD_BRANCH=' + BUILD_BRANCH
|
||||
'-DBUILD_BRANCH=' + BUILD_BRANCH,
|
||||
'-DDISABLE_QML=ON',
|
||||
'-DDISABLE_KTX_CACHE=ON'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,6 +97,11 @@ def packages = [
|
|||
versionId: 'cA3tVJSmkvb1naA3l6D_Jv2Noh.4yc4m',
|
||||
checksum: '617a80d213a5ec69fbfa21a1f2f738cd',
|
||||
],
|
||||
glad: [
|
||||
file: 'glad_armv8-libcpp.zip',
|
||||
versionId: 'Q9szthzeye8fFyAA.cY26Lgn2B8kezEE',
|
||||
checksum: 'a8ee8584cf1ccd34766c7ddd9d5e5449',
|
||||
],
|
||||
glm: [
|
||||
file: 'glm-0.9.8.tgz',
|
||||
versionId: 'BlkJNwaYV2Gfy5XwMeU7K0uzPDRKFMt2',
|
||||
|
|
|
@ -1,27 +1,22 @@
|
|||
set(EXTERNAL_NAME glew)
|
||||
|
||||
if (ANDROID)
|
||||
set(ANDROID_CMAKE_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" "-DANDROID_NATIVE_API_LEVEL=19")
|
||||
endif ()
|
||||
set(EXTERNAL_NAME glad32es)
|
||||
|
||||
include(ExternalProject)
|
||||
include(SelectLibraryConfigurations)
|
||||
|
||||
ExternalProject_Add(
|
||||
${EXTERNAL_NAME}
|
||||
URL http://hifi-public.s3.amazonaws.com/dependencies/glew_simple_1.13.0.zip
|
||||
URL_MD5 73f833649e904257b35bf4e84f8bdfb5
|
||||
CONFIGURE_COMMAND CMAKE_ARGS ${ANDROID_CMAKE_ARGS} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
URL https://hifi-public.s3.amazonaws.com/austin/glad/glad32es.zip
|
||||
URL_MD5 6a641d8c49dee4c895fa59315f5682a6
|
||||
CONFIGURE_COMMAND CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
LOG_DOWNLOAD 1
|
||||
LOG_CONFIGURE 1
|
||||
LOG_BUILD 1
|
||||
)
|
||||
|
||||
# Hide this external target (for ide users)
|
||||
set_target_properties(${EXTERNAL_NAME} PROPERTIES FOLDER "hidden/externals")
|
||||
|
||||
ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR)
|
||||
|
||||
string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER)
|
||||
set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${INSTALL_DIR}/include CACHE PATH "List of glew include directories")
|
||||
set_target_properties(${EXTERNAL_NAME} PROPERTIES FOLDER "hidden/externals")
|
||||
ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR)
|
||||
|
||||
if (UNIX)
|
||||
set(LIB_PREFIX "lib")
|
||||
|
@ -30,5 +25,9 @@ elseif (WIN32)
|
|||
set(LIB_EXT "lib")
|
||||
endif ()
|
||||
|
||||
set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${INSTALL_DIR}/lib/${LIB_PREFIX}glew_d.${LIB_EXT} CACHE FILEPATH "Path to glew debug library")
|
||||
set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${INSTALL_DIR}/lib/${LIB_PREFIX}glew.${LIB_EXT} CACHE FILEPATH "Path to glew release library")
|
||||
set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${INSTALL_DIR}/lib/${LIB_PREFIX}glad_d.${LIB_EXT})
|
||||
set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${INSTALL_DIR}/lib/${LIB_PREFIX}glad.${LIB_EXT})
|
||||
select_library_configurations(${EXTERNAL_NAME_UPPER})
|
||||
|
||||
set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${INSTALL_DIR}/include CACHE PATH "List of glad include directories")
|
||||
set(${EXTERNAL_NAME_UPPER}_LIBRARY ${${EXTERNAL_NAME_UPPER}_LIBRARY} CACHE INTERNAL "glad libraries")
|
33
cmake/externals/glad41/CMakeLists.txt
vendored
Normal file
33
cmake/externals/glad41/CMakeLists.txt
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
set(EXTERNAL_NAME glad41)
|
||||
|
||||
include(ExternalProject)
|
||||
include(SelectLibraryConfigurations)
|
||||
|
||||
ExternalProject_Add(
|
||||
${EXTERNAL_NAME}
|
||||
URL https://hifi-public.s3.amazonaws.com/austin/glad/glad41.zip
|
||||
URL_MD5 1324eeec33abe91e67d19ae551ba624d
|
||||
CONFIGURE_COMMAND CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
LOG_DOWNLOAD 1
|
||||
LOG_CONFIGURE 1
|
||||
LOG_BUILD 1
|
||||
)
|
||||
|
||||
# Hide this external target (for ide users)
|
||||
string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER)
|
||||
set_target_properties(${EXTERNAL_NAME} PROPERTIES FOLDER "hidden/externals")
|
||||
ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR)
|
||||
|
||||
if (UNIX)
|
||||
set(LIB_PREFIX "lib")
|
||||
set(LIB_EXT "a")
|
||||
elseif (WIN32)
|
||||
set(LIB_EXT "lib")
|
||||
endif ()
|
||||
|
||||
set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${INSTALL_DIR}/lib/${LIB_PREFIX}glad_d.${LIB_EXT})
|
||||
set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${INSTALL_DIR}/lib/${LIB_PREFIX}glad.${LIB_EXT})
|
||||
select_library_configurations(${EXTERNAL_NAME_UPPER})
|
||||
|
||||
set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${INSTALL_DIR}/include CACHE PATH "List of glad include directories")
|
||||
set(${EXTERNAL_NAME_UPPER}_LIBRARY ${${EXTERNAL_NAME_UPPER}_LIBRARY} CACHE INTERNAL "glad libraries")
|
33
cmake/externals/glad45/CMakeLists.txt
vendored
Normal file
33
cmake/externals/glad45/CMakeLists.txt
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
set(EXTERNAL_NAME glad45)
|
||||
|
||||
include(ExternalProject)
|
||||
include(SelectLibraryConfigurations)
|
||||
|
||||
ExternalProject_Add(
|
||||
${EXTERNAL_NAME}
|
||||
URL https://hifi-public.s3.amazonaws.com/austin/glad/glad45.zip
|
||||
URL_MD5 cfb19b3cb5b2f8f1d1669fb3150e5f05
|
||||
CONFIGURE_COMMAND CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
LOG_DOWNLOAD 1
|
||||
LOG_CONFIGURE 1
|
||||
LOG_BUILD 1
|
||||
)
|
||||
|
||||
# Hide this external target (for ide users)
|
||||
string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER)
|
||||
set_target_properties(${EXTERNAL_NAME} PROPERTIES FOLDER "hidden/externals")
|
||||
ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR)
|
||||
|
||||
if (UNIX)
|
||||
set(LIB_PREFIX "lib")
|
||||
set(LIB_EXT "a")
|
||||
elseif (WIN32)
|
||||
set(LIB_EXT "lib")
|
||||
endif ()
|
||||
|
||||
set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${INSTALL_DIR}/lib/${LIB_PREFIX}glad_d.${LIB_EXT})
|
||||
set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${INSTALL_DIR}/lib/${LIB_PREFIX}glad.${LIB_EXT})
|
||||
select_library_configurations(${EXTERNAL_NAME_UPPER})
|
||||
|
||||
set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${INSTALL_DIR}/include CACHE PATH "List of glad include directories")
|
||||
set(${EXTERNAL_NAME_UPPER}_LIBRARY ${${EXTERNAL_NAME_UPPER}_LIBRARY} CACHE INTERNAL "glad libraries")
|
43
cmake/macros/TargetGlad.cmake
Normal file
43
cmake/macros/TargetGlad.cmake
Normal file
|
@ -0,0 +1,43 @@
|
|||
#
|
||||
# Copyright 2015 High Fidelity, Inc.
|
||||
# Created by Bradley Austin Davis on 2015/10/10
|
||||
#
|
||||
# Distributed under the Apache License, Version 2.0.
|
||||
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
#
|
||||
macro(TARGET_GLAD)
|
||||
if (ANDROID)
|
||||
set(INSTALL_DIR ${HIFI_ANDROID_PRECOMPILED}/glad)
|
||||
set(GLAD_INCLUDE_DIRS "${INSTALL_DIR}/include")
|
||||
set(GLAD_LIBRARY_DEBUG ${INSTALL_DIR}/lib/libglad_d.a)
|
||||
set(GLAD_LIBRARY_RELEASE ${INSTALL_DIR}/lib/libglad.a)
|
||||
select_library_configurations(GLAD)
|
||||
find_library(EGL EGL)
|
||||
target_link_libraries(${TARGET_NAME} ${EGL})
|
||||
else()
|
||||
if (APPLE)
|
||||
set(GLAD_VER "41")
|
||||
else()
|
||||
if (USE_GLES)
|
||||
set(GLAD_VER "32es")
|
||||
else()
|
||||
set(GLAD_VER "45")
|
||||
add_dependency_external_projects(glad45)
|
||||
endif()
|
||||
if (WIN32)
|
||||
find_package(OpenGL REQUIRED)
|
||||
target_link_libraries(${TARGET_NAME} "${OPENGL_LIBRARY}")
|
||||
# we don't need the include, because we get everything from GLAD
|
||||
#target_include_directories(${TARGET_NAME} PUBLIC ${OPENGL_INCLUDE_DIR})
|
||||
endif()
|
||||
endif()
|
||||
set(GLAD "glad${GLAD_VER}")
|
||||
string(TOUPPER ${GLAD} GLAD_UPPER)
|
||||
add_dependency_external_projects(${GLAD})
|
||||
set(GLAD_INCLUDE_DIRS ${${GLAD_UPPER}_INCLUDE_DIRS})
|
||||
set(GLAD_LIBRARY ${${GLAD_UPPER}_LIBRARY})
|
||||
endif()
|
||||
|
||||
target_include_directories(${TARGET_NAME} PUBLIC ${GLAD_INCLUDE_DIRS})
|
||||
target_link_libraries(${TARGET_NAME} ${GLAD_LIBRARY})
|
||||
endmacro()
|
|
@ -1,16 +0,0 @@
|
|||
#
|
||||
# Copyright 2015 High Fidelity, Inc.
|
||||
# Created by Bradley Austin Davis on 2015/10/10
|
||||
#
|
||||
# Distributed under the Apache License, Version 2.0.
|
||||
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
#
|
||||
macro(TARGET_GLEW)
|
||||
if (NOT ANDROID)
|
||||
add_definitions(-DGLEW_STATIC)
|
||||
add_dependency_external_projects(glew)
|
||||
find_package(GLEW REQUIRED)
|
||||
target_include_directories(${TARGET_NAME} PUBLIC ${GLEW_INCLUDE_DIRS})
|
||||
target_link_libraries(${TARGET_NAME} ${GLEW_LIBRARY})
|
||||
endif()
|
||||
endmacro()
|
|
@ -6,34 +6,6 @@
|
|||
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
#
|
||||
macro(TARGET_OPENGL)
|
||||
if (ANDROID)
|
||||
find_library(EGL EGL)
|
||||
find_library(OpenGLES3 GLESv3)
|
||||
list(APPEND IGNORE_COPY_LIBS ${OpenGLES3} ${OpenGLES2} ${EGL})
|
||||
target_link_libraries(${TARGET_NAME} ${OpenGLES3} ${EGL})
|
||||
elseif (USE_GLES)
|
||||
set(ANGLE_INCLUDE_DIR "${QT_DIR}/include/QtANGLE")
|
||||
set(ANGLE_LIB_DIR "${QT_DIR}/lib")
|
||||
find_library(EGL_LIBRARY_RELEASE "libEGL" HINTS ${ANGLE_LIB_DIR})
|
||||
find_library(EGL_LIBRARY_DEBUG "libEGLd" HINTS ${ANGLE_LIB_DIR})
|
||||
find_library(GLES_LIBRARY_RELEASE "libGLESv2" HINTS ${ANGLE_LIB_DIR})
|
||||
find_library(GLES_LIBRARY_DEBUG "libGLESv2d" HINTS ${ANGLE_LIB_DIR})
|
||||
include(SelectLibraryConfigurations)
|
||||
select_library_configurations(EGL)
|
||||
select_library_configurations(GLES)
|
||||
message("QQQ ${GLES_LIBRARIES}")
|
||||
target_link_libraries(${TARGET_NAME} ${EGL_LIBRARIES})
|
||||
target_link_libraries(${TARGET_NAME} ${GLES_LIBRARIES})
|
||||
target_include_directories(${TARGET_NAME} PUBLIC "${ANGLE_INCLUDE_DIR}")
|
||||
elseif (APPLE)
|
||||
# link in required OS X frameworks and include the right GL headers
|
||||
find_library(OpenGL OpenGL)
|
||||
target_link_libraries(${TARGET_NAME} ${OpenGL})
|
||||
else()
|
||||
find_package(OpenGL REQUIRED)
|
||||
target_link_libraries(${TARGET_NAME} "${OPENGL_LIBRARY}")
|
||||
target_include_directories(${TARGET_NAME} PUBLIC ${OPENGL_INCLUDE_DIR})
|
||||
endif()
|
||||
target_glad()
|
||||
target_nsight()
|
||||
target_glew()
|
||||
endmacro()
|
||||
|
|
|
@ -17,10 +17,9 @@ generate_qrc(OUTPUT ${RESOURCES_QRC} PATH ${CMAKE_CURRENT_SOURCE_DIR}/resources
|
|||
|
||||
add_custom_command(
|
||||
OUTPUT ${RESOURCES_RCC}
|
||||
DEPENDS ${RESOURCES_QRC} ${GENERATE_QRC_DEPENDS}
|
||||
COMMAND "${QT_DIR}/bin/rcc"
|
||||
ARGS ${RESOURCES_QRC} -binary -o ${RESOURCES_RCC}
|
||||
MAIN_DEPENDENCY ${RESOURCES_QRC}
|
||||
DEPENDS ${GENERATE_QRC_DEPENDS}
|
||||
)
|
||||
|
||||
list(APPEND GENERATE_QRC_DEPENDS ${RESOURCES_RCC})
|
||||
|
@ -52,6 +51,7 @@ endif()
|
|||
# grab the implementation and header files from src dirs
|
||||
file(GLOB_RECURSE INTERFACE_SRCS "src/*.cpp" "src/*.h")
|
||||
GroupSources("src")
|
||||
list(APPEND INTERFACE_SRCS ${RESOURCES_RCC})
|
||||
|
||||
# Add SpeechRecognizer if on Windows or OS X, otherwise remove
|
||||
if (WIN32)
|
||||
|
|
Binary file not shown.
|
@ -1,89 +1,135 @@
|
|||
name = mannequin
|
||||
name = being_of_light
|
||||
type = body+head
|
||||
scale = 1
|
||||
filename = mannequin/mannequin.baked.fbx
|
||||
filename = being_of_light/being_of_light.fbx
|
||||
texdir = being_of_light/textures
|
||||
joint = jointRoot = Hips
|
||||
joint = jointLean = Spine
|
||||
joint = jointLeftHand = LeftHand
|
||||
joint = jointHead = Head
|
||||
joint = jointHead = HeadTop_End
|
||||
joint = jointLean = Spine
|
||||
joint = jointEyeLeft = LeftEye
|
||||
joint = jointEyeRight = RightEye
|
||||
joint = jointRightHand = RightHand
|
||||
joint = jointNeck = Neck
|
||||
joint = jointNeck = Head
|
||||
joint = jointEyeRight = RightEye
|
||||
freeJoint = LeftArm
|
||||
freeJoint = LeftForeArm
|
||||
freeJoint = RightArm
|
||||
freeJoint = RightForeArm
|
||||
bs = EyeBlink_L = blink = 1
|
||||
bs = JawOpen = mouth_Open = 1
|
||||
bs = LipsFunnel = Oo = 1
|
||||
bs = BrowsU_L = brow_Up = 1
|
||||
jointIndex = RightHandPinky2 = 19
|
||||
jointIndex = LeftHandMiddle4 = 61
|
||||
jointIndex = LeftHand = 41
|
||||
jointIndex = LeftHandRing4 = 49
|
||||
jointIndex = RightHandMiddle3 = 36
|
||||
jointIndex = LeftHandThumb4 = 57
|
||||
jointIndex = RightToe_End = 10
|
||||
jointIndex = LeftHandRing1 = 46
|
||||
jointIndex = LeftForeArm = 40
|
||||
jointIndex = RightHandIndex4 = 29
|
||||
jointIndex = LeftShoulder = 38
|
||||
jointIndex = RightHandMiddle4 = 37
|
||||
jointIndex = RightShoulder = 14
|
||||
jointIndex = LeftLeg = 2
|
||||
jointIndex = LeftToe_End = 5
|
||||
jointIndex = Hips = 0
|
||||
jointIndex = RightFoot = 8
|
||||
jointIndex = RightHandThumb2 = 31
|
||||
jointIndex = LeftHandMiddle3 = 60
|
||||
jointIndex = RightHandThumb1 = 30
|
||||
jointIndex = Neck = 62
|
||||
jointIndex = Spine = 11
|
||||
jointIndex = RightHandThumb4 = 33
|
||||
jointIndex = RightHandMiddle1 = 34
|
||||
jointIndex = LeftHandIndex4 = 53
|
||||
jointIndex = face = 68
|
||||
jointIndex = RightHandRing3 = 24
|
||||
jointIndex = LeftHandPinky4 = 45
|
||||
jointIndex = LeftHandMiddle2 = 59
|
||||
jointIndex = RightHandThumb3 = 32
|
||||
jointIndex = LeftHandPinky3 = 44
|
||||
jointIndex = HeadTop_End = 66
|
||||
jointIndex = Spine1 = 12
|
||||
jointIndex = LeftHandRing3 = 48
|
||||
jointIndex = mannequin1 = 67
|
||||
jointIndex = RightEye = 65
|
||||
jointIndex = RightHandRing4 = 25
|
||||
jointIndex = RightHandPinky4 = 21
|
||||
jointIndex = LeftHandRing2 = 47
|
||||
jointIndex = RightHandIndex3 = 28
|
||||
jointIndex = RightUpLeg = 6
|
||||
jointIndex = LeftArm = 39
|
||||
jointIndex = LeftHandThumb3 = 56
|
||||
jointIndex = RightHandIndex2 = 27
|
||||
jointIndex = RightForeArm = 16
|
||||
jointIndex = RightArm = 15
|
||||
jointIndex = RightHandRing2 = 23
|
||||
jointIndex = LeftHandMiddle1 = 58
|
||||
jointIndex = Spine2 = 13
|
||||
jointIndex = LeftHandThumb2 = 55
|
||||
jointIndex = RightHandMiddle2 = 35
|
||||
jointIndex = RightHandPinky1 = 18
|
||||
jointIndex = LeftUpLeg = 1
|
||||
jointIndex = RightLeg = 7
|
||||
jointIndex = LeftHandIndex2 = 51
|
||||
jointIndex = RightHand = 17
|
||||
jointIndex = LeftHandIndex3 = 52
|
||||
jointIndex = LeftFoot = 3
|
||||
jointIndex = RightHandPinky3 = 20
|
||||
jointIndex = RightHandIndex1 = 26
|
||||
jointIndex = LeftHandPinky1 = 42
|
||||
jointIndex = RightToeBase = 9
|
||||
bs = MouthFrown_L = Frown_Left = 1
|
||||
bs = MouthLeft = Midmouth_Left = 1
|
||||
bs = BrowsU_R = BrowsUp_Right = 1
|
||||
bs = ChinUpperRaise = UpperLipUp_Right = 0.5
|
||||
bs = ChinUpperRaise = UpperLipUp_Left = 0.5
|
||||
bs = MouthSmile_R = Smile_Right = 1
|
||||
bs = MouthDimple_L = Smile_Left = 0.25
|
||||
bs = EyeBlink_L = Blink_Left = 1
|
||||
bs = BrowsD_L = BrowsDown_Left = 1
|
||||
bs = MouthFrown_R = Frown_Right = 1
|
||||
bs = MouthDimple_R = Smile_Right = 0.25
|
||||
bs = Sneer = Squint_Right = 0.5
|
||||
bs = Sneer = Squint_Left = 0.5
|
||||
bs = Sneer = NoseScrunch_Right = 0.75
|
||||
bs = Sneer = NoseScrunch_Left = 0.75
|
||||
bs = EyeSquint_L = Squint_Left = 1
|
||||
bs = EyeBlink_R = Blink_Right = 1
|
||||
bs = JawLeft = JawRotateY_Left = 0.5
|
||||
bs = BrowsD_R = BrowsDown_Right = 1
|
||||
bs = EyeSquint_R = Squint_Right = 1
|
||||
bs = Puff = CheekPuff_Right = 1
|
||||
bs = Puff = CheekPuff_Left = 1
|
||||
bs = LipsUpperClose = UpperLipIn = 1
|
||||
bs = JawOpen = MouthOpen = 0.69999999999999996
|
||||
bs = LipsUpperUp = UpperLipUp_Right = 0.69999999999999996
|
||||
bs = LipsUpperUp = UpperLipUp_Left = 0.69999999999999996
|
||||
bs = LipsLowerDown = LowerLipDown_Right = 0.69999999999999996
|
||||
bs = LipsLowerDown = LowerLipDown_Left = 0.69999999999999996
|
||||
bs = LipsLowerOpen = LowerLipOut = 1
|
||||
bs = EyeOpen_L = EyesWide_Left = 1
|
||||
bs = LipsPucker = MouthNarrow_Right = 1
|
||||
bs = LipsPucker = MouthNarrow_Left = 1
|
||||
bs = EyeOpen_R = EyesWide_Right = 1
|
||||
bs = JawRight = Jaw_Right = 1
|
||||
bs = MouthRight = Midmouth_Right = 1
|
||||
bs = ChinLowerRaise = Jaw_Up = 1
|
||||
bs = LipsUpperOpen = UpperLipOut = 1
|
||||
bs = BrowsU_C = BrowsUp_Right = 1
|
||||
bs = BrowsU_C = BrowsUp_Left = 1
|
||||
bs = JawFwd = JawForeward = 1
|
||||
bs = BrowsU_L = BrowsUp_Left = 1
|
||||
bs = MouthSmile_L = Smile_Left = 1
|
||||
bs = LipsLowerClose = LowerLipIn = 1
|
||||
bs = LipsFunnel = TongueUp = 1
|
||||
bs = LipsFunnel = MouthWhistle_NarrowAdjust_Right = 0.5
|
||||
bs = LipsFunnel = MouthWhistle_NarrowAdjust_Left = 0.5
|
||||
bs = LipsFunnel = MouthNarrow_Right = 1
|
||||
bs = LipsFunnel = MouthNarrow_Left = 1
|
||||
bs = LipsFunnel = Jaw_Down = 0.35999999999999999
|
||||
bs = LipsFunnel = JawForeward = 0.39000000000000001
|
||||
jointIndex = LeftHandIndex1 = 50
|
||||
jointIndex = LeftToeBase = 4
|
||||
jointIndex = LeftHandPinky2 = 43
|
||||
jointIndex = RightHandRing1 = 22
|
||||
jointIndex = LeftHandThumb1 = 54
|
||||
jointIndex = LeftEye = 64
|
||||
jointIndex = LeftHandIndex2 = 51
|
||||
jointIndex = LeftHandIndex3 = 52
|
||||
jointIndex = LeftHandIndex4 = 53
|
||||
jointIndex = Spine1 = 12
|
||||
jointIndex = Spine2 = 13
|
||||
jointIndex = RightHandThumb1 = 18
|
||||
jointIndex = RightHandThumb2 = 19
|
||||
jointIndex = RightHandThumb3 = 20
|
||||
jointIndex = RightHandThumb4 = 21
|
||||
jointIndex = LeftFoot = 8
|
||||
jointIndex = LeftForeArm = 40
|
||||
jointIndex = Neck = 62
|
||||
jointIndex = Head = 63
|
||||
jointIndex = Hips = 0
|
||||
jointIndex = RightHandPinky1 = 30
|
||||
jointIndex = RightHandPinky2 = 31
|
||||
jointIndex = RightHandPinky3 = 32
|
||||
jointIndex = RightHandPinky4 = 33
|
||||
jointIndex = RightLeg = 2
|
||||
jointIndex = RightForeArm = 16
|
||||
jointIndex = LeftHandRing1 = 46
|
||||
jointIndex = LeftHandRing2 = 47
|
||||
jointIndex = LeftHandRing3 = 48
|
||||
jointIndex = LeftHandRing4 = 49
|
||||
jointIndex = LeftHandThumb1 = 54
|
||||
jointIndex = LeftHandThumb2 = 55
|
||||
jointIndex = LeftHandThumb3 = 56
|
||||
jointIndex = LeftHandThumb4 = 57
|
||||
jointIndex = HeadTop_End = 66
|
||||
jointIndex = LeftUpLeg = 6
|
||||
jointIndex = LeftToeBase = 9
|
||||
jointIndex = LeftHandPinky1 = 42
|
||||
jointIndex = LeftHandPinky2 = 43
|
||||
jointIndex = LeftHandPinky3 = 44
|
||||
jointIndex = LeftHandPinky4 = 45
|
||||
jointIndex = LeftLeg = 7
|
||||
jointIndex = RightEye = 65
|
||||
jointIndex = RightHand = 17
|
||||
jointIndex = RightToeBase = 4
|
||||
jointIndex = RightUpLeg = 1
|
||||
jointIndex = RightArm = 15
|
||||
jointIndex = RightHandRing1 = 26
|
||||
jointIndex = RightHandRing2 = 27
|
||||
jointIndex = RightHandRing3 = 28
|
||||
jointIndex = RightHandRing4 = 29
|
||||
jointIndex = RightHandIndex1 = 22
|
||||
jointIndex = RightHandIndex2 = 23
|
||||
jointIndex = RightHandIndex3 = 24
|
||||
jointIndex = RightHandIndex4 = 25
|
||||
jointIndex = LeftToe_End = 10
|
||||
jointIndex = LeftHandMiddle1 = 58
|
||||
jointIndex = LeftHandMiddle2 = 59
|
||||
jointIndex = LeftHandMiddle3 = 60
|
||||
jointIndex = LeftShoulder = 38
|
||||
jointIndex = LeftHandMiddle4 = 61
|
||||
jointIndex = RightFoot = 3
|
||||
jointIndex = LeftHand = 41
|
||||
jointIndex = RightHandMiddle1 = 34
|
||||
jointIndex = RightHandMiddle2 = 35
|
||||
jointIndex = RightHandMiddle3 = 36
|
||||
jointIndex = RightShoulder = 14
|
||||
jointIndex = LeftEye = 64
|
||||
jointIndex = RightHandMiddle4 = 37
|
||||
jointIndex = Body = 67
|
||||
jointIndex = LeftArm = 39
|
||||
jointIndex = RightToe_End = 5
|
||||
jointIndex = Spine = 11
|
||||
|
|
|
@ -14,13 +14,14 @@
|
|||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
#include <gl/Config.h>
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtx/component_wise.hpp>
|
||||
#include <glm/gtx/quaternion.hpp>
|
||||
#include <glm/gtx/vector_angle.hpp>
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
|
||||
#include <gl/Config.h>
|
||||
|
||||
#include <QtCore/QResource>
|
||||
#include <QtCore/QAbstractNativeEventFilter>
|
||||
#include <QtCore/QCommandLineParser>
|
||||
|
@ -309,13 +310,19 @@ static QTimer locationUpdateTimer;
|
|||
static QTimer identityPacketTimer;
|
||||
static QTimer pingTimer;
|
||||
|
||||
static const QString DISABLE_WATCHDOG_FLAG("HIFI_DISABLE_WATCHDOG");
|
||||
#if defined(Q_OS_ANDROID)
|
||||
static bool DISABLE_WATCHDOG = true;
|
||||
#else
|
||||
static const QString DISABLE_WATCHDOG_FLAG{ "HIFI_DISABLE_WATCHDOG" };
|
||||
static bool DISABLE_WATCHDOG = QProcessEnvironment::systemEnvironment().contains(DISABLE_WATCHDOG_FLAG);
|
||||
#endif
|
||||
|
||||
#if defined(USE_GLES)
|
||||
static bool DISABLE_DEFERRED = true;
|
||||
#else
|
||||
static const QString RENDER_FORWARD{ "HIFI_RENDER_FORWARD" };
|
||||
static bool DISABLE_DEFERRED = !QProcessEnvironment::systemEnvironment().contains(RENDER_FORWARD);
|
||||
#endif
|
||||
|
||||
static const int MAX_CONCURRENT_RESOURCE_DOWNLOADS = 16;
|
||||
|
||||
|
@ -1126,7 +1133,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
updateHeartbeat();
|
||||
|
||||
// Now that OpenGL is initialized, we are sure we have a valid context and can create the various pipeline shaders with success.
|
||||
DependencyManager::get<GeometryCache>()->initializeShapePipelines();
|
||||
// DependencyManager::get<GeometryCache>()->initializeShapePipelines();
|
||||
|
||||
// sessionRunTime will be reset soon by loadSettings. Grab it now to get previous session value.
|
||||
// The value will be 0 if the user blew away settings this session, which is both a feature and a bug.
|
||||
|
@ -2219,11 +2226,13 @@ void Application::initializeGL() {
|
|||
|
||||
gl::initModuleGl();
|
||||
_glWidget->makeCurrent();
|
||||
_chromiumShareContext = new OffscreenGLCanvas();
|
||||
_chromiumShareContext->setObjectName("ChromiumShareContext");
|
||||
_chromiumShareContext->create(_glWidget->qglContext());
|
||||
_chromiumShareContext->makeCurrent();
|
||||
qt_gl_set_global_share_context(_chromiumShareContext->getContext());
|
||||
if (!nsightActive()) {
|
||||
_chromiumShareContext = new OffscreenGLCanvas();
|
||||
_chromiumShareContext->setObjectName("ChromiumShareContext");
|
||||
_chromiumShareContext->create(_glWidget->qglContext());
|
||||
_chromiumShareContext->makeCurrent();
|
||||
qt_gl_set_global_share_context(_chromiumShareContext->getContext());
|
||||
}
|
||||
|
||||
_glWidget->makeCurrent();
|
||||
gpu::Context::init<gpu::gl::GLBackend>();
|
||||
|
@ -2240,19 +2249,17 @@ void Application::initializeGL() {
|
|||
// Set up the render engine
|
||||
render::CullFunctor cullFunctor = LODManager::shouldRender;
|
||||
static const QString RENDER_FORWARD = "HIFI_RENDER_FORWARD";
|
||||
#ifdef Q_OS_ANDROID
|
||||
bool isDeferred = false;
|
||||
#else
|
||||
bool isDeferred = !QProcessEnvironment::systemEnvironment().contains(RENDER_FORWARD);
|
||||
#endif
|
||||
_renderEngine->addJob<UpdateSceneTask>("UpdateScene");
|
||||
#ifndef Q_OS_ANDROID
|
||||
_renderEngine->addJob<SecondaryCameraRenderTask>("SecondaryCameraJob", cullFunctor, isDeferred);
|
||||
_renderEngine->addJob<SecondaryCameraRenderTask>("SecondaryCameraJob", cullFunctor, !DISABLE_DEFERRED);
|
||||
#endif
|
||||
_renderEngine->addJob<RenderViewTask>("RenderMainView", cullFunctor, isDeferred);
|
||||
_renderEngine->addJob<RenderViewTask>("RenderMainView", cullFunctor, !DISABLE_DEFERRED);
|
||||
_renderEngine->load();
|
||||
_renderEngine->registerScene(_main3DScene);
|
||||
|
||||
// Now that OpenGL is initialized, we are sure we have a valid context and can create the various pipeline shaders with success.
|
||||
DependencyManager::get<GeometryCache>()->initializeShapePipelines();
|
||||
|
||||
_offscreenContext = new OffscreenGLCanvas();
|
||||
_offscreenContext->setObjectName("MainThreadContext");
|
||||
_offscreenContext->create(_glWidget->qglContext());
|
||||
|
@ -4326,9 +4333,9 @@ void Application::init() {
|
|||
|
||||
// Make sure Login state is up to date
|
||||
DependencyManager::get<DialogsManager>()->toggleLoginDialog();
|
||||
#ifndef Q_OS_ANDROID
|
||||
DependencyManager::get<DeferredLightingEffect>()->init();
|
||||
#endif
|
||||
if (!DISABLE_DEFERRED) {
|
||||
DependencyManager::get<DeferredLightingEffect>()->init();
|
||||
}
|
||||
DependencyManager::get<AvatarManager>()->init();
|
||||
|
||||
_timerStart.start();
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <QTranslator>
|
||||
|
||||
#include <BuildInfo.h>
|
||||
#include <gl/OpenGLVersionChecker.h>
|
||||
#include <SandboxUtils.h>
|
||||
#include <SharedUtil.h>
|
||||
#include <NetworkAccessManager.h>
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include "ApplicationOverlay.h"
|
||||
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
|
||||
#include <avatar/AvatarManager.h>
|
||||
|
@ -17,12 +19,10 @@
|
|||
#include <OffscreenUi.h>
|
||||
#include <CursorManager.h>
|
||||
#include <PerfStat.h>
|
||||
#include <gl/Config.h>
|
||||
|
||||
#include "AudioClient.h"
|
||||
#include "audio/AudioScope.h"
|
||||
#include "Application.h"
|
||||
#include "ApplicationOverlay.h"
|
||||
|
||||
#include "Util.h"
|
||||
#include "ui/Stats.h"
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#define hifi_ApplicationOverlay_h
|
||||
|
||||
#include <gpu/Texture.h>
|
||||
#include <render/Args.h>
|
||||
|
||||
|
||||
// Handles the drawing of the overlays to the screen
|
||||
|
|
|
@ -10,15 +10,12 @@
|
|||
|
||||
#include "ResourceImageItem.h"
|
||||
|
||||
#include <gl/Config.h>
|
||||
|
||||
#include <QOpenGLFramebufferObjectFormat>
|
||||
#include <QOpenGLFunctions>
|
||||
#include <QOpenGLExtraFunctions>
|
||||
#include <QOpenGLContext>
|
||||
|
||||
#include <plugins/DisplayPlugin.h>
|
||||
#ifdef Q_OS_ANDROID
|
||||
#include <gl/Config.h>
|
||||
#endif
|
||||
|
||||
ResourceImageItem::ResourceImageItem() : QQuickFramebufferObject() {
|
||||
auto textureCache = DependencyManager::get<TextureCache>();
|
||||
connect(textureCache.data(), SIGNAL(spectatorCameraFramebufferReset()), this, SLOT(update()));
|
||||
|
@ -91,11 +88,9 @@ QOpenGLFramebufferObject* ResourceImageItemRenderer::createFramebufferObject(con
|
|||
}
|
||||
|
||||
void ResourceImageItemRenderer::render() {
|
||||
auto f = QOpenGLContext::currentContext()->extraFunctions();
|
||||
|
||||
if (_fenceSync) {
|
||||
f->glWaitSync(_fenceSync, 0, GL_TIMEOUT_IGNORED);
|
||||
f->glDeleteSync(_fenceSync);
|
||||
glWaitSync(_fenceSync, 0, GL_TIMEOUT_IGNORED);
|
||||
glDeleteSync(_fenceSync);
|
||||
_fenceSync = 0;
|
||||
}
|
||||
if (_ready) {
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
#include "Application.h"
|
||||
|
||||
#include <gl/Config.h>
|
||||
|
||||
#include <QQuickFramebufferObject>
|
||||
#include <QQuickWindow>
|
||||
#include <QTimer>
|
||||
|
|
|
@ -10,16 +10,14 @@
|
|||
#include <condition_variable>
|
||||
#include <queue>
|
||||
|
||||
#include <gl/Config.h>
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QThread>
|
||||
#include <QtCore/QTimer>
|
||||
|
||||
#include <QtOpenGL/QGLWidget>
|
||||
#include <QtGui/QImage>
|
||||
#include <QOpenGLFramebufferObject>
|
||||
#if defined(Q_OS_MAC)
|
||||
#include <OpenGL/CGLCurrent.h>
|
||||
#endif
|
||||
#include <QtGui/QOpenGLFramebufferObject>
|
||||
|
||||
#include <NumericalConstants.h>
|
||||
#include <DependencyManager.h>
|
||||
|
@ -27,7 +25,6 @@
|
|||
|
||||
#include <gl/QOpenGLContextWrapper.h>
|
||||
#include <gl/GLWidget.h>
|
||||
#include <gl/Config.h>
|
||||
#include <gl/GLEscrow.h>
|
||||
#include <gl/Context.h>
|
||||
|
||||
|
@ -130,6 +127,8 @@ public:
|
|||
OpenGLDisplayPlugin* currentPlugin{ nullptr };
|
||||
Q_ASSERT(_context);
|
||||
_context->makeCurrent();
|
||||
CHECK_GL_ERROR();
|
||||
_context->doneCurrent();
|
||||
while (!_shutdown) {
|
||||
if (_pendingMainThreadOperation) {
|
||||
PROFILE_RANGE(render, "MainThreadOp")
|
||||
|
@ -171,20 +170,15 @@ public:
|
|||
QThread::setPriority(newPlugin->getPresentPriority());
|
||||
bool wantVsync = newPlugin->wantVsync();
|
||||
_context->makeCurrent();
|
||||
#if defined(Q_OS_WIN)
|
||||
wglSwapIntervalEXT(wantVsync ? 1 : 0);
|
||||
hasVsync = wglGetSwapIntervalEXT() != 0;
|
||||
#elif defined(Q_OS_MAC)
|
||||
GLint interval = wantVsync ? 1 : 0;
|
||||
newPlugin->swapBuffers();
|
||||
CGLSetParameter(CGLGetCurrentContext(), kCGLCPSwapInterval, &interval);
|
||||
newPlugin->swapBuffers();
|
||||
CGLGetParameter(CGLGetCurrentContext(), kCGLCPSwapInterval, &interval);
|
||||
hasVsync = interval != 0;
|
||||
#else
|
||||
// TODO: Fill in for linux
|
||||
Q_UNUSED(wantVsync);
|
||||
CHECK_GL_ERROR();
|
||||
#if defined(Q_OS_MAC)
|
||||
newPlugin->swapBuffers()
|
||||
#endif
|
||||
gl::setSwapInterval(wantVsync ? 1 : 0);
|
||||
#if defined(Q_OS_MAC)
|
||||
newPlugin->swapBuffers();
|
||||
#endif
|
||||
hasVsync = gl::getSwapInterval() != 0;
|
||||
newPlugin->setVsyncEnabled(hasVsync);
|
||||
newPlugin->customizeContext();
|
||||
CHECK_GL_ERROR();
|
||||
|
@ -284,6 +278,12 @@ bool OpenGLDisplayPlugin::activate() {
|
|||
DependencyManager::set<PresentThread>();
|
||||
presentThread = DependencyManager::get<PresentThread>();
|
||||
presentThread->setObjectName("Presentation Thread");
|
||||
if (!widget->context()->makeCurrent()) {
|
||||
throw std::runtime_error("Failed to make context current");
|
||||
}
|
||||
CHECK_GL_ERROR();
|
||||
widget->context()->doneCurrent();
|
||||
|
||||
presentThread->setContext(widget->context());
|
||||
// Start execution
|
||||
presentThread->start();
|
||||
|
@ -884,7 +884,7 @@ void OpenGLDisplayPlugin::updateCompositeFramebuffer() {
|
|||
}
|
||||
|
||||
void OpenGLDisplayPlugin::copyTextureToQuickFramebuffer(NetworkTexturePointer networkTexture, QOpenGLFramebufferObject* target, GLsync* fenceSync) {
|
||||
#if !defined(Q_OS_ANDROID)
|
||||
#if !defined(USE_GLES)
|
||||
auto glBackend = const_cast<OpenGLDisplayPlugin&>(*this).getGLBackend();
|
||||
withMainThreadContext([&] {
|
||||
GLuint sourceTexture = glBackend->getTextureID(networkTexture->getGPUTexture());
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "DisplayPlugin.h"
|
||||
#include <gl/Config.h>
|
||||
|
||||
#include <condition_variable>
|
||||
#include <memory>
|
||||
|
|
|
@ -26,7 +26,7 @@ static std::weak_ptr<gpu::Pipeline> _texturedPipeline;
|
|||
// FIXME: This is interfering with the uniform buffers in DeferredLightingEffect.cpp, so use 11 to avoid collisions
|
||||
static int32_t PARTICLE_UNIFORM_SLOT { 11 };
|
||||
|
||||
static ShapePipelinePointer shapePipelineFactory(const ShapePlumber& plumber, const ShapeKey& key) {
|
||||
static ShapePipelinePointer shapePipelineFactory(const ShapePlumber& plumber, const ShapeKey& key, gpu::Batch& batch) {
|
||||
auto texturedPipeline = _texturedPipeline.lock();
|
||||
if (!texturedPipeline) {
|
||||
auto state = std::make_shared<gpu::State>();
|
||||
|
@ -40,10 +40,13 @@ static ShapePipelinePointer shapePipelineFactory(const ShapePlumber& plumber, co
|
|||
auto fragShader = gpu::Shader::createPixel(std::string(textured_particle_frag));
|
||||
|
||||
auto program = gpu::Shader::createProgram(vertShader, fragShader);
|
||||
gpu::Shader::BindingSet slotBindings;
|
||||
slotBindings.insert(gpu::Shader::Binding(std::string("particleBuffer"), PARTICLE_UNIFORM_SLOT));
|
||||
gpu::Shader::makeProgram(*program, slotBindings);
|
||||
_texturedPipeline = texturedPipeline = gpu::Pipeline::create(program, state);
|
||||
|
||||
batch.runLambda([program] {
|
||||
gpu::Shader::BindingSet slotBindings;
|
||||
slotBindings.insert(gpu::Shader::Binding(std::string("particleBuffer"), PARTICLE_UNIFORM_SLOT));
|
||||
gpu::Shader::makeProgram(*program, slotBindings);
|
||||
});
|
||||
}
|
||||
|
||||
return std::make_shared<render::ShapePipeline>(texturedPipeline, nullptr, nullptr, nullptr);
|
||||
|
|
|
@ -46,7 +46,7 @@ struct PolyLineUniforms {
|
|||
glm::vec3 color;
|
||||
};
|
||||
|
||||
static render::ShapePipelinePointer shapePipelineFactory(const render::ShapePlumber& plumber, const render::ShapeKey& key) {
|
||||
static render::ShapePipelinePointer shapePipelineFactory(const render::ShapePlumber& plumber, const render::ShapeKey& key, gpu::Batch& batch) {
|
||||
if (!polylinePipeline) {
|
||||
auto VS = gpu::Shader::createVertex(std::string(paintStroke_vert));
|
||||
auto PS = gpu::Shader::createPixel(std::string(paintStroke_frag));
|
||||
|
@ -56,15 +56,21 @@ static render::ShapePipelinePointer shapePipelineFactory(const render::ShapePlum
|
|||
auto fadePS = gpu::Shader::createPixel(std::string(paintStroke_fade_frag));
|
||||
gpu::ShaderPointer fadeProgram = gpu::Shader::createProgram(fadeVS, fadePS);
|
||||
#endif
|
||||
gpu::Shader::BindingSet slotBindings;
|
||||
slotBindings.insert(gpu::Shader::Binding(std::string("originalTexture"), PAINTSTROKE_TEXTURE_SLOT));
|
||||
slotBindings.insert(gpu::Shader::Binding(std::string("polyLineBuffer"), PAINTSTROKE_UNIFORM_SLOT));
|
||||
gpu::Shader::makeProgram(*program, slotBindings);
|
||||
batch.runLambda([program
|
||||
#ifdef POLYLINE_ENTITY_USE_FADE_EFFECT
|
||||
slotBindings.insert(gpu::Shader::Binding(std::string("fadeMaskMap"), PAINTSTROKE_TEXTURE_SLOT + 1));
|
||||
slotBindings.insert(gpu::Shader::Binding(std::string("fadeParametersBuffer"), PAINTSTROKE_UNIFORM_SLOT + 1));
|
||||
gpu::Shader::makeProgram(*fadeProgram, slotBindings);
|
||||
, fadeProgram
|
||||
#endif
|
||||
] {
|
||||
gpu::Shader::BindingSet slotBindings;
|
||||
slotBindings.insert(gpu::Shader::Binding(std::string("originalTexture"), PAINTSTROKE_TEXTURE_SLOT));
|
||||
slotBindings.insert(gpu::Shader::Binding(std::string("polyLineBuffer"), PAINTSTROKE_UNIFORM_SLOT));
|
||||
gpu::Shader::makeProgram(*program, slotBindings);
|
||||
#ifdef POLYLINE_ENTITY_USE_FADE_EFFECT
|
||||
slotBindings.insert(gpu::Shader::Binding(std::string("fadeMaskMap"), PAINTSTROKE_TEXTURE_SLOT + 1));
|
||||
slotBindings.insert(gpu::Shader::Binding(std::string("fadeParametersBuffer"), PAINTSTROKE_UNIFORM_SLOT + 1));
|
||||
gpu::Shader::makeProgram(*fadeProgram, slotBindings);
|
||||
#endif
|
||||
});
|
||||
gpu::StatePointer state = gpu::StatePointer(new gpu::State());
|
||||
state->setDepthTest(true, true, gpu::LESS_EQUAL);
|
||||
PrepareStencil::testMask(*state);
|
||||
|
|
|
@ -1457,7 +1457,7 @@ static gpu::PipelinePointer _pipelines[2];
|
|||
static gpu::PipelinePointer _wireframePipelines[2];
|
||||
static gpu::Stream::FormatPointer _vertexFormat;
|
||||
|
||||
ShapePipelinePointer shapePipelineFactory(const ShapePlumber& plumber, const ShapeKey& key) {
|
||||
ShapePipelinePointer shapePipelineFactory(const ShapePlumber& plumber, const ShapeKey& key, gpu::Batch& batch) {
|
||||
if (!_pipelines[0]) {
|
||||
gpu::ShaderPointer vertexShaders[2] = { gpu::Shader::createVertex(std::string(polyvox_vert)), gpu::Shader::createVertex(std::string(polyvox_fade_vert)) };
|
||||
gpu::ShaderPointer pixelShaders[2] = { gpu::Shader::createPixel(std::string(polyvox_frag)), gpu::Shader::createPixel(std::string(polyvox_fade_frag)) };
|
||||
|
@ -1485,7 +1485,10 @@ ShapePipelinePointer shapePipelineFactory(const ShapePlumber& plumber, const Sha
|
|||
// Two sets of pipelines: normal and fading
|
||||
for (auto i = 0; i < 2; i++) {
|
||||
gpu::ShaderPointer program = gpu::Shader::createProgram(vertexShaders[i], pixelShaders[i]);
|
||||
gpu::Shader::makeProgram(*program, slotBindings);
|
||||
|
||||
batch.runLambda([program, slotBindings] {
|
||||
gpu::Shader::makeProgram(*program, slotBindings);
|
||||
});
|
||||
|
||||
_pipelines[i] = gpu::Pipeline::create(program, state);
|
||||
_wireframePipelines[i] = gpu::Pipeline::create(program, wireframeState);
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include "FBX.h"
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QMetaType>
|
||||
#include <QSet>
|
||||
#include <QUrl>
|
||||
|
@ -33,7 +34,11 @@
|
|||
class QIODevice;
|
||||
class FBXNode;
|
||||
|
||||
#if defined(Q_OS_ANDROID)
|
||||
#define FBX_PACK_NORMALS 0
|
||||
#else
|
||||
#define FBX_PACK_NORMALS 1
|
||||
#endif
|
||||
|
||||
#if FBX_PACK_NORMALS
|
||||
using NormalType = glm::uint32;
|
||||
|
|
|
@ -13,23 +13,86 @@
|
|||
|
||||
#include <mutex>
|
||||
|
||||
#if defined(HIFI_GLES)
|
||||
PFNGLQUERYCOUNTEREXTPROC __glQueryCounterEXT = NULL;
|
||||
PFNGLGETQUERYOBJECTUI64VEXTPROC __glGetQueryObjectui64vEXT = NULL;
|
||||
PFNGLFRAMEBUFFERTEXTUREEXTPROC __glFramebufferTextureEXT = NULL;
|
||||
#if defined(Q_OS_MAC)
|
||||
#include <OpenGL/CGLCurrent.h>
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
|
||||
static void* getGlProcessAddress(const char *namez) {
|
||||
auto result = wglGetProcAddress(namez);
|
||||
if (!result) {
|
||||
static HMODULE glModule = nullptr;
|
||||
if (!glModule) {
|
||||
glModule = LoadLibraryW(L"opengl32.dll");
|
||||
}
|
||||
result = GetProcAddress(glModule, namez);
|
||||
}
|
||||
if (!result) {
|
||||
OutputDebugStringA(namez);
|
||||
OutputDebugStringA("\n");
|
||||
}
|
||||
return (void*)result;
|
||||
}
|
||||
|
||||
typedef BOOL(APIENTRYP PFNWGLSWAPINTERVALEXTPROC)(int interval);
|
||||
typedef int (APIENTRYP PFNWGLGETSWAPINTERVALEXTPROC) (void);
|
||||
typedef BOOL(APIENTRYP PFNWGLCHOOSEPIXELFORMATARBPROC)(HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
typedef HGLRC(APIENTRYP PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC hDC, HGLRC hShareContext, const int *attribList);
|
||||
|
||||
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT;
|
||||
PFNWGLGETSWAPINTERVALEXTPROC wglGetSwapIntervalEXT;
|
||||
PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB;
|
||||
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB;
|
||||
|
||||
#elif defined(Q_OS_ANDROID)
|
||||
|
||||
static void* getGlProcessAddress(const char *namez) {
|
||||
auto result = eglGetProcAddress(namez);
|
||||
return (void*)result;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
void gl::initModuleGl() {
|
||||
static std::once_flag once;
|
||||
std::call_once(once, [] {
|
||||
#if defined(HIFI_GLES)
|
||||
glQueryCounterEXT = (PFNGLQUERYCOUNTEREXTPROC)eglGetProcAddress("glQueryCounterEXT");
|
||||
glGetQueryObjectui64vEXT = (PFNGLGETQUERYOBJECTUI64VEXTPROC)eglGetProcAddress("glGetQueryObjectui64vEXT");
|
||||
glFramebufferTextureEXT = (PFNGLFRAMEBUFFERTEXTUREEXTPROC)eglGetProcAddress("glFramebufferTextureEXT");
|
||||
#if defined(Q_OS_WIN)
|
||||
wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)getGlProcessAddress("wglSwapIntervalEXT");
|
||||
wglGetSwapIntervalEXT = (PFNWGLGETSWAPINTERVALEXTPROC)getGlProcessAddress("wglGetSwapIntervalEXT");
|
||||
wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)getGlProcessAddress("wglChoosePixelFormatARB");
|
||||
wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)getGlProcessAddress("wglCreateContextAttribsARB");
|
||||
#endif
|
||||
|
||||
#if defined(USE_GLES)
|
||||
gladLoadGLES2Loader(getGlProcessAddress);
|
||||
#else
|
||||
glewExperimental = true;
|
||||
glewInit();
|
||||
gladLoadGLLoader(getGlProcessAddress);
|
||||
#endif
|
||||
});
|
||||
}
|
||||
|
||||
int gl::getSwapInterval() {
|
||||
#if defined(Q_OS_WIN)
|
||||
return wglGetSwapIntervalEXT();
|
||||
#elif defined(Q_OS_MAC)
|
||||
GLint interval;
|
||||
CGLGetParameter(CGLGetCurrentContext(), kCGLCPSwapInterval, &interval);
|
||||
return interval;
|
||||
#else
|
||||
// TODO: Fill in for linux
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
void gl::setSwapInterval(int interval) {
|
||||
#if defined(Q_OS_WIN)
|
||||
wglSwapIntervalEXT(interval);
|
||||
#elif defined(Q_OS_MAC)
|
||||
CGLSetParameter(CGLGetCurrentContext(), kCGLCPSwapInterval, &interval);
|
||||
#else
|
||||
Q_UNUSED(interval);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -15,11 +15,6 @@
|
|||
#include <QtCore/QtGlobal>
|
||||
|
||||
#if defined(USE_GLES)
|
||||
#define HIFI_GLES
|
||||
#define HIFI_EGL
|
||||
#endif
|
||||
|
||||
#if defined(HIFI_GLES)
|
||||
// Minimum GL ES version required is 3.2
|
||||
#define GL_MIN_VERSION_MAJOR 0x03
|
||||
#define GL_MIN_VERSION_MINOR 0x02
|
||||
|
@ -35,57 +30,25 @@
|
|||
|
||||
#define MINIMUM_GL_VERSION ((GL_MIN_VERSION_MAJOR << 8) | GL_MIN_VERSION_MINOR)
|
||||
|
||||
#if defined(HIFI_EGL)
|
||||
#if defined(Q_OS_ANDROID)
|
||||
#include <EGL/egl.h>
|
||||
#include <glad/glad.h>
|
||||
#else
|
||||
#include <glad/glad.h>
|
||||
#ifndef GL_SLUMINANCE8_EXT
|
||||
#define GL_SLUMINANCE8_EXT 0x8C47
|
||||
#endif
|
||||
// Prevent inclusion of System GL headers
|
||||
#ifndef __gl_h_
|
||||
#define __gl_h_
|
||||
#endif
|
||||
|
||||
#if defined(HIFI_GLES)
|
||||
#include <GLES3/gl32.h>
|
||||
|
||||
#define GL_DEPTH_COMPONENT32_OES 0x81A7
|
||||
#define GL_TIME_ELAPSED_EXT 0x88BF
|
||||
#define GL_TIMESTAMP_EXT 0x8E28
|
||||
#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9
|
||||
#define GL_TEXTURE_BORDER_COLOR_EXT 0x1004
|
||||
#define GL_CLAMP_TO_BORDER_EXT 0x812D
|
||||
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
|
||||
#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
|
||||
|
||||
|
||||
// Add some additional extensions missing from GLES 3.1
|
||||
extern "C" {
|
||||
typedef void (GL_APIENTRYP PFNGLQUERYCOUNTEREXTPROC) (GLuint id, GLenum target);
|
||||
typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64 *params);
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
|
||||
|
||||
|
||||
#define glQueryCounterEXT __glQueryCounterEXT
|
||||
#define glGetQueryObjectui64vEXT __glGetQueryObjectui64vEXT
|
||||
#define glFramebufferTextureEXT __glFramebufferTextureEXT
|
||||
|
||||
extern PFNGLQUERYCOUNTEREXTPROC __glQueryCounterEXT;
|
||||
extern PFNGLGETQUERYOBJECTUI64VEXTPROC __glGetQueryObjectui64vEXT;
|
||||
extern PFNGLFRAMEBUFFERTEXTUREEXTPROC __glFramebufferTextureEXT;
|
||||
}
|
||||
|
||||
#else // !defined(HIFI_GLES)
|
||||
|
||||
#define GL_GLEXT_PROTOTYPES 1
|
||||
#include <GL/glew.h>
|
||||
|
||||
#if defined(Q_OS_DARWIN)
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glext.h>
|
||||
#include <OpenGL/OpenGL.h>
|
||||
#elif defined(Q_OS_WIN64)
|
||||
#include <GL/wglew.h>
|
||||
#endif
|
||||
|
||||
#endif // !defined(Q_OS_ANDROID)
|
||||
|
||||
// Platform specific code to load the GL functions
|
||||
namespace gl {
|
||||
void initModuleGl();
|
||||
int getSwapInterval();
|
||||
void setSwapInterval(int swapInterval);
|
||||
}
|
||||
|
||||
#endif // hifi_gpu_GPUConfig_h
|
||||
|
|
|
@ -23,10 +23,11 @@
|
|||
#include <shared/GlobalAppProperties.h>
|
||||
#include <GLMHelpers.h>
|
||||
#include "GLLogging.h"
|
||||
#include "Config.h"
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
|
||||
#ifdef DEBUG
|
||||
#if defined(DEBUG) || defined(USE_GLES)
|
||||
static bool enableDebugLogger = true;
|
||||
#else
|
||||
static const QString DEBUG_FLAG("HIFI_DEBUG_OPENGL");
|
||||
|
@ -69,12 +70,6 @@ Context::Context(QWindow* window) {
|
|||
setWindow(window);
|
||||
}
|
||||
|
||||
#ifdef GL_CUSTOM_CONTEXT
|
||||
void Context::destroyWin32Context(HGLRC hglrc) {
|
||||
wglDeleteContext(hglrc);
|
||||
}
|
||||
#endif
|
||||
|
||||
void Context::release() {
|
||||
doneCurrent();
|
||||
#ifdef GL_CUSTOM_CONTEXT
|
||||
|
@ -130,15 +125,22 @@ void Context::setWindow(QWindow* window) {
|
|||
updateSwapchainMemoryCounter();
|
||||
}
|
||||
|
||||
void Context::clear() {
|
||||
glClearColor(0, 0, 0, 1);
|
||||
QSize windowSize = _window->size() * _window->devicePixelRatio();
|
||||
glViewport(0, 0, windowSize.width(), windowSize.height());
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
swapBuffers();
|
||||
}
|
||||
|
||||
#ifndef GLAPIENTRY
|
||||
#define GLAPIENTRY GL_APIENTRY
|
||||
#endif
|
||||
#if defined(GL_CUSTOM_CONTEXT)
|
||||
|
||||
void GLAPIENTRY debugMessageCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam) {
|
||||
//if (GL_DEBUG_SEVERITY_NOTIFICATION == severity) {
|
||||
// return;
|
||||
//}
|
||||
#pragma optimize( "", off)
|
||||
|
||||
static void debugMessageCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam) {
|
||||
if (GL_DEBUG_SEVERITY_NOTIFICATION == severity) {
|
||||
return;
|
||||
}
|
||||
qCDebug(glLogging) << "OpenGL: " << message;
|
||||
|
||||
// For high severity errors, force a sync to the log, since we might crash
|
||||
|
@ -152,27 +154,7 @@ void GLAPIENTRY debugMessageCallback(GLenum source, GLenum type, GLuint id, GLen
|
|||
//}
|
||||
}
|
||||
|
||||
|
||||
#if defined(GL_CUSTOM_CONTEXT)
|
||||
|
||||
bool Context::makeCurrent() {
|
||||
BOOL result = wglMakeCurrent(_hdc, _hglrc);
|
||||
assert(result);
|
||||
updateSwapchainMemoryCounter();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void Context::swapBuffers() {
|
||||
SwapBuffers(_hdc);
|
||||
}
|
||||
|
||||
void Context::doneCurrent() {
|
||||
wglMakeCurrent(0, 0);
|
||||
}
|
||||
|
||||
|
||||
void setupPixelFormatSimple(HDC hdc) {
|
||||
static void setupPixelFormatSimple(HDC hdc) {
|
||||
// FIXME build the PFD based on the
|
||||
static const PIXELFORMATDESCRIPTOR pfd = // pfd Tells Windows How We Want Things To Be
|
||||
{
|
||||
|
@ -205,6 +187,59 @@ void setupPixelFormatSimple(HDC hdc) {
|
|||
}
|
||||
}
|
||||
|
||||
void Context::destroyWin32Context(HGLRC hglrc) {
|
||||
wglDeleteContext(hglrc);
|
||||
}
|
||||
|
||||
bool Context::makeCurrent() {
|
||||
BOOL result = wglMakeCurrent(_hdc, _hglrc);
|
||||
assert(result);
|
||||
updateSwapchainMemoryCounter();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void Context::swapBuffers() {
|
||||
SwapBuffers(_hdc);
|
||||
}
|
||||
|
||||
void Context::doneCurrent() {
|
||||
wglMakeCurrent(0, 0);
|
||||
}
|
||||
|
||||
// Pixel format arguments
|
||||
#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9
|
||||
#define WGL_DRAW_TO_WINDOW_ARB 0x2001
|
||||
#define WGL_COLOR_BITS_ARB 0x2014
|
||||
#define WGL_DEPTH_BITS_ARB 0x2022
|
||||
#define WGL_PIXEL_TYPE_ARB 0x2013
|
||||
#define WGL_STENCIL_BITS_ARB 0x2023
|
||||
#define WGL_TYPE_RGBA_ARB 0x202B
|
||||
#define WGL_SUPPORT_OPENGL_ARB 0x2010
|
||||
#define WGL_DOUBLE_BUFFER_ARB 0x2011
|
||||
|
||||
// Context create arguments
|
||||
#define WGL_CONTEXT_FLAGS_ARB 0x2094
|
||||
#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
|
||||
#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
|
||||
#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
|
||||
|
||||
// Context create flag bits
|
||||
#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001
|
||||
#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
|
||||
#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
|
||||
|
||||
#if !defined(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB)
|
||||
#define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242
|
||||
#endif
|
||||
|
||||
typedef BOOL(APIENTRYP PFNWGLCHOOSEPIXELFORMATARBPROC)(HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
typedef HGLRC(APIENTRYP PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC hDC, HGLRC hShareContext, const int *attribList);
|
||||
|
||||
GLAPI PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB;
|
||||
GLAPI PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB;
|
||||
|
||||
|
||||
void Context::create() {
|
||||
if (!PRIMARY) {
|
||||
PRIMARY = static_cast<Context*>(qApp->property(hifi::properties::gl::PRIMARY_CONTEXT).value<void*>());
|
||||
|
@ -224,7 +259,6 @@ void Context::create() {
|
|||
if (qApp->property(hifi::properties::CRASHED).toBool()) {
|
||||
enableDebugLogger = true;
|
||||
}
|
||||
|
||||
auto hdc = GetDC(hwnd);
|
||||
setupPixelFormatSimple(hdc);
|
||||
auto glrc = wglCreateContext(hdc);
|
||||
|
@ -233,20 +267,25 @@ void Context::create() {
|
|||
if (!makeCurrentResult) {
|
||||
throw std::runtime_error("Unable to create initial context");
|
||||
}
|
||||
glewExperimental = true;
|
||||
glewInit();
|
||||
if (glewIsSupported("GL_VERSION_4_5")) {
|
||||
_version = 0x0405;
|
||||
} else if (glewIsSupported("GL_VERSION_4_3")) {
|
||||
_version = 0x0403;
|
||||
}
|
||||
glGetError();
|
||||
gl::initModuleGl();
|
||||
wglMakeCurrent(0, 0);
|
||||
wglDeleteContext(glrc);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
});
|
||||
|
||||
_hdc = GetDC(_hwnd);
|
||||
#if defined(USE_GLES)
|
||||
_version = 0x0200;
|
||||
#else
|
||||
if (GLAD_GL_VERSION_4_5) {
|
||||
_version = 0x0405;
|
||||
} else if (GLAD_GL_VERSION_4_3) {
|
||||
_version = 0x0403;
|
||||
} else {
|
||||
_version = 0x0401;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int pixelFormat = 0;
|
||||
static PIXELFORMATDESCRIPTOR pfd;
|
||||
if (!pixelFormat) {
|
||||
|
@ -267,6 +306,7 @@ void Context::create() {
|
|||
formatAttribs.push_back(24);
|
||||
formatAttribs.push_back(WGL_STENCIL_BITS_ARB);
|
||||
formatAttribs.push_back(8);
|
||||
|
||||
#ifdef NATIVE_SRGB_FRAMEBUFFER
|
||||
// formatAttribs.push_back(WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB);
|
||||
// formatAttribs.push_back(GL_TRUE);
|
||||
|
@ -292,7 +332,11 @@ void Context::create() {
|
|||
contextAttribs.push_back(WGL_CONTEXT_MINOR_VERSION_ARB);
|
||||
contextAttribs.push_back(minorVersion);
|
||||
contextAttribs.push_back(WGL_CONTEXT_PROFILE_MASK_ARB);
|
||||
#if defined(USE_GLES)
|
||||
contextAttribs.push_back(WGL_CONTEXT_ES2_PROFILE_BIT_EXT);
|
||||
#else
|
||||
contextAttribs.push_back(WGL_CONTEXT_CORE_PROFILE_BIT_ARB);
|
||||
#endif
|
||||
contextAttribs.push_back(WGL_CONTEXT_FLAGS_ARB);
|
||||
if (enableDebugLogger) {
|
||||
contextAttribs.push_back(WGL_CONTEXT_DEBUG_BIT_ARB);
|
||||
|
@ -313,24 +357,20 @@ void Context::create() {
|
|||
qApp->setProperty(hifi::properties::gl::PRIMARY_CONTEXT, QVariant::fromValue((void*)PRIMARY));
|
||||
}
|
||||
|
||||
if (!makeCurrent()) {
|
||||
throw std::runtime_error("Could not make context current");
|
||||
}
|
||||
if (enableDebugLogger) {
|
||||
makeCurrent();
|
||||
glDebugMessageCallback(debugMessageCallback, NULL);
|
||||
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
|
||||
doneCurrent();
|
||||
}
|
||||
doneCurrent();
|
||||
}
|
||||
|
||||
#pragma optimize( "", on)
|
||||
|
||||
#endif
|
||||
|
||||
void Context::clear() {
|
||||
glClearColor(0, 0, 0, 1);
|
||||
QSize windowSize = _window->size() * _window->devicePixelRatio();
|
||||
glViewport(0, 0, windowSize.width(), windowSize.height());
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
swapBuffers();
|
||||
}
|
||||
|
||||
|
||||
OffscreenContext::~OffscreenContext() {
|
||||
_window->deleteLater();
|
||||
|
|
|
@ -22,7 +22,7 @@ class QWindow;
|
|||
class QOpenGLContext;
|
||||
class QThread;
|
||||
|
||||
#if defined(Q_OS_WIN) && !defined(USE_GLES)
|
||||
#if defined(Q_OS_WIN)
|
||||
#define GL_CUSTOM_CONTEXT
|
||||
#endif
|
||||
namespace gl {
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
|
||||
#include "Context.h"
|
||||
|
||||
#include "Config.h"
|
||||
|
||||
#include <QtGui/QOpenGLContext>
|
||||
#include <QtGui/QWindow>
|
||||
|
||||
|
@ -48,7 +50,9 @@ void Context::moveToThread(QThread* thread) {
|
|||
#ifndef GL_CUSTOM_CONTEXT
|
||||
bool Context::makeCurrent() {
|
||||
updateSwapchainMemoryCounter();
|
||||
return _context->makeCurrent(_window);
|
||||
bool result = _context->makeCurrent(_window);
|
||||
gl::initModuleGl();
|
||||
return result;
|
||||
}
|
||||
|
||||
void Context::swapBuffers() {
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include <mutex>
|
||||
|
||||
#include "Config.h"
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QThread>
|
||||
#include <QtCore/QRegularExpression>
|
||||
|
@ -11,8 +13,6 @@
|
|||
#include <QtGui/QOpenGLContext>
|
||||
#include <QtGui/QOpenGLDebugLogger>
|
||||
|
||||
#include <QtOpenGL/QGL>
|
||||
|
||||
size_t evalGLFormatSwapchainPixelSize(const QSurfaceFormat& format) {
|
||||
size_t pixelSize = format.redBufferSize() + format.greenBufferSize() + format.blueBufferSize() + format.alphaBufferSize();
|
||||
// We don't apply the length of the swap chain into this pixelSize since it is not vsible for the Process (on windows).
|
||||
|
|
|
@ -69,6 +69,7 @@ void GLWidget::createContext() {
|
|||
_context->create();
|
||||
_context->makeCurrent();
|
||||
_context->clear();
|
||||
_context->doneCurrent();
|
||||
}
|
||||
|
||||
bool GLWidget::makeCurrent() {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "GLWindow.h"
|
||||
|
||||
#include "Config.h"
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtGui/QOpenGLContext>
|
||||
|
||||
|
@ -19,26 +20,18 @@ void GLWindow::createContext(QOpenGLContext* shareContext) {
|
|||
}
|
||||
|
||||
void GLWindow::createContext(const QSurfaceFormat& format, QOpenGLContext* shareContext) {
|
||||
setSurfaceType(QSurface::OpenGLSurface);
|
||||
setFormat(format);
|
||||
_context = new QOpenGLContext;
|
||||
_context->setFormat(format);
|
||||
if (shareContext) {
|
||||
_context->setShareContext(shareContext);
|
||||
}
|
||||
_context = new gl::Context();
|
||||
_context->setWindow(this);
|
||||
_context->create();
|
||||
_context->makeCurrent();
|
||||
_context->clear();
|
||||
}
|
||||
|
||||
GLWindow::~GLWindow() {
|
||||
if (_context) {
|
||||
_context->doneCurrent();
|
||||
_context->deleteLater();
|
||||
_context = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool GLWindow::makeCurrent() {
|
||||
bool makeCurrentResult = _context->makeCurrent(this);
|
||||
bool makeCurrentResult = _context->makeCurrent();
|
||||
Q_ASSERT(makeCurrentResult);
|
||||
|
||||
std::call_once(_reportOnce, []{
|
||||
|
@ -48,7 +41,7 @@ bool GLWindow::makeCurrent() {
|
|||
qCDebug(glLogging) << "GL Renderer: " << QString((const char*) glGetString(GL_RENDERER));
|
||||
});
|
||||
|
||||
Q_ASSERT(_context == QOpenGLContext::currentContext());
|
||||
//Q_ASSERT(_context->qglContext() == QOpenGLContext::currentContext());
|
||||
|
||||
return makeCurrentResult;
|
||||
}
|
||||
|
@ -58,11 +51,11 @@ void GLWindow::doneCurrent() {
|
|||
}
|
||||
|
||||
void GLWindow::swapBuffers() {
|
||||
_context->swapBuffers(this);
|
||||
_context->swapBuffers();
|
||||
}
|
||||
|
||||
QOpenGLContext* GLWindow::context() const {
|
||||
return _context;
|
||||
return _context->qglContext();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
|
||||
#include <mutex>
|
||||
#include <QtGui/QWindow>
|
||||
#include "Context.h"
|
||||
|
||||
class QOpenGLContext;
|
||||
class QOpenGLDebugLogger;
|
||||
|
||||
class GLWindow : public QWindow {
|
||||
public:
|
||||
|
@ -26,8 +26,8 @@ public:
|
|||
void swapBuffers();
|
||||
QOpenGLContext* context() const;
|
||||
private:
|
||||
gl::Context* _context{ nullptr };
|
||||
std::once_flag _reportOnce;
|
||||
QOpenGLContext* _context{ nullptr };
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
#include "OffscreenGLCanvas.h"
|
||||
|
||||
#include "Config.h"
|
||||
|
||||
#include <QtCore/QProcessEnvironment>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtGui/QOffscreenSurface>
|
||||
|
|
|
@ -1,117 +0,0 @@
|
|||
//
|
||||
// OpenGLVersionChecker.cpp
|
||||
// libraries/gl/src/gl
|
||||
//
|
||||
// Created by David Rowe on 28 Jan 2016.
|
||||
// Copyright 2016 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include "OpenGLVersionChecker.h"
|
||||
|
||||
#if !defined(Q_OS_ANDROID)
|
||||
|
||||
#include "Config.h"
|
||||
|
||||
#include <mutex>
|
||||
|
||||
#include <QtCore/QRegularExpression>
|
||||
#include <QtCore/QJsonObject>
|
||||
#include <QtWidgets/QMessageBox>
|
||||
#include <QtOpenGL/QGLWidget>
|
||||
|
||||
#include "GLHelpers.h"
|
||||
|
||||
OpenGLVersionChecker::OpenGLVersionChecker(int& argc, char** argv) :
|
||||
QApplication(argc, argv)
|
||||
{
|
||||
}
|
||||
|
||||
const QGLFormat& getDefaultGLFormat() {
|
||||
// Specify an OpenGL 3.3 format using the Core profile.
|
||||
// That is, no old-school fixed pipeline functionality
|
||||
static QGLFormat glFormat;
|
||||
static std::once_flag once;
|
||||
std::call_once(once, [] {
|
||||
setGLFormatVersion(glFormat);
|
||||
glFormat.setProfile(QGLFormat::CoreProfile); // Requires >=Qt-4.8.0
|
||||
glFormat.setSampleBuffers(false);
|
||||
glFormat.setDepth(false);
|
||||
glFormat.setStencil(false);
|
||||
QGLFormat::setDefaultFormat(glFormat);
|
||||
});
|
||||
return glFormat;
|
||||
}
|
||||
|
||||
|
||||
QJsonObject OpenGLVersionChecker::checkVersion(bool& valid, bool& override) {
|
||||
valid = true;
|
||||
override = false;
|
||||
|
||||
QGLWidget* glWidget = new QGLWidget(getDefaultGLFormat());
|
||||
|
||||
valid = glWidget->isValid();
|
||||
// Inform user if no OpenGL support
|
||||
if (!valid) {
|
||||
QMessageBox messageBox;
|
||||
messageBox.setWindowTitle("Missing OpenGL Support");
|
||||
messageBox.setIcon(QMessageBox::Warning);
|
||||
messageBox.setText(QString().sprintf("Your system does not support OpenGL, Interface cannot run."));
|
||||
messageBox.setInformativeText("Press OK to exit.");
|
||||
messageBox.setStandardButtons(QMessageBox::Ok);
|
||||
messageBox.setDefaultButton(QMessageBox::Ok);
|
||||
messageBox.exec();
|
||||
return QJsonObject();
|
||||
}
|
||||
|
||||
// Retrieve OpenGL version
|
||||
// glWidget->initializeGL();
|
||||
glWidget->makeCurrent();
|
||||
QJsonObject glData = getGLContextData();
|
||||
delete glWidget;
|
||||
|
||||
// Compare against minimum
|
||||
// The GL_VERSION string begins with a version number in one of these forms:
|
||||
// - major_number.minor_number
|
||||
// - major_number.minor_number.release_number
|
||||
// Reference: https://www.opengl.org/sdk/docs/man/docbook4/xhtml/glGetString.xml
|
||||
|
||||
int minimumMajorNumber = (MINIMUM_GL_VERSION >> 8) & 0xFF;
|
||||
int minimumMinorNumber = (MINIMUM_GL_VERSION & 0xFF);
|
||||
int majorNumber = 0;
|
||||
int minorNumber = 0;
|
||||
const QString version { "version" };
|
||||
if (glData.contains(version)) {
|
||||
QString glVersion = glData[version].toString();
|
||||
QStringList versionParts = glVersion.split(QRegularExpression("[\\.\\s]"));
|
||||
if (versionParts.size() >= 2) {
|
||||
majorNumber = versionParts[0].toInt();
|
||||
minorNumber = versionParts[1].toInt();
|
||||
valid = (majorNumber > minimumMajorNumber
|
||||
|| (majorNumber == minimumMajorNumber && minorNumber >= minimumMinorNumber));
|
||||
} else {
|
||||
valid = false;
|
||||
}
|
||||
} else {
|
||||
valid = false;
|
||||
}
|
||||
|
||||
// Prompt user if below minimum
|
||||
if (!valid) {
|
||||
QMessageBox messageBox;
|
||||
messageBox.setWindowTitle("OpenGL Version Too Low");
|
||||
messageBox.setIcon(QMessageBox::Warning);
|
||||
messageBox.setText(QString().sprintf("Your OpenGL version of %i.%i is lower than the minimum of %i.%i.",
|
||||
majorNumber, minorNumber, minimumMajorNumber, minimumMinorNumber));
|
||||
messageBox.setInformativeText("Press OK to exit; Ignore to continue.");
|
||||
messageBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Ignore);
|
||||
messageBox.setDefaultButton(QMessageBox::Ok);
|
||||
override = messageBox.exec() == QMessageBox::Ignore;
|
||||
}
|
||||
|
||||
return glData;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,28 +0,0 @@
|
|||
//
|
||||
// OpenGLVersionChecker.h
|
||||
// libraries/gl/src/gl
|
||||
//
|
||||
// Created by David Rowe on 28 Jan 2016.
|
||||
// Copyright 2016 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#ifndef hifi_OpenGLVersionChecker_h
|
||||
#define hifi_OpenGLVersionChecker_h
|
||||
|
||||
#include <QtGlobal>
|
||||
#if !defined(Q_OS_ANDROID)
|
||||
#include <QApplication>
|
||||
|
||||
class OpenGLVersionChecker : public QApplication {
|
||||
|
||||
public:
|
||||
OpenGLVersionChecker(int& argc, char** argv);
|
||||
|
||||
static QJsonObject checkVersion(bool& valid, bool& override);
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // hifi_OpenGLVersionChecker_h
|
|
@ -153,30 +153,7 @@ void GLBackend::init() {
|
|||
qCDebug(gpugllogging) << "\tcard:" << gpu->getName();
|
||||
qCDebug(gpugllogging) << "\tdriver:" << gpu->getDriver();
|
||||
qCDebug(gpugllogging) << "\tdedicated memory:" << gpu->getMemory() << "MB";
|
||||
|
||||
glewExperimental = true;
|
||||
GLenum err = glewInit();
|
||||
glGetError(); // clear the potential error from glewExperimental
|
||||
if (GLEW_OK != err) {
|
||||
// glewInit failed, something is seriously wrong.
|
||||
qCDebug(gpugllogging, "Error: %s\n", glewGetErrorString(err));
|
||||
}
|
||||
qCDebug(gpugllogging, "Status: Using GLEW %s\n", glewGetString(GLEW_VERSION));
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
if (wglewGetExtension("WGL_EXT_swap_control")) {
|
||||
int swapInterval = wglGetSwapIntervalEXT();
|
||||
qCDebug(gpugllogging, "V-Sync is %s\n", (swapInterval > 0 ? "ON" : "OFF"));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
// TODO: Write the correct code for Linux...
|
||||
/* if (wglewGetExtension("WGL_EXT_swap_control")) {
|
||||
int swapInterval = wglGetSwapIntervalEXT();
|
||||
qCDebug(gpugllogging, "V-Sync is %s\n", (swapInterval > 0 ? "ON" : "OFF"));
|
||||
}*/
|
||||
#endif
|
||||
qCDebug(gpugllogging, "V-Sync is %s\n", (::gl::getSwapInterval() > 0 ? "ON" : "OFF"));
|
||||
#if THREADED_TEXTURE_BUFFERING
|
||||
// This has to happen on the main thread in order to give the thread
|
||||
// pool a reasonable parent object
|
||||
|
|
|
@ -75,7 +75,7 @@ GLenum GLTexelFormat::evalGLTexelFormatInternal(const gpu::Element& dstFormat) {
|
|||
break;
|
||||
case gpu::NUINT8:
|
||||
if ((dstFormat.getSemantic() == gpu::SRGB || dstFormat.getSemantic() == gpu::SRGBA)) {
|
||||
result = GL_SLUMINANCE8;
|
||||
result = GL_SLUMINANCE8_EXT;
|
||||
} else {
|
||||
result = GL_R8;
|
||||
}
|
||||
|
@ -491,7 +491,7 @@ GLTexelFormat GLTexelFormat::evalGLTexelFormat(const Element& dstFormat, const E
|
|||
}
|
||||
case gpu::NUINT8: {
|
||||
if ((dstFormat.getSemantic() == gpu::SRGB || dstFormat.getSemantic() == gpu::SRGBA)) {
|
||||
texel.internalFormat = GL_SLUMINANCE8;
|
||||
texel.internalFormat = GL_SLUMINANCE8_EXT;
|
||||
} else {
|
||||
texel.internalFormat = GL_R8;
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ void GL41Texture::syncSampler() const {
|
|||
glTexParameteri(_target, GL_TEXTURE_MAG_FILTER, fm.magFilter);
|
||||
|
||||
if (sampler.doComparison()) {
|
||||
glTexParameteri(_target, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE);
|
||||
glTexParameteri(_target, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE_ARB);
|
||||
glTexParameteri(_target, GL_TEXTURE_COMPARE_FUNC, COMPARISON_TO_GL[sampler.getComparisonFunction()]);
|
||||
} else {
|
||||
glTexParameteri(_target, GL_TEXTURE_COMPARE_MODE, GL_NONE);
|
||||
|
|
|
@ -197,7 +197,7 @@ void GL45Texture::syncSampler() const {
|
|||
glTextureParameteri(_id, GL_TEXTURE_MAG_FILTER, fm.magFilter);
|
||||
|
||||
if (sampler.doComparison()) {
|
||||
glTextureParameteri(_id, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE);
|
||||
glTextureParameteri(_id, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE_ARB);
|
||||
glTextureParameteri(_id, GL_TEXTURE_COMPARE_FUNC, COMPARISON_TO_GL[sampler.getComparisonFunction()]);
|
||||
} else {
|
||||
glTextureParameteri(_id, GL_TEXTURE_COMPARE_MODE, GL_NONE);
|
||||
|
|
|
@ -2,10 +2,4 @@ set(TARGET_NAME gpu-gles)
|
|||
setup_hifi_library(Concurrent)
|
||||
link_hifi_libraries(shared gl gpu)
|
||||
GroupSources("src")
|
||||
|
||||
target_opengl()
|
||||
target_nsight()
|
||||
|
||||
if (NOT ANDROID)
|
||||
target_glew()
|
||||
endif ()
|
||||
|
|
|
@ -174,7 +174,7 @@ void GLBackend::renderPassTransfer(const Batch& batch) {
|
|||
|
||||
_inRenderTransferPass = true;
|
||||
{ // Sync all the buffers
|
||||
ANDROID_PROFILE(render, "syncGPUBuffer", 0xffaaffaa, 1)
|
||||
PROFILE_RANGE(render_gpu_gl_detail, "syncGPUBuffer");
|
||||
|
||||
for (auto& cached : batch._buffers._items) {
|
||||
if (cached._data) {
|
||||
|
@ -184,7 +184,7 @@ void GLBackend::renderPassTransfer(const Batch& batch) {
|
|||
}
|
||||
|
||||
{ // Sync all the transform states
|
||||
ANDROID_PROFILE(render, "syncCPUTransform", 0xffaaaaff, 1)
|
||||
PROFILE_RANGE(render_gpu_gl_detail, "syncCPUTransform");
|
||||
_transform._cameras.clear();
|
||||
_transform._cameraOffsets.clear();
|
||||
|
||||
|
@ -210,7 +210,6 @@ void GLBackend::renderPassTransfer(const Batch& batch) {
|
|||
case Batch::COMMAND_setViewportTransform:
|
||||
case Batch::COMMAND_setViewTransform:
|
||||
case Batch::COMMAND_setProjectionTransform: {
|
||||
ANDROID_PROFILE_COMMAND(render, (int)(*command), 0xffeeaaff, 1)
|
||||
CommandCall call = _commandCalls[(*command)];
|
||||
(this->*(call))(batch, *offset);
|
||||
break;
|
||||
|
@ -225,8 +224,7 @@ void GLBackend::renderPassTransfer(const Batch& batch) {
|
|||
}
|
||||
|
||||
{ // Sync the transform buffers
|
||||
//PROFILE_RANGE(render_gpu_gl, "transferTransformState");
|
||||
ANDROID_PROFILE(render, "transferTransformState", 0xff0000ff, 1)
|
||||
PROFILE_RANGE(render_gpu_gl_detail, "syncGPUTransform");
|
||||
transferTransformState(batch);
|
||||
}
|
||||
|
||||
|
@ -261,15 +259,12 @@ void GLBackend::renderPassDraw(const Batch& batch) {
|
|||
updateInput();
|
||||
updateTransform(batch);
|
||||
updatePipeline();
|
||||
{
|
||||
ANDROID_PROFILE_COMMAND(render, (int)(*command), 0xff0000ff, 1)
|
||||
|
||||
CommandCall call = _commandCalls[(*command)];
|
||||
(this->*(call))(batch, *offset);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
ANDROID_PROFILE_COMMAND(render, (int)(*command), 0xffff00ff, 1)
|
||||
CommandCall call = _commandCalls[(*command)];
|
||||
(this->*(call))(batch, *offset);
|
||||
break;
|
||||
|
@ -282,7 +277,6 @@ void GLBackend::renderPassDraw(const Batch& batch) {
|
|||
}
|
||||
|
||||
void GLBackend::render(const Batch& batch) {
|
||||
ANDROID_PROFILE(render, "GLBackendRender", 0xffff00ff, 1)
|
||||
_transform._skybox = _stereo._skybox = batch.isSkyboxEnabled();
|
||||
// Allow the batch to override the rendering stereo settings
|
||||
// for things like full framebuffer copy operations (deferred lighting passes)
|
||||
|
@ -292,21 +286,24 @@ void GLBackend::render(const Batch& batch) {
|
|||
}
|
||||
|
||||
{
|
||||
//PROFILE_RANGE(render_gpu_gl, "Transfer");
|
||||
ANDROID_PROFILE(render, "Transfer", 0xff0000ff, 1)
|
||||
PROFILE_RANGE(render_gpu_gl_detail, "Transfer");
|
||||
renderPassTransfer(batch);
|
||||
}
|
||||
|
||||
#ifdef GPU_STEREO_DRAWCALL_INSTANCED
|
||||
if (_stereo.isStereo()) {
|
||||
glEnable(GL_CLIP_DISTANCE0);
|
||||
glEnable(GL_CLIP_DISTANCE0_EXT);
|
||||
}
|
||||
#endif
|
||||
{
|
||||
//PROFILE_RANGE(render_gpu_gl, _stereo._enable ? "Render Stereo" : "Render");
|
||||
ANDROID_PROFILE(render, "RenderPassDraw", 0xff00ddff, 1)
|
||||
PROFILE_RANGE(render_gpu_gl_detail, _stereo.isStereo() ? "Render Stereo" : "Render");
|
||||
renderPassDraw(batch);
|
||||
}
|
||||
#ifdef GPU_STEREO_DRAWCALL_INSTANCED
|
||||
if (_stereo.isStereo()) {
|
||||
glDisable(GL_CLIP_DISTANCE0_EXT);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Restore the saved stereo state for the next batch
|
||||
_stereo._enable = savedStereo;
|
||||
|
@ -314,15 +311,15 @@ void GLBackend::render(const Batch& batch) {
|
|||
|
||||
|
||||
void GLBackend::syncCache() {
|
||||
PROFILE_RANGE(render_gpu_gl_detail, __FUNCTION__);
|
||||
|
||||
syncTransformStateCache();
|
||||
syncPipelineStateCache();
|
||||
syncInputStateCache();
|
||||
syncOutputStateCache();
|
||||
|
||||
//glEnable(GL_LINE_SMOOTH);
|
||||
qDebug() << "TODO: GLBackend.cpp:syncCache GL_LINE_SMOOTH";
|
||||
}
|
||||
|
||||
#ifdef GPU_STEREO_DRAWCALL_DOUBLED
|
||||
void GLBackend::setupStereoSide(int side) {
|
||||
ivec4 vp = _transform._viewport;
|
||||
vp.z /= 2;
|
||||
|
@ -330,14 +327,14 @@ void GLBackend::setupStereoSide(int side) {
|
|||
|
||||
#ifdef GPU_STEREO_CAMERA_BUFFER
|
||||
#ifdef GPU_STEREO_DRAWCALL_DOUBLED
|
||||
//glVertexAttribI1i(14, side);
|
||||
glVertexAttribI4i(14, side, 0, 0, 0);
|
||||
|
||||
glVertexAttribI1i(14, side);
|
||||
#endif
|
||||
#else
|
||||
_transform.bindCurrentCamera(side);
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
#endif
|
||||
|
||||
void GLBackend::do_resetStages(const Batch& batch, size_t paramOffset) {
|
||||
resetStages();
|
||||
|
@ -387,27 +384,34 @@ void GLBackend::resetStages() {
|
|||
|
||||
|
||||
void GLBackend::do_pushProfileRange(const Batch& batch, size_t paramOffset) {
|
||||
if (trace_render_gpu_gl_detail().isDebugEnabled()) {
|
||||
auto name = batch._profileRanges.get(batch._params[paramOffset]._uint);
|
||||
profileRanges.push_back(name);
|
||||
#if defined(NSIGHT_FOUND)
|
||||
nvtxRangePush(name.c_str());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void GLBackend::do_popProfileRange(const Batch& batch, size_t paramOffset) {
|
||||
if (trace_render_gpu_gl_detail().isDebugEnabled()) {
|
||||
profileRanges.pop_back();
|
||||
#if defined(NSIGHT_FOUND)
|
||||
nvtxRangePop();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: As long as we have gl calls explicitely issued from interface
|
||||
// code, we need to be able to record and batch these calls. THe long
|
||||
// term strategy is to get rid of any GL calls in favor of the HIFI GPU API
|
||||
|
||||
// As long as we don;t use several versions of shaders we can avoid this more complex code path
|
||||
// #define GET_UNIFORM_LOCATION(shaderUniformLoc) _pipeline._programShader->getUniformLocation(shaderUniformLoc, isStereo());
|
||||
#ifdef GPU_STEREO_CAMERA_BUFFER
|
||||
#define GET_UNIFORM_LOCATION(shaderUniformLoc) ((_pipeline._programShader) ? _pipeline._programShader->getUniformLocation(shaderUniformLoc, (GLShader::Version) isStereo()) : -1)
|
||||
#else
|
||||
#define GET_UNIFORM_LOCATION(shaderUniformLoc) shaderUniformLoc
|
||||
#endif
|
||||
|
||||
void GLBackend::do_glUniform1i(const Batch& batch, size_t paramOffset) {
|
||||
if (_pipeline._program == 0) {
|
||||
|
@ -571,6 +575,10 @@ void GLBackend::do_glColor4f(const Batch& batch, size_t paramOffset) {
|
|||
if (_input._colorAttribute != newColor) {
|
||||
_input._colorAttribute = newColor;
|
||||
glVertexAttrib4fv(gpu::Stream::COLOR, &_input._colorAttribute.r);
|
||||
// Color has been changed and is not white. To prevent colors from bleeding
|
||||
// between different objects, we need to set the _hadColorAttribute flag
|
||||
// as if a previous render call had potential colors
|
||||
_input._hadColorAttribute = (newColor != glm::vec4(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
}
|
||||
(void)CHECK_GL_ERROR();
|
||||
}
|
||||
|
@ -616,6 +624,7 @@ void GLBackend::queueLambda(const std::function<void()> lambda) const {
|
|||
}
|
||||
|
||||
void GLBackend::recycle() const {
|
||||
PROFILE_RANGE(render_gpu_gl, __FUNCTION__)
|
||||
{
|
||||
std::list<std::function<void()>> lamdbasTrash;
|
||||
{
|
||||
|
@ -737,7 +746,7 @@ void GLBackend::recycle() const {
|
|||
|
||||
GLVariableAllocationSupport::manageMemory();
|
||||
GLVariableAllocationSupport::_frameTexturesCreated = 0;
|
||||
|
||||
Texture::KtxStorage::releaseOpenKtxFiles();
|
||||
}
|
||||
|
||||
void GLBackend::setCameraCorrection(const Mat4& correction) {
|
||||
|
|
|
@ -29,9 +29,16 @@
|
|||
|
||||
// Different versions for the stereo drawcall
|
||||
// Current preferred is "instanced" which draw the shape twice but instanced and rely on clipping plane to draw left/right side only
|
||||
#define GPU_STEREO_TECHNIQUE_DOUBLED_SIMPLE
|
||||
//#define GPU_STEREO_TECHNIQUE_DOUBLED_SMARTER
|
||||
//#define GPU_STEREO_TECHNIQUE_INSTANCED
|
||||
|
||||
|
||||
// Let these be configured by the one define picked above
|
||||
#ifdef GPU_STEREO_TECHNIQUE_DOUBLED_SIMPLE
|
||||
#define GPU_STEREO_DRAWCALL_DOUBLED
|
||||
#endif
|
||||
|
||||
#ifdef GPU_STEREO_TECHNIQUE_DOUBLED_SMARTER
|
||||
#define GPU_STEREO_DRAWCALL_DOUBLED
|
||||
#define GPU_STEREO_CAMERA_BUFFER
|
||||
|
@ -42,15 +49,6 @@
|
|||
#define GPU_STEREO_CAMERA_BUFFER
|
||||
#endif
|
||||
|
||||
//#define ANDROID_INTENSIVE_INSTRUMENTATION 1
|
||||
|
||||
#ifdef ANDROID_INTENSIVE_INSTRUMENTATION
|
||||
#define ANDROID_PROFILE_COMMAND(category, commandIndex, argbColor, payload, ...) PROFILE_RANGE_EX(category, commandNames[commandIndex], argbColor, payload, ##__VA_ARGS__);
|
||||
#define ANDROID_PROFILE(category, name, argbColor, payload, ...) PROFILE_RANGE_EX(category, name, argbColor, payload, ##__VA_ARGS__);
|
||||
#else
|
||||
#define ANDROID_PROFILE_COMMAND(category, commandIndex, argbColor, payload, ...)
|
||||
#define ANDROID_PROFILE(category, name, argbColor, payload, ...)
|
||||
#endif
|
||||
namespace gpu { namespace gl {
|
||||
|
||||
class GLBackend : public Backend, public std::enable_shared_from_this<GLBackend> {
|
||||
|
@ -239,7 +237,10 @@ protected:
|
|||
|
||||
void renderPassTransfer(const Batch& batch);
|
||||
void renderPassDraw(const Batch& batch);
|
||||
|
||||
#ifdef GPU_STEREO_DRAWCALL_DOUBLED
|
||||
void setupStereoSide(int side);
|
||||
#endif
|
||||
|
||||
virtual void initInput() final;
|
||||
virtual void killInput() final;
|
||||
|
@ -249,6 +250,7 @@ protected:
|
|||
|
||||
struct InputStageState {
|
||||
bool _invalidFormat { true };
|
||||
bool _hadColorAttribute{ true };
|
||||
Stream::FormatPointer _format;
|
||||
std::string _formatKey;
|
||||
|
||||
|
|
|
@ -73,13 +73,11 @@ void GLBackend::initInput() {
|
|||
if(!_input._defaultVAO) {
|
||||
glGenVertexArrays(1, &_input._defaultVAO);
|
||||
}
|
||||
qDebug() << "glBindVertexArray(" << _input._defaultVAO << ")";
|
||||
glBindVertexArray(_input._defaultVAO);
|
||||
(void) CHECK_GL_ERROR();
|
||||
}
|
||||
|
||||
void GLBackend::killInput() {
|
||||
qDebug() << "glBindVertexArray(0)";
|
||||
glBindVertexArray(0);
|
||||
if(_input._defaultVAO) {
|
||||
glDeleteVertexArrays(1, &_input._defaultVAO);
|
||||
|
@ -94,7 +92,6 @@ void GLBackend::syncInputStateCache() {
|
|||
_input._attributeActivation[i] = active;
|
||||
}
|
||||
//_input._defaultVAO
|
||||
qDebug() << "glBindVertexArray("<<_input._defaultVAO<< ")";
|
||||
glBindVertexArray(_input._defaultVAO);
|
||||
}
|
||||
|
||||
|
@ -103,7 +100,6 @@ void GLBackend::resetInputStage() {
|
|||
_input._indexBufferType = UINT32;
|
||||
_input._indexBufferOffset = 0;
|
||||
_input._indexBuffer.reset();
|
||||
//qDebug() << "GLBackend::resetInputStage glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);";
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
(void) CHECK_GL_ERROR();
|
||||
|
||||
|
@ -159,49 +155,83 @@ void GLBackend::do_setIndirectBuffer(const Batch& batch, size_t paramOffset) {
|
|||
(void)CHECK_GL_ERROR();
|
||||
}
|
||||
|
||||
|
||||
// Core 41 doesn't expose the features to really separate the vertex format from the vertex buffers binding
|
||||
// Core 43 does :)
|
||||
// FIXME crashing problem with glVertexBindingDivisor / glVertexAttribFormat
|
||||
// Once resolved, break this up into the GL 4.1 and 4.5 backends
|
||||
#if 1 || (GPU_INPUT_PROFILE == GPU_CORE_41)
|
||||
#define NO_SUPPORT_VERTEX_ATTRIB_FORMAT
|
||||
#else
|
||||
#define SUPPORT_VERTEX_ATTRIB_FORMAT
|
||||
#endif
|
||||
|
||||
void GLBackend::updateInput() {
|
||||
#if defined(SUPPORT_VERTEX_ATTRIB_FORMAT)
|
||||
if (_input._invalidFormat) {
|
||||
|
||||
InputStageState::ActivationCache newActivation;
|
||||
|
||||
// Assign the vertex format required
|
||||
if (_input._format) {
|
||||
for (auto& it : _input._format->getAttributes()) {
|
||||
const Stream::Attribute& attrib = (it).second;
|
||||
bool hasColorAttribute{ false };
|
||||
|
||||
GLuint slot = attrib._slot;
|
||||
GLuint count = attrib._element.getLocationScalarCount();
|
||||
uint8_t locationCount = attrib._element.getLocationCount();
|
||||
GLenum type = _elementTypeToGL41Type[attrib._element.getType()];
|
||||
GLuint offset = attrib._offset;;
|
||||
GLboolean isNormalized = attrib._element.isNormalized();
|
||||
_input._attribBindingBuffers.reset();
|
||||
|
||||
GLenum perLocationSize = attrib._element.getLocationSize();
|
||||
const Stream::Format::AttributeMap& attributes = _input._format->getAttributes();
|
||||
auto& inputChannels = _input._format->getChannels();
|
||||
for (auto& channelIt : inputChannels) {
|
||||
auto bufferChannelNum = (channelIt).first;
|
||||
const Stream::Format::ChannelMap::value_type::second_type& channel = (channelIt).second;
|
||||
_input._attribBindingBuffers.set(bufferChannelNum);
|
||||
|
||||
for (size_t locNum = 0; locNum < locationCount; ++locNum) {
|
||||
newActivation.set(slot + locNum);
|
||||
glVertexAttribFormat(slot + locNum, count, type, isNormalized, offset + locNum * perLocationSize);
|
||||
glVertexAttribBinding(slot + locNum, attrib._channel);
|
||||
GLuint frequency = 0;
|
||||
for (unsigned int i = 0; i < channel._slots.size(); i++) {
|
||||
const Stream::Attribute& attrib = attributes.at(channel._slots[i]);
|
||||
|
||||
GLuint slot = attrib._slot;
|
||||
GLuint count = attrib._element.getLocationScalarCount();
|
||||
uint8_t locationCount = attrib._element.getLocationCount();
|
||||
GLenum type = gl::ELEMENT_TYPE_TO_GL[attrib._element.getType()];
|
||||
|
||||
GLuint offset = (GLuint)attrib._offset;;
|
||||
GLboolean isNormalized = attrib._element.isNormalized();
|
||||
|
||||
GLenum perLocationSize = attrib._element.getLocationSize();
|
||||
|
||||
hasColorAttribute = hasColorAttribute || (slot == Stream::COLOR);
|
||||
|
||||
for (GLuint locNum = 0; locNum < locationCount; ++locNum) {
|
||||
GLuint attriNum = (GLuint)(slot + locNum);
|
||||
newActivation.set(attriNum);
|
||||
if (!_input._attributeActivation[attriNum]) {
|
||||
_input._attributeActivation.set(attriNum);
|
||||
glEnableVertexAttribArray(attriNum);
|
||||
}
|
||||
if (attrib._element.isInteger()) {
|
||||
glVertexAttribIFormat(attriNum, count, type, offset + locNum * perLocationSize);
|
||||
} else {
|
||||
glVertexAttribFormat(attriNum, count, type, isNormalized, offset + locNum * perLocationSize);
|
||||
}
|
||||
glVertexAttribBinding(attriNum, attrib._channel);
|
||||
}
|
||||
|
||||
if (i == 0) {
|
||||
frequency = attrib._frequency;
|
||||
} else {
|
||||
assert(frequency == attrib._frequency);
|
||||
}
|
||||
|
||||
|
||||
(void)CHECK_GL_ERROR();
|
||||
}
|
||||
glVertexBindingDivisor(attrib._channel, attrib._frequency);
|
||||
#ifdef GPU_STEREO_DRAWCALL_INSTANCED
|
||||
glVertexBindingDivisor(bufferChannelNum, frequency * (isStereo() ? 2 : 1));
|
||||
#else
|
||||
glVertexBindingDivisor(bufferChannelNum, frequency);
|
||||
#endif
|
||||
}
|
||||
(void)CHECK_GL_ERROR();
|
||||
|
||||
if (_input._hadColorAttribute && !hasColorAttribute) {
|
||||
// The previous input stage had a color attribute but this one doesn't so reset
|
||||
// color to pure white.
|
||||
const auto white = glm::vec4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
glVertexAttrib4fv(Stream::COLOR, &white.r);
|
||||
_input._colorAttribute = white;
|
||||
}
|
||||
_input._hadColorAttribute = hasColorAttribute;
|
||||
}
|
||||
|
||||
// Manage Activation what was and what is expected now
|
||||
for (size_t i = 0; i < newActivation.size(); i++) {
|
||||
// This should only disable VertexAttribs since the one needed by the vertex format (if it exists) have been enabled above
|
||||
for (GLuint i = 0; i < (GLuint)newActivation.size(); i++) {
|
||||
bool newState = newActivation[i];
|
||||
if (newState != _input._attributeActivation[i]) {
|
||||
if (newState) {
|
||||
|
@ -219,120 +249,18 @@ void GLBackend::updateInput() {
|
|||
}
|
||||
|
||||
if (_input._invalidBuffers.any()) {
|
||||
int numBuffers = _input._buffers.size();
|
||||
auto buffer = _input._buffers.data();
|
||||
auto vbo = _input._bufferVBOs.data();
|
||||
auto offset = _input._bufferOffsets.data();
|
||||
auto stride = _input._bufferStrides.data();
|
||||
|
||||
for (int bufferNum = 0; bufferNum < numBuffers; bufferNum++) {
|
||||
if (_input._invalidBuffers.test(bufferNum)) {
|
||||
glBindVertexBuffer(bufferNum, (*vbo), (*offset), (*stride));
|
||||
for (GLuint buffer = 0; buffer < _input._buffers.size(); buffer++, vbo++, offset++, stride++) {
|
||||
if (_input._invalidBuffers.test(buffer)) {
|
||||
glBindVertexBuffer(buffer, (*vbo), (*offset), (GLsizei)(*stride));
|
||||
}
|
||||
buffer++;
|
||||
vbo++;
|
||||
offset++;
|
||||
stride++;
|
||||
}
|
||||
|
||||
_input._invalidBuffers.reset();
|
||||
(void)CHECK_GL_ERROR();
|
||||
}
|
||||
#else
|
||||
if (_input._invalidFormat || _input._invalidBuffers.any()) {
|
||||
|
||||
if (_input._invalidFormat) {
|
||||
InputStageState::ActivationCache newActivation;
|
||||
|
||||
_stats._ISNumFormatChanges++;
|
||||
|
||||
// Check expected activation
|
||||
if (_input._format) {
|
||||
for (auto& it : _input._format->getAttributes()) {
|
||||
const Stream::Attribute& attrib = (it).second;
|
||||
uint8_t locationCount = attrib._element.getLocationCount();
|
||||
for (int i = 0; i < locationCount; ++i) {
|
||||
newActivation.set(attrib._slot + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Manage Activation what was and what is expected now
|
||||
for (unsigned int i = 0; i < newActivation.size(); i++) {
|
||||
bool newState = newActivation[i];
|
||||
if (newState != _input._attributeActivation[i]) {
|
||||
|
||||
if (newState) {
|
||||
glEnableVertexAttribArray(i);
|
||||
} else {
|
||||
glDisableVertexAttribArray(i);
|
||||
}
|
||||
(void)CHECK_GL_ERROR();
|
||||
|
||||
_input._attributeActivation.flip(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// now we need to bind the buffers and assign the attrib pointers
|
||||
if (_input._format) {
|
||||
const Buffers& buffers = _input._buffers;
|
||||
const Offsets& offsets = _input._bufferOffsets;
|
||||
const Offsets& strides = _input._bufferStrides;
|
||||
|
||||
const Stream::Format::AttributeMap& attributes = _input._format->getAttributes();
|
||||
auto& inputChannels = _input._format->getChannels();
|
||||
_stats._ISNumInputBufferChanges++;
|
||||
|
||||
GLuint boundVBO = 0;
|
||||
for (auto& channelIt : inputChannels) {
|
||||
const Stream::Format::ChannelMap::value_type::second_type& channel = (channelIt).second;
|
||||
if ((channelIt).first < buffers.size()) {
|
||||
int bufferNum = (channelIt).first;
|
||||
|
||||
if (_input._invalidBuffers.test(bufferNum) || _input._invalidFormat) {
|
||||
// GLuint vbo = gpu::GL41Backend::getBufferID((*buffers[bufferNum]));
|
||||
GLuint vbo = _input._bufferVBOs[bufferNum];
|
||||
if (boundVBO != vbo) {
|
||||
//qDebug() << "GLBackend::updateInput glBindBuffer(GL_ARRAY_BUFFER, " << vbo <<")";
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
||||
(void)CHECK_GL_ERROR();
|
||||
boundVBO = vbo;
|
||||
}
|
||||
_input._invalidBuffers[bufferNum] = false;
|
||||
|
||||
for (unsigned int i = 0; i < channel._slots.size(); i++) {
|
||||
const Stream::Attribute& attrib = attributes.at(channel._slots[i]);
|
||||
GLuint slot = attrib._slot;
|
||||
GLuint count = attrib._element.getLocationScalarCount();
|
||||
uint8_t locationCount = attrib._element.getLocationCount();
|
||||
GLenum type = gl::ELEMENT_TYPE_TO_GL[attrib._element.getType()];
|
||||
// GLenum perLocationStride = strides[bufferNum];
|
||||
GLenum perLocationStride = attrib._element.getLocationSize();
|
||||
GLuint stride = (GLuint)strides[bufferNum];
|
||||
GLuint pointer = (GLuint)(attrib._offset + offsets[bufferNum]);
|
||||
GLboolean isNormalized = attrib._element.isNormalized();
|
||||
|
||||
for (size_t locNum = 0; locNum < locationCount; ++locNum) {
|
||||
glVertexAttribPointer(slot + (GLuint)locNum, count, type, isNormalized, stride,
|
||||
reinterpret_cast<GLvoid*>(pointer + perLocationStride * (GLuint)locNum));
|
||||
#ifdef GPU_STEREO_DRAWCALL_INSTANCED
|
||||
glVertexAttribDivisor(slot + (GLuint)locNum, attrib._frequency * (isStereo() ? 2 : 1));
|
||||
#else
|
||||
glVertexAttribDivisor(slot + (GLuint)locNum, attrib._frequency);
|
||||
#endif
|
||||
}
|
||||
|
||||
// TODO: Support properly the IAttrib version
|
||||
|
||||
(void)CHECK_GL_ERROR();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// everything format related should be in sync now
|
||||
_input._invalidFormat = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -48,8 +48,8 @@ void GLBackend::do_setFramebuffer(const Batch& batch, size_t paramOffset) {
|
|||
}
|
||||
|
||||
void GLBackend::do_clearFramebuffer(const Batch& batch, size_t paramOffset) {
|
||||
if (_stereo._enable && !_pipeline._stateCache.scissorEnable) {
|
||||
//qWarning("Clear without scissor in stereo mode");
|
||||
if (_stereo.isStereo() && !_pipeline._stateCache.scissorEnable) {
|
||||
qWarning("Clear without scissor in stereo mode");
|
||||
}
|
||||
|
||||
uint32 masks = batch._params[paramOffset + 7]._uint;
|
||||
|
@ -63,17 +63,21 @@ void GLBackend::do_clearFramebuffer(const Batch& batch, size_t paramOffset) {
|
|||
int useScissor = batch._params[paramOffset + 0]._int;
|
||||
|
||||
GLuint glmask = 0;
|
||||
bool restoreStencilMask = false;
|
||||
uint8_t cacheStencilMask = 0xFF;
|
||||
if (masks & Framebuffer::BUFFER_STENCIL) {
|
||||
glClearStencil(stencil);
|
||||
glmask |= GL_STENCIL_BUFFER_BIT;
|
||||
// TODO: we will probably need to also check the write mask of stencil like we do
|
||||
// for depth buffer, but as would say a famous Fez owner "We'll cross that bridge when we come to it"
|
||||
cacheStencilMask = _pipeline._stateCache.stencilActivation.getWriteMaskFront();
|
||||
if (cacheStencilMask != 0xFF) {
|
||||
restoreStencilMask = true;
|
||||
glStencilMask(0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
bool restoreDepthMask = false;
|
||||
if (masks & Framebuffer::BUFFER_DEPTH) {
|
||||
glClearDepthf(depth);
|
||||
|
||||
glmask |= GL_DEPTH_BUFFER_BIT;
|
||||
|
||||
bool cacheDepthMask = _pipeline._stateCache.depthTest.getWriteMask();
|
||||
|
@ -122,6 +126,11 @@ void GLBackend::do_clearFramebuffer(const Batch& batch, size_t paramOffset) {
|
|||
glDisable(GL_SCISSOR_TEST);
|
||||
}
|
||||
|
||||
// Restore Stencil write mask
|
||||
if (restoreStencilMask) {
|
||||
glStencilMask(cacheStencilMask);
|
||||
}
|
||||
|
||||
// Restore write mask meaning turn back off
|
||||
if (restoreDepthMask) {
|
||||
glDepthMask(GL_FALSE);
|
||||
|
@ -142,22 +151,19 @@ void GLBackend::downloadFramebuffer(const FramebufferPointer& srcFramebuffer, co
|
|||
auto readFBO = getFramebufferID(srcFramebuffer);
|
||||
if (srcFramebuffer && readFBO) {
|
||||
if ((srcFramebuffer->getWidth() < (region.x + region.z)) || (srcFramebuffer->getHeight() < (region.y + region.w))) {
|
||||
qCDebug(gpugllogging) << "GLBackend::downloadFramebuffer : srcFramebuffer is too small to provide the region queried";
|
||||
qCWarning(gpugllogging) << "GLBackend::downloadFramebuffer : srcFramebuffer is too small to provide the region queried";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ((destImage.width() < region.z) || (destImage.height() < region.w)) {
|
||||
qCDebug(gpugllogging) << "GLBackend::downloadFramebuffer : destImage is too small to receive the region of the framebuffer";
|
||||
qCWarning(gpugllogging) << "GLBackend::downloadFramebuffer : destImage is too small to receive the region of the framebuffer";
|
||||
return;
|
||||
}
|
||||
|
||||
GLenum format = GL_RGBA;
|
||||
//GLenum format = GL_BGRA;
|
||||
qDebug() << "TODO: GLBackendOutput.cpp:do_clearFramebuffer GL_BGRA";
|
||||
|
||||
if (destImage.format() != QImage::Format_ARGB32) {
|
||||
qCDebug(gpugllogging) << "GLBackend::downloadFramebuffer : destImage format must be FORMAT_ARGB32 to receive the region of the framebuffer";
|
||||
qCWarning(gpugllogging) << "GLBackend::downloadFramebuffer : destImage format must be FORMAT_ARGB32 to receive the region of the framebuffer";
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ void GLBackend::do_setPipeline(const Batch& batch, size_t paramOffset) {
|
|||
|
||||
// null pipeline == reset
|
||||
if (!pipeline) {
|
||||
qDebug() << " null pipeline";
|
||||
_pipeline._pipeline.reset();
|
||||
|
||||
_pipeline._program = 0;
|
||||
|
@ -78,7 +77,12 @@ void GLBackend::do_setPipeline(const Batch& batch, size_t paramOffset) {
|
|||
if (_pipeline._invalidProgram) {
|
||||
glUseProgram(_pipeline._program);
|
||||
if (_pipeline._cameraCorrectionLocation != -1) {
|
||||
auto cameraCorrectionBuffer = syncGPUObject(*_pipeline._cameraCorrectionBuffer._buffer);
|
||||
gl::GLBuffer* cameraCorrectionBuffer = nullptr;
|
||||
if (_transform._viewCorrectionEnabled) {
|
||||
cameraCorrectionBuffer = syncGPUObject(*_pipeline._cameraCorrectionBuffer._buffer);
|
||||
} else {
|
||||
cameraCorrectionBuffer = syncGPUObject(*_pipeline._cameraCorrectionBufferIdentity._buffer);
|
||||
}
|
||||
glBindBufferRange(GL_UNIFORM_BUFFER, _pipeline._cameraCorrectionLocation, cameraCorrectionBuffer->_id, 0, sizeof(CameraCorrection));
|
||||
}
|
||||
(void) CHECK_GL_ERROR();
|
||||
|
@ -150,6 +154,10 @@ void GLBackend::resetUniformStage() {
|
|||
|
||||
void GLBackend::do_setUniformBuffer(const Batch& batch, size_t paramOffset) {
|
||||
GLuint slot = batch._params[paramOffset + 3]._uint;
|
||||
if (slot >(GLuint)MAX_NUM_UNIFORM_BUFFERS) {
|
||||
qCDebug(gpugllogging) << "GLBackend::do_setUniformBuffer: Trying to set a uniform Buffer at slot #" << slot << " which doesn't exist. MaxNumUniformBuffers = " << getMaxNumUniformBuffers();
|
||||
return;
|
||||
}
|
||||
BufferPointer uniformBuffer = batch._buffers.get(batch._params[paramOffset + 2]._uint);
|
||||
GLintptr rangeStart = batch._params[paramOffset + 1]._uint;
|
||||
GLsizeiptr rangeSize = batch._params[paramOffset + 0]._uint;
|
||||
|
@ -192,6 +200,9 @@ void GLBackend::releaseResourceTexture(uint32_t slot) {
|
|||
}
|
||||
|
||||
void GLBackend::resetResourceStage() {
|
||||
for (uint32_t i = 0; i < _resource._buffers.size(); i++) {
|
||||
releaseResourceBuffer(i);
|
||||
}
|
||||
for (uint32_t i = 0; i < _resource._textures.size(); i++) {
|
||||
releaseResourceTexture(i);
|
||||
}
|
||||
|
@ -230,7 +241,7 @@ void GLBackend::do_setResourceBuffer(const Batch& batch, size_t paramOffset) {
|
|||
void GLBackend::do_setResourceTexture(const Batch& batch, size_t paramOffset) {
|
||||
GLuint slot = batch._params[paramOffset + 1]._uint;
|
||||
if (slot >= (GLuint) MAX_NUM_RESOURCE_TEXTURES) {
|
||||
// "GLBackend::do_setResourceTexture: Trying to set a resource Texture at slot #" + slot + " which doesn't exist. MaxNumResourceTextures = " + getMaxNumResourceTextures());
|
||||
qCDebug(gpugllogging) << "GLBackend::do_setResourceTexture: Trying to set a resource Texture at slot #" << slot << " which doesn't exist. MaxNumResourceTextures = " << getMaxNumResourceTextures();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -260,7 +271,7 @@ void GLBackend::do_setResourceTexture(const Batch& batch, size_t paramOffset) {
|
|||
|
||||
_resource._textures[slot] = resourceTexture;
|
||||
|
||||
_stats._RSAmountTextureMemoryBounded += object->size();
|
||||
_stats._RSAmountTextureMemoryBounded += (int) object->size();
|
||||
|
||||
} else {
|
||||
releaseResourceTexture(slot);
|
||||
|
|
|
@ -25,6 +25,7 @@ static bool timeElapsed = false;
|
|||
#endif
|
||||
|
||||
void GLBackend::do_beginQuery(const Batch& batch, size_t paramOffset) {
|
||||
#if !defined(USE_GLES)
|
||||
auto query = batch._queries.get(batch._params[paramOffset]._uint);
|
||||
GLQuery* glquery = syncGPUObject(*query);
|
||||
if (glquery) {
|
||||
|
@ -40,9 +41,11 @@ void GLBackend::do_beginQuery(const Batch& batch, size_t paramOffset) {
|
|||
glquery->_rangeQueryDepth = _queryStage._rangeQueryDepth;
|
||||
(void)CHECK_GL_ERROR();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void GLBackend::do_endQuery(const Batch& batch, size_t paramOffset) {
|
||||
#if !defined(USE_GLES)
|
||||
auto query = batch._queries.get(batch._params[paramOffset]._uint);
|
||||
GLQuery* glquery = syncGPUObject(*query);
|
||||
if (glquery) {
|
||||
|
@ -65,9 +68,11 @@ void GLBackend::do_endQuery(const Batch& batch, size_t paramOffset) {
|
|||
|
||||
(void)CHECK_GL_ERROR();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void GLBackend::do_getQuery(const Batch& batch, size_t paramOffset) {
|
||||
#if !defined(USE_GLES)
|
||||
auto query = batch._queries.get(batch._params[paramOffset]._uint);
|
||||
if (glGetQueryObjectui64vEXT == NULL)
|
||||
return;
|
||||
|
@ -87,6 +92,7 @@ void GLBackend::do_getQuery(const Batch& batch, size_t paramOffset) {
|
|||
}
|
||||
(void)CHECK_GL_ERROR();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void GLBackend::resetQueryStage() {
|
||||
|
|
|
@ -22,22 +22,22 @@ static const size_t NUM_SHADER_DOMAINS = 2;
|
|||
|
||||
// GL Shader type enums
|
||||
// Must match the order of type specified in gpu::Shader::Type
|
||||
static const std::array<GLenum, NUM_SHADER_DOMAINS> SHADER_DOMAINS { {
|
||||
static const std::array<GLenum, NUM_SHADER_DOMAINS> SHADER_DOMAINS{ {
|
||||
GL_VERTEX_SHADER,
|
||||
GL_FRAGMENT_SHADER,
|
||||
// GL_GEOMETRY_SHADER,
|
||||
// GL_GEOMETRY_SHADER,
|
||||
} };
|
||||
|
||||
// Domain specific defines
|
||||
// Must match the order of type specified in gpu::Shader::Type
|
||||
static const std::array<std::string, NUM_SHADER_DOMAINS> DOMAIN_DEFINES { {
|
||||
static const std::array<std::string, NUM_SHADER_DOMAINS> DOMAIN_DEFINES{ {
|
||||
"#define GPU_VERTEX_SHADER",
|
||||
"#define GPU_PIXEL_SHADER",
|
||||
// "#define GPU_GEOMETRY_SHADER",
|
||||
// "#define GPU_GEOMETRY_SHADER",
|
||||
} };
|
||||
|
||||
// Stereo specific defines
|
||||
static const std::string stereoVersion {
|
||||
static const std::string stereoVersion{
|
||||
#ifdef GPU_STEREO_DRAWCALL_INSTANCED
|
||||
"#define GPU_TRANSFORM_IS_STEREO\n#define GPU_TRANSFORM_STEREO_CAMERA\n#define GPU_TRANSFORM_STEREO_CAMERA_INSTANCED\n#define GPU_TRANSFORM_STEREO_SPLIT_SCREEN"
|
||||
#endif
|
||||
|
@ -101,7 +101,7 @@ GLShader* GLBackend::compileBackendProgram(const Shader& program) {
|
|||
auto& programObject = programObjects[version];
|
||||
|
||||
// Let's go through every shaders and make sure they are ready to go
|
||||
std::vector< GLuint > shaderGLObjects;
|
||||
std::vector<GLuint> shaderGLObjects;
|
||||
for (auto subShader : program.getShaders()) {
|
||||
auto object = GLShader::sync((*this), *subShader);
|
||||
if (object) {
|
||||
|
@ -133,147 +133,178 @@ GLShader* GLBackend::compileBackendProgram(const Shader& program) {
|
|||
|
||||
GLBackend::ElementResource GLBackend::getFormatFromGLUniform(GLenum gltype) {
|
||||
switch (gltype) {
|
||||
case GL_FLOAT: return ElementResource(Element(SCALAR, gpu::FLOAT, UNIFORM), Resource::BUFFER);
|
||||
case GL_FLOAT_VEC2: return ElementResource(Element(VEC2, gpu::FLOAT, UNIFORM), Resource::BUFFER);
|
||||
case GL_FLOAT_VEC3: return ElementResource(Element(VEC3, gpu::FLOAT, UNIFORM), Resource::BUFFER);
|
||||
case GL_FLOAT_VEC4: return ElementResource(Element(VEC4, gpu::FLOAT, UNIFORM), Resource::BUFFER);
|
||||
/*
|
||||
case GL_DOUBLE: return ElementResource(Element(SCALAR, gpu::FLOAT, UNIFORM), Resource::BUFFER);
|
||||
case GL_DOUBLE_VEC2: return ElementResource(Element(VEC2, gpu::FLOAT, UNIFORM), Resource::BUFFER);
|
||||
case GL_DOUBLE_VEC3: return ElementResource(Element(VEC3, gpu::FLOAT, UNIFORM), Resource::BUFFER);
|
||||
case GL_DOUBLE_VEC4: return ElementResource(Element(VEC4, gpu::FLOAT, UNIFORM), Resource::BUFFER);
|
||||
*/
|
||||
case GL_INT: return ElementResource(Element(SCALAR, gpu::INT32, UNIFORM), Resource::BUFFER);
|
||||
case GL_INT_VEC2: return ElementResource(Element(VEC2, gpu::INT32, UNIFORM), Resource::BUFFER);
|
||||
case GL_INT_VEC3: return ElementResource(Element(VEC3, gpu::INT32, UNIFORM), Resource::BUFFER);
|
||||
case GL_INT_VEC4: return ElementResource(Element(VEC4, gpu::INT32, UNIFORM), Resource::BUFFER);
|
||||
case GL_FLOAT:
|
||||
return ElementResource(Element(SCALAR, gpu::FLOAT, UNIFORM), Resource::BUFFER);
|
||||
case GL_FLOAT_VEC2:
|
||||
return ElementResource(Element(VEC2, gpu::FLOAT, UNIFORM), Resource::BUFFER);
|
||||
case GL_FLOAT_VEC3:
|
||||
return ElementResource(Element(VEC3, gpu::FLOAT, UNIFORM), Resource::BUFFER);
|
||||
case GL_FLOAT_VEC4:
|
||||
return ElementResource(Element(VEC4, gpu::FLOAT, UNIFORM), Resource::BUFFER);
|
||||
|
||||
case GL_UNSIGNED_INT: return ElementResource(Element(SCALAR, gpu::UINT32, UNIFORM), Resource::BUFFER);
|
||||
#if defined(Q_OS_WIN)
|
||||
case GL_UNSIGNED_INT_VEC2: return ElementResource(Element(VEC2, gpu::UINT32, UNIFORM), Resource::BUFFER);
|
||||
case GL_UNSIGNED_INT_VEC3: return ElementResource(Element(VEC3, gpu::UINT32, UNIFORM), Resource::BUFFER);
|
||||
case GL_UNSIGNED_INT_VEC4: return ElementResource(Element(VEC4, gpu::UINT32, UNIFORM), Resource::BUFFER);
|
||||
#endif
|
||||
case GL_INT:
|
||||
return ElementResource(Element(SCALAR, gpu::INT32, UNIFORM), Resource::BUFFER);
|
||||
case GL_INT_VEC2:
|
||||
return ElementResource(Element(VEC2, gpu::INT32, UNIFORM), Resource::BUFFER);
|
||||
case GL_INT_VEC3:
|
||||
return ElementResource(Element(VEC3, gpu::INT32, UNIFORM), Resource::BUFFER);
|
||||
case GL_INT_VEC4:
|
||||
return ElementResource(Element(VEC4, gpu::INT32, UNIFORM), Resource::BUFFER);
|
||||
|
||||
case GL_BOOL: return ElementResource(Element(SCALAR, gpu::BOOL, UNIFORM), Resource::BUFFER);
|
||||
case GL_BOOL_VEC2: return ElementResource(Element(VEC2, gpu::BOOL, UNIFORM), Resource::BUFFER);
|
||||
case GL_BOOL_VEC3: return ElementResource(Element(VEC3, gpu::BOOL, UNIFORM), Resource::BUFFER);
|
||||
case GL_BOOL_VEC4: return ElementResource(Element(VEC4, gpu::BOOL, UNIFORM), Resource::BUFFER);
|
||||
case GL_UNSIGNED_INT:
|
||||
return ElementResource(Element(SCALAR, gpu::UINT32, UNIFORM), Resource::BUFFER);
|
||||
case GL_UNSIGNED_INT_VEC2:
|
||||
return ElementResource(Element(VEC2, gpu::UINT32, UNIFORM), Resource::BUFFER);
|
||||
case GL_UNSIGNED_INT_VEC3:
|
||||
return ElementResource(Element(VEC3, gpu::UINT32, UNIFORM), Resource::BUFFER);
|
||||
case GL_UNSIGNED_INT_VEC4:
|
||||
return ElementResource(Element(VEC4, gpu::UINT32, UNIFORM), Resource::BUFFER);
|
||||
|
||||
case GL_BOOL:
|
||||
return ElementResource(Element(SCALAR, gpu::BOOL, UNIFORM), Resource::BUFFER);
|
||||
case GL_BOOL_VEC2:
|
||||
return ElementResource(Element(VEC2, gpu::BOOL, UNIFORM), Resource::BUFFER);
|
||||
case GL_BOOL_VEC3:
|
||||
return ElementResource(Element(VEC3, gpu::BOOL, UNIFORM), Resource::BUFFER);
|
||||
case GL_BOOL_VEC4:
|
||||
return ElementResource(Element(VEC4, gpu::BOOL, UNIFORM), Resource::BUFFER);
|
||||
|
||||
case GL_FLOAT_MAT2: return ElementResource(Element(gpu::MAT2, gpu::FLOAT, UNIFORM), Resource::BUFFER);
|
||||
case GL_FLOAT_MAT3: return ElementResource(Element(MAT3, gpu::FLOAT, UNIFORM), Resource::BUFFER);
|
||||
case GL_FLOAT_MAT4: return ElementResource(Element(MAT4, gpu::FLOAT, UNIFORM), Resource::BUFFER);
|
||||
case GL_FLOAT_MAT2:
|
||||
return ElementResource(Element(gpu::MAT2, gpu::FLOAT, UNIFORM), Resource::BUFFER);
|
||||
case GL_FLOAT_MAT3:
|
||||
return ElementResource(Element(MAT3, gpu::FLOAT, UNIFORM), Resource::BUFFER);
|
||||
case GL_FLOAT_MAT4:
|
||||
return ElementResource(Element(MAT4, gpu::FLOAT, UNIFORM), Resource::BUFFER);
|
||||
|
||||
/* {GL_FLOAT_MAT2x3 mat2x3},
|
||||
{GL_FLOAT_MAT2x4 mat2x4},
|
||||
{GL_FLOAT_MAT3x2 mat3x2},
|
||||
{GL_FLOAT_MAT3x4 mat3x4},
|
||||
{GL_FLOAT_MAT4x2 mat4x2},
|
||||
{GL_FLOAT_MAT4x3 mat4x3},
|
||||
{GL_DOUBLE_MAT2 dmat2},
|
||||
{GL_DOUBLE_MAT3 dmat3},
|
||||
{GL_DOUBLE_MAT4 dmat4},
|
||||
{GL_DOUBLE_MAT2x3 dmat2x3},
|
||||
{GL_DOUBLE_MAT2x4 dmat2x4},
|
||||
{GL_DOUBLE_MAT3x2 dmat3x2},
|
||||
{GL_DOUBLE_MAT3x4 dmat3x4},
|
||||
{GL_DOUBLE_MAT4x2 dmat4x2},
|
||||
{GL_DOUBLE_MAT4x3 dmat4x3},
|
||||
*/
|
||||
//{GL_FLOAT_MAT2x3 mat2x3},
|
||||
//{GL_FLOAT_MAT2x4 mat2x4},
|
||||
//{GL_FLOAT_MAT3x2 mat3x2},
|
||||
//{GL_FLOAT_MAT3x4 mat3x4},
|
||||
//{GL_FLOAT_MAT4x2 mat4x2},
|
||||
//{GL_FLOAT_MAT4x3 mat4x3},
|
||||
//{GL_DOUBLE_MAT2 dmat2},
|
||||
//{GL_DOUBLE_MAT3 dmat3},
|
||||
//{GL_DOUBLE_MAT4 dmat4},
|
||||
//{GL_DOUBLE_MAT2x3 dmat2x3},
|
||||
//{GL_DOUBLE_MAT2x4 dmat2x4},
|
||||
//{GL_DOUBLE_MAT3x2 dmat3x2},
|
||||
//{GL_DOUBLE_MAT3x4 dmat3x4},
|
||||
//{GL_DOUBLE_MAT4x2 dmat4x2},
|
||||
//{GL_DOUBLE_MAT4x3 dmat4x3},
|
||||
|
||||
//case GL_SAMPLER_1D: return ElementResource(Element(SCALAR, gpu::FLOAT, SAMPLER), Resource::TEXTURE_1D);
|
||||
case GL_SAMPLER_2D: return ElementResource(Element(SCALAR, gpu::FLOAT, SAMPLER), Resource::TEXTURE_2D);
|
||||
case GL_SAMPLER_2D:
|
||||
return ElementResource(Element(SCALAR, gpu::FLOAT, SAMPLER), Resource::TEXTURE_2D);
|
||||
|
||||
case GL_SAMPLER_3D: return ElementResource(Element(SCALAR, gpu::FLOAT, SAMPLER), Resource::TEXTURE_3D);
|
||||
case GL_SAMPLER_CUBE: return ElementResource(Element(SCALAR, gpu::FLOAT, SAMPLER), Resource::TEXTURE_CUBE);
|
||||
case GL_SAMPLER_3D:
|
||||
return ElementResource(Element(SCALAR, gpu::FLOAT, SAMPLER), Resource::TEXTURE_3D);
|
||||
case GL_SAMPLER_CUBE:
|
||||
return ElementResource(Element(SCALAR, gpu::FLOAT, SAMPLER), Resource::TEXTURE_CUBE);
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
case GL_SAMPLER_2D_MULTISAMPLE: return ElementResource(Element(SCALAR, gpu::FLOAT, SAMPLER_MULTISAMPLE), Resource::TEXTURE_2D);
|
||||
case GL_SAMPLER_1D_ARRAY: return ElementResource(Element(SCALAR, gpu::FLOAT, SAMPLER), Resource::TEXTURE_1D_ARRAY);
|
||||
case GL_SAMPLER_2D_ARRAY: return ElementResource(Element(SCALAR, gpu::FLOAT, SAMPLER), Resource::TEXTURE_2D_ARRAY);
|
||||
case GL_SAMPLER_2D_MULTISAMPLE_ARRAY: return ElementResource(Element(SCALAR, gpu::FLOAT, SAMPLER_MULTISAMPLE), Resource::TEXTURE_2D_ARRAY);
|
||||
#endif
|
||||
case GL_SAMPLER_2D_MULTISAMPLE:
|
||||
return ElementResource(Element(SCALAR, gpu::FLOAT, SAMPLER_MULTISAMPLE), Resource::TEXTURE_2D);
|
||||
case GL_SAMPLER_2D_ARRAY:
|
||||
return ElementResource(Element(SCALAR, gpu::FLOAT, SAMPLER), Resource::TEXTURE_2D_ARRAY);
|
||||
case GL_SAMPLER_2D_MULTISAMPLE_ARRAY:
|
||||
return ElementResource(Element(SCALAR, gpu::FLOAT, SAMPLER_MULTISAMPLE), Resource::TEXTURE_2D_ARRAY);
|
||||
|
||||
case GL_SAMPLER_2D_SHADOW: return ElementResource(Element(SCALAR, gpu::FLOAT, SAMPLER_SHADOW), Resource::TEXTURE_2D);
|
||||
#if defined(Q_OS_WIN)
|
||||
case GL_SAMPLER_CUBE_SHADOW: return ElementResource(Element(SCALAR, gpu::FLOAT, SAMPLER_SHADOW), Resource::TEXTURE_CUBE);
|
||||
case GL_SAMPLER_2D_SHADOW:
|
||||
return ElementResource(Element(SCALAR, gpu::FLOAT, SAMPLER_SHADOW), Resource::TEXTURE_2D);
|
||||
case GL_SAMPLER_CUBE_SHADOW:
|
||||
return ElementResource(Element(SCALAR, gpu::FLOAT, SAMPLER_SHADOW), Resource::TEXTURE_CUBE);
|
||||
|
||||
case GL_SAMPLER_2D_ARRAY_SHADOW: return ElementResource(Element(SCALAR, gpu::FLOAT, SAMPLER_SHADOW), Resource::TEXTURE_2D_ARRAY);
|
||||
#endif
|
||||
case GL_SAMPLER_2D_ARRAY_SHADOW:
|
||||
return ElementResource(Element(SCALAR, gpu::FLOAT, SAMPLER_SHADOW), Resource::TEXTURE_2D_ARRAY);
|
||||
|
||||
// {GL_SAMPLER_1D_SHADOW sampler1DShadow},
|
||||
// {GL_SAMPLER_1D_ARRAY_SHADOW sampler1DArrayShadow},
|
||||
// {GL_SAMPLER_1D_SHADOW sampler1DShadow},
|
||||
// {GL_SAMPLER_1D_ARRAY_SHADOW sampler1DArrayShadow},
|
||||
|
||||
case GL_SAMPLER_BUFFER: return ElementResource(Element(SCALAR, gpu::FLOAT, RESOURCE_BUFFER), Resource::BUFFER);
|
||||
case GL_SAMPLER_BUFFER:
|
||||
return ElementResource(Element(SCALAR, gpu::FLOAT, RESOURCE_BUFFER), Resource::BUFFER);
|
||||
|
||||
// {GL_SAMPLER_2D_RECT sampler2DRect},
|
||||
// {GL_SAMPLER_2D_RECT_SHADOW sampler2DRectShadow},
|
||||
// {GL_SAMPLER_2D_RECT sampler2DRect},
|
||||
// {GL_SAMPLER_2D_RECT_SHADOW sampler2DRectShadow},
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
case GL_INT_SAMPLER_2D:
|
||||
return ElementResource(Element(SCALAR, gpu::INT32, SAMPLER), Resource::TEXTURE_2D);
|
||||
case GL_INT_SAMPLER_2D_MULTISAMPLE:
|
||||
return ElementResource(Element(SCALAR, gpu::INT32, SAMPLER_MULTISAMPLE), Resource::TEXTURE_2D);
|
||||
case GL_INT_SAMPLER_3D:
|
||||
return ElementResource(Element(SCALAR, gpu::INT32, SAMPLER), Resource::TEXTURE_3D);
|
||||
case GL_INT_SAMPLER_CUBE:
|
||||
return ElementResource(Element(SCALAR, gpu::INT32, SAMPLER), Resource::TEXTURE_CUBE);
|
||||
|
||||
case GL_INT_SAMPLER_2D_ARRAY:
|
||||
return ElementResource(Element(SCALAR, gpu::INT32, SAMPLER), Resource::TEXTURE_2D_ARRAY);
|
||||
case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
|
||||
return ElementResource(Element(SCALAR, gpu::INT32, SAMPLER_MULTISAMPLE), Resource::TEXTURE_2D_ARRAY);
|
||||
|
||||
// {GL_INT_SAMPLER_BUFFER isamplerBuffer},
|
||||
// {GL_INT_SAMPLER_2D_RECT isampler2DRect},
|
||||
|
||||
case GL_UNSIGNED_INT_SAMPLER_2D:
|
||||
return ElementResource(Element(SCALAR, gpu::UINT32, SAMPLER), Resource::TEXTURE_2D);
|
||||
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
|
||||
return ElementResource(Element(SCALAR, gpu::UINT32, SAMPLER_MULTISAMPLE), Resource::TEXTURE_2D);
|
||||
case GL_UNSIGNED_INT_SAMPLER_3D:
|
||||
return ElementResource(Element(SCALAR, gpu::UINT32, SAMPLER), Resource::TEXTURE_3D);
|
||||
case GL_UNSIGNED_INT_SAMPLER_CUBE:
|
||||
return ElementResource(Element(SCALAR, gpu::UINT32, SAMPLER), Resource::TEXTURE_CUBE);
|
||||
|
||||
case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
|
||||
return ElementResource(Element(SCALAR, gpu::UINT32, SAMPLER), Resource::TEXTURE_2D_ARRAY);
|
||||
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
|
||||
return ElementResource(Element(SCALAR, gpu::UINT32, SAMPLER_MULTISAMPLE), Resource::TEXTURE_2D_ARRAY);
|
||||
//{GL_UNSIGNED_INT_SAMPLER_BUFFER usamplerBuffer},
|
||||
//{GL_UNSIGNED_INT_SAMPLER_2D_RECT usampler2DRect},
|
||||
|
||||
//{GL_IMAGE_1D image1D},
|
||||
//{GL_IMAGE_2D image2D},
|
||||
//{GL_IMAGE_3D image3D},
|
||||
//{GL_IMAGE_2D_RECT image2DRect},
|
||||
//{GL_IMAGE_CUBE imageCube},
|
||||
//{GL_IMAGE_BUFFER imageBuffer},
|
||||
//{GL_IMAGE_1D_ARRAY image1DArray},
|
||||
//{GL_IMAGE_2D_ARRAY image2DArray},
|
||||
//{GL_IMAGE_2D_MULTISAMPLE image2DMS},
|
||||
//{GL_IMAGE_2D_MULTISAMPLE_ARRAY image2DMSArray},
|
||||
//{GL_INT_IMAGE_1D iimage1D},
|
||||
//{GL_INT_IMAGE_2D iimage2D},
|
||||
//{GL_INT_IMAGE_3D iimage3D},
|
||||
//{GL_INT_IMAGE_2D_RECT iimage2DRect},
|
||||
//{GL_INT_IMAGE_CUBE iimageCube},
|
||||
//{GL_INT_IMAGE_BUFFER iimageBuffer},
|
||||
//{GL_INT_IMAGE_1D_ARRAY iimage1DArray},
|
||||
//{GL_INT_IMAGE_2D_ARRAY iimage2DArray},
|
||||
//{GL_INT_IMAGE_2D_MULTISAMPLE iimage2DMS},
|
||||
//{GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY iimage2DMSArray},
|
||||
//{GL_UNSIGNED_INT_IMAGE_1D uimage1D},
|
||||
//{GL_UNSIGNED_INT_IMAGE_2D uimage2D},
|
||||
//{GL_UNSIGNED_INT_IMAGE_3D uimage3D},
|
||||
//{GL_UNSIGNED_INT_IMAGE_2D_RECT uimage2DRect},
|
||||
//{GL_UNSIGNED_INT_IMAGE_CUBE uimageCube},+ [0] {_name="fInnerRadius" _location=0 _element={_semantic=15 '\xf' _dimension=0 '\0' _type=0 '\0' } } gpu::Shader::Slot
|
||||
|
||||
//{GL_UNSIGNED_INT_IMAGE_BUFFER uimageBuffer},
|
||||
//{GL_UNSIGNED_INT_IMAGE_1D_ARRAY uimage1DArray},
|
||||
//{GL_UNSIGNED_INT_IMAGE_2D_ARRAY uimage2DArray},
|
||||
//{GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE uimage2DMS},
|
||||
//{GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY uimage2DMSArray},
|
||||
//{GL_UNSIGNED_INT_ATOMIC_COUNTER atomic_uint}
|
||||
#if 0
|
||||
case GL_SAMPLER_1D: return ElementResource(Element(SCALAR, gpu::FLOAT, SAMPLER), Resource::TEXTURE_1D);
|
||||
case GL_INT_SAMPLER_1D: return ElementResource(Element(SCALAR, gpu::INT32, SAMPLER), Resource::TEXTURE_1D);
|
||||
case GL_INT_SAMPLER_2D: return ElementResource(Element(SCALAR, gpu::INT32, SAMPLER), Resource::TEXTURE_2D);
|
||||
case GL_INT_SAMPLER_2D_MULTISAMPLE: return ElementResource(Element(SCALAR, gpu::INT32, SAMPLER_MULTISAMPLE), Resource::TEXTURE_2D);
|
||||
case GL_INT_SAMPLER_3D: return ElementResource(Element(SCALAR, gpu::INT32, SAMPLER), Resource::TEXTURE_3D);
|
||||
case GL_INT_SAMPLER_CUBE: return ElementResource(Element(SCALAR, gpu::INT32, SAMPLER), Resource::TEXTURE_CUBE);
|
||||
|
||||
case GL_INT_SAMPLER_1D_ARRAY: return ElementResource(Element(SCALAR, gpu::INT32, SAMPLER), Resource::TEXTURE_1D_ARRAY);
|
||||
case GL_INT_SAMPLER_2D_ARRAY: return ElementResource(Element(SCALAR, gpu::INT32, SAMPLER), Resource::TEXTURE_2D_ARRAY);
|
||||
case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY: return ElementResource(Element(SCALAR, gpu::INT32, SAMPLER_MULTISAMPLE), Resource::TEXTURE_2D_ARRAY);
|
||||
|
||||
// {GL_INT_SAMPLER_BUFFER isamplerBuffer},
|
||||
// {GL_INT_SAMPLER_2D_RECT isampler2DRect},
|
||||
|
||||
case GL_UNSIGNED_INT_SAMPLER_1D: return ElementResource(Element(SCALAR, gpu::UINT32, SAMPLER), Resource::TEXTURE_1D);
|
||||
case GL_UNSIGNED_INT_SAMPLER_2D: return ElementResource(Element(SCALAR, gpu::UINT32, SAMPLER), Resource::TEXTURE_2D);
|
||||
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE: return ElementResource(Element(SCALAR, gpu::UINT32, SAMPLER_MULTISAMPLE), Resource::TEXTURE_2D);
|
||||
case GL_UNSIGNED_INT_SAMPLER_3D: return ElementResource(Element(SCALAR, gpu::UINT32, SAMPLER), Resource::TEXTURE_3D);
|
||||
case GL_UNSIGNED_INT_SAMPLER_CUBE: return ElementResource(Element(SCALAR, gpu::UINT32, SAMPLER), Resource::TEXTURE_CUBE);
|
||||
|
||||
case GL_UNSIGNED_INT_SAMPLER_1D_ARRAY: return ElementResource(Element(SCALAR, gpu::UINT32, SAMPLER), Resource::TEXTURE_1D_ARRAY);
|
||||
case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY: return ElementResource(Element(SCALAR, gpu::UINT32, SAMPLER), Resource::TEXTURE_2D_ARRAY);
|
||||
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY: return ElementResource(Element(SCALAR, gpu::UINT32, SAMPLER_MULTISAMPLE), Resource::TEXTURE_2D_ARRAY);
|
||||
case GL_SAMPLER_1D_ARRAY: return ElementResource(Element(SCALAR, gpu::FLOAT, SAMPLER), Resource::TEXTURE_1D_ARRAY);
|
||||
case GL_DOUBLE: return ElementResource(Element(SCALAR, gpu::FLOAT, UNIFORM), Resource::BUFFER);
|
||||
case GL_DOUBLE_VEC2: return ElementResource(Element(VEC2, gpu::FLOAT, UNIFORM), Resource::BUFFER);
|
||||
case GL_DOUBLE_VEC3: return ElementResource(Element(VEC3, gpu::FLOAT, UNIFORM), Resource::BUFFER);
|
||||
case GL_DOUBLE_VEC4: return ElementResource(Element(VEC4, gpu::FLOAT, UNIFORM), Resource::BUFFER);
|
||||
#endif
|
||||
// {GL_UNSIGNED_INT_SAMPLER_BUFFER usamplerBuffer},
|
||||
// {GL_UNSIGNED_INT_SAMPLER_2D_RECT usampler2DRect},
|
||||
/*
|
||||
{GL_IMAGE_1D image1D},
|
||||
{GL_IMAGE_2D image2D},
|
||||
{GL_IMAGE_3D image3D},
|
||||
{GL_IMAGE_2D_RECT image2DRect},
|
||||
{GL_IMAGE_CUBE imageCube},
|
||||
{GL_IMAGE_BUFFER imageBuffer},
|
||||
{GL_IMAGE_1D_ARRAY image1DArray},
|
||||
{GL_IMAGE_2D_ARRAY image2DArray},
|
||||
{GL_IMAGE_2D_MULTISAMPLE image2DMS},
|
||||
{GL_IMAGE_2D_MULTISAMPLE_ARRAY image2DMSArray},
|
||||
{GL_INT_IMAGE_1D iimage1D},
|
||||
{GL_INT_IMAGE_2D iimage2D},
|
||||
{GL_INT_IMAGE_3D iimage3D},
|
||||
{GL_INT_IMAGE_2D_RECT iimage2DRect},
|
||||
{GL_INT_IMAGE_CUBE iimageCube},
|
||||
{GL_INT_IMAGE_BUFFER iimageBuffer},
|
||||
{GL_INT_IMAGE_1D_ARRAY iimage1DArray},
|
||||
{GL_INT_IMAGE_2D_ARRAY iimage2DArray},
|
||||
{GL_INT_IMAGE_2D_MULTISAMPLE iimage2DMS},
|
||||
{GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY iimage2DMSArray},
|
||||
{GL_UNSIGNED_INT_IMAGE_1D uimage1D},
|
||||
{GL_UNSIGNED_INT_IMAGE_2D uimage2D},
|
||||
{GL_UNSIGNED_INT_IMAGE_3D uimage3D},
|
||||
{GL_UNSIGNED_INT_IMAGE_2D_RECT uimage2DRect},
|
||||
{GL_UNSIGNED_INT_IMAGE_CUBE uimageCube},+ [0] {_name="fInnerRadius" _location=0 _element={_semantic=15 '\xf' _dimension=0 '\0' _type=0 '\0' } } gpu::Shader::Slot
|
||||
|
||||
{GL_UNSIGNED_INT_IMAGE_BUFFER uimageBuffer},
|
||||
{GL_UNSIGNED_INT_IMAGE_1D_ARRAY uimage1DArray},
|
||||
{GL_UNSIGNED_INT_IMAGE_2D_ARRAY uimage2DArray},
|
||||
{GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE uimage2DMS},
|
||||
{GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY uimage2DMSArray},
|
||||
{GL_UNSIGNED_INT_ATOMIC_COUNTER atomic_uint}
|
||||
*/
|
||||
default:
|
||||
return ElementResource(Element(), Resource::BUFFER);
|
||||
default:
|
||||
return ElementResource(Element(), Resource::BUFFER);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
int GLBackend::makeUniformSlots(GLuint glprogram, const Shader::BindingSet& slotBindings,
|
||||
|
@ -324,7 +355,7 @@ int GLBackend::makeUniformSlots(GLuint glprogram, const Shader::BindingSet& slot
|
|||
binding = (*requestedBinding)._location;
|
||||
for (auto i = 0; i < size; i++) {
|
||||
// If we are working with an array of textures, reserve for each elemet
|
||||
glProgramUniform1i(glprogram, location+i, binding+i);
|
||||
glProgramUniform1i(glprogram, location + i, binding + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -456,7 +487,7 @@ int GLBackend::makeOutputSlots(GLuint glprogram, const Shader::BindingSet& slotB
|
|||
outputs.insert(Shader::Slot(name, i, element));
|
||||
}
|
||||
*/
|
||||
return 0; //inputsCount;
|
||||
return 0; //inputsCount;
|
||||
}
|
||||
|
||||
void GLBackend::makeProgramBindings(ShaderObject& shaderObject) {
|
||||
|
@ -527,4 +558,3 @@ void GLBackend::makeProgramBindings(ShaderObject& shaderObject) {
|
|||
qCWarning(gpugllogging) << "GLShader::makeBindings - failed to link after assigning slotBindings?";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#include "GLBackend.h"
|
||||
#include "GLState.h"
|
||||
|
||||
#include <gpu/GPULogging.h>
|
||||
|
||||
using namespace gpu;
|
||||
using namespace gpu::gl;
|
||||
|
||||
|
@ -96,13 +98,11 @@ void GLBackend::do_setStateFrontFaceClockwise(bool isClockwise) {
|
|||
|
||||
void GLBackend::do_setStateDepthClampEnable(bool enable) {
|
||||
if (_pipeline._stateCache.depthClampEnable != enable) {
|
||||
if (enable) {
|
||||
qDebug() << "TODO: GLBackendState.cpp:do_setStateDepthClampEnable GL_DEPTH_CLAMP";
|
||||
//glEnable(GL_DEPTH_CLAMP);
|
||||
} else {
|
||||
//glDisable(GL_DEPTH_CLAMP);
|
||||
qDebug() << "TODO: GLBackendState.cpp:do_setStateDepthClampEnable GL_DEPTH_CLAMP";
|
||||
}
|
||||
//if (enable) {
|
||||
// glEnable(GL_DEPTH_CLAMP);
|
||||
//} else {
|
||||
// glDisable(GL_DEPTH_CLAMP);
|
||||
//}
|
||||
(void)CHECK_GL_ERROR();
|
||||
|
||||
_pipeline._stateCache.depthClampEnable = enable;
|
||||
|
@ -124,13 +124,11 @@ void GLBackend::do_setStateScissorEnable(bool enable) {
|
|||
|
||||
void GLBackend::do_setStateMultisampleEnable(bool enable) {
|
||||
if (_pipeline._stateCache.multisampleEnable != enable) {
|
||||
if (enable) {
|
||||
//glEnable(GL_MULTISAMPLE);
|
||||
qDebug() << "TODO: GLBackendState.cpp:do_setStateMultisampleEnable GL_MULTISAMPLE";
|
||||
} else {
|
||||
//glDisable(GL_MULTISAMPLE);
|
||||
qDebug() << "TODO: GLBackendState.cpp:do_setStateMultisampleEnable GL_MULTISAMPLE";
|
||||
}
|
||||
//if (enable) {
|
||||
// glEnable(GL_MULTISAMPLE);
|
||||
//} else {
|
||||
// glDisable(GL_MULTISAMPLE);
|
||||
//}
|
||||
(void)CHECK_GL_ERROR();
|
||||
|
||||
_pipeline._stateCache.multisampleEnable = enable;
|
||||
|
@ -139,13 +137,11 @@ void GLBackend::do_setStateMultisampleEnable(bool enable) {
|
|||
|
||||
void GLBackend::do_setStateAntialiasedLineEnable(bool enable) {
|
||||
if (_pipeline._stateCache.antialisedLineEnable != enable) {
|
||||
if (enable) {
|
||||
//glEnable(GL_LINE_SMOOTH);
|
||||
qDebug() << "TODO: GLBackendState.cpp:do_setStateAntialiasedLineEnable GL_LINE_SMOOTH";
|
||||
} else {
|
||||
//glDisable(GL_LINE_SMOOTH);
|
||||
qDebug() << "TODO: GLBackendState.cpp:do_setStateAntialiasedLineEnable GL_LINE_SMOOTH";
|
||||
}
|
||||
//if (enable) {
|
||||
// glEnable(GL_LINE_SMOOTH);
|
||||
//} else {
|
||||
// glDisable(GL_LINE_SMOOTH);
|
||||
//}
|
||||
(void)CHECK_GL_ERROR();
|
||||
|
||||
_pipeline._stateCache.antialisedLineEnable = enable;
|
||||
|
@ -157,16 +153,12 @@ void GLBackend::do_setStateDepthBias(Vec2 bias) {
|
|||
if ((bias.x != 0.0f) || (bias.y != 0.0f)) {
|
||||
glEnable(GL_POLYGON_OFFSET_FILL);
|
||||
//glEnable(GL_POLYGON_OFFSET_LINE);
|
||||
qDebug() << "TODO: GLBackendState.cpp:do_setStateDepthBias GL_POLYGON_OFFSET_LINE";
|
||||
//glEnable(GL_POLYGON_OFFSET_POINT);
|
||||
qDebug() << "TODO: GLBackendState.cpp:do_setStateDepthBias GL_POLYGON_OFFSET_POINT";
|
||||
glPolygonOffset(bias.x, bias.y);
|
||||
} else {
|
||||
glDisable(GL_POLYGON_OFFSET_FILL);
|
||||
//glDisable(GL_POLYGON_OFFSET_LINE);
|
||||
qDebug() << "TODO: GLBackendState.cpp:do_setStateDepthBias GL_POLYGON_OFFSET_LINE";
|
||||
//glDisable(GL_POLYGON_OFFSET_POINT);
|
||||
qDebug() << "TODO: GLBackendState.cpp:do_setStateDepthBias GL_POLYGON_OFFSET_POINT";
|
||||
}
|
||||
(void)CHECK_GL_ERROR();
|
||||
|
||||
|
@ -190,7 +182,7 @@ void GLBackend::do_setStateDepthTest(State::DepthTest test) {
|
|||
glDepthFunc(COMPARISON_TO_GL[test.getFunction()]);
|
||||
}
|
||||
if (CHECK_GL_ERROR()) {
|
||||
qDebug() << "DepthTest" << (test.isEnabled() ? "Enabled" : "Disabled")
|
||||
qCDebug(gpulogging) << "DepthTest" << (test.isEnabled() ? "Enabled" : "Disabled")
|
||||
<< "Mask=" << (test.getWriteMask() ? "Write" : "no Write")
|
||||
<< "Func=" << test.getFunction()
|
||||
<< "Raw=" << test.getRaw();
|
||||
|
|
|
@ -74,7 +74,6 @@ void GLBackend::do_generateTextureMips(const Batch& batch, size_t paramOffset) {
|
|||
|
||||
// DO not transfer the texture, this call is expected for rendering texture
|
||||
GLTexture* object = syncGPUObject(resourceTexture);
|
||||
qDebug() << "GLBackendTexture do_generateTextureMips syncGPUObject";
|
||||
if (!object) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ using namespace gpu::gl;
|
|||
|
||||
// Transform Stage
|
||||
void GLBackend::do_setModelTransform(const Batch& batch, size_t paramOffset) {
|
||||
qDebug() << "do_setModelTransform";
|
||||
}
|
||||
|
||||
void GLBackend::do_setViewTransform(const Batch& batch, size_t paramOffset) {
|
||||
|
|
|
@ -22,27 +22,26 @@ GLFramebuffer::~GLFramebuffer() {
|
|||
}
|
||||
|
||||
bool GLFramebuffer::checkStatus() const {
|
||||
bool result = false;
|
||||
switch (_status) {
|
||||
case GL_FRAMEBUFFER_COMPLETE:
|
||||
// Success !
|
||||
result = true;
|
||||
break;
|
||||
return true;
|
||||
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
|
||||
qCDebug(gpugllogging) << "GLFramebuffer::syncGPUObject : Framebuffer not valid, GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT.";
|
||||
qCWarning(gpugllogging) << "GLFramebuffer::syncGPUObject : Framebuffer not valid, GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT.";
|
||||
break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
|
||||
qCDebug(gpugllogging) << "GLFramebuffer::syncGPUObject : Framebuffer not valid, GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT.";
|
||||
qCWarning(gpugllogging) << "GLFramebuffer::syncGPUObject : Framebuffer not valid, GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT.";
|
||||
break;
|
||||
/* TODO: case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER:
|
||||
qCDebug(gpugllogging) << "GLFramebuffer::syncGPUObject : Framebuffer not valid, GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER.";
|
||||
break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER:
|
||||
qCDebug(gpugllogging) << "GLFramebuffer::syncGPUObject : Framebuffer not valid, GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER.";
|
||||
break; */
|
||||
//case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER:
|
||||
// qCWarning(gpugllogging) << "GLFramebuffer::syncGPUObject : Framebuffer not valid, GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER.";
|
||||
// break;
|
||||
//case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER:
|
||||
// qCWarning(gpugllogging) << "GLFramebuffer::syncGPUObject : Framebuffer not valid, GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER.";
|
||||
// break;
|
||||
case GL_FRAMEBUFFER_UNSUPPORTED:
|
||||
qCDebug(gpugllogging) << "GLFramebuffer::syncGPUObject : Framebuffer not valid, GL_FRAMEBUFFER_UNSUPPORTED.";
|
||||
qCWarning(gpugllogging) << "GLFramebuffer::syncGPUObject : Framebuffer not valid, GL_FRAMEBUFFER_UNSUPPORTED.";
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -51,10 +51,7 @@ GLPipeline* GLPipeline::sync(GLBackend& backend, const Pipeline& pipeline) {
|
|||
// Special case for view correction matrices, any pipeline that declares the correction buffer
|
||||
// uniform will automatically have it provided without any client code necessary.
|
||||
// Required for stable lighting in the HMD.
|
||||
//CLIMAX_MERGE_START
|
||||
//getbuffers() doesnt exist anymore.. use get uniformbuffers()?
|
||||
object->_cameraCorrection = shader->getUniformBuffers().findLocation("cameraCorrectionBuffer");
|
||||
//CLIMAX_MERGE_END
|
||||
object->_program = programObject;
|
||||
object->_state = stateObject;
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
Q_LOGGING_CATEGORY(gpugllogging, "hifi.gpu.gl")
|
||||
Q_LOGGING_CATEGORY(trace_render_gpu_gl, "trace.render.gpu.gl")
|
||||
Q_LOGGING_CATEGORY(trace_render_gpu_gl_detail, "trace.render.gpu.gl.detail")
|
||||
|
||||
namespace gpu { namespace gl {
|
||||
|
||||
|
@ -41,8 +42,11 @@ bool checkGLError(const char* name) {
|
|||
case GL_OUT_OF_MEMORY:
|
||||
qCWarning(gpugllogging) << "GLBackend" << name << ": There is not enough memory left to execute the command.The state of the GL is undefined, except for the state of the error flags, after this error is recorded.";
|
||||
break;
|
||||
default:
|
||||
qCWarning(gpugllogging) << "GLBackend" << name << ": Unknown error: " << error;
|
||||
case GL_STACK_UNDERFLOW:
|
||||
qCWarning(gpugllogging) << "GLBackend" << name << ": An attempt has been made to perform an operation that would cause an internal stack to underflow.";
|
||||
break;
|
||||
case GL_STACK_OVERFLOW:
|
||||
qCWarning(gpugllogging) << "GLBackend" << name << ": An attempt has been made to perform an operation that would cause an internal stack to overflow.";
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
|
@ -50,12 +54,8 @@ bool checkGLError(const char* name) {
|
|||
}
|
||||
|
||||
bool checkGLErrorDebug(const char* name) {
|
||||
#ifdef DEBUG
|
||||
// FIXME, disable in debug mode when near release
|
||||
return checkGLError(name);
|
||||
#else
|
||||
Q_UNUSED(name);
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
gpu::Size getFreeDedicatedMemory() {
|
||||
|
@ -182,21 +182,17 @@ State::BlendArg blendArgFromGL(GLenum blendArg) {
|
|||
|
||||
void getCurrentGLState(State::Data& state) {
|
||||
{
|
||||
GLint modes[2];
|
||||
//GLint modes[2];
|
||||
//glGetIntegerv(GL_POLYGON_MODE, modes);
|
||||
qDebug() << "TODO: GLShared.cpp:getCurrentGLState GL_POLYGON_MODE";
|
||||
qDebug() << "TODO: GLShared.cpp:getCurrentGLState GL_FILL";
|
||||
qDebug() << "TODO: GLShared.cpp:getCurrentGLState GL_LINE";
|
||||
|
||||
if (modes[0] == 0 /*GL_FILL*/) {
|
||||
state.fillMode = State::FILL_FACE;
|
||||
} else {
|
||||
if (modes[0] == 0 /*GL_LINE*/) {
|
||||
state.fillMode = State::FILL_LINE;
|
||||
} else {
|
||||
state.fillMode = State::FILL_POINT;
|
||||
}
|
||||
}
|
||||
//if (modes[0] == GL_FILL) {
|
||||
// state.fillMode = State::FILL_FACE;
|
||||
//} else {
|
||||
// if (modes[0] == GL_LINE) {
|
||||
// state.fillMode = State::FILL_LINE;
|
||||
// } else {
|
||||
// state.fillMode = State::FILL_POINT;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
{
|
||||
if (glIsEnabled(GL_CULL_FACE)) {
|
||||
|
@ -211,15 +207,10 @@ void getCurrentGLState(State::Data& state) {
|
|||
GLint winding;
|
||||
glGetIntegerv(GL_FRONT_FACE, &winding);
|
||||
state.frontFaceClockwise = (winding == GL_CW);
|
||||
//state.depthClampEnable = glIsEnabled(GL_DEPTH_CLAMP);
|
||||
qDebug() << "TODO: GLShared.cpp.cpp:getCurrentGLState GL_DEPTH_CLAMP";
|
||||
state.depthClampEnable = false; //glIsEnabled(GL_DEPTH_CLAMP_EXT);
|
||||
state.scissorEnable = glIsEnabled(GL_SCISSOR_TEST);
|
||||
//state.multisampleEnable = glIsEnabled(GL_MULTISAMPLE);
|
||||
qDebug() << "TODO: GLShared.cpp.cpp:getCurrentGLState GL_MULTISAMPLE";
|
||||
|
||||
//state.antialisedLineEnable = glIsEnabled(GL_LINE_SMOOTH);
|
||||
qDebug() << "TODO: GLShared.cpp.cpp:getCurrentGLState GL_LINE_SMOOTH";
|
||||
|
||||
state.multisampleEnable = false; //glIsEnabled(GL_MULTISAMPLE_EXT);
|
||||
state.antialisedLineEnable = false; //glIsEnabled(GL_LINE_SMOOTH);
|
||||
}
|
||||
{
|
||||
if (glIsEnabled(GL_POLYGON_OFFSET_FILL)) {
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
Q_DECLARE_LOGGING_CATEGORY(gpugllogging)
|
||||
Q_DECLARE_LOGGING_CATEGORY(trace_render_gpu_gl)
|
||||
Q_DECLARE_LOGGING_CATEGORY(trace_render_gpu_gl_detail)
|
||||
|
||||
#define BUFFER_OFFSET(bytes) ((GLubyte*) nullptr + (bytes))
|
||||
|
||||
|
|
|
@ -12,11 +12,52 @@ using namespace gpu;
|
|||
using namespace gpu::gl;
|
||||
|
||||
bool GLTexelFormat::isCompressed() const {
|
||||
return false;
|
||||
switch (internalFormat) {
|
||||
case GL_COMPRESSED_R11_EAC:
|
||||
case GL_COMPRESSED_SIGNED_R11_EAC:
|
||||
case GL_COMPRESSED_RG11_EAC:
|
||||
case GL_COMPRESSED_SIGNED_RG11_EAC:
|
||||
case GL_COMPRESSED_RGB8_ETC2:
|
||||
case GL_COMPRESSED_SRGB8_ETC2:
|
||||
case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
|
||||
case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
|
||||
case GL_COMPRESSED_RGBA8_ETC2_EAC:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
|
||||
case GL_COMPRESSED_RGBA_ASTC_4x4:
|
||||
case GL_COMPRESSED_RGBA_ASTC_5x4:
|
||||
case GL_COMPRESSED_RGBA_ASTC_5x5:
|
||||
case GL_COMPRESSED_RGBA_ASTC_6x5:
|
||||
case GL_COMPRESSED_RGBA_ASTC_6x6:
|
||||
case GL_COMPRESSED_RGBA_ASTC_8x5:
|
||||
case GL_COMPRESSED_RGBA_ASTC_8x6:
|
||||
case GL_COMPRESSED_RGBA_ASTC_8x8:
|
||||
case GL_COMPRESSED_RGBA_ASTC_10x5:
|
||||
case GL_COMPRESSED_RGBA_ASTC_10x6:
|
||||
case GL_COMPRESSED_RGBA_ASTC_10x8:
|
||||
case GL_COMPRESSED_RGBA_ASTC_10x10:
|
||||
case GL_COMPRESSED_RGBA_ASTC_12x10:
|
||||
case GL_COMPRESSED_RGBA_ASTC_12x12:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
GLenum GLTexelFormat::evalGLTexelFormatInternal(const gpu::Element& dstFormat) {
|
||||
// qDebug() << "GLTexelFormat::evalGLTexelFormatInternal " << dstFormat.getDimension() << ", " << dstFormat.getSemantic() << ", " << dstFormat.getType();
|
||||
GLenum result = GL_RGBA8;
|
||||
switch (dstFormat.getDimension()) {
|
||||
case gpu::SCALAR: {
|
||||
|
@ -48,6 +89,12 @@ GLenum GLTexelFormat::evalGLTexelFormatInternal(const gpu::Element& dstFormat) {
|
|||
case gpu::INT16:
|
||||
result = GL_R16I;
|
||||
break;
|
||||
case gpu::NUINT16:
|
||||
//result = GL_R16_EXT;
|
||||
break;
|
||||
case gpu::NINT16:
|
||||
//result = GL_R16_SNORM_EXT;
|
||||
break;
|
||||
case gpu::HALF:
|
||||
result = GL_R16F;
|
||||
break;
|
||||
|
@ -59,8 +106,7 @@ GLenum GLTexelFormat::evalGLTexelFormatInternal(const gpu::Element& dstFormat) {
|
|||
break;
|
||||
case gpu::NUINT8:
|
||||
if ((dstFormat.getSemantic() == gpu::SRGB || dstFormat.getSemantic() == gpu::SRGBA)) {
|
||||
//result = GL_SLUMINANCE8;
|
||||
qDebug() << "TODO: GLTexelFormat.cpp:evalGLTexelFormatInternal GL_SLUMINANCE8";
|
||||
result = GL_SLUMINANCE8_NV;
|
||||
} else {
|
||||
result = GL_R8;
|
||||
}
|
||||
|
@ -69,7 +115,6 @@ GLenum GLTexelFormat::evalGLTexelFormatInternal(const gpu::Element& dstFormat) {
|
|||
result = GL_R8_SNORM;
|
||||
break;
|
||||
default:
|
||||
qDebug() << "TODO: GLTexelFormat.cpp:evalGLTexelFormatInternal " << dstFormat.getType();
|
||||
Q_UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
|
@ -85,6 +130,12 @@ GLenum GLTexelFormat::evalGLTexelFormatInternal(const gpu::Element& dstFormat) {
|
|||
case gpu::DEPTH:
|
||||
result = GL_DEPTH_COMPONENT16;
|
||||
switch (dstFormat.getType()) {
|
||||
case gpu::UINT32:
|
||||
case gpu::INT32:
|
||||
case gpu::NUINT32:
|
||||
case gpu::NINT32:
|
||||
result = GL_DEPTH_COMPONENT32_OES;
|
||||
break;
|
||||
case gpu::FLOAT:
|
||||
result = GL_DEPTH_COMPONENT32F;
|
||||
break;
|
||||
|
@ -112,7 +163,7 @@ GLenum GLTexelFormat::evalGLTexelFormatInternal(const gpu::Element& dstFormat) {
|
|||
break;
|
||||
|
||||
default:
|
||||
qCDebug(gpugllogging) << "Unknown combination of texel format";
|
||||
qCWarning(gpugllogging) << "Unknown combination of texel format";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -125,7 +176,7 @@ GLenum GLTexelFormat::evalGLTexelFormatInternal(const gpu::Element& dstFormat) {
|
|||
result = GL_RG8;
|
||||
break;
|
||||
default:
|
||||
qCDebug(gpugllogging) << "Unknown combination of texel format";
|
||||
qCWarning(gpugllogging) << "Unknown combination of texel format";
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -139,11 +190,10 @@ GLenum GLTexelFormat::evalGLTexelFormatInternal(const gpu::Element& dstFormat) {
|
|||
break;
|
||||
case gpu::SRGB:
|
||||
case gpu::SRGBA:
|
||||
//result = GL_SRGB8; // standard 2.2 gamma correction color
|
||||
result = GL_RGB8; // standard 2.2 gamma correction color
|
||||
result = GL_SRGB8; // standard 2.2 gamma correction color
|
||||
break;
|
||||
default:
|
||||
qCDebug(gpugllogging) << "Unknown combination of texel format";
|
||||
qCWarning(gpugllogging) << "Unknown combination of texel format";
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -171,6 +221,12 @@ GLenum GLTexelFormat::evalGLTexelFormatInternal(const gpu::Element& dstFormat) {
|
|||
case gpu::INT16:
|
||||
result = GL_RGBA16I;
|
||||
break;
|
||||
case gpu::NUINT16:
|
||||
//result = GL_RGBA16_EXT;
|
||||
break;
|
||||
case gpu::NINT16:
|
||||
//result = GL_RGBA16_SNORM_EXT;
|
||||
break;
|
||||
case gpu::HALF:
|
||||
result = GL_RGBA16F;
|
||||
break;
|
||||
|
@ -183,12 +239,13 @@ GLenum GLTexelFormat::evalGLTexelFormatInternal(const gpu::Element& dstFormat) {
|
|||
case gpu::NUINT8:
|
||||
result = GL_RGBA8;
|
||||
break;
|
||||
case gpu::NUINT2:
|
||||
//result = GL_RGBA2;
|
||||
break;
|
||||
case gpu::NINT8:
|
||||
result = GL_RGBA8_SNORM;
|
||||
break;
|
||||
case gpu::NUINT2:
|
||||
case gpu::NINT16:
|
||||
case gpu::NUINT16:
|
||||
case gpu::NINT2_10_10_10:
|
||||
case gpu::NUINT32:
|
||||
case gpu::NINT32:
|
||||
case gpu::COMPRESSED:
|
||||
|
@ -197,55 +254,21 @@ GLenum GLTexelFormat::evalGLTexelFormatInternal(const gpu::Element& dstFormat) {
|
|||
}
|
||||
break;
|
||||
case gpu::SRGB:
|
||||
//result = GL_SRGB8;
|
||||
result = GL_RGB8;
|
||||
qDebug() << "SRGBA Here 2";
|
||||
result = GL_SRGB8;
|
||||
break;
|
||||
case gpu::SRGBA:
|
||||
result = GL_SRGB8_ALPHA8; // standard 2.2 gamma correction color
|
||||
break;
|
||||
default:
|
||||
qCDebug(gpugllogging) << "Unknown combination of texel format";
|
||||
}
|
||||
break;
|
||||
}
|
||||
// TODO: implement compression formats supported by android (ASTC, ETC2)
|
||||
/*
|
||||
case gpu::TILE4x4: {
|
||||
switch (dstFormat.getSemantic()) {
|
||||
case gpu::COMPRESSED_BC4_RED:
|
||||
result = GL_COMPRESSED_RED_RGTC1;
|
||||
break;
|
||||
case gpu::COMPRESSED_BC1_SRGB:
|
||||
result = GL_COMPRESSED_SRGB_S3TC_DXT1_EXT;
|
||||
break;
|
||||
case gpu::COMPRESSED_BC1_SRGBA:
|
||||
result = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;
|
||||
break;
|
||||
case gpu::COMPRESSED_BC3_SRGBA:
|
||||
result = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;
|
||||
break;
|
||||
case gpu::COMPRESSED_BC5_XY:
|
||||
result = GL_COMPRESSED_RG_RGTC2;
|
||||
break;
|
||||
case gpu::COMPRESSED_BC6_RGB:
|
||||
result = GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT;
|
||||
break;
|
||||
case gpu::COMPRESSED_BC7_SRGBA:
|
||||
result = GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM;
|
||||
break;
|
||||
|
||||
default:
|
||||
qCWarning(gpugllogging) << "Unknown combination of texel format";
|
||||
}
|
||||
break;
|
||||
*/
|
||||
}
|
||||
default:
|
||||
qCDebug(gpugllogging) << "Unknown combination of texel format";
|
||||
}
|
||||
|
||||
//qDebug() << "GLTexelFormat::evalGLTexelFormatInternal result " << result;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -260,21 +283,15 @@ GLTexelFormat GLTexelFormat::evalGLTexelFormat(const Element& dstFormat, const E
|
|||
texel.type = ELEMENT_TYPE_TO_GL[dstFormat.getType()];
|
||||
|
||||
switch (dstFormat.getSemantic()) {
|
||||
case gpu::RED:
|
||||
case gpu::RGB:
|
||||
case gpu::RGBA:
|
||||
texel.internalFormat = GL_R8;
|
||||
break;
|
||||
|
||||
//CLIMAX_MERGE_START
|
||||
// case gpu::COMPRESSED_R:
|
||||
// qDebug() << "TODO: GLTexelFormat.cpp:evalGLTexelFormat GL_COMPRESSED_RED_RGTC1";
|
||||
// //texel.internalFormat = GL_COMPRESSED_RED_RGTC1;
|
||||
// break;
|
||||
//CLIMAX_MERGE_END
|
||||
|
||||
case gpu::DEPTH:
|
||||
texel.format = GL_DEPTH_COMPONENT;
|
||||
texel.internalFormat = GL_DEPTH_COMPONENT32_OES;
|
||||
texel.internalFormat = GL_DEPTH_COMPONENT32F;
|
||||
break;
|
||||
case gpu::DEPTH_STENCIL:
|
||||
texel.type = GL_UNSIGNED_INT_24_8;
|
||||
|
@ -314,17 +331,6 @@ GLTexelFormat GLTexelFormat::evalGLTexelFormat(const Element& dstFormat, const E
|
|||
case gpu::RGBA:
|
||||
texel.internalFormat = GL_RGB8;
|
||||
break;
|
||||
//CLIMAX_MERGE_START
|
||||
//not needed?
|
||||
// case gpu::COMPRESSED_RGB:
|
||||
// qDebug() << "TODO: GLTexelFormat.cpp:evalGLTexelFormat GL_COMPRESSED_RGB";
|
||||
// //texel.internalFormat = GL_COMPRESSED_RGB;
|
||||
// break;
|
||||
// case gpu::COMPRESSED_SRGB:
|
||||
// qDebug() << "TODO: GLTexelFormat.cpp:evalGLTexelFormat GL_COMPRESSED_SRGB";
|
||||
// //texel.internalFormat = GL_COMPRESSED_SRGB;
|
||||
// break;
|
||||
//CLIMAX_MERGE_END
|
||||
default:
|
||||
qCWarning(gpugllogging) << "Unknown combination of texel format";
|
||||
}
|
||||
|
@ -339,8 +345,7 @@ GLTexelFormat GLTexelFormat::evalGLTexelFormat(const Element& dstFormat, const E
|
|||
switch (srcFormat.getSemantic()) {
|
||||
case gpu::BGRA:
|
||||
case gpu::SBGRA:
|
||||
qDebug() << "TODO: GLTexelFormat.cpp:evalGLTexelFormat GL_BGRA";
|
||||
//texel.format = GL_BGRA;
|
||||
texel.format = GL_RGBA; // GL_BGRA_EXT;
|
||||
break;
|
||||
case gpu::RGB:
|
||||
case gpu::RGBA:
|
||||
|
@ -358,41 +363,11 @@ GLTexelFormat GLTexelFormat::evalGLTexelFormat(const Element& dstFormat, const E
|
|||
texel.internalFormat = GL_RGBA8;
|
||||
break;
|
||||
case gpu::SRGB:
|
||||
//texel.internalFormat = GL_SRGB8;
|
||||
texel.internalFormat = GL_RGB8;
|
||||
qDebug() << "SRGBA Here 3";
|
||||
texel.internalFormat = GL_SRGB8;
|
||||
break;
|
||||
case gpu::SRGBA:
|
||||
texel.internalFormat = GL_SRGB8_ALPHA8;
|
||||
break;
|
||||
|
||||
//CLIMAX_MERGE_START
|
||||
// case gpu::COMPRESSED_RGBA:
|
||||
// //texel.internalFormat = GL_COMPRESSED_RGBA;
|
||||
// qDebug() << "TODO: GLTexelFormat.cpp:evalGLTexelFormat GL_COMPRESSED_RGBA";
|
||||
// break;
|
||||
// case gpu::COMPRESSED_SRGBA:
|
||||
// //texel.internalFormat = GL_COMPRESSED_SRGB_ALPHA;
|
||||
// qDebug() << "TODO: GLTexelFormat.cpp:evalGLTexelFormat GL_COMPRESSED_SRGB_ALPHA";
|
||||
// break;
|
||||
//CLIMAX_MERGE_END
|
||||
// FIXME: WE will want to support this later
|
||||
/*
|
||||
case gpu::COMPRESSED_BC3_RGBA:
|
||||
texel.internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
||||
break;
|
||||
case gpu::COMPRESSED_BC3_SRGBA:
|
||||
texel.internalFormat = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;
|
||||
break;
|
||||
|
||||
case gpu::COMPRESSED_BC7_RGBA:
|
||||
texel.internalFormat = GL_COMPRESSED_RGBA_BPTC_UNORM_ARB;
|
||||
break;
|
||||
case gpu::COMPRESSED_BC7_SRGBA:
|
||||
texel.internalFormat = GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM;
|
||||
break;
|
||||
*/
|
||||
|
||||
default:
|
||||
qCWarning(gpugllogging) << "Unknown combination of texel format";
|
||||
}
|
||||
|
@ -449,13 +424,11 @@ GLTexelFormat GLTexelFormat::evalGLTexelFormat(const Element& dstFormat, const E
|
|||
break;
|
||||
}
|
||||
case gpu::NUINT16: {
|
||||
//texel.internalFormat = GL_R16;
|
||||
qDebug() << "TODO: GLTexelFormat.cpp:evalGLTexelFormat GL_R16";
|
||||
texel.internalFormat = GL_R16_EXT;
|
||||
break;
|
||||
}
|
||||
case gpu::NINT16: {
|
||||
//texel.internalFormat = GL_R16_SNORM;
|
||||
qDebug() << "TODO: GLTexelFormat.cpp:evalGLTexelFormat GL_R16_SNORM";
|
||||
texel.internalFormat = GL_R16_SNORM_EXT;
|
||||
break;
|
||||
}
|
||||
case gpu::HALF: {
|
||||
|
@ -472,9 +445,7 @@ GLTexelFormat GLTexelFormat::evalGLTexelFormat(const Element& dstFormat, const E
|
|||
}
|
||||
case gpu::NUINT8: {
|
||||
if ((dstFormat.getSemantic() == gpu::SRGB || dstFormat.getSemantic() == gpu::SRGBA)) {
|
||||
// texel.internalFormat = GL_SLUMINANCE8;
|
||||
qDebug() << "TODO: GLTexelFormat.cpp:evalGLTexelFormat GL_SLUMINANCE8";
|
||||
|
||||
texel.internalFormat = GL_SLUMINANCE8_NV;
|
||||
} else {
|
||||
texel.internalFormat = GL_R8;
|
||||
}
|
||||
|
@ -495,7 +466,7 @@ GLTexelFormat GLTexelFormat::evalGLTexelFormat(const Element& dstFormat, const E
|
|||
|
||||
case gpu::R11G11B10:
|
||||
texel.format = GL_RGB;
|
||||
// the type should be float
|
||||
texel.type = GL_UNSIGNED_INT_10F_11F_11F_REV;
|
||||
texel.internalFormat = GL_R11F_G11F_B10F;
|
||||
break;
|
||||
|
||||
|
@ -537,6 +508,7 @@ GLTexelFormat GLTexelFormat::evalGLTexelFormat(const Element& dstFormat, const E
|
|||
}
|
||||
case gpu::COMPRESSED:
|
||||
case gpu::NUINT2:
|
||||
case gpu::NINT2_10_10_10:
|
||||
case gpu::NUM_TYPES: { // quiet compiler
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
|
@ -583,18 +555,8 @@ GLTexelFormat GLTexelFormat::evalGLTexelFormat(const Element& dstFormat, const E
|
|||
break;
|
||||
case gpu::SRGB:
|
||||
case gpu::SRGBA:
|
||||
//texel.internalFormat = GL_SRGB8; // standard 2.2 gamma correction color
|
||||
texel.internalFormat = GL_RGB8; // standard 2.2 gamma correction color
|
||||
texel.internalFormat = GL_SRGB8; // standard 2.2 gamma correction color
|
||||
break;
|
||||
//CLIMAX_MERGE_START
|
||||
// case gpu::COMPRESSED_RGB:
|
||||
// //texel.internalFormat = GL_COMPRESSED_RGB;
|
||||
// qDebug() << "TODO: GLTexelFormat.cpp:evalGLTexelFormat GL_COMPRESSED_RGB";
|
||||
// break;
|
||||
// case gpu::COMPRESSED_SRGB:
|
||||
// //texel.internalFormat = GL_COMPRESSED_SRGB;
|
||||
// qDebug() << "TODO: GLTexelFormat.cpp:evalGLTexelFormat GL_COMPRESSED_SRGB";
|
||||
// break;
|
||||
default:
|
||||
qCWarning(gpugllogging) << "Unknown combination of texel format";
|
||||
}
|
||||
|
@ -633,13 +595,11 @@ GLTexelFormat GLTexelFormat::evalGLTexelFormat(const Element& dstFormat, const E
|
|||
break;
|
||||
case gpu::NUINT16:
|
||||
texel.format = GL_RGBA;
|
||||
//texel.internalFormat = GL_RGBA16;
|
||||
qDebug() << "TODO: GLTexelFormat.cpp:evalGLTexelFormat GL_RGBA16";
|
||||
//texel.internalFormat = GL_RGBA16_EXT;
|
||||
break;
|
||||
case gpu::NINT16:
|
||||
texel.format = GL_RGBA;
|
||||
qDebug() << "TODO: GLTexelFormat.cpp:evalGLTexelFormat GL_RGBA16_SNORM";
|
||||
//texel.internalFormat = GL_RGBA16_SNORM;
|
||||
//texel.internalFormat = GL_RGBA16_SNORM_EXT;
|
||||
break;
|
||||
case gpu::HALF:
|
||||
texel.format = GL_RGBA;
|
||||
|
@ -661,30 +621,24 @@ GLTexelFormat GLTexelFormat::evalGLTexelFormat(const Element& dstFormat, const E
|
|||
texel.format = GL_RGBA;
|
||||
texel.internalFormat = GL_RGBA8_SNORM;
|
||||
break;
|
||||
case gpu::NUINT2:
|
||||
texel.format = GL_RGBA;
|
||||
texel.internalFormat = GL_RGBA8;
|
||||
break;
|
||||
case gpu::NUINT32:
|
||||
case gpu::NINT32:
|
||||
case gpu::NINT2_10_10_10:
|
||||
case gpu::COMPRESSED:
|
||||
case gpu::NUINT2:
|
||||
case gpu::NUM_TYPES: // quiet compiler
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
break;
|
||||
case gpu::SRGB:
|
||||
//texel.internalFormat = GL_SRGB8;
|
||||
texel.internalFormat = GL_RGB8; // standard 2.2 gamma correction color
|
||||
texel.internalFormat = GL_SRGB8;
|
||||
break;
|
||||
case gpu::SRGBA:
|
||||
texel.internalFormat = GL_SRGB8_ALPHA8; // standard 2.2 gamma correction color
|
||||
break;
|
||||
//CLIMAX_MERGE_START
|
||||
// case gpu::COMPRESSED_RGBA:
|
||||
// //texel.internalFormat = GL_COMPRESSED_RGBA;
|
||||
// qDebug() << "TODO: GLTexelFormat.cpp:evalGLTexelFormat GL_COMPRESSED_RGBA";
|
||||
// break;
|
||||
// case gpu::COMPRESSED_SRGBA:
|
||||
// qDebug() << "TODO: GLTexelFormat.cpp:evalGLTexelFormat GL_COMPRESSED_SRGB_ALPHA";
|
||||
// //texel.internalFormat = GL_COMPRESSED_SRGB_ALPHA;
|
||||
// break;
|
||||
default:
|
||||
qCWarning(gpugllogging) << "Unknown combination of texel format";
|
||||
}
|
||||
|
@ -693,7 +647,6 @@ GLTexelFormat GLTexelFormat::evalGLTexelFormat(const Element& dstFormat, const E
|
|||
default:
|
||||
qCDebug(gpugllogging) << "Unknown combination of texel format";
|
||||
}
|
||||
//qDebug() << "GLTexelFormat::evalGLTexelFormat Texel.type " << texel.type << " - texel.format=" << texel.format << " texel.internalFormat=" << texel.internalFormat;
|
||||
return texel;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,10 +28,8 @@ const GLenum GLTexture::WRAP_MODES[Sampler::NUM_WRAP_MODES] = {
|
|||
GL_REPEAT, // WRAP_REPEAT,
|
||||
GL_MIRRORED_REPEAT, // WRAP_MIRROR,
|
||||
GL_CLAMP_TO_EDGE, // WRAP_CLAMP,
|
||||
GL_CLAMP_TO_BORDER_EXT, // WRAP_BORDER,
|
||||
|
||||
//GL_MIRROR_CLAMP_TO_EDGE_EXT // WRAP_MIRROR_ONCE,
|
||||
// qDebug() << "TODO: GLTexture.cpp:WRAP_MODES GL_MIRROR_CLAMP_TO_EDGE_EXT";
|
||||
GL_CLAMP_TO_BORDER, // WRAP_BORDER,
|
||||
GL_MIRRORED_REPEAT //GL_MIRROR_CLAMP_TO_EDGE_EXT // WRAP_MIRROR_ONCE,
|
||||
};
|
||||
|
||||
const GLFilterMode GLTexture::FILTER_MODES[Sampler::NUM_FILTERS] = {
|
||||
|
|
|
@ -198,7 +198,7 @@ void GLESTexture::syncSampler() const {
|
|||
glTexParameteri(_target, GL_TEXTURE_WRAP_T, WRAP_MODES[sampler.getWrapModeV()]);
|
||||
glTexParameteri(_target, GL_TEXTURE_WRAP_R, WRAP_MODES[sampler.getWrapModeW()]);
|
||||
|
||||
glTexParameterfv(_target, GL_TEXTURE_BORDER_COLOR_EXT, (const float*)&sampler.getBorderColor());
|
||||
glTexParameterfv(_target, GL_TEXTURE_BORDER_COLOR, (const float*)&sampler.getBorderColor());
|
||||
//glTexParameterf(_target, GL_TEXTURE_MAX_ANISOTROPY_EXT, sampler.getMaxAnisotropy());
|
||||
|
||||
glTexParameterf(_target, GL_TEXTURE_MIN_LOD, (float)sampler.getMinMip());
|
||||
|
|
|
@ -269,6 +269,10 @@ public:
|
|||
|
||||
void _glColor4f(float red, float green, float blue, float alpha);
|
||||
|
||||
// Maybe useful but shoudln't be public. Please convince me otherwise
|
||||
// Well porting to gles i need it...
|
||||
void runLambda(std::function<void()> f);
|
||||
|
||||
enum Command {
|
||||
COMMAND_draw = 0,
|
||||
COMMAND_drawIndexed,
|
||||
|
@ -497,8 +501,7 @@ protected:
|
|||
void startNamedCall(const std::string& name);
|
||||
void stopNamedCall();
|
||||
|
||||
// Maybe useful but shoudln't be public. Please convince me otherwise
|
||||
void runLambda(std::function<void()> f);
|
||||
|
||||
|
||||
void captureDrawCallInfoImpl();
|
||||
};
|
||||
|
|
|
@ -539,7 +539,7 @@ public:
|
|||
|
||||
static TexturePointer build(const ktx::KTXDescriptor& descriptor);
|
||||
static TexturePointer unserialize(const std::string& ktxFile);
|
||||
static TexturePointer unserialize(const cache::FilePointer& cacheEntry);
|
||||
static TexturePointer unserialize(const cache::FilePointer& cacheEntry, const std::string& source = std::string());
|
||||
|
||||
static bool evalKTXFormat(const Element& mipFormat, const Element& texelFormat, ktx::Header& header);
|
||||
static bool evalTextureFormat(const ktx::Header& header, Element& mipFormat, Element& texelFormat);
|
||||
|
|
|
@ -498,14 +498,10 @@ TexturePointer Texture::build(const ktx::KTXDescriptor& descriptor) {
|
|||
|
||||
GPUKTXPayload gpuktxKeyValue;
|
||||
if (!GPUKTXPayload::findInKeyValues(descriptor.keyValues, gpuktxKeyValue)) {
|
||||
#if defined(Q_OS_ANDROID)
|
||||
qCWarning(gpulogging) << "Could not find GPUKTX key values.";
|
||||
// FIXME use sensible defaults based on the texture type and format
|
||||
gpuktxKeyValue._usageType = TextureUsageType::RESOURCE;
|
||||
gpuktxKeyValue._usage = Texture::Usage::Builder().withColor().withAlpha().build();
|
||||
#else
|
||||
qCWarning(gpulogging) << "Could not find GPUKTX key values.";
|
||||
return TexturePointer();
|
||||
#endif
|
||||
}
|
||||
|
||||
auto texture = create(gpuktxKeyValue._usageType,
|
||||
|
@ -531,7 +527,7 @@ TexturePointer Texture::build(const ktx::KTXDescriptor& descriptor) {
|
|||
return texture;
|
||||
}
|
||||
|
||||
TexturePointer Texture::unserialize(const cache::FilePointer& cacheEntry) {
|
||||
TexturePointer Texture::unserialize(const cache::FilePointer& cacheEntry, const std::string& source) {
|
||||
std::unique_ptr<ktx::KTX> ktxPointer = ktx::KTX::create(std::make_shared<storage::FileStorage>(cacheEntry->getFilepath().c_str()));
|
||||
if (!ktxPointer) {
|
||||
return nullptr;
|
||||
|
@ -540,6 +536,9 @@ TexturePointer Texture::unserialize(const cache::FilePointer& cacheEntry) {
|
|||
auto texture = build(ktxPointer->toDescriptor());
|
||||
if (texture) {
|
||||
texture->setKtxBacking(cacheEntry);
|
||||
if (texture->source().empty()) {
|
||||
texture->setSource(source);
|
||||
}
|
||||
}
|
||||
|
||||
return texture;
|
||||
|
@ -554,6 +553,7 @@ TexturePointer Texture::unserialize(const std::string& ktxfile) {
|
|||
auto texture = build(ktxPointer->toDescriptor());
|
||||
if (texture) {
|
||||
texture->setKtxBacking(ktxfile);
|
||||
texture->setSource(ktxfile);
|
||||
}
|
||||
|
||||
return texture;
|
||||
|
|
|
@ -50,8 +50,10 @@ Q_LOGGING_CATEGORY(trace_resource_parse_image, "trace.resource.parse.image")
|
|||
Q_LOGGING_CATEGORY(trace_resource_parse_image_raw, "trace.resource.parse.image.raw")
|
||||
Q_LOGGING_CATEGORY(trace_resource_parse_image_ktx, "trace.resource.parse.image.ktx")
|
||||
|
||||
#if !defined(DISABLE_KTX_CACHE)
|
||||
const std::string TextureCache::KTX_DIRNAME { "ktx_cache" };
|
||||
const std::string TextureCache::KTX_EXT { "ktx" };
|
||||
#endif
|
||||
|
||||
static const QString RESOURCE_SCHEME = "resource";
|
||||
static const QUrl SPECTATOR_CAMERA_FRAME_URL("resource://spectatorCameraFrame");
|
||||
|
@ -61,7 +63,9 @@ static const float SKYBOX_LOAD_PRIORITY { 10.0f }; // Make sure skybox loads fir
|
|||
static const float HIGH_MIPS_LOAD_PRIORITY { 9.0f }; // Make sure high mips loads after skybox but before models
|
||||
|
||||
TextureCache::TextureCache() {
|
||||
#if !defined(DISABLE_KTX_CACHE)
|
||||
_ktxCache->initialize();
|
||||
#endif
|
||||
setUnusedResourceCacheSize(0);
|
||||
setObjectName("TextureCache");
|
||||
}
|
||||
|
@ -742,16 +746,20 @@ void NetworkTexture::handleFinishedInitialLoad() {
|
|||
|
||||
gpu::TexturePointer texture = textureCache->getTextureByHash(hash);
|
||||
|
||||
#if !defined(DISABLE_KTX_CACHE)
|
||||
if (!texture) {
|
||||
auto ktxFile = textureCache->_ktxCache->getFile(hash);
|
||||
if (ktxFile) {
|
||||
texture = gpu::Texture::unserialize(ktxFile);
|
||||
if (texture) {
|
||||
texture = textureCache->cacheTextureByHash(hash, texture);
|
||||
if (texture->source().empty()) {
|
||||
texture->setSource(url.toString().toStdString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
if (!texture) {
|
||||
|
||||
auto memKtx = ktx::KTX::createBare(*header, keyValues);
|
||||
|
@ -766,6 +774,7 @@ void NetworkTexture::handleFinishedInitialLoad() {
|
|||
|
||||
// Move ktx to file
|
||||
const char* data = reinterpret_cast<const char*>(memKtx->_storage->data());
|
||||
#if !defined(DISABLE_KTX_CACHE)
|
||||
size_t length = memKtx->_storage->size();
|
||||
cache::FilePointer file;
|
||||
auto& ktxCache = textureCache->_ktxCache;
|
||||
|
@ -777,11 +786,14 @@ void NetworkTexture::handleFinishedInitialLoad() {
|
|||
Q_ARG(int, 0));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
auto newKtxDescriptor = memKtx->toDescriptor();
|
||||
|
||||
texture = gpu::Texture::build(newKtxDescriptor);
|
||||
#if !defined(DISABLE_KTX_CACHE)
|
||||
texture->setKtxBacking(file);
|
||||
#endif
|
||||
texture->setSource(filename);
|
||||
|
||||
auto& images = originalKtxDescriptor->images;
|
||||
|
@ -924,11 +936,12 @@ void ImageReader::read() {
|
|||
// If we already have a live texture with the same hash, use it
|
||||
auto texture = textureCache->getTextureByHash(hash);
|
||||
|
||||
#if !defined(DISABLE_KTX_CACHE)
|
||||
// If there is no live texture, check if there's an existing KTX file
|
||||
if (!texture) {
|
||||
auto ktxFile = textureCache->_ktxCache->getFile(hash);
|
||||
if (ktxFile) {
|
||||
texture = gpu::Texture::unserialize(ktxFile);
|
||||
texture = gpu::Texture::unserialize(ktxFile, _url.toString().toStdString());
|
||||
if (texture) {
|
||||
texture = textureCache->cacheTextureByHash(hash, texture);
|
||||
} else {
|
||||
|
@ -936,6 +949,7 @@ void ImageReader::read() {
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// If we found the texture either because it's in use or via KTX deserialization,
|
||||
// set the image and return immediately.
|
||||
|
@ -971,6 +985,7 @@ void ImageReader::read() {
|
|||
|
||||
// Save the image into a KTXFile
|
||||
if (texture && textureCache) {
|
||||
#if !defined(DISABLE_KTX_CACHE)
|
||||
auto memKtx = gpu::Texture::serialize(*texture);
|
||||
|
||||
// Move the texture into a memory mapped file
|
||||
|
@ -987,7 +1002,7 @@ void ImageReader::read() {
|
|||
} else {
|
||||
qCWarning(modelnetworking) << "Unable to serialize texture to KTX " << _url;
|
||||
}
|
||||
|
||||
#endif
|
||||
// We replace the texture with the one stored in the cache. This deals with the possible race condition of two different
|
||||
// images with the same hash being loaded concurrently. Only one of them will make it into the cache by hash first and will
|
||||
// be the winner
|
||||
|
|
|
@ -194,10 +194,12 @@ private:
|
|||
TextureCache();
|
||||
virtual ~TextureCache();
|
||||
|
||||
#if !defined(DISABLE_KTX_CACHE)
|
||||
static const std::string KTX_DIRNAME;
|
||||
static const std::string KTX_EXT;
|
||||
|
||||
std::shared_ptr<cache::FileCache> _ktxCache { std::make_shared<KTXCache>(KTX_DIRNAME, KTX_EXT) };
|
||||
#endif
|
||||
// Map from image hashes to texture weak pointers
|
||||
std::unordered_map<std::string, std::weak_ptr<gpu::Texture>> _texturesByHashes;
|
||||
std::mutex _texturesByHashesMutex;
|
||||
|
|
|
@ -89,12 +89,14 @@ void Skybox::render(gpu::Batch& batch, const ViewFrustum& viewFrustum, const Sky
|
|||
auto skyFS = gpu::Shader::createPixel(std::string(skybox_frag));
|
||||
auto skyShader = gpu::Shader::createProgram(skyVS, skyFS);
|
||||
|
||||
gpu::Shader::BindingSet bindings;
|
||||
bindings.insert(gpu::Shader::Binding(std::string("cubeMap"), SKYBOX_SKYMAP_SLOT));
|
||||
bindings.insert(gpu::Shader::Binding(std::string("skyboxBuffer"), SKYBOX_CONSTANTS_SLOT));
|
||||
if (!gpu::Shader::makeProgram(*skyShader, bindings)) {
|
||||
batch.runLambda([skyShader] {
|
||||
gpu::Shader::BindingSet bindings;
|
||||
bindings.insert(gpu::Shader::Binding(std::string("cubeMap"), SKYBOX_SKYMAP_SLOT));
|
||||
bindings.insert(gpu::Shader::Binding(std::string("skyboxBuffer"), SKYBOX_CONSTANTS_SLOT));
|
||||
if (!gpu::Shader::makeProgram(*skyShader, bindings)) {
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
auto skyState = std::make_shared<gpu::State>();
|
||||
// Must match PrepareStencil::STENCIL_BACKGROUND
|
||||
|
|
|
@ -639,7 +639,7 @@ render::ShapePipelinePointer GeometryCache::_simpleWirePipeline;
|
|||
|
||||
uint8_t GeometryCache::CUSTOM_PIPELINE_NUMBER = 0;
|
||||
|
||||
render::ShapePipelinePointer GeometryCache::shapePipelineFactory(const render::ShapePlumber& plumber, const render::ShapeKey& key) {
|
||||
render::ShapePipelinePointer GeometryCache::shapePipelineFactory(const render::ShapePlumber& plumber, const render::ShapeKey& key, gpu::Batch& batch) {
|
||||
initializeShapePipelines();
|
||||
|
||||
if (key.isWireframe()) {
|
||||
|
@ -2001,11 +2001,11 @@ void GeometryCache::renderGlowLine(gpu::Batch& batch, const glm::vec3& p1, const
|
|||
}
|
||||
|
||||
void GeometryCache::useSimpleDrawPipeline(gpu::Batch& batch, bool noBlend) {
|
||||
if (!_standardDrawPipeline) {
|
||||
static std::once_flag once;
|
||||
std::call_once(once, [&]() {
|
||||
auto vs = gpu::Shader::createVertex(std::string(standardTransformPNTC_vert));
|
||||
auto ps = gpu::Shader::createPixel(std::string(standardDrawTexture_frag));
|
||||
auto program = gpu::Shader::createProgram(vs, ps);
|
||||
gpu::Shader::makeProgram((*program));
|
||||
|
||||
auto state = std::make_shared<gpu::State>();
|
||||
|
||||
|
@ -2021,9 +2021,15 @@ void GeometryCache::useSimpleDrawPipeline(gpu::Batch& batch, bool noBlend) {
|
|||
|
||||
auto noBlendPS = gpu::StandardShaderLib::getDrawTextureOpaquePS();
|
||||
auto programNoBlend = gpu::Shader::createProgram(vs, noBlendPS);
|
||||
gpu::Shader::makeProgram((*programNoBlend));
|
||||
|
||||
_standardDrawPipelineNoBlend = gpu::Pipeline::create(programNoBlend, stateNoBlend);
|
||||
}
|
||||
|
||||
batch.runLambda([program, programNoBlend] {
|
||||
gpu::Shader::makeProgram((*program));
|
||||
gpu::Shader::makeProgram((*programNoBlend));
|
||||
});
|
||||
});
|
||||
|
||||
if (noBlend) {
|
||||
batch.setPipeline(_standardDrawPipelineNoBlend);
|
||||
} else {
|
||||
|
|
|
@ -158,7 +158,7 @@ public:
|
|||
static void computeSimpleHullPointListForShape(int entityShape, const glm::vec3 &entityExtents, QVector<glm::vec3> &outPointList);
|
||||
|
||||
static uint8_t CUSTOM_PIPELINE_NUMBER;
|
||||
static render::ShapePipelinePointer shapePipelineFactory(const render::ShapePlumber& plumber, const render::ShapeKey& key);
|
||||
static render::ShapePipelinePointer shapePipelineFactory(const render::ShapePlumber& plumber, const render::ShapeKey& key, gpu::Batch& batch);
|
||||
static void registerShapePipeline() {
|
||||
if (!CUSTOM_PIPELINE_NUMBER) {
|
||||
CUSTOM_PIPELINE_NUMBER = render::ShapePipeline::registerCustomShapePipelineFactory(shapePipelineFactory);
|
||||
|
|
|
@ -96,7 +96,7 @@ protected:
|
|||
|
||||
float enableObscurance{ 1.0f };
|
||||
|
||||
float enableMaterialTexturing { 1.0f };
|
||||
float enableMaterialTexturing { 0.0f };
|
||||
float enableWireframe { 0.0f }; // false by default
|
||||
|
||||
Parameters() {}
|
||||
|
@ -148,7 +148,7 @@ public:
|
|||
bool enableSpecular{ true };
|
||||
|
||||
bool enableAlbedo{ true };
|
||||
bool enableMaterialTexturing { true };
|
||||
bool enableMaterialTexturing { false };
|
||||
|
||||
bool enableAmbientLight{ true };
|
||||
bool enableDirectionalLight{ true };
|
||||
|
|
|
@ -17,7 +17,9 @@
|
|||
const int MAX_TEXCOORDS = 2;
|
||||
|
||||
struct TexMapArray {
|
||||
mat4 _texcoordTransforms[MAX_TEXCOORDS];
|
||||
// mat4 _texcoordTransforms[MAX_TEXCOORDS];
|
||||
mat4 _texcoordTransforms0;
|
||||
mat4 _texcoordTransforms1;
|
||||
vec4 _lightmapParams;
|
||||
};
|
||||
|
||||
|
@ -31,13 +33,13 @@ TexMapArray getTexMapArray() {
|
|||
|
||||
<@func evalTexMapArrayTexcoord0(texMapArray, inTexcoord0, outTexcoord0)@>
|
||||
{
|
||||
<$outTexcoord0$> = (<$texMapArray$>._texcoordTransforms[0] * vec4(<$inTexcoord0$>.st, 0.0, 1.0)).st;
|
||||
<$outTexcoord0$> = (<$texMapArray$>._texcoordTransforms0 * vec4(<$inTexcoord0$>.st, 0.0, 1.0)).st;
|
||||
}
|
||||
<@endfunc@>
|
||||
|
||||
<@func evalTexMapArrayTexcoord1(texMapArray, inTexcoord1, outTexcoord1)@>
|
||||
{
|
||||
<$outTexcoord1$> = (<$texMapArray$>._texcoordTransforms[1] * vec4(<$inTexcoord1$>.st, 0.0, 1.0)).st;
|
||||
<$outTexcoord1$> = (<$texMapArray$>._texcoordTransforms1 * vec4(<$inTexcoord1$>.st, 0.0, 1.0)).st;
|
||||
}
|
||||
<@endfunc@>
|
||||
|
||||
|
|
|
@ -126,11 +126,13 @@ void CompositeHUD::run(const RenderContextPointer& renderContext) {
|
|||
}
|
||||
|
||||
// Grab the HUD texture
|
||||
#if !defined(DISABLE_QML)
|
||||
gpu::doInBatch(renderContext->args->_context, [&](gpu::Batch& batch) {
|
||||
if (renderContext->args->_hudOperator) {
|
||||
renderContext->args->_hudOperator(batch, renderContext->args->_hudTexture, renderContext->args->_renderMode == RenderArgs::RenderMode::MIRROR_RENDER_MODE);
|
||||
}
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
void Blit::run(const RenderContextPointer& renderContext, const gpu::FramebufferPointer& srcFramebuffer) {
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "FramebufferCache.h"
|
||||
#include "TextureCache.h"
|
||||
#include "RenderCommonTask.h"
|
||||
#include "LightStage.h"
|
||||
|
||||
#include "nop_frag.h"
|
||||
|
||||
|
@ -63,17 +64,21 @@ void RenderForwardTask::build(JobModel& task, const render::Varying& input, rend
|
|||
// GPU jobs: Start preparing the main framebuffer
|
||||
const auto framebuffer = task.addJob<PrepareFramebuffer>("PrepareFramebuffer");
|
||||
|
||||
task.addJob<PrepareForward>("PrepareForward", lightingModel);
|
||||
|
||||
// draw a stencil mask in hidden regions of the framebuffer.
|
||||
task.addJob<PrepareStencil>("PrepareStencil", framebuffer);
|
||||
|
||||
// Draw opaques forward
|
||||
task.addJob<Draw>("DrawOpaques", opaques, shapePlumber);
|
||||
const auto opaqueInputs = DrawForward::Inputs(opaques, lightingModel).asVarying();
|
||||
task.addJob<DrawForward>("DrawOpaques", opaqueInputs, shapePlumber);
|
||||
|
||||
// Similar to light stage, background stage has been filled by several potential render items and resolved for the frame in this job
|
||||
task.addJob<DrawBackgroundStage>("DrawBackgroundDeferred", lightingModel);
|
||||
|
||||
// Draw transparent objects forward
|
||||
task.addJob<Draw>("DrawTransparents", transparents, shapePlumber);
|
||||
const auto transparentInputs = DrawForward::Inputs(transparents, lightingModel).asVarying();
|
||||
task.addJob<DrawForward>("DrawTransparents", transparentInputs, shapePlumber);
|
||||
|
||||
{ // Debug the bounds of the rendered items, still look at the zbuffer
|
||||
|
||||
|
@ -125,18 +130,85 @@ void PrepareFramebuffer::run(const RenderContextPointer& renderContext, gpu::Fra
|
|||
batch.setFramebuffer(_framebuffer);
|
||||
batch.clearFramebuffer(gpu::Framebuffer::BUFFER_COLOR0 | gpu::Framebuffer::BUFFER_DEPTH |
|
||||
gpu::Framebuffer::BUFFER_STENCIL,
|
||||
vec4(vec3(0), 1), 1.0, 0, true);
|
||||
vec4(vec3(0, 1.0, 0.0), 0), 1.0, 0, true);
|
||||
});
|
||||
|
||||
framebuffer = _framebuffer;
|
||||
}
|
||||
|
||||
void Draw::run(const RenderContextPointer& renderContext, const Inputs& items) {
|
||||
enum ForwardShader_MapSlot {
|
||||
DEFERRED_BUFFER_COLOR_UNIT = 0,
|
||||
DEFERRED_BUFFER_NORMAL_UNIT = 1,
|
||||
DEFERRED_BUFFER_EMISSIVE_UNIT = 2,
|
||||
DEFERRED_BUFFER_DEPTH_UNIT = 3,
|
||||
DEFERRED_BUFFER_OBSCURANCE_UNIT = 4,
|
||||
SHADOW_MAP_UNIT = 5,
|
||||
SKYBOX_MAP_UNIT = SHADOW_MAP_UNIT + 4,
|
||||
DEFERRED_BUFFER_LINEAR_DEPTH_UNIT,
|
||||
DEFERRED_BUFFER_CURVATURE_UNIT,
|
||||
DEFERRED_BUFFER_DIFFUSED_CURVATURE_UNIT,
|
||||
SCATTERING_LUT_UNIT,
|
||||
SCATTERING_SPECULAR_UNIT,
|
||||
};
|
||||
enum ForwardShader_BufferSlot {
|
||||
DEFERRED_FRAME_TRANSFORM_BUFFER_SLOT = 0,
|
||||
CAMERA_CORRECTION_BUFFER_SLOT,
|
||||
SCATTERING_PARAMETERS_BUFFER_SLOT,
|
||||
LIGHTING_MODEL_BUFFER_SLOT = render::ShapePipeline::Slot::LIGHTING_MODEL,
|
||||
LIGHT_GPU_SLOT = render::ShapePipeline::Slot::LIGHT,
|
||||
LIGHT_AMBIENT_SLOT = render::ShapePipeline::Slot::LIGHT_AMBIENT_BUFFER,
|
||||
HAZE_MODEL_BUFFER_SLOT = render::ShapePipeline::Slot::HAZE_MODEL,
|
||||
LIGHT_INDEX_GPU_SLOT,
|
||||
LIGHT_CLUSTER_GRID_FRUSTUM_GRID_SLOT,
|
||||
LIGHT_CLUSTER_GRID_CLUSTER_GRID_SLOT,
|
||||
LIGHT_CLUSTER_GRID_CLUSTER_CONTENT_SLOT,
|
||||
};
|
||||
|
||||
void PrepareForward::run(const RenderContextPointer& renderContext, const Inputs& inputs) {
|
||||
RenderArgs* args = renderContext->args;
|
||||
const auto& lightingModel = inputs;
|
||||
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
|
||||
args->_batch = &batch;
|
||||
|
||||
model::LightPointer keySunLight;
|
||||
auto lightStage = args->_scene->getStage<LightStage>();
|
||||
if (lightStage) {
|
||||
keySunLight = lightStage->getCurrentKeyLight();
|
||||
}
|
||||
|
||||
model::LightPointer keyAmbiLight;
|
||||
if (lightStage) {
|
||||
keyAmbiLight = lightStage->getCurrentAmbientLight();
|
||||
}
|
||||
|
||||
if (keySunLight) {
|
||||
if (LIGHT_GPU_SLOT >= 0) {
|
||||
batch.setUniformBuffer(LIGHT_GPU_SLOT, keySunLight->getLightSchemaBuffer());
|
||||
}
|
||||
}
|
||||
|
||||
if (keyAmbiLight) {
|
||||
if (LIGHT_AMBIENT_SLOT >= 0) {
|
||||
batch.setUniformBuffer(LIGHT_AMBIENT_SLOT, keyAmbiLight->getAmbientSchemaBuffer());
|
||||
}
|
||||
|
||||
if (keyAmbiLight->getAmbientMap() && (SKYBOX_MAP_UNIT >= 0)) {
|
||||
batch.setResourceTexture(SKYBOX_MAP_UNIT, keyAmbiLight->getAmbientMap());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void DrawForward::run(const RenderContextPointer& renderContext, const Inputs& inputs) {
|
||||
RenderArgs* args = renderContext->args;
|
||||
|
||||
const auto& inItems = inputs.get0();
|
||||
const auto& lightingModel = inputs.get1();
|
||||
|
||||
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
|
||||
args->_batch = &batch;
|
||||
|
||||
|
||||
// Setup projection
|
||||
glm::mat4 projMat;
|
||||
Transform viewMat;
|
||||
|
@ -146,63 +218,23 @@ void Draw::run(const RenderContextPointer& renderContext, const Inputs& items) {
|
|||
batch.setViewTransform(viewMat);
|
||||
batch.setModelTransform(Transform());
|
||||
|
||||
// Setup lighting model for all items;
|
||||
batch.setUniformBuffer(render::ShapePipeline::Slot::LIGHTING_MODEL, lightingModel->getParametersBuffer());
|
||||
|
||||
// From the lighting model define a global shapeKey ORED with individiual keys
|
||||
ShapeKey::Builder keyBuilder;
|
||||
if (lightingModel->isWireframeEnabled()) {
|
||||
keyBuilder.withWireframe();
|
||||
}
|
||||
ShapeKey globalKey = keyBuilder.build();
|
||||
args->_globalShapeKey = globalKey._flags.to_ulong();
|
||||
|
||||
// Render items
|
||||
renderStateSortShapes(renderContext, _shapePlumber, items, -1);
|
||||
renderStateSortShapes(renderContext, _shapePlumber, inItems, -1, globalKey);
|
||||
|
||||
args->_batch = nullptr;
|
||||
args->_globalShapeKey = 0;
|
||||
});
|
||||
args->_batch = nullptr;
|
||||
}
|
||||
|
||||
const gpu::PipelinePointer Stencil::getPipeline() {
|
||||
if (!_stencilPipeline) {
|
||||
auto vs = gpu::StandardShaderLib::getDrawUnitQuadTexcoordVS();
|
||||
auto ps = gpu::Shader::createPixel(std::string(nop_frag));
|
||||
gpu::ShaderPointer program = gpu::Shader::createProgram(vs, ps);
|
||||
gpu::Shader::makeProgram(*program);
|
||||
|
||||
auto state = std::make_shared<gpu::State>();
|
||||
state->setDepthTest(true, false, gpu::LESS_EQUAL);
|
||||
PrepareStencil::drawBackground(*state);
|
||||
|
||||
_stencilPipeline = gpu::Pipeline::create(program, state);
|
||||
}
|
||||
return _stencilPipeline;
|
||||
}
|
||||
|
||||
void Stencil::run(const RenderContextPointer& renderContext) {
|
||||
RenderArgs* args = renderContext->args;
|
||||
|
||||
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
|
||||
args->_batch = &batch;
|
||||
|
||||
batch.enableStereo(false);
|
||||
batch.setViewportTransform(args->_viewport);
|
||||
batch.setStateScissorRect(args->_viewport);
|
||||
|
||||
batch.setPipeline(getPipeline());
|
||||
batch.draw(gpu::TRIANGLE_STRIP, 4);
|
||||
});
|
||||
args->_batch = nullptr;
|
||||
}
|
||||
|
||||
void DrawBackground::run(const RenderContextPointer& renderContext, const Inputs& background) {
|
||||
RenderArgs* args = renderContext->args;
|
||||
|
||||
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
|
||||
args->_batch = &batch;
|
||||
|
||||
batch.enableSkybox(true);
|
||||
batch.setViewportTransform(args->_viewport);
|
||||
batch.setStateScissorRect(args->_viewport);
|
||||
|
||||
// Setup projection
|
||||
glm::mat4 projMat;
|
||||
Transform viewMat;
|
||||
args->getViewFrustum().evalProjectionMatrix(projMat);
|
||||
args->getViewFrustum().evalViewTransform(viewMat);
|
||||
batch.setProjectionTransform(projMat);
|
||||
batch.setViewTransform(viewMat);
|
||||
|
||||
renderItems(renderContext, background);
|
||||
});
|
||||
args->_batch = nullptr;
|
||||
}
|
|
@ -38,37 +38,28 @@ private:
|
|||
gpu::FramebufferPointer _framebuffer;
|
||||
};
|
||||
|
||||
class Draw {
|
||||
class PrepareForward {
|
||||
public:
|
||||
using Inputs = render::ItemBounds;
|
||||
using JobModel = render::Job::ModelI<Draw, Inputs>;
|
||||
using Inputs = LightingModelPointer;
|
||||
using JobModel = render::Job::ModelI<PrepareForward, Inputs>;
|
||||
|
||||
Draw(const render::ShapePlumberPointer& shapePlumber) : _shapePlumber(shapePlumber) {}
|
||||
void run(const render::RenderContextPointer& renderContext,
|
||||
const Inputs& items);
|
||||
const Inputs& inputs);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
class DrawForward{
|
||||
public:
|
||||
using Inputs = render::VaryingSet2<render::ItemBounds, LightingModelPointer>;
|
||||
using JobModel = render::Job::ModelI<DrawForward, Inputs>;
|
||||
|
||||
DrawForward(const render::ShapePlumberPointer& shapePlumber) : _shapePlumber(shapePlumber) {}
|
||||
void run(const render::RenderContextPointer& renderContext,
|
||||
const Inputs& inputs);
|
||||
|
||||
private:
|
||||
render::ShapePlumberPointer _shapePlumber;
|
||||
};
|
||||
|
||||
class Stencil {
|
||||
public:
|
||||
using JobModel = render::Job::Model<Stencil>;
|
||||
|
||||
void run(const render::RenderContextPointer& renderContext);
|
||||
|
||||
private:
|
||||
const gpu::PipelinePointer getPipeline();
|
||||
gpu::PipelinePointer _stencilPipeline;
|
||||
};
|
||||
|
||||
class DrawBackground {
|
||||
public:
|
||||
using Inputs = render::ItemBounds;
|
||||
using JobModel = render::Job::ModelI<DrawBackground, Inputs>;
|
||||
|
||||
void run(const render::RenderContextPointer& renderContext,
|
||||
const Inputs& background);
|
||||
};
|
||||
|
||||
#endif // hifi_RenderForwardTask_h
|
||||
|
|
|
@ -39,12 +39,12 @@ mat4 dualQuatToMat4(vec4 real, vec4 dual) {
|
|||
twoRealXZ - twoRealYW,
|
||||
0.0);
|
||||
vec4 col1 = vec4(twoRealXY - twoRealZW,
|
||||
1 - twoRealXSq - twoRealZSq,
|
||||
1.0 - twoRealXSq - twoRealZSq,
|
||||
twoRealYZ + twoRealXW,
|
||||
0.0);
|
||||
vec4 col2 = vec4(twoRealXZ + twoRealYW,
|
||||
twoRealYZ - twoRealXW,
|
||||
1 - twoRealXSq - twoRealYSq,
|
||||
1.0 - twoRealXSq - twoRealYSq,
|
||||
0.0);
|
||||
vec4 col3 = vec4(2.0 * (-dual.w * real.x + dual.x * real.w - dual.y * real.z + dual.z * real.y),
|
||||
2.0 * (-dual.w * real.y + dual.x * real.z + dual.y * real.w - dual.z * real.x),
|
||||
|
@ -72,7 +72,7 @@ void skinPosition(ivec4 skinClusterIndex, vec4 skinClusterWeight, vec4 inPositio
|
|||
|
||||
// to ensure that we rotate along the shortest arc, reverse dual quaternions with negative polarity.
|
||||
float dqClusterWeight = clusterWeight;
|
||||
if (dot(real, polarityReference) < 0) {
|
||||
if (dot(real, polarityReference) < 0.0) {
|
||||
dqClusterWeight = -clusterWeight;
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ void skinPositionNormal(ivec4 skinClusterIndex, vec4 skinClusterWeight, vec4 inP
|
|||
|
||||
// to ensure that we rotate along the shortest arc, reverse dual quaternions with negative polarity.
|
||||
float dqClusterWeight = clusterWeight;
|
||||
if (dot(real, polarityReference) < 0) {
|
||||
if (dot(real, polarityReference) < 0.0) {
|
||||
dqClusterWeight = -clusterWeight;
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ void skinPositionNormalTangent(ivec4 skinClusterIndex, vec4 skinClusterWeight, v
|
|||
|
||||
// to ensure that we rotate along the shortest arc, reverse dual quaternions with negative polarity.
|
||||
float dqClusterWeight = clusterWeight;
|
||||
if (dot(real, polarityReference) < 0) {
|
||||
if (dot(real, polarityReference) < 0.0) {
|
||||
dqClusterWeight = -clusterWeight;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ void main(void) {
|
|||
vec3 fragNormal;
|
||||
<$transformEyeToWorldDir(cam, _normal, fragNormal)$>
|
||||
|
||||
/* vec4 color = vec4(evalSkyboxGlobalColor(
|
||||
vec4 color = vec4(evalSkyboxGlobalColor(
|
||||
cam._viewInverse,
|
||||
1.0,
|
||||
1.0,
|
||||
|
@ -81,8 +81,6 @@ void main(void) {
|
|||
opacity);
|
||||
color.rgb += emissive * isEmissiveEnabled();
|
||||
|
||||
*/
|
||||
|
||||
_fragColor = vec4(albedo, opacity);
|
||||
|
||||
// _fragColor = vec4(albedo, opacity);
|
||||
_fragColor = color;
|
||||
}
|
||||
|
|
|
@ -12,10 +12,16 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
<@include ForwardBufferWrite.slh@>
|
||||
<! <@include ForwardBufferWrite.slh@> !>
|
||||
|
||||
<@include ForwardGlobalLight.slh@>
|
||||
<$declareEvalSkyboxGlobalColor()$>
|
||||
|
||||
<@include model/Material.slh@>
|
||||
|
||||
<@include gpu/Transform.slh@>
|
||||
<$declareStandardCameraTransform()$>
|
||||
|
||||
<@include MaterialTextures.slh@>
|
||||
<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, _SCRIBE_NULL, EMISSIVE, OCCLUSION, SCATTERING)$>
|
||||
|
||||
|
@ -26,6 +32,8 @@ in vec3 _normal;
|
|||
in vec3 _tangent;
|
||||
in vec3 _color;
|
||||
|
||||
out vec4 _fragColor;
|
||||
|
||||
void main(void) {
|
||||
Material mat = getMaterial();
|
||||
int matKey = getMaterialKey(mat);
|
||||
|
@ -40,6 +48,15 @@ void main(void) {
|
|||
<$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>;
|
||||
albedo *= _color;
|
||||
|
||||
float metallic = getMaterialMetallic(mat);
|
||||
vec3 fresnel = vec3(0.03); // Default Di-electric fresnel value
|
||||
if (metallic <= 0.5) {
|
||||
metallic = 0.0;
|
||||
} else {
|
||||
fresnel = albedo;
|
||||
metallic = 1.0;
|
||||
}
|
||||
|
||||
float roughness = getMaterialRoughness(mat);
|
||||
<$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>;
|
||||
|
||||
|
@ -52,13 +69,24 @@ void main(void) {
|
|||
float scattering = getMaterialScattering(mat);
|
||||
<$evalMaterialScattering(scatteringTex, scattering, matKey, scattering)$>;
|
||||
|
||||
packForwardFragment(
|
||||
viewNormal,
|
||||
opacity,
|
||||
vec3 fragPosition = _position.xyz;
|
||||
|
||||
TransformCamera cam = getTransformCamera();
|
||||
|
||||
vec4 color = vec4(evalSkyboxGlobalColor(
|
||||
cam._viewInverse,
|
||||
1.0,
|
||||
1.0,
|
||||
fragPosition,
|
||||
viewNormal,
|
||||
albedo,
|
||||
roughness,
|
||||
getMaterialMetallic(mat),
|
||||
emissive,
|
||||
occlusionTex,
|
||||
scattering);
|
||||
fresnel,
|
||||
metallic,
|
||||
roughness),
|
||||
opacity);
|
||||
|
||||
color.rgb += emissive * isEmissiveEnabled();
|
||||
|
||||
// _fragColor = vec4(albedo, opacity);
|
||||
_fragColor = color;
|
||||
}
|
||||
|
|
|
@ -12,10 +12,17 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
<@include ForwardBufferWrite.slh@>
|
||||
|
||||
<!<@include ForwardBufferWrite.slh@> !>
|
||||
|
||||
<@include ForwardGlobalLight.slh@>
|
||||
<$declareEvalSkyboxGlobalColor()$>
|
||||
|
||||
<@include model/Material.slh@>
|
||||
|
||||
<@include gpu/Transform.slh@>
|
||||
<$declareStandardCameraTransform()$>
|
||||
|
||||
<@include MaterialTextures.slh@>
|
||||
<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, METALLIC, EMISSIVE, OCCLUSION)$>
|
||||
|
||||
|
@ -26,6 +33,8 @@ in vec3 _normal;
|
|||
in vec3 _tangent;
|
||||
in vec3 _color;
|
||||
|
||||
out vec4 _fragColor;
|
||||
|
||||
void main(void) {
|
||||
Material mat = getMaterial();
|
||||
int matKey = getMaterialKey(mat);
|
||||
|
@ -51,16 +60,32 @@ void main(void) {
|
|||
|
||||
float metallic = getMaterialMetallic(mat);
|
||||
<$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>;
|
||||
vec3 fresnel = vec3(0.03); // Default Di-electric fresnel value
|
||||
if (metallic <= 0.5) {
|
||||
metallic = 0.0;
|
||||
}
|
||||
else {
|
||||
fresnel = albedo;
|
||||
metallic = 1.0;
|
||||
}
|
||||
vec3 fragPosition = _position.xyz;
|
||||
|
||||
float scattering = getMaterialScattering(mat);
|
||||
TransformCamera cam = getTransformCamera();
|
||||
|
||||
packForwardFragment(
|
||||
normalize(viewNormal.xyz),
|
||||
opacity,
|
||||
vec4 color = vec4(evalSkyboxGlobalColor(
|
||||
cam._viewInverse,
|
||||
1.0,
|
||||
1.0,
|
||||
fragPosition,
|
||||
viewNormal,
|
||||
albedo,
|
||||
roughness,
|
||||
fresnel,
|
||||
metallic,
|
||||
emissive,
|
||||
occlusionTex,
|
||||
scattering);
|
||||
roughness),
|
||||
opacity);
|
||||
|
||||
color.rgb += emissive * isEmissiveEnabled();
|
||||
|
||||
// _fragColor = vec4(albedo, opacity);
|
||||
_fragColor = color;
|
||||
}
|
||||
|
|
|
@ -12,10 +12,17 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
<@include ForwardBufferWrite.slh@>
|
||||
|
||||
<!<@include ForwardBufferWrite.slh@> !>
|
||||
|
||||
<@include ForwardGlobalLight.slh@>
|
||||
<$declareEvalSkyboxGlobalColor()$>
|
||||
|
||||
<@include model/Material.slh@>
|
||||
|
||||
<@include gpu/Transform.slh@>
|
||||
<$declareStandardCameraTransform()$>
|
||||
|
||||
<@include MaterialTextures.slh@>
|
||||
<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC, EMISSIVE, OCCLUSION)$>
|
||||
|
||||
|
@ -25,12 +32,13 @@ in vec2 _texCoord1;
|
|||
in vec3 _normal;
|
||||
in vec3 _color;
|
||||
|
||||
out vec4 _fragColor;
|
||||
|
||||
void main(void) {
|
||||
Material mat = getMaterial();
|
||||
int matKey = getMaterialKey(mat);
|
||||
<$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, _SCRIBE_NULL, metallicTex, emissiveTex)$>
|
||||
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$>
|
||||
<! <$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$> !>
|
||||
|
||||
float opacity = 1.0;
|
||||
<$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>;
|
||||
|
@ -48,7 +56,14 @@ void main(void) {
|
|||
|
||||
float metallic = getMaterialMetallic(mat);
|
||||
<$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>;
|
||||
|
||||
vec3 fresnel = vec3(0.03); // Default Di-electric fresnel value
|
||||
if (metallic <= 0.5) {
|
||||
metallic = 0.0;
|
||||
}
|
||||
else {
|
||||
fresnel = albedo;
|
||||
metallic = 1.0;
|
||||
}/*
|
||||
float scattering = getMaterialScattering(mat);
|
||||
|
||||
packForwardFragment(
|
||||
|
@ -60,4 +75,26 @@ void main(void) {
|
|||
emissive,
|
||||
occlusionTex,
|
||||
scattering);
|
||||
*/
|
||||
vec3 fragPosition = _position.xyz;
|
||||
|
||||
TransformCamera cam = getTransformCamera();
|
||||
vec3 fragNormal;
|
||||
<$transformEyeToWorldDir(cam, _normal, fragNormal)$>
|
||||
|
||||
vec4 color = vec4(evalSkyboxGlobalColor(
|
||||
cam._viewInverse,
|
||||
1.0,
|
||||
1.0,
|
||||
fragPosition,
|
||||
fragNormal,
|
||||
albedo,
|
||||
fresnel,
|
||||
metallic,
|
||||
roughness),
|
||||
opacity);
|
||||
color.rgb += emissive * isEmissiveEnabled();
|
||||
|
||||
// _fragColor = vec4(albedo, opacity);
|
||||
_fragColor = color;
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ const ShapePipelinePointer ShapePlumber::pickPipeline(RenderArgs* args, const Ke
|
|||
auto factoryIt = ShapePipeline::_globalCustomFactoryMap.find(key.getCustom());
|
||||
if ((factoryIt != ShapePipeline::_globalCustomFactoryMap.end()) && (factoryIt)->second) {
|
||||
// found a factory for the custom key, can now generate a shape pipeline for this case:
|
||||
addPipelineHelper(Filter(key), key, 0, (factoryIt)->second(*this, key));
|
||||
addPipelineHelper(Filter(key), key, 0, (factoryIt)->second(*this, key, *(args->_batch)));
|
||||
|
||||
return pickPipeline(args, key);
|
||||
} else {
|
||||
|
|
|
@ -301,7 +301,7 @@ protected:
|
|||
ItemSetter _itemSetter;
|
||||
public:
|
||||
using CustomKey = uint8_t;
|
||||
using CustomFactory = std::function<std::shared_ptr<ShapePipeline> (const ShapePlumber& plumber, const ShapeKey& key)>;
|
||||
using CustomFactory = std::function<std::shared_ptr<ShapePipeline> (const ShapePlumber& plumber, const ShapeKey& key, gpu::Batch& batch)>;
|
||||
using CustomFactoryMap = std::map<CustomKey, CustomFactory>;
|
||||
|
||||
static CustomFactoryMap _globalCustomFactoryMap;
|
||||
|
|
|
@ -6,14 +6,14 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
#include "OffscreenQmlSurface.h"
|
||||
#include "ImageProvider.h"
|
||||
|
||||
// Has to come before Qt GL includes
|
||||
#include <gl/Config.h>
|
||||
#include <AudioClient.h>
|
||||
|
||||
#include <unordered_set>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <gl/Config.h>
|
||||
|
||||
#include <QtWidgets/QWidget>
|
||||
#include <QtQml/QtQml>
|
||||
#include <QtQml/QQmlEngine>
|
||||
|
@ -29,7 +29,6 @@
|
|||
#include <QtMultimedia/QAudioOutputSelectorControl>
|
||||
#include <QtMultimedia/QMediaPlayer>
|
||||
|
||||
#include <AudioClient.h>
|
||||
#include <shared/NsightHelpers.h>
|
||||
#include <shared/GlobalAppProperties.h>
|
||||
#include <shared/QtHelpers.h>
|
||||
|
@ -46,8 +45,10 @@
|
|||
#include <gl/OffscreenGLCanvas.h>
|
||||
#include <gl/GLHelpers.h>
|
||||
#include <gl/Context.h>
|
||||
#include <gl/Config.h>
|
||||
#include <shared/ReadWriteLockable.h>
|
||||
|
||||
#include "ImageProvider.h"
|
||||
#include "types/FileTypeProfile.h"
|
||||
#include "types/HFWebEngineProfile.h"
|
||||
#include "types/SoundEffect.h"
|
||||
|
@ -282,7 +283,7 @@ private:
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 8.0f);
|
||||
#if !defined(Q_OS_ANDROID)
|
||||
#if !defined(USE_GLES)
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_LOD_BIAS, -0.2f);
|
||||
#endif
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 8.0f);
|
||||
|
@ -519,6 +520,7 @@ QOpenGLContext* OffscreenQmlSurface::getSharedContext() {
|
|||
|
||||
void OffscreenQmlSurface::cleanup() {
|
||||
_isCleaned = true;
|
||||
#if !defined(DISABLE_QML)
|
||||
_canvas->makeCurrent();
|
||||
|
||||
_renderControl->invalidate();
|
||||
|
@ -536,9 +538,11 @@ void OffscreenQmlSurface::cleanup() {
|
|||
offscreenTextures.releaseSize(_size);
|
||||
|
||||
_canvas->doneCurrent();
|
||||
#endif
|
||||
}
|
||||
|
||||
void OffscreenQmlSurface::render() {
|
||||
#if !defined(DISABLE_QML)
|
||||
if (nsightActive()) {
|
||||
return;
|
||||
}
|
||||
|
@ -578,6 +582,7 @@ void OffscreenQmlSurface::render() {
|
|||
_quickWindow->resetOpenGLState();
|
||||
_lastRenderTime = usecTimestampNow();
|
||||
_canvas->doneCurrent();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool OffscreenQmlSurface::fetchTexture(TextureAndFence& textureAndFence) {
|
||||
|
@ -622,7 +627,9 @@ OffscreenQmlSurface::~OffscreenQmlSurface() {
|
|||
|
||||
cleanup();
|
||||
auto engine = _qmlContext->engine();
|
||||
#if !defined(DISABLE_QML)
|
||||
_canvas->deleteLater();
|
||||
#endif
|
||||
_rootItem->deleteLater();
|
||||
_quickWindow->deleteLater();
|
||||
releaseEngine(engine);
|
||||
|
@ -647,6 +654,7 @@ void OffscreenQmlSurface::disconnectAudioOutputTimer() {
|
|||
void OffscreenQmlSurface::create() {
|
||||
qCDebug(uiLogging) << "Building QML surface";
|
||||
|
||||
#if !defined(DISABLE_QML)
|
||||
_renderControl = new QMyQuickRenderControl();
|
||||
connect(_renderControl, &QQuickRenderControl::renderRequested, this, [this] { _render = true; });
|
||||
connect(_renderControl, &QQuickRenderControl::sceneChanged, this, [this] { _render = _polish = true; });
|
||||
|
@ -663,20 +671,24 @@ void OffscreenQmlSurface::create() {
|
|||
_quickWindow->setClearBeforeRendering(false);
|
||||
|
||||
_renderControl->_renderWindow = _proxyWindow;
|
||||
|
||||
_canvas = new OffscreenGLCanvas();
|
||||
if (!_canvas->create(getSharedContext())) {
|
||||
qFatal("Failed to create OffscreenGLCanvas");
|
||||
return;
|
||||
};
|
||||
|
||||
connect(_quickWindow, &QQuickWindow::focusObjectChanged, this, &OffscreenQmlSurface::onFocusObjectChanged);
|
||||
|
||||
// acquireEngine interrogates the GL context, so we need to have the context current here
|
||||
if (!_canvas->makeCurrent()) {
|
||||
qFatal("Failed to make context current for QML Renderer");
|
||||
return;
|
||||
}
|
||||
#else
|
||||
_quickWindow = new QQuickWindow();
|
||||
#endif
|
||||
|
||||
|
||||
connect(_quickWindow, &QQuickWindow::focusObjectChanged, this, &OffscreenQmlSurface::onFocusObjectChanged);
|
||||
|
||||
|
||||
// Create a QML engine.
|
||||
auto qmlEngine = acquireEngine(_quickWindow);
|
||||
|
@ -691,7 +703,10 @@ void OffscreenQmlSurface::create() {
|
|||
// FIXME Compatibility mechanism for existing HTML and JS that uses eventBridgeWrapper
|
||||
// Find a way to flag older scripts using this mechanism and wanr that this is deprecated
|
||||
_qmlContext->setContextProperty("eventBridgeWrapper", new EventBridgeWrapper(this, _qmlContext));
|
||||
|
||||
#if !defined(DISABLE_QML)
|
||||
_renderControl->initialize(_canvas->getContext());
|
||||
#endif
|
||||
|
||||
#if !defined(Q_OS_ANDROID)
|
||||
// Connect with the audio client and listen for audio device changes
|
||||
|
@ -791,6 +806,7 @@ void OffscreenQmlSurface::resize(const QSize& newSize_, bool forceResize) {
|
|||
return;
|
||||
}
|
||||
|
||||
#if !defined(DISABLE_QML)
|
||||
qCDebug(uiLogging) << "Offscreen UI resizing to " << newSize.width() << "x" << newSize.height();
|
||||
gl::withSavedContext([&] {
|
||||
_canvas->makeCurrent();
|
||||
|
@ -827,6 +843,7 @@ void OffscreenQmlSurface::resize(const QSize& newSize_, bool forceResize) {
|
|||
|
||||
_canvas->doneCurrent();
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
QQuickItem* OffscreenQmlSurface::getRootItem() {
|
||||
|
@ -1009,7 +1026,9 @@ void OffscreenQmlSurface::updateQuick() {
|
|||
|
||||
if (_polish) {
|
||||
PROFILE_RANGE(render_qml, "OffscreenQML polish")
|
||||
#if !defined(DISABLE_QML)
|
||||
_renderControl->polishItems();
|
||||
#endif
|
||||
_polish = false;
|
||||
}
|
||||
|
||||
|
@ -1300,9 +1319,11 @@ bool OffscreenQmlSurface::isPaused() const {
|
|||
|
||||
void OffscreenQmlSurface::setProxyWindow(QWindow* window) {
|
||||
_proxyWindow = window;
|
||||
#if !defined(DISABLE_QML)
|
||||
if (_renderControl) {
|
||||
_renderControl->_renderWindow = window;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
QObject* OffscreenQmlSurface::getEventHandler() {
|
||||
|
@ -1514,4 +1535,4 @@ void OffscreenQmlSurface::sendToQml(const QVariant& message) {
|
|||
}
|
||||
|
||||
|
||||
#include "OffscreenQmlSurface.moc"
|
||||
#include "OffscreenQmlSurface.moc"
|
|
@ -168,10 +168,13 @@ public slots:
|
|||
|
||||
private:
|
||||
QQuickWindow* _quickWindow { nullptr };
|
||||
QMyQuickRenderControl* _renderControl{ nullptr };
|
||||
QQmlContext* _qmlContext { nullptr };
|
||||
QQuickItem* _rootItem { nullptr };
|
||||
|
||||
#if !defined(DISABLE_QML)
|
||||
QMyQuickRenderControl* _renderControl{ nullptr };
|
||||
OffscreenGLCanvas* _canvas { nullptr };
|
||||
#endif
|
||||
|
||||
QTimer _updateTimer;
|
||||
uint32_t _fbo { 0 };
|
||||
|
|
|
@ -19,9 +19,10 @@ if (WIN32 AND (NOT USE_GLES))
|
|||
set(TARGET_NAME oculus)
|
||||
setup_hifi_plugin(Multimedia)
|
||||
link_hifi_libraries(
|
||||
shared gl gpu gpu-gl controllers ui
|
||||
shared gl gpu controllers ui
|
||||
plugins ui-plugins display-plugins input-plugins
|
||||
audio-client networking render-utils
|
||||
${PLATFORM_GL_BACKEND}
|
||||
)
|
||||
include_hifi_library_headers(octree)
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <controllers/Pose.h>
|
||||
#include <display-plugins/CompositorHelper.h>
|
||||
#include <gpu/Frame.h>
|
||||
#include <gl/Config.h>
|
||||
|
||||
#include "OculusHelpers.h"
|
||||
|
||||
|
@ -92,9 +93,7 @@ glm::mat4 OculusBaseDisplayPlugin::getCullingProjection(const glm::mat4& basePro
|
|||
|
||||
// DLL based display plugins MUST initialize GLEW inside the DLL code.
|
||||
void OculusBaseDisplayPlugin::customizeContext() {
|
||||
glewExperimental = true;
|
||||
GLenum err = glewInit();
|
||||
glGetError(); // clear the potential error from glewExperimental
|
||||
gl::initModuleGl();
|
||||
Parent::customizeContext();
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ if (APPLE)
|
|||
|
||||
set(TARGET_NAME oculusLegacy)
|
||||
setup_hifi_plugin()
|
||||
link_hifi_libraries(shared gl gpu gpu-gl plugins ui ui-plugins display-plugins input-plugins midi)
|
||||
link_hifi_libraries(shared gl gpu plugins ui ui-plugins display-plugins input-plugins midi ${PLATFORM_GL_BACKEND})
|
||||
|
||||
include_hifi_library_headers(octree)
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ if (WIN32 AND (NOT USE_GLES))
|
|||
setup_hifi_plugin(OpenGL Script Qml Widgets Multimedia)
|
||||
link_hifi_libraries(shared gl networking controllers ui
|
||||
plugins display-plugins ui-plugins input-plugins script-engine
|
||||
audio-client render-utils model gpu gpu-gl render model-networking fbx ktx image procedural)
|
||||
audio-client render-utils model gpu render model-networking fbx ktx image procedural ${PLATFORM_GL_BACKEND})
|
||||
|
||||
include_hifi_library_headers(octree)
|
||||
|
||||
|
|
|
@ -175,12 +175,12 @@ public:
|
|||
while (!_queue.empty()) {
|
||||
auto& front = _queue.front();
|
||||
|
||||
auto result = glClientWaitSync(front.fence, 0, 0);
|
||||
auto result = glClientWaitSync((GLsync)front.fence, 0, 0);
|
||||
|
||||
if (GL_TIMEOUT_EXPIRED == result || GL_WAIT_FAILED == result) {
|
||||
break;
|
||||
} else if (GL_CONDITION_SATISFIED == result || GL_ALREADY_SIGNALED == result) {
|
||||
glDeleteSync(front.fence);
|
||||
glDeleteSync((GLsync)front.fence);
|
||||
} else {
|
||||
assert(false);
|
||||
}
|
||||
|
@ -510,14 +510,8 @@ void OpenVrDisplayPlugin::internalDeactivate() {
|
|||
}
|
||||
|
||||
void OpenVrDisplayPlugin::customizeContext() {
|
||||
// Display plugins in DLLs must initialize glew locally
|
||||
static std::once_flag once;
|
||||
std::call_once(once, [] {
|
||||
glewExperimental = true;
|
||||
GLenum err = glewInit();
|
||||
glGetError(); // clear the potential error from glewExperimental
|
||||
});
|
||||
|
||||
// Display plugins in DLLs must initialize GL locally
|
||||
gl::initModuleGl();
|
||||
Parent::customizeContext();
|
||||
|
||||
if (_threadedSubmit) {
|
||||
|
|
|
@ -27,9 +27,9 @@ struct CompositeInfo {
|
|||
using Array = std::array<CompositeInfo, COMPOSITING_BUFFER_SIZE>;
|
||||
|
||||
gpu::TexturePointer texture;
|
||||
GLuint textureID { 0 };
|
||||
uint32_t textureID { 0 };
|
||||
glm::mat4 pose;
|
||||
GLsync fence{ 0 };
|
||||
void* fence{ 0 };
|
||||
};
|
||||
|
||||
class OpenVrDisplayPlugin : public HmdDisplayPlugin {
|
||||
|
|
8
tests/gl/CMakeLists.txt
Normal file
8
tests/gl/CMakeLists.txt
Normal file
|
@ -0,0 +1,8 @@
|
|||
set(TARGET_NAME gl-test)
|
||||
# This is not a testcase -- just set it up as a regular hifi project
|
||||
setup_hifi_project(Quick Gui OpenGL)
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Tests/manual-tests/")
|
||||
link_hifi_libraries(shared gl)
|
||||
package_libraries_for_deployment()
|
||||
target_nsight()
|
||||
target_opengl()
|
43
tests/gl/src/main.cpp
Normal file
43
tests/gl/src/main.cpp
Normal file
|
@ -0,0 +1,43 @@
|
|||
//
|
||||
// Created by Bradley Austin Davis on 2018/01/11
|
||||
// Copyright 2014 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtCore/QTimer>
|
||||
#include <gl/Config.h>
|
||||
#include <gl/GLWindow.h>
|
||||
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
QGuiApplication app(argc, argv);
|
||||
|
||||
GLWindow* window = new GLWindow();
|
||||
window->create();
|
||||
window->show();
|
||||
bool contextCreated = false;
|
||||
QTimer* timer = new QTimer();
|
||||
QObject::connect(timer, &QTimer::timeout, [&] {
|
||||
if (!contextCreated) {
|
||||
window->createContext();
|
||||
contextCreated = true;
|
||||
}
|
||||
if (!window->makeCurrent()) {
|
||||
throw std::runtime_error("Failed");
|
||||
}
|
||||
glClearColor(1.0, 0.0, 1.0, 1.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
auto err = glGetError();
|
||||
|
||||
window->swapBuffers();
|
||||
window->doneCurrent();
|
||||
});
|
||||
|
||||
timer->setInterval(15);
|
||||
timer->setSingleShot(false);
|
||||
timer->start();
|
||||
app.exec();
|
||||
}
|
|
@ -4,7 +4,13 @@ AUTOSCRIBE_SHADER_LIB(gpu model render-utils)
|
|||
setup_hifi_project(Quick Gui OpenGL Script Widgets)
|
||||
setup_memory_debugger()
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Tests/manual-tests/")
|
||||
link_hifi_libraries(networking gl gpu gpu-gl procedural shared fbx model model-networking animation script-engine render render-utils octree image ktx)
|
||||
link_hifi_libraries(
|
||||
shared networking gl
|
||||
ktx gpu procedural octree image
|
||||
model model-networking fbx animation
|
||||
script-engine render render-utils
|
||||
${PLATFORM_GL_BACKEND}
|
||||
)
|
||||
|
||||
if (WIN32)
|
||||
add_dependency_external_projects(wasapi)
|
||||
|
|
|
@ -12,7 +12,15 @@ setup_hifi_project(Quick Gui OpenGL)
|
|||
set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Tests/manual-tests/")
|
||||
|
||||
# link in the shared libraries
|
||||
link_hifi_libraries(shared networking model fbx ktx image octree gl gpu gpu-gl render model-networking networking render-utils entities entities-renderer animation audio avatars script-engine physics procedural midi ui)
|
||||
link_hifi_libraries(
|
||||
shared networking animation
|
||||
ktx image octree gl gpu
|
||||
render render-utils
|
||||
model fbx model-networking
|
||||
entities entities-renderer audio avatars script-engine
|
||||
physics procedural midi ui
|
||||
${PLATFORM_GL_BACKEND}
|
||||
)
|
||||
|
||||
if (WIN32)
|
||||
target_link_libraries(${TARGET_NAME} Winmm.lib)
|
||||
|
|
|
@ -12,7 +12,15 @@ setup_hifi_project(Quick Gui OpenGL)
|
|||
set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Tests/manual-tests/")
|
||||
|
||||
# link in the shared libraries
|
||||
link_hifi_libraries(shared octree gl gpu gpu-gl render model model-networking networking render-utils fbx entities entities-renderer animation audio avatars script-engine physics ktx image)
|
||||
link_hifi_libraries(
|
||||
shared networking octree
|
||||
gl gpu render ktx image animation
|
||||
model fbx model-networking
|
||||
render-utils
|
||||
entities entities-renderer audio avatars
|
||||
script-engine physics
|
||||
${PLATFORM_GL_BACKEND}
|
||||
)
|
||||
|
||||
package_libraries_for_deployment()
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Tests/manual-tests/")
|
|||
setup_memory_debugger()
|
||||
|
||||
# link in the shared libraries
|
||||
link_hifi_libraries(render-utils gl gpu gpu-gl shared)
|
||||
link_hifi_libraries(render-utils gl gpu shared ${PLATFORM_GL_BACKEND})
|
||||
target_link_libraries(${TARGET_NAME} ${CMAKE_THREAD_LIBS_INIT})
|
||||
|
||||
if (WIN32)
|
||||
|
|
|
@ -8,9 +8,12 @@ set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Tests/manual-tests/")
|
|||
setup_memory_debugger()
|
||||
|
||||
# link in the shared libraries
|
||||
link_hifi_libraries(shared octree gl gpu gpu-gl model render fbx networking entities
|
||||
script-engine physics
|
||||
render-utils entities-renderer)
|
||||
link_hifi_libraries(
|
||||
shared octree gl gpu model render fbx networking entities
|
||||
script-engine physics
|
||||
render-utils entities-renderer
|
||||
${PLATFORM_GL_BACKEND}
|
||||
)
|
||||
|
||||
include_directories("${PROJECT_BINARY_DIR}/../../libraries/gpu/")
|
||||
include_directories("${PROJECT_BINARY_DIR}/../../libraries/render-utils/")
|
||||
|
|
Loading…
Reference in a new issue