增加完整的dsa扩展检测
This commit is contained in:
parent
dda548dc6f
commit
bb3009c5fb
@ -6,25 +6,9 @@ namespace hgl
|
|||||||
{
|
{
|
||||||
namespace graph
|
namespace graph
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* 渲染驱动
|
|
||||||
* 用于对真实渲染API的交接管理
|
|
||||||
*/
|
|
||||||
class RenderDriver
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
|
|
||||||
RenderStatus current_status;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
virtual void SetCurStatus(const RenderStatus &)=0;
|
|
||||||
|
|
||||||
virtual void ClearColorBuffer()=0;
|
|
||||||
virtual void ClearDepthBuffer()=0;
|
|
||||||
};//class RenderDriver
|
|
||||||
|
|
||||||
void InitOpenGLDebug();
|
void InitOpenGLDebug();
|
||||||
|
|
||||||
|
bool IsSupportDSA();
|
||||||
}//namespace graph
|
}//namespace graph
|
||||||
}//namespace hgl
|
}//namespace hgl
|
||||||
#endif//HGL_RENDER_DRIVER_INCLUDE
|
#endif//HGL_RENDER_DRIVER_INCLUDE
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
add_library(ULRE.RenderDriver STATIC GLCore/RenderDriverGLCore.cpp
|
add_library(ULRE.RenderDriver STATIC OpenGLDebug.cpp
|
||||||
|
OpenGLExt.cpp
|
||||||
GLSL.cpp
|
GLSL.cpp
|
||||||
Shader.cpp
|
Shader.cpp
|
||||||
VertexArray.cpp
|
VertexArray.cpp
|
||||||
VertexBuffer.cpp
|
VertexBuffer.cpp
|
||||||
VertexBufferControlDSA.cpp
|
VertexBufferControlDSA.cpp
|
||||||
VertexBufferControlBind.cpp
|
VertexBufferControlBind.cpp
|
||||||
OpenGLDebug.cpp
|
|
||||||
TextureFormat.cpp
|
TextureFormat.cpp
|
||||||
Texture1D.cpp
|
Texture1D.cpp
|
||||||
Texture1DDSA.cpp
|
Texture1DDSA.cpp
|
||||||
|
@ -1,6 +1,66 @@
|
|||||||
#include<GL/glcorearb.h>
|
#include<GLEWCore/glew.h>
|
||||||
|
|
||||||
namespace hgl
|
namespace hgl
|
||||||
{
|
{
|
||||||
|
namespace graph
|
||||||
|
{
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
enum GLAPI_SUPPORT
|
||||||
|
{
|
||||||
|
gasNoSupport=-1,
|
||||||
|
gasNoCheck=0,
|
||||||
|
gasSupport=1
|
||||||
|
};
|
||||||
|
|
||||||
|
static GLAPI_SUPPORT support_dsa=gasNoCheck;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsSupportDSA()
|
||||||
|
{
|
||||||
|
if(support_dsa==gasSupport)return(true);
|
||||||
|
|
||||||
|
//texture api
|
||||||
|
if(glCreateTextures
|
||||||
|
&&glGenerateTextureMipmap
|
||||||
|
&&glGetTextureLevelParameteriv
|
||||||
|
&&glGetTextureParameteriv
|
||||||
|
&&glGetCompressedTextureImage
|
||||||
|
&&glGetTextureImage
|
||||||
|
&&glBindTextureUnit
|
||||||
|
&&glCompressedTextureSubImage1D
|
||||||
|
&&glCompressedTextureSubImage2D
|
||||||
|
&&glTextureSubImage1D
|
||||||
|
&&glTextureSubImage2D
|
||||||
|
|
||||||
|
//sampler object
|
||||||
|
&&glGenSamplers
|
||||||
|
&&glBindSampler
|
||||||
|
&&glSamplerParameteri
|
||||||
|
&&glSamplerParameterfv
|
||||||
|
|
||||||
|
//vbo
|
||||||
|
&&glCreateBuffers
|
||||||
|
&&glNamedBufferData
|
||||||
|
&&glNamedBufferSubData
|
||||||
|
|
||||||
|
//vao
|
||||||
|
&&glCreateVertexArrays
|
||||||
|
&&glDeleteVertexArrays
|
||||||
|
&&glVertexArrayAttribBinding
|
||||||
|
&&glVertexArrayAttribFormat
|
||||||
|
&&glVertexArrayAttribIFormat
|
||||||
|
&&glVertexArrayAttribLFormat
|
||||||
|
&&glEnableVertexArrayAttrib
|
||||||
|
&&glVertexArrayVertexBuffer
|
||||||
|
)
|
||||||
|
{
|
||||||
|
support_dsa=gasSupport;
|
||||||
|
return(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
support_dsa=gasNoSupport;
|
||||||
|
return(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}//namespace hgl
|
}//namespace hgl
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include<hgl/graph/Texture1D.h>
|
#include<hgl/graph/Texture1D.h>
|
||||||
#include<hgl/LogInfo.h>
|
#include<hgl/LogInfo.h>
|
||||||
|
#include<hgl/graph/RenderDriver.h>
|
||||||
|
|
||||||
namespace hgl
|
namespace hgl
|
||||||
{
|
{
|
||||||
@ -63,7 +64,7 @@ namespace hgl
|
|||||||
|
|
||||||
Texture1D *CreateTexture1D()
|
Texture1D *CreateTexture1D()
|
||||||
{
|
{
|
||||||
// if(GLEW_VERSION_4_5||GLEW_ARB_direct_state_access||GL_EXT_direct_state_access)
|
// if(IsSupportDSA())
|
||||||
return CreateTexture1DDSA();
|
return CreateTexture1DDSA();
|
||||||
// else
|
// else
|
||||||
// return CreateTexture1DBind();
|
// return CreateTexture1DBind();
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include<hgl/graph/VertexArray.h>
|
#include<hgl/graph/VertexArray.h>
|
||||||
#include<GLEWCore/glew.h>
|
#include<GLEWCore/glew.h>
|
||||||
#include"VertexBufferControl.h"
|
#include"VertexBufferControl.h"
|
||||||
|
#include<hgl/graph/RenderDriver.h>
|
||||||
|
|
||||||
namespace hgl
|
namespace hgl
|
||||||
{
|
{
|
||||||
@ -16,7 +17,7 @@ namespace hgl
|
|||||||
|
|
||||||
void InitVertexBufferAPI()
|
void InitVertexBufferAPI()
|
||||||
{
|
{
|
||||||
if(GLEW_VERSION_4_5||GLEW_ARB_direct_state_access)
|
if(IsSupportDSA())
|
||||||
CreateVertexBufferControl=CreateVertexBufferControlDSA;
|
CreateVertexBufferControl=CreateVertexBufferControlDSA;
|
||||||
else
|
else
|
||||||
CreateVertexBufferControl=CreateVertexBufferControlBind;
|
CreateVertexBufferControl=CreateVertexBufferControlBind;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user