Skip to content

Commit

Permalink
spirv-val: Fix naming for ImageFormat functions
Browse files Browse the repository at this point in the history
  • Loading branch information
spencer-lunarg committed Nov 1, 2023
1 parent 5b66a41 commit 7895cbf
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions source/val/validate_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ bool IsValidGatherLodBiasAMD(const ValidationState_t& _, spv::Op opcode) {
return false;
}

bool IsSignedInt32ImageFormat(spv::ImageFormat format) {
// Signed or Unsigned Integer Format
bool IsIntImageFormat(spv::ImageFormat format) {
switch (format) {
case spv::ImageFormat::Rgba32i:
case spv::ImageFormat::Rgba16i:
Expand All @@ -199,14 +200,16 @@ bool IsSignedInt32ImageFormat(spv::ImageFormat format) {
case spv::ImageFormat::Rg8ui:
case spv::ImageFormat::R16ui:
case spv::ImageFormat::R8ui:
case spv::ImageFormat::R64ui:
case spv::ImageFormat::R64i:
return true;
default:
break;
}
return false;
}

bool IsSignedInt64ImageFormat(spv::ImageFormat format) {
bool IsInt64ImageFormat(spv::ImageFormat format) {
switch (format) {
case spv::ImageFormat::R64ui:
case spv::ImageFormat::R64i:
Expand Down Expand Up @@ -265,10 +268,6 @@ bool IsFloatImageFormat(spv::ImageFormat format) {
return false;
}

bool IsIntImageFormat(spv::ImageFormat format) {
return IsSignedInt32ImageFormat(format) || IsSignedInt64ImageFormat(format);
}

// Returns true if the opcode is a Image instruction which applies
// homogenous projection to the coordinates.
bool IsProj(spv::Op opcode) {
Expand Down Expand Up @@ -1066,11 +1065,11 @@ spv_result_t ValidateTypeImage(ValidationState_t& _, const Instruction* inst) {
<< _.VkErrorID(4965)
<< "Image Format type (float or int) does not match Sample Type "
"operand";
}
if (is_int) {
} else if (is_int) {
const uint32_t bit_width = _.GetBitWidth(info.sampled_type);
if ((bit_width == 32 && !IsSignedInt32ImageFormat(info.format)) ||
(bit_width == 64 && !IsSignedInt64ImageFormat(info.format))) {
// format check above to be int
if ((bit_width == 32 && IsInt64ImageFormat(info.format)) ||
(bit_width == 64 && !IsInt64ImageFormat(info.format))) {
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< _.VkErrorID(4965)
<< "Image Format width (32 or 64) does not match Sample Type "
Expand Down

0 comments on commit 7895cbf

Please sign in to comment.