Commit 1a146f07 by Shahbaz Youssefi Committed by Commit Bot

Roll VK-GL-CTS from c4e6dbe68e04 to ededa67cb12a (76 revisions)

https://chromium.googlesource.com/external/github.com/KhronosGroup/VK-GL-CTS.git/+log/c4e6dbe68e04..ededa67cb12a 2021-04-13 timvp@google.com Always include sys/system_properties.h for Android 2021-04-09 juha.heiskanen@siru.fi Add primitive topologies for XFB query tests 2021-04-09 alexander.galazin@arm.com Merge vk-gl-cts/github-master into vk-gl-cts/master 2021-04-09 s.fricke@samsung.com Add OpImageQuerySamples with Storage Image test 2021-04-09 jdarpinian@chromium.org EXT_multisampled_render_to_texture test using ReadPixels 2021-04-08 alexander.galazin@arm.com Merge vk-gl-cts/opengl-es-cts-3.2.7 into vk-gl-cts/master 2021-04-08 alexander.galazin@arm.com Merge vk-gl-cts/opengl-cts-4.6.0 into vk-gl-cts/master 2021-04-07 alexander.galazin@arm.com Merge vk-gl-cts/vulkan-cts-1.2.6 into vk-gl-cts/master 2021-04-07 jajones@nvidia.com Add CMake detection logic for libdrm include files 2021-04-02 juha.heiskanen@siru.fi Add early fragment tests 2021-04-02 michal.jakubek@mobica.com Add tests for multisample resolve to level != 0 2021-04-02 boris.zanin@mobica.com Add coverage for 1D, 1D array and Cube array shadow images 2021-04-02 boris.zanin@mobica.com Add subgroup testing for ray tracing pipelines 2021-04-02 caio.oliveira@intel.com Test interaction between Workgroup explicit layout and zero initialization 2021-04-02 Alexander.Galazin@arm.com Merge "Merge vk-gl-cts/vulkan-cts-1.2.6 into vk-gl-cts/master" 2021-04-02 cheryl.wei@arm.com Add waived tests support for cts tools 2021-04-01 rgarcia@igalia.com Remove duplicate dataSafe function from deSTLUtil 2021-04-01 boris.zanin@mobica.com Add keys deqp-log-decompiled-spirv and deqp-log-empty-loginfo 2021-04-01 apinheiro@igalia.com Check for drawIndirectFirstInstance should only affect indirect draw calls 2021-03-31 alexander.galazin@arm.com Support GL 4.5 in the uniform location tests 2021-03-31 alexander.galazin@arm.com Support GL 4.5 in the multisample texture tests 2021-03-31 alexander.galazin@arm.com Support GL 4.5 in the EXT_texture_border_clamp tests 2021-03-30 alexander.galazin@arm.com Update Vulkan headers 2021-03-30 alexander.galazin@arm.com Support GL 4.5 in the geometry shading tests 2021-03-30 alexander.galazin@arm.com Support GL 4.5 in the tessellation tests 2021-03-30 alexander.galazin@arm.com Merge vk-gl-cts/opengl-es-cts-3.2.7 into vk-gl-cts/master 2021-03-30 alexander.galazin@arm.com Merge vk-gl-cts/vulkan-cts-1.2.6 into vk-gl-cts/master 2021-03-30 alexander.galazin@arm.com Support GL 4.5 in the copy image tests 2021-03-26 michal.jakubek@mobica.com Added tests for most-negative snorm values in images 2021-03-26 alexander.galazin@arm.com Notice of withdrawal of Vulkan CTS 1.2.2.x 2021-03-25 timvp@google.com Include sys/system_properties.h in teglAndroidUtil.cpp 2021-03-25 afdx@google.com Add a batch of GraphicsFuzz tests 2021-03-25 alexander.galazin@arm.com Merge vk-gl-cts/opengl-es-cts-3.2.7 into vk-gl-cts/master 2021-03-25 rgarcia@igalia.com QPA image viewer updates 2021-03-25 boris.zanin@mobica.com Fulfill OpControlBarrier requirement 2021-03-25 slawomir.cygan@intel.com Add an option to terminate after first failure, update READMEs 2021-03-25 slawomir.cygan@intel.com Terminate with an error if unrecognized arguments are passed to dEQP executable 2021-03-25 venni.ihanakangas@siru.fi Ensure only Unix paths are added to deqp.apk 2021-03-19 alexander.galazin@arm.com Merge vk-gl-cts/github-master into vk-gl-cts/master 2021-03-19 jbolz@nvidia.com Add tests to exercise 'readonly' SSBOs 2021-03-18 alexander.galazin@arm.com Merge vk-gl-cts/vulkan-cts-1.2.5 into vk-gl-cts/master 2021-03-18 slawomir.cygan@intel.com Fix required features checks in shaderRecordExplicitScalarOffset_6 test case 2021-03-18 tom.cooper@arm.com Add VK_EXT_headless_surface surface tests 2021-03-18 Junda.Liu@amd.com Fix robust buffer access result checking for partially out of bound cases 2021-03-18 tapani.palli@intel.com Use linear tiling with external_memory_host tests 2021-03-18 ancheng.qiao@arm.com Fix precision issue in NearestEdgeTests shaders 2021-03-17 alexander.galazin@arm.com Merge vk-gl-cts/vulkan-cts-1.2.5 into vk-gl-cts/master 2021-03-17 gleese@broadcom.com Enable shadow filtering tests for non-filterable formats 2021-03-17 rgarcia@igalia.com Add BGR and BGRA formats to image view tests 2021-03-17 alexander.galazin@arm.com Merge vk-gl-cts/opengl-es-cts-3.2.7 into vk-gl-cts/master 2021-03-17 jari.komppa@siru.fi Add tests for standard multisample positions 2021-03-17 rgarcia@igalia.com Push constant overwrite tests 2021-03-17 rgarcia@igalia.com Test large command buffers with many draw commands 2021-03-17 rgarcia@igalia.com Test barycentric coordinates in ray tracing hits 2021-03-17 rgarcia@igalia.com Add missing mandatory features 2021-03-17 venni.ihanakangas@siru.fi Ensure WSI colorspace has no effect on image contents 2021-03-17 tapani.palli@intel.com reset minSampleShading only with OpenGL Core 4.0+ 2021-03-16 alexander.galazin@arm.com Merge vk-gl-cts/opengl-es-cts-3.2.7 into vk-gl-cts/master 2021-03-16 alexander.galazin@arm.com Merge vk-gl-cts/vulkan-cts-1.2.5 into vk-gl-cts/master 2021-03-16 alexander.galazin@arm.com Merge vk-gl-cts/opengl-cts-4.6.0 into vk-gl-cts/master 2021-03-15 rgarcia@igalia.com Enable validation for all custom devices 2021-03-15 rgarcia@igalia.com Remove multiview requirement in extended dyn state tests 2021-03-15 boris.zanin@mobica.com Fix recursion depth requirement in complexcontrolflow 2021-03-15 rgarcia@igalia.com Check image extent support in watertightness tests 2021-03-15 boris.zanin@mobica.com Read deserealization size from stream 2021-03-15 gleese@broadcom.com Fix flush/invalidate in mismatched_write_op tests 2021-03-15 gleese@broadcom.com Fix sync validation for mismatched_write_op tests 2021-03-15 tapani.palli@intel.com Check if image sample count supported by VkSampleCountFlags 2021-03-15 rgarcia@igalia.com Always accumulate errors in desc set random tests 2021-03-15 syoussefi@google.com Fix missing barrier in compute test 2021-03-15 syoussefi@google.com Fix missing barrier in texture buffer test 2021-03-15 ari.suonpaa@siru.fi Replace libUI with native Android AHB API 2021-03-10 gleese@broadcom.com Add a waiver for depth bias on some Broadcom GPUs 2021-03-10 alexander.galazin@arm.com Update Vulkan/GL Readme 2021-03-10 ari.suonpaa@siru.fi Update Amber 2021-03-08 toni.salmivalli@siru.fi Add a batch of Graphicsfuzz tests If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/vk-gl-cts-angle-autoroll Please CC syoussefi@google.com,angle-bots+autoroll-info@google.com on the revert to ensure that a human is aware of the problem. To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/master/autoroll/README.md Bug: angleproject:5816 Change-Id: I324ce9596a62771726dc4504b2341e049818f7de Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2807533Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
parent c782ef19
......@@ -29,7 +29,7 @@ vars = {
'dummy_checkout_chromium': False,
# Current revision of VK-GL-CTS (a.k.a dEQP).
'vk_gl_cts_revision': 'c4e6dbe68e043d6697f60768baf5b2876c6596c6',
'vk_gl_cts_revision': 'ededa67cb12aec0c5e92e3eba40d3f3c7b4d697f',
# Current revision of googletest.
# Note: this dep cannot be auto-rolled b/c of nesting.
......
......@@ -6,7 +6,7 @@
"src/tests/deqp_support/deqp_data_autogen.gni":
"3a74e9e404a9b1a4ff1a78d8a640c472",
"third_party/VK-GL-CTS/src/CMakeLists.txt":
"c7a733365029f77382d34a1f55c8fbd1",
"949042acfa4a257f7ea1126681d59d2e",
"third_party/VK-GL-CTS/src/execserver/CMakeLists.txt":
"38aa187592e6ef9a331fc1ea313fc68d",
"third_party/VK-GL-CTS/src/executor/CMakeLists.txt":
......@@ -96,9 +96,9 @@
"third_party/VK-GL-CTS/src/external/vulkancts/modules/vulkan/rasterization/CMakeLists.txt":
"13850a7e8d1f12fc9d1ba5b3314c54eb",
"third_party/VK-GL-CTS/src/external/vulkancts/modules/vulkan/ray_query/CMakeLists.txt":
"93b1670e6e54c125ed659fd46da18ed9",
"5e106b9d055144bc4db2e3e478191a5c",
"third_party/VK-GL-CTS/src/external/vulkancts/modules/vulkan/ray_tracing/CMakeLists.txt":
"41033012125348ad28fc3a1b0f2e81e3",
"53b436e7a42e17135503b8fe5491c679",
"third_party/VK-GL-CTS/src/external/vulkancts/modules/vulkan/renderpass/CMakeLists.txt":
"154254ec9d21124a3ef46ad9e5cb1829",
"third_party/VK-GL-CTS/src/external/vulkancts/modules/vulkan/robustness/CMakeLists.txt":
......@@ -162,7 +162,7 @@
"third_party/VK-GL-CTS/src/framework/opengl/wrapper/CMakeLists.txt":
"31a7adfb6e907b53ef24bb6ea044b838",
"third_party/VK-GL-CTS/src/framework/platform/CMakeLists.txt":
"61165590822c668da40db99db8f2b45b",
"1abeb4f05ee0db1fccfa002957b10c2f",
"third_party/VK-GL-CTS/src/framework/qphelper/CMakeLists.txt":
"e5d27635282f53b760c13cc68374e586",
"third_party/VK-GL-CTS/src/framework/randomshaders/CMakeLists.txt":
......@@ -180,7 +180,7 @@
"third_party/VK-GL-CTS/src/modules/gles2/accuracy/CMakeLists.txt":
"a6677806fdbde7ecb6c61aced41d4bed",
"third_party/VK-GL-CTS/src/modules/gles2/functional/CMakeLists.txt":
"7c30918f4517fe75af1c0681be2244a0",
"e9acbb5a31fcba3dfe637ae31ac23a62",
"third_party/VK-GL-CTS/src/modules/gles2/performance/CMakeLists.txt":
"c62305ca30bf2a2af2d728ac8617bfce",
"third_party/VK-GL-CTS/src/modules/gles2/stress/CMakeLists.txt":
......
......@@ -918,9 +918,7 @@ if (build_angle_deqp_tests && !is_fuchsia) {
"/wd4996", # deprecated
]
}
if (is_android) {
include_dirs += [ "$deqp_path/framework/platform/android" ]
}
defines = [
"DEQP_SUPPORT_GLES31=1",
"DEQP_SUPPORT_GLES3=1",
......@@ -936,6 +934,17 @@ if (build_angle_deqp_tests && !is_fuchsia) {
"ANGLE_DEQP_DATA_DIR=\"gen/vk_gl_cts_data/data\"",
]
if (is_android) {
include_dirs += [ "$deqp_path/framework/platform/android" ]
_android_api = android64_ndk_api_level
if (!angle_64bit_current_cpu) {
_android_api = android32_ndk_api_level
}
defines += [ "DE_ANDROID_API=" + "${_android_api}" ]
}
if (is_clang) {
# TODO(jmadill): Remove this once we fix dEQP.
cflags_c = [ "-Wno-unused-local-typedef" ]
......@@ -1193,7 +1202,6 @@ if (build_angle_deqp_tests && !is_fuchsia) {
]
sources = deqp_libtester_sources
if (is_android) {
sources += deqp_libtester_sources_android
libs = [ "log" ]
}
}
......
......@@ -26,6 +26,7 @@ deqp_include_dirs = [
"$deqp_path/modules/gles31/functional",
"$deqp_path/modules/gles31/stress",
"$deqp_path/modules/glusecases",
"$deqp_path/modules/egl",
"${angle_glslang_dir}",
"${angle_spirv_tools_dir}",
]
......@@ -101,6 +102,8 @@ deqp_gles2_sources = [
"$deqp_path/modules/gles2/functional/es2fLightAmountTest.hpp",
"$deqp_path/modules/gles2/functional/es2fMultisampleTests.cpp",
"$deqp_path/modules/gles2/functional/es2fMultisampleTests.hpp",
"$deqp_path/modules/gles2/functional/es2fMultisampledRenderToTextureTests.cpp",
"$deqp_path/modules/gles2/functional/es2fMultisampledRenderToTextureTests.hpp",
"$deqp_path/modules/gles2/functional/es2fNegativeBufferApiTests.cpp",
"$deqp_path/modules/gles2/functional/es2fNegativeBufferApiTests.hpp",
"$deqp_path/modules/gles2/functional/es2fNegativeFragmentApiTests.cpp",
......@@ -748,7 +751,8 @@ deqp_gles31_sources = [
]
deqp_egl_sources = [
"$deqp_path/modules/egl/teglAndroidUtil.cpp",
# "$deqp_path/modules/egl/teglAndroidUtil.cpp", # anglebug.com/5816: build failure. Fixed in
# https://gerrit.khronos.org/c/vk-gl-cts/+/7296
"$deqp_path/modules/egl/teglAndroidUtil.hpp",
"$deqp_path/modules/egl/teglApiCase.cpp",
"$deqp_path/modules/egl/teglApiCase.hpp",
......@@ -851,6 +855,9 @@ deqp_egl_sources = [
"$deqp_path/modules/egl/teglVGRenderUtil.hpp",
"$deqp_path/modules/egl/teglWideColorTests.cpp",
"$deqp_path/modules/egl/teglWideColorTests.hpp",
# Overrides
"deqp_support//teglAndroidUtil_override.cpp", # anglebug.com/5816
]
deqp_khr_common_sources = [
......@@ -2015,8 +2022,3 @@ deqp_libtester_sources = [
"deqp_support/tcuRandomOrderExecutor.cpp",
"deqp_support/tcuRandomOrderExecutor.h",
]
deqp_libtester_sources_android = [
"$deqp_path/framework/platform/android/tcuAndroidInternals.cpp",
"$deqp_path/framework/platform/android/tcuAndroidInternals.hpp",
]
/*-------------------------------------------------------------------------
* drawElements Quality Program EGL Module
* ---------------------------------------
*
* Copyright 2014 The Android Open Source Project
*
* 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 Android-specific operations.
*//*--------------------------------------------------------------------*/
#include "teglAndroidUtil.hpp"
#include "deStringUtil.hpp"
#include "eglwEnums.hpp"
#include "eglwLibrary.hpp"
#include "gluTextureUtil.hpp"
#include "glwEnums.hpp"
#include "tcuTextureUtil.hpp"
namespace deqp
{
namespace egl
{
namespace Image
{
using de::MovePtr;
using eglu::AttribMap;
using std::string;
using tcu::PixelBufferAccess;
using tcu::Texture2D;
using tcu::TextureFormat;
using namespace glw;
using namespace eglw;
#if (DE_OS != DE_OS_ANDROID)
MovePtr<ImageSource> createAndroidNativeImageSource(GLenum format)
{
return createUnsupportedImageSource("Not Android platform", format);
}
#else // DE_OS == DE_OS_ANDROID
# if defined(__ANDROID_API_O__) && (DE_ANDROID_API >= __ANDROID_API_O__)
# define BUILT_WITH_ANDROID_HARDWARE_BUFFER 1
# endif
# if defined(__ANDROID_API_P__) && (DE_ANDROID_API >= __ANDROID_API_P__)
# define BUILT_WITH_ANDROID_P_HARDWARE_BUFFER 1
# endif
# if !defined(BUILT_WITH_ANDROID_HARDWARE_BUFFER)
MovePtr<ImageSource> createAndroidNativeImageSource(GLenum format)
{
return createUnsupportedImageSource("AHB API not supported", format);
}
# else // defined(BUILT_WITH_ANDROID_HARDWARE_BUFFER)
namespace
{
# include <android/hardware_buffer.h>
# include <sys/system_properties.h>
# include "deDynamicLibrary.hpp"
deInt32 androidGetSdkVersion(void)
{
static deInt32 sdkVersion = -1;
if (sdkVersion < 0)
{
char value[128] = {0};
__system_property_get("ro.build.version.sdk", value);
sdkVersion = static_cast<deInt32>(strtol(value, DE_NULL, 10));
printf("SDK Version is %d\n", sdkVersion);
}
return sdkVersion;
}
typedef int (*pfnAHardwareBuffer_allocate)(const AHardwareBuffer_Desc *desc,
AHardwareBuffer **outBuffer);
typedef void (*pfnAHardwareBuffer_describe)(const AHardwareBuffer *buffer,
AHardwareBuffer_Desc *outDesc);
typedef void (*pfnAHardwareBuffer_acquire)(AHardwareBuffer *buffer);
typedef void (*pfnAHardwareBuffer_release)(AHardwareBuffer *buffer);
typedef int (*pfnAHardwareBuffer_isSupported)(const AHardwareBuffer_Desc *desc);
struct AhbFunctions
{
pfnAHardwareBuffer_allocate allocate;
pfnAHardwareBuffer_describe describe;
pfnAHardwareBuffer_acquire acquire;
pfnAHardwareBuffer_release release;
pfnAHardwareBuffer_isSupported isSupported;
};
AhbFunctions ahbFunctions;
bool ahbFunctionsLoaded(AhbFunctions *pAhbFunctions)
{
static bool ahbApiLoaded = false;
if (ahbApiLoaded ||
((pAhbFunctions->allocate != DE_NULL) && (pAhbFunctions->describe != DE_NULL) &&
(pAhbFunctions->acquire != DE_NULL) && (pAhbFunctions->release != DE_NULL) &&
(pAhbFunctions->isSupported != DE_NULL)))
{
ahbApiLoaded = true;
return true;
}
return false;
}
bool loadAhbDynamicApis(deInt32 sdkVersion)
{
if (sdkVersion >= __ANDROID_API_O__)
{
if (!ahbFunctionsLoaded(&ahbFunctions))
{
static de::DynamicLibrary libnativewindow("libnativewindow.so");
ahbFunctions.allocate = reinterpret_cast<pfnAHardwareBuffer_allocate>(
libnativewindow.getFunction("AHardwareBuffer_allocate"));
ahbFunctions.describe = reinterpret_cast<pfnAHardwareBuffer_describe>(
libnativewindow.getFunction("AHardwareBuffer_describe"));
ahbFunctions.acquire = reinterpret_cast<pfnAHardwareBuffer_acquire>(
libnativewindow.getFunction("AHardwareBuffer_acquire"));
ahbFunctions.release = reinterpret_cast<pfnAHardwareBuffer_release>(
libnativewindow.getFunction("AHardwareBuffer_release"));
ahbFunctions.isSupported = reinterpret_cast<pfnAHardwareBuffer_isSupported>(
libnativewindow.getFunction("AHardwareBuffer_isSupported"));
return ahbFunctionsLoaded(&ahbFunctions);
}
else
{
return true;
}
}
return false;
}
AHardwareBuffer_Format getPixelFormat(GLenum format)
{
switch (format)
{
case GL_RGB565:
return AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM;
case GL_RGB8:
return AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM;
case GL_RGBA8:
return AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM;
case GL_DEPTH_COMPONENT16:
return AHARDWAREBUFFER_FORMAT_D16_UNORM;
case GL_DEPTH_COMPONENT24:
return AHARDWAREBUFFER_FORMAT_D24_UNORM;
case GL_DEPTH24_STENCIL8:
return AHARDWAREBUFFER_FORMAT_D24_UNORM_S8_UINT;
case GL_DEPTH_COMPONENT32F:
return AHARDWAREBUFFER_FORMAT_D32_FLOAT;
case GL_DEPTH32F_STENCIL8:
return AHARDWAREBUFFER_FORMAT_D32_FLOAT_S8_UINT;
case GL_RGB10_A2:
return AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM;
case GL_RGBA16F:
return AHARDWAREBUFFER_FORMAT_R16G16B16A16_FLOAT;
case GL_STENCIL_INDEX8:
return AHARDWAREBUFFER_FORMAT_S8_UINT;
default:
TCU_THROW(NotSupportedError, "Texture format unsupported by Android");
}
}
class AndroidNativeClientBuffer : public ClientBuffer
{
public:
AndroidNativeClientBuffer(const Library &egl, GLenum format);
~AndroidNativeClientBuffer(void);
EGLClientBuffer get(void) const;
void lock(void **data);
void unlock(void);
private:
const Library &m_egl;
AHardwareBuffer *m_hardwareBuffer;
};
AndroidNativeClientBuffer::AndroidNativeClientBuffer(const Library &egl, GLenum format) : m_egl(egl)
{
// deInt32 sdkVersion = checkAnbApiBuild();
deInt32 sdkVersion = androidGetSdkVersion();
# if defined(BUILT_WITH_ANDROID_P_HARDWARE_BUFFER)
// When testing AHB on Android-P and newer the CTS must be compiled against API28 or newer.
DE_TEST_ASSERT(sdkVersion >= 28); /*__ANDROID_API_P__ */
# else
// When testing AHB on Android-O and newer the CTS must be compiled against API26 or newer.
DE_TEST_ASSERT(sdkVersion >= 26); /* __ANDROID_API_O__ */
# endif // !defined(BUILT_WITH_ANDROID_P_HARDWARE_BUFFER)
if (sdkVersion >= __ANDROID_API_O__)
{
# if defined(BUILT_WITH_ANDROID_HARDWARE_BUFFER)
if (!loadAhbDynamicApis(sdkVersion))
{
// Couldn't load Android AHB system APIs.
DE_TEST_ASSERT(false);
}
# else
// Invalid Android AHB APIs configuration. Please check the instructions on how to build NDK
// for Android.
DE_TEST_ASSERT(false);
# endif // defined(BUILT_WITH_ANDROID_HARDWARE_BUFFER)
}
AHardwareBuffer_Desc hbufferdesc = {
64u,
64u,
1u, // number of images
getPixelFormat(format),
AHARDWAREBUFFER_USAGE_CPU_READ_OFTEN | AHARDWAREBUFFER_USAGE_CPU_WRITE_RARELY |
AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE | AHARDWAREBUFFER_USAGE_GPU_FRAMEBUFFER,
0u, // Stride in pixels, ignored for AHardwareBuffer_allocate()
0u, // Initialize to zero, reserved for future use
0u // Initialize to zero, reserved for future use
};
if (!ahbFunctions.isSupported(&hbufferdesc))
TCU_THROW(NotSupportedError, "Texture format unsupported");
ahbFunctions.allocate(&hbufferdesc, &m_hardwareBuffer);
}
AndroidNativeClientBuffer::~AndroidNativeClientBuffer(void)
{
ahbFunctions.release(m_hardwareBuffer);
}
EGLClientBuffer AndroidNativeClientBuffer::get(void) const
{
typedef EGLW_APICALL EGLClientBuffer(EGLW_APIENTRY * eglGetNativeClientBufferANDROIDFunc)(
const struct AHardwareBuffer *buffer);
return ((eglGetNativeClientBufferANDROIDFunc)m_egl.getProcAddress(
"eglGetNativeClientBufferANDROID"))(m_hardwareBuffer);
}
void AndroidNativeClientBuffer::lock(void **data)
{
const int status = AHardwareBuffer_lock(
m_hardwareBuffer, AHARDWAREBUFFER_USAGE_CPU_WRITE_RARELY, -1, DE_NULL, data);
if (status != 0)
TCU_FAIL(("AHardwareBuffer_lock failed with error: " + de::toString(status)).c_str());
}
void AndroidNativeClientBuffer::unlock(void)
{
const int status = AHardwareBuffer_unlock(m_hardwareBuffer, DE_NULL);
if (status != 0)
TCU_FAIL(("AHardwareBuffer_unlock failed with error: " + de::toString(status)).c_str());
}
class AndroidNativeImageSource : public ImageSource
{
public:
AndroidNativeImageSource(GLenum format) : m_format(format) {}
~AndroidNativeImageSource(void);
MovePtr<ClientBuffer> createBuffer(const Library &egl,
const glw::Functions &,
Texture2D *) const;
string getRequiredExtension(void) const { return "EGL_ANDROID_get_native_client_buffer"; }
EGLImageKHR createImage(const Library &egl,
EGLDisplay dpy,
EGLContext ctx,
EGLClientBuffer clientBuffer) const;
GLenum getEffectiveFormat(void) const { return m_format; }
protected:
GLenum m_format;
};
AndroidNativeImageSource::~AndroidNativeImageSource(void) {}
MovePtr<ClientBuffer> AndroidNativeImageSource::createBuffer(const Library &egl,
const glw::Functions &,
Texture2D *ref) const
{
MovePtr<AndroidNativeClientBuffer> buffer(new AndroidNativeClientBuffer(egl, m_format));
if (ref != DE_NULL)
{
const TextureFormat texFormat = glu::mapGLInternalFormat(m_format);
void *bufferData = DE_NULL;
*ref = Texture2D(texFormat, 64, 64);
ref->allocLevel(0);
tcu::fillWithComponentGradients(ref->getLevel(0), tcu::Vec4(0.0f, 0.0f, 0.0f, 0.0f),
tcu::Vec4(1.0f, 1.0f, 1.0f, 1.0f));
buffer->lock(&bufferData);
{
PixelBufferAccess nativeBuffer(texFormat, 64, 64, 1, bufferData);
tcu::copy(nativeBuffer, ref->getLevel(0));
}
buffer->unlock();
}
return MovePtr<ClientBuffer>(buffer);
}
EGLImageKHR AndroidNativeImageSource::createImage(const Library &egl,
EGLDisplay dpy,
EGLContext,
EGLClientBuffer clientBuffer) const
{
static const EGLint attribs[] = {EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE};
const EGLImageKHR image =
egl.createImageKHR(dpy, EGL_NO_CONTEXT, EGL_NATIVE_BUFFER_ANDROID, clientBuffer, attribs);
EGLU_CHECK_MSG(egl, "eglCreateImageKHR()");
return image;
}
} // namespace
MovePtr<ImageSource> createAndroidNativeImageSource(GLenum format)
{
try
{
return MovePtr<ImageSource>(new AndroidNativeImageSource(format));
}
catch (const std::runtime_error &exc)
{
return createUnsupportedImageSource(
string("Android native buffers unsupported: ") + exc.what(), format);
}
}
# endif // defined(BUILT_WITH_ANDROID_HARDWARE_BUFFER)
#endif // DE_OS == DE_OS_ANDROID
} // namespace Image
} // namespace egl
} // namespace deqp
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