summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorLei Zhang <antiagainst@google.com>2018-07-11 16:53:19 -0400
committerDavid Neto <dneto@google.com>2018-07-11 18:00:54 -0400
commit4db9c789ffb69193ccd5d2dfad1d7bcab5e00f23 (patch)
treeee9bd0214fe6696b3f6317be3b90cbbcea5be0c0 /source
parentaee809d55616ace3a0130ed20a2adb5ca31e32e8 (diff)
Add option to skip verifying block layout
We need this to avoid emitting errors on DirectX layout rules.
Diffstat (limited to 'source')
-rw-r--r--source/spirv_validator_options.cpp5
-rw-r--r--source/spirv_validator_options.h4
-rw-r--r--source/val/validate_decorations.cpp3
3 files changed, 11 insertions, 1 deletions
diff --git a/source/spirv_validator_options.cpp b/source/spirv_validator_options.cpp
index 828d1503..daa53ebd 100644
--- a/source/spirv_validator_options.cpp
+++ b/source/spirv_validator_options.cpp
@@ -91,3 +91,8 @@ void spvValidatorOptionsSetRelaxBlockLayout(spv_validator_options options,
bool val) {
options->relax_block_layout = val;
}
+
+void spvValidatorOptionsSetSkipBlockLayout(spv_validator_options options,
+ bool val) {
+ options->skip_block_layout = val;
+}
diff --git a/source/spirv_validator_options.h b/source/spirv_validator_options.h
index f28cca68..46f24ead 100644
--- a/source/spirv_validator_options.h
+++ b/source/spirv_validator_options.h
@@ -41,12 +41,14 @@ struct spv_validator_options_t {
: universal_limits_(),
relax_struct_store(false),
relax_logical_pointer(false),
- relax_block_layout(false) {}
+ relax_block_layout(false),
+ skip_block_layout(false) {}
validator_universal_limits_t universal_limits_;
bool relax_struct_store;
bool relax_logical_pointer;
bool relax_block_layout;
+ bool skip_block_layout;
};
#endif // LIBSPIRV_SPIRV_VALIDATOR_OPTIONS_H_
diff --git a/source/val/validate_decorations.cpp b/source/val/validate_decorations.cpp
index 29e8f742..40ce5bb5 100644
--- a/source/val/validate_decorations.cpp
+++ b/source/val/validate_decorations.cpp
@@ -331,6 +331,8 @@ spv_result_t checkLayout(uint32_t struct_id, const char* storage_class_str,
const char* decoration_str, bool blockRules,
MemberConstraints& constraints,
ValidationState_t& vstate) {
+ if (vstate.options()->skip_block_layout) return SPV_SUCCESS;
+
auto fail = [&vstate, struct_id, storage_class_str, decoration_str,
blockRules](uint32_t member_idx) -> DiagnosticStream {
DiagnosticStream ds =
@@ -342,6 +344,7 @@ spv_result_t checkLayout(uint32_t struct_id, const char* storage_class_str,
<< " layout rules: member " << member_idx << " ");
return ds;
};
+
const bool relaxed_block_layout = vstate.IsRelaxedBlockLayout();
const auto& members = getStructMembers(struct_id, vstate);