diagFile = sys.stdout):
OutputGenerator.__init__(self, errFile, warnFile, diagFile)
self.INDENT_SPACES = 4
+ # Struct member categories, to be used to avoid validating output values retrieved by queries such as vkGetPhysicalDeviceProperties
+ # For example, VkPhysicalDeviceProperties will be ignored for vkGetPhysicalDeviceProperties where it is an ouput, but will be processed
+ # for vkCreateDevice where is it a member of the VkDeviceCreateInfo input parameter.
+ self.STRUCT_MEMBERS_INPUT_ONLY_NONE = 1 # The struct contains no 'input-only' members and will always be processed
+ self.STRUCT_MEMBERS_INPUT_ONLY_MIXED = 2 # The struct contains some 'input-only' members; these members will only be processed when the struct is an input parameter
+ self.STRUCT_MEMBERS_INPUT_ONLY_EXCLUSIVE = 3 # The struct contains only 'input-only' members; the entire struct will only be processed when it is an input parameter
# Commands to ignore
self.blacklist = [
'vkGetInstanceProcAddr',
self.structTypes = dict() # Map of Vulkan struct typename to required VkStructureType
self.commands = [] # List of CommandData records for all Vulkan commands
self.structMembers = [] # List of StructMemberData records for all Vulkan structs
- self.validatedStructs = set() # Set of structs containing members that require validation
+ self.validatedStructs = dict() # Map of structs containing members that require validation to a value indicating
+ # that the struct contains members that are only validated when it is an input parameter
+ self.enumRanges = dict() # Map of enum name to BEGIN/END range values
# Named tuples to store struct and command data
self.StructType = namedtuple('StructType', ['name', 'value'])
- self.CommandParam = namedtuple('CommandParam', ['type', 'name', 'ispointer', 'isstaticarray', 'isoptional', 'iscount', 'len', 'extstructs', 'cdecl'])
+ self.CommandParam = namedtuple('CommandParam', ['type', 'name', 'ispointer', 'isstaticarray', 'isbool', 'israngedenum',
+ 'isconst', 'isoptional', 'iscount', 'len', 'extstructs', 'cdecl'])
self.CommandData = namedtuple('CommandData', ['name', 'params', 'cdecl'])
self.StructMemberData = namedtuple('StructMemberData', ['name', 'members'])
#
self.structTypes = dict()
self.commands = []
self.structMembers = []
- self.validatedStructs = set()
+ self.validatedStructs = dict()
+ self.enumRanges = dict()
def endFeature(self):
# C-specific
# Actually write the interface to the output file.
type = info[0]
name = info[1]
stypeValue = ''
+ cdecl = self.makeCParamDecl(member, 0)
# Process VkStructureType
if type == 'VkStructureType':
# Extract the required struct type value from the comments
membersInfo.append(self.CommandParam(type=type, name=name,
ispointer=self.paramIsPointer(member),
isstaticarray=isstaticarray,
+ isbool=True if type == 'VkBool32' else False,
+ israngedenum=True if type in self.enumRanges else False,
+ isconst=True if 'const' in cdecl else False,
isoptional=isoptional,
iscount=iscount,
len=self.getLen(member),
extstructs=member.attrib.get('validextensionstructs') if name == 'pNext' else None,
- cdecl=self.makeCParamDecl(member, 0)))
+ cdecl=cdecl))
self.structMembers.append(self.StructMemberData(name=typeName, members=membersInfo))
#
# Capture group (e.g. C "enum" type) info to be used for
# These are concatenated together with other types.
def genGroup(self, groupinfo, groupName):
OutputGenerator.genGroup(self, groupinfo, groupName)
+ groupElem = groupinfo.elem
+ #
+ # Store the sType values
if groupName == 'VkStructureType':
- groupElem = groupinfo.elem
for elem in groupElem.findall('enum'):
- name = elem.get('name')
- self.stypes.append(name)
+ self.stypes.append(elem.get('name'))
+ else:
+ # Determine if begin/end ranges are needed (we don't do this for VkStructureType, which has a more finely grained check)
+ expandName = re.sub(r'([0-9a-z_])([A-Z0-9][^A-Z0-9]?)',r'\1_\2',groupName).upper()
+ expandPrefix = expandName
+ expandSuffix = ''
+ expandSuffixMatch = re.search(r'[A-Z][A-Z]+$',groupName)
+ if expandSuffixMatch:
+ expandSuffix = '_' + expandSuffixMatch.group()
+ # Strip off the suffix from the prefix
+ expandPrefix = expandName.rsplit(expandSuffix, 1)[0]
+ isEnum = ('FLAG_BITS' not in expandPrefix)
+ if isEnum:
+ self.enumRanges[groupName] = (expandPrefix + '_BEGIN_RANGE' + expandSuffix, expandPrefix + '_END_RANGE' + expandSuffix)
#
# Capture command parameter info to be used for param
# check code generation.
paramsInfo = []
for param in params:
paramInfo = self.getTypeNameTuple(param)
+ cdecl = self.makeCParamDecl(param, 0)
# Check for parameter name in lens set
iscount = False
if paramInfo[1] in lens:
paramsInfo.append(self.CommandParam(type=paramInfo[0], name=paramInfo[1],
ispointer=self.paramIsPointer(param),
isstaticarray=self.paramIsStaticArray(param),
+ isbool=True if paramInfo[0] == 'VkBool32' else False,
+ israngedenum=True if paramInfo[0] in self.enumRanges else False,
+ isconst=True if 'const' in cdecl else False,
isoptional=self.paramIsOptional(param),
iscount=iscount,
len=self.getLen(param),
extstructs=None,
- cdecl=self.makeCParamDecl(param, 0)))
+ cdecl=cdecl))
self.commands.append(self.CommandData(name=name, params=paramsInfo, cdecl=self.makeCDecls(cmdinfo.elem)[0]))
#
# Check if the parameter passed in is a pointer
if name:
if '->' in name:
# The count is obtained by dereferencing a member of a struct parameter
- lenParam = self.CommandParam(name=name, iscount=True, ispointer=False, isoptional=False, type=None, len=None, isstaticarray=None, extstructs=None, cdecl=None)
+ lenParam = self.CommandParam(name=name, iscount=True, ispointer=False, isbool=False, israngedenum=False, isconst=False,
+ isstaticarray=None, isoptional=False, type=None, len=None, extstructs=None, cdecl=None)
elif 'latexmath' in name:
lenName, decoratedName = self.parseLateXMath(name)
lenParam = self.getParamByName(params, lenName)
return indent + expr
#
# Generate the parameter checking code
- def genFuncBody(self, indent, name, values, valuePrefix, variablePrefix, structName):
+ def genFuncBody(self, indent, name, values, valuePrefix, variablePrefix, structName, needConditionCheck):
funcBody = ''
unused = []
+ # Code to conditionally check parameters only when they are inputs. Primarily avoids
+ # checking uninitialized members of output structs used to retrieve bools and enums.
+ # Conditional checks are grouped together to be appended to funcBody within a single
+ # if check for input parameter direction.
+ conditionalExprs = []
for value in values:
checkExpr = '' # Code to check the current parameter
+ lenParam = None
+ #
+ # Generate the full name of the value, which will be printed in
+ # the error message, by adding the variable prefix to the
+ # value name
+ valueDisplayName = '(std::string({}) + std::string("{}")).c_str()'.format(variablePrefix, value.name) if variablePrefix else '"{}"'.format(value.name)
#
# Check for NULL pointers, ignore the inout count parameters that
# will be validated with their associated array
if (value.ispointer or value.isstaticarray) and not value.iscount:
#
- # Generate the full name of the value, which will be printed in
- # the error message, by adding the variable prefix to the
- # value name
- valueDisplayName = '(std::string({}) + std::string("{}")).c_str()'.format(variablePrefix, value.name) if variablePrefix else '"{}"'.format(value.name)
- #
# Parameters for function argument generation
req = 'VK_TRUE' # Paramerter can be NULL
cpReq = 'VK_TRUE' # Count pointer can be NULL
cvReq = 'VK_TRUE' # Count value can be 0
- lenParam = None
+ lenDisplayName = None # Name of length parameter to print with validation messages; parameter name with prefix applied
#
# Generate required/optional parameter strings for the pointer and count values
if value.isoptional:
if value.len:
# The parameter is an array with an explicit count parameter
lenParam = self.getLenParam(values, value.len)
- if not lenParam: print(value.len)
+ lenDisplayName = '(std::string({}) + std::string("{}")).c_str()'.format(variablePrefix, lenParam.name) if variablePrefix else '"{}"'.format(lenParam.name)
if lenParam.ispointer:
# Count parameters that are pointers are inout
if type(lenParam.isoptional) is list:
# This is an array
if lenParam.ispointer:
# When the length parameter is a pointer, there is an extra Boolean parameter in the function call to indicate if it is required
- checkExpr = 'skipCall |= validate_struct_type_array(report_data, {}, "{ln}", {dn}, "{sv}", {pf}{ln}, {pf}{vn}, {sv}, {}, {}, {});\n'.format(name, cpReq, cvReq, req, ln=lenParam.name, dn=valueDisplayName, vn=value.name, sv=stype.value, pf=valuePrefix)
+ checkExpr = 'skipCall |= validate_struct_type_array(report_data, {}, {ldn}, {dn}, "{sv}", {pf}{ln}, {pf}{vn}, {sv}, {}, {}, {});\n'.format(name, cpReq, cvReq, req, ln=lenParam.name, ldn=lenDisplayName, dn=valueDisplayName, vn=value.name, sv=stype.value, pf=valuePrefix)
else:
- checkExpr = 'skipCall |= validate_struct_type_array(report_data, {}, "{ln}", {dn}, "{sv}", {pf}{ln}, {pf}{vn}, {sv}, {}, {});\n'.format(name, cvReq, req, ln=lenParam.name, dn=valueDisplayName, vn=value.name, sv=stype.value, pf=valuePrefix)
+ checkExpr = 'skipCall |= validate_struct_type_array(report_data, {}, {ldn}, {dn}, "{sv}", {pf}{ln}, {pf}{vn}, {sv}, {}, {});\n'.format(name, cvReq, req, ln=lenParam.name, ldn=lenDisplayName, dn=valueDisplayName, vn=value.name, sv=stype.value, pf=valuePrefix)
else:
checkExpr = 'skipCall |= validate_struct_type(report_data, {}, {}, "{sv}", {}{vn}, {sv}, {});\n'.format(name, valueDisplayName, valuePrefix, req, vn=value.name, sv=stype.value)
elif value.name == 'pNext':
if lenParam:
# This is an array
if lenParam.ispointer:
- # If count and array parameters are optional, there
- # will be no validation
+ # If count and array parameters are optional, there will be no validation
if req == 'VK_TRUE' or cpReq == 'VK_TRUE' or cvReq == 'VK_TRUE':
# When the length parameter is a pointer, there is an extra Boolean parameter in the function call to indicate if it is required
- checkExpr = 'skipCall |= validate_array(report_data, {}, "{ln}", {dn}, {pf}{ln}, {pf}{vn}, {}, {}, {});\n'.format(name, cpReq, cvReq, req, ln=lenParam.name, dn=valueDisplayName, vn=value.name, pf=valuePrefix)
+ checkExpr = 'skipCall |= validate_array(report_data, {}, {ldn}, {dn}, {pf}{ln}, {pf}{vn}, {}, {}, {});\n'.format(name, cpReq, cvReq, req, ln=lenParam.name, ldn=lenDisplayName, dn=valueDisplayName, vn=value.name, pf=valuePrefix)
else:
- # If count and array parameters are optional, there
- # will be no validation
+ # If count and array parameters are optional, there will be no validation
if req == 'VK_TRUE' or cvReq == 'VK_TRUE':
funcName = 'validate_array' if value.type != 'char' else 'validate_string_array'
- checkExpr = 'skipCall |= {}(report_data, {}, "{ln}", {dn}, {pf}{ln}, {pf}{vn}, {}, {});\n'.format(funcName, name, cvReq, req, ln=lenParam.name, dn=valueDisplayName, vn=value.name, pf=valuePrefix)
+ checkExpr = 'skipCall |= {}(report_data, {}, {ldn}, {dn}, {pf}{ln}, {pf}{vn}, {}, {});\n'.format(funcName, name, cvReq, req, ln=lenParam.name, ldn=lenDisplayName, dn=valueDisplayName, vn=value.name, pf=valuePrefix)
elif not value.isoptional:
# Function pointers need a reinterpret_cast to void*
if value.type[:4] == 'PFN_':
# If this is a pointer to a struct, see if it contains members
# that need to be checked
if value.type in self.validatedStructs:
- if checkExpr:
- checkExpr += '\n' + indent
#
# The name prefix used when reporting an error with a struct member (eg. the 'pCreateInfor->' in 'pCreateInfo->sType')
prefix = '(std::string({}) + std::string("{}->")).c_str()'.format(variablePrefix, value.name) if variablePrefix else '"{}->"'.format(value.name)
- checkExpr += 'skipCall |= parameter_validation_{}(report_data, {}, {}, {}{});\n'.format(value.type, name, prefix, valuePrefix, value.name)
+ #
+ membersInputOnly = self.validatedStructs[value.type]
+ #
+ # If the current struct has mixed 'input-only' and 'non-input-only' members, it needs an isInput flag
+ if membersInputOnly == self.STRUCT_MEMBERS_INPUT_ONLY_MIXED:
+ # If this function is called from another struct validation function (valuePrefix is not empty), then we forward the 'isInput' prameter
+ isInput = 'isInput'
+ if not valuePrefix:
+ # We are validating function parameters and need to determine if the current value is an input parameter
+ isInput = 'true' if value.isconst else 'false'
+ if checkExpr:
+ checkExpr += '\n' + indent
+ checkExpr += 'skipCall |= parameter_validation_{}(report_data, {}, {}, {}, {}{});\n'.format(value.type, name, prefix, isInput, valuePrefix, value.name)
+ else:
+ # Validation function does not have an isInput field
+ expr = 'skipCall |= parameter_validation_{}(report_data, {}, {}, {}{});\n'.format(value.type, name, prefix, valuePrefix, value.name)
+ #
+ # If the struct only has input-only members and is a member of another struct, it is conditionally processed based on 'isInput'
+ if valuePrefix and membersInputOnly == self.STRUCT_MEMBERS_INPUT_ONLY_EXCLUSIVE:
+ if needConditionCheck:
+ conditionalExprs.append(expr)
+ else:
+ if checkExpr:
+ checkExpr += '\n' + indent
+ checkExpr += expr
+ #
+ # If the struct is a function parameter (valuePrefix is empty) and only contains input-only parameters, it can be ignored if it is not an input
+ elif (membersInputOnly == self.STRUCT_MEMBERS_INPUT_ONLY_NONE) or (not valuePrefix and membersInputOnly == self.STRUCT_MEMBERS_INPUT_ONLY_EXCLUSIVE and value.isconst):
+ if checkExpr:
+ checkExpr += '\n' + indent
+ checkExpr += expr
+ elif value.isbool and value.isconst:
+ expr = 'skipCall |= validate_bool32_array(report_data, {}, {}, {pf}{}, {pf}{});\n'.format(name, valueDisplayName, lenParam.name, value.name, pf=valuePrefix)
+ if checkExpr:
+ checkExpr += '\n' + indent
+ checkExpr += expr
+ elif value.israngedenum and value.isconst:
+ enumRange = self.enumRanges[value.type]
+ expr = 'skipCall |= validate_ranged_enum_array(report_data, {}, {}, "{}", {}, {}, {pf}{}, {pf}{});\n'.format(name, valueDisplayName, value.type, enumRange[0], enumRange[1], lenParam.name, value.name, pf=valuePrefix)
+ if checkExpr:
+ checkExpr += '\n' + indent
+ checkExpr += expr
elif value.type in self.validatedStructs:
- # The name prefix used when reporting an error with a struct member (eg. the 'pCreateInfor->' in 'pCreateInfo->sType')
+ # The name of the value with prefix applied
prefix = '(std::string({}) + std::string("{}.")).c_str()'.format(variablePrefix, value.name) if variablePrefix else '"{}."'.format(value.name)
- checkExpr += 'skipCall |= parameter_validation_{}(report_data, {}, {}, &({}{}));\n'.format(value.type, name, prefix, valuePrefix, value.name)
+ #
+ membersInputOnly = self.validatedStructs[value.type]
+ #
+ # If the current struct has mixed 'input-only' and 'non-input-only' members, it needs an isInput flag
+ if membersInputOnly == self.STRUCT_MEMBERS_INPUT_ONLY_MIXED:
+ # If this function is called from another struct validation function (valuePrefix is not empty), then we forward the 'isInput' prameter
+ isInput = 'isInput'
+ if not valuePrefix:
+ # We are validating function parameters and need to determine if the current value is an input parameter
+ isInput = 'true' if value.isconst else 'false'
+ if checkExpr:
+ checkExpr += '\n' + indent
+ checkExpr += 'skipCall |= parameter_validation_{}(report_data, {}, {}, {}, &({}{}));\n'.format(value.type, name, prefix, isInput, valuePrefix, value.name)
+ else:
+ # Validation function does not have an isInput field
+ expr = 'skipCall |= parameter_validation_{}(report_data, {}, {}, &({}{}));\n'.format(value.type, name, prefix, valuePrefix, value.name)
+ #
+ # If the struct only has input-only members and is a member of another struct, it is conditionally processed based on 'isInput'
+ if valuePrefix and membersInputOnly == self.STRUCT_MEMBERS_INPUT_ONLY_EXCLUSIVE:
+ if needConditionCheck:
+ conditionalExprs.append(expr)
+ else:
+ if checkExpr:
+ checkExpr += '\n' + indent
+ checkExpr += expr
+ #
+ # If the struct is a function parameter (valuePrefix is empty) and only contains input-only parameters, it can be ignored if it is not an input
+ elif (membersInputOnly == self.STRUCT_MEMBERS_INPUT_ONLY_NONE) or (not valuePrefix and membersInputOnly == self.STRUCT_MEMBERS_INPUT_ONLY_EXCLUSIVE and value.isconst):
+ if checkExpr:
+ checkExpr += '\n' + indent
+ checkExpr += expr
+ elif value.isbool:
+ expr = 'skipCall |= validate_bool32(report_data, {}, {}, {}{});\n'.format(name, valueDisplayName, valuePrefix, value.name)
+ if needConditionCheck:
+ conditionalExprs.append(expr)
+ else:
+ checkExpr = expr
+ elif value.israngedenum:
+ enumRange = self.enumRanges[value.type]
+ expr = 'skipCall |= validate_ranged_enum(report_data, {}, {}, "{}", {}, {}, {}{});\n'.format(name, valueDisplayName, value.type, enumRange[0], enumRange[1], valuePrefix, value.name)
+ if needConditionCheck:
+ conditionalExprs.append(expr)
+ else:
+ checkExpr = expr
#
# Append the parameter check to the function body for the current command
if checkExpr:
else:
funcBody += indent + checkExpr
elif not value.iscount:
- # The parameter is not checked (counts will be checked with
- # their associated array)
+ # If no expression was generated for this value, it is unreferenced by the validation function, unless
+ # it is an array count, which is indirectly referenced for array valiadation.
unused.append(value.name)
+ # Add the 'input' only checks
+ if conditionalExprs:
+ funcBody += '\n'
+ funcBody += indent + 'if (isInput) {'
+ indent = self.incIndent(indent)
+ for conditionalExpr in conditionalExprs:
+ funcBody += '\n'
+ funcBody += indent + conditionalExpr
+ indent = self.decIndent(indent)
+ funcBody += indent + '}\n'
return funcBody, unused
#
# Post-process the collected struct member data to create a list of structs
# with members that need to be validated
def prepareStructMemberData(self):
for struct in self.structMembers:
+ inputOnly = False
+ validated = False
for member in struct.members:
if not member.iscount:
lenParam = self.getLenParam(struct.members, member.len)
- # The sType needs to be validated
- # An required array/count needs to be validated
+ # The sType value needs to be validated
+ # The pNext value needs to be validated
+ # A required array/count needs to be validated
# A required pointer needs to be validated
- validated = False
+ # A bool needs to be validated, and the struct is an input parameter
+ # An enum needs to be validated, and the struct is an input parameter
if member.type in self.structTypes:
validated = True
+ elif member.name == 'pNext':
+ validated = True
elif member.ispointer and lenParam: # This is an array
# Make sure len is not optional
if lenParam.ispointer:
validated = True
elif member.ispointer and not member.isoptional:
validated = True
- #
- if validated:
- self.validatedStructs.add(struct.name)
- # Second pass to check for struct members that are structs
- # requiring validation
+ elif member.isbool or member.israngedenum:
+ inputOnly = True
+ #
+ if validated or inputOnly:
+ if not validated:
+ self.validatedStructs[struct.name] = self.STRUCT_MEMBERS_INPUT_ONLY_EXCLUSIVE
+ elif not inputOnly:
+ self.validatedStructs[struct.name] = self.STRUCT_MEMBERS_INPUT_ONLY_NONE
+ else:
+ self.validatedStructs[struct.name] = self.STRUCT_MEMBERS_INPUT_ONLY_MIXED
+ # Second pass to check for struct members that are structs requiring validation
+ # May not be necessary, as structs seem to always be defined before first use in the XML registry
for member in struct.members:
if member.type in self.validatedStructs:
- self.validatedStructs.add(struct.name)
+ memberInputOnly = self.validatedStructs[member.type]
+ if not struct.name in self.validatedStructs:
+ self.validatedStructs[struct.name] = memberInputOnly
+ elif self.validatedStructs[struct.name] != memberInputOnly:
+ self.validatedStructs[struct.name] = self.STRUCT_MEMBERS_INPUT_ONLY_MIXED
#
# Generate the struct member check code from the captured data
def processStructMemberData(self):
indent = self.incIndent(None)
for struct in self.structMembers:
- # The string returned by genFuncBody will be nested in an if check
- # for a NULL pointer, so needs its indent incremented
- funcBody, unused = self.genFuncBody(self.incIndent(indent), 'pFuncName', struct.members, 'pStruct->', 'pVariableName', struct.name)
+ needConditionCheck = False
+ if struct.name in self.validatedStructs and self.validatedStructs[struct.name] == self.STRUCT_MEMBERS_INPUT_ONLY_MIXED:
+ needConditionCheck = True
+ #
+ # The string returned by genFuncBody will be nested in an if check for a NULL pointer, so needs its indent incremented
+ funcBody, unused = self.genFuncBody(self.incIndent(indent), 'pFuncName', struct.members, 'pStruct->', 'pVariableName', struct.name, needConditionCheck)
if funcBody:
cmdDef = 'static VkBool32 parameter_validation_{}(\n'.format(struct.name)
cmdDef += ' debug_report_data*'.ljust(self.genOpts.alignFuncParam) + ' report_data,\n'
cmdDef += ' const char*'.ljust(self.genOpts.alignFuncParam) + ' pFuncName,\n'
cmdDef += ' const char*'.ljust(self.genOpts.alignFuncParam) + ' pVariableName,\n'
+ # If there is a funcBody, this struct must have an entry in the validatedStructs dictionary
+ if self.validatedStructs[struct.name] == self.STRUCT_MEMBERS_INPUT_ONLY_MIXED:
+ # If the struct has mixed input only and non-input only members, it needs a flag to indicate if it is an input or output
+ cmdDef += ' bool'.ljust(self.genOpts.alignFuncParam) + ' isInput,\n'
cmdDef += ' const {}*'.format(struct.name).ljust(self.genOpts.alignFuncParam) + ' pStruct)\n'
cmdDef += '{\n'
cmdDef += indent + 'VkBool32 skipCall = VK_FALSE;\n'
def processCmdData(self):
indent = self.incIndent(None)
for command in self.commands:
- cmdBody, unused = self.genFuncBody(indent, '"{}"'.format(command.name), command.params, '', None, None)
+ cmdBody, unused = self.genFuncBody(indent, '"{}"'.format(command.name), command.params, '', None, None, False)
if cmdBody:
cmdDef = self.getCmdDef(command) + '\n'
cmdDef += '{\n'
}
}
-bool PostGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format,
- VkFormatProperties *pFormatProperties) {
-
- if (format < VK_FORMAT_BEGIN_RANGE || format > VK_FORMAT_END_RANGE) {
- log_msg(mdd(physicalDevice), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkGetPhysicalDeviceFormatProperties parameter, VkFormat format, is an unrecognized enumerator");
- return false;
- }
-
- return true;
-}
-
VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL
vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties *pFormatProperties) {
VkBool32 skipCall = VK_FALSE;
if (skipCall == VK_FALSE) {
get_dispatch_table(pc_instance_table_map, physicalDevice)
->GetPhysicalDeviceFormatProperties(physicalDevice, format, pFormatProperties);
-
- PostGetPhysicalDeviceFormatProperties(physicalDevice, format, pFormatProperties);
}
}
bool PostGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type,
VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags,
VkImageFormatProperties *pImageFormatProperties, VkResult result) {
-
- if (format < VK_FORMAT_BEGIN_RANGE || format > VK_FORMAT_END_RANGE) {
- log_msg(mdd(physicalDevice), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkGetPhysicalDeviceImageFormatProperties parameter, VkFormat format, is an unrecognized enumerator");
- return false;
- }
-
- if (type < VK_IMAGE_TYPE_BEGIN_RANGE || type > VK_IMAGE_TYPE_END_RANGE) {
- log_msg(mdd(physicalDevice), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkGetPhysicalDeviceImageFormatProperties parameter, VkImageType type, is an unrecognized enumerator");
- return false;
- }
-
- if (tiling < VK_IMAGE_TILING_BEGIN_RANGE || tiling > VK_IMAGE_TILING_END_RANGE) {
- log_msg(mdd(physicalDevice), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkGetPhysicalDeviceImageFormatProperties parameter, VkImageTiling tiling, is an unrecognized enumerator");
- return false;
- }
-
if (result < VK_SUCCESS) {
std::string reason = "vkGetPhysicalDeviceImageFormatProperties parameter, VkResult result, is " + EnumeratorString(result);
log_msg(mdd(physicalDevice), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
return result;
}
-bool PostGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties *pProperties) {
-
- if (pProperties != nullptr) {
- if (pProperties->deviceType < VK_PHYSICAL_DEVICE_TYPE_BEGIN_RANGE ||
- pProperties->deviceType > VK_PHYSICAL_DEVICE_TYPE_END_RANGE) {
- log_msg(mdd(physicalDevice), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkGetPhysicalDeviceProperties parameter, VkPhysicalDeviceType pProperties->deviceType, is an unrecognized "
- "enumerator");
- return false;
- }
- }
-
- return true;
-}
-
VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL
vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties *pProperties) {
VkBool32 skipCall = VK_FALSE;
if (skipCall == VK_FALSE) {
get_dispatch_table(pc_instance_table_map, physicalDevice)->GetPhysicalDeviceProperties(physicalDevice, pProperties);
-
- PostGetPhysicalDeviceProperties(physicalDevice, pProperties);
}
}
if (pCreateInfo != NULL) {
if ((pCreateInfo->enabledLayerCount > 0) && (pCreateInfo->ppEnabledLayerNames != NULL)) {
- for (auto i = 0; i < pCreateInfo->enabledLayerCount; i++) {
+ for (size_t i = 0; i < pCreateInfo->enabledLayerCount; i++) {
skipCall |= validate_string(my_instance_data->report_data, "vkCreateDevice", "pCreateInfo->ppEnabledLayerNames",
pCreateInfo->ppEnabledLayerNames[i]);
}
}
if ((pCreateInfo->enabledExtensionCount > 0) && (pCreateInfo->ppEnabledExtensionNames != NULL)) {
- for (auto i = 0; i < pCreateInfo->enabledExtensionCount; i++) {
+ for (size_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) {
skipCall |= validate_string(my_instance_data->report_data, "vkCreateDevice", "pCreateInfo->ppEnabledExtensionNames",
pCreateInfo->ppEnabledExtensionNames[i]);
}
bool PostGetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type,
VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling,
uint32_t *pNumProperties, VkSparseImageFormatProperties *pProperties) {
-
- if (format < VK_FORMAT_BEGIN_RANGE || format > VK_FORMAT_END_RANGE) {
- log_msg(mdd(physicalDevice), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkGetPhysicalDeviceSparseImageFormatProperties parameter, VkFormat format, is an unrecognized enumerator");
- return false;
- }
-
- if (type < VK_IMAGE_TYPE_BEGIN_RANGE || type > VK_IMAGE_TYPE_END_RANGE) {
- log_msg(mdd(physicalDevice), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkGetPhysicalDeviceSparseImageFormatProperties parameter, VkImageType type, is an unrecognized enumerator");
- return false;
- }
-
- if (tiling < VK_IMAGE_TILING_BEGIN_RANGE || tiling > VK_IMAGE_TILING_END_RANGE) {
- log_msg(mdd(physicalDevice), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkGetPhysicalDeviceSparseImageFormatProperties parameter, VkImageTiling tiling, is an unrecognized enumerator");
- return false;
- }
-
if (pProperties != nullptr) {
if ((pProperties->aspectMask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT |
VK_IMAGE_ASPECT_METADATA_BIT)) == 0) {
return result;
}
-bool PreCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo) {
- if (pCreateInfo != nullptr) {
- if (pCreateInfo->queryType < VK_QUERY_TYPE_BEGIN_RANGE || pCreateInfo->queryType > VK_QUERY_TYPE_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateQueryPool parameter, VkQueryType pCreateInfo->queryType, is an unrecognized enumerator");
- return false;
- }
- }
-
- return true;
-}
-
bool PostCreateQueryPool(VkDevice device, VkQueryPool *pQueryPool, VkResult result) {
if (result < VK_SUCCESS) {
std::string reason = "vkCreateQueryPool parameter, VkResult result, is " + EnumeratorString(result);
skipCall |= parameter_validation_vkCreateQueryPool(my_data->report_data, pCreateInfo, pAllocator, pQueryPool);
if (skipCall == VK_FALSE) {
- PreCreateQueryPool(device, pCreateInfo);
-
result = get_dispatch_table(pc_device_table_map, device)->CreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool);
PostCreateQueryPool(device, pQueryPool, result);
bool PreCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo) {
if (pCreateInfo != nullptr) {
- if (pCreateInfo->sharingMode < VK_SHARING_MODE_BEGIN_RANGE || pCreateInfo->sharingMode > VK_SHARING_MODE_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateBuffer parameter, VkSharingMode pCreateInfo->sharingMode, is an unrecognized enumerator");
- return false;
- } else if (pCreateInfo->sharingMode == VK_SHARING_MODE_CONCURRENT) {
+ if (pCreateInfo->sharingMode == VK_SHARING_MODE_CONCURRENT) {
validate_queue_family_indices(device, "vkCreateBuffer", pCreateInfo->queueFamilyIndexCount,
pCreateInfo->pQueueFamilyIndices);
}
}
}
-bool PreCreateBufferView(VkDevice device, const VkBufferViewCreateInfo *pCreateInfo) {
- if (pCreateInfo != nullptr) {
- if (pCreateInfo->format < VK_FORMAT_BEGIN_RANGE || pCreateInfo->format > VK_FORMAT_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateBufferView parameter, VkFormat pCreateInfo->format, is an unrecognized enumerator");
- return false;
- }
- }
-
- return true;
-}
-
bool PostCreateBufferView(VkDevice device, VkBufferView *pView, VkResult result) {
if (result < VK_SUCCESS) {
std::string reason = "vkCreateBufferView parameter, VkResult result, is " + EnumeratorString(result);
skipCall |= parameter_validation_vkCreateBufferView(my_data->report_data, pCreateInfo, pAllocator, pView);
if (skipCall == VK_FALSE) {
- PreCreateBufferView(device, pCreateInfo);
-
result = get_dispatch_table(pc_device_table_map, device)->CreateBufferView(device, pCreateInfo, pAllocator, pView);
PostCreateBufferView(device, pView, result);
bool PreCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo) {
if (pCreateInfo != nullptr) {
- if (pCreateInfo->imageType < VK_IMAGE_TYPE_BEGIN_RANGE || pCreateInfo->imageType > VK_IMAGE_TYPE_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateImage parameter, VkImageType pCreateInfo->imageType, is an unrecognized enumerator");
- return false;
- }
- if (pCreateInfo->format < VK_FORMAT_BEGIN_RANGE || pCreateInfo->format > VK_FORMAT_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateImage parameter, VkFormat pCreateInfo->format, is an unrecognized enumerator");
- return false;
- }
- if (pCreateInfo->tiling < VK_IMAGE_TILING_BEGIN_RANGE || pCreateInfo->tiling > VK_IMAGE_TILING_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateImage parameter, VkImageTiling pCreateInfo->tiling, is an unrecognized enumerator");
- return false;
- }
- if (pCreateInfo->sharingMode < VK_SHARING_MODE_BEGIN_RANGE || pCreateInfo->sharingMode > VK_SHARING_MODE_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateImage parameter, VkSharingMode pCreateInfo->sharingMode, is an unrecognized enumerator");
- return false;
- } else if (pCreateInfo->sharingMode == VK_SHARING_MODE_CONCURRENT) {
+ if (pCreateInfo->sharingMode == VK_SHARING_MODE_CONCURRENT) {
validate_queue_family_indices(device, "vkCreateImage", pCreateInfo->queueFamilyIndexCount,
pCreateInfo->pQueueFamilyIndices);
}
}
}
-bool PreCreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo) {
- if (pCreateInfo != nullptr) {
- if (pCreateInfo->viewType < VK_IMAGE_VIEW_TYPE_BEGIN_RANGE || pCreateInfo->viewType > VK_IMAGE_VIEW_TYPE_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateImageView parameter, VkImageViewType pCreateInfo->viewType, is an unrecognized enumerator");
- return false;
- }
- if (pCreateInfo->format < VK_FORMAT_BEGIN_RANGE || pCreateInfo->format > VK_FORMAT_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateImageView parameter, VkFormat pCreateInfo->format, is an unrecognized enumerator");
- return false;
- }
- if (pCreateInfo->components.r < VK_COMPONENT_SWIZZLE_BEGIN_RANGE ||
- pCreateInfo->components.r > VK_COMPONENT_SWIZZLE_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateImageView parameter, VkComponentSwizzle pCreateInfo->components.r, is an unrecognized enumerator");
- return false;
- }
- if (pCreateInfo->components.g < VK_COMPONENT_SWIZZLE_BEGIN_RANGE ||
- pCreateInfo->components.g > VK_COMPONENT_SWIZZLE_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateImageView parameter, VkComponentSwizzle pCreateInfo->components.g, is an unrecognized enumerator");
- return false;
- }
- if (pCreateInfo->components.b < VK_COMPONENT_SWIZZLE_BEGIN_RANGE ||
- pCreateInfo->components.b > VK_COMPONENT_SWIZZLE_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateImageView parameter, VkComponentSwizzle pCreateInfo->components.b, is an unrecognized enumerator");
- return false;
- }
- if (pCreateInfo->components.a < VK_COMPONENT_SWIZZLE_BEGIN_RANGE ||
- pCreateInfo->components.a > VK_COMPONENT_SWIZZLE_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateImageView parameter, VkComponentSwizzle pCreateInfo->components.a, is an unrecognized enumerator");
- return false;
- }
- }
-
- return true;
-}
-
bool PostCreateImageView(VkDevice device, VkImageView *pView, VkResult result) {
if (result < VK_SUCCESS) {
std::string reason = "vkCreateImageView parameter, VkResult result, is " + EnumeratorString(result);
skipCall |= parameter_validation_vkCreateImageView(my_data->report_data, pCreateInfo, pAllocator, pView);
if (skipCall == VK_FALSE) {
- PreCreateImageView(device, pCreateInfo);
-
result = get_dispatch_table(pc_device_table_map, device)->CreateImageView(device, pCreateInfo, pAllocator, pView);
PostCreateImageView(device, pView, result);
}
}
- if (pCreateInfos->pVertexInputState != nullptr) {
- if (pCreateInfos->pVertexInputState->pVertexBindingDescriptions != nullptr) {
- if (pCreateInfos->pVertexInputState->pVertexBindingDescriptions->inputRate < VK_VERTEX_INPUT_RATE_BEGIN_RANGE ||
- pCreateInfos->pVertexInputState->pVertexBindingDescriptions->inputRate > VK_VERTEX_INPUT_RATE_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateGraphicsPipelines parameter, VkVertexInputRate "
- "pCreateInfos->pVertexInputState->pVertexBindingDescriptions->inputRate, is an unrecognized "
- "enumerator");
- return false;
- }
- }
- if (pCreateInfos->pVertexInputState->pVertexAttributeDescriptions != nullptr) {
- if (pCreateInfos->pVertexInputState->pVertexAttributeDescriptions->format < VK_FORMAT_BEGIN_RANGE ||
- pCreateInfos->pVertexInputState->pVertexAttributeDescriptions->format > VK_FORMAT_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateGraphicsPipelines parameter, VkFormat "
- "pCreateInfos->pVertexInputState->pVertexAttributeDescriptions->format, is an unrecognized enumerator");
- return false;
- }
- }
- }
- if (pCreateInfos->pInputAssemblyState != nullptr) {
- if (pCreateInfos->pInputAssemblyState->topology < VK_PRIMITIVE_TOPOLOGY_BEGIN_RANGE ||
- pCreateInfos->pInputAssemblyState->topology > VK_PRIMITIVE_TOPOLOGY_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateGraphicsPipelines parameter, VkPrimitiveTopology pCreateInfos->pInputAssemblyState->topology, is "
- "an unrecognized enumerator");
- return false;
- }
- }
if (pCreateInfos->pRasterizationState != nullptr) {
- if (pCreateInfos->pRasterizationState->polygonMode < VK_POLYGON_MODE_BEGIN_RANGE ||
- pCreateInfos->pRasterizationState->polygonMode > VK_POLYGON_MODE_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateGraphicsPipelines parameter, VkPolygonMode pCreateInfos->pRasterizationState->polygonMode, is an "
- "unrecognized enumerator");
- return false;
- }
if (pCreateInfos->pRasterizationState->cullMode & ~VK_CULL_MODE_FRONT_AND_BACK) {
log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
"vkCreateGraphicsPipelines parameter, VkCullMode pCreateInfos->pRasterizationState->cullMode, is an "
"unrecognized enumerator");
return false;
}
- if (pCreateInfos->pRasterizationState->frontFace < VK_FRONT_FACE_BEGIN_RANGE ||
- pCreateInfos->pRasterizationState->frontFace > VK_FRONT_FACE_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateGraphicsPipelines parameter, VkFrontFace pCreateInfos->pRasterizationState->frontFace, is an "
- "unrecognized enumerator");
- return false;
- }
- }
- if (pCreateInfos->pDepthStencilState != nullptr) {
- if (pCreateInfos->pDepthStencilState->depthCompareOp < VK_COMPARE_OP_BEGIN_RANGE ||
- pCreateInfos->pDepthStencilState->depthCompareOp > VK_COMPARE_OP_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateGraphicsPipelines parameter, VkCompareOp pCreateInfos->pDepthStencilState->depthCompareOp, is an "
- "unrecognized enumerator");
- return false;
- }
- if (pCreateInfos->pDepthStencilState->front.failOp < VK_STENCIL_OP_BEGIN_RANGE ||
- pCreateInfos->pDepthStencilState->front.failOp > VK_STENCIL_OP_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateGraphicsPipelines parameter, VkStencilOp pCreateInfos->pDepthStencilState->front.failOp, is an "
- "unrecognized enumerator");
- return false;
- }
- if (pCreateInfos->pDepthStencilState->front.passOp < VK_STENCIL_OP_BEGIN_RANGE ||
- pCreateInfos->pDepthStencilState->front.passOp > VK_STENCIL_OP_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateGraphicsPipelines parameter, VkStencilOp pCreateInfos->pDepthStencilState->front.passOp, is an "
- "unrecognized enumerator");
- return false;
- }
- if (pCreateInfos->pDepthStencilState->front.depthFailOp < VK_STENCIL_OP_BEGIN_RANGE ||
- pCreateInfos->pDepthStencilState->front.depthFailOp > VK_STENCIL_OP_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateGraphicsPipelines parameter, VkStencilOp pCreateInfos->pDepthStencilState->front.depthFailOp, is "
- "an unrecognized enumerator");
- return false;
- }
- if (pCreateInfos->pDepthStencilState->front.compareOp < VK_COMPARE_OP_BEGIN_RANGE ||
- pCreateInfos->pDepthStencilState->front.compareOp > VK_COMPARE_OP_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateGraphicsPipelines parameter, VkCompareOp pCreateInfos->pDepthStencilState->front.compareOp, is an "
- "unrecognized enumerator");
- return false;
- }
- if (pCreateInfos->pDepthStencilState->back.failOp < VK_STENCIL_OP_BEGIN_RANGE ||
- pCreateInfos->pDepthStencilState->back.failOp > VK_STENCIL_OP_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateGraphicsPipelines parameter, VkStencilOp pCreateInfos->pDepthStencilState->back.failOp, is an "
- "unrecognized enumerator");
- return false;
- }
- if (pCreateInfos->pDepthStencilState->back.passOp < VK_STENCIL_OP_BEGIN_RANGE ||
- pCreateInfos->pDepthStencilState->back.passOp > VK_STENCIL_OP_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateGraphicsPipelines parameter, VkStencilOp pCreateInfos->pDepthStencilState->back.passOp, is an "
- "unrecognized enumerator");
- return false;
- }
- if (pCreateInfos->pDepthStencilState->back.depthFailOp < VK_STENCIL_OP_BEGIN_RANGE ||
- pCreateInfos->pDepthStencilState->back.depthFailOp > VK_STENCIL_OP_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateGraphicsPipelines parameter, VkStencilOp pCreateInfos->pDepthStencilState->back.depthFailOp, is "
- "an unrecognized enumerator");
- return false;
- }
- if (pCreateInfos->pDepthStencilState->back.compareOp < VK_COMPARE_OP_BEGIN_RANGE ||
- pCreateInfos->pDepthStencilState->back.compareOp > VK_COMPARE_OP_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateGraphicsPipelines parameter, VkCompareOp pCreateInfos->pDepthStencilState->back.compareOp, is an "
- "unrecognized enumerator");
- return false;
- }
}
if (pCreateInfos->pColorBlendState != nullptr) {
if (pCreateInfos->pColorBlendState->logicOpEnable == VK_TRUE &&
}
int i = 0;
- for (auto j = 0; j < pCreateInfos[i].stageCount; j++) {
+ for (size_t j = 0; j < pCreateInfos[i].stageCount; j++) {
validate_string(data->report_data, "vkCreateGraphicsPipelines", "pCreateInfos[i].pStages[j].pName",
pCreateInfos[i].pStages[j].pName);
}
}
}
-bool PreCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo) {
- if (pCreateInfo != nullptr) {
- if (pCreateInfo->magFilter < VK_FILTER_BEGIN_RANGE || pCreateInfo->magFilter > VK_FILTER_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateSampler parameter, VkFilter pCreateInfo->magFilter, is an unrecognized enumerator");
- return false;
- }
- if (pCreateInfo->minFilter < VK_FILTER_BEGIN_RANGE || pCreateInfo->minFilter > VK_FILTER_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateSampler parameter, VkFilter pCreateInfo->minFilter, is an unrecognized enumerator");
- return false;
- }
- if (pCreateInfo->mipmapMode < VK_SAMPLER_MIPMAP_MODE_BEGIN_RANGE ||
- pCreateInfo->mipmapMode > VK_SAMPLER_MIPMAP_MODE_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateSampler parameter, VkSamplerMipmapMode pCreateInfo->mipmapMode, is an unrecognized enumerator");
- return false;
- }
- if (pCreateInfo->addressModeU < VK_SAMPLER_ADDRESS_MODE_BEGIN_RANGE ||
- pCreateInfo->addressModeU > VK_SAMPLER_ADDRESS_MODE_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateSampler parameter, VkTexAddress pCreateInfo->addressModeU, is an unrecognized enumerator");
- return false;
- }
- if (pCreateInfo->addressModeV < VK_SAMPLER_ADDRESS_MODE_BEGIN_RANGE ||
- pCreateInfo->addressModeV > VK_SAMPLER_ADDRESS_MODE_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateSampler parameter, VkTexAddress pCreateInfo->addressModeV, is an unrecognized enumerator");
- return false;
- }
- if (pCreateInfo->addressModeW < VK_SAMPLER_ADDRESS_MODE_BEGIN_RANGE ||
- pCreateInfo->addressModeW > VK_SAMPLER_ADDRESS_MODE_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateSampler parameter, VkTexAddress pCreateInfo->addressModeW, is an unrecognized enumerator");
- return false;
- }
- if (pCreateInfo->anisotropyEnable > VK_TRUE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateSampler parameter, VkBool32 pCreateInfo->anisotropyEnable, is an unrecognized boolean");
- return false;
- }
- if (pCreateInfo->compareEnable > VK_TRUE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateSampler parameter, VkBool32 pCreateInfo->compareEnable, is an unrecognized boolean");
- return false;
- }
- if (pCreateInfo->compareEnable) {
- if (pCreateInfo->compareOp < VK_COMPARE_OP_BEGIN_RANGE || pCreateInfo->compareOp > VK_COMPARE_OP_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateSampler parameter, VkCompareOp pCreateInfo->compareOp, is an unrecognized enumerator");
- return false;
- }
- }
- if (pCreateInfo->borderColor < VK_BORDER_COLOR_BEGIN_RANGE || pCreateInfo->borderColor > VK_BORDER_COLOR_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateSampler parameter, VkBorderColor pCreateInfo->borderColor, is an unrecognized enumerator");
- return false;
- }
- if (pCreateInfo->unnormalizedCoordinates > VK_TRUE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateSampler parameter, VkBool32 pCreateInfo->unnormalizedCoordinates, is an unrecognized boolean");
- return false;
- }
- }
-
- return true;
-}
-
bool PostCreateSampler(VkDevice device, VkSampler *pSampler, VkResult result) {
if (result < VK_SUCCESS) {
std::string reason = "vkCreateSampler parameter, VkResult result, is " + EnumeratorString(result);
skipCall |= parameter_validation_vkCreateSampler(my_data->report_data, pCreateInfo, pAllocator, pSampler);
if (skipCall == VK_FALSE) {
- PreCreateSampler(device, pCreateInfo);
-
result = get_dispatch_table(pc_device_table_map, device)->CreateSampler(device, pCreateInfo, pAllocator, pSampler);
PostCreateSampler(device, pSampler, result);
}
}
-bool PreCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo) {
- if (pCreateInfo != nullptr) {
- if (pCreateInfo->pBindings != nullptr) {
- if (pCreateInfo->pBindings->descriptorType < VK_DESCRIPTOR_TYPE_BEGIN_RANGE ||
- pCreateInfo->pBindings->descriptorType > VK_DESCRIPTOR_TYPE_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateDescriptorSetLayout parameter, VkDescriptorType pCreateInfo->pBindings->descriptorType, is an "
- "unrecognized enumerator");
- return false;
- }
- }
- }
-
- return true;
-}
-
bool PostCreateDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout *pSetLayout, VkResult result) {
if (result < VK_SUCCESS) {
std::string reason = "vkCreateDescriptorSetLayout parameter, VkResult result, is " + EnumeratorString(result);
skipCall |= parameter_validation_vkCreateDescriptorSetLayout(my_data->report_data, pCreateInfo, pAllocator, pSetLayout);
if (skipCall == VK_FALSE) {
- PreCreateDescriptorSetLayout(device, pCreateInfo);
-
result =
get_dispatch_table(pc_device_table_map, device)->CreateDescriptorSetLayout(device, pCreateInfo, pAllocator, pSetLayout);
}
}
-bool PreCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo) {
- if (pCreateInfo != nullptr) {
- if (pCreateInfo->pPoolSizes != nullptr) {
- if (pCreateInfo->pPoolSizes->type < VK_DESCRIPTOR_TYPE_BEGIN_RANGE ||
- pCreateInfo->pPoolSizes->type > VK_DESCRIPTOR_TYPE_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateDescriptorPool parameter, VkDescriptorType pCreateInfo->pTypeCount->type, is an unrecognized "
- "enumerator");
- return false;
- }
- }
- }
-
- return true;
-}
-
bool PostCreateDescriptorPool(VkDevice device, uint32_t maxSets, VkDescriptorPool *pDescriptorPool, VkResult result) {
/* TODOVV: How do we validate maxSets? Probably belongs in the limits layer? */
skipCall |= parameter_validation_vkCreateDescriptorPool(my_data->report_data, pCreateInfo, pAllocator, pDescriptorPool);
if (skipCall == VK_FALSE) {
- PreCreateDescriptorPool(device, pCreateInfo);
-
result =
get_dispatch_table(pc_device_table_map, device)->CreateDescriptorPool(device, pCreateInfo, pAllocator, pDescriptorPool);
return result;
}
-bool PreUpdateDescriptorSets(VkDevice device, const VkWriteDescriptorSet *pDescriptorWrites,
- const VkCopyDescriptorSet *pDescriptorCopies) {
- if (pDescriptorWrites != nullptr) {
- if (pDescriptorWrites->descriptorType < VK_DESCRIPTOR_TYPE_BEGIN_RANGE ||
- pDescriptorWrites->descriptorType > VK_DESCRIPTOR_TYPE_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkUpdateDescriptorSets parameter, VkDescriptorType pDescriptorWrites->descriptorType, is an unrecognized "
- "enumerator");
- return false;
- }
- /* TODO: Validate other parts of pImageInfo, pBufferInfo, pTexelBufferView? */
- /* TODO: This test should probably only be done if descriptorType is correct type of descriptor */
- if (pDescriptorWrites->pImageInfo != nullptr) {
- if (((pDescriptorWrites->pImageInfo->imageLayout < VK_IMAGE_LAYOUT_BEGIN_RANGE) ||
- (pDescriptorWrites->pImageInfo->imageLayout > VK_IMAGE_LAYOUT_END_RANGE)) &&
- (pDescriptorWrites->pImageInfo->imageLayout != VK_IMAGE_LAYOUT_PRESENT_SRC_KHR)) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkUpdateDescriptorSets parameter, VkImageLayout pDescriptorWrites->pDescriptors->imageLayout, is an "
- "unrecognized enumerator");
- return false;
- }
- }
- }
-
- return true;
-}
-
VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL
vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet *pDescriptorWrites,
uint32_t descriptorCopyCount, const VkCopyDescriptorSet *pDescriptorCopies) {
descriptorCopyCount, pDescriptorCopies);
if (skipCall == VK_FALSE) {
- PreUpdateDescriptorSets(device, pDescriptorWrites, pDescriptorCopies);
-
get_dispatch_table(pc_device_table_map, device)
->UpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies);
}
}
}
-bool PreCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo) {
- if (pCreateInfo != nullptr) {
- if (pCreateInfo->pAttachments != nullptr) {
- if (pCreateInfo->pAttachments->format < VK_FORMAT_BEGIN_RANGE ||
- pCreateInfo->pAttachments->format > VK_FORMAT_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateRenderPass parameter, VkFormat pCreateInfo->pAttachments->format, is an unrecognized enumerator");
- return false;
- }
- if (pCreateInfo->pAttachments->loadOp < VK_ATTACHMENT_LOAD_OP_BEGIN_RANGE ||
- pCreateInfo->pAttachments->loadOp > VK_ATTACHMENT_LOAD_OP_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateRenderPass parameter, VkAttachmentLoadOp pCreateInfo->pAttachments->loadOp, is an unrecognized "
- "enumerator");
- return false;
- }
- if (pCreateInfo->pAttachments->storeOp < VK_ATTACHMENT_STORE_OP_BEGIN_RANGE ||
- pCreateInfo->pAttachments->storeOp > VK_ATTACHMENT_STORE_OP_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateRenderPass parameter, VkAttachmentStoreOp pCreateInfo->pAttachments->storeOp, is an unrecognized "
- "enumerator");
- return false;
- }
- if (pCreateInfo->pAttachments->stencilLoadOp < VK_ATTACHMENT_LOAD_OP_BEGIN_RANGE ||
- pCreateInfo->pAttachments->stencilLoadOp > VK_ATTACHMENT_LOAD_OP_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateRenderPass parameter, VkAttachmentLoadOp pCreateInfo->pAttachments->stencilLoadOp, is an "
- "unrecognized enumerator");
- return false;
- }
- if (pCreateInfo->pAttachments->stencilStoreOp < VK_ATTACHMENT_STORE_OP_BEGIN_RANGE ||
- pCreateInfo->pAttachments->stencilStoreOp > VK_ATTACHMENT_STORE_OP_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateRenderPass parameter, VkAttachmentStoreOp pCreateInfo->pAttachments->stencilStoreOp, is an "
- "unrecognized enumerator");
- return false;
- }
- if (((pCreateInfo->pAttachments->initialLayout < VK_IMAGE_LAYOUT_BEGIN_RANGE) ||
- (pCreateInfo->pAttachments->initialLayout > VK_IMAGE_LAYOUT_END_RANGE)) &&
- (pCreateInfo->pAttachments->initialLayout != VK_IMAGE_LAYOUT_PRESENT_SRC_KHR)) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateRenderPass parameter, VkImageLayout pCreateInfo->pAttachments->initialLayout, is an unrecognized "
- "enumerator");
- return false;
- }
- if (((pCreateInfo->pAttachments->initialLayout < VK_IMAGE_LAYOUT_BEGIN_RANGE) ||
- (pCreateInfo->pAttachments->initialLayout > VK_IMAGE_LAYOUT_END_RANGE)) &&
- (pCreateInfo->pAttachments->initialLayout != VK_IMAGE_LAYOUT_PRESENT_SRC_KHR)) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateRenderPass parameter, VkImageLayout pCreateInfo->pAttachments->finalLayout, is an unrecognized "
- "enumerator");
- return false;
- }
- }
- if (pCreateInfo->pSubpasses != nullptr) {
- if (pCreateInfo->pSubpasses->pipelineBindPoint < VK_PIPELINE_BIND_POINT_BEGIN_RANGE ||
- pCreateInfo->pSubpasses->pipelineBindPoint > VK_PIPELINE_BIND_POINT_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateRenderPass parameter, VkPipelineBindPoint pCreateInfo->pSubpasses->pipelineBindPoint, is an "
- "unrecognized enumerator");
- return false;
- }
- if (pCreateInfo->pSubpasses->pInputAttachments != nullptr) {
- if (((pCreateInfo->pSubpasses->pInputAttachments->layout < VK_IMAGE_LAYOUT_BEGIN_RANGE) ||
- (pCreateInfo->pSubpasses->pInputAttachments->layout > VK_IMAGE_LAYOUT_END_RANGE)) &&
- (pCreateInfo->pSubpasses->pInputAttachments->layout != VK_IMAGE_LAYOUT_PRESENT_SRC_KHR)) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateRenderPass parameter, VkImageLayout pCreateInfo->pSubpasses->pInputAttachments->layout, is an "
- "unrecognized enumerator");
- return false;
- }
- }
- if (pCreateInfo->pSubpasses->pColorAttachments != nullptr) {
- if (((pCreateInfo->pSubpasses->pColorAttachments->layout < VK_IMAGE_LAYOUT_BEGIN_RANGE) ||
- (pCreateInfo->pSubpasses->pColorAttachments->layout > VK_IMAGE_LAYOUT_END_RANGE)) &&
- (pCreateInfo->pSubpasses->pColorAttachments->layout != VK_IMAGE_LAYOUT_PRESENT_SRC_KHR)) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateRenderPass parameter, VkImageLayout pCreateInfo->pSubpasses->pColorAttachments->layout, is an "
- "unrecognized enumerator");
- return false;
- }
- }
- if (pCreateInfo->pSubpasses->pResolveAttachments != nullptr) {
- if (((pCreateInfo->pSubpasses->pResolveAttachments->layout < VK_IMAGE_LAYOUT_BEGIN_RANGE) ||
- (pCreateInfo->pSubpasses->pResolveAttachments->layout > VK_IMAGE_LAYOUT_END_RANGE)) &&
- (pCreateInfo->pSubpasses->pResolveAttachments->layout != VK_IMAGE_LAYOUT_PRESENT_SRC_KHR)) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateRenderPass parameter, VkImageLayout pCreateInfo->pSubpasses->pResolveAttachments->layout, is "
- "an unrecognized enumerator");
- return false;
- }
- }
- if (pCreateInfo->pSubpasses->pDepthStencilAttachment &&
- ((pCreateInfo->pSubpasses->pDepthStencilAttachment->layout < VK_IMAGE_LAYOUT_BEGIN_RANGE) ||
- (pCreateInfo->pSubpasses->pDepthStencilAttachment->layout > VK_IMAGE_LAYOUT_END_RANGE)) &&
- (pCreateInfo->pSubpasses->pDepthStencilAttachment->layout != VK_IMAGE_LAYOUT_PRESENT_SRC_KHR)) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCreateRenderPass parameter, VkImageLayout pCreateInfo->pSubpasses->pDepthStencilAttachment->layout, is "
- "an unrecognized enumerator");
- return false;
- }
- }
- }
-
- return true;
-}
-
bool PostCreateRenderPass(VkDevice device, VkRenderPass *pRenderPass, VkResult result) {
if (result < VK_SUCCESS) {
std::string reason = "vkCreateRenderPass parameter, VkResult result, is " + EnumeratorString(result);
skipCall |= parameter_validation_vkCreateRenderPass(my_data->report_data, pCreateInfo, pAllocator, pRenderPass);
if (skipCall == VK_FALSE) {
- PreCreateRenderPass(device, pCreateInfo);
-
result = get_dispatch_table(pc_device_table_map, device)->CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass);
PostCreateRenderPass(device, pRenderPass, result);
return result;
}
-bool PreCreateCommandBuffer(VkDevice device, const VkCommandBufferAllocateInfo *pCreateInfo) {
- if (pCreateInfo != nullptr) {
- if (pCreateInfo->level < VK_COMMAND_BUFFER_LEVEL_BEGIN_RANGE || pCreateInfo->level > VK_COMMAND_BUFFER_LEVEL_END_RANGE) {
- log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkAllocateCommandBuffers parameter, VkCommandBufferLevel pCreateInfo->level, is an unrecognized enumerator");
- return false;
- }
- }
-
- return true;
-}
-
bool PostCreateCommandBuffer(VkDevice device, VkCommandBuffer *pCommandBuffer, VkResult result) {
if (result < VK_SUCCESS) {
std::string reason = "vkAllocateCommandBuffers parameter, VkResult result, is " + EnumeratorString(result);
skipCall |= parameter_validation_vkAllocateCommandBuffers(my_data->report_data, pAllocateInfo, pCommandBuffers);
if (skipCall == VK_FALSE) {
- PreCreateCommandBuffer(device, pAllocateInfo);
-
result = get_dispatch_table(pc_device_table_map, device)->AllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers);
PostCreateCommandBuffer(device, pCommandBuffers, result);
return result;
}
-bool PostCmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) {
-
- if (pipelineBindPoint < VK_PIPELINE_BIND_POINT_BEGIN_RANGE || pipelineBindPoint > VK_PIPELINE_BIND_POINT_END_RANGE) {
- log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCmdBindPipeline parameter, VkPipelineBindPoint pipelineBindPoint, is an unrecognized enumerator");
- return false;
- }
-
- return true;
-}
-
VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL
vkCmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) {
- get_dispatch_table(pc_device_table_map, commandBuffer)->CmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline);
+ VkBool32 skipCall = VK_FALSE;
+ layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
+ assert(my_data != NULL);
- PostCmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline);
+ skipCall |= parameter_validation_vkCmdBindPipeline(my_data->report_data, pipelineBindPoint, pipeline);
+
+ if (skipCall == VK_FALSE) {
+ get_dispatch_table(pc_device_table_map, commandBuffer)->CmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline);
+ }
}
VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL
get_dispatch_table(pc_device_table_map, commandBuffer)->CmdSetStencilReference(commandBuffer, faceMask, reference);
}
-bool PostCmdBindDescriptorSets(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout,
- uint32_t firstSet, uint32_t setCount, uint32_t dynamicOffsetCount) {
-
- if (pipelineBindPoint < VK_PIPELINE_BIND_POINT_BEGIN_RANGE || pipelineBindPoint > VK_PIPELINE_BIND_POINT_END_RANGE) {
- log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCmdBindDescriptorSets parameter, VkPipelineBindPoint pipelineBindPoint, is an unrecognized enumerator");
- return false;
- }
-
- return true;
-}
-
VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL
vkCmdBindDescriptorSets(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout,
uint32_t firstSet, uint32_t descriptorSetCount, const VkDescriptorSet *pDescriptorSets,
get_dispatch_table(pc_device_table_map, commandBuffer)
->CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, pDescriptorSets,
dynamicOffsetCount, pDynamicOffsets);
-
- PostCmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, dynamicOffsetCount);
}
}
-bool PostCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType) {
-
- if (indexType < VK_INDEX_TYPE_BEGIN_RANGE || indexType > VK_INDEX_TYPE_END_RANGE) {
- log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCmdBindIndexBuffer parameter, VkIndexType indexType, is an unrecognized enumerator");
- return false;
- }
-
- return true;
-}
-
VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL
vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType) {
- get_dispatch_table(pc_device_table_map, commandBuffer)->CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType);
+ VkBool32 skipCall = VK_FALSE;
+ layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
+ assert(my_data != NULL);
+
+ skipCall |= parameter_validation_vkCmdBindIndexBuffer(my_data->report_data, buffer, offset, indexType);
- PostCmdBindIndexBuffer(commandBuffer, buffer, offset, indexType);
+ if (skipCall == VK_FALSE) {
+ get_dispatch_table(pc_device_table_map, commandBuffer)->CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType);
+ }
}
VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding,
return true;
}
-bool PostCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage,
- VkImageLayout dstImageLayout, uint32_t regionCount) {
- if (((srcImageLayout < VK_IMAGE_LAYOUT_BEGIN_RANGE) || (srcImageLayout > VK_IMAGE_LAYOUT_END_RANGE)) &&
- (srcImageLayout != VK_IMAGE_LAYOUT_PRESENT_SRC_KHR)) {
- log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCmdCopyImage parameter, VkImageLayout srcImageLayout, is an unrecognized enumerator");
- return false;
- }
-
- if (((dstImageLayout < VK_IMAGE_LAYOUT_BEGIN_RANGE) || (dstImageLayout > VK_IMAGE_LAYOUT_END_RANGE)) &&
- (dstImageLayout != VK_IMAGE_LAYOUT_PRESENT_SRC_KHR)) {
- log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCmdCopyImage parameter, VkImageLayout dstImageLayout, is an unrecognized enumerator");
- return false;
- }
-
- return true;
-}
-
VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL
vkCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage,
VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy *pRegions) {
get_dispatch_table(pc_device_table_map, commandBuffer)
->CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
-
- PostCmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount);
}
}
return true;
}
-bool PostCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage,
- VkImageLayout dstImageLayout, uint32_t regionCount, VkFilter filter) {
-
- if (((srcImageLayout < VK_IMAGE_LAYOUT_BEGIN_RANGE) || (srcImageLayout > VK_IMAGE_LAYOUT_END_RANGE)) &&
- (srcImageLayout != VK_IMAGE_LAYOUT_PRESENT_SRC_KHR)) {
- log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCmdBlitImage parameter, VkImageLayout srcImageLayout, is an unrecognized enumerator");
- return false;
- }
-
- if (((dstImageLayout < VK_IMAGE_LAYOUT_BEGIN_RANGE) || (dstImageLayout > VK_IMAGE_LAYOUT_END_RANGE)) &&
- (dstImageLayout != VK_IMAGE_LAYOUT_PRESENT_SRC_KHR)) {
- log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCmdBlitImage parameter, VkImageLayout dstImageLayout, is an unrecognized enumerator");
- return false;
- }
-
- if (filter < VK_FILTER_BEGIN_RANGE || filter > VK_FILTER_END_RANGE) {
- log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCmdBlitImage parameter, VkFilter filter, is an unrecognized enumerator");
- return false;
- }
-
- return true;
-}
-
VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL
vkCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage,
VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit *pRegions, VkFilter filter) {
get_dispatch_table(pc_device_table_map, commandBuffer)
->CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions, filter);
-
- PostCmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, filter);
}
}
return true;
}
-bool PostCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout,
- uint32_t regionCount) {
-
- if (((dstImageLayout < VK_IMAGE_LAYOUT_BEGIN_RANGE) || (dstImageLayout > VK_IMAGE_LAYOUT_END_RANGE)) &&
- (dstImageLayout != VK_IMAGE_LAYOUT_PRESENT_SRC_KHR)) {
- log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCmdCopyBufferToImage parameter, VkImageLayout dstImageLayout, is an unrecognized enumerator");
- return false;
- }
-
- return true;
-}
-
VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer,
VkImage dstImage, VkImageLayout dstImageLayout,
uint32_t regionCount, const VkBufferImageCopy *pRegions) {
get_dispatch_table(pc_device_table_map, commandBuffer)
->CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions);
-
- PostCmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage, dstImageLayout, regionCount);
}
}
return true;
}
-bool PostCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer,
- uint32_t regionCount) {
-
- if (((srcImageLayout < VK_IMAGE_LAYOUT_BEGIN_RANGE) || (srcImageLayout > VK_IMAGE_LAYOUT_END_RANGE)) &&
- (srcImageLayout != VK_IMAGE_LAYOUT_PRESENT_SRC_KHR)) {
- log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCmdCopyImageToBuffer parameter, VkImageLayout srcImageLayout, is an unrecognized enumerator");
- return false;
- }
-
- return true;
-}
-
VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage,
VkImageLayout srcImageLayout, VkBuffer dstBuffer,
uint32_t regionCount, const VkBufferImageCopy *pRegions) {
get_dispatch_table(pc_device_table_map, commandBuffer)
->CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions);
-
- PostCmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout, dstBuffer, regionCount);
}
}
get_dispatch_table(pc_device_table_map, commandBuffer)->CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data);
}
-bool PostCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, uint32_t rangeCount) {
-
- if (((imageLayout < VK_IMAGE_LAYOUT_BEGIN_RANGE) || (imageLayout > VK_IMAGE_LAYOUT_END_RANGE)) &&
- (imageLayout != VK_IMAGE_LAYOUT_PRESENT_SRC_KHR)) {
- log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCmdClearColorImage parameter, VkImageLayout imageLayout, is an unrecognized enumerator");
- return false;
- }
-
- return true;
-}
-
VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image,
VkImageLayout imageLayout, const VkClearColorValue *pColor,
uint32_t rangeCount, const VkImageSubresourceRange *pRanges) {
if (skipCall == VK_FALSE) {
get_dispatch_table(pc_device_table_map, commandBuffer)
->CmdClearColorImage(commandBuffer, image, imageLayout, pColor, rangeCount, pRanges);
-
- PostCmdClearColorImage(commandBuffer, image, imageLayout, rangeCount);
}
}
-bool PostCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout,
- const VkClearDepthStencilValue *pDepthStencil, uint32_t rangeCount) {
-
- if (((imageLayout < VK_IMAGE_LAYOUT_BEGIN_RANGE) || (imageLayout > VK_IMAGE_LAYOUT_END_RANGE)) &&
- (imageLayout != VK_IMAGE_LAYOUT_PRESENT_SRC_KHR)) {
- log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCmdClearDepthStencilImage parameter, VkImageLayout imageLayout, is an unrecognized enumerator");
- return false;
- }
-
- return true;
-}
-
VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL
vkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout,
const VkClearDepthStencilValue *pDepthStencil, uint32_t rangeCount,
if (skipCall == VK_FALSE) {
get_dispatch_table(pc_device_table_map, commandBuffer)
->CmdClearDepthStencilImage(commandBuffer, image, imageLayout, pDepthStencil, rangeCount, pRanges);
-
- PostCmdClearDepthStencilImage(commandBuffer, image, imageLayout, pDepthStencil, rangeCount);
}
}
return true;
}
-bool PostCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage,
- VkImageLayout dstImageLayout, uint32_t regionCount) {
-
- if (((srcImageLayout < VK_IMAGE_LAYOUT_BEGIN_RANGE) || (srcImageLayout > VK_IMAGE_LAYOUT_END_RANGE)) &&
- (srcImageLayout != VK_IMAGE_LAYOUT_PRESENT_SRC_KHR)) {
- log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCmdResolveImage parameter, VkImageLayout srcImageLayout, is an unrecognized enumerator");
- return false;
- }
-
- if (((dstImageLayout < VK_IMAGE_LAYOUT_BEGIN_RANGE) || (dstImageLayout > VK_IMAGE_LAYOUT_END_RANGE)) &&
- (dstImageLayout != VK_IMAGE_LAYOUT_PRESENT_SRC_KHR)) {
- log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCmdResolveImage parameter, VkImageLayout dstImageLayout, is an unrecognized enumerator");
- return false;
- }
-
- return true;
-}
-
VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL
vkCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage,
VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve *pRegions) {
get_dispatch_table(pc_device_table_map, commandBuffer)
->CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
-
- PostCmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount);
}
}
}
}
-bool PostCmdBeginRenderPass(VkCommandBuffer commandBuffer, VkSubpassContents contents) {
-
- if (contents < VK_SUBPASS_CONTENTS_BEGIN_RANGE || contents > VK_SUBPASS_CONTENTS_END_RANGE) {
- log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCmdBeginRenderPass parameter, VkSubpassContents contents, is an unrecognized enumerator");
- return false;
- }
-
- return true;
-}
-
VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL
vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin, VkSubpassContents contents) {
VkBool32 skipCall = VK_FALSE;
if (skipCall == VK_FALSE) {
get_dispatch_table(pc_device_table_map, commandBuffer)->CmdBeginRenderPass(commandBuffer, pRenderPassBegin, contents);
-
- PostCmdBeginRenderPass(commandBuffer, contents);
}
}
-bool PostCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) {
-
- if (contents < VK_SUBPASS_CONTENTS_BEGIN_RANGE || contents > VK_SUBPASS_CONTENTS_END_RANGE) {
- log_msg(mdd(commandBuffer), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "vkCmdNextSubpass parameter, VkSubpassContents contents, is an unrecognized enumerator");
- return false;
- }
-
- return true;
-}
-
VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) {
- get_dispatch_table(pc_device_table_map, commandBuffer)->CmdNextSubpass(commandBuffer, contents);
+ VkBool32 skipCall = VK_FALSE;
+ layer_data *my_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
+ assert(my_data != NULL);
- PostCmdNextSubpass(commandBuffer, contents);
+ skipCall |= parameter_validation_vkCmdNextSubpass(my_data->report_data, contents);
+
+ if (skipCall == VK_FALSE) {
+ get_dispatch_table(pc_device_table_map, commandBuffer)->CmdNextSubpass(commandBuffer, contents);
+ }
}
VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdEndRenderPass(VkCommandBuffer commandBuffer) {
#define PARAMETER_VALIDATION_UTILS_H
#include <algorithm>
+#include <cstdlib>
#include <string>
#include "vulkan/vulkan.h"
};
}
-// String returned by string_VkStructureType for an unrecognized type
+// Layer name string to be logged with validation messages.
+const char ParameterValidationName[] = "ParameterValidation";
+
+// String returned by string_VkStructureType for an unrecognized type.
const std::string UnsupportedStructureTypeString = "Unhandled VkStructureType";
+// The base value used when computing the offset for an enumeration token value that is added by an extension.
+// When validating enumeration tokens, any value >= to this value is considered to be provided by an extension.
+// See Appendix C.10 "Assigning Extension Token Values" from the Vulkan specification
+const uint32_t ExtEnumBaseValue = 1000000000;
+
+template <typename T> bool is_extension_added_token(T value) {
+ return (std::abs(static_cast<int32_t>(value)) >= ExtEnumBaseValue);
+}
+
+// VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE token is a special case that was converted from a core token to an
+// extension added token. Its original value was intentionally preserved after the conversion, so it does not use
+// the base value that other extension added tokens use, and it does not fall within the enum's begin/end range.
+template <> bool is_extension_added_token(VkSamplerAddressMode value) {
+ bool result = (std::abs(static_cast<int32_t>(value)) >= ExtEnumBaseValue);
+ return (result || (value == VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE));
+}
+
/**
* Validate a required pointer.
*
VkBool32 skipCall = VK_FALSE;
if (value == NULL) {
- skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "%s: required parameter %s specified as NULL", apiName, parameterName);
+ skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1,
+ ParameterValidationName, "%s: required parameter %s specified as NULL", apiName, parameterName);
}
return skipCall;
if (count == NULL) {
if (countPtrRequired == VK_TRUE) {
skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1,
- "PARAMCHECK", "%s: required parameter %s specified as NULL", apiName, countName);
+ ParameterValidationName, "%s: required parameter %s specified as NULL", apiName, countName);
}
} else {
skipCall |= validate_array(report_data, apiName, countName, arrayName, (*count), array, countValueRequired, arrayRequired);
// Count parameters not tagged as optional cannot be 0
if ((count == 0) && (countRequired == VK_TRUE)) {
- skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "%s: value of %s must be greater than 0", apiName, countName);
+ skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1,
+ ParameterValidationName, "%s: value of %s must be greater than 0", apiName, countName);
}
// Array parameters not tagged as optional cannot be NULL,
// unless the count is 0
if ((array == NULL) && (arrayRequired == VK_TRUE) && (count != 0)) {
- skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "%s: required parameter %s specified as NULL", apiName, arrayName);
+ skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1,
+ ParameterValidationName, "%s: required parameter %s specified as NULL", apiName, arrayName);
}
return skipCall;
if (value == NULL) {
if (required == VK_TRUE) {
skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1,
- "PARAMCHECK", "%s: required parameter %s specified as NULL", apiName, parameterName);
+ ParameterValidationName, "%s: required parameter %s specified as NULL", apiName, parameterName);
}
} else if (value->sType != sType) {
- skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
- "%s: parameter %s->sType must be %s", apiName, parameterName, sTypeName);
+ skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1,
+ ParameterValidationName, "%s: parameter %s->sType must be %s", apiName, parameterName, sTypeName);
}
return skipCall;
if (count == NULL) {
if (countPtrRequired == VK_TRUE) {
skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1,
- "PARAMCHECK", "%s: required parameter %s specified as NULL", apiName, countName);
+ ParameterValidationName, "%s: required parameter %s specified as NULL", apiName, countName);
}
} else {
skipCall |= validate_struct_type_array(report_data, apiName, countName, arrayName, sTypeName, (*count), array, sType,
// Count parameters not tagged as optional cannot be 0
if ((count == 0) && (countRequired == VK_TRUE)) {
skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1,
- "PARAMCHECK", "%s: parameter %s must be greater than 0", apiName, countName);
+ ParameterValidationName, "%s: parameter %s must be greater than 0", apiName, countName);
}
// Array parameters not tagged as optional cannot be NULL,
// unless the count is 0
if ((array == NULL) && (arrayRequired == VK_TRUE) && (count != 0)) {
skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1,
- "PARAMCHECK", "%s: required parameter %s specified as NULL", apiName, arrayName);
+ ParameterValidationName, "%s: required parameter %s specified as NULL", apiName, arrayName);
}
} else {
// Verify that all structs in the array have the correct type
for (uint32_t i = 0; i < count; ++i) {
if (array[i].sType != sType) {
- skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1,
- "PARAMCHECK", "%s: parameter %s[%d].sType must be %s", apiName, arrayName, i, sTypeName);
+ skipCall |=
+ log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1,
+ ParameterValidationName, "%s: parameter %s[%d].sType must be %s", apiName, arrayName, i, sTypeName);
}
}
}
// Count parameters not tagged as optional cannot be 0
if ((count == 0) && (countRequired == VK_TRUE)) {
skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1,
- "PARAMCHECK", "%s: parameter %s must be greater than 0", apiName, countName);
+ ParameterValidationName, "%s: parameter %s must be greater than 0", apiName, countName);
}
// Array parameters not tagged as optional cannot be NULL,
// unless the count is 0
if ((array == NULL) && (arrayRequired == VK_TRUE) && (count != 0)) {
skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1,
- "PARAMCHECK", "%s: required parameter %s specified as NULL", apiName, arrayName);
+ ParameterValidationName, "%s: required parameter %s specified as NULL", apiName, arrayName);
}
} else {
// Verify that strings in the array not NULL
for (uint32_t i = 0; i < count; ++i) {
if (array[i] == NULL) {
- skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1,
- "PARAMCHECK", "%s: required parameter %s[%d] specified as NULL", apiName, arrayName, i);
+ skipCall |=
+ log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1,
+ ParameterValidationName, "%s: required parameter %s[%d] specified as NULL", apiName, arrayName, i);
}
}
}
if (next != NULL) {
if (allowedTypeCount == 0) {
skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1,
- "PARAMCHECK", "%s: value of %s must be NULL", apiName, parameterName);
+ ParameterValidationName, "%s: value of %s must be NULL", apiName, parameterName);
} else {
const VkStructureType *start = allowedTypes;
const VkStructureType *end = allowedTypes + allowedTypeCount;
if (typeName == UnsupportedStructureTypeString) {
skipCall |= log_msg(
- report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
+ report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1,
+ ParameterValidationName,
"%s: %s chain includes a structure with unexpected VkStructureType (%d); Allowed structures are [%s]",
apiName, parameterName, current->sType, allowedStructNames);
} else {
skipCall |= log_msg(
- report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
+ report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1,
+ ParameterValidationName,
"%s: %s chain includes a structure with unexpected VkStructureType %s; Allowed structures are [%s]",
apiName, parameterName, typeName.c_str(), allowedStructNames);
}
return skipCall;
}
+/**
+* Validate a VkBool32 value.
+*
+* Generate a warning if a VkBool32 value is neither VK_TRUE nor VK_FALSE.
+*
+* @param report_data debug_report_data object for routing validation messages.
+* @param apiName Name of API call being validated.
+* @param parameterName Name of parameter being validated.
+* @param value Boolean value to validate.
+* @return Boolean value indicating that the call should be skipped.
+*/
+static VkBool32 validate_bool32(debug_report_data *report_data, const char *apiName, const char *parameterName, VkBool32 value) {
+ VkBool32 skipCall = VK_FALSE;
+
+ if ((value != VK_TRUE) && (value != VK_FALSE)) {
+ skipCall |=
+ log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1,
+ ParameterValidationName, "%s: value of %s (%d) is neither VK_TRUE nor VK_FALSE", apiName, parameterName, value);
+ }
+
+ return skipCall;
+}
+
+/**
+* Validate a Vulkan enumeration value.
+*
+* Generate a warning if an enumeration token value does not fall within the core enumeration
+* begin and end token values, and was not added to the enumeration by an extension. Extension
+* provided enumerations use the equation specified in Appendix C.10 of the Vulkan specification,
+* with 1,000,000,000 as the base token value.
+*
+* @note This function does not expect to process enumerations defining bitmask flag bits.
+*
+* @param report_data debug_report_data object for routing validation messages.
+* @param apiName Name of API call being validated.
+* @param parameterName Name of parameter being validated.
+* @param enumName Name of the enumeration being validated.
+* @param begin The begin range value for the enumeration.
+* @param end The end range value for the enumeration.
+* @param value Boolean value to validate.
+* @return Boolean value indicating that the call should be skipped.
+*/
+template <typename T>
+VkBool32 validate_ranged_enum(debug_report_data *report_data, const char *apiName, const char *parameterName, const char *enumName,
+ T begin, T end, T value) {
+ VkBool32 skipCall = VK_FALSE;
+
+ if (((value < begin) || (value > end)) && !is_extension_added_token(value)) {
+ skipCall |=
+ log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1,
+ ParameterValidationName, "%s: value of %s (%d) does not fall within the begin..end range of the core %s "
+ "enumeration tokens and is not an extension added token",
+ apiName, parameterName, value, enumName);
+ }
+
+ return skipCall;
+}
+
+/**
+* Validate an array of Vulkan enumeration value.
+*
+* Process all enumeration token values in the specified array and generate a warning if a value
+* does not fall within the core enumeration begin and end token values, and was not added to
+* the enumeration by an extension. Extension provided enumerations use the equation specified
+* in Appendix C.10 of the Vulkan specification, with 1,000,000,000 as the base token value.
+*
+* @note This function does not expect to process enumerations defining bitmask flag bits.
+*
+* @param report_data debug_report_data object for routing validation messages.
+* @param apiName Name of API call being validated.
+* @param parameterName Name of parameter being validated.
+* @param enumName Name of the enumeration being validated.
+* @param begin The begin range value for the enumeration.
+* @param end The end range value for the enumeration.
+* @param value Boolean value to validate.
+* @return Boolean value indicating that the call should be skipped.
+*/
+template <typename T>
+static VkBool32 validate_ranged_enum_array(debug_report_data *report_data, const char *apiName, const char *parameterName,
+ const char *enumName, T begin, T end, uint32_t count, const T *pValues) {
+ VkBool32 skipCall = VK_FALSE;
+
+ for (uint32_t i = 0; i < count; ++i) {
+ if (((pValues[i] < begin) || (pValues[i] > end)) && !is_extension_added_token(pValues[i])) {
+ skipCall |=
+ log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1,
+ ParameterValidationName, "%s: value of %s[%d] (%d) does not fall within the begin..end range of the core %s "
+ "enumeration tokens and is not an extension added token",
+ apiName, parameterName, i, pValues[i], enumName);
+ }
+ }
+
+ return skipCall;
+}
+
#endif // PARAMETER_VALIDATION_UTILS_H