Wrap azdo check into a function call
This commit is contained in:
parent
d8e6ebbb0e
commit
d84d103b03
@ -46,17 +46,6 @@ debugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei le
|
||||
return;
|
||||
}
|
||||
|
||||
// Suppress warnings about GL_ARB_bindless_texture not being supported
|
||||
// when we're not even using it
|
||||
if (UserConfigParams::m_azdo == false &&
|
||||
source == GL_DEBUG_SOURCE_SHADER_COMPILER_ARB && msg != NULL &&
|
||||
std::string(msg).find("GL_ARB_bindless_texture") != std::string::npos)
|
||||
{
|
||||
Log::debug("GLWrap", "Suppressed warning: %s", msg);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
switch(source)
|
||||
{
|
||||
case GL_DEBUG_SOURCE_API_ARB:
|
||||
|
@ -534,6 +534,7 @@ void IrrDriver::initDevice()
|
||||
hasComputeShaders = false;
|
||||
hasTextureStorage = false;
|
||||
hasTextureView = false;
|
||||
hasBindlessTexture = false;
|
||||
// Default false value for hasVSLayer if --no-graphics argument is used
|
||||
#if !defined(__APPLE__)
|
||||
if (!ProfileWorld::isNoGraphics())
|
||||
@ -566,6 +567,10 @@ void IrrDriver::initDevice()
|
||||
hasTextureView = true;
|
||||
Log::info("GLDriver", "ARB Texture View enabled");
|
||||
}
|
||||
if (hasGLExtension("GL_ARB_bindless_texture")) {
|
||||
hasBindlessTexture = true;
|
||||
Log::info("GLDriver", "ARB Bindless Texture enabled");
|
||||
}
|
||||
m_support_sdsm = m_support_sdsm && hasComputeShaders && hasBuffserStorage;
|
||||
|
||||
std::string driver((char*)(glGetString(GL_VERSION)));
|
||||
|
@ -191,6 +191,7 @@ private:
|
||||
bool hasComputeShaders;
|
||||
bool hasTextureStorage;
|
||||
bool hasTextureView;
|
||||
bool hasBindlessTexture;
|
||||
bool m_support_sdsm;
|
||||
bool m_support_texture_compression;
|
||||
bool m_need_ubo_workaround;
|
||||
@ -297,6 +298,11 @@ public:
|
||||
return UserConfigParams::m_texture_compression && m_support_texture_compression;
|
||||
}
|
||||
|
||||
bool useAZDO() const
|
||||
{
|
||||
return hasBindlessTexture && UserConfigParams::m_azdo;
|
||||
}
|
||||
|
||||
bool needUBOWorkaround() const
|
||||
{
|
||||
return m_need_ubo_workaround;
|
||||
@ -347,6 +353,11 @@ public:
|
||||
return hasTextureView;
|
||||
}
|
||||
|
||||
bool hasARBBindlessTexture() const
|
||||
{
|
||||
return hasBindlessTexture;
|
||||
}
|
||||
|
||||
video::SColorf getAmbientLight() const;
|
||||
|
||||
struct GlowData {
|
||||
|
@ -1031,7 +1031,7 @@ void IrrDriver::renderGlow(std::vector<GlowData>& glows)
|
||||
glUseProgram(MeshShader::InstancedColorizeShader::getInstance()->Program);
|
||||
|
||||
glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(video::EVT_STANDARD, InstanceTypeGlow));
|
||||
if (UserConfigParams::m_azdo)
|
||||
if (irr_driver->useAZDO())
|
||||
{
|
||||
if (GlowPassCmd::getInstance()->Size)
|
||||
{
|
||||
|
@ -427,7 +427,7 @@ void renderMeshes1stPass()
|
||||
continue;
|
||||
}
|
||||
|
||||
if (UserConfigParams::m_azdo)
|
||||
if (irr_driver->useAZDO())
|
||||
HandleExpander<typename T::FirstPassShader>::template Expand(mesh.TextureHandles, T::FirstPassTextures);
|
||||
else
|
||||
TexExpander<typename T::FirstPassShader>::template ExpandTex(mesh, T::FirstPassTextures);
|
||||
@ -500,7 +500,7 @@ void IrrDriver::renderSolidFirstPass()
|
||||
renderMeshes1stPass<SphereMap, 2, 1>();
|
||||
renderMeshes1stPass<DetailMat, 2, 1>();
|
||||
|
||||
if (UserConfigParams::m_azdo)
|
||||
if (irr_driver->useAZDO())
|
||||
{
|
||||
multidraw1stPass<DefaultMaterial>();
|
||||
multidraw1stPass<AlphaRef>();
|
||||
@ -546,7 +546,7 @@ void renderMeshes2ndPass( const std::vector<uint64_t> &Prefilled_Handle,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (UserConfigParams::m_azdo)
|
||||
if (irr_driver->useAZDO())
|
||||
HandleExpander<typename T::SecondPassShader>::template Expand(mesh.TextureHandles, T::SecondPassTextures, Prefilled_Handle[0], Prefilled_Handle[1], Prefilled_Handle[2]);
|
||||
else
|
||||
TexExpander<typename T::SecondPassShader>::template ExpandTex(mesh, T::SecondPassTextures, Prefilled_Tex[0], Prefilled_Tex[1], Prefilled_Tex[2]);
|
||||
@ -595,7 +595,7 @@ void IrrDriver::renderSolidSecondPass()
|
||||
|
||||
uint64_t DiffuseHandle = 0, SpecularHandle = 0, SSAOHandle = 0, DepthHandle = 0;
|
||||
|
||||
if (UserConfigParams::m_azdo)
|
||||
if (irr_driver->useAZDO())
|
||||
{
|
||||
DiffuseHandle = glGetTextureSamplerHandleARB(m_rtts->getRenderTarget(RTT_DIFFUSE), MeshShader::ObjectPass2Shader::getInstance()->SamplersId[0]);
|
||||
if (!glIsTextureHandleResidentARB(DiffuseHandle))
|
||||
@ -633,7 +633,7 @@ void IrrDriver::renderSolidSecondPass()
|
||||
renderMeshes2ndPass<GrassMat, 3, 1>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle), DiffSpecSSAOTex);
|
||||
renderMeshes2ndPass<NormalMat, 3, 1>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle), DiffSpecSSAOTex);
|
||||
|
||||
if (UserConfigParams::m_azdo)
|
||||
if (irr_driver->useAZDO())
|
||||
{
|
||||
multidraw2ndPass<DefaultMaterial>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, 0, 0));
|
||||
multidraw2ndPass<AlphaRef>(createVector<uint64_t>(DiffuseHandle, SpecularHandle, SSAOHandle, 0, 0));
|
||||
@ -714,7 +714,7 @@ static void renderMultiMeshNormals()
|
||||
|
||||
void IrrDriver::renderNormalsVisualisation()
|
||||
{
|
||||
if (UserConfigParams::m_azdo) {
|
||||
if (irr_driver->useAZDO()) {
|
||||
renderMultiMeshNormals<DefaultMaterial>();
|
||||
renderMultiMeshNormals<AlphaRef>();
|
||||
renderMultiMeshNormals<UnlitMat>();
|
||||
@ -752,7 +752,7 @@ void renderTransparenPass(const std::vector<TexUnit> &TexUnits, std::vector<STK:
|
||||
continue;
|
||||
}
|
||||
|
||||
if (UserConfigParams::m_azdo)
|
||||
if (irr_driver->useAZDO())
|
||||
Shader::getInstance()->SetTextureHandles(mesh.TextureHandles[0]);
|
||||
else
|
||||
Shader::getInstance()->SetTextureUnits(getTextureGLuint(mesh.textures[0]));
|
||||
@ -932,7 +932,7 @@ void renderShadow(unsigned cascade)
|
||||
GLMesh *mesh = STK::tuple_get<0>(t.at(i));
|
||||
if (!irr_driver->hasARB_base_instance())
|
||||
glBindVertexArray(mesh->vao);
|
||||
if (UserConfigParams::m_azdo)
|
||||
if (irr_driver->useAZDO())
|
||||
HandleExpander<typename T::ShadowPassShader>::template Expand(mesh->TextureHandles, T::ShadowTextures);
|
||||
else
|
||||
TexExpander<typename T::ShadowPassShader>::template ExpandTex(*mesh, T::ShadowTextures);
|
||||
@ -1004,7 +1004,7 @@ void IrrDriver::renderShadows()
|
||||
if (irr_driver->hasARB_draw_indirect())
|
||||
glBindBuffer(GL_DRAW_INDIRECT_BUFFER, ShadowPassCmd::getInstance()->drawindirectcmd);
|
||||
|
||||
if (UserConfigParams::m_azdo)
|
||||
if (irr_driver->useAZDO())
|
||||
{
|
||||
multidrawShadow<DefaultMaterial>(cascade);
|
||||
multidrawShadow<DetailMat>(cascade);
|
||||
@ -1081,7 +1081,7 @@ void drawRSM(const core::matrix4 & rsm_matrix)
|
||||
GLMesh *mesh = STK::tuple_get<0>(t.at(i));
|
||||
if (!irr_driver->hasARB_base_instance())
|
||||
glBindVertexArray(mesh->vao);
|
||||
if (UserConfigParams::m_azdo)
|
||||
if (irr_driver->useAZDO())
|
||||
HandleExpander<typename T::RSMShader>::template Expand(mesh->TextureHandles, T::RSMTextures);
|
||||
else
|
||||
TexExpander<typename T::RSMShader>::template ExpandTex(*mesh, T::RSMTextures);
|
||||
@ -1138,7 +1138,7 @@ void IrrDriver::renderRSM()
|
||||
if (irr_driver->hasARB_draw_indirect())
|
||||
glBindBuffer(GL_DRAW_INDIRECT_BUFFER, RSMPassCmd::getInstance()->drawindirectcmd);
|
||||
|
||||
if (UserConfigParams::m_azdo)
|
||||
if (irr_driver->useAZDO())
|
||||
{
|
||||
multidrawRSM<DefaultMaterial>(rsm_matrix);
|
||||
multidrawRSM<NormalMat>(rsm_matrix);
|
||||
|
@ -147,9 +147,9 @@ GLuint LoadShader(const char * file, unsigned type)
|
||||
char versionString[20];
|
||||
sprintf(versionString, "#version %d\n", irr_driver->getGLSLVersion());
|
||||
std::string Code = versionString;
|
||||
if (UserConfigParams::m_azdo)
|
||||
if (irr_driver->useAZDO())
|
||||
Code += "#extension GL_ARB_bindless_texture : enable\n";
|
||||
else
|
||||
else if (irr_driver->hasARBBindlessTexture())
|
||||
{
|
||||
Code += "#extension GL_ARB_bindless_texture : disable\n";
|
||||
Code += "#undef GL_ARB_bindless_texture\n";
|
||||
|
@ -286,7 +286,7 @@ SetTexture(GLMesh &mesh, unsigned i, bool isSrgb, const std::string &matname)
|
||||
return;
|
||||
}
|
||||
compressTexture(mesh.textures[i], isSrgb);
|
||||
if (UserConfigParams::m_azdo)
|
||||
if (irr_driver->useAZDO())
|
||||
{
|
||||
if (!mesh.TextureHandles[i])
|
||||
mesh.TextureHandles[i] = glGetTextureSamplerHandleARB(getTextureGLuint(mesh.textures[i]), MeshShader::ObjectPass1Shader::getInstance()->SamplersId[0]);
|
||||
@ -359,7 +359,7 @@ void InitTexturesTransparent(GLMesh &mesh)
|
||||
return;
|
||||
}
|
||||
compressTexture(mesh.textures[0], true);
|
||||
if (UserConfigParams::m_azdo)
|
||||
if (irr_driver->useAZDO())
|
||||
{
|
||||
if (!mesh.TextureHandles[0])
|
||||
mesh.TextureHandles[0] = glGetTextureSamplerHandleARB(getTextureGLuint(mesh.textures[0]), MeshShader::ObjectPass1Shader::getInstance()->SamplersId[0]);
|
||||
|
@ -269,7 +269,7 @@ void STKMeshSceneNode::render()
|
||||
size_t count = mesh.IndexCount;
|
||||
|
||||
compressTexture(mesh.textures[0], true);
|
||||
if (UserConfigParams::m_azdo)
|
||||
if (irr_driver->useAZDO())
|
||||
{
|
||||
if (!mesh.TextureHandles[0])
|
||||
mesh.TextureHandles[0] = glGetTextureSamplerHandleARB(getTextureGLuint(mesh.textures[0]), MeshShader::ObjectPass1Shader::getInstance()->SamplersId[0]);
|
||||
@ -307,7 +307,7 @@ void STKMeshSceneNode::render()
|
||||
GLenum itype = mesh.IndexType;
|
||||
size_t count = mesh.IndexCount;
|
||||
|
||||
if (UserConfigParams::m_azdo)
|
||||
if (irr_driver->useAZDO())
|
||||
{
|
||||
GLuint64 DiffuseHandle = glGetTextureSamplerHandleARB(irr_driver->getRenderTargetTexture(RTT_DIFFUSE), MeshShader::ObjectPass2Shader::getInstance()->SamplersId[0]);
|
||||
if (!glIsTextureHandleResidentARB(DiffuseHandle))
|
||||
@ -403,7 +403,7 @@ void STKMeshSceneNode::render()
|
||||
tmpcol.getBlue() / 255.0f);
|
||||
|
||||
compressTexture(mesh.textures[0], true);
|
||||
if (UserConfigParams::m_azdo)
|
||||
if (irr_driver->useAZDO())
|
||||
{
|
||||
if (!mesh.TextureHandles[0])
|
||||
mesh.TextureHandles[0] = glGetTextureSamplerHandleARB(getTextureGLuint(mesh.textures[0]), MeshShader::TransparentFogShader::getInstance()->SamplersId[0]);
|
||||
@ -433,7 +433,7 @@ void STKMeshSceneNode::render()
|
||||
size_t count = mesh.IndexCount;
|
||||
|
||||
compressTexture(mesh.textures[0], true);
|
||||
if (UserConfigParams::m_azdo)
|
||||
if (irr_driver->useAZDO())
|
||||
{
|
||||
if (!mesh.TextureHandles[0])
|
||||
mesh.TextureHandles[0] = glGetTextureSamplerHandleARB(getTextureGLuint(mesh.textures[0]), MeshShader::TransparentShader::getInstance()->SamplersId[0]);
|
||||
|
@ -143,7 +143,7 @@ void FillInstances(const std::unordered_map<scene::IMeshBuffer *, std::vector<st
|
||||
for (; It != E; ++It)
|
||||
{
|
||||
FillInstances_impl<T>(It->second, InstanceBuffer, CommandBuffer, InstanceBufferOffset, CommandBufferOffset, Polycount);
|
||||
if (!UserConfigParams::m_azdo)
|
||||
if (!irr_driver->useAZDO())
|
||||
InstancedList.push_back(It->second.front().first);
|
||||
}
|
||||
}
|
||||
@ -527,7 +527,7 @@ GenDrawCalls(unsigned cascade, std::vector<GLMesh *> &InstancedList,
|
||||
if (irr_driver->hasARB_draw_indirect())
|
||||
ShadowPassCmd::getInstance()->Offset[cascade][Mat] = CommandBufferOffset; // Store command buffer offset
|
||||
FillInstances<T>(MeshForShadowPass[Mat][cascade], InstancedList, InstanceBuffer, CommandBuffer, InstanceBufferOffset, CommandBufferOffset, PolyCount);
|
||||
if (UserConfigParams::m_azdo)
|
||||
if (irr_driver->useAZDO())
|
||||
ShadowPassCmd::getInstance()->Size[cascade][Mat] = CommandBufferOffset - ShadowPassCmd::getInstance()->Offset[cascade][Mat];
|
||||
}
|
||||
|
||||
@ -734,11 +734,11 @@ PROFILER_POP_CPU_MARKER();
|
||||
{
|
||||
size_t Polycnt = 0;
|
||||
FillInstances_impl<GlowInstanceData>(It->second, GlowInstanceBuffer, GlowCmdBuffer, offset, current_cmd, Polycnt);
|
||||
if (!UserConfigParams::m_azdo)
|
||||
if (!irr_driver->useAZDO())
|
||||
ListInstancedGlow::getInstance()->push_back(It->second.front().first);
|
||||
}
|
||||
|
||||
if (UserConfigParams::m_azdo)
|
||||
if (irr_driver->useAZDO())
|
||||
GlowPassCmd::getInstance()->Size = current_cmd - GlowPassCmd::getInstance()->Offset;
|
||||
|
||||
if (!irr_driver->hasBufferStorageExtension())
|
||||
|
Loading…
Reference in New Issue
Block a user