Totally disable code that needes gles 3.1.
This commit is contained in:
parent
3ae175e05a
commit
742fb309df
@ -42,7 +42,6 @@ extern "C" {
|
||||
# endif
|
||||
#elif defined(ANDROID_DEVICE) || defined(USE_GLES2)
|
||||
# include <GLES3/gl3.h>
|
||||
# include <GLES3/gl31.h>
|
||||
# include <GLES3/gl3ext.h>
|
||||
# include <GLES2/gl2ext.h>
|
||||
# define glVertexAttribDivisorARB glVertexAttribDivisor
|
||||
|
@ -76,11 +76,13 @@ public:
|
||||
GLuint m_dest_tu;
|
||||
ComputeShadowBlurVShader()
|
||||
{
|
||||
#if !defined(USE_GLES2) && !defined(ANDROID)
|
||||
loadProgram(OBJECT, GL_COMPUTE_SHADER, "blurshadowV.comp");
|
||||
m_dest_tu = 1;
|
||||
assignUniforms("pixel", "weights");
|
||||
assignSamplerNames(0, "source", ST_NEARED_CLAMPED_FILTERED);
|
||||
assignTextureUnit(m_dest_tu, "dest");
|
||||
#endif
|
||||
} // ComputeShadowBlurVShader
|
||||
|
||||
}; // ComputeShadowBlurVShader
|
||||
@ -137,11 +139,13 @@ public:
|
||||
GLuint m_dest_tu;
|
||||
ComputeGaussian6VBlurShader()
|
||||
{
|
||||
#if !defined(USE_GLES2) && !defined(ANDROID)
|
||||
loadProgram(OBJECT, GL_COMPUTE_SHADER, "gaussian6v.comp");
|
||||
m_dest_tu = 1;
|
||||
assignUniforms("pixel", "weights");
|
||||
assignSamplerNames(0, "source", ST_BILINEAR_CLAMPED_FILTERED);
|
||||
assignTextureUnit(m_dest_tu, "dest");
|
||||
#endif
|
||||
} // ComputeGaussian6VBlurShader
|
||||
}; // ComputeGaussian6VBlurShader
|
||||
|
||||
@ -154,11 +158,13 @@ public:
|
||||
GLuint m_dest_tu;
|
||||
ComputeGaussian6HBlurShader()
|
||||
{
|
||||
#if !defined(USE_GLES2) && !defined(ANDROID)
|
||||
loadProgram(OBJECT, GL_COMPUTE_SHADER, "gaussian6h.comp");
|
||||
m_dest_tu = 1;
|
||||
assignUniforms("pixel", "weights");
|
||||
assignSamplerNames(0, "source", ST_BILINEAR_CLAMPED_FILTERED);
|
||||
assignTextureUnit(m_dest_tu, "dest");
|
||||
#endif
|
||||
} // ComputeGaussian6HBlurShader
|
||||
}; // ComputeGaussian6HBlurShader
|
||||
|
||||
@ -171,11 +177,13 @@ public:
|
||||
GLuint m_dest_tu;
|
||||
ComputeShadowBlurHShader()
|
||||
{
|
||||
#if !defined(USE_GLES2) && !defined(ANDROID)
|
||||
loadProgram(OBJECT, GL_COMPUTE_SHADER, "blurshadowH.comp");
|
||||
m_dest_tu = 1;
|
||||
assignUniforms("pixel", "weights");
|
||||
assignSamplerNames(0, "source", ST_NEARED_CLAMPED_FILTERED);
|
||||
assignTextureUnit(m_dest_tu, "dest");
|
||||
#endif
|
||||
} // ComputeShadowBlurHShader
|
||||
}; // ComputeShadowBlurHShader
|
||||
|
||||
@ -234,17 +242,20 @@ public:
|
||||
GLuint m_dest_tu;
|
||||
ComputeGaussian17TapHShader()
|
||||
{
|
||||
#if !defined(USE_GLES2) && !defined(ANDROID)
|
||||
loadProgram(OBJECT, GL_COMPUTE_SHADER, "bilateralH.comp");
|
||||
m_dest_tu = 2;
|
||||
assignUniforms("pixel");
|
||||
assignSamplerNames(0, "source", ST_NEARED_CLAMPED_FILTERED,
|
||||
1, "depth", ST_NEARED_CLAMPED_FILTERED);
|
||||
assignTextureUnit(m_dest_tu, "dest");
|
||||
#endif
|
||||
} // ComputeGaussian17TapHShader
|
||||
// ------------------------------------------------------------------------
|
||||
void render(const FrameBuffer &fb, const FrameBuffer &auxiliary,
|
||||
int width, int height)
|
||||
{
|
||||
#if !defined(USE_GLES2) && !defined(ANDROID)
|
||||
use();
|
||||
glBindSampler(m_dest_tu, 0);
|
||||
setTextureUnits(fb.getRTT()[0],
|
||||
@ -253,6 +264,7 @@ public:
|
||||
0, GL_WRITE_ONLY, GL_R16F);
|
||||
setUniforms(core::vector2df(1.0f/width, 1.0f/height));
|
||||
glDispatchCompute((int)width / 8 + 1, (int)height / 8 + 1, 1);
|
||||
#endif
|
||||
} // render
|
||||
}; // ComputeGaussian17TapHShader
|
||||
|
||||
@ -290,17 +302,20 @@ public:
|
||||
|
||||
ComputeGaussian17TapVShader()
|
||||
{
|
||||
#if !defined(USE_GLES2) && !defined(ANDROID)
|
||||
loadProgram(OBJECT, GL_COMPUTE_SHADER, "bilateralV.comp");
|
||||
m_dest_tu = 2;
|
||||
assignUniforms("pixel");
|
||||
assignSamplerNames(0, "source", ST_NEARED_CLAMPED_FILTERED,
|
||||
1, "depth", ST_NEARED_CLAMPED_FILTERED);
|
||||
assignTextureUnit(m_dest_tu, "dest");
|
||||
#endif
|
||||
} // ComputeGaussian17TapVShader
|
||||
// ------------------------------------------------------------------------
|
||||
void render(const FrameBuffer &auxiliary, const FrameBuffer &fb,
|
||||
int width, int height)
|
||||
{
|
||||
#if !defined(USE_GLES2) && !defined(ANDROID)
|
||||
use();
|
||||
glBindSampler(m_dest_tu, 0);
|
||||
setTextureUnits(auxiliary.getRTT()[0],
|
||||
@ -310,6 +325,7 @@ public:
|
||||
setUniforms(core::vector2df(1.0f/width, 1.0f/height));
|
||||
glDispatchCompute((int)fb.getWidth() / 8 + 1,
|
||||
(int)fb.getHeight() / 8 + 1, 1);
|
||||
#endif
|
||||
} // render
|
||||
}; // ComputeGaussian17TapVShader
|
||||
|
||||
@ -1114,10 +1130,8 @@ 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
|
||||
@ -1132,6 +1146,7 @@ void PostProcessing::renderGaussian6BlurLayer(FrameBuffer &in_fbo,
|
||||
UserConfigParams::m_shadows_resolution,
|
||||
UserConfigParams::m_shadows_resolution, sigma_h);
|
||||
}
|
||||
#if !defined(USE_GLES2) && !defined(ANDROID)
|
||||
else
|
||||
{
|
||||
const std::vector<float> &weightsV = getGaussianWeight(sigma_v, 7);
|
||||
@ -1166,6 +1181,7 @@ void PostProcessing::renderGaussian6BlurLayer(FrameBuffer &in_fbo,
|
||||
(int)UserConfigParams::m_shadows_resolution / 8 + 1, 1);
|
||||
glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);
|
||||
}
|
||||
#endif
|
||||
glDeleteTextures(1, &layer_tex);
|
||||
} // renderGaussian6BlurLayer
|
||||
|
||||
@ -1191,6 +1207,7 @@ void PostProcessing::renderGaussian6Blur(const FrameBuffer &in_fbo,
|
||||
Gaussian6HBlurShader::getInstance()->render(auxiliary, in_fbo.getWidth(),
|
||||
in_fbo.getHeight(), sigma_h);
|
||||
}
|
||||
#if !defined(USE_GLES2) && !defined(ANDROID)
|
||||
else
|
||||
{
|
||||
const std::vector<float> &weightsV = getGaussianWeight(sigma_v, 7);
|
||||
@ -1223,6 +1240,7 @@ void PostProcessing::renderGaussian6Blur(const FrameBuffer &in_fbo,
|
||||
(int)in_fbo.getHeight() / 8 + 1, 1);
|
||||
glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // renderGaussian6Blur
|
||||
|
||||
@ -1248,8 +1266,12 @@ void PostProcessing::renderGaussian17TapBlur(const FrameBuffer &in_fbo,
|
||||
{
|
||||
assert(in_fbo.getWidth() == auxiliary.getWidth() &&
|
||||
in_fbo.getHeight() == auxiliary.getHeight());
|
||||
|
||||
#if !defined(USE_GLES2) && !defined(ANDROID)
|
||||
if (CVS->supportsComputeShadersFiltering())
|
||||
glMemoryBarrier(GL_FRAMEBUFFER_BARRIER_BIT);
|
||||
#endif
|
||||
|
||||
{
|
||||
if (!CVS->supportsComputeShadersFiltering())
|
||||
{
|
||||
@ -1266,8 +1288,12 @@ void PostProcessing::renderGaussian17TapBlur(const FrameBuffer &in_fbo,
|
||||
in_fbo.getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(USE_GLES2) && !defined(ANDROID)
|
||||
if (CVS->supportsComputeShadersFiltering())
|
||||
glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);
|
||||
#endif
|
||||
|
||||
{
|
||||
if (!CVS->supportsComputeShadersFiltering())
|
||||
{
|
||||
@ -1284,8 +1310,11 @@ void PostProcessing::renderGaussian17TapBlur(const FrameBuffer &in_fbo,
|
||||
in_fbo.getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(USE_GLES2) && !defined(ANDROID)
|
||||
if (CVS->supportsComputeShadersFiltering())
|
||||
glMemoryBarrier(GL_TEXTURE_FETCH_BARRIER_BIT);
|
||||
#endif
|
||||
} // renderGaussian17TapBlur
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -687,6 +687,7 @@ void IrrDriver::renderGlow(std::vector<GlowData>& glows)
|
||||
|
||||
if (CVS->supportsIndirectInstancingRendering())
|
||||
{
|
||||
#if !defined(ANDROID) && !defined(USE_GLES2)
|
||||
glBindBuffer(GL_DRAW_INDIRECT_BUFFER, GlowPassCmd::getInstance()->drawindirectcmd);
|
||||
InstancedColorizeShader::getInstance()->use();
|
||||
|
||||
@ -695,12 +696,10 @@ void IrrDriver::renderGlow(std::vector<GlowData>& glows)
|
||||
{
|
||||
if (GlowPassCmd::getInstance()->Size)
|
||||
{
|
||||
#if !defined(ANDROID) && !defined(USE_GLES2)
|
||||
glMultiDrawElementsIndirect(GL_TRIANGLES, GL_UNSIGNED_SHORT,
|
||||
(const void*)(GlowPassCmd::getInstance()->Offset * sizeof(DrawElementsIndirectCommand)),
|
||||
(int)GlowPassCmd::getInstance()->Size,
|
||||
sizeof(DrawElementsIndirectCommand));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -708,6 +707,7 @@ void IrrDriver::renderGlow(std::vector<GlowData>& glows)
|
||||
for (unsigned i = 0; i < ListInstancedGlow::getInstance()->size(); i++)
|
||||
glDrawElementsIndirect(GL_TRIANGLES, GL_UNSIGNED_SHORT, (const void*)((GlowPassCmd::getInstance()->Offset + i) * sizeof(DrawElementsIndirectCommand)));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
|
||||
|
@ -962,7 +962,6 @@ 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;
|
||||
@ -972,7 +971,6 @@ void draw(const T *Shader, const GLMesh *mesh, uniforms... Args)
|
||||
glDrawElementsBaseVertex(ptype, (int)count, itype,
|
||||
(GLvoid *)mesh->vaoOffset,
|
||||
(int)mesh->vaoBaseVertex);
|
||||
#endif
|
||||
} // draw
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -1113,6 +1111,7 @@ void renderMeshes1stPass()
|
||||
template<typename T, typename...Args>
|
||||
void renderInstancedMeshes1stPass(Args...args)
|
||||
{
|
||||
#if !defined(ANDROID) && !defined(USE_GLES2)
|
||||
std::vector<GLMesh *> &meshes = T::InstancedList::getInstance()->SolidPass;
|
||||
T::InstancedFirstPassShader::getInstance()->use();
|
||||
glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(T::VertexType, T::Instance));
|
||||
@ -1133,6 +1132,7 @@ void renderInstancedMeshes1stPass(Args...args)
|
||||
T::InstancedFirstPassShader::getInstance()->setUniforms(args...);
|
||||
glDrawElementsIndirect(GL_TRIANGLES, GL_UNSIGNED_SHORT, (const void*)((SolidPassCmd::getInstance()->Offset[T::MaterialType] + i) * sizeof(DrawElementsIndirectCommand)));
|
||||
}
|
||||
#endif
|
||||
} // renderInstancedMeshes1stPass
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -1160,8 +1160,10 @@ void IrrDriver::renderSolidFirstPass()
|
||||
{
|
||||
windDir = getWindDir();
|
||||
|
||||
#if !defined(ANDROID) && !defined(USE_GLES2)
|
||||
if (CVS->supportsIndirectInstancingRendering())
|
||||
glBindBuffer(GL_DRAW_INDIRECT_BUFFER, SolidPassCmd::getInstance()->drawindirectcmd);
|
||||
#endif
|
||||
|
||||
{
|
||||
ScopedGPUTimer Timer(getGPUTimer(Q_SOLID_PASS1));
|
||||
@ -1179,6 +1181,7 @@ void IrrDriver::renderSolidFirstPass()
|
||||
renderMeshes1stPass<SphereMap, 2, 1>();
|
||||
renderMeshes1stPass<DetailMat, 2, 1>();
|
||||
|
||||
#if !defined(ANDROID) && !defined(USE_GLES2)
|
||||
if (CVS->isAZDOEnabled())
|
||||
{
|
||||
multidraw1stPass<DefaultMaterial>();
|
||||
@ -1200,6 +1203,7 @@ void IrrDriver::renderSolidFirstPass()
|
||||
renderInstancedMeshes1stPass<DetailMat>();
|
||||
renderInstancedMeshes1stPass<NormalMat>();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} // renderSolidFirstPass
|
||||
|
||||
@ -1246,6 +1250,7 @@ void renderMeshes2ndPass( const std::vector<uint64_t> &Prefilled_Handle,
|
||||
template<typename T, typename...Args>
|
||||
void renderInstancedMeshes2ndPass(const std::vector<GLuint> &Prefilled_tex, Args...args)
|
||||
{
|
||||
#if !defined(ANDROID) && !defined(USE_GLES2)
|
||||
std::vector<GLMesh *> &meshes = T::InstancedList::getInstance()->SolidPass;
|
||||
T::InstancedSecondPassShader::getInstance()->use();
|
||||
glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(T::VertexType,
|
||||
@ -1261,6 +1266,7 @@ void renderInstancedMeshes2ndPass(const std::vector<GLuint> &Prefilled_tex, Args
|
||||
(const void*)((SolidPassCmd::getInstance()->Offset[T::MaterialType] + i)
|
||||
* sizeof(DrawElementsIndirectCommand)));
|
||||
}
|
||||
#endif
|
||||
} // renderInstancedMeshes2ndPass
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -1319,7 +1325,9 @@ void IrrDriver::renderSolidSecondPass()
|
||||
if (!glIsTextureHandleResidentARB(DepthHandle))
|
||||
glMakeTextureHandleResidentARB(DepthHandle);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(ANDROID) && !defined(USE_GLES2)
|
||||
if (CVS->supportsIndirectInstancingRendering())
|
||||
glBindBuffer(GL_DRAW_INDIRECT_BUFFER,
|
||||
SolidPassCmd::getInstance()->drawindirectcmd);
|
||||
@ -1378,9 +1386,7 @@ void IrrDriver::renderSolidSecondPass()
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (CVS->supportsIndirectInstancingRendering())
|
||||
else if (CVS->supportsIndirectInstancingRendering())
|
||||
{
|
||||
renderInstancedMeshes2ndPass<DefaultMaterial>(DiffSpecSSAOTex);
|
||||
renderInstancedMeshes2ndPass<AlphaRef>(DiffSpecSSAOTex);
|
||||
@ -1393,10 +1399,8 @@ 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];
|
||||
@ -1406,14 +1410,13 @@ 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
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} // renderSolidSecondPass
|
||||
|
||||
@ -1421,6 +1424,7 @@ void IrrDriver::renderSolidSecondPass()
|
||||
template<typename T>
|
||||
static void renderInstancedMeshNormals()
|
||||
{
|
||||
#if !defined(ANDROID) && !defined(USE_GLES2)
|
||||
std::vector<GLMesh *> &meshes = T::InstancedList::getInstance()->SolidPass;
|
||||
NormalVisualizer::getInstance()->use();
|
||||
glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(T::VertexType, T::Instance));
|
||||
@ -1431,6 +1435,7 @@ static void renderInstancedMeshNormals()
|
||||
(const void*)((SolidPassCmd::getInstance()->Offset[T::MaterialType] + i)
|
||||
* sizeof(DrawElementsIndirectCommand)));
|
||||
}
|
||||
#endif
|
||||
} // renderInstancedMeshNormals
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -1454,6 +1459,7 @@ static void renderMultiMeshNormals()
|
||||
// ----------------------------------------------------------------------------
|
||||
void IrrDriver::renderNormalsVisualisation()
|
||||
{
|
||||
#if !defined(ANDROID) && !defined(USE_GLES2)
|
||||
if (CVS->isAZDOEnabled()) {
|
||||
renderMultiMeshNormals<DefaultMaterial>();
|
||||
renderMultiMeshNormals<AlphaRef>();
|
||||
@ -1471,6 +1477,7 @@ void IrrDriver::renderNormalsVisualisation()
|
||||
renderInstancedMeshNormals<DetailMat>();
|
||||
renderInstancedMeshNormals<NormalMat>();
|
||||
}
|
||||
#endif
|
||||
} // renderNormalsVisualisation
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -1510,8 +1517,6 @@ static video::ITexture *displaceTex = 0;
|
||||
// ----------------------------------------------------------------------------
|
||||
void IrrDriver::renderTransparent()
|
||||
{
|
||||
|
||||
#ifndef ANDROID
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthMask(GL_FALSE);
|
||||
glEnable(GL_BLEND);
|
||||
@ -1645,15 +1650,12 @@ void IrrDriver::renderTransparent()
|
||||
irr_driver->getFBO(FBO_COLORS).getWidth(),
|
||||
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,7 +1664,6 @@ 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
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -1715,6 +1716,7 @@ void renderShadow(unsigned cascade)
|
||||
template<typename T, typename...Args>
|
||||
void renderInstancedShadow(unsigned cascade, Args ...args)
|
||||
{
|
||||
#if !defined(ANDROID) && !defined(USE_GLES2)
|
||||
T::InstancedShadowPassShader::getInstance()->use();
|
||||
glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(T::VertexType,
|
||||
InstanceTypeShadow));
|
||||
@ -1731,7 +1733,7 @@ void renderInstancedShadow(unsigned cascade, Args ...args)
|
||||
(const void*)((tmp)
|
||||
* sizeof(DrawElementsIndirectCommand)));
|
||||
} // for i
|
||||
|
||||
#endif
|
||||
} // renderInstancedShadow
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -1892,6 +1894,7 @@ void drawRSM(const core::matrix4 & rsm_matrix)
|
||||
template<typename T, typename...Args>
|
||||
void renderRSMShadow(Args ...args)
|
||||
{
|
||||
#if !defined(ANDROID) && !defined(USE_GLES2)
|
||||
T::InstancedRSMShader::getInstance()->use();
|
||||
glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(T::VertexType, InstanceTypeRSM));
|
||||
auto t = T::InstancedList::getInstance()->RSM;
|
||||
@ -1906,6 +1909,7 @@ void renderRSMShadow(Args ...args)
|
||||
(const void*)((RSMPassCmd::getInstance()->Offset[T::MaterialType] + i)
|
||||
* sizeof(DrawElementsIndirectCommand)));
|
||||
}
|
||||
#endif
|
||||
} // renderRSMShadow
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -1945,6 +1949,7 @@ void IrrDriver::renderRSM()
|
||||
drawRSM<DetailMat, 3, 1>(rsm_matrix);
|
||||
drawRSM<SplattingMat, 1>(rsm_matrix);
|
||||
|
||||
#if !defined(ANDROID) && !defined(USE_GLES2)
|
||||
if (CVS->supportsIndirectInstancingRendering())
|
||||
glBindBuffer(GL_DRAW_INDIRECT_BUFFER,
|
||||
RSMPassCmd::getInstance()->drawindirectcmd);
|
||||
@ -1965,5 +1970,7 @@ void IrrDriver::renderRSM()
|
||||
renderRSMShadow<NormalMat>(rsm_matrix);
|
||||
renderRSMShadow<DetailMat>(rsm_matrix);
|
||||
}
|
||||
#endif
|
||||
|
||||
getShadowMatrices()->setRSMMapAvail(true);
|
||||
} // renderRSM
|
||||
|
@ -72,6 +72,7 @@ GLuint ShaderBase::loadShader(const std::string &file, unsigned type)
|
||||
code << "#version 300 es\n";
|
||||
#endif
|
||||
|
||||
#if !defined(USE_GLES2) && !defined(ANDROID)
|
||||
// Some drivers report that the compute shaders extension is available,
|
||||
// but they report only OpenGL 3.x version, and thus these extensions
|
||||
// must be enabled manually. Otherwise the shaders compilation will fail
|
||||
@ -86,6 +87,7 @@ GLuint ShaderBase::loadShader(const std::string &file, unsigned type)
|
||||
if (CVS->isARBArraysOfArraysUsable())
|
||||
code << "#extension GL_ARB_arrays_of_arrays : enable\n";
|
||||
}
|
||||
#endif
|
||||
|
||||
if (CVS->isAMDVertexShaderLayerUsable())
|
||||
code << "#extension GL_AMD_vertex_shader_layer : enable\n";
|
||||
|
@ -222,6 +222,7 @@ core::matrix4 ShadowMatrices::getTighestFitOrthoProj(const core::matrix4 &transf
|
||||
void ShadowMatrices::updateSplitAndLightcoordRangeFromComputeShaders(unsigned int width,
|
||||
unsigned int height)
|
||||
{
|
||||
#if !defined(USE_GLES2) && !defined(ANDROID)
|
||||
struct CascadeBoundingBox
|
||||
{
|
||||
int xmin;
|
||||
@ -284,6 +285,7 @@ void ShadowMatrices::updateSplitAndLightcoordRangeFromComputeShaders(unsigned in
|
||||
SharedGPUObjects::getViewProjectionMatricesUBO());
|
||||
glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0,
|
||||
80 * sizeof(float), 4 * 16 * sizeof(float));
|
||||
#endif
|
||||
} // updateSplitAndLightcoordRangeFromComputeShaders
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -692,10 +692,12 @@ PROFILER_POP_CPU_MARKER();
|
||||
size_t offset = 0, current_cmd = 0;
|
||||
if (!CVS->supportsAsyncInstanceUpload())
|
||||
{
|
||||
#if !defined(USE_GLES2) && !defined(ANDROID)
|
||||
glBindBuffer(GL_ARRAY_BUFFER, VAOManager::getInstance()->getInstanceBuffer(InstanceTypeDualTex));
|
||||
InstanceBufferDualTex = (InstanceDataDualTex*)glMapBufferRange(GL_ARRAY_BUFFER, 0, 10000 * sizeof(InstanceDataDualTex), GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
glBindBuffer(GL_DRAW_INDIRECT_BUFFER, SolidPassCmd::getInstance()->drawindirectcmd);
|
||||
CmdBuffer = (DrawElementsIndirectCommand*)glMapBufferRange(GL_DRAW_INDIRECT_BUFFER, 0, 10000 * sizeof(DrawElementsIndirectCommand), GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -740,8 +742,10 @@ PROFILER_POP_CPU_MARKER();
|
||||
|
||||
if (!CVS->supportsAsyncInstanceUpload())
|
||||
{
|
||||
#if !defined(USE_GLES2) && !defined(ANDROID)
|
||||
glUnmapBuffer(GL_ARRAY_BUFFER);
|
||||
glUnmapBuffer(GL_DRAW_INDIRECT_BUFFER);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#pragma omp section
|
||||
@ -750,10 +754,12 @@ PROFILER_POP_CPU_MARKER();
|
||||
|
||||
if (!CVS->supportsAsyncInstanceUpload())
|
||||
{
|
||||
#if !defined(USE_GLES2) && !defined(ANDROID)
|
||||
glBindBuffer(GL_ARRAY_BUFFER, VAOManager::getInstance()->getInstanceBuffer(InstanceTypeGlow));
|
||||
GlowInstanceBuffer = (GlowInstanceData*)glMapBufferRange(GL_ARRAY_BUFFER, 0, 10000 * sizeof(InstanceDataDualTex), GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
glBindBuffer(GL_DRAW_INDIRECT_BUFFER, GlowPassCmd::getInstance()->drawindirectcmd);
|
||||
GlowCmdBuffer = (DrawElementsIndirectCommand*)glMapBufferRange(GL_DRAW_INDIRECT_BUFFER, 0, 10000 * sizeof(DrawElementsIndirectCommand), GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Glow
|
||||
@ -774,8 +780,10 @@ PROFILER_POP_CPU_MARKER();
|
||||
|
||||
if (!CVS->supportsAsyncInstanceUpload())
|
||||
{
|
||||
#if !defined(USE_GLES2) && !defined(ANDROID)
|
||||
glUnmapBuffer(GL_ARRAY_BUFFER);
|
||||
glUnmapBuffer(GL_DRAW_INDIRECT_BUFFER);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#pragma omp section
|
||||
@ -785,10 +793,12 @@ PROFILER_POP_CPU_MARKER();
|
||||
size_t offset = 0, current_cmd = 0;
|
||||
if (!CVS->supportsAsyncInstanceUpload())
|
||||
{
|
||||
#if !defined(USE_GLES2) && !defined(ANDROID)
|
||||
glBindBuffer(GL_ARRAY_BUFFER, VAOManager::getInstance()->getInstanceBuffer(InstanceTypeShadow));
|
||||
ShadowInstanceBuffer = (InstanceDataSingleTex*)glMapBufferRange(GL_ARRAY_BUFFER, 0, 10000 * sizeof(InstanceDataDualTex), GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
glBindBuffer(GL_DRAW_INDIRECT_BUFFER, ShadowPassCmd::getInstance()->drawindirectcmd);
|
||||
ShadowCmdBuffer = (DrawElementsIndirectCommand*)glMapBufferRange(GL_DRAW_INDIRECT_BUFFER, 0, 10000 * sizeof(DrawElementsIndirectCommand), GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
#endif
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < 4; i++)
|
||||
@ -810,8 +820,10 @@ PROFILER_POP_CPU_MARKER();
|
||||
}
|
||||
if (!CVS->supportsAsyncInstanceUpload())
|
||||
{
|
||||
#if !defined(USE_GLES2) && !defined(ANDROID)
|
||||
glUnmapBuffer(GL_ARRAY_BUFFER);
|
||||
glUnmapBuffer(GL_DRAW_INDIRECT_BUFFER);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#pragma omp section
|
||||
@ -820,10 +832,12 @@ PROFILER_POP_CPU_MARKER();
|
||||
size_t offset = 0, current_cmd = 0;
|
||||
if (!CVS->supportsAsyncInstanceUpload())
|
||||
{
|
||||
#if !defined(USE_GLES2) && !defined(ANDROID)
|
||||
glBindBuffer(GL_ARRAY_BUFFER, VAOManager::getInstance()->getInstanceBuffer(InstanceTypeRSM));
|
||||
RSMInstanceBuffer = (InstanceDataSingleTex*)glMapBufferRange(GL_ARRAY_BUFFER, 0, 10000 * sizeof(InstanceDataDualTex), GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
glBindBuffer(GL_DRAW_INDIRECT_BUFFER, RSMPassCmd::getInstance()->drawindirectcmd);
|
||||
RSMCmdBuffer = (DrawElementsIndirectCommand*)glMapBufferRange(GL_DRAW_INDIRECT_BUFFER, 0, 10000 * sizeof(DrawElementsIndirectCommand), GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Default Material
|
||||
@ -849,8 +863,10 @@ PROFILER_POP_CPU_MARKER();
|
||||
|
||||
if (!CVS->supportsAsyncInstanceUpload())
|
||||
{
|
||||
#if !defined(USE_GLES2) && !defined(ANDROID)
|
||||
glUnmapBuffer(GL_ARRAY_BUFFER);
|
||||
glUnmapBuffer(GL_DRAW_INDIRECT_BUFFER);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,11 +37,9 @@ public:
|
||||
DrawElementsIndirectCommand *Ptr;
|
||||
CommandBuffer()
|
||||
{
|
||||
#if !defined(ANDROID) && !defined(USE_GLES2)
|
||||
glGenBuffers(1, &drawindirectcmd);
|
||||
#if !defined(ANDROID) && !defined(USE_GLES2)
|
||||
glBindBuffer(GL_DRAW_INDIRECT_BUFFER, drawindirectcmd);
|
||||
#endif
|
||||
#if !defined(ANDROID) && !defined(USE_GLES2)
|
||||
if (CVS->supportsAsyncInstanceUpload())
|
||||
{
|
||||
glBufferStorage(GL_DRAW_INDIRECT_BUFFER, 10000 * sizeof(DrawElementsIndirectCommand), 0, GL_MAP_PERSISTENT_BIT | GL_MAP_WRITE_BIT);
|
||||
@ -49,9 +47,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
glBufferData(GL_DRAW_INDIRECT_BUFFER, 10000 * sizeof(DrawElementsIndirectCommand), 0, GL_STREAM_DRAW);
|
||||
#if !defined(ANDROID) && !defined(USE_GLES2)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user