增加完整的dsa扩展检测
This commit is contained in:
parent
dda548dc6f
commit
bb3009c5fb
@ -6,25 +6,9 @@ namespace hgl
|
||||
{
|
||||
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();
|
||||
|
||||
bool IsSupportDSA();
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
#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
|
||||
Shader.cpp
|
||||
VertexArray.cpp
|
||||
VertexBuffer.cpp
|
||||
VertexBufferControlDSA.cpp
|
||||
VertexBufferControlBind.cpp
|
||||
OpenGLDebug.cpp
|
||||
TextureFormat.cpp
|
||||
Texture1D.cpp
|
||||
Texture1DDSA.cpp
|
||||
|
@ -1,6 +1,66 @@
|
||||
#include<GL/glcorearb.h>
|
||||
#include<GLEWCore/glew.h>
|
||||
|
||||
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
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include<hgl/graph/Texture1D.h>
|
||||
#include<hgl/LogInfo.h>
|
||||
#include<hgl/graph/RenderDriver.h>
|
||||
|
||||
namespace hgl
|
||||
{
|
||||
@ -63,7 +64,7 @@ namespace hgl
|
||||
|
||||
Texture1D *CreateTexture1D()
|
||||
{
|
||||
// if(GLEW_VERSION_4_5||GLEW_ARB_direct_state_access||GL_EXT_direct_state_access)
|
||||
// if(IsSupportDSA())
|
||||
return CreateTexture1DDSA();
|
||||
// else
|
||||
// return CreateTexture1DBind();
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include<hgl/graph/VertexArray.h>
|
||||
#include<GLEWCore/glew.h>
|
||||
#include"VertexBufferControl.h"
|
||||
#include<hgl/graph/RenderDriver.h>
|
||||
|
||||
namespace hgl
|
||||
{
|
||||
@ -16,7 +17,7 @@ namespace hgl
|
||||
|
||||
void InitVertexBufferAPI()
|
||||
{
|
||||
if(GLEW_VERSION_4_5||GLEW_ARB_direct_state_access)
|
||||
if(IsSupportDSA())
|
||||
CreateVertexBufferControl=CreateVertexBufferControlDSA;
|
||||
else
|
||||
CreateVertexBufferControl=CreateVertexBufferControlBind;
|
||||
|
Loading…
x
Reference in New Issue
Block a user