mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
This fixes three problems in `test_vulkan`:
1. One negative test is violating the OpenCL specification. A call to
`clEnqueue{Wait,Signal}SemaphoresKHR` with an invalid semaphore should
return `CL_INVALID_SEMAPHORE_KHR` and not `CL_INVALID_VALUE`.
>
[CL_INVALID_SEMAPHORE_KHR](https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_API.html#CL_INVALID_SEMAPHORE_KHR)
if any of the semaphore objects specified by sema_objects is not valid.
2. When populating the list of supported external memory handle types
for Vulkan, the types are unconditionally added to the list, without
checking if the device supports it or not, this fix is namely for
`VULKAN_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD`.
3. If a device does not support an optional extension (that is required
for a test), the test should skip, not throw an exception and fail. A
test failure should be reserved for the cases where a device claims
support for an extension but then fails to execute the test correctly.
---------
Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
82 lines
3.3 KiB
C++
82 lines
3.3 KiB
C++
//
|
|
// Copyright (c) 2024 The Khronos Group Inc.
|
|
//
|
|
// 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.
|
|
//
|
|
|
|
#ifndef _vulkan_utility_hpp_
|
|
#define _vulkan_utility_hpp_
|
|
|
|
#include "vulkan_wrapper_types.hpp"
|
|
#include <vector>
|
|
#include <ostream>
|
|
#include <string.h>
|
|
#include <map>
|
|
#include "../../../test_common/harness/testHarness.h"
|
|
|
|
#define STRING_(str) #str
|
|
#define STRING(str) STRING_(str)
|
|
|
|
#define ROUND_UP(n, multiple) \
|
|
(((n) + (multiple)-1) - ((((n) + (multiple)-1)) % (multiple)))
|
|
|
|
const VulkanInstance& getVulkanInstance();
|
|
const VulkanPhysicalDevice& getVulkanPhysicalDevice();
|
|
const VulkanPhysicalDevice&
|
|
getAssociatedVulkanPhysicalDevice(cl_device_id deviceId);
|
|
const VulkanQueueFamily& getVulkanQueueFamily(
|
|
const VulkanPhysicalDevice& physicalDevice = getVulkanPhysicalDevice(),
|
|
uint32_t queueFlags = VULKAN_QUEUE_FLAG_GRAPHICS
|
|
| VULKAN_QUEUE_FLAG_COMPUTE);
|
|
const VulkanMemoryType&
|
|
getVulkanMemoryType(const VulkanDevice& device,
|
|
VulkanMemoryTypeProperty memoryTypeProperty);
|
|
bool checkVkSupport();
|
|
const VulkanQueueFamilyList& getEmptyVulkanQueueFamilyList();
|
|
const VulkanDescriptorSetLayoutList& getEmptyVulkanDescriptorSetLayoutList();
|
|
const VulkanQueueFamilyToQueueCountMap&
|
|
getDefaultVulkanQueueFamilyToQueueCountMap();
|
|
const std::vector<VulkanExternalMemoryHandleType>
|
|
getSupportedVulkanExternalMemoryHandleTypeList(
|
|
const VulkanPhysicalDevice& physical_device);
|
|
const std::vector<VulkanExternalSemaphoreHandleType>
|
|
getSupportedVulkanExternalSemaphoreHandleTypeList(const VulkanDevice& vkDevice);
|
|
std::vector<VulkanExternalSemaphoreHandleType>
|
|
getSupportedInteropExternalSemaphoreHandleTypes(cl_device_id device,
|
|
VulkanDevice& vkDevice);
|
|
const std::vector<VulkanFormat> getSupportedVulkanFormatList();
|
|
|
|
uint32_t getVulkanFormatElementSize(VulkanFormat format);
|
|
const char* getVulkanFormatGLSLFormat(VulkanFormat format);
|
|
const char* getVulkanFormatGLSLTypePrefix(VulkanFormat format);
|
|
cl_external_semaphore_handle_type_khr getCLSemaphoreTypeFromVulkanType(
|
|
VulkanExternalSemaphoreHandleType vulkanExternalSemaphoreHandleType);
|
|
|
|
std::string prepareVulkanShader(
|
|
std::string shaderCode,
|
|
const std::map<std::string, std::string>& patternToSubstituteMap);
|
|
|
|
std::ostream& operator<<(std::ostream& os,
|
|
VulkanMemoryTypeProperty memoryTypeProperty);
|
|
std::ostream&
|
|
operator<<(std::ostream& os,
|
|
VulkanExternalMemoryHandleType externalMemoryHandleType);
|
|
std::ostream&
|
|
operator<<(std::ostream& os,
|
|
VulkanExternalSemaphoreHandleType externalSemaphoreHandleType);
|
|
std::ostream& operator<<(std::ostream& os, VulkanFormat format);
|
|
|
|
std::vector<char> readFile(const std::string& filename,
|
|
const std::string& startdir);
|
|
#endif // _vulkan_utility_hpp_
|