Basic GL_ARB_vertex_shader detection.
Remove a redundant copy operation in ModelRData::BuildVertices This was SVN commit r2822.
This commit is contained in:
parent
99c6af533d
commit
a92e92cd46
@ -66,6 +66,48 @@ FUNC2(void, glCompressedTexSubImage2DARB, glCompressedTexSubImage2D, "1.3", (GLe
|
|||||||
FUNC2(void, glCompressedTexSubImage1DARB, glCompressedTexSubImage1D, "1.3", (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid*))
|
FUNC2(void, glCompressedTexSubImage1DARB, glCompressedTexSubImage1D, "1.3", (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid*))
|
||||||
FUNC2(void, glGetCompressedTexImageARB, glGetCompressedTexImage, "1.3", (GLenum, GLint, GLvoid*))
|
FUNC2(void, glGetCompressedTexImageARB, glGetCompressedTexImage, "1.3", (GLenum, GLint, GLvoid*))
|
||||||
|
|
||||||
|
// GL_ARB_shader_objects
|
||||||
|
FUNC2(void, glDeleteObjectARB, glDeleteObject, "2.0", (GLhandleARB obj))
|
||||||
|
FUNC2(GLhandleARB, glGetHandleARB, glGetHandle, "2.0", (GLenum pname))
|
||||||
|
FUNC2(void, glDetachObjectARB, glDetachObject, "2.0", (GLhandleARB containerObj, GLhandleARB attachedObj))
|
||||||
|
FUNC2(GLhandleARB, glCreateShaderObjectARB, glCreateShaderObject, "2.0", (GLenum shaderType))
|
||||||
|
FUNC2(void, glShaderSourceARB, glShaderSource, "2.0", (GLhandleARB shaderObj, GLsizei count, const char **string, const GLint *length))
|
||||||
|
FUNC2(void, glCompileShaderARB, glCompileShader, "2.0", (GLhandleARB shaderObj))
|
||||||
|
FUNC2(GLhandleARB, glCreateProgramObjectARB, glCreateProgramObject, "2.0", (void))
|
||||||
|
FUNC2(void, glAttachObjectARB, glAttachObject, "2.0", (GLhandleARB containerObj, GLhandleARB obj))
|
||||||
|
FUNC2(void, glLinkProgramARB, glLinkProgram, "2.0", (GLhandleARB programObj))
|
||||||
|
FUNC2(void, glUseProgramObjectARB, glUseProgramObject, "2.0", (GLhandleARB programObj))
|
||||||
|
FUNC2(void, glValidateProgramARB, glValidateProgram, "2.0", (GLhandleARB programObj))
|
||||||
|
FUNC2(void, glUniform1fARB, glUniform1f, "2.0", (GLint location, GLfloat v0))
|
||||||
|
FUNC2(void, glUniform2fARB, glUniform2f, "2.0", (GLint location, GLfloat v0, GLfloat v1))
|
||||||
|
FUNC2(void, glUniform3fARB, glUniform3f, "2.0", (GLint location, GLfloat v0, GLfloat v1, GLfloat v2))
|
||||||
|
FUNC2(void, glUniform4fARB, glUniform4f, "2.0", (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3))
|
||||||
|
FUNC2(void, glUniform1iARB, glUniform1i, "2.0", (GLint location, GLint v0))
|
||||||
|
FUNC2(void, glUniform2iARB, glUniform2i, "2.0", (GLint location, GLint v0, GLint v1))
|
||||||
|
FUNC2(void, glUniform3iARB, glUniform3i, "2.0", (GLint location, GLint v0, GLint v1, GLint v2))
|
||||||
|
FUNC2(void, glUniform4iARB, glUniform4i, "2.0", (GLint location, GLint v0, GLint v1, GLint v2, GLint v3))
|
||||||
|
FUNC2(void, glUniform1fvARB, glUniform1fv, "2.0", (GLint location, GLsizei count, const GLfloat *value))
|
||||||
|
FUNC2(void, glUniform2fvARB, glUniform2fv, "2.0", (GLint location, GLsizei count, const GLfloat *value))
|
||||||
|
FUNC2(void, glUniform3fvARB, glUniform3fv, "2.0", (GLint location, GLsizei count, const GLfloat *value))
|
||||||
|
FUNC2(void, glUniform4fvARB, glUniform4fv, "2.0", (GLint location, GLsizei count, const GLfloat *value))
|
||||||
|
FUNC2(void, glUniform1ivARB, glUniform1iv, "2.0", (GLint location, GLsizei count, const GLint *value))
|
||||||
|
FUNC2(void, glUniform2ivARB, glUniform2iv, "2.0", (GLint location, GLsizei count, const GLint *value))
|
||||||
|
FUNC2(void, glUniform3ivARB, glUniform3iv, "2.0", (GLint location, GLsizei count, const GLint *value))
|
||||||
|
FUNC2(void, glUniform4ivARB, glUniform4iv, "2.0", (GLint location, GLsizei count, const GLint *value))
|
||||||
|
FUNC2(void, glUniformMatrix2fvARB, glUniformMatrix2fv, "2.0", (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
|
||||||
|
FUNC2(void, glUniformMatrix3fvARB, glUniformMatrix3fv, "2.0", (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
|
||||||
|
FUNC2(void, glUniformMatrix4fvARB, glUniformMatrix4fv, "2.0", (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
|
||||||
|
FUNC2(void, glGetObjectParameterfvARB, glGetObjectParameterfv, "2.0", (GLhandleARB obj, GLenum pname, GLfloat *params))
|
||||||
|
FUNC2(void, glGetObjectParameterivARB, glGetObjectParameteriv, "2.0", (GLhandleARB obj, GLenum pname, GLint *params))
|
||||||
|
FUNC2(void, glGetInfoLogARB, glGetInfoLog, "2.0", (GLhandleARB obj, GLsizei maxLength, GLsizei *length, char *infoLog))
|
||||||
|
FUNC2(void, glGetAttachedObjectsARB, glGetAttachedObjects, "2.0", (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj))
|
||||||
|
FUNC2(GLint, glGetUniformLocationARB, glGetUniformLocation, "2.0", (GLhandleARB programObj, const char *name))
|
||||||
|
FUNC2(void, glGetActiveUniformARB, glGetActiveUniform, "2.0", (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, char *name))
|
||||||
|
FUNC2(void, glGetUniformfvARB, glGetUniformfv, "2.0", (GLhandleARB programObj, GLint location, GLfloat *params))
|
||||||
|
FUNC2(void, glGetUniformivARB, glGetUniformiv, "2.0", (GLhandleARB programObj, GLint location, GLint *params))
|
||||||
|
FUNC2(void, glGetShaderSourceARB, glGetShaderSource, "2.0", (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source))
|
||||||
|
|
||||||
|
|
||||||
#if OS_WIN
|
#if OS_WIN
|
||||||
// WGL_EXT_swap_control
|
// WGL_EXT_swap_control
|
||||||
FUNC(int, wglSwapIntervalEXT, (int))
|
FUNC(int, wglSwapIntervalEXT, (int))
|
||||||
|
@ -55,7 +55,7 @@ extern "C"
|
|||||||
|
|
||||||
|
|
||||||
static const char* exts = NULL;
|
static const char* exts = NULL;
|
||||||
static bool have_14, have_13, have_12;
|
static bool have_20, have_14, have_13, have_12;
|
||||||
|
|
||||||
|
|
||||||
// return a C string of unspecified length containing a space-separated
|
// return a C string of unspecified length containing a space-separated
|
||||||
@ -80,6 +80,15 @@ static bool isImplementedInCore(const char* ext)
|
|||||||
if(!strcmp(ext, #known_ext))\
|
if(!strcmp(ext, #known_ext))\
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if(have_20)
|
||||||
|
{
|
||||||
|
MATCH(GL_ARB_shader_objects);
|
||||||
|
MATCH(GL_ARB_vertex_shader);
|
||||||
|
MATCH(GL_ARB_fragment_shader);
|
||||||
|
MATCH(GL_ARB_draw_buffers);
|
||||||
|
MATCH(GL_ARB_texture_non_power_of_two);
|
||||||
|
MATCH(GL_ARB_point_sprite);
|
||||||
|
}
|
||||||
if(have_14)
|
if(have_14)
|
||||||
{
|
{
|
||||||
MATCH(GL_SGIS_generate_mipmap);
|
MATCH(GL_SGIS_generate_mipmap);
|
||||||
@ -403,6 +412,7 @@ void oglInit()
|
|||||||
have_12 = oglHaveVersion("1.2");
|
have_12 = oglHaveVersion("1.2");
|
||||||
have_13 = oglHaveVersion("1.3");
|
have_13 = oglHaveVersion("1.3");
|
||||||
have_14 = oglHaveVersion("1.4");
|
have_14 = oglHaveVersion("1.4");
|
||||||
|
have_20 = oglHaveVersion("2.0");
|
||||||
|
|
||||||
importExtensionFunctions();
|
importExtensionFunctions();
|
||||||
|
|
||||||
|
@ -146,16 +146,22 @@ static void SkinNormal(const SModelVertex& vertex,const CMatrix3D* invmatrices,C
|
|||||||
void CModelRData::BuildVertices()
|
void CModelRData::BuildVertices()
|
||||||
{
|
{
|
||||||
CModelDefPtr mdef=m_Model->GetModelDef();
|
CModelDefPtr mdef=m_Model->GetModelDef();
|
||||||
|
size_t numVertices=mdef->GetNumVertices();
|
||||||
|
SModelVertex* vertices=mdef->GetVertices();
|
||||||
|
|
||||||
// allocate vertices if we haven't got any already
|
// allocate vertices if we haven't got any already and
|
||||||
|
// fill in data that never changes
|
||||||
if (!m_Vertices) {
|
if (!m_Vertices) {
|
||||||
m_Vertices=new SVertex[mdef->GetNumVertices()];
|
m_Vertices=new SVertex[mdef->GetNumVertices()];
|
||||||
m_Normals=new CVector3D[mdef->GetNumVertices()];
|
m_Normals=new CVector3D[mdef->GetNumVertices()];
|
||||||
|
|
||||||
|
for (uint j=0; j<numVertices; j++) {
|
||||||
|
m_Vertices[j].m_UVs[0]=vertices[j].m_U;
|
||||||
|
m_Vertices[j].m_UVs[1]=1-vertices[j].m_V;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// build vertices
|
// build vertices
|
||||||
size_t numVertices=mdef->GetNumVertices();
|
|
||||||
SModelVertex* vertices=mdef->GetVertices();
|
|
||||||
const CMatrix3D* bonematrices=m_Model->GetBoneMatrices();
|
const CMatrix3D* bonematrices=m_Model->GetBoneMatrices();
|
||||||
if (bonematrices) {
|
if (bonematrices) {
|
||||||
// boned model - calculate skinned vertex positions/normals
|
// boned model - calculate skinned vertex positions/normals
|
||||||
@ -178,8 +184,6 @@ void CModelRData::BuildVertices()
|
|||||||
PROFILE_START( "lighting vertices" );
|
PROFILE_START( "lighting vertices" );
|
||||||
// now fill in UV and vertex colour data
|
// now fill in UV and vertex colour data
|
||||||
for (uint j=0; j<numVertices; j++) {
|
for (uint j=0; j<numVertices; j++) {
|
||||||
m_Vertices[j].m_UVs[0]=vertices[j].m_U;
|
|
||||||
m_Vertices[j].m_UVs[1]=1-vertices[j].m_V;
|
|
||||||
CColor sc = m_Model->GetShadingColor();
|
CColor sc = m_Model->GetShadingColor();
|
||||||
g_Renderer.m_SHCoeffsUnits.Evaluate(m_Normals[j], m_Vertices[j].m_Color,
|
g_Renderer.m_SHCoeffsUnits.Evaluate(m_Normals[j], m_Vertices[j].m_Color,
|
||||||
RGBColor(sc.r, sc.g, sc.b));
|
RGBColor(sc.r, sc.g, sc.b));
|
||||||
|
@ -110,6 +110,7 @@ void CRenderer::EnumCaps()
|
|||||||
m_Caps.m_VBO=false;
|
m_Caps.m_VBO=false;
|
||||||
m_Caps.m_TextureBorderClamp=false;
|
m_Caps.m_TextureBorderClamp=false;
|
||||||
m_Caps.m_GenerateMipmaps=false;
|
m_Caps.m_GenerateMipmaps=false;
|
||||||
|
m_Caps.m_VertexShader=false;
|
||||||
|
|
||||||
// now start querying extensions
|
// now start querying extensions
|
||||||
if (!m_Options.m_NoVBO) {
|
if (!m_Options.m_NoVBO) {
|
||||||
@ -123,8 +124,14 @@ void CRenderer::EnumCaps()
|
|||||||
if (oglHaveExtension("GL_SGIS_generate_mipmap")) {
|
if (oglHaveExtension("GL_SGIS_generate_mipmap")) {
|
||||||
m_Caps.m_GenerateMipmaps=true;
|
m_Caps.m_GenerateMipmaps=true;
|
||||||
}
|
}
|
||||||
|
if (0 == oglHaveExtensions(0, "GL_ARB_shader_objects", "GL_ARB_shading_language_100", 0))
|
||||||
|
{
|
||||||
|
if (oglHaveExtension("GL_ARB_vertex_shader"))
|
||||||
|
m_Caps.m_VertexShader=true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CRenderer::Open(int width, int height, int depth)
|
bool CRenderer::Open(int width, int height, int depth)
|
||||||
{
|
{
|
||||||
m_Width = width;
|
m_Width = width;
|
||||||
|
@ -319,6 +319,7 @@ protected:
|
|||||||
bool m_VBO;
|
bool m_VBO;
|
||||||
bool m_TextureBorderClamp;
|
bool m_TextureBorderClamp;
|
||||||
bool m_GenerateMipmaps;
|
bool m_GenerateMipmaps;
|
||||||
|
bool m_VertexShader;
|
||||||
} m_Caps;
|
} m_Caps;
|
||||||
// renderer options
|
// renderer options
|
||||||
struct Options {
|
struct Options {
|
||||||
|
Loading…
Reference in New Issue
Block a user