Skip to content

Commit

Permalink
pr-feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Nathan Gauër <[email protected]>
  • Loading branch information
Keenuts committed Jun 17, 2024
1 parent 8f9fb57 commit c4f2f66
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
12 changes: 4 additions & 8 deletions source/val/validate_memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,8 +785,7 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) {
(!_.HasCapability(spv::Capability::Float16) &&
_.ContainsSizedIntOrFloatType(value_id, spv::Op::OpTypeFloat, 16))) {
auto underlying_type = value_type;
while (underlying_type &&
underlying_type->opcode() == spv::Op::OpTypePointer) {
while (underlying_type->opcode() == spv::Op::OpTypePointer) {
storage_class = underlying_type->GetOperandAs<spv::StorageClass>(1u);
underlying_type =
_.FindDef(underlying_type->GetOperandAs<uint32_t>(2u));
Expand All @@ -802,8 +801,7 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) {
}
break;
case spv::StorageClass::Uniform:
if (underlying_type &&
!_.HasCapability(
if (!_.HasCapability(
spv::Capability::UniformAndStorageBuffer16BitAccess)) {
if (underlying_type->opcode() == spv::Op::OpTypeArray ||
underlying_type->opcode() == spv::Op::OpTypeRuntimeArray) {
Expand Down Expand Up @@ -851,8 +849,7 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) {
if (!_.HasCapability(spv::Capability::Int8) &&
_.ContainsSizedIntOrFloatType(value_id, spv::Op::OpTypeInt, 8)) {
auto underlying_type = value_type;
while (underlying_type &&
underlying_type->opcode() == spv::Op::OpTypePointer) {
while (underlying_type->opcode() == spv::Op::OpTypePointer) {
storage_class = underlying_type->GetOperandAs<spv::StorageClass>(1u);
underlying_type =
_.FindDef(underlying_type->GetOperandAs<uint32_t>(2u));
Expand All @@ -868,8 +865,7 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) {
}
break;
case spv::StorageClass::Uniform:
if (underlying_type &&
!_.HasCapability(
if (!_.HasCapability(
spv::Capability::UniformAndStorageBuffer8BitAccess)) {
if (underlying_type->opcode() == spv::Op::OpTypeArray ||
underlying_type->opcode() == spv::Op::OpTypeRuntimeArray) {
Expand Down
8 changes: 8 additions & 0 deletions test/enum_set_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,14 @@ TEST_P(CapabilitySetForEachTest, CopyConstructor) {
EXPECT_THAT(ElementsIn(copy), Eq(GetParam().expected));
}

TEST_P(CapabilitySetForEachTest, MoveConstructor) {
// We need a writable copy to move from.
CapabilitySet copy(GetParam().capabilities);
CapabilitySet moved(std::move(copy));

EXPECT_THAT(ElementsIn(moved), Eq(GetParam().expected));
}

TEST_P(CapabilitySetForEachTest, OperatorEquals) {
CapabilitySet assigned = GetParam().capabilities;
EXPECT_THAT(ElementsIn(assigned), Eq(GetParam().expected));
Expand Down

0 comments on commit c4f2f66

Please sign in to comment.