Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/KhronosGroup/SPIRV-Tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Fischer <greg@lunarg.com>2021-03-31 21:26:36 +0300
committerGitHub <noreply@github.com>2021-03-31 21:26:36 +0300
commit48007a5c7f7cc671b391bebd46e87fd6edc6c24b (patch)
treedce07739301240a0142f6d28a392fb67eb233536 /include
parent61e256c9c44b023a5296c8641fa482e23d1d70a5 (diff)
Add interpolate legalization pass (#4220)
This pass converts an internal form of GLSLstd450 Interpolate ops to the externally valid form. The external form takes the lvalue of the interpolant. The internal form can do a load of the interpolant. The pass replaces the load with its pointer. The internal form is generated by glslang and possibly other frontends for HLSL shaders. The new pass is called as part of HLSL legalization after all propagation is complete. Also adds internal interpolate form to pre-legalization validation
Diffstat (limited to 'include')
-rw-r--r--include/spirv-tools/libspirv.h2
-rw-r--r--include/spirv-tools/libspirv.hpp2
-rw-r--r--include/spirv-tools/optimizer.hpp9
3 files changed, 13 insertions, 0 deletions
diff --git a/include/spirv-tools/libspirv.h b/include/spirv-tools/libspirv.h
index 2891cbe8f..8b30dcba2 100644
--- a/include/spirv-tools/libspirv.h
+++ b/include/spirv-tools/libspirv.h
@@ -588,6 +588,8 @@ SPIRV_TOOLS_EXPORT void spvValidatorOptionsSetRelaxLogicalPointer(
// 3) Pointers that are actaul parameters on function calls do not have to point
// to the same type pointed as the formal parameter. The types just need to
// logically match.
+// 4) GLSLstd450 Interpolate* instructions can have a load of an interpolant
+// for a first argument.
SPIRV_TOOLS_EXPORT void spvValidatorOptionsSetBeforeHlslLegalization(
spv_validator_options options, bool val);
diff --git a/include/spirv-tools/libspirv.hpp b/include/spirv-tools/libspirv.hpp
index e7e7fc7aa..0c31a1827 100644
--- a/include/spirv-tools/libspirv.hpp
+++ b/include/spirv-tools/libspirv.hpp
@@ -136,6 +136,8 @@ class ValidatorOptions {
// 3) Pointers that are actaul parameters on function calls do not have to
// point to the same type pointed as the formal parameter. The types just
// need to logically match.
+ // 4) GLSLstd450 Interpolate* instructions can have a load of an interpolant
+ // for a first argument.
void SetBeforeHlslLegalization(bool val) {
spvValidatorOptionsSetBeforeHlslLegalization(options_, val);
}
diff --git a/include/spirv-tools/optimizer.hpp b/include/spirv-tools/optimizer.hpp
index 1683d077f..e8b5b6982 100644
--- a/include/spirv-tools/optimizer.hpp
+++ b/include/spirv-tools/optimizer.hpp
@@ -838,6 +838,15 @@ Optimizer::PassToken CreateWrapOpKillPass();
// capabilities.
Optimizer::PassToken CreateAmdExtToKhrPass();
+// Replaces the internal version of GLSLstd450 InterpolateAt* extended
+// instructions with the externally valid version. The internal version allows
+// an OpLoad of the interpolant for the first argument. This pass removes the
+// OpLoad and replaces it with its pointer. glslang and possibly other
+// frontends will create the internal version for HLSL. This pass will be part
+// of HLSL legalization and should be called after interpolants have been
+// propagated into their final positions.
+Optimizer::PassToken CreateInterpolateFixupPass();
+
} // namespace spvtools
#endif // INCLUDE_SPIRV_TOOLS_OPTIMIZER_HPP_