OpenGL ES 2.0 Support fixes

Changed SDK logo to be POT for better compatibility with an OpenGL ES 2 context. Disabled Gamma correction in OpenGL ES 2.0 contexts. Added a flag to allow building only OpenGL ES 2.0 examples Fixed cases where a result of VK_SUBOPTIMAL_KHR would throw and exception.
parent fa7396af
...@@ -81,6 +81,11 @@ if(PVR_BUILD_EXAMPLES) ...@@ -81,6 +81,11 @@ if(PVR_BUILD_EXAMPLES)
option(PVR_BUILD_OPENGLES_EXAMPLES "Build the OpenGLES PowerVR SDK Examples - PVR_BUILD_EXAMPLES must also be enabled" OFF) option(PVR_BUILD_OPENGLES_EXAMPLES "Build the OpenGLES PowerVR SDK Examples - PVR_BUILD_EXAMPLES must also be enabled" OFF)
option(PVR_BUILD_VULKAN_EXAMPLES "Build the Vulkan PowerVR SDK Examples - PVR_BUILD_EXAMPLES must also be enabled" OFF) option(PVR_BUILD_VULKAN_EXAMPLES "Build the Vulkan PowerVR SDK Examples - PVR_BUILD_EXAMPLES must also be enabled" OFF)
option(PVR_BUILD_OPENCL_EXAMPLES "Build the OpenCL PowerVR SDK Examples - PVR_BUILD_EXAMPLES must also be enabled" OFF) option(PVR_BUILD_OPENCL_EXAMPLES "Build the OpenCL PowerVR SDK Examples - PVR_BUILD_EXAMPLES must also be enabled" OFF)
option(PVR_BUILD_OPENGLES2_EXAMPLES "Only build OpenGL ES 2.0 examples - PVR_BUILD_EXAMPLES must also be enabled. Assumes PVR_BUILD_OPENGLES_EXAMPLES to ON and disables Non-OpenGL ES examples as well." OFF)
if (PVR_BUILD_OPENGLES2_EXAMPLES)
set(PVR_BUILD_OPENGLES_EXAMPLES ON)
endif()
if(NOT PVR_BUILD_OPENGLES_EXAMPLES AND NOT PVR_BUILD_VULKAN_EXAMPLES AND NOT PVR_BUILD_OPENCL_EXAMPLES) if(NOT PVR_BUILD_OPENGLES_EXAMPLES AND NOT PVR_BUILD_VULKAN_EXAMPLES AND NOT PVR_BUILD_OPENCL_EXAMPLES)
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/examples/OpenGLES/CMakeLists.txt) if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/examples/OpenGLES/CMakeLists.txt)
......
...@@ -158,7 +158,8 @@ pvr::Result OpenGLESIntroducingPVRUtils::initView() ...@@ -158,7 +158,8 @@ pvr::Result OpenGLESIntroducingPVRUtils::initView()
pvr::utils::appendSingleBuffersFromModel(*_scene, _deviceResources->vbos, _deviceResources->ibos); pvr::utils::appendSingleBuffersFromModel(*_scene, _deviceResources->vbos, _deviceResources->ibos);
_deviceResources->uiRenderer.init(getWidth(), getHeight(), isFullScreen(), getBackBufferColorspace() == pvr::ColorSpace::sRGB); _deviceResources->uiRenderer.init(
getWidth(), getHeight(), isFullScreen(), (_deviceResources->context->getApiVersion() == pvr::Api::OpenGLES2) || (getBackBufferColorspace() == pvr::ColorSpace::sRGB));
_deviceResources->uiRenderer.getDefaultTitle()->setText("IntroducingPVRUtils"); _deviceResources->uiRenderer.getDefaultTitle()->setText("IntroducingPVRUtils");
_deviceResources->uiRenderer.getDefaultTitle()->commitUpdates(); _deviceResources->uiRenderer.getDefaultTitle()->commitUpdates();
...@@ -176,7 +177,8 @@ pvr::Result OpenGLESIntroducingPVRUtils::initView() ...@@ -176,7 +177,8 @@ pvr::Result OpenGLESIntroducingPVRUtils::initView()
{ {
// Gamma correct the clear color // Gamma correct the clear color
_clearColor = pvr::utils::convertLRGBtoSRGB(clearColorLinearSpace); _clearColor = pvr::utils::convertLRGBtoSRGB(clearColorLinearSpace);
numDefines = 0; // However, OpenGL ES2 should not be gamma corrected because the textures will unfortunately not be correctly read in linear values
if (_deviceResources->context->getApiVersion() > pvr::Api::OpenGLES2) { numDefines = 0; }
} }
GLuint program = _deviceResources->program = pvr::utils::createShaderProgram(*this, VertexShaderFile, FragmentShaderFile, attribs, attribIndices, 3, defines, numDefines); GLuint program = _deviceResources->program = pvr::utils::createShaderProgram(*this, VertexShaderFile, FragmentShaderFile, attribs, attribIndices, 3, defines, numDefines);
......
cmake_minimum_required(VERSION 3.3) cmake_minimum_required(VERSION 3.3)
project(OpenGLESExamples) project(OpenGLESExamples)
set(EXAMPLES if (PVR_BUILD_OPENGLES2_EXAMPLES)
01_HelloAPI set(EXAMPLES
02_IntroducingPVRShell 01_HelloAPI
03_IntroducingPVRUtils 02_IntroducingPVRShell
04_IntroducingUIRenderer 03_IntroducingPVRUtils
05_IntroducingPVRCamera 04_IntroducingUIRenderer
MultiviewVR 05_IntroducingPVRCamera
PostProcessing PVRScopeExample
OpenCLExample PVRScopeRemote
Skinning )
ParticleSystem else()
GaussianBlur set(EXAMPLES
Navigation2D 01_HelloAPI
Navigation3D 02_IntroducingPVRShell
DeferredShading 03_IntroducingPVRUtils
PVRScopeExample 04_IntroducingUIRenderer
PVRScopeRemote 05_IntroducingPVRCamera
IMGFramebufferDownsample MultiviewVR
IMGTextureFilterCubic PostProcessing
ImageBasedLighting OpenCLExample
) Skinning
ParticleSystem
GaussianBlur
Navigation2D
Navigation3D
DeferredShading
PVRScopeExample
PVRScopeRemote
IMGFramebufferDownsample
IMGTextureFilterCubic
ImageBasedLighting
)
endif()
foreach(EXAMPLE ${EXAMPLES}) foreach(EXAMPLE ${EXAMPLES})
message ("==>CMake generation for OpenGLES/${EXAMPLE}...") message ("==>CMake generation for OpenGLES/${EXAMPLE}...")
......
...@@ -52,8 +52,5 @@ void main() ...@@ -52,8 +52,5 @@ void main()
mediump vec3 specularColor = vec3(plasticSpecularIntensity) + metallicSpecularIntensity * albedo; mediump vec3 specularColor = vec3(plasticSpecularIntensity) + metallicSpecularIntensity * albedo;
color += specularColor; color += specularColor;
} }
#ifndef FRAMEBUFFER_SRGB
color = pow(color, vec3(0.4545454545)); // Do gamma correction
#endif
gl_FragColor = vec4(color, 1.); gl_FragColor = vec4(color, 1.);
} }
\ No newline at end of file
...@@ -59,8 +59,5 @@ void main() ...@@ -59,8 +59,5 @@ void main()
mediump vec3 specularColor = vec3(plasticSpecularIntensity) + metallicSpecularIntensity * albedo; mediump vec3 specularColor = vec3(plasticSpecularIntensity) + metallicSpecularIntensity * albedo;
color += specularColor; color += specularColor;
} }
#ifndef FRAMEBUFFER_SRGB
color = pow(color, vec3(0.4545454545)); // Gamma correction
#endif
gl_FragColor = vec4(color, 1.0); gl_FragColor = vec4(color, 1.0);
} }
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -111,7 +111,7 @@ void Queue_::present(const PresentInfo& presentInfo, Result* const results) ...@@ -111,7 +111,7 @@ void Queue_::present(const PresentInfo& presentInfo, Result* const results)
presentInfoVk.waitSemaphoreCount = presentInfo.numWaitSemaphores; presentInfoVk.waitSemaphoreCount = presentInfo.numWaitSemaphores;
presentInfoVk.pResults = (VkResult*)results; presentInfoVk.pResults = (VkResult*)results;
vkThrowIfFailed(getDevice()->getVkBindings().vkQueuePresentKHR(getVkHandle(), &presentInfoVk), "Error in queue present"); vkThrowIfError(static_cast<pvrvk::Result>(getDevice()->getVkBindings().vkQueuePresentKHR(getVkHandle(), &presentInfoVk)), "Error in queue present");
} }
void Queue_::waitIdle() { vkThrowIfFailed(getDevice()->getVkBindings().vkQueueWaitIdle(getVkHandle()), "Queue::waitIdle - error in preceeding command."); } void Queue_::waitIdle() { vkThrowIfFailed(getDevice()->getVkBindings().vkQueueWaitIdle(getVkHandle()), "Queue::waitIdle - error in preceeding command."); }
......
...@@ -21,15 +21,15 @@ ...@@ -21,15 +21,15 @@
*****************************************************************************/ *****************************************************************************/
#define PVRSDK_VERSION "5.1" #define PVRSDK_VERSION "5.1"
#define PVRSDK_BUILD "19.2@5544206" #define PVRSDK_BUILD "19.2@5562047"
#define PVRVERSION_MAJ "19" #define PVRVERSION_MAJ "19"
#define PVRVERSION_MIN "2" #define PVRVERSION_MIN "2"
#define PVRVERSION_BRANCH "192" #define PVRVERSION_BRANCH "192"
#define PVRVERSION_BRANCH_DEC "19.2" #define PVRVERSION_BRANCH_DEC "19.2"
#define PVRVERSION_BRANCH_NAME "REL/19.2" #define PVRVERSION_BRANCH_NAME "REL/19.2"
#define PVRVERSION_BUILD "5544206" #define PVRVERSION_BUILD "5562047"
#define PVRVERSION_BUILD_HI "554" #define PVRVERSION_BUILD_HI "556"
#define PVRVERSION_BUILD_LO "4206" #define PVRVERSION_BUILD_LO "2047"
#define PVRSDK_COPYRIGHT_TXT "Copyright (c) Imagination Technologies Ltd. All Rights Reserved." #define PVRSDK_COPYRIGHT_TXT "Copyright (c) Imagination Technologies Ltd. All Rights Reserved."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment