forked from KhronosGroup/SPIRV-Tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes KhronosGroup#5781 * Requires all image operands to match except for depth between operand and result
- Loading branch information
1 parent
f914d9c
commit 39df9b4
Showing
2 changed files
with
249 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1005,7 +1005,8 @@ bool IsAllowedSampledImageOperand(spv::Op opcode, ValidationState_t& _) { | |
|
||
spv_result_t ValidateSampledImage(ValidationState_t& _, | ||
const Instruction* inst) { | ||
if (_.GetIdOpcode(inst->type_id()) != spv::Op::OpTypeSampledImage) { | ||
auto type_inst = _.FindDef(inst->type_id()); | ||
if (type_inst->opcode() != spv::Op::OpTypeSampledImage) { | ||
return _.diag(SPV_ERROR_INVALID_DATA, inst) | ||
<< "Expected Result Type to be OpTypeSampledImage."; | ||
} | ||
|
@@ -1022,6 +1023,26 @@ spv_result_t ValidateSampledImage(ValidationState_t& _, | |
<< "Corrupt image type definition"; | ||
} | ||
|
||
// Image operands must match except for depth. | ||
auto sampled_image_id = type_inst->GetOperandAs<uint32_t>(1); | ||
if (sampled_image_id != image_type) { | ||
ImageTypeInfo sampled_info; | ||
if (!GetImageTypeInfo(_, sampled_image_id, &sampled_info)) { | ||
return _.diag(SPV_ERROR_INVALID_DATA, inst) | ||
<< "Corrupt image type definition"; | ||
} | ||
if (info.sampled_type != sampled_info.sampled_type || | ||
info.dim != sampled_info.dim || info.arrayed != sampled_info.arrayed || | ||
info.multisampled != sampled_info.multisampled || | ||
info.sampled != sampled_info.sampled || | ||
info.format != sampled_info.format || | ||
info.access_qualifier != sampled_info.access_qualifier) { | ||
return _.diag(SPV_ERROR_INVALID_DATA, inst) | ||
<< "Image operands must match result image operands except for " | ||
"depth"; | ||
} | ||
} | ||
|
||
// TODO([email protected]) Check compatibility of result type and received | ||
// image. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters