Skip to content

Commit 9893436

Browse files
committed
VkVSCommon: avoid vulkan includes
As some includes are not available in CTS such as vk_enum_string_helper.h, avoid to include it and just stringify the VkResult.
1 parent 64e5640 commit 9893436

5 files changed

Lines changed: 8 additions & 31 deletions

File tree

common/include/VkVSCommon.h

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ extern "C" {
4040
#ifdef __cplusplus
4141
} // extern "C"
4242

43-
// C++ only macros and utilities
44-
#include <iostream>
45-
#include <vulkan/vulkan.h>
46-
#include "vk_enum_string_helper.h"
47-
4843
// Macro to check Vulkan features and return error if not supported
4944
// Note: This macro contains a return statement - use with care
5045
#define CHECK_VULKAN_FEATURE(feature, name, optional) \
@@ -62,21 +57,6 @@ extern "C" {
6257
#define VKVS_CASE_STR(x) case x: return VKVS_STRINGIFY(x)
6358
#endif
6459

65-
// Helper function to get string representation of VkResult codes
66-
// Handles video-specific extension codes and falls back to generated string_VkResult()
67-
inline const char* string_VkResult_Extended(VkResult result) {
68-
// First try video-specific error codes
69-
switch (result) {
70-
VKVS_CASE_STR(VK_ERROR_VIDEO_PROFILE_OPERATION_NOT_SUPPORTED_KHR);
71-
VKVS_CASE_STR(VK_ERROR_VIDEO_PROFILE_FORMAT_NOT_SUPPORTED_KHR);
72-
VKVS_CASE_STR(VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR);
73-
VKVS_CASE_STR(VK_ERROR_VIDEO_STD_VERSION_NOT_SUPPORTED_KHR);
74-
default:
75-
// Fall back to generated string_VkResult()
76-
return string_VkResult(result);
77-
}
78-
}
79-
8060
// Helper function to check if a VkResult indicates video profile/feature not supported
8161
// Returns true for video-specific KHR errors (profile, format, codec, std version)
8262
// and general Vulkan capability errors (format, feature, driver, extension)

common/libs/VkCodecUtils/VulkanVideoProcessor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ VkResult VulkanVideoProcessor::Initialize(const VulkanDeviceContext* vkDevCtx,
136136

137137
if (result != VK_SUCCESS) {
138138
std::cerr << "FATAL ERROR: Video decode capabilities not supported for this codec/profile!" << std::endl;
139-
std::cerr << "GetVideoDecodeCapabilities failed with error: " << string_VkResult_Extended(result) << std::endl;
139+
std::cerr << "GetVideoDecodeCapabilities failed with error: " << VKVS_STRINGIFY(result) << std::endl;
140140
return result;
141141
}
142142

vk_video_encoder/libs/VkVideoEncoder/VkEncoderConfigAV1.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616

1717
#include "VkVideoEncoder/VkEncoderConfigAV1.h"
18-
#include "vk_enum_string_helper.h"
1918

2019
#define READ_PARAM(i, param, type) { \
2120
int32_t data = 0; \
@@ -204,11 +203,11 @@ VkResult EncoderConfigAV1::InitDeviceCapabilities(const VulkanDeviceContext* vkD
204203
if (IsVideoUnsupportedResult(result)) {
205204
// Not supported by hardware/driver - return VK_ERROR_INCOMPATIBLE_DRIVER
206205
std::cerr << "*** Video encode capabilities not supported by hardware/driver ("
207-
<< string_VkResult_Extended(result) << ") ***" << std::endl;
206+
<< VKVS_STRINGIFY(result) << ") ***" << std::endl;
208207
return VK_ERROR_INCOMPATIBLE_DRIVER;
209208
}
210209
// Actual error (e.g., out of memory)
211-
std::cerr << "*** Error getting video capabilities: " << string_VkResult_Extended(result) << " ***" << std::endl;
210+
std::cerr << "*** Error getting video capabilities: " << VKVS_STRINGIFY(result) << " ***" << std::endl;
212211
return result;
213212
}
214213

vk_video_encoder/libs/VkVideoEncoder/VkEncoderConfigH264.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
#include "VkVideoEncoder/VkEncoderConfigH264.h"
1818
#include "VkVideoEncoder/VkVideoEncoderH264.h"
19-
#include "vk_enum_string_helper.h"
2019

2120
int EncoderConfigH264::DoParseArguments(int argc, char* argv[])
2221
{
@@ -407,11 +406,11 @@ VkResult EncoderConfigH264::InitDeviceCapabilities(const VulkanDeviceContext* vk
407406
if (IsVideoUnsupportedResult(result)) {
408407
// Not supported by hardware/driver - return VK_ERROR_INCOMPATIBLE_DRIVER
409408
std::cerr << "*** Video encode capabilities not supported by hardware/driver ("
410-
<< string_VkResult_Extended(result) << ") ***" << std::endl;
409+
<< VKVS_STRINGIFY(result) << ") ***" << std::endl;
411410
return VK_ERROR_INCOMPATIBLE_DRIVER;
412411
}
413412
// Actual error (e.g., out of memory)
414-
std::cerr << "*** Error getting video capabilities: " << string_VkResult_Extended(result) << " ***" << std::endl;
413+
std::cerr << "*** Error getting video capabilities: " << VKVS_STRINGIFY(result) << " ***" << std::endl;
415414
return result;
416415
}
417416

vk_video_encoder/libs/VkVideoEncoder/VkEncoderConfigH265.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <math.h> /* sqrt */
1818
#include "VkVideoEncoder/VkEncoderConfigH265.h"
1919
#include "VkVideoEncoder/VkVideoEncoderH265.h"
20-
#include "vk_enum_string_helper.h"
2120

2221
static void SetupAspectRatio(StdVideoH265SequenceParameterSetVui *vui, uint32_t width, uint32_t height,
2322
uint32_t darWidth, uint32_t darHeight)
@@ -128,11 +127,11 @@ VkResult EncoderConfigH265::InitDeviceCapabilities(const VulkanDeviceContext* vk
128127
if (IsVideoUnsupportedResult(result)) {
129128
// Not supported by hardware/driver - return VK_ERROR_INCOMPATIBLE_DRIVER
130129
std::cerr << "*** Video encode capabilities not supported by hardware/driver ("
131-
<< string_VkResult_Extended(result) << ") ***" << std::endl;
130+
<< VKVS_STRINGIFY(result) << ") ***" << std::endl;
132131
return VK_ERROR_INCOMPATIBLE_DRIVER;
133132
}
134133
// Actual error (e.g., out of memory)
135-
std::cerr << "*** Error getting video capabilities: " << string_VkResult_Extended(result) << " ***" << std::endl;
134+
std::cerr << "*** Error getting video capabilities: " << VKVS_STRINGIFY(result) << " ***" << std::endl;
136135
return result;
137136
}
138137

@@ -153,7 +152,7 @@ VkResult EncoderConfigH265::InitDeviceCapabilities(const VulkanDeviceContext* vk
153152
qualityLevelProperties,
154153
h265QualityLevelProperties);
155154
if (result != VK_SUCCESS) {
156-
std::cout << "*** Could not get Video Encode QualityLevel Properties :" << string_VkResult_Extended(result) << " ***" << std::endl;
155+
std::cout << "*** Could not get Video Encode QualityLevel Properties :" << VKVS_STRINGIFY(result) << " ***" << std::endl;
157156
return result;
158157
}
159158

0 commit comments

Comments
 (0)