aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorasuonpaa <34128694+asuonpaa@users.noreply.github.com>2021-01-11 11:53:53 +0200
committerGitHub <noreply@github.com>2021-01-11 09:53:53 +0000
commite2ccba04930477fbc0dcde9b080facc033071751 (patch)
tree33039a677f75accd6b6c32a1a3a8a0b96c84b05a
parentf8a6fdbe4dc9890fa967091f43b5f7669962c403 (diff)
downloadamber-e2ccba04930477fbc0dcde9b080facc033071751.tar.gz
Expose target environment to shader info (#935)
This change exposes shader target environment parsed from Amber Script into shader info structure. This allows Vulkan CTS to compile GLSL into SPIR-V using the specified SPIR-V version.
-rw-r--r--include/amber/shader_info.h2
-rw-r--r--src/script.cc10
2 files changed, 8 insertions, 4 deletions
diff --git a/include/amber/shader_info.h b/include/amber/shader_info.h
index 03e0c81..6c9126a 100644
--- a/include/amber/shader_info.h
+++ b/include/amber/shader_info.h
@@ -54,6 +54,8 @@ struct ShaderInfo {
std::string shader_source;
/// A list of SPIR-V optimization passes to execute on the shader.
std::vector<std::string> optimizations;
+ /// Target environment for the shader compilation.
+ std::string target_env;
/// The shader SPIR-V if it was compiled by Amber
std::vector<uint32_t> shader_data;
};
diff --git a/src/script.cc b/src/script.cc
index 5193aab..7d7483f 100644
--- a/src/script.cc
+++ b/src/script.cc
@@ -32,10 +32,11 @@ std::vector<ShaderInfo> Script::GetShaderInfo() const {
for (const auto& pipeline : pipelines_) {
auto shader_info = pipeline->GetShader(shader.get());
if (shader_info) {
- ret.emplace_back(ShaderInfo{
- shader->GetFormat(), shader->GetType(),
- pipeline->GetName() + "-" + shader->GetName(), shader->GetData(),
- shader_info->GetShaderOptimizations(), shader_info->GetData()});
+ ret.emplace_back(
+ ShaderInfo{shader->GetFormat(), shader->GetType(),
+ pipeline->GetName() + "-" + shader->GetName(),
+ shader->GetData(), shader_info->GetShaderOptimizations(),
+ shader->GetTargetEnv(), shader_info->GetData()});
in_pipeline = true;
}
@@ -47,6 +48,7 @@ std::vector<ShaderInfo> Script::GetShaderInfo() const {
shader->GetName(),
shader->GetData(),
{},
+ shader->GetTargetEnv(),
{}});
}
}