Merge branch 'OpenGL3-upgrade' into NDK
Conflicts: src/Nazara/Graphics/SkyboxBackground.cpp src/Nazara/Renderer/RenderTexture.cpp src/Nazara/Renderer/Renderer.cpp Former-commit-id: e8914d4e32a689b7df365dca15a438f10722530c
This commit is contained in:
@@ -11,20 +11,12 @@
|
||||
#include <stdexcept>
|
||||
#include <Nazara/Renderer/Debug.hpp>
|
||||
|
||||
NzGpuQuery::NzGpuQuery() :
|
||||
m_id(0)
|
||||
NzGpuQuery::NzGpuQuery()
|
||||
{
|
||||
if (IsSupported())
|
||||
{
|
||||
NzContext::EnsureContext();
|
||||
NzContext::EnsureContext();
|
||||
|
||||
glGenQueries(1, reinterpret_cast<GLuint*>(&m_id));
|
||||
}
|
||||
else
|
||||
{
|
||||
NazaraError("Occlusion queries not supported");
|
||||
return;
|
||||
}
|
||||
m_id = 0;
|
||||
glGenQueries(1, reinterpret_cast<GLuint*>(&m_id));
|
||||
|
||||
#ifdef NAZARA_DEBUG
|
||||
if (!m_id)
|
||||
@@ -110,15 +102,13 @@ bool NzGpuQuery::IsModeSupported(nzGpuQueryMode mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case nzGpuQueryMode_AnySamplesPassed:
|
||||
case nzGpuQueryMode_TimeElapsed:
|
||||
return NzOpenGL::GetVersion() >= 330;
|
||||
|
||||
case nzGpuQueryMode_AnySamplesPassedConservative:
|
||||
return NzOpenGL::GetVersion() >= 430;
|
||||
|
||||
case nzGpuQueryMode_AnySamplesPassed:
|
||||
case nzGpuQueryMode_PrimitiveGenerated:
|
||||
case nzGpuQueryMode_SamplesPassed:
|
||||
case nzGpuQueryMode_TimeElapsed:
|
||||
case nzGpuQueryMode_TransformFeedbackPrimitivesWritten:
|
||||
return true;
|
||||
}
|
||||
@@ -126,8 +116,3 @@ bool NzGpuQuery::IsModeSupported(nzGpuQueryMode mode)
|
||||
NazaraError("Gpu Query mode not handled (0x" + NzString::Number(mode, 16) + ')');
|
||||
return false;
|
||||
}
|
||||
|
||||
bool NzGpuQuery::IsSupported()
|
||||
{
|
||||
return NzRenderer::HasCapability(nzRendererCap_OcclusionQuery);
|
||||
}
|
||||
|
||||
@@ -800,10 +800,10 @@ bool NzOpenGL::Initialize()
|
||||
|
||||
NazaraDebug("OpenGL version: " + NzString::Number(major) + '.' + NzString::Number(minor));
|
||||
|
||||
// Le moteur ne fonctionnera pas avec OpenGL 1.x, autant s'arrêter là si c'est le cas
|
||||
if (s_openglVersion < 200)
|
||||
// Le moteur nécessite OpenGL 3.3, autant s'arrêter là si ce n'est pas le cas
|
||||
if (s_openglVersion < 330)
|
||||
{
|
||||
NazaraError("OpenGL " + NzString::Number(major) + '.' + NzString::Number(minor) + " detected (2.0 required). Please upgrade your drivers or your video card");
|
||||
NazaraError("OpenGL " + NzString::Number(major) + '.' + NzString::Number(minor) + " detected (3.3 required). Please upgrade your drivers or your video card");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -832,10 +832,8 @@ bool NzOpenGL::Initialize()
|
||||
|
||||
s_glslVersion = major*100 + minor*10; // GLSL 3.3 => 330
|
||||
|
||||
// Possible uniquement dans le cas où le GLSL vient d'une extension d'OpenGL 1
|
||||
// Ce qui est rejeté il y a un moment déjà, mais on doit s'attendre à tout de la part d'un driver...
|
||||
// (Exemple: Un driver OpenGL 2 mais ne supportant que le GLSL 100)
|
||||
if (s_glslVersion < 110)
|
||||
// Normalement rejeté il y a un moment déjà, mais on doit s'attendre à tout de la part d'un driver...
|
||||
if (s_glslVersion < 330)
|
||||
{
|
||||
NazaraError("GLSL version is too low, please upgrade your drivers or your video card");
|
||||
return false;
|
||||
@@ -857,18 +855,26 @@ bool NzOpenGL::Initialize()
|
||||
{
|
||||
glActiveTexture = reinterpret_cast<PFNGLACTIVETEXTUREPROC>(LoadEntry("glActiveTexture"));
|
||||
glAttachShader = reinterpret_cast<PFNGLATTACHSHADERPROC>(LoadEntry("glAttachShader"));
|
||||
glBeginConditionalRender = reinterpret_cast<PFNGLBEGINCONDITIONALRENDERPROC>(LoadEntry("glBeginConditionalRender"));
|
||||
glBeginQuery = reinterpret_cast<PFNGLBEGINQUERYPROC>(LoadEntry("glBeginQuery"));
|
||||
glBindAttribLocation = reinterpret_cast<PFNGLBINDATTRIBLOCATIONPROC>(LoadEntry("glBindAttribLocation"));
|
||||
glBindBuffer = reinterpret_cast<PFNGLBINDBUFFERPROC>(LoadEntry("glBindBuffer"));
|
||||
glBindFragDataLocation = reinterpret_cast<PFNGLBINDFRAGDATALOCATIONPROC>(LoadEntry("glBindFragDataLocation"));
|
||||
glBindFramebuffer = reinterpret_cast<PFNGLBINDFRAMEBUFFERPROC>(LoadEntry("glBindFramebuffer"));
|
||||
glBindRenderbuffer = reinterpret_cast<PFNGLBINDRENDERBUFFERPROC>(LoadEntry("glBindRenderbuffer"));
|
||||
glBindSampler = reinterpret_cast<PFNGLBINDSAMPLERPROC>(LoadEntry("glBindSampler"));
|
||||
glBindTexture = reinterpret_cast<PFNGLBINDTEXTUREPROC>(LoadEntry("glBindTexture"));
|
||||
glBindVertexArray = reinterpret_cast<PFNGLBINDVERTEXARRAYPROC>(LoadEntry("glBindVertexArray"));
|
||||
glBlendFunc = reinterpret_cast<PFNGLBLENDFUNCPROC>(LoadEntry("glBlendFunc"));
|
||||
glBlendFuncSeparate = reinterpret_cast<PFNGLBLENDFUNCSEPARATEPROC>(LoadEntry("glBlendFuncSeparate"));
|
||||
glBlitFramebuffer = reinterpret_cast<PFNGLBLITFRAMEBUFFERPROC>(LoadEntry("glBlitFramebuffer"));
|
||||
glBufferData = reinterpret_cast<PFNGLBUFFERDATAPROC>(LoadEntry("glBufferData"));
|
||||
glBufferSubData = reinterpret_cast<PFNGLBUFFERSUBDATAPROC>(LoadEntry("glBufferSubData"));
|
||||
glClear = reinterpret_cast<PFNGLCLEARPROC>(LoadEntry("glClear"));
|
||||
glClearColor = reinterpret_cast<PFNGLCLEARCOLORPROC>(LoadEntry("glClearColor"));
|
||||
glClearDepth = reinterpret_cast<PFNGLCLEARDEPTHPROC>(LoadEntry("glClearDepth"));
|
||||
glClearStencil = reinterpret_cast<PFNGLCLEARSTENCILPROC>(LoadEntry("glClearStencil"));
|
||||
glCheckFramebufferStatus = reinterpret_cast<PFNGLCHECKFRAMEBUFFERSTATUSPROC>(LoadEntry("glCheckFramebufferStatus"));
|
||||
glCreateProgram = reinterpret_cast<PFNGLCREATEPROGRAMPROC>(LoadEntry("glCreateProgram"));
|
||||
glCreateShader = reinterpret_cast<PFNGLCREATESHADERPROC>(LoadEntry("glCreateShader"));
|
||||
glColorMask = reinterpret_cast<PFNGLCOLORMASKPROC>(LoadEntry("glColorMask"));
|
||||
@@ -876,25 +882,43 @@ bool NzOpenGL::Initialize()
|
||||
glCompileShader = reinterpret_cast<PFNGLCOMPILESHADERPROC>(LoadEntry("glCompileShader"));
|
||||
glCopyTexSubImage2D = reinterpret_cast<PFNGLCOPYTEXSUBIMAGE2DPROC>(LoadEntry("glCopyTexSubImage2D"));
|
||||
glDeleteBuffers = reinterpret_cast<PFNGLDELETEBUFFERSPROC>(LoadEntry("glDeleteBuffers"));
|
||||
glDeleteFramebuffers = reinterpret_cast<PFNGLDELETEFRAMEBUFFERSPROC>(LoadEntry("glDeleteFramebuffers"));
|
||||
glDeleteQueries = reinterpret_cast<PFNGLDELETEQUERIESPROC>(LoadEntry("glDeleteQueries"));
|
||||
glDeleteProgram = reinterpret_cast<PFNGLDELETEPROGRAMPROC>(LoadEntry("glDeleteProgram"));
|
||||
glDeleteRenderbuffers = reinterpret_cast<PFNGLDELETERENDERBUFFERSPROC>(LoadEntry("glDeleteRenderbuffers"));
|
||||
glDeleteSamplers = reinterpret_cast<PFNGLDELETESAMPLERSPROC>(LoadEntry("glDeleteSamplers"));
|
||||
glDeleteShader = reinterpret_cast<PFNGLDELETESHADERPROC>(LoadEntry("glDeleteShader"));
|
||||
glDeleteTextures = reinterpret_cast<PFNGLDELETETEXTURESPROC>(LoadEntry("glDeleteTextures"));
|
||||
glDeleteVertexArrays = reinterpret_cast<PFNGLDELETEVERTEXARRAYSPROC>(LoadEntry("glDeleteVertexArrays"));
|
||||
glDepthFunc = reinterpret_cast<PFNGLDEPTHFUNCPROC>(LoadEntry("glDepthFunc"));
|
||||
glDepthMask = reinterpret_cast<PFNGLDEPTHMASKPROC>(LoadEntry("glDepthMask"));
|
||||
glDisable = reinterpret_cast<PFNGLDISABLEPROC>(LoadEntry("glDisable"));
|
||||
glDisableVertexAttribArray = reinterpret_cast<PFNGLDISABLEVERTEXATTRIBARRAYPROC>(LoadEntry("glDisableVertexAttribArray"));
|
||||
glDrawArrays = reinterpret_cast<PFNGLDRAWARRAYSPROC>(LoadEntry("glDrawArrays"));
|
||||
glDrawArraysInstanced = reinterpret_cast<PFNGLDRAWARRAYSINSTANCEDPROC>(LoadEntry("glDrawArraysInstanced"));
|
||||
glDrawBuffer = reinterpret_cast<PFNGLDRAWBUFFERPROC>(LoadEntry("glDrawBuffer"));
|
||||
glDrawBuffers = reinterpret_cast<PFNGLDRAWBUFFERSPROC>(LoadEntry("glDrawBuffers"));
|
||||
glDrawElements = reinterpret_cast<PFNGLDRAWELEMENTSPROC>(LoadEntry("glDrawElements"));
|
||||
glDrawElementsInstanced = reinterpret_cast<PFNGLDRAWELEMENTSINSTANCEDPROC>(LoadEntry("glDrawElementsInstanced"));
|
||||
glEnable = reinterpret_cast<PFNGLENABLEPROC>(LoadEntry("glEnable"));
|
||||
glEnableVertexAttribArray = reinterpret_cast<PFNGLENABLEVERTEXATTRIBARRAYPROC>(LoadEntry("glEnableVertexAttribArray"));
|
||||
glEndConditionalRender = reinterpret_cast<PFNGLENDCONDITIONALRENDERPROC>(LoadEntry("glEndConditionalRender"));
|
||||
glEndQuery = reinterpret_cast<PFNGLENDQUERYPROC>(LoadEntry("glEndQuery"));
|
||||
glFlush = reinterpret_cast<PFNGLFLUSHPROC>(LoadEntry("glFlush"));
|
||||
glFramebufferRenderbuffer = reinterpret_cast<PFNGLFRAMEBUFFERRENDERBUFFERPROC>(LoadEntry("glFramebufferRenderbuffer"));
|
||||
glFramebufferTexture = reinterpret_cast<PFNGLFRAMEBUFFERTEXTUREPROC>(LoadEntry("glFramebufferTexture"));
|
||||
glFramebufferTexture1D = reinterpret_cast<PFNGLFRAMEBUFFERTEXTURE1DPROC>(LoadEntry("glFramebufferTexture1D"));
|
||||
glFramebufferTexture2D = reinterpret_cast<PFNGLFRAMEBUFFERTEXTURE2DPROC>(LoadEntry("glFramebufferTexture2D"));
|
||||
glFramebufferTexture3D = reinterpret_cast<PFNGLFRAMEBUFFERTEXTURE3DPROC>(LoadEntry("glFramebufferTexture3D"));
|
||||
glFramebufferTextureLayer = reinterpret_cast<PFNGLFRAMEBUFFERTEXTURELAYERPROC>(LoadEntry("glFramebufferTextureLayer"));
|
||||
glGenerateMipmap = reinterpret_cast<PFNGLGENERATEMIPMAPPROC>(LoadEntry("glGenerateMipmap"));
|
||||
glGenBuffers = reinterpret_cast<PFNGLGENBUFFERSPROC>(LoadEntry("glGenBuffers"));
|
||||
glGenFramebuffers = reinterpret_cast<PFNGLGENFRAMEBUFFERSPROC>(LoadEntry("glGenFramebuffers"));
|
||||
glGenQueries = reinterpret_cast<PFNGLGENQUERIESPROC>(LoadEntry("glGenQueries"));
|
||||
glGenRenderbuffers = reinterpret_cast<PFNGLGENRENDERBUFFERSPROC>(LoadEntry("glGenRenderbuffers"));
|
||||
glGenSamplers = reinterpret_cast<PFNGLGENSAMPLERSPROC>(LoadEntry("glGenSamplers"));
|
||||
glGenTextures = reinterpret_cast<PFNGLGENTEXTURESPROC>(LoadEntry("glGenTextures"));
|
||||
glGenVertexArrays = reinterpret_cast<PFNGLGENVERTEXARRAYSPROC>(LoadEntry("glGenVertexArrays"));
|
||||
glGetActiveUniform = reinterpret_cast<PFNGLGETACTIVEUNIFORMPROC>(LoadEntry("glGetActiveUniform"));
|
||||
glGetBooleanv = reinterpret_cast<PFNGLGETBOOLEANVPROC>(LoadEntry("glGetBooleanv"));
|
||||
glGetBufferParameteriv = reinterpret_cast<PFNGLGETBUFFERPARAMETERIVPROC>(LoadEntry("glGetBufferParameteriv"));
|
||||
@@ -909,6 +933,7 @@ bool NzOpenGL::Initialize()
|
||||
glGetShaderInfoLog = reinterpret_cast<PFNGLGETSHADERINFOLOGPROC>(LoadEntry("glGetShaderInfoLog"));
|
||||
glGetShaderiv = reinterpret_cast<PFNGLGETSHADERIVPROC>(LoadEntry("glGetShaderiv"));
|
||||
glGetShaderSource = reinterpret_cast<PFNGLGETSHADERSOURCEPROC>(LoadEntry("glGetShaderSource"));
|
||||
glGetStringi = reinterpret_cast<PFNGLGETSTRINGIPROC>(LoadEntry("glGetStringi"));
|
||||
glGetTexImage = reinterpret_cast<PFNGLGETTEXIMAGEPROC>(LoadEntry("glGetTexImage"));
|
||||
glGetTexLevelParameterfv = reinterpret_cast<PFNGLGETTEXLEVELPARAMETERFVPROC>(LoadEntry("glGetTexLevelParameterfv"));
|
||||
glGetTexLevelParameteriv = reinterpret_cast<PFNGLGETTEXLEVELPARAMETERIVPROC>(LoadEntry("glGetTexLevelParameteriv"));
|
||||
@@ -919,10 +944,14 @@ bool NzOpenGL::Initialize()
|
||||
glLineWidth = reinterpret_cast<PFNGLLINEWIDTHPROC>(LoadEntry("glLineWidth"));
|
||||
glLinkProgram = reinterpret_cast<PFNGLLINKPROGRAMPROC>(LoadEntry("glLinkProgram"));
|
||||
glMapBuffer = reinterpret_cast<PFNGLMAPBUFFERPROC>(LoadEntry("glMapBuffer"));
|
||||
glMapBufferRange = reinterpret_cast<PFNGLMAPBUFFERRANGEPROC>(LoadEntry("glMapBufferRange"));
|
||||
glPixelStorei = reinterpret_cast<PFNGLPIXELSTOREIPROC>(LoadEntry("glPixelStorei"));
|
||||
glPointSize = reinterpret_cast<PFNGLPOINTSIZEPROC>(LoadEntry("glPointSize"));
|
||||
glPolygonMode = reinterpret_cast<PFNGLPOLYGONMODEPROC>(LoadEntry("glPolygonMode"));
|
||||
glReadPixels = reinterpret_cast<PFNGLREADPIXELSPROC>(LoadEntry("glReadPixels"));
|
||||
glRenderbufferStorage = reinterpret_cast<PFNGLRENDERBUFFERSTORAGEPROC>(LoadEntry("glRenderbufferStorage"));
|
||||
glSamplerParameterf = reinterpret_cast<PFNGLSAMPLERPARAMETERFPROC>(LoadEntry("glSamplerParameterf"));
|
||||
glSamplerParameteri = reinterpret_cast<PFNGLSAMPLERPARAMETERIPROC>(LoadEntry("glSamplerParameteri"));
|
||||
glScissor = reinterpret_cast<PFNGLSCISSORPROC>(LoadEntry("glScissor"));
|
||||
glShaderSource = reinterpret_cast<PFNGLSHADERSOURCEPROC>(LoadEntry("glShaderSource"));
|
||||
glStencilFunc = reinterpret_cast<PFNGLSTENCILFUNCPROC>(LoadEntry("glStencilFunc"));
|
||||
@@ -949,7 +978,9 @@ bool NzOpenGL::Initialize()
|
||||
glUnmapBuffer = reinterpret_cast<PFNGLUNMAPBUFFERPROC>(LoadEntry("glUnmapBuffer"));
|
||||
glUseProgram = reinterpret_cast<PFNGLUSEPROGRAMPROC>(LoadEntry("glUseProgram"));
|
||||
glVertexAttrib4f = reinterpret_cast<PFNGLVERTEXATTRIB4FPROC>(LoadEntry("glVertexAttrib4f"));
|
||||
glVertexAttribDivisor = reinterpret_cast<PFNGLVERTEXATTRIBDIVISORPROC>(LoadEntry("glVertexAttribDivisor"));
|
||||
glVertexAttribPointer = reinterpret_cast<PFNGLVERTEXATTRIBPOINTERPROC>(LoadEntry("glVertexAttribPointer"));
|
||||
glVertexAttribIPointer = reinterpret_cast<PFNGLVERTEXATTRIBIPOINTERPROC>(LoadEntry("glVertexAttribIPointer"));
|
||||
glViewport = reinterpret_cast<PFNGLVIEWPORTPROC>(LoadEntry("glViewport"));
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
@@ -961,16 +992,10 @@ bool NzOpenGL::Initialize()
|
||||
/****************************************Extensions****************************************/
|
||||
|
||||
// Fonctions optionnelles
|
||||
glBindFragDataLocation = reinterpret_cast<PFNGLBINDFRAGDATALOCATIONPROC>(LoadEntry("glBindFragDataLocation", false));
|
||||
if (!glBindFragDataLocation)
|
||||
glBindFragDataLocation = reinterpret_cast<PFNGLBINDFRAGDATALOCATIONEXTPROC>(LoadEntry("glBindFragDataLocationEXT", false));
|
||||
glBindFragDataLocation = reinterpret_cast<PFNGLBINDFRAGDATALOCATIONPROC>(LoadEntry("glBindFragDataLocation"));
|
||||
|
||||
glDrawTexture = reinterpret_cast<PFNGLDRAWTEXTURENVPROC>(LoadEntry("glDrawTextureNV", false));
|
||||
glFramebufferTexture = reinterpret_cast<PFNGLFRAMEBUFFERTEXTUREPROC>(LoadEntry("glFramebufferTexture", false));
|
||||
glGetStringi = reinterpret_cast<PFNGLGETSTRINGIPROC>(LoadEntry("glGetStringi", false));
|
||||
glInvalidateBufferData = reinterpret_cast<PFNGLINVALIDATEBUFFERDATAPROC>(LoadEntry("glInvalidateBufferData", false));
|
||||
glMapBufferRange = reinterpret_cast<PFNGLMAPBUFFERRANGEPROC>(LoadEntry("glMapBufferRange", false));
|
||||
glVertexAttribIPointer = reinterpret_cast<PFNGLVERTEXATTRIBIPOINTERPROC>(LoadEntry("glVertexAttribIPointer", false));
|
||||
glVertexAttribLPointer = reinterpret_cast<PFNGLVERTEXATTRIBLPOINTERPROC>(LoadEntry("glVertexAttribLPointer", false));
|
||||
|
||||
#if defined(NAZARA_PLATFORM_WINDOWS)
|
||||
@@ -985,8 +1010,7 @@ bool NzOpenGL::Initialize()
|
||||
|
||||
if (!glGetStringi || !LoadExtensions3())
|
||||
{
|
||||
if (s_openglVersion >= 300) // Dans le cas contraire c'est normal
|
||||
NazaraWarning("Failed to load OpenGL 3 extension system, switching to OpenGL 2 extension system...");
|
||||
NazaraWarning("Failed to load OpenGL 3 extension system, falling back to OpenGL 2 extension system...");
|
||||
|
||||
if (!LoadExtensionsString(reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS))))
|
||||
NazaraWarning("Failed to load extension system");
|
||||
@@ -1010,37 +1034,6 @@ bool NzOpenGL::Initialize()
|
||||
// AnisotropicFilter
|
||||
s_openGLextensions[nzOpenGLExtension_AnisotropicFilter] = IsSupported("GL_EXT_texture_filter_anisotropic");
|
||||
|
||||
// ConditionalRender
|
||||
if (s_openglVersion >= 300)
|
||||
{
|
||||
try
|
||||
{
|
||||
glBeginConditionalRender = reinterpret_cast<PFNGLBEGINCONDITIONALRENDERPROC>(LoadEntry("glBeginConditionalRender"));
|
||||
glEndConditionalRender = reinterpret_cast<PFNGLENDCONDITIONALRENDERPROC>(LoadEntry("glEndConditionalRender"));
|
||||
|
||||
s_openGLextensions[nzOpenGLExtension_ConditionalRender] = true;
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
NazaraWarning("Failed to load Conditional Render: " + NzString(e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
if (!s_openGLextensions[nzOpenGLExtension_ConditionalRender] && IsSupported("GL_NV_conditional_render"))
|
||||
{
|
||||
try
|
||||
{
|
||||
glBeginConditionalRender = reinterpret_cast<PFNGLBEGINCONDITIONALRENDERPROC>(LoadEntry("glBeginConditionalRenderNV"));
|
||||
glEndConditionalRender = reinterpret_cast<PFNGLENDCONDITIONALRENDERPROC>(LoadEntry("glEndConditionalRenderNV"));
|
||||
|
||||
s_openGLextensions[nzOpenGLExtension_ConditionalRender] = true;
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
NazaraWarning("Failed to load GL_NV_conditional_render: " + NzString(e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
// DebugOutput
|
||||
if (s_openglVersion >= 430 || IsSupported("GL_KHR_debug"))
|
||||
{
|
||||
@@ -1076,37 +1069,6 @@ bool NzOpenGL::Initialize()
|
||||
}
|
||||
}
|
||||
|
||||
// DrawInstanced
|
||||
if (s_openglVersion >= 310)
|
||||
{
|
||||
try
|
||||
{
|
||||
glDrawArraysInstanced = reinterpret_cast<PFNGLDRAWARRAYSINSTANCEDPROC>(LoadEntry("glDrawArraysInstanced"));
|
||||
glDrawElementsInstanced = reinterpret_cast<PFNGLDRAWELEMENTSINSTANCEDPROC>(LoadEntry("glDrawElementsInstanced"));
|
||||
|
||||
s_openGLextensions[nzOpenGLExtension_DrawInstanced] = true;
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
NazaraWarning("Failed to load Draw Instanced: " + NzString(e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
if (!s_openGLextensions[nzOpenGLExtension_DrawInstanced] && IsSupported("GL_ARB_draw_instanced"))
|
||||
{
|
||||
try
|
||||
{
|
||||
glDrawArraysInstanced = reinterpret_cast<PFNGLDRAWARRAYSINSTANCEDARBPROC>(LoadEntry("glDrawArraysInstancedARB"));
|
||||
glDrawElementsInstanced = reinterpret_cast<PFNGLDRAWELEMENTSINSTANCEDARBPROC>(LoadEntry("glDrawElementsInstancedARB"));
|
||||
|
||||
s_openGLextensions[nzOpenGLExtension_DrawInstanced] = true;
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
NazaraWarning("Failed to load GL_ARB_draw_instanced: " + NzString(e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
// FP64
|
||||
if (s_openglVersion >= 400 || IsSupported("GL_ARB_gpu_shader_fp64"))
|
||||
{
|
||||
@@ -1126,35 +1088,6 @@ bool NzOpenGL::Initialize()
|
||||
}
|
||||
}
|
||||
|
||||
// FrameBufferObject
|
||||
if (s_openglVersion >= 300 || IsSupported("GL_ARB_framebuffer_object"))
|
||||
{
|
||||
try
|
||||
{
|
||||
glBindFramebuffer = reinterpret_cast<PFNGLBINDFRAMEBUFFERPROC>(LoadEntry("glBindFramebuffer"));
|
||||
glBindRenderbuffer = reinterpret_cast<PFNGLBINDRENDERBUFFERPROC>(LoadEntry("glBindRenderbuffer"));
|
||||
glBlitFramebuffer = reinterpret_cast<PFNGLBLITFRAMEBUFFERPROC>(LoadEntry("glBlitFramebuffer"));
|
||||
glCheckFramebufferStatus = reinterpret_cast<PFNGLCHECKFRAMEBUFFERSTATUSPROC>(LoadEntry("glCheckFramebufferStatus"));
|
||||
glDeleteFramebuffers = reinterpret_cast<PFNGLDELETEFRAMEBUFFERSPROC>(LoadEntry("glDeleteFramebuffers"));
|
||||
glDeleteRenderbuffers = reinterpret_cast<PFNGLDELETERENDERBUFFERSPROC>(LoadEntry("glDeleteRenderbuffers"));
|
||||
glFramebufferRenderbuffer = reinterpret_cast<PFNGLFRAMEBUFFERRENDERBUFFERPROC>(LoadEntry("glFramebufferRenderbuffer"));
|
||||
glFramebufferTexture1D = reinterpret_cast<PFNGLFRAMEBUFFERTEXTURE1DPROC>(LoadEntry("glFramebufferTexture1D"));
|
||||
glFramebufferTexture2D = reinterpret_cast<PFNGLFRAMEBUFFERTEXTURE2DPROC>(LoadEntry("glFramebufferTexture2D"));
|
||||
glFramebufferTexture3D = reinterpret_cast<PFNGLFRAMEBUFFERTEXTURE3DPROC>(LoadEntry("glFramebufferTexture3D"));
|
||||
glFramebufferTextureLayer = reinterpret_cast<PFNGLFRAMEBUFFERTEXTURELAYERPROC>(LoadEntry("glFramebufferTextureLayer"));
|
||||
glGenerateMipmap = reinterpret_cast<PFNGLGENERATEMIPMAPPROC>(LoadEntry("glGenerateMipmap"));
|
||||
glGenFramebuffers = reinterpret_cast<PFNGLGENFRAMEBUFFERSPROC>(LoadEntry("glGenFramebuffers"));
|
||||
glGenRenderbuffers = reinterpret_cast<PFNGLGENRENDERBUFFERSPROC>(LoadEntry("glGenRenderbuffers"));
|
||||
glRenderbufferStorage = reinterpret_cast<PFNGLRENDERBUFFERSTORAGEPROC>(LoadEntry("glRenderbufferStorage"));
|
||||
|
||||
s_openGLextensions[nzOpenGLExtension_FrameBufferObject] = true;
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
NazaraWarning("Failed to load ARB_framebuffer_object: (" + NzString(e.what()) + ")");
|
||||
}
|
||||
}
|
||||
|
||||
// GetProgramBinary
|
||||
if (s_openglVersion >= 410 || IsSupported("GL_ARB_get_program_binary"))
|
||||
{
|
||||
@@ -1172,57 +1105,6 @@ bool NzOpenGL::Initialize()
|
||||
}
|
||||
}
|
||||
|
||||
// InstancedArray
|
||||
if (s_openglVersion >= 330)
|
||||
{
|
||||
try
|
||||
{
|
||||
glVertexAttribDivisor = reinterpret_cast<PFNGLVERTEXATTRIBDIVISORPROC>(LoadEntry("glVertexAttribDivisor"));
|
||||
|
||||
s_openGLextensions[nzOpenGLExtension_InstancedArray] = true;
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
NazaraWarning("Failed to load Instanced Array: " + NzString(e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
if (!s_openGLextensions[nzOpenGLExtension_InstancedArray] && IsSupported("GL_ARB_instanced_arrays"))
|
||||
{
|
||||
try
|
||||
{
|
||||
glVertexAttribDivisor = reinterpret_cast<PFNGLVERTEXATTRIBDIVISORARBPROC>(LoadEntry("glVertexAttribDivisorARB"));
|
||||
|
||||
s_openGLextensions[nzOpenGLExtension_InstancedArray] = true;
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
NazaraWarning("Failed to load GL_ARB_instanced_arrays: " + NzString(e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
// PixelBufferObject
|
||||
s_openGLextensions[nzOpenGLExtension_PixelBufferObject] = (s_openglVersion >= 210 || IsSupported("GL_ARB_pixel_buffer_object"));
|
||||
|
||||
// SamplerObjects
|
||||
if (s_openglVersion >= 330 || IsSupported("GL_ARB_sampler_objects"))
|
||||
{
|
||||
try
|
||||
{
|
||||
glBindSampler = reinterpret_cast<PFNGLBINDSAMPLERPROC>(LoadEntry("glBindSampler"));
|
||||
glDeleteSamplers = reinterpret_cast<PFNGLDELETESAMPLERSPROC>(LoadEntry("glDeleteSamplers"));
|
||||
glGenSamplers = reinterpret_cast<PFNGLGENSAMPLERSPROC>(LoadEntry("glGenSamplers"));
|
||||
glSamplerParameterf = reinterpret_cast<PFNGLSAMPLERPARAMETERFPROC>(LoadEntry("glSamplerParameterf"));
|
||||
glSamplerParameteri = reinterpret_cast<PFNGLSAMPLERPARAMETERIPROC>(LoadEntry("glSamplerParameteri"));
|
||||
|
||||
s_openGLextensions[nzOpenGLExtension_SamplerObjects] = true;
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
NazaraWarning("Failed to load ARB_sampler_objects: (" + NzString(e.what()) + ")");
|
||||
}
|
||||
}
|
||||
|
||||
// SeparateShaderObjects
|
||||
if (s_openglVersion >= 400 || IsSupported("GL_ARB_separate_shader_objects"))
|
||||
{
|
||||
@@ -1262,9 +1144,6 @@ bool NzOpenGL::Initialize()
|
||||
// Shader_ImageLoadStore
|
||||
s_openGLextensions[nzOpenGLExtension_Shader_ImageLoadStore] = (s_openglVersion >= 420 || IsSupported("GL_ARB_shader_image_load_store"));
|
||||
|
||||
// TextureArray
|
||||
s_openGLextensions[nzOpenGLExtension_TextureArray] = (s_openglVersion >= 300 || IsSupported("GL_EXT_texture_array"));
|
||||
|
||||
// TextureCompression_s3tc
|
||||
s_openGLextensions[nzOpenGLExtension_TextureCompression_s3tc] = IsSupported("GL_EXT_texture_compression_s3tc");
|
||||
|
||||
@@ -1285,27 +1164,6 @@ bool NzOpenGL::Initialize()
|
||||
}
|
||||
}
|
||||
|
||||
// VertexArrayObject
|
||||
if (s_openglVersion >= 300 || IsSupported("GL_ARB_vertex_array_object"))
|
||||
{
|
||||
try
|
||||
{
|
||||
glBindVertexArray = reinterpret_cast<PFNGLBINDVERTEXARRAYPROC>(LoadEntry("glBindVertexArray"));
|
||||
glDeleteVertexArrays = reinterpret_cast<PFNGLDELETEVERTEXARRAYSPROC>(LoadEntry("glDeleteVertexArrays"));
|
||||
glGenVertexArrays = reinterpret_cast<PFNGLGENVERTEXARRAYSPROC>(LoadEntry("glGenVertexArrays"));
|
||||
|
||||
s_openGLextensions[nzOpenGLExtension_VertexArrayObjects] = true;
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
NazaraWarning("Failed to load ARB_vertex_array_object: " + NzString(e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
// Fonctions de substitut
|
||||
if (!glGenerateMipmap)
|
||||
glGenerateMipmap = reinterpret_cast<PFNGLGENERATEMIPMAPEXTPROC>(LoadEntry("glGenerateMipmapEXT", false));
|
||||
|
||||
/******************************Initialisation*****************************/
|
||||
|
||||
s_contextStates = nullptr;
|
||||
|
||||
@@ -111,11 +111,6 @@ bool NzRenderBuffer::IsValid() const
|
||||
return m_id != 0;
|
||||
}
|
||||
|
||||
bool NzRenderBuffer::IsSupported()
|
||||
{
|
||||
return NzOpenGL::IsSupported(nzOpenGLExtension_FrameBufferObject);
|
||||
}
|
||||
|
||||
bool NzRenderBuffer::Initialize()
|
||||
{
|
||||
if (!NzRenderBufferLibrary::Initialize())
|
||||
|
||||
@@ -299,12 +299,6 @@ bool NzRenderTexture::AttachTexture(nzAttachmentPoint attachmentPoint, nzUInt8 i
|
||||
|
||||
bool NzRenderTexture::Create(bool lock)
|
||||
{
|
||||
if (!IsSupported())
|
||||
{
|
||||
NazaraError("Render textures not supported");
|
||||
return false;
|
||||
}
|
||||
|
||||
Destroy();
|
||||
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
@@ -655,11 +649,6 @@ bool NzRenderTexture::HasContext() const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool NzRenderTexture::IsSupported()
|
||||
{
|
||||
return NzOpenGL::IsSupported(nzOpenGLExtension_FrameBufferObject);
|
||||
}
|
||||
|
||||
void NzRenderTexture::Blit(NzRenderTexture* src, NzRectui srcRect, NzRenderTexture* dst, NzRectui dstRect, nzUInt32 buffers, bool bilinearFilter)
|
||||
{
|
||||
NazaraAssert(src && src->IsValid(), "Invalid source render texture");
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
#include <vector>
|
||||
#include <Nazara/Renderer/Debug.hpp>
|
||||
|
||||
///TODO: Manager les VAO (permettre plusieurs draw calls sans rebinder le VAO)
|
||||
|
||||
namespace
|
||||
{
|
||||
const nzUInt8 r_coreFragmentShader[] = {
|
||||
@@ -43,14 +45,6 @@ namespace
|
||||
#include <Nazara/Renderer/Resources/Shaders/Debug/core.vert.h>
|
||||
};
|
||||
|
||||
const nzUInt8 r_compatibilityFragmentShader[] = {
|
||||
#include <Nazara/Renderer/Resources/Shaders/Debug/compatibility.frag.h>
|
||||
};
|
||||
|
||||
const nzUInt8 r_compatibilityVertexShader[] = {
|
||||
#include <Nazara/Renderer/Resources/Shaders/Debug/compatibility.vert.h>
|
||||
};
|
||||
|
||||
enum ObjectType
|
||||
{
|
||||
ObjectType_Context,
|
||||
@@ -122,8 +116,6 @@ namespace
|
||||
const NzVertexBuffer* s_vertexBuffer;
|
||||
bool s_capabilities[nzRendererCap_Max+1];
|
||||
bool s_instancing;
|
||||
bool s_useSamplerObjects;
|
||||
bool s_useVertexArrayObjects;
|
||||
unsigned int s_maxColorAttachments;
|
||||
unsigned int s_maxRenderTarget;
|
||||
unsigned int s_maxTextureSize;
|
||||
@@ -141,14 +133,6 @@ void NzRenderer::BeginCondition(const NzGpuQuery& query, nzGpuQueryCondition con
|
||||
}
|
||||
#endif
|
||||
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!s_capabilities[nzRendererCap_ConditionalRendering])
|
||||
{
|
||||
NazaraError("Conditional rendering is not supported");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
glBeginConditionalRender(query.GetOpenGLID(), NzOpenGL::QueryCondition[condition]);
|
||||
}
|
||||
|
||||
@@ -205,9 +189,7 @@ void NzRenderer::DrawFullscreenQuad()
|
||||
}
|
||||
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
|
||||
if (s_useVertexArrayObjects)
|
||||
glBindVertexArray(0);
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
void NzRenderer::DrawIndexedPrimitives(nzPrimitiveMode mode, unsigned int firstIndex, unsigned int indexCount)
|
||||
@@ -257,9 +239,7 @@ void NzRenderer::DrawIndexedPrimitives(nzPrimitiveMode mode, unsigned int firstI
|
||||
}
|
||||
|
||||
glDrawElements(NzOpenGL::PrimitiveMode[mode], indexCount, type, offset);
|
||||
|
||||
if (s_useVertexArrayObjects)
|
||||
glBindVertexArray(0);
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
void NzRenderer::DrawIndexedPrimitivesInstanced(unsigned int instanceCount, nzPrimitiveMode mode, unsigned int firstIndex, unsigned int indexCount)
|
||||
@@ -279,12 +259,6 @@ void NzRenderer::DrawIndexedPrimitivesInstanced(unsigned int instanceCount, nzPr
|
||||
#endif
|
||||
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!s_capabilities[nzRendererCap_Instancing])
|
||||
{
|
||||
NazaraError("Instancing not supported");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!s_indexBuffer)
|
||||
{
|
||||
NazaraError("No index buffer");
|
||||
@@ -328,9 +302,7 @@ void NzRenderer::DrawIndexedPrimitivesInstanced(unsigned int instanceCount, nzPr
|
||||
}
|
||||
|
||||
glDrawElementsInstanced(NzOpenGL::PrimitiveMode[mode], indexCount, type, offset, instanceCount);
|
||||
|
||||
if (s_useVertexArrayObjects)
|
||||
glBindVertexArray(0);
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
void NzRenderer::DrawPrimitives(nzPrimitiveMode mode, unsigned int firstVertex, unsigned int vertexCount)
|
||||
@@ -358,9 +330,7 @@ void NzRenderer::DrawPrimitives(nzPrimitiveMode mode, unsigned int firstVertex,
|
||||
}
|
||||
|
||||
glDrawArrays(NzOpenGL::PrimitiveMode[mode], firstVertex, vertexCount);
|
||||
|
||||
if (s_useVertexArrayObjects)
|
||||
glBindVertexArray(0);
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
void NzRenderer::DrawPrimitivesInstanced(unsigned int instanceCount, nzPrimitiveMode mode, unsigned int firstVertex, unsigned int vertexCount)
|
||||
@@ -380,12 +350,6 @@ void NzRenderer::DrawPrimitivesInstanced(unsigned int instanceCount, nzPrimitive
|
||||
#endif
|
||||
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!s_capabilities[nzRendererCap_Instancing])
|
||||
{
|
||||
NazaraError("Instancing not supported");
|
||||
return;
|
||||
}
|
||||
|
||||
if (instanceCount == 0)
|
||||
{
|
||||
NazaraError("Instance count must be over zero");
|
||||
@@ -409,9 +373,7 @@ void NzRenderer::DrawPrimitivesInstanced(unsigned int instanceCount, nzPrimitive
|
||||
}
|
||||
|
||||
glDrawArraysInstanced(NzOpenGL::PrimitiveMode[mode], firstVertex, vertexCount, instanceCount);
|
||||
|
||||
if (s_useVertexArrayObjects)
|
||||
glBindVertexArray(0);
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
void NzRenderer::Enable(nzRendererParameter parameter, bool enable)
|
||||
@@ -443,14 +405,6 @@ void NzRenderer::EndCondition()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!s_capabilities[nzRendererCap_ConditionalRendering])
|
||||
{
|
||||
NazaraError("Conditional rendering is not supported");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
glEndConditionalRender();
|
||||
}
|
||||
|
||||
@@ -474,14 +428,6 @@ nzRendererComparison NzRenderer::GetDepthFunc()
|
||||
|
||||
NzVertexBuffer* NzRenderer::GetInstanceBuffer()
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!s_capabilities[nzRendererCap_Instancing])
|
||||
{
|
||||
NazaraError("Instancing not supported");
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
s_updateFlags |= Update_VAO;
|
||||
return &s_instanceBuffer;
|
||||
}
|
||||
@@ -629,19 +575,9 @@ bool NzRenderer::Initialize()
|
||||
}
|
||||
|
||||
// Récupération des capacités d'OpenGL
|
||||
s_capabilities[nzRendererCap_AnisotropicFilter] = NzOpenGL::IsSupported(nzOpenGLExtension_AnisotropicFilter);
|
||||
s_capabilities[nzRendererCap_ConditionalRendering] = NzOpenGL::IsSupported(nzOpenGLExtension_ConditionalRender);
|
||||
s_capabilities[nzRendererCap_FP64] = NzOpenGL::IsSupported(nzOpenGLExtension_FP64);
|
||||
s_capabilities[nzRendererCap_HardwareBuffer] = true; // Natif depuis OpenGL 1.5
|
||||
s_capabilities[nzRendererCap_Instancing] = NzOpenGL::IsSupported(nzOpenGLExtension_DrawInstanced) && NzOpenGL::IsSupported(nzOpenGLExtension_InstancedArray);
|
||||
s_capabilities[nzRendererCap_MultipleRenderTargets] = (glBindFragDataLocation != nullptr); // Natif depuis OpenGL 2.0 mais inutile sans glBindFragDataLocation
|
||||
s_capabilities[nzRendererCap_OcclusionQuery] = true; // Natif depuis OpenGL 1.5
|
||||
s_capabilities[nzRendererCap_PixelBufferObject] = NzOpenGL::IsSupported(nzOpenGLExtension_PixelBufferObject);
|
||||
s_capabilities[nzRendererCap_RenderTexture] = NzOpenGL::IsSupported(nzOpenGLExtension_FrameBufferObject);
|
||||
s_capabilities[nzRendererCap_Texture3D] = true; // Natif depuis OpenGL 1.2
|
||||
s_capabilities[nzRendererCap_TextureCubemap] = true; // Natif depuis OpenGL 1.3
|
||||
s_capabilities[nzRendererCap_TextureMulti] = true; // Natif depuis OpenGL 1.3
|
||||
s_capabilities[nzRendererCap_TextureNPOT] = true; // Natif depuis OpenGL 2.0
|
||||
s_capabilities[nzRendererCap_AnisotropicFilter] = NzOpenGL::IsSupported(nzOpenGLExtension_AnisotropicFilter);
|
||||
s_capabilities[nzRendererCap_FP64] = NzOpenGL::IsSupported(nzOpenGLExtension_FP64);
|
||||
s_capabilities[nzRendererCap_Instancing] = true; // Supporté par OpenGL 3.3
|
||||
|
||||
NzContext::EnsureContext();
|
||||
|
||||
@@ -655,39 +591,21 @@ bool NzRenderer::Initialize()
|
||||
else
|
||||
s_maxAnisotropyLevel = 1;
|
||||
|
||||
if (s_capabilities[nzRendererCap_RenderTexture])
|
||||
{
|
||||
GLint maxColorAttachments;
|
||||
glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS, &maxColorAttachments);
|
||||
GLint maxColorAttachments;
|
||||
glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS, &maxColorAttachments);
|
||||
s_maxColorAttachments = static_cast<unsigned int>(maxColorAttachments);
|
||||
|
||||
s_maxColorAttachments = static_cast<unsigned int>(maxColorAttachments);
|
||||
}
|
||||
else
|
||||
s_maxColorAttachments = 1;
|
||||
GLint maxDrawBuffers;
|
||||
glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
|
||||
s_maxRenderTarget = static_cast<unsigned int>(maxDrawBuffers);
|
||||
|
||||
if (s_capabilities[nzRendererCap_MultipleRenderTargets])
|
||||
{
|
||||
GLint maxDrawBuffers;
|
||||
glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
|
||||
|
||||
s_maxRenderTarget = static_cast<unsigned int>(maxDrawBuffers);
|
||||
}
|
||||
else
|
||||
s_maxRenderTarget = 1;
|
||||
|
||||
if (s_capabilities[nzRendererCap_TextureMulti])
|
||||
{
|
||||
GLint maxTextureUnits;
|
||||
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &maxTextureUnits);
|
||||
|
||||
s_maxTextureUnit = static_cast<unsigned int>(maxTextureUnits);
|
||||
}
|
||||
else
|
||||
s_maxTextureUnit = 1;
|
||||
GLint maxTextureUnits;
|
||||
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &maxTextureUnits);
|
||||
s_maxTextureUnit = static_cast<unsigned int>(maxTextureUnits);
|
||||
|
||||
GLint maxTextureSize;
|
||||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
|
||||
s_maxTextureSize = maxTextureSize;
|
||||
s_maxTextureSize = static_cast<unsigned int>(maxTextureSize);
|
||||
|
||||
GLint maxVertexAttribs;
|
||||
glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs);
|
||||
@@ -700,8 +618,6 @@ bool NzRenderer::Initialize()
|
||||
s_target = nullptr;
|
||||
s_targetSize.Set(0U);
|
||||
s_textureUnits.resize(s_maxTextureUnit);
|
||||
s_useSamplerObjects = NzOpenGL::IsSupported(nzOpenGLExtension_SamplerObjects);
|
||||
s_useVertexArrayObjects = NzOpenGL::IsSupported(nzOpenGLExtension_VertexArrayObjects);
|
||||
s_updateFlags = Update_Matrices | Update_Shader | Update_VAO;
|
||||
s_vertexBuffer = nullptr;
|
||||
|
||||
@@ -775,32 +691,13 @@ bool NzRenderer::Initialize()
|
||||
return false;
|
||||
}
|
||||
|
||||
const char* fragmentShader;
|
||||
const char* vertexShader;
|
||||
unsigned int fragmentShaderLength;
|
||||
unsigned int vertexShaderLength;
|
||||
if (NzOpenGL::GetGLSLVersion() >= 140)
|
||||
{
|
||||
fragmentShader = reinterpret_cast<const char*>(r_coreFragmentShader);
|
||||
fragmentShaderLength = sizeof(r_coreFragmentShader);
|
||||
vertexShader = reinterpret_cast<const char*>(r_coreVertexShader);
|
||||
vertexShaderLength = sizeof(r_coreVertexShader);
|
||||
}
|
||||
else
|
||||
{
|
||||
fragmentShader = reinterpret_cast<const char*>(r_compatibilityFragmentShader);
|
||||
fragmentShaderLength = sizeof(r_compatibilityFragmentShader);
|
||||
vertexShader = reinterpret_cast<const char*>(r_compatibilityVertexShader);
|
||||
vertexShaderLength = sizeof(r_compatibilityVertexShader);
|
||||
}
|
||||
|
||||
if (!debugShader->AttachStageFromSource(nzShaderStage_Fragment, fragmentShader, fragmentShaderLength))
|
||||
if (!debugShader->AttachStageFromSource(nzShaderStage_Fragment, reinterpret_cast<const char*>(r_coreFragmentShader), sizeof(r_coreFragmentShader)))
|
||||
{
|
||||
NazaraError("Failed to attach fragment stage");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!debugShader->AttachStageFromSource(nzShaderStage_Vertex, vertexShader, vertexShaderLength))
|
||||
if (!debugShader->AttachStageFromSource(nzShaderStage_Vertex, reinterpret_cast<const char*>(r_coreVertexShader), sizeof(r_coreVertexShader)))
|
||||
{
|
||||
NazaraError("Failed to attach vertex stage");
|
||||
return false;
|
||||
@@ -1549,31 +1446,14 @@ bool NzRenderer::EnsureStateUpdate()
|
||||
{
|
||||
if (s_updateFlags & Update_Textures)
|
||||
{
|
||||
if (s_useSamplerObjects)
|
||||
for (unsigned int i : s_dirtyTextureUnits)
|
||||
{
|
||||
for (unsigned int i : s_dirtyTextureUnits)
|
||||
{
|
||||
TextureUnit& unit = s_textureUnits[i];
|
||||
TextureUnit& unit = s_textureUnits[i];
|
||||
|
||||
if (unit.texture && !unit.samplerUpdated)
|
||||
{
|
||||
unit.sampler.Bind(i);
|
||||
unit.samplerUpdated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (unsigned int i : s_dirtyTextureUnits)
|
||||
if (unit.texture && !unit.samplerUpdated)
|
||||
{
|
||||
TextureUnit& unit = s_textureUnits[i];
|
||||
|
||||
if (unit.texture && !unit.samplerUpdated)
|
||||
{
|
||||
NzOpenGL::BindTextureUnit(i);
|
||||
unit.sampler.Apply(unit.texture);
|
||||
unit.samplerUpdated = true;
|
||||
}
|
||||
unit.sampler.Bind(i);
|
||||
unit.samplerUpdated = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1608,73 +1488,52 @@ bool NzRenderer::EnsureStateUpdate()
|
||||
}
|
||||
#endif
|
||||
|
||||
bool update;
|
||||
VAO_Map::iterator vaoIt;
|
||||
// Note: Les VAOs ne sont pas partagés entre les contextes, nous avons donc un tableau de VAOs par contexte
|
||||
const NzContext* context = NzContext::GetCurrent();
|
||||
|
||||
// Si les VAOs sont supportés, on entoure nos appels par ceux-ci
|
||||
if (s_useVertexArrayObjects)
|
||||
auto it = s_vaos.find(context);
|
||||
if (it == s_vaos.end())
|
||||
{
|
||||
// Note: Les VAOs ne sont pas partagés entre les contextes, nous avons donc un tableau de VAOs par contexte
|
||||
const NzContext* context = NzContext::GetCurrent();
|
||||
Context_Entry entry;
|
||||
entry.onReleaseSlot.Connect(context->OnContextRelease, OnContextRelease);
|
||||
|
||||
auto it = s_vaos.find(context);
|
||||
if (it == s_vaos.end())
|
||||
{
|
||||
Context_Entry entry;
|
||||
entry.onReleaseSlot.Connect(context->OnContextRelease, OnContextRelease);
|
||||
|
||||
it = s_vaos.insert(std::make_pair(context, std::move(entry))).first;
|
||||
}
|
||||
|
||||
VAO_Map& vaoMap = it->second.vaoMap;
|
||||
|
||||
// Notre clé est composée de ce qui définit un VAO
|
||||
const NzVertexDeclaration* vertexDeclaration = s_vertexBuffer->GetVertexDeclaration();
|
||||
const NzVertexDeclaration* instancingDeclaration = (s_instancing) ? s_instanceBuffer.GetVertexDeclaration() : nullptr;
|
||||
VAO_Key key(s_indexBuffer, s_vertexBuffer, vertexDeclaration, instancingDeclaration);
|
||||
|
||||
// On recherche un VAO existant avec notre configuration
|
||||
vaoIt = vaoMap.find(key);
|
||||
if (vaoIt == vaoMap.end())
|
||||
{
|
||||
// On créé notre VAO
|
||||
glGenVertexArrays(1, &s_currentVAO);
|
||||
glBindVertexArray(s_currentVAO);
|
||||
|
||||
// On l'ajoute à notre liste
|
||||
VAO_Entry entry;
|
||||
entry.vao = s_currentVAO;
|
||||
|
||||
// Connect the slots
|
||||
if (s_indexBuffer)
|
||||
entry.onIndexBufferReleaseSlot.Connect(s_indexBuffer->OnIndexBufferRelease, OnIndexBufferRelease);
|
||||
|
||||
if (instancingDeclaration)
|
||||
entry.onInstancingDeclarationReleaseSlot.Connect(instancingDeclaration->OnVertexDeclarationRelease, OnVertexDeclarationRelease);
|
||||
|
||||
entry.onVertexBufferReleaseSlot.Connect(s_vertexBuffer->OnVertexBufferRelease, OnVertexBufferRelease);
|
||||
entry.onVertexDeclarationReleaseSlot.Connect(vertexDeclaration->OnVertexDeclarationRelease, OnVertexDeclarationRelease);
|
||||
|
||||
vaoIt = vaoMap.insert(std::make_pair(key, std::move(entry))).first;
|
||||
|
||||
// Et on indique qu'on veut le programmer
|
||||
update = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Notre VAO existe déjà, il est donc inutile de le reprogrammer
|
||||
s_currentVAO = vaoIt->second.vao;
|
||||
|
||||
update = false;
|
||||
}
|
||||
it = s_vaos.insert(std::make_pair(context, std::move(entry))).first;
|
||||
}
|
||||
else
|
||||
update = true; // Fallback si les VAOs ne sont pas supportés
|
||||
|
||||
bool updateFailed = false;
|
||||
VAO_Map& vaoMap = it->second.vaoMap;
|
||||
|
||||
if (update)
|
||||
// Notre clé est composée de ce qui définit un VAO
|
||||
const NzVertexDeclaration* vertexDeclaration = s_vertexBuffer->GetVertexDeclaration();
|
||||
const NzVertexDeclaration* instancingDeclaration = (s_instancing) ? s_instanceBuffer.GetVertexDeclaration() : nullptr;
|
||||
VAO_Key key(s_indexBuffer, s_vertexBuffer, vertexDeclaration, instancingDeclaration);
|
||||
|
||||
// On recherche un VAO existant avec notre configuration
|
||||
auto vaoIt = vaoMap.find(key);
|
||||
if (vaoIt == vaoMap.end())
|
||||
{
|
||||
// On créé notre VAO
|
||||
glGenVertexArrays(1, &s_currentVAO);
|
||||
glBindVertexArray(s_currentVAO);
|
||||
|
||||
// On l'ajoute à notre liste
|
||||
VAO_Entry entry;
|
||||
entry.vao = s_currentVAO;
|
||||
|
||||
// Connect the slots
|
||||
if (s_indexBuffer)
|
||||
entry.onIndexBufferReleaseSlot.Connect(s_indexBuffer->OnIndexBufferRelease, OnIndexBufferRelease);
|
||||
|
||||
if (instancingDeclaration)
|
||||
entry.onInstancingDeclarationReleaseSlot.Connect(instancingDeclaration->OnVertexDeclarationRelease, OnVertexDeclarationRelease);
|
||||
|
||||
entry.onVertexBufferReleaseSlot.Connect(s_vertexBuffer->OnVertexBufferRelease, OnVertexBufferRelease);
|
||||
entry.onVertexDeclarationReleaseSlot.Connect(vertexDeclaration->OnVertexDeclarationRelease, OnVertexDeclarationRelease);
|
||||
|
||||
vaoIt = vaoMap.insert(std::make_pair(key, std::move(entry))).first;
|
||||
|
||||
// And begin to program it
|
||||
bool updateFailed = false;
|
||||
|
||||
// Pour éviter la duplication de code, on va utiliser une astuce via une boucle for
|
||||
for (unsigned int i = 0; i < (s_instancing ? 2U : 1U); ++i)
|
||||
{
|
||||
@@ -1714,11 +1573,11 @@ bool NzRenderer::EnsureStateUpdate()
|
||||
case nzComponentType_Color:
|
||||
{
|
||||
glVertexAttribPointer(NzOpenGL::VertexComponentIndex[j],
|
||||
NzUtility::ComponentCount[type],
|
||||
NzOpenGL::ComponentType[type],
|
||||
GL_TRUE,
|
||||
stride,
|
||||
reinterpret_cast<void*>(bufferOffset + offset));
|
||||
NzUtility::ComponentCount[type],
|
||||
NzOpenGL::ComponentType[type],
|
||||
GL_TRUE,
|
||||
stride,
|
||||
reinterpret_cast<void*>(bufferOffset + offset));
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -1729,10 +1588,10 @@ bool NzRenderer::EnsureStateUpdate()
|
||||
case nzComponentType_Double4:
|
||||
{
|
||||
glVertexAttribLPointer(NzOpenGL::VertexComponentIndex[j],
|
||||
NzUtility::ComponentCount[type],
|
||||
NzOpenGL::ComponentType[type],
|
||||
stride,
|
||||
reinterpret_cast<void*>(bufferOffset + offset));
|
||||
NzUtility::ComponentCount[type],
|
||||
NzOpenGL::ComponentType[type],
|
||||
stride,
|
||||
reinterpret_cast<void*>(bufferOffset + offset));
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -1743,11 +1602,11 @@ bool NzRenderer::EnsureStateUpdate()
|
||||
case nzComponentType_Float4:
|
||||
{
|
||||
glVertexAttribPointer(NzOpenGL::VertexComponentIndex[j],
|
||||
NzUtility::ComponentCount[type],
|
||||
NzOpenGL::ComponentType[type],
|
||||
GL_FALSE,
|
||||
stride,
|
||||
reinterpret_cast<void*>(bufferOffset + offset));
|
||||
NzUtility::ComponentCount[type],
|
||||
NzOpenGL::ComponentType[type],
|
||||
GL_FALSE,
|
||||
stride,
|
||||
reinterpret_cast<void*>(bufferOffset + offset));
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -1758,10 +1617,10 @@ bool NzRenderer::EnsureStateUpdate()
|
||||
case nzComponentType_Int4:
|
||||
{
|
||||
glVertexAttribIPointer(NzOpenGL::VertexComponentIndex[j],
|
||||
NzUtility::ComponentCount[type],
|
||||
NzOpenGL::ComponentType[type],
|
||||
stride,
|
||||
reinterpret_cast<void*>(bufferOffset + offset));
|
||||
NzUtility::ComponentCount[type],
|
||||
NzOpenGL::ComponentType[type],
|
||||
stride,
|
||||
reinterpret_cast<void*>(bufferOffset + offset));
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -1772,6 +1631,7 @@ bool NzRenderer::EnsureStateUpdate()
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Les attributs d'instancing ont un diviseur spécifique (pour dépendre de l'instance en cours)
|
||||
if (i == 1)
|
||||
glVertexAttribDivisor(NzOpenGL::VertexComponentIndex[j], 1);
|
||||
@@ -1801,46 +1661,40 @@ bool NzRenderer::EnsureStateUpdate()
|
||||
// On invalide les bindings des buffers (car nous les avons défini manuellement)
|
||||
NzOpenGL::SetBuffer(nzBufferType_Index, 0);
|
||||
NzOpenGL::SetBuffer(nzBufferType_Vertex, 0);
|
||||
}
|
||||
|
||||
if (s_useVertexArrayObjects)
|
||||
{
|
||||
if (update)
|
||||
if (updateFailed)
|
||||
{
|
||||
if (updateFailed)
|
||||
{
|
||||
// La création de notre VAO a échoué, libérons-le et marquons-le comme problématique
|
||||
glDeleteVertexArrays(1, &vaoIt->second.vao);
|
||||
vaoIt->second.vao = 0;
|
||||
s_currentVAO = 0;
|
||||
}
|
||||
else
|
||||
glBindVertexArray(0); // On marque la fin de la construction du VAO en le débindant
|
||||
// La création de notre VAO a échoué, libérons-le et marquons-le comme problématique
|
||||
glDeleteVertexArrays(1, &vaoIt->second.vao);
|
||||
vaoIt->second.vao = 0;
|
||||
s_currentVAO = 0;
|
||||
}
|
||||
|
||||
// En cas de non-support des VAOs, les attributs doivent être respécifiés à chaque frame
|
||||
s_updateFlags &= ~Update_VAO;
|
||||
else
|
||||
glBindVertexArray(0); // On marque la fin de la construction du VAO en le débindant
|
||||
}
|
||||
else
|
||||
// Notre VAO existe déjà, il est donc inutile de le reprogrammer
|
||||
s_currentVAO = vaoIt->second.vao;
|
||||
|
||||
// En cas de non-support des VAOs, les attributs doivent être respécifiés à chaque frame
|
||||
s_updateFlags &= ~Update_VAO;
|
||||
}
|
||||
|
||||
#ifdef NAZARA_DEBUG
|
||||
if (s_updateFlags != Update_None && !s_useVertexArrayObjects && s_updateFlags != Update_VAO)
|
||||
if (s_updateFlags != Update_None && s_updateFlags != Update_VAO)
|
||||
NazaraWarning("Update flags not fully cleared");
|
||||
#endif
|
||||
}
|
||||
|
||||
// On bind notre VAO
|
||||
if (s_useVertexArrayObjects)
|
||||
if (!s_currentVAO)
|
||||
{
|
||||
if (!s_currentVAO)
|
||||
{
|
||||
NazaraError("Failed to create VAO");
|
||||
return false;
|
||||
}
|
||||
|
||||
glBindVertexArray(s_currentVAO);
|
||||
NazaraError("Failed to create VAO");
|
||||
return false;
|
||||
}
|
||||
|
||||
glBindVertexArray(s_currentVAO);
|
||||
|
||||
// On vérifie que les textures actuellement bindées sont bien nos textures
|
||||
// Ceci à cause du fait qu'il est possible que des opérations sur les textures aient eu lieu
|
||||
// entre le dernier rendu et maintenant
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
#version 110
|
||||
|
||||
/********************Uniformes********************/
|
||||
uniform vec4 Color;
|
||||
|
||||
/********************Fonctions********************/
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = Color;
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
35,118,101,114,115,105,111,110,32,49,49,48,13,10,13,10,47,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,85,110,105,102,111,114,109,101,115,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,47,13,10,117,110,105,102,111,114,109,32,118,101,99,52,32,67,111,108,111,114,59,13,10,13,10,47,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,70,111,110,99,116,105,111,110,115,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,47,13,10,118,111,105,100,32,109,97,105,110,40,41,13,10,123,13,10,9,103,108,95,70,114,97,103,67,111,108,111,114,32,61,32,67,111,108,111,114,59,13,10,125,
|
||||
@@ -1,13 +0,0 @@
|
||||
#version 110
|
||||
|
||||
/********************Entrant********************/
|
||||
varying vec3 VertexPosition;
|
||||
|
||||
/********************Uniformes********************/
|
||||
uniform mat4 WorldViewProjMatrix;
|
||||
|
||||
/********************Fonctions********************/
|
||||
void main()
|
||||
{
|
||||
gl_Position = WorldViewProjMatrix * vec4(VertexPosition, 1.0);
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
35,118,101,114,115,105,111,110,32,49,49,48,13,10,13,10,47,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,69,110,116,114,97,110,116,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,47,13,10,118,97,114,121,105,110,103,32,118,101,99,51,32,86,101,114,116,101,120,80,111,115,105,116,105,111,110,59,13,10,13,10,47,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,85,110,105,102,111,114,109,101,115,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,47,13,10,117,110,105,102,111,114,109,32,109,97,116,52,32,87,111,114,108,100,86,105,101,119,80,114,111,106,77,97,116,114,105,120,59,13,10,13,10,47,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,70,111,110,99,116,105,111,110,115,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,47,13,10,118,111,105,100,32,109,97,105,110,40,41,13,10,123,13,10,9,103,108,95,80,111,115,105,116,105,111,110,32,61,32,87,111,114,108,100,86,105,101,119,80,114,111,106,77,97,116,114,105,120,32,42,32,118,101,99,52,40,86,101,114,116,101,120,80,111,115,105,116,105,111,110,44,32,49,46,48,41,59,13,10,125,13,10,
|
||||
@@ -157,17 +157,14 @@ bool NzShader::Create()
|
||||
glBindAttribLocation(m_program, NzOpenGL::VertexComponentIndex[nzVertexComponent_Userdata3], "VertexUserdata3");
|
||||
glBindAttribLocation(m_program, NzOpenGL::VertexComponentIndex[nzVertexComponent_Userdata4], "VertexUserdata4");
|
||||
|
||||
if (NzRenderer::HasCapability(nzRendererCap_MultipleRenderTargets))
|
||||
{
|
||||
NzString uniform;
|
||||
uniform = "RenderTarget";
|
||||
NzString uniform;
|
||||
uniform = "RenderTarget";
|
||||
|
||||
unsigned int maxRenderTargets = NzRenderer::GetMaxRenderTargets();
|
||||
for (unsigned int i = 0; i < maxRenderTargets; ++i)
|
||||
{
|
||||
NzString uniformName = uniform + NzString::Number(i);
|
||||
glBindFragDataLocation(m_program, i, uniformName.GetConstBuffer());
|
||||
}
|
||||
unsigned int maxRenderTargets = NzRenderer::GetMaxRenderTargets();
|
||||
for (unsigned int i = 0; i < maxRenderTargets; ++i)
|
||||
{
|
||||
NzString uniformName = uniform + NzString::Number(i);
|
||||
glBindFragDataLocation(m_program, i, uniformName.GetConstBuffer());
|
||||
}
|
||||
|
||||
if (NzOpenGL::IsSupported(nzOpenGLExtension_GetProgramBinary))
|
||||
|
||||
@@ -220,12 +220,10 @@ bool NzShaderStage::IsSupported(nzShaderStage stage)
|
||||
switch (stage)
|
||||
{
|
||||
case nzShaderStage_Fragment:
|
||||
case nzShaderStage_Geometry:
|
||||
case nzShaderStage_Vertex:
|
||||
return true;
|
||||
|
||||
case nzShaderStage_Geometry:
|
||||
return NzOpenGL::GetVersion() >= 320;
|
||||
|
||||
default:
|
||||
NazaraError("Shader stage not handled (0x" + NzString::Number(stage, 16) + ')');
|
||||
return false;
|
||||
|
||||
@@ -165,12 +165,12 @@ bool NzTexture::Create(nzImageType type, nzPixelFormat format, unsigned int widt
|
||||
}
|
||||
|
||||
m_impl = new NzTextureImpl;
|
||||
m_impl->depth = GetValidSize(depth);
|
||||
m_impl->depth = depth;
|
||||
m_impl->format = format;
|
||||
m_impl->height = GetValidSize(height);
|
||||
m_impl->height = height;
|
||||
m_impl->levelCount = levelCount;
|
||||
m_impl->type = type;
|
||||
m_impl->width = GetValidSize(width);
|
||||
m_impl->width = width;
|
||||
|
||||
glGenTextures(1, &m_impl->id);
|
||||
NzOpenGL::BindTexture(m_impl->type, m_impl->id);
|
||||
@@ -1035,20 +1035,6 @@ unsigned int NzTexture::GetOpenGLID() const
|
||||
return m_impl->id;
|
||||
}
|
||||
|
||||
unsigned int NzTexture::GetValidSize(unsigned int size)
|
||||
{
|
||||
if (NzRenderer::HasCapability(nzRendererCap_TextureNPOT))
|
||||
return size;
|
||||
else
|
||||
{
|
||||
unsigned int pot = 1;
|
||||
while (pot < size)
|
||||
pot <<= 1;
|
||||
|
||||
return pot;
|
||||
}
|
||||
}
|
||||
|
||||
bool NzTexture::IsFormatSupported(nzPixelFormat format)
|
||||
{
|
||||
switch (format)
|
||||
@@ -1101,14 +1087,14 @@ bool NzTexture::IsFormatSupported(nzPixelFormat format)
|
||||
case nzPixelFormat_RGBA32F:
|
||||
case nzPixelFormat_RGBA32I:
|
||||
case nzPixelFormat_RGBA32UI:
|
||||
return NzOpenGL::GetVersion() >= 300;
|
||||
return true;
|
||||
|
||||
// Formats de profondeur (Supportés avec les FBOs)
|
||||
case nzPixelFormat_Depth16:
|
||||
case nzPixelFormat_Depth24:
|
||||
case nzPixelFormat_Depth32:
|
||||
case nzPixelFormat_Depth24Stencil8:
|
||||
return NzOpenGL::IsSupported(nzOpenGLExtension_FrameBufferObject);
|
||||
return true;
|
||||
|
||||
// Formats de stencil (Non supportés pour les textures)
|
||||
case nzPixelFormat_Stencil1:
|
||||
@@ -1141,14 +1127,12 @@ bool NzTexture::IsTypeSupported(nzImageType type)
|
||||
switch (type)
|
||||
{
|
||||
case nzImageType_1D:
|
||||
case nzImageType_1D_Array:
|
||||
case nzImageType_2D:
|
||||
case nzImageType_2D_Array:
|
||||
case nzImageType_3D:
|
||||
case nzImageType_Cubemap:
|
||||
return true; // Tous supportés nativement dans OpenGL 2
|
||||
|
||||
case nzImageType_1D_Array:
|
||||
case nzImageType_2D_Array:
|
||||
return NzOpenGL::IsSupported(nzOpenGLExtension_TextureArray);
|
||||
return true; // Tous supportés nativement dans OpenGL 3
|
||||
}
|
||||
|
||||
NazaraError("Image type not handled (0x" + NzString::Number(type, 16) + ')');
|
||||
|
||||
Reference in New Issue
Block a user