Implement lod bias for user materials
A lod bias can be applied to textures when dynamic resolution is enabled. A proper lod bias is calculated and applied for quality levels HIGH and ULTRA. Lod Bias is implemented in glslang, which mean it's ignored when glslang is not used, which currently happens with OpenGL backends with optimization turned off (which includes filament LITE). This may be fixed in the future.
This commit is contained in:
committed by
Mathias Agopian
parent
1a8550e8e0
commit
ceeccde92c
@@ -30,6 +30,7 @@
|
||||
#include "sca/GLSLTools.h"
|
||||
|
||||
#include <utils/Log.h>
|
||||
#include <filament/MaterialEnums.h>
|
||||
|
||||
using namespace glslang;
|
||||
using namespace spirv_cross;
|
||||
@@ -203,6 +204,12 @@ bool GLSLPostProcessor::process(const std::string& inputShader, Config const& co
|
||||
return false;
|
||||
}
|
||||
|
||||
// add texture lod bias
|
||||
if (config.shaderType == filament::backend::FRAGMENT &&
|
||||
config.domain == filament::MaterialDomain::SURFACE) {
|
||||
GLSLTools::textureLodBias(tShader);
|
||||
}
|
||||
|
||||
program.addShader(&tShader);
|
||||
// Even though we only have a single shader stage, linking is still necessary to finalize
|
||||
// SPIR-V types
|
||||
|
||||
Reference in New Issue
Block a user