More macros to disable extra gl calls
This commit is contained in:
@@ -41,7 +41,10 @@ extern "C" {
|
||||
# define GL_TEXTURE_SWIZZLE_RGBA 0x8E46
|
||||
# endif
|
||||
#elif defined(ANDROID_DEVICE)
|
||||
# include <GLES/gl.h>
|
||||
# include <GLES3/gl3.h>
|
||||
# include <GLES3/gl31.h>
|
||||
# include <GLES3/gl3ext.h>
|
||||
# define glVertexAttribDivisorARB glVertexAttribDivisor
|
||||
#elif defined(WIN32)
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
|
||||
@@ -177,12 +177,14 @@ void initGL()
|
||||
return;
|
||||
is_gl_init = true;
|
||||
// For Mesa extension reporting
|
||||
#ifndef ANDROID_DEVICE
|
||||
#ifndef WIN32
|
||||
glewExperimental = GL_TRUE;
|
||||
#endif
|
||||
GLenum err = glewInit();
|
||||
if (GLEW_OK != err)
|
||||
Log::fatal("GLEW", "Glew initialisation failed with error %s", glewGetErrorString(err));
|
||||
#endif
|
||||
#ifdef ARB_DEBUG_OUTPUT
|
||||
if (glDebugMessageCallbackARB)
|
||||
glDebugMessageCallbackARB((GLDEBUGPROCARB)debugCallback, NULL);
|
||||
|
||||
@@ -1055,6 +1055,7 @@ void PostProcessing::renderRHDebug(unsigned SHR, unsigned SHG, unsigned SHB,
|
||||
const core::matrix4 &rh_matrix,
|
||||
const core::vector3df &rh_extend)
|
||||
{
|
||||
#ifndef ANDROID
|
||||
glEnable(GL_PROGRAM_POINT_SIZE);
|
||||
RHDebug::getInstance()->use();
|
||||
glActiveTexture(GL_TEXTURE0 + RHDebug::getInstance()->m_tu_shr);
|
||||
@@ -1066,6 +1067,7 @@ void PostProcessing::renderRHDebug(unsigned SHR, unsigned SHG, unsigned SHB,
|
||||
RHDebug::getInstance()->setUniforms(rh_matrix, rh_extend);
|
||||
glDrawArrays(GL_POINTS, 0, 32 * 16 * 32);
|
||||
glDisable(GL_PROGRAM_POINT_SIZE);
|
||||
#endif
|
||||
} // renderRHDebug
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -1134,8 +1136,10 @@ void PostProcessing::renderGaussian6BlurLayer(FrameBuffer &in_fbo,
|
||||
{
|
||||
GLuint layer_tex;
|
||||
glGenTextures(1, &layer_tex);
|
||||
#ifndef ANDROID_DEVICE
|
||||
glTextureView(layer_tex, GL_TEXTURE_2D, in_fbo.getRTT()[0],
|
||||
GL_R32F, 0, 1, layer, 1);
|
||||
#endif
|
||||
if (!CVS->supportsComputeShadersFiltering())
|
||||
{
|
||||
// Used as temp
|
||||
@@ -1657,6 +1661,7 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode,
|
||||
if (!CVS->isARBUniformBufferObjectUsable())
|
||||
return in_fbo;
|
||||
|
||||
#ifndef ANDROID
|
||||
glEnable(GL_FRAMEBUFFER_SRGB);
|
||||
irr_driver->getFBO(FBO_MLAA_COLORS).bind();
|
||||
renderPassThrough(in_fbo->getRTT()[0],
|
||||
@@ -1672,6 +1677,7 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode,
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
}
|
||||
glDisable(GL_FRAMEBUFFER_SRGB);
|
||||
#endif
|
||||
|
||||
return out_fbo;
|
||||
} // render
|
||||
|
||||
@@ -1948,7 +1948,7 @@ void renderRSMShadow(Args ...args)
|
||||
template<typename T, typename... Args>
|
||||
void multidrawRSM(Args...args)
|
||||
{
|
||||
#ifndef ANDROIDD
|
||||
#ifndef ANDROID
|
||||
T::InstancedRSMShader::getInstance()->use();
|
||||
glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(T::VertexType,
|
||||
InstanceTypeRSM));
|
||||
|
||||
@@ -54,7 +54,9 @@ public:
|
||||
GLuint block_idx =
|
||||
glGetProgramResourceIndex(m_program, GL_SHADER_STORAGE_BLOCK,
|
||||
"BoundingBoxes");
|
||||
#ifndef ANDROID
|
||||
glShaderStorageBlockBinding(m_program, block_idx, 2);
|
||||
#endif
|
||||
} // LightspaceBoundingBoxShader
|
||||
}; // LightspaceBoundingBoxShader
|
||||
|
||||
@@ -70,11 +72,13 @@ public:
|
||||
GLuint block_idx =
|
||||
glGetProgramResourceIndex(m_program,
|
||||
GL_SHADER_STORAGE_BLOCK, "BoundingBoxes");
|
||||
#ifndef ANDROID
|
||||
glShaderStorageBlockBinding(m_program, block_idx, 2);
|
||||
block_idx =
|
||||
glGetProgramResourceIndex(m_program, GL_SHADER_STORAGE_BLOCK,
|
||||
"NewMatrixData");
|
||||
glShaderStorageBlockBinding(m_program, block_idx, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -185,6 +185,7 @@ void Skybox::generateCubeMapFromTextures()
|
||||
}
|
||||
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP, m_cube_map);
|
||||
#ifndef ANDROID
|
||||
if (CVS->isTextureCompressionEnabled())
|
||||
{
|
||||
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0,
|
||||
@@ -197,6 +198,7 @@ void Skybox::generateCubeMapFromTextures()
|
||||
GL_SRGB_ALPHA, size, size, 0, GL_BGRA,
|
||||
GL_UNSIGNED_BYTE, (GLvoid*)rgba[i]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
|
||||
for (unsigned i = 0; i < 6; i++)
|
||||
@@ -207,6 +209,7 @@ void Skybox::generateCubeMapFromTextures()
|
||||
// ----------------------------------------------------------------------------
|
||||
void Skybox::generateSpecularCubemap()
|
||||
{
|
||||
#ifndef ANDROID
|
||||
glGenTextures(1, &m_specular_probe);
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP, m_specular_probe);
|
||||
size_t cubemap_size = 256;
|
||||
@@ -299,6 +302,7 @@ void Skybox::generateSpecularCubemap()
|
||||
}
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
glDeleteFramebuffers(1, &fbo);
|
||||
#endif
|
||||
} // generateSpecularCubemap
|
||||
|
||||
|
||||
@@ -317,7 +321,9 @@ Skybox::Skybox(const std::vector<video::ITexture *> &skybox_textures)
|
||||
{
|
||||
m_skybox_textures = skybox_textures;
|
||||
|
||||
#ifndef ANDROID
|
||||
glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
|
||||
#endif
|
||||
|
||||
if (!skybox_textures.empty())
|
||||
{
|
||||
|
||||
@@ -344,6 +344,7 @@ static void setTexture(GLMesh &mesh, unsigned i, bool is_srgb,
|
||||
getUnicolorTexture(video::SColor(255, 127, 127, 127));
|
||||
}
|
||||
compressTexture(mesh.textures[i], is_srgb);
|
||||
#ifndef ANDROID
|
||||
if (CVS->isAZDOEnabled())
|
||||
{
|
||||
if (!mesh.TextureHandles[i])
|
||||
@@ -355,6 +356,7 @@ static void setTexture(GLMesh &mesh, unsigned i, bool is_srgb,
|
||||
if (!glIsTextureHandleResidentARB(mesh.TextureHandles[i]))
|
||||
glMakeTextureHandleResidentARB(mesh.TextureHandles[i]);
|
||||
}
|
||||
#endif
|
||||
} // setTexture
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -423,6 +425,7 @@ void initTexturesTransparent(GLMesh &mesh)
|
||||
return;
|
||||
}
|
||||
compressTexture(mesh.textures[0], true);
|
||||
#ifndef ANDROID
|
||||
if (CVS->isAZDOEnabled())
|
||||
{
|
||||
if (!mesh.TextureHandles[0])
|
||||
@@ -434,4 +437,5 @@ void initTexturesTransparent(GLMesh &mesh)
|
||||
if (!glIsTextureHandleResidentARB(mesh.TextureHandles[0]))
|
||||
glMakeTextureHandleResidentARB(mesh.TextureHandles[0]);
|
||||
}
|
||||
#endif
|
||||
} // initTexturesTransparent
|
||||
|
||||
@@ -127,7 +127,9 @@ void STKMeshSceneNode::drawGlow(const GLMesh &mesh)
|
||||
GLenum itype = mesh.IndexType;
|
||||
size_t count = mesh.IndexCount;
|
||||
ColorizeShader::getInstance()->setUniforms(AbsoluteTransformation, video::SColorf(glowcolor.getRed() / 255.f, glowcolor.getGreen() / 255.f, glowcolor.getBlue() / 255.f));
|
||||
#ifndef ANDROID
|
||||
glDrawElementsBaseVertex(ptype, count, itype, (GLvoid *)mesh.vaoOffset, mesh.vaoBaseVertex);
|
||||
#endif
|
||||
}
|
||||
|
||||
void STKMeshSceneNode::updatevbo()
|
||||
@@ -303,6 +305,7 @@ void STKMeshSceneNode::render()
|
||||
size_t count = mesh.IndexCount;
|
||||
|
||||
compressTexture(mesh.textures[0], true);
|
||||
#ifndef ANDROID
|
||||
if (CVS->isAZDOEnabled())
|
||||
{
|
||||
if (!mesh.TextureHandles[0])
|
||||
@@ -317,6 +320,7 @@ void STKMeshSceneNode::render()
|
||||
Shaders::ObjectPass1Shader::getInstance()->setTextureHandles(mesh.TextureHandles[0]);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
Shaders::ObjectPass1Shader::getInstance()->setTextureUnits(getTextureGLuint(mesh.textures[0]));
|
||||
Shaders::ObjectPass1Shader::getInstance()->setUniforms(AbsoluteTransformation, invmodel);
|
||||
assert(mesh.vao);
|
||||
@@ -346,6 +350,7 @@ void STKMeshSceneNode::render()
|
||||
GLenum itype = mesh.IndexType;
|
||||
size_t count = mesh.IndexCount;
|
||||
|
||||
#ifndef ANDROID
|
||||
if (CVS->isAZDOEnabled())
|
||||
{
|
||||
GLuint64 DiffuseHandle =
|
||||
@@ -384,6 +389,7 @@ void STKMeshSceneNode::render()
|
||||
mesh.TextureHandles[0], mesh.TextureHandles[1]);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
Shaders::ObjectPass2Shader::getInstance()->setTextureUnits(
|
||||
irr_driver->getRenderTargetTexture(RTT_DIFFUSE),
|
||||
irr_driver->getRenderTargetTexture(RTT_SPECULAR),
|
||||
@@ -456,6 +462,7 @@ void STKMeshSceneNode::render()
|
||||
tmpcol.getBlue() / 255.0f);
|
||||
|
||||
compressTexture(mesh.textures[0], true);
|
||||
#ifndef ANDROID
|
||||
if (CVS->isAZDOEnabled())
|
||||
{
|
||||
if (!mesh.TextureHandles[0])
|
||||
@@ -468,6 +475,7 @@ void STKMeshSceneNode::render()
|
||||
->setTextureHandles(mesh.TextureHandles[0]);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
Shaders::TransparentFogShader::getInstance()
|
||||
->setTextureUnits(getTextureGLuint(mesh.textures[0]));
|
||||
@@ -494,6 +502,7 @@ void STKMeshSceneNode::render()
|
||||
size_t count = mesh.IndexCount;
|
||||
|
||||
compressTexture(mesh.textures[0], true);
|
||||
#ifndef ANDROID
|
||||
if (CVS->isAZDOEnabled())
|
||||
{
|
||||
if (!mesh.TextureHandles[0])
|
||||
@@ -505,6 +514,7 @@ void STKMeshSceneNode::render()
|
||||
Shaders::TransparentShader::getInstance()->setTextureHandles(mesh.TextureHandles[0]);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
Shaders::TransparentShader::getInstance()->setTextureUnits(getTextureGLuint(mesh.textures[0]));
|
||||
|
||||
Shaders::TransparentShader::getInstance()->setUniforms(AbsoluteTransformation, mesh.TextureMatrix);
|
||||
|
||||
@@ -858,6 +858,8 @@ PROFILER_POP_CPU_MARKER();
|
||||
poly_count[SOLID_NORMAL_AND_DEPTH_PASS] += SolidPoly;
|
||||
poly_count[SHADOW_PASS] += ShadowPoly;
|
||||
|
||||
#ifndef ANDROID
|
||||
if (CVS->supportsAsyncInstanceUpload())
|
||||
glMemoryBarrier(GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -38,7 +38,9 @@ public:
|
||||
CommandBuffer()
|
||||
{
|
||||
glGenBuffers(1, &drawindirectcmd);
|
||||
#ifndef ANDROID_DEVICE
|
||||
glBindBuffer(GL_DRAW_INDIRECT_BUFFER, drawindirectcmd);
|
||||
#endif
|
||||
#ifndef ANDROID
|
||||
if (CVS->supportsAsyncInstanceUpload())
|
||||
{
|
||||
|
||||
@@ -20,7 +20,12 @@
|
||||
#include "graphics/central_settings.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
|
||||
#ifdef ANDROID_DEVICE
|
||||
#include "jni/irrlicht/source/Irrlicht/COGLES2Texture.h"
|
||||
#else
|
||||
#include "../../lib/irrlicht/source/Irrlicht/COpenGLTexture.h"
|
||||
#endif
|
||||
|
||||
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
@@ -28,13 +33,21 @@
|
||||
|
||||
GLuint getTextureGLuint(irr::video::ITexture *tex)
|
||||
{
|
||||
#ifdef ANDROID_DEVICE
|
||||
return static_cast<irr::video::COGLES2Texture*>(tex)->getOpenGLTextureName();
|
||||
#else
|
||||
return static_cast<irr::video::COpenGLTexture*>(tex)->getOpenGLTextureName();
|
||||
#endif
|
||||
}
|
||||
|
||||
GLuint getDepthTexture(irr::video::ITexture *tex)
|
||||
{
|
||||
assert(tex->isRenderTarget());
|
||||
#ifdef ANDROID_DEVICE
|
||||
return 1; //static_cast<irr::video::COGLES2FBODepthTexture*>(tex)->DepthRenderBuffer;
|
||||
#else
|
||||
return static_cast<irr::video::COpenGLFBOTexture*>(tex)->DepthBufferTexture;
|
||||
#endif
|
||||
}
|
||||
|
||||
static std::set<irr::video::ITexture *> AlreadyTransformedTexture;
|
||||
@@ -46,6 +59,11 @@ void resetTextureTable()
|
||||
unicolor_cache.clear();
|
||||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
#define GL_BGRA GL_RGBA
|
||||
#define GL_BGR GL_RGB
|
||||
#endif
|
||||
|
||||
void compressTexture(irr::video::ITexture *tex, bool srgb, bool premul_alpha)
|
||||
{
|
||||
if (AlreadyTransformedTexture.find(tex) != AlreadyTransformedTexture.end())
|
||||
@@ -91,6 +109,7 @@ void compressTexture(irr::video::ITexture *tex, bool srgb, bool premul_alpha)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef ANDROID
|
||||
if (!CVS->isTextureCompressionEnabled())
|
||||
{
|
||||
if (srgb)
|
||||
@@ -105,6 +124,7 @@ void compressTexture(irr::video::ITexture *tex, bool srgb, bool premul_alpha)
|
||||
else
|
||||
internalFormat = (tex->hasAlpha()) ? GL_COMPRESSED_RGBA_S3TC_DXT5_EXT : GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
|
||||
}
|
||||
#endif
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, w, h, 0, Format, GL_UNSIGNED_BYTE, (GLvoid *)data);
|
||||
glGenerateMipmap(GL_TEXTURE_2D);
|
||||
delete[] data;
|
||||
@@ -167,6 +187,7 @@ bool loadCompressedTexture(const std::string& compressed_tex)
|
||||
*/
|
||||
void saveCompressedTexture(const std::string& compressed_tex)
|
||||
{
|
||||
#ifndef ANDROID
|
||||
int internal_format, width, height, size, compressionSuccessful;
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, (GLint *)&internal_format);
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, (GLint *)&width);
|
||||
@@ -189,6 +210,7 @@ void saveCompressedTexture(const std::string& compressed_tex)
|
||||
ofs.close();
|
||||
}
|
||||
delete[] data;
|
||||
#endif
|
||||
}
|
||||
|
||||
video::ITexture* getUnicolorTexture(const video::SColor &c)
|
||||
|
||||
@@ -55,7 +55,9 @@ void TextureShaderBase::bindTextureNearest(GLuint texture_unit, GLuint tex)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
#ifndef ANDROID
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.);
|
||||
#endif
|
||||
|
||||
} // bindTextureNearest
|
||||
|
||||
@@ -71,7 +73,9 @@ void TextureShaderBase::bindTextureTrilinearAnisotropic(GLuint tex_unit, GLuint
|
||||
|
||||
int aniso = UserConfigParams::m_anisotropic;
|
||||
if (aniso == 0) aniso = 1;
|
||||
#ifndef ANDROID
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, (float)aniso);
|
||||
#endif
|
||||
} // bindTextureTrilinearAnisotropic
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -86,8 +90,10 @@ void TextureShaderBase::bindCubemapTrilinear(unsigned tex_unit, unsigned tex)
|
||||
|
||||
int aniso = UserConfigParams::m_anisotropic;
|
||||
if (aniso == 0) aniso = 1;
|
||||
#ifndef ANDROID
|
||||
glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAX_ANISOTROPY_EXT,
|
||||
(float)aniso);
|
||||
#endif
|
||||
} // bindCubemapTrilinear
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -100,7 +106,9 @@ void TextureShaderBase::bindTextureNearestClamped(GLuint texture_unit,
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
#ifndef ANDROID
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.);
|
||||
#endif
|
||||
} // bindTextureNearestClamped
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -114,7 +122,9 @@ void TextureShaderBase::bindTextureBilinear(GLuint texture_unit, GLuint tex)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
#ifndef ANDROID
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.);
|
||||
#endif
|
||||
} // bindTextureBilinear
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -126,7 +136,9 @@ void TextureShaderBase::bindTextureBilinearClamped(GLuint tex_unit, GLuint tex)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
#ifndef ANDROID
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.);
|
||||
#endif
|
||||
} // bindTextureBilinearClamped
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -138,7 +150,9 @@ void TextureShaderBase::bindTextureSemiTrilinear(GLuint tex_unit, GLuint tex_id)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
#ifndef ANDROID
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.);
|
||||
#endif
|
||||
} // bindTextureSemiTrilinear
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -167,7 +181,9 @@ void TextureShaderBase::bindTrilinearClampedArrayTexture(unsigned tex_unit,
|
||||
|
||||
int aniso = UserConfigParams::m_anisotropic;
|
||||
if (aniso == 0) aniso = 1;
|
||||
#ifndef ANDROID
|
||||
glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAX_ANISOTROPY_EXT, (float)aniso);
|
||||
#endif
|
||||
} // bindTrilinearClampedArrayTexture
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -179,7 +195,9 @@ void TextureShaderBase::bindTextureVolume(unsigned tex_unit, unsigned tex_id)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
#ifndef ANDROID
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.);
|
||||
#endif
|
||||
} // bindTextureVolume
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -211,7 +229,9 @@ GLuint TextureShaderBase::createSamplers(SamplerTypeNew sampler_type)
|
||||
glSamplerParameteri(id, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glSamplerParameteri(id, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glSamplerParameteri(id, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
#ifndef ANDROID
|
||||
glSamplerParameterf(id, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.);
|
||||
#endif
|
||||
return createNearestSampler();
|
||||
}
|
||||
case ST_BILINEAR_CLAMPED_FILTERED:
|
||||
@@ -234,7 +254,9 @@ GLuint TextureShaderBase::createNearestSampler()
|
||||
glSamplerParameteri(id, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glSamplerParameteri(id, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glSamplerParameteri(id, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
#ifndef ANDROID
|
||||
glSamplerParameterf(id, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.);
|
||||
#endif
|
||||
return id;
|
||||
#endif
|
||||
} // createNearestSampler
|
||||
@@ -252,7 +274,9 @@ GLuint TextureShaderBase::createTrilinearSampler()
|
||||
|
||||
int aniso = UserConfigParams::m_anisotropic;
|
||||
if (aniso == 0) aniso = 1;
|
||||
#ifndef ANDROID
|
||||
glSamplerParameterf(id, GL_TEXTURE_MAX_ANISOTROPY_EXT, (float)aniso);
|
||||
#endif
|
||||
return id;
|
||||
#endif
|
||||
} // createTrilinearSampler
|
||||
|
||||
@@ -215,9 +215,11 @@ public:
|
||||
template<int N, typename... HandlesId>
|
||||
void setTextureHandlesImpl(uint64_t handle, HandlesId... args)
|
||||
{
|
||||
#ifndef ANDROID
|
||||
if (handle)
|
||||
glUniformHandleui64ARB(m_texture_location[N], handle);
|
||||
setTextureHandlesImpl<N + 1>(args...);
|
||||
#endif
|
||||
} // setTextureHandlesImpl
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@@ -39,12 +39,14 @@ VAOManager::VAOManager()
|
||||
{
|
||||
glGenBuffers(1, &instance_vbo[i]);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, instance_vbo[i]);
|
||||
#ifndef ANDROID
|
||||
if (CVS->supportsAsyncInstanceUpload())
|
||||
{
|
||||
glBufferStorage(GL_ARRAY_BUFFER, 10000 * sizeof(InstanceDataDualTex), 0, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT);
|
||||
Ptr[i] = glMapBufferRange(GL_ARRAY_BUFFER, 0, 10000 * sizeof(InstanceDataDualTex), GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
glBufferData(GL_ARRAY_BUFFER, 10000 * sizeof(InstanceDataDualTex), 0, GL_STREAM_DRAW);
|
||||
}
|
||||
@@ -88,12 +90,14 @@ resizeBufferIfNecessary(size_t &lastIndex, size_t newLastIndex, size_t bufferSiz
|
||||
GLuint newVBO;
|
||||
glGenBuffers(1, &newVBO);
|
||||
glBindBuffer(type, newVBO);
|
||||
#ifndef ANDROID
|
||||
if (CVS->supportsAsyncInstanceUpload())
|
||||
{
|
||||
glBufferStorage(type, bufferSize *stride, 0, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT);
|
||||
Pointer = glMapBufferRange(type, 0, bufferSize * stride, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
glBufferData(type, bufferSize * stride, 0, GL_DYNAMIC_DRAW);
|
||||
|
||||
if (id)
|
||||
@@ -289,22 +293,26 @@ void VAOManager::append(scene::IMeshBuffer *mb, VTXTYPE tp)
|
||||
size_t old_idx_cnt = last_index[tp];
|
||||
|
||||
regenerateBuffer(tp, old_vtx_cnt + mb->getVertexCount(), old_idx_cnt + mb->getIndexCount());
|
||||
#ifndef ANDROID
|
||||
if (CVS->supportsAsyncInstanceUpload())
|
||||
{
|
||||
void *tmp = (char*)VBOPtr[tp] + old_vtx_cnt * getVertexPitch(tp);
|
||||
memcpy(tmp, mb->getVertices(), mb->getVertexCount() * getVertexPitch(tp));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo[tp]);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, old_vtx_cnt * getVertexPitch(tp), mb->getVertexCount() * getVertexPitch(tp), mb->getVertices());
|
||||
}
|
||||
#ifndef ANDROID
|
||||
if (CVS->supportsAsyncInstanceUpload())
|
||||
{
|
||||
void *tmp = (char*)IBOPtr[tp] + old_idx_cnt * sizeof(u16);
|
||||
memcpy(tmp, mb->getIndices(), mb->getIndexCount() * sizeof(u16));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo[tp]);
|
||||
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, old_idx_cnt * sizeof(u16), mb->getIndexCount() * sizeof(u16), mb->getIndices());
|
||||
|
||||
@@ -1961,10 +1961,12 @@ void Skin::process3DPane(IGUIElement *element, const core::recti &rect,
|
||||
FrameBuffer* fb = mvw->getFrameBuffer();
|
||||
if (fb != NULL && fb->getRTT().size() > 0)
|
||||
{
|
||||
#ifndef ANDROID
|
||||
glEnable(GL_FRAMEBUFFER_SRGB);
|
||||
draw2DImageFromRTT(fb->getRTT()[0], 512, 512,
|
||||
rect, core::rect<s32>(0, 0, 512, 512), NULL, SColor(255, 255, 255, 255), true);
|
||||
glDisable(GL_FRAMEBUFFER_SRGB);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (type == WTYPE_ICON_BUTTON || type == WTYPE_MODEL_VIEW)
|
||||
|
||||
@@ -42,18 +42,22 @@ NetworkConsole::NetworkConsole()
|
||||
// ----------------------------------------------------------------------------
|
||||
NetworkConsole::~NetworkConsole()
|
||||
{
|
||||
#ifndef ANDROID
|
||||
if (m_thread_keyboard)
|
||||
pthread_cancel(*m_thread_keyboard);//, SIGKILL);
|
||||
#endif
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void NetworkConsole::run()
|
||||
{
|
||||
#ifndef ANDROID
|
||||
// listen keyboard console input
|
||||
m_thread_keyboard = new pthread_t;
|
||||
pthread_create(m_thread_keyboard, NULL, mainLoop, this);
|
||||
|
||||
Log::info("NetworkConsole", "Ready.");
|
||||
#endif
|
||||
} // run
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user