Improve fix for boolean decorations queried in get_decoration, added support to get_member_decoration, and updated comments to reflect the change in behavior.

This commit is contained in:
Graham Wihlidal 2017-01-05 21:01:49 +01:00
parent acd98ac0d5
commit 9b1ee8f10a
2 changed files with 5 additions and 6 deletions

View File

@ -890,7 +890,7 @@ uint32_t Compiler::get_member_decoration(uint32_t id, uint32_t index, Decoration
case DecorationSpecId:
return dec.spec_id;
default:
return 0;
return 1;
}
}
@ -1018,11 +1018,8 @@ uint32_t Compiler::get_decoration(uint32_t id, Decoration decoration) const
return dec.input_attachment;
case DecorationSpecId:
return dec.spec_id;
case DecorationNonWritable:
case DecorationNonReadable:
return 1;
default:
return 0;
return 1;
}
}

View File

@ -138,8 +138,10 @@ public:
uint64_t get_decoration_mask(uint32_t id) const;
// Gets the value for decorations which take arguments.
// If the decoration is a boolean (i.e. spv::DecorationNonWritable),
// 1 will be returned.
// If decoration doesn't exist or decoration is not recognized,
// 0 will be returned.
// 0 will be returned.
uint32_t get_decoration(uint32_t id, spv::Decoration decoration) const;
// Removes the decoration for a an ID.