Put some preprocessor macros to prevent unsupported GLES calls
This commit is contained in:
parent
02808cdfd0
commit
368a230ed7
@ -104,6 +104,7 @@ private:
|
||||
-1., 1., -1., -1., // LowerLeft
|
||||
1., -1., 1., 1., // UpperRight
|
||||
1., 1., 1., -1. }; // LowerRight
|
||||
#ifndef ANDROID
|
||||
glGenBuffers(1, &m_quad_buffer);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, m_quad_buffer);
|
||||
glBufferData(GL_ARRAY_BUFFER, 16 * sizeof(float), quad_vertex,
|
||||
@ -118,6 +119,7 @@ private:
|
||||
glVertexAttribPointer(3, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float),
|
||||
(GLvoid *)(2 * sizeof(float)));
|
||||
glBindVertexArray(0);
|
||||
#endif
|
||||
} // initQuadBuffer
|
||||
#endif
|
||||
public:
|
||||
@ -126,6 +128,7 @@ public:
|
||||
|
||||
ColoredTextureRectShader()
|
||||
{
|
||||
#ifndef ANDROID
|
||||
#ifdef XX
|
||||
initQuadBuffer();
|
||||
#endif
|
||||
@ -154,6 +157,7 @@ public:
|
||||
GL_DYNAMIC_DRAW);
|
||||
glVertexAttribIPointer(2, 4, GL_UNSIGNED_INT, 4 * sizeof(unsigned), 0);
|
||||
glBindVertexArray(0);
|
||||
#endif
|
||||
} // ColoredTextureRectShader
|
||||
}; // ColoredTextureRectShader
|
||||
|
||||
@ -165,6 +169,7 @@ static void drawTexColoredQuad(const video::ITexture *texture,
|
||||
float tex_center_pos_y, float tex_width,
|
||||
float tex_height)
|
||||
{
|
||||
#ifndef ANDROID
|
||||
unsigned colors[] = {
|
||||
col[0].getRed(), col[0].getGreen(), col[0].getBlue(), col[0].getAlpha(),
|
||||
col[1].getRed(), col[1].getGreen(), col[1].getBlue(), col[1].getAlpha(),
|
||||
@ -194,6 +199,7 @@ static void drawTexColoredQuad(const video::ITexture *texture,
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
glGetError();
|
||||
#endif
|
||||
} // drawTexColoredQuad
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -202,6 +208,7 @@ static void drawTexQuad(GLuint texture, float width, float height,
|
||||
float tex_center_pos_x, float tex_center_pos_y,
|
||||
float tex_width, float tex_height)
|
||||
{
|
||||
#ifndef ANDROID
|
||||
TextureRectShader::getInstance()->use();
|
||||
glBindVertexArray(SharedGPUObjects::getUI_VAO());
|
||||
|
||||
@ -217,6 +224,7 @@ static void drawTexQuad(GLuint texture, float width, float height,
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
glGetError();
|
||||
#endif
|
||||
} // drawTexQuad
|
||||
|
||||
|
||||
@ -270,6 +278,7 @@ void draw2DImage(const video::ITexture* texture,
|
||||
const core::rect<s32>* clip_rect,
|
||||
const video::SColor &colors, bool use_alpha_channel_of_texture)
|
||||
{
|
||||
#ifndef ANDROID
|
||||
if (!CVS->isGLSL())
|
||||
{
|
||||
video::SColor duplicatedArray[4] = { colors, colors, colors, colors };
|
||||
@ -332,6 +341,7 @@ void draw2DImage(const video::ITexture* texture,
|
||||
glUseProgram(0);
|
||||
|
||||
glGetError();
|
||||
#endif
|
||||
} // draw2DImage
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -342,6 +352,7 @@ void draw2DImageFromRTT(GLuint texture, size_t texture_w, size_t texture_h,
|
||||
const video::SColor &colors,
|
||||
bool use_alpha_channel_of_texture)
|
||||
{
|
||||
#ifndef ANDROID
|
||||
if (use_alpha_channel_of_texture)
|
||||
{
|
||||
glEnable(GL_BLEND);
|
||||
@ -369,6 +380,7 @@ void draw2DImageFromRTT(GLuint texture, size_t texture_w, size_t texture_h,
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
glBindVertexArray(0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
#endif
|
||||
} // draw2DImageFromRTT
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -379,6 +391,7 @@ void draw2DImage(const video::ITexture* texture,
|
||||
const video::SColor* const colors,
|
||||
bool use_alpha_channel_of_texture)
|
||||
{
|
||||
#ifndef ANDROID
|
||||
if (!CVS->isGLSL())
|
||||
{
|
||||
irr_driver->getVideoDriver()->draw2DImage(texture, destRect, sourceRect,
|
||||
@ -435,6 +448,7 @@ void draw2DImage(const video::ITexture* texture,
|
||||
glUseProgram(0);
|
||||
|
||||
glGetError();
|
||||
#endif
|
||||
} // draw2DImage
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -444,6 +458,7 @@ void draw2DVertexPrimitiveList(video::ITexture *tex, const void* vertices,
|
||||
scene::E_PRIMITIVE_TYPE pType,
|
||||
video::E_INDEX_TYPE iType)
|
||||
{
|
||||
#ifndef ANDROID
|
||||
if (!CVS->isGLSL())
|
||||
{
|
||||
irr_driver->getVideoDriver()
|
||||
@ -477,6 +492,7 @@ void draw2DVertexPrimitiveList(video::ITexture *tex, const void* vertices,
|
||||
glDeleteBuffers(1, &tmpvbo);
|
||||
glDeleteBuffers(1, &tmpibo);
|
||||
|
||||
#endif
|
||||
} // draw2DVertexPrimitiveList
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -484,9 +500,12 @@ void GL32_draw2DRectangle(video::SColor color, const core::rect<s32>& position,
|
||||
const core::rect<s32>* clip)
|
||||
{
|
||||
|
||||
#ifndef ANDROID
|
||||
if (!CVS->isGLSL())
|
||||
{
|
||||
#endif
|
||||
irr_driver->getVideoDriver()->draw2DRectangle(color, position, clip);
|
||||
#ifndef ANDROID
|
||||
return;
|
||||
}
|
||||
|
||||
@ -541,4 +560,5 @@ void GL32_draw2DRectangle(video::SColor color, const core::rect<s32>& position,
|
||||
glUseProgram(0);
|
||||
|
||||
glGetError();
|
||||
#endif
|
||||
} // GL32_draw2DRectangle
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "graphics/glwrap.hpp"
|
||||
#include "graphics/graphics_restrictions.hpp"
|
||||
|
||||
|
||||
CentralVideoSettings *CVS = new CentralVideoSettings();
|
||||
|
||||
void CentralVideoSettings::init()
|
||||
@ -191,10 +192,12 @@ void CentralVideoSettings::init()
|
||||
if (GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_FRAMEBUFFER_SRGB_CAPABLE) &&
|
||||
m_glsl == true)
|
||||
{
|
||||
#ifndef ANDROID
|
||||
GLint param = GL_SRGB;
|
||||
glGetFramebufferAttachmentParameteriv(GL_DRAW_FRAMEBUFFER, GL_BACK_LEFT,
|
||||
GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING, ¶m);
|
||||
m_need_srgb_visual_workaround = (param != GL_SRGB);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
#define GLEW_STATIC
|
||||
|
||||
extern "C" {
|
||||
#ifndef ANDROID
|
||||
#ifndef ANDROID_DEVICE
|
||||
# include <GL/glew.h>
|
||||
#endif
|
||||
}
|
||||
@ -40,7 +40,7 @@ extern "C" {
|
||||
# ifndef GL_TEXTURE_SWIZZLE_RGBA
|
||||
# define GL_TEXTURE_SWIZZLE_RGBA 0x8E46
|
||||
# endif
|
||||
#elif defined(ANDROID)
|
||||
#elif defined(ANDROID_DEVICE)
|
||||
# include <GLES/gl.h>
|
||||
#elif defined(WIN32)
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
|
@ -30,6 +30,49 @@
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
#ifndef GL_DEBUG_SEVERITY_HIGH_ARB
|
||||
// Extension: ARB_debug_output
|
||||
#define GL_DEBUG_SEVERITY_HIGH_ARB 0x9146
|
||||
#define GL_DEBUG_SEVERITY_LOW_ARB 0x9148
|
||||
#define GL_DEBUG_SEVERITY_MEDIUM_ARB 0x9147
|
||||
#define GL_DEBUG_SOURCE_API_ARB 0x8246
|
||||
#define GL_DEBUG_SOURCE_APPLICATION_ARB 0x824A
|
||||
#define GL_DEBUG_SOURCE_OTHER_ARB 0x824B
|
||||
#define GL_DEBUG_SOURCE_SHADER_COMPILER_ARB 0x8248
|
||||
#define GL_DEBUG_SOURCE_THIRD_PARTY_ARB 0x8249
|
||||
#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB 0x8247
|
||||
#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB 0x824D
|
||||
#define GL_DEBUG_TYPE_ERROR_ARB 0x824C
|
||||
#define GL_DEBUG_TYPE_OTHER_ARB 0x8251
|
||||
#define GL_DEBUG_TYPE_PERFORMANCE_ARB 0x8250
|
||||
#define GL_DEBUG_TYPE_PORTABILITY_ARB 0x824F
|
||||
#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB 0x824E
|
||||
#endif
|
||||
|
||||
#ifndef GL_DEBUG_SEVERITY_HIGH
|
||||
// Extension: KHR_debug
|
||||
#define GL_DEBUG_SEVERITY_HIGH 0x9146
|
||||
#define GL_DEBUG_SEVERITY_LOW 0x9148
|
||||
#define GL_DEBUG_SEVERITY_MEDIUM 0x9147
|
||||
#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B
|
||||
#define GL_DEBUG_SOURCE_API 0x8246
|
||||
#define GL_DEBUG_SOURCE_APPLICATION 0x824A
|
||||
#define GL_DEBUG_SOURCE_OTHER 0x824B
|
||||
#define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248
|
||||
#define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249
|
||||
#define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247
|
||||
#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D
|
||||
#define GL_DEBUG_TYPE_ERROR 0x824C
|
||||
#define GL_DEBUG_TYPE_MARKER 0x8268
|
||||
#define GL_DEBUG_TYPE_OTHER 0x8251
|
||||
#define GL_DEBUG_TYPE_PERFORMANCE 0x8250
|
||||
#define GL_DEBUG_TYPE_POP_GROUP 0x826A
|
||||
#define GL_DEBUG_TYPE_PORTABILITY 0x824F
|
||||
#define GL_DEBUG_TYPE_PUSH_GROUP 0x8269
|
||||
#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E
|
||||
#endif
|
||||
|
||||
|
||||
static bool is_gl_init = false;
|
||||
|
||||
#if DEBUG
|
||||
@ -40,7 +83,7 @@ bool GLContextDebugBit = false;
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
#if !defined(__APPLE__)
|
||||
#if !defined(__APPLE__) && !defined(ANDROID)
|
||||
#define ARB_DEBUG_OUTPUT
|
||||
#endif
|
||||
#endif
|
||||
@ -198,6 +241,7 @@ FrameBuffer::FrameBuffer(const std::vector<GLuint> &RTTs, size_t w, size_t h,
|
||||
{
|
||||
glGenFramebuffers(1, &fbo);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
||||
#ifndef ANDROID
|
||||
if (layered)
|
||||
{
|
||||
for (unsigned i = 0; i < RTTs.size(); i++)
|
||||
@ -205,11 +249,14 @@ FrameBuffer::FrameBuffer(const std::vector<GLuint> &RTTs, size_t w, size_t h,
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
for (unsigned i = 0; i < RTTs.size(); i++)
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, GL_TEXTURE_2D, RTTs[i], 0);
|
||||
#ifndef ANDROID
|
||||
}
|
||||
GLenum result = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
assert(result == GL_FRAMEBUFFER_COMPLETE_EXT);
|
||||
#endif
|
||||
}
|
||||
|
||||
FrameBuffer::FrameBuffer(const std::vector<GLuint> &RTTs, GLuint DS, size_t w,
|
||||
@ -219,6 +266,7 @@ FrameBuffer::FrameBuffer(const std::vector<GLuint> &RTTs, GLuint DS, size_t w,
|
||||
{
|
||||
glGenFramebuffers(1, &fbo);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
||||
#ifndef ANDROID
|
||||
if (layered)
|
||||
{
|
||||
for (unsigned i = 0; i < RTTs.size(); i++)
|
||||
@ -227,14 +275,17 @@ FrameBuffer::FrameBuffer(const std::vector<GLuint> &RTTs, GLuint DS, size_t w,
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
for (unsigned i = 0; i < RTTs.size(); i++)
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, GL_TEXTURE_2D, RTTs[i], 0);
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, DS, 0);
|
||||
#ifndef ANDROID
|
||||
}
|
||||
GLenum result = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
assert(result == GL_FRAMEBUFFER_COMPLETE_EXT);
|
||||
if (layered)
|
||||
glGenFramebuffers(1, &fbolayer);
|
||||
#endif
|
||||
}
|
||||
|
||||
FrameBuffer::~FrameBuffer()
|
||||
|
@ -184,6 +184,7 @@ void ParticleSystemProxy::setFlip()
|
||||
void ParticleSystemProxy::setHeightmap(const std::vector<std::vector<float> > &hm,
|
||||
float f1, float f2, float f3, float f4)
|
||||
{
|
||||
#ifndef ANDROID
|
||||
track_x = f1, track_z = f2, track_x_len = f3, track_z_len = f4;
|
||||
|
||||
unsigned width = (unsigned)hm.size();
|
||||
@ -206,6 +207,7 @@ void ParticleSystemProxy::setHeightmap(const std::vector<std::vector<float> > &h
|
||||
glBindBuffer(GL_TEXTURE_BUFFER, 0);
|
||||
|
||||
delete[] hm_array;
|
||||
#endif
|
||||
}
|
||||
|
||||
static
|
||||
@ -412,6 +414,7 @@ void ParticleSystemProxy::cleanGL()
|
||||
|
||||
void ParticleSystemProxy::CommonRenderingVAO(GLuint PositionBuffer)
|
||||
{
|
||||
#ifndef ANDROID
|
||||
glBindBuffer(GL_ARRAY_BUFFER, SharedGPUObjects::getParticleQuadVBO());
|
||||
glEnableVertexAttribArray(4);
|
||||
glVertexAttribPointer(4, 4, GL_FLOAT, GL_FALSE, 4 * sizeof(float), 0);
|
||||
@ -428,10 +431,12 @@ void ParticleSystemProxy::CommonRenderingVAO(GLuint PositionBuffer)
|
||||
glEnableVertexAttribArray(2);
|
||||
glVertexAttribPointer(2, 1, GL_FLOAT, GL_FALSE, sizeof(ParticleData), (GLvoid *)(7 * sizeof(float)));
|
||||
glVertexAttribDivisorARB(2, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ParticleSystemProxy::AppendQuaternionRenderingVAO(GLuint QuaternionBuffer)
|
||||
{
|
||||
#ifndef ANDROID
|
||||
glBindBuffer(GL_ARRAY_BUFFER, QuaternionBuffer);
|
||||
glEnableVertexAttribArray(5);
|
||||
|
||||
@ -441,10 +446,12 @@ void ParticleSystemProxy::AppendQuaternionRenderingVAO(GLuint QuaternionBuffer)
|
||||
glEnableVertexAttribArray(6);
|
||||
glVertexAttribPointer(6, 1, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (GLvoid *)(3 * sizeof(float)));
|
||||
glVertexAttribDivisorARB(6, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ParticleSystemProxy::CommonSimulationVAO(GLuint position_vbo, GLuint initialValues_vbo)
|
||||
{
|
||||
#ifndef ANDROID
|
||||
glBindBuffer(GL_ARRAY_BUFFER, position_vbo);
|
||||
glEnableVertexAttribArray(0);
|
||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(ParticleSystemProxy::ParticleData), (GLvoid*)0);
|
||||
@ -464,10 +471,12 @@ void ParticleSystemProxy::CommonSimulationVAO(GLuint position_vbo, GLuint initia
|
||||
glVertexAttribPointer(6, 3, GL_FLOAT, GL_FALSE, sizeof(ParticleSystemProxy::ParticleData), (GLvoid*)(4 * sizeof(float)));
|
||||
glEnableVertexAttribArray(7);
|
||||
glVertexAttribPointer(7, 1, GL_FLOAT, GL_FALSE, sizeof(ParticleSystemProxy::ParticleData), (GLvoid*)(7 * sizeof(float)));
|
||||
#endif
|
||||
}
|
||||
|
||||
void ParticleSystemProxy::simulate()
|
||||
{
|
||||
#ifndef ANDROID
|
||||
int timediff = int(GUIEngine::getLatestDt() * 1000.f);
|
||||
int active_count = getEmitter()->getMaxLifeTime() * getEmitter()->getMaxParticlesPerSecond() / 1000;
|
||||
core::matrix4 matrix = getAbsoluteTransformation();
|
||||
@ -517,6 +526,7 @@ void ParticleSystemProxy::simulate()
|
||||
std::swap(tfb_buffers[0], tfb_buffers[1]);
|
||||
std::swap(current_rendering_vao, non_current_rendering_vao);
|
||||
std::swap(current_simulation_vao, non_current_simulation_vao);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ParticleSystemProxy::drawFlip()
|
||||
|
@ -73,9 +73,9 @@
|
||||
* Should help prevent distros building against an incompatible library.
|
||||
*/
|
||||
|
||||
#if IRRLICHT_VERSION_MAJOR < 1 || IRRLICHT_VERSION_MINOR < 7 || \
|
||||
#if (IRRLICHT_VERSION_MAJOR < 1 || IRRLICHT_VERSION_MINOR < 7 || \
|
||||
_IRR_MATERIAL_MAX_TEXTURES_ < 8 || !defined(_IRR_COMPILE_WITH_OPENGL_) || \
|
||||
!defined(_IRR_COMPILE_WITH_B3D_LOADER_)
|
||||
!defined(_IRR_COMPILE_WITH_B3D_LOADER_)) && !defined(ANDROID)
|
||||
#error "Building against an incompatible Irrlicht. Distros, \
|
||||
please use the included version."
|
||||
#endif
|
||||
|
@ -46,10 +46,6 @@
|
||||
#include "utils/ptr_vector.hpp"
|
||||
#include "utils/vec3.hpp"
|
||||
|
||||
#ifdef ANDROID
|
||||
# include <GLES2/gl2ext.h>
|
||||
#endif
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace scene { class ISceneManager; class IMesh; class IAnimatedMeshSceneNode; class IAnimatedMesh;
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "graphics/camera.hpp"
|
||||
#include "graphics/central_settings.hpp"
|
||||
#include "graphics/glwrap.hpp"
|
||||
#include "graphics/gl_headers.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "graphics/mlaa_areamap.hpp"
|
||||
#include "graphics/shaders.hpp"
|
||||
|
@ -189,8 +189,10 @@ void IrrDriver::renderGLSL(float dt)
|
||||
if (World::getWorld() && World::getWorld()->getTrack()->hasShadows() && m_spherical_harmonics->has6Textures())
|
||||
irr_driver->getSceneManager()->setAmbientLight(SColor(0, 0, 0, 0));
|
||||
|
||||
#ifndef ANDROID
|
||||
if (!CVS->isDefferedEnabled())
|
||||
glEnable(GL_FRAMEBUFFER_SRGB);
|
||||
#endif
|
||||
|
||||
PROFILER_PUSH_CPU_MARKER("Update Light Info", 0xFF, 0x0, 0x0);
|
||||
unsigned plc = updateLightsInfo(camnode, dt);
|
||||
@ -282,12 +284,16 @@ void IrrDriver::renderGLSL(float dt)
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef ANDROID
|
||||
glEnable(GL_FRAMEBUFFER_SRGB);
|
||||
#endif
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
if (CVS->isDefferedEnabled())
|
||||
camera->activate();
|
||||
m_post_processing->renderPassThrough(fbo->getRTT()[0], viewport.LowerRightCorner.X - viewport.UpperLeftCorner.X, viewport.LowerRightCorner.Y - viewport.UpperLeftCorner.Y);
|
||||
#ifndef ANDROID
|
||||
glDisable(GL_FRAMEBUFFER_SRGB);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
// Save projection-view matrix for the next frame
|
||||
@ -400,8 +406,10 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po
|
||||
else
|
||||
{
|
||||
// We need a cleared depth buffer for some effect (eg particles depth blending)
|
||||
#ifndef ANDROID
|
||||
if (GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_FRAMEBUFFER_SRGB_WORKING))
|
||||
glDisable(GL_FRAMEBUFFER_SRGB);
|
||||
#endif
|
||||
m_rtts->getFBO(FBO_NORMAL_AND_DEPTHS).bind();
|
||||
// Bind() modifies the viewport. In order not to affect anything else,
|
||||
// the viewport is just reset here and not removed in Bind().
|
||||
@ -411,8 +419,10 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po
|
||||
vp.LowerRightCorner.X - vp.UpperLeftCorner.X,
|
||||
vp.LowerRightCorner.Y - vp.UpperLeftCorner.Y);
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
#ifndef ANDROID
|
||||
if (GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_FRAMEBUFFER_SRGB_WORKING))
|
||||
glEnable(GL_FRAMEBUFFER_SRGB);
|
||||
#endif
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
}
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
@ -535,7 +545,9 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po
|
||||
}
|
||||
if (!CVS->isDefferedEnabled() && !forceRTT)
|
||||
{
|
||||
#ifndef ANDROID
|
||||
glDisable(GL_FRAMEBUFFER_SRGB);
|
||||
#endif
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDepthMask(GL_FALSE);
|
||||
return;
|
||||
@ -684,10 +696,12 @@ void IrrDriver::renderGlow(std::vector<GlowData>& glows)
|
||||
{
|
||||
if (GlowPassCmd::getInstance()->Size)
|
||||
{
|
||||
#ifndef ANDROID
|
||||
glMultiDrawElementsIndirect(GL_TRIANGLES, GL_UNSIGNED_SHORT,
|
||||
(const void*)(GlowPassCmd::getInstance()->Offset * sizeof(DrawElementsIndirectCommand)),
|
||||
(int)GlowPassCmd::getInstance()->Size,
|
||||
sizeof(DrawElementsIndirectCommand));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -174,6 +174,7 @@ class ShadowShader : public TextureShader<ShadowShader, 0, int, core::matrix4>
|
||||
public:
|
||||
ShadowShader()
|
||||
{
|
||||
#ifndef ANDROID
|
||||
// Geometry shader needed
|
||||
if (CVS->getGLSLVersion() < 150)
|
||||
return;
|
||||
@ -188,6 +189,7 @@ public:
|
||||
GL_GEOMETRY_SHADER, "shadow.geom",
|
||||
GL_FRAGMENT_SHADER, "shadow.frag");
|
||||
}
|
||||
#endif
|
||||
assignUniforms("layer", "ModelMatrix");
|
||||
} // ShadowShader
|
||||
}; // ShadowShader
|
||||
@ -198,6 +200,8 @@ class InstancedShadowShader : public TextureShader<InstancedShadowShader, 0, int
|
||||
public:
|
||||
InstancedShadowShader()
|
||||
{
|
||||
#ifndef ANDROID
|
||||
// Geometry shader needed
|
||||
// Geometry shader needed
|
||||
if (CVS->getGLSLVersion() < 150)
|
||||
return;
|
||||
@ -214,6 +218,7 @@ public:
|
||||
GL_GEOMETRY_SHADER, "instanced_shadow.geom",
|
||||
GL_FRAGMENT_SHADER, "shadow.frag");
|
||||
}
|
||||
#endif
|
||||
assignUniforms("layer");
|
||||
} // InstancedShadowShader
|
||||
|
||||
@ -421,6 +426,7 @@ class RefShadowShader : public TextureShader<RefShadowShader, 1,
|
||||
public:
|
||||
RefShadowShader()
|
||||
{
|
||||
#ifndef ANDROID
|
||||
// Geometry shader needed
|
||||
if (CVS->getGLSLVersion() < 150)
|
||||
return;
|
||||
@ -437,6 +443,7 @@ public:
|
||||
}
|
||||
assignUniforms("layer", "ModelMatrix");
|
||||
assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
|
||||
#endif
|
||||
} // RefShadowShader
|
||||
}; // RefShadowShader
|
||||
|
||||
@ -447,6 +454,7 @@ class InstancedRefShadowShader : public TextureShader<InstancedRefShadowShader,
|
||||
public:
|
||||
InstancedRefShadowShader()
|
||||
{
|
||||
#ifndef ANDROID
|
||||
// Geometry shader needed
|
||||
if (CVS->getGLSLVersion() < 150)
|
||||
return;
|
||||
@ -465,6 +473,7 @@ public:
|
||||
}
|
||||
assignUniforms("layer");
|
||||
assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
|
||||
#endif
|
||||
} // InstancedRefShadowShader
|
||||
}; // InstancedRefShadowShader
|
||||
|
||||
@ -504,11 +513,13 @@ class NormalVisualizer : public Shader<NormalVisualizer, video::SColor>
|
||||
public:
|
||||
NormalVisualizer()
|
||||
{
|
||||
#ifndef ANDROID
|
||||
loadProgram(OBJECT, GL_VERTEX_SHADER, "utils/getworldmatrix.vert",
|
||||
GL_VERTEX_SHADER, "instanced_object_pass.vert",
|
||||
GL_GEOMETRY_SHADER, "normal_visualizer.geom",
|
||||
GL_FRAGMENT_SHADER, "coloredquad.frag");
|
||||
assignUniforms("color");
|
||||
#endif
|
||||
} // NormalVisualizer
|
||||
}; // NormalVisualizer
|
||||
|
||||
@ -672,6 +683,7 @@ class GrassShadowShader : public TextureShader<GrassShadowShader, 1, int, core::
|
||||
public:
|
||||
GrassShadowShader()
|
||||
{
|
||||
#ifndef ANDROID
|
||||
// Geometry shader needed
|
||||
if (CVS->getGLSLVersion() < 150)
|
||||
return;
|
||||
@ -688,6 +700,7 @@ public:
|
||||
}
|
||||
assignUniforms("layer", "ModelMatrix", "windDir");
|
||||
assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
|
||||
#endif
|
||||
} // GrassShadowShader
|
||||
}; // GrassShadowShader
|
||||
|
||||
@ -698,6 +711,7 @@ class InstancedGrassShadowShader : public TextureShader<InstancedGrassShadowShad
|
||||
public:
|
||||
InstancedGrassShadowShader()
|
||||
{
|
||||
#ifndef ANDROID
|
||||
// Geometry shader needed
|
||||
if (CVS->getGLSLVersion() < 150)
|
||||
return;
|
||||
@ -717,6 +731,7 @@ public:
|
||||
|
||||
assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED);
|
||||
assignUniforms("layer", "windDir");
|
||||
#endif
|
||||
} // InstancedGrassShadowShader
|
||||
}; // InstancedGrassShadowShader
|
||||
|
||||
@ -982,6 +997,7 @@ using namespace RenderGeometry;
|
||||
template<typename T, typename...uniforms>
|
||||
void draw(const T *Shader, const GLMesh *mesh, uniforms... Args)
|
||||
{
|
||||
#ifndef ANDROID
|
||||
irr_driver->IncreaseObjectCount();
|
||||
GLenum ptype = mesh->PrimitiveType;
|
||||
GLenum itype = mesh->IndexType;
|
||||
@ -991,6 +1007,7 @@ void draw(const T *Shader, const GLMesh *mesh, uniforms... Args)
|
||||
glDrawElementsBaseVertex(ptype, (int)count, itype,
|
||||
(GLvoid *)mesh->vaoOffset,
|
||||
(int)mesh->vaoBaseVertex);
|
||||
#endif
|
||||
} // draw
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -1157,6 +1174,7 @@ void renderInstancedMeshes1stPass(Args...args)
|
||||
template<typename T, typename...Args>
|
||||
void multidraw1stPass(Args...args)
|
||||
{
|
||||
#ifndef ANDROID
|
||||
T::InstancedFirstPassShader::getInstance()->use();
|
||||
glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(T::VertexType, T::Instance));
|
||||
if (SolidPassCmd::getInstance()->Size[T::MaterialType])
|
||||
@ -1167,6 +1185,7 @@ void multidraw1stPass(Args...args)
|
||||
(int)SolidPassCmd::getInstance()->Size[T::MaterialType],
|
||||
sizeof(DrawElementsIndirectCommand));
|
||||
}
|
||||
#endif
|
||||
} // multidraw1stPass
|
||||
|
||||
static core::vector3df windDir;
|
||||
@ -1284,8 +1303,10 @@ template<typename T, typename...Args>
|
||||
void multidraw2ndPass(const std::vector<uint64_t> &Handles, Args... args)
|
||||
{
|
||||
T::InstancedSecondPassShader::getInstance()->use();
|
||||
#ifndef ANDROID
|
||||
glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(T::VertexType,
|
||||
T::Instance));
|
||||
#endif
|
||||
uint64_t nulltex[10] = {};
|
||||
if (SolidPassCmd::getInstance()->Size[T::MaterialType])
|
||||
{
|
||||
@ -1293,11 +1314,13 @@ void multidraw2ndPass(const std::vector<uint64_t> &Handles, Args... args)
|
||||
Expand(nulltex, T::SecondPassTextures, Handles[0], Handles[1],
|
||||
Handles[2]);
|
||||
T::InstancedSecondPassShader::getInstance()->setUniforms(args...);
|
||||
#ifndef ANDROID
|
||||
glMultiDrawElementsIndirect(GL_TRIANGLES, GL_UNSIGNED_SHORT,
|
||||
(const void*)(SolidPassCmd::getInstance()->Offset[T::MaterialType]
|
||||
* sizeof(DrawElementsIndirectCommand)),
|
||||
(int)SolidPassCmd::getInstance()->Size[T::MaterialType],
|
||||
(int)sizeof(DrawElementsIndirectCommand));
|
||||
#endif
|
||||
}
|
||||
} // multidraw2ndPass
|
||||
|
||||
@ -1310,6 +1333,7 @@ void IrrDriver::renderSolidSecondPass()
|
||||
|
||||
uint64_t DiffuseHandle = 0, SpecularHandle = 0, SSAOHandle = 0, DepthHandle = 0;
|
||||
|
||||
#ifndef ANDROID
|
||||
if (CVS->isAZDOEnabled())
|
||||
{
|
||||
DiffuseHandle = glGetTextureSamplerHandleARB(m_rtts->getRenderTarget(RTT_DIFFUSE),
|
||||
@ -1336,6 +1360,7 @@ void IrrDriver::renderSolidSecondPass()
|
||||
if (CVS->supportsIndirectInstancingRendering())
|
||||
glBindBuffer(GL_DRAW_INDIRECT_BUFFER,
|
||||
SolidPassCmd::getInstance()->drawindirectcmd);
|
||||
#endif
|
||||
|
||||
{
|
||||
ScopedGPUTimer Timer(getGPUTimer(Q_SOLID_PASS2));
|
||||
@ -1381,11 +1406,13 @@ void IrrDriver::renderSolidSecondPass()
|
||||
SpecularHandle, SSAOHandle, DepthHandle);
|
||||
GrassMat::InstancedSecondPassShader::getInstance()->setUniforms(windDir,
|
||||
irr_driver->getSunDirection());
|
||||
#ifndef ANDROID
|
||||
glMultiDrawElementsIndirect(GL_TRIANGLES, GL_UNSIGNED_SHORT,
|
||||
(const void*)(SolidPassCmd::getInstance()->Offset[GrassMat::MaterialType]
|
||||
* sizeof(DrawElementsIndirectCommand)),
|
||||
(int)SolidPassCmd::getInstance()->Size[GrassMat::MaterialType],
|
||||
(int)sizeof(DrawElementsIndirectCommand));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1402,8 +1429,10 @@ void IrrDriver::renderSolidSecondPass()
|
||||
{
|
||||
std::vector<GLMesh *> &meshes = GrassMat::InstancedList::getInstance()->SolidPass;
|
||||
GrassMat::InstancedSecondPassShader::getInstance()->use();
|
||||
#ifndef ANDROID
|
||||
glBindVertexArray(VAOManager::getInstance()
|
||||
->getInstanceVAO(GrassMat::VertexType, GrassMat::Instance));
|
||||
#endif
|
||||
for (unsigned i = 0; i < meshes.size(); i++)
|
||||
{
|
||||
GLMesh *mesh = meshes[i];
|
||||
@ -1413,9 +1442,11 @@ void IrrDriver::renderSolidSecondPass()
|
||||
irr_driver->getDepthStencilTexture());
|
||||
GrassMat::InstancedSecondPassShader::getInstance()
|
||||
->setUniforms(windDir, irr_driver->getSunDirection());
|
||||
#ifndef ANDROID
|
||||
glDrawElementsIndirect(GL_TRIANGLES, GL_UNSIGNED_SHORT,
|
||||
(const void*)((SolidPassCmd::getInstance()->Offset[GrassMat::MaterialType] + i)
|
||||
* sizeof(DrawElementsIndirectCommand)));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1442,6 +1473,7 @@ static void renderInstancedMeshNormals()
|
||||
template<typename T>
|
||||
static void renderMultiMeshNormals()
|
||||
{
|
||||
#ifndef ANDROID
|
||||
NormalVisualizer::getInstance()->use();
|
||||
glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(T::VertexType, T::Instance));
|
||||
if (SolidPassCmd::getInstance()->Size[T::MaterialType])
|
||||
@ -1452,6 +1484,7 @@ static void renderMultiMeshNormals()
|
||||
(int)SolidPassCmd::getInstance()->Size[T::MaterialType],
|
||||
(int)sizeof(DrawElementsIndirectCommand));
|
||||
}
|
||||
#endif
|
||||
} // renderMultiMeshNormals
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -1514,6 +1547,7 @@ static video::ITexture *displaceTex = 0;
|
||||
void IrrDriver::renderTransparent()
|
||||
{
|
||||
|
||||
#ifndef ANDROID
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthMask(GL_FALSE);
|
||||
glEnable(GL_BLEND);
|
||||
@ -1648,12 +1682,14 @@ void IrrDriver::renderTransparent()
|
||||
irr_driver->getFBO(FBO_COLORS).getHeight());
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
|
||||
#endif
|
||||
} // renderTransparent
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
template<typename T, typename...uniforms>
|
||||
void drawShadow(const T *Shader, unsigned cascade, const GLMesh *mesh, uniforms... Args)
|
||||
{
|
||||
#ifndef ANDROID
|
||||
irr_driver->IncreaseObjectCount();
|
||||
GLenum ptype = mesh->PrimitiveType;
|
||||
GLenum itype = mesh->IndexType;
|
||||
@ -1662,6 +1698,7 @@ void drawShadow(const T *Shader, unsigned cascade, const GLMesh *mesh, uniforms.
|
||||
Shader->setUniforms(cascade, Args...);
|
||||
glDrawElementsBaseVertex(ptype, (int)count, itype,
|
||||
(GLvoid *)mesh->vaoOffset, (int)mesh->vaoBaseVertex);
|
||||
#endif
|
||||
} // drawShadow
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -1737,6 +1774,7 @@ void renderInstancedShadow(unsigned cascade, Args ...args)
|
||||
template<typename T, typename...Args>
|
||||
static void multidrawShadow(unsigned i, Args ...args)
|
||||
{
|
||||
#ifndef ANDROID
|
||||
T::InstancedShadowPassShader::getInstance()->use();
|
||||
glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(T::VertexType,
|
||||
InstanceTypeShadow));
|
||||
@ -1749,11 +1787,13 @@ static void multidrawShadow(unsigned i, Args ...args)
|
||||
(int)ShadowPassCmd::getInstance()->Size[i][T::MaterialType],
|
||||
sizeof(DrawElementsIndirectCommand));
|
||||
}
|
||||
#endif
|
||||
} // multidrawShadow
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void IrrDriver::renderShadows()
|
||||
{
|
||||
#ifndef ANDROID
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
glDepthMask(GL_TRUE);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
@ -1829,6 +1869,7 @@ void IrrDriver::renderShadows()
|
||||
glBindTexture(GL_TEXTURE_2D_ARRAY, m_rtts->getShadowFBO().getRTT()[0]);
|
||||
glGenerateMipmap(GL_TEXTURE_2D_ARRAY);
|
||||
}
|
||||
#endif
|
||||
} // renderShadows
|
||||
|
||||
|
||||
@ -1907,6 +1948,7 @@ void renderRSMShadow(Args ...args)
|
||||
template<typename T, typename... Args>
|
||||
void multidrawRSM(Args...args)
|
||||
{
|
||||
#ifndef ANDROIDD
|
||||
T::InstancedRSMShader::getInstance()->use();
|
||||
glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(T::VertexType,
|
||||
InstanceTypeRSM));
|
||||
@ -1919,6 +1961,7 @@ void multidrawRSM(Args...args)
|
||||
(int)RSMPassCmd::getInstance()->Size[T::MaterialType],
|
||||
sizeof(DrawElementsIndirectCommand));
|
||||
}
|
||||
#endif
|
||||
} // multidrawRSM
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -105,10 +105,12 @@ public:
|
||||
sizeof(LightBaseClass::PointLightInfo),
|
||||
(GLvoid*)(7 * sizeof(float)));
|
||||
|
||||
#ifndef ANDROID
|
||||
glVertexAttribDivisorARB(attrib_Position, 1);
|
||||
glVertexAttribDivisorARB(attrib_Energy, 1);
|
||||
glVertexAttribDivisorARB(attrib_Color, 1);
|
||||
glVertexAttribDivisorARB(attrib_Radius, 1);
|
||||
#endif
|
||||
} // PointLightShader
|
||||
}; // PointLightShader
|
||||
|
||||
@ -155,10 +157,12 @@ public:
|
||||
sizeof(LightBaseClass::PointLightInfo),
|
||||
(GLvoid*)(7 * sizeof(float)));
|
||||
|
||||
#ifndef ANDROID
|
||||
glVertexAttribDivisorARB(attrib_Position, 1);
|
||||
glVertexAttribDivisorARB(attrib_Energy, 1);
|
||||
glVertexAttribDivisorARB(attrib_Color, 1);
|
||||
glVertexAttribDivisorARB(attrib_Radius, 1);
|
||||
#endif
|
||||
} // PointLightScatterShader
|
||||
};
|
||||
|
||||
@ -243,6 +247,7 @@ class RadianceHintsConstructionShader
|
||||
public:
|
||||
RadianceHintsConstructionShader()
|
||||
{
|
||||
#ifndef ANDROID
|
||||
if (CVS->isAMDVertexShaderLayerUsable())
|
||||
{
|
||||
loadProgram(OBJECT, GL_VERTEX_SHADER, "slicedscreenquad.vert",
|
||||
@ -259,6 +264,7 @@ public:
|
||||
assignSamplerNames(0, "ctex", ST_BILINEAR_FILTERED,
|
||||
1, "ntex", ST_BILINEAR_FILTERED,
|
||||
2, "dtex", ST_BILINEAR_FILTERED);
|
||||
#endif
|
||||
} // RadianceHintsConstructionShader
|
||||
}; // RadianceHintsConstructionShader
|
||||
|
||||
@ -272,6 +278,7 @@ class NVWorkaroundRadianceHintsConstructionShader
|
||||
public:
|
||||
NVWorkaroundRadianceHintsConstructionShader()
|
||||
{
|
||||
#ifndef ANDROID
|
||||
loadProgram(OBJECT,GL_VERTEX_SHADER,"slicedscreenquad_nvworkaround.vert",
|
||||
GL_GEOMETRY_SHADER, "rhpassthrough.geom",
|
||||
GL_FRAGMENT_SHADER, "rh.frag");
|
||||
@ -281,6 +288,7 @@ public:
|
||||
assignSamplerNames(0, "ctex", ST_BILINEAR_FILTERED,
|
||||
1, "ntex", ST_BILINEAR_FILTERED,
|
||||
2, "dtex", ST_BILINEAR_FILTERED);
|
||||
#endif
|
||||
} // NVWorkaroundRadianceHintsConstructionShader
|
||||
}; // NVWorkaroundRadianceHintsConstructionShader
|
||||
|
||||
|
@ -76,6 +76,10 @@ RTT::RTT(size_t width, size_t height)
|
||||
|
||||
// All RTTs are currently RGBA16F mostly with stencil. The four tmp RTTs are the same size
|
||||
// as the screen, for use in post-processing.
|
||||
#ifdef ANDROID
|
||||
#define GL_BGRA GL_RGBA
|
||||
#define GL_BGR GL_RGB
|
||||
#endif
|
||||
|
||||
RenderTargetTextures[RTT_TMP1] = generateRTT(res, GL_RGBA16F, GL_BGRA, GL_FLOAT);
|
||||
RenderTargetTextures[RTT_TMP2] = generateRTT(res, GL_RGBA16F, GL_BGRA, GL_FLOAT);
|
||||
|
@ -39,6 +39,7 @@ public:
|
||||
{
|
||||
glGenBuffers(1, &drawindirectcmd);
|
||||
glBindBuffer(GL_DRAW_INDIRECT_BUFFER, drawindirectcmd);
|
||||
#ifndef ANDROID
|
||||
if (CVS->supportsAsyncInstanceUpload())
|
||||
{
|
||||
glBufferStorage(GL_DRAW_INDIRECT_BUFFER, 10000 * sizeof(DrawElementsIndirectCommand), 0, GL_MAP_PERSISTENT_BIT | GL_MAP_WRITE_BIT);
|
||||
@ -46,8 +47,11 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
glBufferData(GL_DRAW_INDIRECT_BUFFER, 10000 * sizeof(DrawElementsIndirectCommand), 0, GL_STREAM_DRAW);
|
||||
#ifndef ANDROID
|
||||
}
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <cstdio>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef ANDROID_DEVICE
|
||||
# include <android/log.h>
|
||||
#endif
|
||||
|
||||
@ -136,7 +136,7 @@ void Log::printMessage(int level, const char *component, const char *format,
|
||||
|
||||
if(level<m_min_log_level) return;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef ANDROID_DEVICE
|
||||
android_LogPriority alp;
|
||||
switch (level)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user