Skip to content

Commit

Permalink
layer: remove VK_LAYER_SETTING_TYPE_FRAMESET_EXT
Browse files Browse the repository at this point in the history
After VK_EXT_layer_settings spec review, this new type
was judge unnecessary because it could be express by
three uint32. However, it still remains useful for the
layer settings library to correctly interpret formated
strings that represent "framesets".
  • Loading branch information
christophe-lunarg committed Aug 30, 2023
1 parent b0712df commit 33e9ad7
Show file tree
Hide file tree
Showing 13 changed files with 310 additions and 230 deletions.
29 changes: 28 additions & 1 deletion include/vulkan/layer/vk_layer_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,35 @@ extern "C" {

#include "vk_layer_settings_ext.h"

typedef enum VlLayerSettingType {
VL_LAYER_SETTING_TYPE_BOOL32 = VK_LAYER_SETTING_TYPE_BOOL32_EXT,
VL_LAYER_SETTING_TYPE_INT32 = VK_LAYER_SETTING_TYPE_INT32_EXT,
VL_LAYER_SETTING_TYPE_INT64 = VK_LAYER_SETTING_TYPE_INT64_EXT,
VL_LAYER_SETTING_TYPE_UINT32 = VK_LAYER_SETTING_TYPE_UINT32_EXT,
VL_LAYER_SETTING_TYPE_UINT64 = VK_LAYER_SETTING_TYPE_UINT64_EXT,
VL_LAYER_SETTING_TYPE_FLOAT32 = VK_LAYER_SETTING_TYPE_FLOAT32_EXT,
VL_LAYER_SETTING_TYPE_FLOAT64 = VK_LAYER_SETTING_TYPE_FLOAT64_EXT,
VL_LAYER_SETTING_TYPE_STRING = VK_LAYER_SETTING_TYPE_STRING_EXT,
VL_LAYER_SETTING_TYPE_FRAMESET,
VL_LAYER_SETTING_TYPE_FRAMESET_STRING
} VlLayerSettingType;

VK_DEFINE_HANDLE(VlLayerSettingSet)

// - `first` is an integer related to the first frame to be processed.
// The frame numbering is 0-based.
// - `count` is an integer related to the number of frames to be
// processed. A count of zero represents every frame after the start of the range.
// - `step` is an integer related to the interval between frames. A step of zero
// represent no frame to be processed.
// between frames to be processed.

typedef struct VlFrameset {
uint32_t first;
uint32_t count;
uint32_t step;
} VlFrameset;

typedef void (VKAPI_PTR *VlLayerSettingLogCallback)(const char *pSettingName, const char *pMessage);

// Create a layer setting set. If 'pCallback' is set to NULL, the messages are outputed to stderr.
Expand All @@ -30,7 +57,7 @@ void vlDestroyLayerSettingSet(VlLayerSettingSet layerSettingSet, const VkAllocat
VkBool32 vlHasLayerSetting(VlLayerSettingSet layerSettingSet, const char *pSettingName);

// Query setting values
VkResult vlGetLayerSettingValues(VlLayerSettingSet layerSettingSet, const char *pSettingName, VkLayerSettingTypeEXT type,
VkResult vlGetLayerSettingValues(VlLayerSettingSet layerSettingSet, const char *pSettingName, VlLayerSettingType type,
uint32_t *pValueCount, void *pValues);

const VkLayerSettingsCreateInfoEXT *vlFindLayerSettingsCreateInfo(const VkInstanceCreateInfo *pCreateInfo);
Expand Down
6 changes: 3 additions & 3 deletions include/vulkan/layer/vk_layer_settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ void vlGetLayerSettingValues(VlLayerSettingSet layerSettingSet,
const char *pSettingName, std::vector<std::string> &settingValues);

void vlGetLayerSettingValue(VlLayerSettingSet layerSettingSet,
const char *pSettingName, VkFramesetEXT &settingValue);
const char *pSettingName, VlFrameset &settingValue);

void vlGetLayerSettingValues(VlLayerSettingSet layerSettingSet, const char *pSettingName,
std::vector<VkFramesetEXT> &settingValues);
void vlGetLayerSettingValues(VlLayerSettingSet layerSettingSet,
const char *pSettingName, std::vector<VlFrameset> &settingValues);

// Required by vk_safe_struct
typedef std::pair<uint32_t, uint32_t> VlCustomSTypeInfo;
Expand Down
9 changes: 1 addition & 8 deletions include/vulkan/layer/vk_layer_settings_ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,9 @@ typedef enum VkLayerSettingTypeEXT {
VK_LAYER_SETTING_TYPE_UINT64_EXT,
VK_LAYER_SETTING_TYPE_FLOAT32_EXT,
VK_LAYER_SETTING_TYPE_FLOAT64_EXT,
VK_LAYER_SETTING_TYPE_STRING_EXT,
VK_LAYER_SETTING_TYPE_FRAMESET_EXT
VK_LAYER_SETTING_TYPE_STRING_EXT
} VkLayerSettingTypeEXT;

typedef struct VkFramesetEXT {
uint32_t first;
uint32_t count;
uint32_t step;
} VkFramesetEXT;

typedef struct VkLayerSettingEXT {
const char *pLayerName;
const char *pSettingName;
Expand Down
10 changes: 5 additions & 5 deletions src/layer/layer_settings_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,10 @@ int64_t ToInt64(const std::string &token) {
return int_id;
}

VkFramesetEXT ToFrameSet(const std::string &s) {
VlFrameset ToFrameSet(const std::string &s) {
assert(IsFrameSets(s));

VkFramesetEXT frameset{0, 1, 1};
VlFrameset frameset{0, 1, 1};

const std::vector<std::string> &frameset_split = vl::Split(s, '-');
if (frameset_split.size() >= 1) {
Expand All @@ -217,10 +217,10 @@ VkFramesetEXT ToFrameSet(const std::string &s) {
return frameset;
}

std::vector<VkFramesetEXT> ToFrameSets(const std::string &s) {
std::vector<VlFrameset> ToFrameSets(const std::string &s) {
std::vector<std::string> tokens = Split(s, FindDelimiter(s));

std::vector<VkFramesetEXT> results;
std::vector<VlFrameset> results;
results.resize(tokens.size());
for (std::size_t i = 0, n = tokens.size(); i < n; ++i) {
results[i] = ToFrameSet(tokens[i]);
Expand All @@ -247,7 +247,7 @@ bool IsFloat(const std::string &s) {
return std::regex_search(s, FRAME_REGEX);
}

std::string Format(const char *message, ...) {
std::string FormatString(const char *message, ...) {
std::size_t const STRING_BUFFER(4096);

assert(message != nullptr);
Expand Down
6 changes: 3 additions & 3 deletions src/layer/layer_settings_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ namespace vl {

bool IsFrameSets(const std::string &s);

VkFramesetEXT ToFrameSet(const std::string &s);
VlFrameset ToFrameSet(const std::string &s);

std::vector<VkFramesetEXT> ToFrameSets(const std::string &s);
std::vector<VlFrameset> ToFrameSets(const std::string &s);

bool IsInteger(const std::string &s);

bool IsFloat(const std::string &s);

std::string Format(const char *message, ...);
std::string FormatString(const char *message, ...);
} // namespace vl

Loading

0 comments on commit 33e9ad7

Please sign in to comment.