From: Gurchetan Singh Date: Tue, 7 Nov 2017 20:47:47 +0000 (+0000) Subject: Lower correlation threshold in flush-finish tests again am: 6455e6f987 am: 2e18b48b04... X-Git-Tag: upstream/1.3.5~1974^2~8^2~105^2~89 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6a46f98d8d09ba6ca77700e693b8ad5cec55c02e;hp=3883c129f0b956d97a8b0e773aaaef364076b1b2;p=platform%2Fupstream%2FVK-GL-CTS.git Lower correlation threshold in flush-finish tests again am: 6455e6f987 am: 2e18b48b04 am: b31b60abe6 am: da172c6afd am: ed080cc354 am: 4d5a25b142 am: 3883c129f0 Change-Id: I75ece02330dcfbd2606e9587d59886b92fb7c3f6 --- diff --git a/Android.mk b/Android.mk index 7d60924..07c3086 100644 --- a/Android.mk +++ b/Android.mk @@ -1027,6 +1027,8 @@ deqp_compile_flags := \ -DDEQP_GLES3_RUNTIME_LOAD=1 \ -DDEQP_GLES2_RUNTIME_LOAD=1 \ -DQP_SUPPORT_PNG=1 \ + -Wall \ + -Werror \ -Wconversion \ -fwrapv \ -Wno-sign-conversion @@ -1052,6 +1054,11 @@ LOCAL_CPPFLAGS += -Wno-non-virtual-dtor -Wno-delete-non-virtual-dtor LOCAL_NDK_STL_VARIANT := gnustl_static LOCAL_RTTI_FLAG := -frtti -fexceptions LOCAL_MULTILIB := both +LOCAL_TIDY_CHECKS := \ + -google-build-explicit-make-pair, \ + -google-global-names-in-headers, \ + -google-runtime-member-string-references, \ + -google-runtime-operator, \ include $(BUILD_SHARED_LIBRARY) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ecdd52..445cf7c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,8 +57,14 @@ endif () include_directories(${ZLIB_INCLUDE_PATH}) # libpng -find_path(PNG_INCLUDE_PATH png.h) -find_library(PNG_LIBRARY png) +# +# The FindPNG module defines PNG_INCLUDE_DIRS and PNG_LIBRARIES. But dEQP's +# CMake files expect the non-standard PNG_INCLUDE_PATH and PNG_LIBRARY. Set the +# non-standard variables here to retain compatibility with dEQP's existing +# CMake files. +include(FindPNG) +set(PNG_INCLUDE_PATH ${PNG_INCLUDE_DIRS}) +set(PNG_LIBRARY ${PNG_LIBRARIES}) if (NOT PNG_INCLUDE_PATH OR NOT PNG_LIBRARY) message(STATUS "System version of libpng not found, using external/libpng") diff --git a/OWNERS b/OWNERS index 03695dd..579961c 100644 --- a/OWNERS +++ b/OWNERS @@ -1,4 +1,7 @@ -phaulos@google.com tinazh@google.com -misojarvi@google.com -kraita@google.com +chrisforbes@google.com + +# We miss you +# phaulos@google.com +# kraita@google.com +# misojarvi@google.com diff --git a/android/cts/master/gles31-master.txt b/android/cts/master/gles31-master.txt index f5c06b0..34db622 100644 --- a/android/cts/master/gles31-master.txt +++ b/android/cts/master/gles31-master.txt @@ -16645,7 +16645,6 @@ dEQP-GLES31.functional.debug.negative_coverage.callbacks.vertex_array.draw_array dEQP-GLES31.functional.debug.negative_coverage.callbacks.vertex_array.draw_arrays_incomplete_primitive dEQP-GLES31.functional.debug.negative_coverage.callbacks.vertex_array.draw_elements dEQP-GLES31.functional.debug.negative_coverage.callbacks.vertex_array.draw_elements_base_vertex -dEQP-GLES31.functional.debug.negative_coverage.callbacks.vertex_array.draw_elements_base_vertex_invalid_map dEQP-GLES31.functional.debug.negative_coverage.callbacks.vertex_array.draw_elements_base_vertex_primitive_mode_mismatch dEQP-GLES31.functional.debug.negative_coverage.callbacks.vertex_array.draw_elements_invalid_program dEQP-GLES31.functional.debug.negative_coverage.callbacks.vertex_array.draw_elements_incomplete_primitive @@ -16656,13 +16655,11 @@ dEQP-GLES31.functional.debug.negative_coverage.callbacks.vertex_array.draw_eleme dEQP-GLES31.functional.debug.negative_coverage.callbacks.vertex_array.draw_elements_instanced_invalid_program dEQP-GLES31.functional.debug.negative_coverage.callbacks.vertex_array.draw_elements_instanced_incomplete_primitive dEQP-GLES31.functional.debug.negative_coverage.callbacks.vertex_array.draw_elements_instanced_base_vertex -dEQP-GLES31.functional.debug.negative_coverage.callbacks.vertex_array.draw_elements_instanced_base_vertex_invalid_map dEQP-GLES31.functional.debug.negative_coverage.callbacks.vertex_array.draw_elements_instanced_base_vertex_primitive_mode_mismatch dEQP-GLES31.functional.debug.negative_coverage.callbacks.vertex_array.draw_range_elements dEQP-GLES31.functional.debug.negative_coverage.callbacks.vertex_array.draw_range_elements_invalid_program dEQP-GLES31.functional.debug.negative_coverage.callbacks.vertex_array.draw_range_elements_incomplete_primitive dEQP-GLES31.functional.debug.negative_coverage.callbacks.vertex_array.draw_range_elements_base_vertex -dEQP-GLES31.functional.debug.negative_coverage.callbacks.vertex_array.draw_range_elements_base_vertex_invalid_map dEQP-GLES31.functional.debug.negative_coverage.callbacks.vertex_array.draw_range_elements_base_vertex_primitive_mode_mismatch dEQP-GLES31.functional.debug.negative_coverage.callbacks.state.enable dEQP-GLES31.functional.debug.negative_coverage.callbacks.state.disable @@ -17146,7 +17143,6 @@ dEQP-GLES31.functional.debug.negative_coverage.log.vertex_array.draw_arrays_inva dEQP-GLES31.functional.debug.negative_coverage.log.vertex_array.draw_arrays_incomplete_primitive dEQP-GLES31.functional.debug.negative_coverage.log.vertex_array.draw_elements dEQP-GLES31.functional.debug.negative_coverage.log.vertex_array.draw_elements_base_vertex -dEQP-GLES31.functional.debug.negative_coverage.log.vertex_array.draw_elements_base_vertex_invalid_map dEQP-GLES31.functional.debug.negative_coverage.log.vertex_array.draw_elements_base_vertex_primitive_mode_mismatch dEQP-GLES31.functional.debug.negative_coverage.log.vertex_array.draw_elements_invalid_program dEQP-GLES31.functional.debug.negative_coverage.log.vertex_array.draw_elements_incomplete_primitive @@ -17157,13 +17153,11 @@ dEQP-GLES31.functional.debug.negative_coverage.log.vertex_array.draw_elements_in dEQP-GLES31.functional.debug.negative_coverage.log.vertex_array.draw_elements_instanced_invalid_program dEQP-GLES31.functional.debug.negative_coverage.log.vertex_array.draw_elements_instanced_incomplete_primitive dEQP-GLES31.functional.debug.negative_coverage.log.vertex_array.draw_elements_instanced_base_vertex -dEQP-GLES31.functional.debug.negative_coverage.log.vertex_array.draw_elements_instanced_base_vertex_invalid_map dEQP-GLES31.functional.debug.negative_coverage.log.vertex_array.draw_elements_instanced_base_vertex_primitive_mode_mismatch dEQP-GLES31.functional.debug.negative_coverage.log.vertex_array.draw_range_elements dEQP-GLES31.functional.debug.negative_coverage.log.vertex_array.draw_range_elements_invalid_program dEQP-GLES31.functional.debug.negative_coverage.log.vertex_array.draw_range_elements_incomplete_primitive dEQP-GLES31.functional.debug.negative_coverage.log.vertex_array.draw_range_elements_base_vertex -dEQP-GLES31.functional.debug.negative_coverage.log.vertex_array.draw_range_elements_base_vertex_invalid_map dEQP-GLES31.functional.debug.negative_coverage.log.vertex_array.draw_range_elements_base_vertex_primitive_mode_mismatch dEQP-GLES31.functional.debug.negative_coverage.log.state.enable dEQP-GLES31.functional.debug.negative_coverage.log.state.disable @@ -17646,7 +17640,6 @@ dEQP-GLES31.functional.debug.negative_coverage.get_error.vertex_array.draw_array dEQP-GLES31.functional.debug.negative_coverage.get_error.vertex_array.draw_arrays_incomplete_primitive dEQP-GLES31.functional.debug.negative_coverage.get_error.vertex_array.draw_elements dEQP-GLES31.functional.debug.negative_coverage.get_error.vertex_array.draw_elements_base_vertex -dEQP-GLES31.functional.debug.negative_coverage.get_error.vertex_array.draw_elements_base_vertex_invalid_map dEQP-GLES31.functional.debug.negative_coverage.get_error.vertex_array.draw_elements_base_vertex_primitive_mode_mismatch dEQP-GLES31.functional.debug.negative_coverage.get_error.vertex_array.draw_elements_invalid_program dEQP-GLES31.functional.debug.negative_coverage.get_error.vertex_array.draw_elements_incomplete_primitive @@ -17657,13 +17650,11 @@ dEQP-GLES31.functional.debug.negative_coverage.get_error.vertex_array.draw_eleme dEQP-GLES31.functional.debug.negative_coverage.get_error.vertex_array.draw_elements_instanced_invalid_program dEQP-GLES31.functional.debug.negative_coverage.get_error.vertex_array.draw_elements_instanced_incomplete_primitive dEQP-GLES31.functional.debug.negative_coverage.get_error.vertex_array.draw_elements_instanced_base_vertex -dEQP-GLES31.functional.debug.negative_coverage.get_error.vertex_array.draw_elements_instanced_base_vertex_invalid_map dEQP-GLES31.functional.debug.negative_coverage.get_error.vertex_array.draw_elements_instanced_base_vertex_primitive_mode_mismatch dEQP-GLES31.functional.debug.negative_coverage.get_error.vertex_array.draw_range_elements dEQP-GLES31.functional.debug.negative_coverage.get_error.vertex_array.draw_range_elements_invalid_program dEQP-GLES31.functional.debug.negative_coverage.get_error.vertex_array.draw_range_elements_incomplete_primitive dEQP-GLES31.functional.debug.negative_coverage.get_error.vertex_array.draw_range_elements_base_vertex -dEQP-GLES31.functional.debug.negative_coverage.get_error.vertex_array.draw_range_elements_base_vertex_invalid_map dEQP-GLES31.functional.debug.negative_coverage.get_error.vertex_array.draw_range_elements_base_vertex_primitive_mode_mismatch dEQP-GLES31.functional.debug.negative_coverage.get_error.state.enable dEQP-GLES31.functional.debug.negative_coverage.get_error.state.disable diff --git a/framework/common/tcuFuzzyImageCompare.cpp b/framework/common/tcuFuzzyImageCompare.cpp index 596ab83..4e76476 100644 --- a/framework/common/tcuFuzzyImageCompare.cpp +++ b/framework/common/tcuFuzzyImageCompare.cpp @@ -318,7 +318,7 @@ float fuzzyCompare (const FuzzyCompareParams& params, const ConstPixelBufferAcce for (int y = 1; y < height-1; y++) { - for (int x = 1; x < width-1; x += params.maxSampleSkip > 0 ? (int)rnd.getInt(0, params.maxSampleSkip) : 1) + for (int x = 1; x < width-1; x += 1 + (int)rnd.getInt(0, params.maxSampleSkip)) { const deUint32 minDist2RefToCmp = distSquaredToNeighbor<4>(rnd, readUnorm8<4>(refAccess, x, y), cmpAccess, x, y); const deUint32 minDist2CmpToRef = distSquaredToNeighbor<4>(rnd, readUnorm8<4>(cmpAccess, x, y), refAccess, x, y); diff --git a/framework/delibs/cmake/CFlags.cmake b/framework/delibs/cmake/CFlags.cmake index 8a4b9ad..bcb11ab 100644 --- a/framework/delibs/cmake/CFlags.cmake +++ b/framework/delibs/cmake/CFlags.cmake @@ -53,6 +53,11 @@ if (DE_COMPILER_IS_GCC OR DE_COMPILER_IS_CLANG) # Turn on -Wstrict-overflow=5 and check all warnings before removing set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fwrapv") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fwrapv") + + # Force compiler to not export any symbols. + # Any static libraries build are linked into the standalone executable binaries. + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden") elseif (DE_COMPILER_IS_MSC) # Compiler flags for msc diff --git a/framework/platform/CMakeLists.txt b/framework/platform/CMakeLists.txt index d13f8c9..77a5447 100644 --- a/framework/platform/CMakeLists.txt +++ b/framework/platform/CMakeLists.txt @@ -83,6 +83,12 @@ if (NOT DEFINED TCUTIL_PLATFORM_SRCS) include_directories(wayland) endif() + elseif (DE_OS_IS_UNIX AND DEQP_USE_SURFACELESS) + set(TCUTIL_PLATFORM_SRCS + surfaceless/tcuSurfacelessPlatform.hpp + surfaceless/tcuSurfacelessPlatform.cpp + ) + elseif (DE_OS_IS_ANDROID) set(TCUTIL_PLATFORM_SRCS android/tcuAndroidExecService.cpp diff --git a/framework/platform/android/tcuAndroidMain.cpp b/framework/platform/android/tcuAndroidMain.cpp index fa14c1e..620b9f6 100644 --- a/framework/platform/android/tcuAndroidMain.cpp +++ b/framework/platform/android/tcuAndroidMain.cpp @@ -34,7 +34,7 @@ DE_BEGIN_EXTERN_C -void createTestActivity (ANativeActivity* activity, void* savedState, size_t savedStateSize) +JNIEXPORT void JNICALL createTestActivity (ANativeActivity* activity, void* savedState, size_t savedStateSize) { DE_UNREF(savedState && savedStateSize); try diff --git a/framework/platform/surfaceless/tcuSurfacelessPlatform.cpp b/framework/platform/surfaceless/tcuSurfacelessPlatform.cpp new file mode 100644 index 0000000..f1fb2d5 --- /dev/null +++ b/framework/platform/surfaceless/tcuSurfacelessPlatform.cpp @@ -0,0 +1,476 @@ +/*------------------------------------------------------------------------- + * drawElements Quality Program Tester Core + * ---------------------------------------- + * + * Copyright 2015 Intel Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *//*! + * \file + * \brief surfaceless platform + *//*--------------------------------------------------------------------*/ + +#include "tcuSurfacelessPlatform.hpp" + +#include +#include +#include + +#include "deDynamicLibrary.hpp" +#include "deMemory.h" +#include "deSTLUtil.hpp" +#include "egluUtil.hpp" +#include "egluGLUtil.hpp" +#include "eglwEnums.hpp" +#include "eglwLibrary.hpp" +#include "gluPlatform.hpp" +#include "gluRenderConfig.hpp" +#include "glwInitES20Direct.hpp" +#include "glwInitES30Direct.hpp" +#include "glwInitFunctions.hpp" +#include "tcuFunctionLibrary.hpp" +#include "tcuPixelFormat.hpp" +#include "tcuPlatform.hpp" +#include "tcuRenderTarget.hpp" +#include "vkPlatform.hpp" + +#include + +using std::string; +using std::vector; + +#if !defined(EGL_KHR_create_context) + #define EGL_CONTEXT_FLAGS_KHR 0x30FC + #define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098 + #define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB + #define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002 + #define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001 + #define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001 + #define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002 + #define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD + #define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD + #define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004 + #define EGL_KHR_create_context 1 + #define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF + #define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE + #define EGL_OPENGL_ES3_BIT_KHR 0x00000040 +#endif // EGL_KHR_create_context + +// Default library names +#if !defined(DEQP_GLES2_LIBRARY_PATH) +# define DEQP_GLES2_LIBRARY_PATH "libGLESv2.so" +#endif + +#if !defined(DEQP_GLES3_LIBRARY_PATH) +# define DEQP_GLES3_LIBRARY_PATH DEQP_GLES2_LIBRARY_PATH +#endif + +#if !defined(DEQP_OPENGL_LIBRARY_PATH) +# define DEQP_OPENGL_LIBRARY_PATH "libGL.so" +#endif + +namespace tcu +{ +namespace surfaceless +{ + +class VulkanLibrary : public vk::Library +{ +public: + VulkanLibrary (void) + : m_library ("libvulkan.so.1") + , m_driver (m_library) + { + } + + const vk::PlatformInterface& getPlatformInterface (void) const + { + return m_driver; + } + +private: + const tcu::DynamicFunctionLibrary m_library; + const vk::PlatformDriver m_driver; +}; + +// Copied from tcuX11Platform.cpp +class VulkanPlatform : public vk::Platform +{ +public: + vk::Library* createLibrary (void) const + { + return new VulkanLibrary(); + } + + void describePlatform (std::ostream& dst) const + { + utsname sysInfo; + + deMemset(&sysInfo, 0, sizeof(sysInfo)); + + if (uname(&sysInfo) != 0) + throw std::runtime_error("uname() failed"); + + dst << "OS: " << sysInfo.sysname << " " << sysInfo.release << " " << sysInfo.version << "\n"; + dst << "CPU: " << sysInfo.machine << "\n"; + } + + // FINISHME: Query actual memory limits. + // + // These hard-coded memory limits were copied from tcuX11Platform.cpp, + // and they work well enough for Intel platforms. + void getMemoryLimits (vk::PlatformMemoryLimits& limits) const + { + limits.totalSystemMemory = 256*1024*1024; + limits.totalDeviceLocalMemory = 128*1024*1024; + limits.deviceMemoryAllocationGranularity = 64*1024; + limits.devicePageSize = 4096; + limits.devicePageTableEntrySize = 8; + limits.devicePageTableHierarchyLevels = 3; + } +}; + +bool isEGLExtensionSupported( + const eglw::Library& egl, + eglw::EGLDisplay display, + const std::string& extName) +{ + const vector exts = eglu::getClientExtensions(egl); + return de::contains(exts.begin(), exts.end(), extName); +} + +class GetProcFuncLoader : public glw::FunctionLoader +{ +public: + GetProcFuncLoader(const eglw::Library& egl): m_egl(egl) + { + } + + glw::GenericFuncType get(const char* name) const + { + return (glw::GenericFuncType)m_egl.getProcAddress(name); + } +protected: + const eglw::Library& m_egl; +}; + +class DynamicFuncLoader : public glw::FunctionLoader +{ +public: + DynamicFuncLoader(de::DynamicLibrary* library): m_library(library) + { + } + + glw::GenericFuncType get(const char* name) const + { + return (glw::GenericFuncType)m_library->getFunction(name); + } + +private: + de::DynamicLibrary* m_library; +}; + +class Platform : public tcu::Platform, public glu::Platform +{ +public: + Platform (void); + const glu::Platform& getGLPlatform (void) const { return *this; } + const vk::Platform& getVulkanPlatform (void) const { return m_vkPlatform; } + +private: + VulkanPlatform m_vkPlatform; +}; + +class ContextFactory : public glu::ContextFactory +{ +public: + ContextFactory (void); + glu::RenderContext* createContext (const glu::RenderConfig& config, const tcu::CommandLine& cmdLine) const; +}; + +class EglRenderContext : public glu::RenderContext +{ +public: + EglRenderContext(const glu::RenderConfig& config, const tcu::CommandLine& cmdLine); + ~EglRenderContext(void); + + glu::ContextType getType (void) const { return m_contextType; } + const glw::Functions& getFunctions (void) const { return m_glFunctions; } + const tcu::RenderTarget& getRenderTarget (void) const; + void postIterate (void); + +private: + const eglw::DefaultLibrary m_egl; + const glu::ContextType m_contextType; + eglw::EGLDisplay m_eglDisplay; + eglw::EGLContext m_eglContext; + de::DynamicLibrary* m_glLibrary; + glw::Functions m_glFunctions; + tcu::RenderTarget m_renderTarget; +}; + +Platform::Platform(void) +{ + m_contextFactoryRegistry.registerFactory(new ContextFactory()); +} + +ContextFactory::ContextFactory() + : glu::ContextFactory("default", "EGL surfaceless context") +{} + +glu::RenderContext* ContextFactory::createContext(const glu::RenderConfig& config, const tcu::CommandLine& cmdLine) const +{ + return new EglRenderContext(config, cmdLine); +} + +EglRenderContext::EglRenderContext(const glu::RenderConfig& config, const tcu::CommandLine& cmdLine) + : m_egl("libEGL.so") + , m_contextType(config.type) + , m_eglDisplay(EGL_NO_DISPLAY) + , m_eglContext(EGL_NO_CONTEXT) + , m_renderTarget( + config.width, + config.height, + tcu::PixelFormat( + config.redBits, + config.greenBits, + config.blueBits, + config.alphaBits), + config.depthBits, + config.stencilBits, + config.numSamples) + +{ + vector context_attribs; + vector frame_buffer_attribs; + vector surface_attribs; + + const glu::ContextType& contextType = config.type; + eglw::EGLint eglMajorVersion; + eglw::EGLint eglMinorVersion; + eglw::EGLint flags = 0; + eglw::EGLint num_configs; + eglw::EGLConfig egl_config; + eglw::EGLSurface egl_surface; + + (void) cmdLine; + + m_eglDisplay = m_egl.getDisplay(NULL); + EGLU_CHECK_MSG(m_egl, "eglGetDisplay()"); + if (m_eglDisplay == EGL_NO_DISPLAY) + throw tcu::ResourceError("eglGetDisplay() failed"); + + EGLU_CHECK_CALL(m_egl, initialize(m_eglDisplay, &eglMajorVersion, &eglMinorVersion)); + + frame_buffer_attribs.push_back(EGL_RENDERABLE_TYPE); + switch(contextType.getMajorVersion()) + { + case 3: + frame_buffer_attribs.push_back(EGL_OPENGL_ES3_BIT); + break; + case 2: + frame_buffer_attribs.push_back(EGL_OPENGL_ES2_BIT); + break; + default: + frame_buffer_attribs.push_back(EGL_OPENGL_ES_BIT); + } + + frame_buffer_attribs.push_back(EGL_SURFACE_TYPE); + switch (config.surfaceType) + { + case glu::RenderConfig::SURFACETYPE_DONT_CARE: + frame_buffer_attribs.push_back(EGL_DONT_CARE); + break; + case glu::RenderConfig::SURFACETYPE_OFFSCREEN_NATIVE: + break; + case glu::RenderConfig::SURFACETYPE_OFFSCREEN_GENERIC: + frame_buffer_attribs.push_back(EGL_PBUFFER_BIT); + surface_attribs.push_back(EGL_WIDTH); + surface_attribs.push_back(config.width); + surface_attribs.push_back(EGL_HEIGHT); + surface_attribs.push_back(config.height); + break; + case glu::RenderConfig::SURFACETYPE_WINDOW: + throw tcu::NotSupportedError("surfaceless platform does not support --deqp-surface-type=window"); + case glu::RenderConfig::SURFACETYPE_LAST: + TCU_CHECK_INTERNAL(false); + } + + surface_attribs.push_back(EGL_NONE); + + frame_buffer_attribs.push_back(EGL_RED_SIZE); + frame_buffer_attribs.push_back(config.redBits); + + frame_buffer_attribs.push_back(EGL_GREEN_SIZE); + frame_buffer_attribs.push_back(config.greenBits); + + frame_buffer_attribs.push_back(EGL_BLUE_SIZE); + frame_buffer_attribs.push_back(config.blueBits); + + frame_buffer_attribs.push_back(EGL_ALPHA_SIZE); + frame_buffer_attribs.push_back(config.alphaBits); + + frame_buffer_attribs.push_back(EGL_DEPTH_SIZE); + frame_buffer_attribs.push_back(config.depthBits); + + frame_buffer_attribs.push_back(EGL_STENCIL_SIZE); + frame_buffer_attribs.push_back(config.stencilBits); + + frame_buffer_attribs.push_back(EGL_NONE); + + if (!eglChooseConfig(m_eglDisplay, &frame_buffer_attribs[0], NULL, 0, &num_configs)) + throw tcu::ResourceError("surfaceless couldn't find any config"); + + if (!eglChooseConfig(m_eglDisplay, &frame_buffer_attribs[0], &egl_config, 1, &num_configs)) + throw tcu::ResourceError("surfaceless couldn't find any config"); + + switch (config.surfaceType) + { + case glu::RenderConfig::SURFACETYPE_DONT_CARE: + egl_surface = EGL_NO_SURFACE; + break; + case glu::RenderConfig::SURFACETYPE_OFFSCREEN_GENERIC: + egl_surface = eglCreatePbufferSurface(m_eglDisplay, egl_config, &surface_attribs[0]); + break; + } + + context_attribs.push_back(EGL_CONTEXT_MAJOR_VERSION_KHR); + context_attribs.push_back(contextType.getMajorVersion()); + context_attribs.push_back(EGL_CONTEXT_MINOR_VERSION_KHR); + context_attribs.push_back(contextType.getMinorVersion()); + + switch (contextType.getProfile()) + { + case glu::PROFILE_ES: + EGLU_CHECK_CALL(m_egl, bindAPI(EGL_OPENGL_ES_API)); + break; + case glu::PROFILE_CORE: + EGLU_CHECK_CALL(m_egl, bindAPI(EGL_OPENGL_API)); + context_attribs.push_back(EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR); + context_attribs.push_back(EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR); + break; + case glu::PROFILE_COMPATIBILITY: + EGLU_CHECK_CALL(m_egl, bindAPI(EGL_OPENGL_API)); + context_attribs.push_back(EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR); + context_attribs.push_back(EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR); + break; + case glu::PROFILE_LAST: + TCU_CHECK_INTERNAL(false); + } + + if ((contextType.getFlags() & glu::CONTEXT_DEBUG) != 0) + flags |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR; + + if ((contextType.getFlags() & glu::CONTEXT_ROBUST) != 0) + flags |= EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR; + + if ((contextType.getFlags() & glu::CONTEXT_FORWARD_COMPATIBLE) != 0) + flags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR; + + context_attribs.push_back(EGL_CONTEXT_FLAGS_KHR); + context_attribs.push_back(flags); + + context_attribs.push_back(EGL_NONE); + + m_eglContext = m_egl.createContext(m_eglDisplay, egl_config, EGL_NO_CONTEXT, &context_attribs[0]); + EGLU_CHECK_MSG(m_egl, "eglCreateContext()"); + if (!m_eglContext) + throw tcu::ResourceError("eglCreateContext failed"); + + EGLU_CHECK_CALL(m_egl, makeCurrent(m_eglDisplay, egl_surface, egl_surface, m_eglContext)); + + if ((eglMajorVersion == 1 && eglMinorVersion >= 5) || + isEGLExtensionSupported(m_egl, m_eglDisplay, "EGL_KHR_get_all_proc_addresses") || + isEGLExtensionSupported(m_egl, EGL_NO_DISPLAY, "EGL_KHR_client_get_all_proc_addresses")) + { + // Use eglGetProcAddress() for core functions + GetProcFuncLoader funcLoader(m_egl); + glu::initCoreFunctions(&m_glFunctions, &funcLoader, contextType.getAPI()); + } +#if !defined(DEQP_GLES2_RUNTIME_LOAD) + else if (contextType.getAPI() == glu::ApiType::es(2,0)) + { + glw::initES20Direct(&m_glFunctions); + } +#endif +#if !defined(DEQP_GLES3_RUNTIME_LOAD) + else if (contextType.getAPI() == glu::ApiType::es(3,0)) + { + glw::initES30Direct(&m_glFunctions); + } +#endif + else + { + const char* libraryPath = NULL; + + if (glu::isContextTypeES(contextType)) + { + if (contextType.getMinorVersion() <= 2) + libraryPath = DEQP_GLES2_LIBRARY_PATH; + else + libraryPath = DEQP_GLES3_LIBRARY_PATH; + } + else + { + libraryPath = DEQP_OPENGL_LIBRARY_PATH; + } + + m_glLibrary = new de::DynamicLibrary(libraryPath); + + DynamicFuncLoader funcLoader(m_glLibrary); + glu::initCoreFunctions(&m_glFunctions, &funcLoader, contextType.getAPI()); + } + + { + GetProcFuncLoader extLoader(m_egl); + glu::initExtensionFunctions(&m_glFunctions, &extLoader, contextType.getAPI()); + } +} + +EglRenderContext::~EglRenderContext(void) +{ + try + { + if (m_eglDisplay != EGL_NO_DISPLAY) + { + EGLU_CHECK_CALL(m_egl, makeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)); + + if (m_eglContext != EGL_NO_CONTEXT) + EGLU_CHECK_CALL(m_egl, destroyContext(m_eglDisplay, m_eglContext)); + } + + EGLU_CHECK_CALL(m_egl, terminate(m_eglDisplay)); + } + catch (...) + { + } +} + +const tcu::RenderTarget& EglRenderContext::getRenderTarget(void) const +{ + return m_renderTarget; +} + +void EglRenderContext::postIterate(void) +{ + this->getFunctions().finish(); +} + +} // namespace surfaceless +} // namespace tcu + +tcu::Platform* createPlatform(void) +{ + return new tcu::surfaceless::Platform(); +} diff --git a/framework/platform/surfaceless/tcuSurfacelessPlatform.hpp b/framework/platform/surfaceless/tcuSurfacelessPlatform.hpp new file mode 100644 index 0000000..81978a3 --- /dev/null +++ b/framework/platform/surfaceless/tcuSurfacelessPlatform.hpp @@ -0,0 +1,34 @@ +#ifndef _TCUSURFACELESSPLATFORM_HPP +#define _TCUSURFACELESSPLATFORM_HPP + +/*------------------------------------------------------------------------- + * drawElements Quality Program Tester Core + * ---------------------------------------- + * + * Copyright 2015 Intel Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *//*! + * \file + * \brief DRM platform + *//*--------------------------------------------------------------------*/ + +namespace tcu +{ + class Platform; +} + +tcu::Platform* createPlatform (void); + +#endif // _TCUSURFACELESSPLATFORM_HPP diff --git a/modules/egl/teglColorClearCase.cpp b/modules/egl/teglColorClearCase.cpp index 8ae8b4c..92cbd8f 100644 --- a/modules/egl/teglColorClearCase.cpp +++ b/modules/egl/teglColorClearCase.cpp @@ -310,6 +310,7 @@ public: // Signal completion. packetIter->signal->increment(); } + m_egl.releaseThread(); } private: diff --git a/modules/egl/teglGLES2SharedRenderingPerfTests.cpp b/modules/egl/teglGLES2SharedRenderingPerfTests.cpp index bc13aad..7d334c9 100644 --- a/modules/egl/teglGLES2SharedRenderingPerfTests.cpp +++ b/modules/egl/teglGLES2SharedRenderingPerfTests.cpp @@ -717,7 +717,7 @@ void TestContext::render (void) class TestThread : de::Thread { public: - TestThread (const vector contexts); + TestThread (const vector contexts, const Library& egl); ~TestThread (void); void start (void); @@ -727,6 +727,7 @@ public: private: vector m_contexts; + const Library& m_egl; bool m_isOk; string m_errorString; @@ -746,8 +747,9 @@ private: TestThread (const TestThread&); }; -TestThread::TestThread (const vector contexts) +TestThread::TestThread (const vector contexts, const Library& egl) : m_contexts (contexts) + , m_egl (egl) , m_isOk (false) , m_errorString ("") , m_beginTimeUs (0) @@ -800,6 +802,8 @@ void TestThread::run (void) m_isOk = false; m_errorString = "Got unknown exception"; } + + m_egl.releaseThread(); } class SharedRenderingPerfCase : public TestCase @@ -879,7 +883,7 @@ void SharedRenderingPerfCase::deinit (void) namespace { -void createThreads (vector& threads, int threadCount, int perThreadContextCount, vector& contexts) +void createThreads (vector& threads, int threadCount, int perThreadContextCount, vector& contexts, const Library& egl) { DE_ASSERT(threadCount * perThreadContextCount == (int)contexts.size()); DE_ASSERT(threads.empty()); @@ -891,7 +895,7 @@ void createThreads (vector& threads, int threadCount, int perThread for (int contextNdx = 0; contextNdx < perThreadContextCount; contextNdx++) threadContexts.push_back(contexts[threadNdx * perThreadContextCount + contextNdx]); - threads.push_back(new TestThread(threadContexts)); + threads.push_back(new TestThread(threadContexts, egl)); threadContexts.clear(); } @@ -1036,7 +1040,7 @@ TestCase::IterateResult SharedRenderingPerfCase::iterate (void) if (m_results.empty()) logTestConfig(m_testCtx.getLog(), m_config); - createThreads(threads, m_config.threadCount, m_config.perThreadContextCount, m_contexts); + createThreads(threads, m_config.threadCount, m_config.perThreadContextCount, m_contexts, m_eglTestCtx.getLibrary()); beginTimeUs = deGetMicroseconds(); diff --git a/modules/egl/teglImageTests.cpp b/modules/egl/teglImageTests.cpp index aa1b666..fd01af3 100644 --- a/modules/egl/teglImageTests.cpp +++ b/modules/egl/teglImageTests.cpp @@ -194,6 +194,15 @@ public: IterateResult iterate (void) { + const Library& egl = m_eglTestCtx.getLibrary(); + + if (eglu::getVersion(egl, m_display) < eglu::Version(1, 5) && + !eglu::hasExtension(egl, m_display, "EGL_KHR_image") && + !eglu::hasExtension(egl, m_display, "EGL_KHR_image_base")) + { + TCU_THROW(NotSupportedError, "EGLimages not supported"); + } + #define CHECK_CREATE(MSG, DPY, CONTEXT, SOURCE, ERR) checkCreate(MSG, DPY, #DPY, CONTEXT, #CONTEXT, SOURCE, #SOURCE, ERR) CHECK_CREATE("Testing bad display (-1)...", (EGLDisplay)-1, EGL_NO_CONTEXT, EGL_NONE, EGL_BAD_DISPLAY); CHECK_CREATE("Testing bad context (-1)...", m_display, (EGLContext)-1, EGL_NONE, EGL_BAD_CONTEXT); diff --git a/modules/egl/teglMultiThreadTests.cpp b/modules/egl/teglMultiThreadTests.cpp index 21952a9..9a98245 100644 --- a/modules/egl/teglMultiThreadTests.cpp +++ b/modules/egl/teglMultiThreadTests.cpp @@ -110,9 +110,6 @@ public: THREADSTATUS_NOT_STARTED = 0, THREADSTATUS_RUNNING, THREADSTATUS_READY, - - THREADSTATUS_NOT_SUPPORTED, - THREADSTATUS_ERROR }; TestThread (MultiThreadedTest& test, int id); @@ -149,18 +146,20 @@ public: virtual bool runThread (TestThread& thread) = 0; virtual IterateResult iterate (void); - bool execTest (TestThread& thread); + void execTest (TestThread& thread); const Library& getLibrary (void) const { return m_eglTestCtx.getLibrary(); } protected: - void barrier (TestThread& thread); + void barrier (void); private: int m_threadCount; bool m_initialized; deUint64 m_startTimeUs; const deUint64 m_timeoutUs; + bool m_ok; + bool m_supported; vector m_threads; volatile deInt32 m_barrierWaiters; @@ -189,10 +188,7 @@ void TestThread::run (void) try { - if (m_test.execTest(*this)) - m_status = THREADSTATUS_READY; - else - m_status = THREADSTATUS_ERROR; + m_test.execTest(*this); } catch (const TestThread::TestStop&) { @@ -210,15 +206,17 @@ void TestThread::run (void) { getLog() << ThreadLog::BeginMessage << "Unknown exception" << ThreadLog::EndMessage; } + + getLibrary().releaseThread(); + m_status = THREADSTATUS_READY; } -bool MultiThreadedTest::execTest (TestThread& thread) +void MultiThreadedTest::execTest (TestThread& thread) { - bool isOk = false; - try { - isOk = runThread(thread); + if (!runThread(thread)) + m_ok = false; } catch (const TestThread::TestStop&) { @@ -227,9 +225,7 @@ bool MultiThreadedTest::execTest (TestThread& thread) } catch (const tcu::NotSupportedError&) { - // Set status of each thread - for (int threadNdx = 0; threadNdx < (int)m_threads.size(); threadNdx++) - m_threads[threadNdx]->setStatus(TestThread::THREADSTATUS_NOT_SUPPORTED); + m_supported = false; // Release barriers for (int threadNdx = 0; threadNdx < (int)m_threads.size(); threadNdx++) @@ -242,9 +238,7 @@ bool MultiThreadedTest::execTest (TestThread& thread) } catch(...) { - // Set status of each thread - for (int threadNdx = 0; threadNdx < (int)m_threads.size(); threadNdx++) - m_threads[threadNdx]->setStatus(TestThread::THREADSTATUS_ERROR); + m_ok = false; // Release barriers for (int threadNdx = 0; threadNdx < (int)m_threads.size(); threadNdx++) @@ -255,8 +249,6 @@ bool MultiThreadedTest::execTest (TestThread& thread) throw; } - - return isOk; } MultiThreadedTest::MultiThreadedTest (EglTestContext& eglTestCtx, const char* name, const char* description, int threadCount, deUint64 timeoutUs) @@ -265,7 +257,8 @@ MultiThreadedTest::MultiThreadedTest (EglTestContext& eglTestCtx, const char* na , m_initialized (false) , m_startTimeUs (0) , m_timeoutUs (timeoutUs) - + , m_ok (true) + , m_supported (true) , m_barrierWaiters (0) , m_barrierSemaphore1 (0, 0) , m_barrierSemaphore2 (1, 0) @@ -295,7 +288,7 @@ void MultiThreadedTest::deinit (void) } } -void MultiThreadedTest::barrier (TestThread& thread) +void MultiThreadedTest::barrier (void) { { const deInt32 waiters = deAtomicIncrement32(&m_barrierWaiters); @@ -328,7 +321,7 @@ void MultiThreadedTest::barrier (TestThread& thread) } // Barrier was released due an error in other thread - if (thread.getStatus() != TestThread::THREADSTATUS_RUNNING) + if (!m_ok || !m_supported) throw TestThread::TestStop(); } @@ -338,6 +331,9 @@ TestCase::IterateResult MultiThreadedTest::iterate (void) { m_testCtx.getLog() << tcu::TestLog::Message << "Thread timeout limit: " << m_timeoutUs << "us" << tcu::TestLog::EndMessage; + m_ok = true; + m_supported = true; + // Create threads m_threads.reserve(m_threadCount); @@ -366,18 +362,6 @@ TestCase::IterateResult MultiThreadedTest::iterate (void) for (int threadNdx = 0; threadNdx < (int)m_threads.size(); threadNdx++) m_threads[threadNdx]->join(); - bool isOk = true; - bool notSupported = false; - - for (int threadNdx = 0; threadNdx < (int)m_threads.size(); threadNdx++) - { - if (m_threads[threadNdx]->getStatus() == TestThread::THREADSTATUS_ERROR) - isOk = false; - - if (m_threads[threadNdx]->getStatus() == TestThread::THREADSTATUS_NOT_SUPPORTED) - notSupported = true; - } - // Get logs { vector messageNdx; @@ -417,9 +401,9 @@ TestCase::IterateResult MultiThreadedTest::iterate (void) m_threads.clear(); // Set result - if (isOk) + if (m_ok) { - if (notSupported) + if (!m_supported) m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "Not Supported"); else m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass"); @@ -553,7 +537,7 @@ bool MultiThreadedConfigTest::runThread (TestThread& thread) de::Random rnd (deInt32Hash(thread.getId() + 10435)); vector configs; - barrier(thread); + barrier(); for (int getConfigsNdx = 0; getConfigsNdx < m_getConfigs; getConfigsNdx++) { @@ -942,7 +926,7 @@ bool MultiThreadedObjectTest::runThread (TestThread& thread) TCU_THROW(NotSupportedError, "No usable config found"); } - barrier(thread); + barrier(); // Create / Destroy Objects if ((m_types & TYPE_SINGLE_WINDOW) != 0 && (m_types & TYPE_PBUFFER) == 0 && (m_types & TYPE_PIXMAP) == 0 && (m_types & TYPE_CONTEXT) == 0) @@ -957,30 +941,30 @@ bool MultiThreadedObjectTest::runThread (TestThread& thread) if (thread.getId() == 0) pushObjectsToShared(thread); - barrier(thread); + barrier(); // Push second threads objects to shared if (thread.getId() == 1) pushObjectsToShared(thread); - barrier(thread); + barrier(); // Make queries from shared surfaces querySetSharedObjects(thread, 100); - barrier(thread); + barrier(); // Pull surfaces for first thread from shared surfaces if (thread.getId() == 0) pullObjectsFromShared(thread, (int)(m_sharedPbuffers.size()/2), (int)(m_sharedNativePixmaps.size()/2), (int)(m_sharedNativeWindows.size()/2), (int)(m_sharedContexts.size()/2)); - barrier(thread); + barrier(); // Pull surfaces for second thread from shared surfaces if (thread.getId() == 1) pullObjectsFromShared(thread, (int)m_sharedPbuffers.size(), (int)m_sharedNativePixmaps.size(), (int)m_sharedNativeWindows.size(), (int)m_sharedContexts.size()); - barrier(thread); + barrier(); // Create / Destroy Objects if ((m_types & TYPE_SINGLE_WINDOW) == 0) diff --git a/modules/egl/teglRenderTests.cpp b/modules/egl/teglRenderTests.cpp index 8b5b5c2..46b1780 100644 --- a/modules/egl/teglRenderTests.cpp +++ b/modules/egl/teglRenderTests.cpp @@ -356,6 +356,37 @@ tcu::TextureFormat getColorFormat (const tcu::PixelFormat& colorBits) #undef PACK_FMT } +/* +The getColorThreshold function is used to obtain a +threshold usable for the fuzzyCompare function. + +For 8bit color depths a value of 0.02 should provide +a good metric for rejecting images above this level. +For other bit depths other thresholds should be selected. +Ideally this function would take advantage of the +getColorThreshold function provided by the PixelFormat class +as this would also allow setting per channel thresholds. +However using the PixelFormat provided function can result +in too strict thresholds for 8bit bit depths (compared to +the current default of 0.02) or too relaxed for lower bit +depths if scaled proportionally to the 8bit default. +*/ + +float getColorThreshold (const tcu::PixelFormat& colorBits) +{ + if ((colorBits.redBits > 0 && colorBits.redBits < 8) || + (colorBits.greenBits > 0 && colorBits.greenBits < 8) || + (colorBits.blueBits > 0 && colorBits.blueBits < 8) || + (colorBits.alphaBits > 0 && colorBits.alphaBits < 8)) + { + return 0.05f; + } + else + { + return 0.02f; + } +} + tcu::TextureFormat getDepthFormat (const int depthBits) { switch (depthBits) @@ -699,9 +730,9 @@ void SingleThreadRenderCase::executeForContexts (EGLDisplay display, EGLSurface const int numContexts = (int)contexts.size(); const int drawsPerCtx = 2; const int numIters = 2; - const float threshold = 0.02f; - const tcu::PixelFormat pixelFmt = getPixelFormat(egl, display, config.config); + const float threshold = getColorThreshold(pixelFmt); + const int depthBits = eglu::getConfigAttribInt(egl, display, config.config, EGL_DEPTH_SIZE); const int stencilBits = eglu::getConfigAttribInt(egl, display, config.config, EGL_STENCIL_SIZE); const int numSamples = eglu::getConfigAttribInt(egl, display, config.config, EGL_SAMPLES); @@ -868,6 +899,7 @@ public: // Signal completion. packetIter->signal->increment(); } + m_egl.releaseThread(); } private: @@ -902,9 +934,9 @@ void MultiThreadRenderCase::executeForContexts (EGLDisplay display, EGLSurface s const int packetsPerThread = 2; const int numThreads = numContexts; const int numPackets = numThreads * packetsPerThread; - const float threshold = 0.02f; - const tcu::PixelFormat pixelFmt = getPixelFormat(egl, display, config.config); + const float threshold = getColorThreshold(pixelFmt); + const int depthBits = eglu::getConfigAttribInt(egl, display, config.config, EGL_DEPTH_SIZE); const int stencilBits = eglu::getConfigAttribInt(egl, display, config.config, EGL_STENCIL_SIZE); const int numSamples = eglu::getConfigAttribInt(egl, display, config.config, EGL_SAMPLES); diff --git a/modules/egl/teglThreadCleanUpTests.cpp b/modules/egl/teglThreadCleanUpTests.cpp index ffe3913..a3f64cb 100644 --- a/modules/egl/teglThreadCleanUpTests.cpp +++ b/modules/egl/teglThreadCleanUpTests.cpp @@ -120,6 +120,8 @@ public: { m_error = error; } + + m_egl.releaseThread(); } private: diff --git a/modules/egl/teglWideColorTests.cpp b/modules/egl/teglWideColorTests.cpp index 20d4fff..31afd28 100644 --- a/modules/egl/teglWideColorTests.cpp +++ b/modules/egl/teglWideColorTests.cpp @@ -406,7 +406,7 @@ void WideColorTest::checkFP16Support (void) if (numConfigs <= 0) { log << tcu::TestLog::Message << "No configs returned." << tcu::TestLog::EndMessage; - TCU_THROW(NotSupportedError, "10:10:10:2 pixel format is not supported"); + TCU_THROW(NotSupportedError, "16:16:16:16 pixel format is not supported"); } log << tcu::TestLog::Message << numConfigs << " configs returned" << tcu::TestLog::EndMessage; diff --git a/modules/gles2/functional/es2fTextureCompletenessTests.cpp b/modules/gles2/functional/es2fTextureCompletenessTests.cpp index f83fec6..c81cd94 100644 --- a/modules/gles2/functional/es2fTextureCompletenessTests.cpp +++ b/modules/gles2/functional/es2fTextureCompletenessTests.cpp @@ -128,7 +128,7 @@ public: IterateResult iterate (void); protected: - virtual void createTexture (void) = 0; + virtual void createTexture (GLuint texture) = 0; tcu::TestContext& m_testCtx; glu::RenderContext& m_renderCtx; @@ -160,12 +160,17 @@ Tex2DCompletenessCase::IterateResult Tex2DCompletenessCase::iterate (void) glViewport (offsetX, offsetY, viewportWidth, viewportHeight); - createTexture (); + GLuint texture; + glGenTextures(1, &texture); + createTexture(texture); + renderer.renderQuad (0, &texCoord[0], glu::TextureTestUtil::TEXTURETYPE_2D); glu::readPixels (m_renderCtx, offsetX, offsetY, renderedFrame.getAccess()); bool isOk = compareToConstantColor(log, "Result", "Image comparison result", renderedFrame, tcu::COMPARE_LOG_RESULT, m_compareColor); + glDeleteTextures(1, &texture); + m_testCtx.setTestResult(isOk ? QP_TEST_RESULT_PASS : QP_TEST_RESULT_FAIL, isOk ? "Pass" : "Image comparison failed"); return STOP; @@ -180,7 +185,7 @@ public: IterateResult iterate (void); protected: - virtual void createTexture (void) = 0; + virtual void createTexture (GLuint texture) = 0; tcu::TestContext& m_testCtx; glu::RenderContext& m_renderCtx; @@ -209,7 +214,9 @@ TexCubeCompletenessCase::IterateResult TexCubeCompletenessCase::iterate (void) int offsetX = random.getInt(0, de::max(0,m_renderCtx.getRenderTarget().getWidth() - 64)); int offsetY = random.getInt(0, de::max(0,m_renderCtx.getRenderTarget().getHeight() - 64)); - createTexture(); + GLuint texture; + glGenTextures(1, &texture); + createTexture(texture); for (int face = 0; face < tcu::CUBEFACE_LAST; face++) { @@ -226,6 +233,8 @@ TexCubeCompletenessCase::IterateResult TexCubeCompletenessCase::iterate (void) allFacesOk = false; } + glDeleteTextures(1, &texture); + m_testCtx.setTestResult(allFacesOk ? QP_TEST_RESULT_PASS : QP_TEST_RESULT_FAIL, allFacesOk ? "Pass" : "Image comparison failed"); return STOP; @@ -239,7 +248,7 @@ public: Incomplete2DSizeCase (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const char* name, const char* description, IVec2 size, IVec2 invalidLevelSize, int invalidLevelNdx, const glu::ContextInfo& ctxInfo); ~Incomplete2DSizeCase (void) {} - virtual void createTexture (void); + virtual void createTexture (GLuint texture); private: int m_invalidLevelNdx; @@ -257,7 +266,7 @@ Incomplete2DSizeCase::Incomplete2DSizeCase (tcu::TestContext& testCtx, glu::Rend { } -void Incomplete2DSizeCase::createTexture (void) +void Incomplete2DSizeCase::createTexture (GLuint texture) { static const char* const s_relaxingExtensions[] = { @@ -269,8 +278,6 @@ void Incomplete2DSizeCase::createTexture (void) tcu::TextureLevel levelData (fmt); TestLog& log = m_testCtx.getLog(); - GLuint texture; - glGenTextures (1, &texture); glPixelStorei (GL_UNPACK_ALIGNMENT, 1); glBindTexture (GL_TEXTURE_2D, texture); @@ -315,7 +322,7 @@ public: Incomplete2DFormatCase (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const char* name, const char* description, IVec2 size, deUint32 format, deUint32 invalidFormat, int invalidLevelNdx); ~Incomplete2DFormatCase (void) {} - virtual void createTexture (void); + virtual void createTexture (GLuint texture); private: int m_invalidLevelNdx; @@ -333,13 +340,11 @@ Incomplete2DFormatCase::Incomplete2DFormatCase (tcu::TestContext& testCtx, glu:: { } -void Incomplete2DFormatCase::createTexture (void) +void Incomplete2DFormatCase::createTexture (GLuint texture) { tcu::TextureFormat fmt = glu::mapGLTransferFormat(m_format, GL_UNSIGNED_BYTE); tcu::TextureLevel levelData (fmt); - GLuint texture; - glGenTextures (1, &texture); glPixelStorei (GL_UNPACK_ALIGNMENT, 1); glBindTexture (GL_TEXTURE_2D, texture); @@ -372,7 +377,7 @@ public: Incomplete2DMissingLevelCase (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const char* name, const char* description, IVec2 size, int missingLevelNdx); ~Incomplete2DMissingLevelCase (void) {} - virtual void createTexture (void); + virtual void createTexture (GLuint texture); private: int m_missingLevelNdx; @@ -386,13 +391,11 @@ Incomplete2DMissingLevelCase::Incomplete2DMissingLevelCase (tcu::TestContext& te { } -void Incomplete2DMissingLevelCase::createTexture (void) +void Incomplete2DMissingLevelCase::createTexture (GLuint texture) { tcu::TextureFormat fmt = glu::mapGLTransferFormat(GL_RGBA, GL_UNSIGNED_BYTE); tcu::TextureLevel levelData (fmt); - GLuint texture; - glGenTextures (1, &texture); glPixelStorei (GL_UNPACK_ALIGNMENT, 1); glBindTexture (GL_TEXTURE_2D, texture); @@ -425,7 +428,7 @@ public: Incomplete2DWrapModeCase (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const char* name, const char* description, IVec2 size, deUint32 wrapT, deUint32 wrapS, const glu::ContextInfo& ctxInfo); ~Incomplete2DWrapModeCase (void) {} - virtual void createTexture (void); + virtual void createTexture (GLuint texture); private: deUint32 m_wrapT; @@ -443,14 +446,12 @@ Incomplete2DWrapModeCase::Incomplete2DWrapModeCase (tcu::TestContext& testCtx, g { } -void Incomplete2DWrapModeCase::createTexture (void) +void Incomplete2DWrapModeCase::createTexture (GLuint texture) { TestLog& log = m_testCtx.getLog(); tcu::TextureFormat fmt = glu::mapGLTransferFormat(GL_RGBA, GL_UNSIGNED_BYTE); tcu::TextureLevel levelData (fmt); - GLuint texture; - glGenTextures(1, &texture); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glBindTexture(GL_TEXTURE_2D, texture); @@ -480,7 +481,7 @@ public: Complete2DExtraLevelCase (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const char* name, const char* description, IVec2 size); ~Complete2DExtraLevelCase (void) {} - virtual void createTexture (void); + virtual void createTexture (GLuint texture); private: IVec2 m_size; @@ -492,13 +493,11 @@ Complete2DExtraLevelCase::Complete2DExtraLevelCase (tcu::TestContext& testCtx, g { } -void Complete2DExtraLevelCase::createTexture (void) +void Complete2DExtraLevelCase::createTexture (GLuint texture) { tcu::TextureFormat fmt = glu::mapGLTransferFormat(GL_RGBA, GL_UNSIGNED_BYTE); tcu::TextureLevel levelData (fmt); - GLuint texture; - glGenTextures (1, &texture); glPixelStorei (GL_UNPACK_ALIGNMENT, 1); glBindTexture (GL_TEXTURE_2D, texture); @@ -533,7 +532,7 @@ public: Incomplete2DEmptyObjectCase (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const char* name, const char* description, IVec2 size); ~Incomplete2DEmptyObjectCase (void) {} - virtual void createTexture (void); + virtual void createTexture (GLuint texture); private: IVec2 m_size; @@ -545,10 +544,8 @@ Incomplete2DEmptyObjectCase::Incomplete2DEmptyObjectCase (tcu::TestContext& test { } -void Incomplete2DEmptyObjectCase::createTexture (void) +void Incomplete2DEmptyObjectCase::createTexture (GLuint texture) { - GLuint texture; - glGenTextures (1, &texture); glPixelStorei (GL_UNPACK_ALIGNMENT, 1); glBindTexture (GL_TEXTURE_2D, texture); @@ -569,7 +566,7 @@ public: IncompleteCubeSizeCase (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const char* name, const char* description, IVec2 size, IVec2 invalidLevelSize, int invalidLevelNdx, tcu::CubeFace invalidCubeFace); ~IncompleteCubeSizeCase (void) {} - virtual void createTexture (void); + virtual void createTexture (GLuint texture); private: int m_invalidLevelNdx; @@ -596,13 +593,11 @@ IncompleteCubeSizeCase::IncompleteCubeSizeCase (tcu::TestContext& testCtx, glu:: { } -void IncompleteCubeSizeCase::createTexture (void) +void IncompleteCubeSizeCase::createTexture (GLuint texture) { tcu::TextureFormat fmt = glu::mapGLTransferFormat(GL_RGBA, GL_UNSIGNED_BYTE); tcu::TextureLevel levelData (fmt); - GLuint texture; - glGenTextures (1, &texture); glPixelStorei (GL_UNPACK_ALIGNMENT, 1); glBindTexture (GL_TEXTURE_CUBE_MAP, texture); @@ -641,7 +636,7 @@ public: IncompleteCubeFormatCase (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const char* name, const char* description, IVec2 size, deUint32 format, deUint32 invalidFormat, tcu::CubeFace invalidCubeFace); ~IncompleteCubeFormatCase (void) {} - virtual void createTexture (void); + virtual void createTexture (GLuint texture); private: deUint32 m_format; @@ -668,13 +663,11 @@ IncompleteCubeFormatCase::IncompleteCubeFormatCase (tcu::TestContext& testCtx, g { } -void IncompleteCubeFormatCase::createTexture (void) +void IncompleteCubeFormatCase::createTexture (GLuint texture) { tcu::TextureFormat fmt = glu::mapGLTransferFormat(GL_RGBA, GL_UNSIGNED_BYTE); tcu::TextureLevel levelData (fmt); - GLuint texture; - glGenTextures (1, &texture); glPixelStorei (GL_UNPACK_ALIGNMENT, 1); glBindTexture (GL_TEXTURE_CUBE_MAP, texture); @@ -713,7 +706,7 @@ public: IncompleteCubeMissingLevelCase (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const char* name, const char* description, IVec2 size, int invalidLevelNdx, tcu::CubeFace invalidCubeFace); ~IncompleteCubeMissingLevelCase (void) {} - virtual void createTexture (void); + virtual void createTexture (GLuint texture); private: int m_invalidLevelNdx; @@ -737,13 +730,11 @@ IncompleteCubeMissingLevelCase::IncompleteCubeMissingLevelCase (tcu::TestContext { } -void IncompleteCubeMissingLevelCase::createTexture (void) +void IncompleteCubeMissingLevelCase::createTexture (GLuint texture) { tcu::TextureFormat fmt = glu::mapGLTransferFormat(GL_RGBA, GL_UNSIGNED_BYTE); tcu::TextureLevel levelData (fmt); - GLuint texture; - glGenTextures (1, &texture); glPixelStorei (GL_UNPACK_ALIGNMENT, 1); glBindTexture (GL_TEXTURE_CUBE_MAP, texture); @@ -782,7 +773,7 @@ public: IncompleteCubeWrapModeCase (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const char* name, const char* description, IVec2 size, deUint32 wrapT, deUint32 wrapS, const glu::ContextInfo& ctxInfo); ~IncompleteCubeWrapModeCase (void) {} - virtual void createTexture (void); + virtual void createTexture (GLuint texture); private: deUint32 m_wrapT; @@ -800,14 +791,12 @@ IncompleteCubeWrapModeCase::IncompleteCubeWrapModeCase (tcu::TestContext& testCt { } -void IncompleteCubeWrapModeCase::createTexture (void) +void IncompleteCubeWrapModeCase::createTexture (GLuint texture) { TestLog& log = m_testCtx.getLog(); tcu::TextureFormat fmt = glu::mapGLTransferFormat(GL_RGBA, GL_UNSIGNED_BYTE); tcu::TextureLevel levelData (fmt); - GLuint texture; - glGenTextures(1, &texture); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glBindTexture(GL_TEXTURE_2D, texture); @@ -838,7 +827,7 @@ public: CompleteCubeExtraLevelCase (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const char* name, const char* description, IVec2 size); ~CompleteCubeExtraLevelCase (void) {} - virtual void createTexture (void); + virtual void createTexture (GLuint texture); private: IVec2 m_size; @@ -850,13 +839,11 @@ CompleteCubeExtraLevelCase::CompleteCubeExtraLevelCase (tcu::TestContext& testCt { } -void CompleteCubeExtraLevelCase::createTexture (void) +void CompleteCubeExtraLevelCase::createTexture (GLuint texture) { tcu::TextureFormat fmt = glu::mapGLTransferFormat(GL_RGBA, GL_UNSIGNED_BYTE); tcu::TextureLevel levelData (fmt); - GLuint texture; - glGenTextures (1, &texture); glPixelStorei (GL_UNPACK_ALIGNMENT, 1); glBindTexture (GL_TEXTURE_2D, texture); @@ -894,7 +881,7 @@ public: IncompleteCubeEmptyObjectCase (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const char* name, const char* description, IVec2 size); ~IncompleteCubeEmptyObjectCase (void) {} - virtual void createTexture (void); + virtual void createTexture (GLuint texture); private: IVec2 m_size; @@ -906,10 +893,8 @@ IncompleteCubeEmptyObjectCase::IncompleteCubeEmptyObjectCase (tcu::TestContext& { } -void IncompleteCubeEmptyObjectCase::createTexture (void) +void IncompleteCubeEmptyObjectCase::createTexture (GLuint texture) { - GLuint texture; - glGenTextures (1, &texture); glPixelStorei (GL_UNPACK_ALIGNMENT, 1); glBindTexture (GL_TEXTURE_2D, texture); diff --git a/modules/gles31/functional/es31fDrawElementsBaseVertexTests.cpp b/modules/gles31/functional/es31fDrawElementsBaseVertexTests.cpp index 11764c1..7b68587 100644 --- a/modules/gles31/functional/es31fDrawElementsBaseVertexTests.cpp +++ b/modules/gles31/functional/es31fDrawElementsBaseVertexTests.cpp @@ -218,6 +218,14 @@ VertexIDCase::~VertexIDCase (void) void VertexIDCase::init (void) { + if (m_method == deqp::gls::DrawTestSpec::DRAWMETHOD_DRAWELEMENTS_BASEVERTEX || + m_method == gls::DrawTestSpec::DRAWMETHOD_DRAWELEMENTS_RANGED_BASEVERTEX || + m_method == gls::DrawTestSpec::DRAWMETHOD_DRAWELEMENTS_INSTANCED_BASEVERTEX) + { + const bool supportsES32 = contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)); + TCU_CHECK_AND_THROW(NotSupportedError, supportsES32 || m_context.getContextInfo().isExtensionSupported("GL_EXT_draw_elements_base_vertex"), "GL_EXT_draw_elements_base_vertex is not supported."); + } + m_testCtx.getLog() << TestLog::Message << "gl_VertexID should be the index of the vertex that is being passed to the shader. i.e. indices[i] + basevertex" << TestLog::EndMessage; diff --git a/modules/gles31/functional/es31fFboSRGBWriteControlTests.cpp b/modules/gles31/functional/es31fFboSRGBWriteControlTests.cpp index b4ebcac..5cbdb0c 100644 --- a/modules/gles31/functional/es31fFboSRGBWriteControlTests.cpp +++ b/modules/gles31/functional/es31fFboSRGBWriteControlTests.cpp @@ -1509,8 +1509,8 @@ FboSRGBQueryCase::~FboSRGBQueryCase (void) void FboSRGBQueryCase::init (void) { // extension requirements for test - if (!glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)) && !m_context.getContextInfo().isExtensionSupported("GL_EXT_sRGB_write_control")) - TCU_THROW(NotSupportedError, "Test requires extension GL_EXT_sRGB_write_control or a context version equal or higher than 3.2"); + if (!m_context.getContextInfo().isExtensionSupported("GL_EXT_sRGB_write_control")) + TCU_THROW(NotSupportedError, "Test requires extension GL_EXT_sRGB_write_control"); } void FboSRGBQueryCase::deinit (void) @@ -1797,8 +1797,8 @@ FboSRGBUnsupportedEnumCase::~FboSRGBUnsupportedEnumCase (void) void FboSRGBUnsupportedEnumCase::init (void) { // extension requirements for test - if (glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)) || m_context.getContextInfo().isExtensionSupported("GL_EXT_sRGB_write_control")) - TCU_THROW(NotSupportedError, "Test requires extension GL_EXT_sRGB_write_control to be unsupported and a context version less than 3.2"); + if (m_context.getContextInfo().isExtensionSupported("GL_EXT_sRGB_write_control")) + TCU_THROW(NotSupportedError, "Test requires extension GL_EXT_sRGB_write_control to be unsupported"); } void FboSRGBUnsupportedEnumCase::deinit (void) diff --git a/modules/gles31/functional/es31fNegativeAdvancedBlendEquationTests.cpp b/modules/gles31/functional/es31fNegativeAdvancedBlendEquationTests.cpp index 2613282..abc1f5e 100644 --- a/modules/gles31/functional/es31fNegativeAdvancedBlendEquationTests.cpp +++ b/modules/gles31/functional/es31fNegativeAdvancedBlendEquationTests.cpp @@ -224,7 +224,7 @@ void attachment_advanced_equation (NegativeTestContext& ctx) ctx.expectError(GL_NO_ERROR); ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER); - ctx.beginSection("GL_INVALID_OPERATION is generated if blending is enabled, advanced equations are used, and the draw buffer for other color outputs is not NONE."); + ctx.beginSection("GL_INVALID_OPERATION is generated if blending is enabled, advanced equations are used, and the draw buffer for other color outputs is not NONE unless NVX_blend_equation_advanced_multi_draw_buffers is supported."); for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(s_equations); ++ndx) { glu::ShaderProgram program(ctx.getRenderContext(), generateProgramSources(ctx, s_equations[ndx])); @@ -237,7 +237,10 @@ void attachment_advanced_equation (NegativeTestContext& ctx) ctx.expectError(GL_NO_ERROR); ctx.glBlendEquation(getEquation(s_equations[ndx])); ctx.glDrawElements(GL_TRIANGLES, 0, GL_UNSIGNED_INT, 0); - ctx.expectError(GL_INVALID_OPERATION); + if (ctx.isExtensionSupported("GL_NVX_blend_equation_advanced_multi_draw_buffers")) + ctx.expectError(GL_NO_ERROR); + else + ctx.expectError(GL_INVALID_OPERATION); } ctx.endSection(); diff --git a/modules/gles31/functional/es31fNegativeComputeTests.cpp b/modules/gles31/functional/es31fNegativeComputeTests.cpp index eb2e0ec..813a56a 100644 --- a/modules/gles31/functional/es31fNegativeComputeTests.cpp +++ b/modules/gles31/functional/es31fNegativeComputeTests.cpp @@ -646,7 +646,7 @@ void invalid_maximum_work_group_sizes (NegativeTestContext& ctx) ctx.glGetIntegerv(GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS, &maxWorkGroupInvocations); ctx.expectError(GL_NO_ERROR); - DE_ASSERT((maxWorkGroupSizeX * maxWorkGroupSizeY * maxWorkGroupSizeZ) > maxWorkGroupInvocations ); + DE_ASSERT(((deInt64) maxWorkGroupSizeX * maxWorkGroupSizeY * maxWorkGroupSizeZ) > maxWorkGroupInvocations ); const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)); const char* const shaderVersion = isES32 diff --git a/modules/gles31/functional/es31fNegativeVertexArrayApiTests.cpp b/modules/gles31/functional/es31fNegativeVertexArrayApiTests.cpp index 56340d9..1ed5f2d 100644 --- a/modules/gles31/functional/es31fNegativeVertexArrayApiTests.cpp +++ b/modules/gles31/functional/es31fNegativeVertexArrayApiTests.cpp @@ -701,24 +701,6 @@ void draw_elements_base_vertex (NegativeTestContext& ctx) ctx.endSection(); } -void draw_elements_base_vertex_invalid_map (NegativeTestContext& ctx) -{ - GLuint buf = 0; - GLfloat vertices[1]; - - ctx.beginSection("GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to an enabled array or the element array and the buffer object's data store is currently mapped."); - ctx.glGenBuffers(1, &buf); - ctx.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buf); - ctx.glBufferData(GL_ELEMENT_ARRAY_BUFFER, 10, 0, GL_STATIC_DRAW); - ctx.glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER, 0, 5, GL_MAP_READ_BIT); - ctx.expectError(GL_NO_ERROR); - ctx.glDrawElementsBaseVertex(GL_POINTS, 1, GL_UNSIGNED_INT, vertices, 1); - ctx.expectError(GL_INVALID_OPERATION); - ctx.glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER); - ctx.glDeleteBuffers(1, &buf); - ctx.endSection(); -} - void draw_elements_base_vertex_primitive_mode_mismatch (NegativeTestContext& ctx) { TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a 3.2 context or higher context version."); @@ -1085,25 +1067,6 @@ void draw_elements_instanced_base_vertex (NegativeTestContext& ctx) ctx.glUseProgram(0); } -void draw_elements_instanced_base_vertex_invalid_map (NegativeTestContext& ctx) -{ - GLfloat vertices[1]; - GLuint buf = 0; - - ctx.beginSection("GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to an enabled array or the element array and the buffer object's data store is currently mapped."); - ctx.glGenBuffers(1, &buf); - ctx.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buf); - ctx.glBufferData(GL_ELEMENT_ARRAY_BUFFER, 10, 0, GL_STATIC_DRAW); - ctx.glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER, 0, 5, GL_MAP_READ_BIT); - ctx.expectError(GL_NO_ERROR); - ctx.glDrawElementsInstancedBaseVertex(GL_POINTS, 1, GL_UNSIGNED_INT, vertices, 1, 1); - ctx.expectError(GL_INVALID_OPERATION); - ctx.glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER); - ctx.glDeleteBuffers(1, &buf); - ctx.endSection(); - -} - void draw_elements_instanced_base_vertex_primitive_mode_mismatch (NegativeTestContext& ctx) { TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a 3.2 context or higher context version."); @@ -1371,24 +1334,6 @@ void draw_range_elements_base_vertex (NegativeTestContext& ctx) ctx.glUseProgram(0); } -void draw_range_elements_base_vertex_invalid_map (NegativeTestContext& ctx) -{ - GLuint buf = 0; - GLfloat vertices[1]; - - ctx.beginSection("GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to an enabled array or the element array and the buffer object's data store is currently mapped."); - ctx.glGenBuffers(1, &buf); - ctx.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buf); - ctx.glBufferData(GL_ELEMENT_ARRAY_BUFFER, 10, 0, GL_STATIC_DRAW); - ctx.glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER, 0, 5, GL_MAP_READ_BIT); - ctx.expectError(GL_NO_ERROR); - ctx.glDrawRangeElementsBaseVertex(GL_POINTS, 0, 1, 1, GL_UNSIGNED_INT, vertices, 1); - ctx.expectError(GL_INVALID_OPERATION); - ctx.glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER); - ctx.glDeleteBuffers(1, &buf); - ctx.endSection(); -} - void draw_range_elements_base_vertex_primitive_mode_mismatch (NegativeTestContext& ctx) { TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a 3.2 context or higher context version."); @@ -1430,7 +1375,6 @@ std::vector getNegativeVertexArrayApiTestFunctions () {draw_arrays_incomplete_primitive, "draw_arrays_incomplete_primitive", "Invalid glDrawArrays() usage" }, {draw_elements, "draw_elements", "Invalid glDrawElements() usage" }, {draw_elements_base_vertex, "draw_elements_base_vertex", "Invalid glDrawElementsBaseVertex() usage" }, - {draw_elements_base_vertex_invalid_map, "draw_elements_base_vertex_invalid_map" , "Invalid glDrawElementsBaseVertex() usage" }, {draw_elements_base_vertex_primitive_mode_mismatch, "draw_elements_base_vertex_primitive_mode_mismatch", "Invalid glDrawElementsBaseVertex() usage" }, {draw_elements_invalid_program, "draw_elements_invalid_program", "Invalid glDrawElements() usage" }, {draw_elements_incomplete_primitive, "draw_elements_incomplete_primitive", "Invalid glDrawElements() usage" }, @@ -1441,13 +1385,11 @@ std::vector getNegativeVertexArrayApiTestFunctions () {draw_elements_instanced_invalid_program, "draw_elements_instanced_invalid_program", "Invalid glDrawElementsInstanced() usage" }, {draw_elements_instanced_incomplete_primitive, "draw_elements_instanced_incomplete_primitive", "Invalid glDrawElementsInstanced() usage" }, {draw_elements_instanced_base_vertex, "draw_elements_instanced_base_vertex", "Invalid glDrawElementsInstancedBaseVertex() usage" }, - {draw_elements_instanced_base_vertex_invalid_map, "draw_elements_instanced_base_vertex_invalid_map", "Invalid glDrawElementsInstancedBaseVertex() usage" }, {draw_elements_instanced_base_vertex_primitive_mode_mismatch, "draw_elements_instanced_base_vertex_primitive_mode_mismatch", "Invalid glDrawElementsInstancedBaseVertex() usage" }, {draw_range_elements, "draw_range_elements", "Invalid glDrawRangeElements() usage" }, {draw_range_elements_invalid_program, "draw_range_elements_invalid_program", "Invalid glDrawRangeElements() usage" }, {draw_range_elements_incomplete_primitive, "draw_range_elements_incomplete_primitive", "Invalid glDrawRangeElements() usage" }, {draw_range_elements_base_vertex, "draw_range_elements_base_vertex", "Invalid glDrawRangeElementsBaseVertex() usage" }, - {draw_range_elements_base_vertex_invalid_map, "draw_range_elements_base_vertex_invalid_map", "Invalid glDrawRangeElementsBaseVertex() usage" }, {draw_range_elements_base_vertex_primitive_mode_mismatch, "draw_range_elements_base_vertex_primitive_mode_mismatch", "Invalid glDrawRangeElementsBaseVertex() usage" }, }; diff --git a/modules/glshared/glsBuiltinPrecisionTests.cpp b/modules/glshared/glsBuiltinPrecisionTests.cpp index da69f89..afe990b 100644 --- a/modules/glshared/glsBuiltinPrecisionTests.cpp +++ b/modules/glshared/glsBuiltinPrecisionTests.cpp @@ -2924,12 +2924,32 @@ public: protected: ExprP doExpand (ExpandContext&, const ArgExprs& args) const { - ExprP val = args.a[0] * args.b[0]; + ExprP op[Size]; + // Precompute all products. + for (int ndx = 0; ndx < Size; ++ndx) + op[ndx] = args.a[ndx] * args.b[ndx]; - for (int ndx = 1; ndx < Size; ++ndx) - val = val + args.a[ndx] * args.b[ndx]; + int idx[Size]; + //Prepare an array of indices. + for (int ndx = 0; ndx < Size; ++ndx) + idx[ndx] = ndx; - return val; + ExprP res = op[0]; + // Compute the first dot alternative: SUM(a[i]*b[i]), i = 0 .. Size-1 + for (int ndx = 1; ndx < Size; ++ndx) + res = res + op[ndx]; + + // Generate all permutations of indices and + // using a permutation compute a dot alternative. + // Generates all possible variants fo summation of products in the dot product expansion expression. + do { + ExprP alt = constant(0.0f); + for (int ndx = 0; ndx < Size; ++ndx) + alt = alt + op[idx[ndx]]; + res = alternatives(res, alt); + } while (std::next_permutation(idx, idx + Size)); + + return res; } }; diff --git a/modules/glshared/glsDrawTest.cpp b/modules/glshared/glsDrawTest.cpp index 155bd35..d4f10c2 100644 --- a/modules/glshared/glsDrawTest.cpp +++ b/modules/glshared/glsDrawTest.cpp @@ -43,6 +43,7 @@ #include "tcuFloat.hpp" #include "tcuTextureUtil.hpp" +#include "gluContextInfo.hpp" #include "gluPixelTransfer.hpp" #include "gluCallLogWrapper.hpp" @@ -3034,6 +3035,7 @@ static bool containsLineCases (const std::vector& m_specs) DrawTest::DrawTest (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const DrawTestSpec& spec, const char* name, const char* desc) : TestCase (testCtx, name, desc) , m_renderCtx (renderCtx) + , m_contextInfo (DE_NULL) , m_refBuffers (DE_NULL) , m_refContext (DE_NULL) , m_glesContext (DE_NULL) @@ -3051,6 +3053,7 @@ DrawTest::DrawTest (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, co DrawTest::DrawTest (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const char* name, const char* desc) : TestCase (testCtx, name, desc) , m_renderCtx (renderCtx) + , m_contextInfo (DE_NULL) , m_refBuffers (DE_NULL) , m_refContext (DE_NULL) , m_glesContext (DE_NULL) @@ -3130,6 +3133,7 @@ void DrawTest::init (void) m_maxDiffRed = deCeilFloatToInt32(256.0f * (6.0f / (float)(1 << m_renderCtx.getRenderTarget().getPixelFormat().redBits))); m_maxDiffGreen = deCeilFloatToInt32(256.0f * (6.0f / (float)(1 << m_renderCtx.getRenderTarget().getPixelFormat().greenBits))); m_maxDiffBlue = deCeilFloatToInt32(256.0f * (6.0f / (float)(1 << m_renderCtx.getRenderTarget().getPixelFormat().blueBits))); + m_contextInfo = glu::ContextInfo::create(m_renderCtx); } void DrawTest::deinit (void) @@ -3139,21 +3143,32 @@ void DrawTest::deinit (void) delete m_refBuffers; delete m_refContext; delete m_glesContext; + delete m_contextInfo; m_glArrayPack = DE_NULL; m_rrArrayPack = DE_NULL; m_refBuffers = DE_NULL; m_refContext = DE_NULL; m_glesContext = DE_NULL; + m_contextInfo = DE_NULL; } DrawTest::IterateResult DrawTest::iterate (void) { const int specNdx = (m_iteration / 2); + const DrawTestSpec& spec = m_specs[specNdx]; + + if (spec.drawMethod == DrawTestSpec::DRAWMETHOD_DRAWELEMENTS_BASEVERTEX || + spec.drawMethod == DrawTestSpec::DRAWMETHOD_DRAWELEMENTS_INSTANCED_BASEVERTEX || + spec.drawMethod == DrawTestSpec::DRAWMETHOD_DRAWELEMENTS_RANGED_BASEVERTEX) + { + const bool supportsES32 = contextSupports(m_renderCtx.getType(), glu::ApiType::es(3, 2)); + TCU_CHECK_AND_THROW(NotSupportedError, supportsES32 || m_contextInfo->isExtensionSupported("GL_EXT_draw_elements_base_vertex"), "GL_EXT_draw_elements_base_vertex is not supported."); + } + const bool drawStep = (m_iteration % 2) == 0; const bool compareStep = (m_iteration % 2) == 1; const IterateResult iterateResult = ((size_t)m_iteration + 1 == m_specs.size()*2) ? (STOP) : (CONTINUE); - const DrawTestSpec& spec = m_specs[specNdx]; const bool updateProgram = (m_iteration == 0) || (drawStep && !checkSpecsShaderCompatible(m_specs[specNdx], m_specs[specNdx-1])); // try to use the same shader in all iterations IterationLogSectionEmitter sectionEmitter (m_testCtx.getLog(), specNdx, m_specs.size(), m_iteration_descriptions[specNdx], drawStep && m_specs.size()!=1); diff --git a/modules/glshared/glsDrawTest.hpp b/modules/glshared/glsDrawTest.hpp index 5347269..8c04ef5 100644 --- a/modules/glshared/glsDrawTest.hpp +++ b/modules/glshared/glsDrawTest.hpp @@ -27,6 +27,11 @@ #include "tcuResultCollector.hpp" #include "gluRenderContext.hpp" +namespace glu +{ +class ContextInfo; +} + namespace sglr { @@ -259,6 +264,7 @@ private: glu::RenderContext& m_renderCtx; + glu::ContextInfo* m_contextInfo; sglr::ReferenceContextBuffers* m_refBuffers; sglr::ReferenceContext* m_refContext; sglr::Context* m_glesContext; diff --git a/targets/surfaceless/surfaceless.cmake b/targets/surfaceless/surfaceless.cmake new file mode 100644 index 0000000..f506112 --- /dev/null +++ b/targets/surfaceless/surfaceless.cmake @@ -0,0 +1,47 @@ +message("*** Using Surfaceless target") + +set(DEQP_TARGET_NAME "Surfaceless") + +include(FindPkgConfig) + +set(DEQP_USE_SURFACELESS ON) + +set(DEQP_SUPPORT_GLES2 ON) +set(DEQP_SUPPORT_GLES3 ON) +set(DEQP_SUPPORT_EGL ON) + +find_library(GLES2_LIBRARIES GLESv2) +find_library(GLES3_LIBRARIES GLESv3) +find_path(GLES2_INCLUDE_PATH GLES2/gl2.h) +find_path(GLES3_INCLUDE_PATH GLES3/gl3.h) + +if (GLES2_INCLUDE_PATH AND GLES2_LIBRARIES) + set(DEQP_GLES2_LIBRARIES ${GLES2_LIBRARIES}) +else () + message (SEND_ERROR "GLESv2 support not found") +endif () + +if (GLES3_INCLUDE_PATH AND GLES3_LIBRARIES) + set(DEQP_GLES3_LIBRARIES ${GLES3_LIBRARIES}) +elseif (GLES3_INCLUDE_PATH AND GLES2_LIBRARIES) + # Assume GLESv2 provides ES3 symbols if gl3.h was found + # and the GLESv3 library was not. + set(DEQP_GLES3_LIBRARIES ${GLES2_LIBRARIES}) +else () + message (FATAL_ERROR "GLESv3 support not found") +endif () + +pkg_check_modules(EGL REQUIRED egl) +set(DEQP_EGL_LIBRARIES ${EGL_LIBRARIES}) + +pkg_check_modules(GBM REQUIRED gbm) +pkg_check_modules(KMS REQUIRED libkms) +pkg_check_modules(DRM REQUIRED libdrm) + +include_directories(${GLES2_INCLUDE_PATH} ${GLES3_INCLUDE_PATH} + ${EGL_INCLUDE_DIRS} ${GBM_INCLUDE_DIRS} + ${KMS_INCLUDE_DIRS} ${DRM_INCLUDE_DIRS}) + +set(DEQP_PLATFORM_LIBRARIES ${DEQP_GLES2_LIBRARIES} ${DEQP_GLES3_LIBRARIES} + ${DEQP_EGL_LIBRARIES} ${GBM_LIBRARIES} + ${KMS_LIBRARIES} ${DRM_LIBRARIES})