Deprecate the sampler map (#453)
Contributes to #451
* Add a warning when a sampler map is provided (for both online and
offline compiles)
* the sampler is still supported and works as before if it is provided
* Without a sampler map clspv now auto-generates bindings for literal
samplers based on the sampler literal
* updated sampler map tests to also test without a sampler map
* new test to verify consistency with the descriptor map
diff --git a/lib/Compiler.cpp b/lib/Compiler.cpp
index 1ce2fba..82b39ce 100644
--- a/lib/Compiler.cpp
+++ b/lib/Compiler.cpp
@@ -148,7 +148,7 @@
llvm::cl::value_desc("format"));
static llvm::cl::opt<std::string>
- SamplerMap("samplermap", llvm::cl::desc("Literal sampler map"),
+ SamplerMap("samplermap", llvm::cl::desc("DEPRECATED - Literal sampler map"),
llvm::cl::value_desc("filename"));
static llvm::cl::opt<bool> cluster_non_pointer_kernel_args(
@@ -185,6 +185,7 @@
// Parse the sampler map from the provided string.
samplerMapBuffer = llvm::MemoryBuffer::getMemBuffer(sampler_map);
+ clspv::Option::SetUseSamplerMap(true);
if (!SamplerMap.empty()) {
llvm::outs() << "Warning: -samplermap is ignored when the sampler map is "
"provided through a string.\n";
@@ -201,6 +202,7 @@
return -1;
}
+ clspv::Option::SetUseSamplerMap(true);
samplerMapBuffer = std::move(errorOrSamplerMapFile.get());
if (0 == samplerMapBuffer->getBufferSize()) {
llvm::errs() << "Error: Sampler map was an empty file!\n";
@@ -208,6 +210,11 @@
}
}
+ if (clspv::Option::UseSamplerMap()) {
+ llvm::outs()
+ << "Warning: use of the sampler map is deprecated and unnecessary\n";
+ }
+
// No sampler map to parse.
if (!samplerMapBuffer || 0 == samplerMapBuffer->getBufferSize())
return 0;