mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-10 11:41:59 +02:00
avoid using explicit dialects when we want just a default one
This commit is contained in:
parent
9a1e1a001a
commit
224e9590ec
3 changed files with 21 additions and 1 deletions
|
@ -64,6 +64,25 @@ Shader::Reflection Shader::getReflection(shader::Dialect dialect, shader::Varian
|
|||
return _source.getReflection(dialect, variant);
|
||||
}
|
||||
|
||||
|
||||
Shader::Reflection Shader::getReflection() const {
|
||||
|
||||
// FOr sake of convenience i would like to be able to use a "default" dialect that represents the reflection
|
||||
// of the source of the shader
|
||||
// What i really want, is a reflection that is designed for the gpu lib interface but we don;t have that yet (glsl45 is the closest to that)
|
||||
// Until we have an implementation for this, we will return such default reflection from the one available and platform specific
|
||||
|
||||
#if defined(USE_GLES)
|
||||
auto defaultDialect = shader::Dialect::glsl310es;
|
||||
#elif defined(Q_OS_MAC)
|
||||
// Mac only supports 4.1
|
||||
auto defaultDialect = shader::Dialect::glsl410;
|
||||
#else
|
||||
auto defaultDialect = shader::Dialect::glsl450;
|
||||
#endif
|
||||
return getReflection(defaultDialect, shader::Variant::Mono);
|
||||
}
|
||||
|
||||
Shader::~Shader()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -92,6 +92,7 @@ public:
|
|||
const Shaders& getShaders() const { return _shaders; }
|
||||
|
||||
Reflection getReflection(shader::Dialect dialect, shader::Variant variant) const;
|
||||
Reflection getReflection() const; // get the default version of the reflection
|
||||
|
||||
// Compilation Handler can be passed while compiling a shader (in the makeProgram call) to be able to give the hand to
|
||||
// the caller thread if the compilation fails and to provide a different version of the source for it
|
||||
|
|
|
@ -86,7 +86,7 @@ void ShapePlumber::addPipeline(const Key& key, const gpu::ShaderPointer& program
|
|||
void ShapePlumber::addPipeline(const Filter& filter, const gpu::ShaderPointer& program, const gpu::StatePointer& state,
|
||||
BatchSetter batchSetter, ItemSetter itemSetter) {
|
||||
ShapeKey key{ filter._flags };
|
||||
auto reflection = program->getReflection(shader::Dialect::glsl450, shader::Variant::Mono);
|
||||
auto reflection = program->getReflection();
|
||||
auto locations = std::make_shared<Locations>();
|
||||
locations->albedoTextureUnit = reflection.validTexture(graphics::slot::texture::MaterialAlbedo);
|
||||
locations->roughnessTextureUnit = reflection.validTexture(graphics::slot::texture::MaterialRoughness);
|
||||
|
|
Loading…
Reference in a new issue