Removed lots of EXT Vertex Shader related code.

--HG--
branch : gsoc2013-dfighter
hg/feature/gsoc2013-dfighter
dfighter1985 12 years ago
parent 932f2bdd27
commit a81db21e0a

@ -129,9 +129,6 @@ uint CDriverGL3::_Registered=0;
// Version of the driver. Not the interface version!! Increment when implementation of the driver change. // Version of the driver. Not the interface version!! Increment when implementation of the driver change.
const uint32 CDriverGL3::ReleaseVersion = 0x11; const uint32 CDriverGL3::ReleaseVersion = 0x11;
// Number of register to allocate for the EXTVertexShader extension
const uint CDriverGL3::_EVSNumConstant = 97;
GLenum CDriverGL3::NLCubeFaceToGLCubeFace[6] = GLenum CDriverGL3::NLCubeFaceToGLCubeFace[6] =
{ {
GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB,
@ -526,43 +523,6 @@ bool CDriverGL3::setupDisplay()
// check whether per pixel lighting shader is supported // check whether per pixel lighting shader is supported
checkForPerPixelLightingSupport(); checkForPerPixelLightingSupport();
// if EXTVertexShader is used, bind the standard GL arrays, and allocate constant
if ( !_Extensions.ARBVertexProgram && _Extensions.EXTVertexShader)
{
_EVSPositionHandle = nglBindParameterEXT(GL_CURRENT_VERTEX_EXT);
_EVSNormalHandle = nglBindParameterEXT(GL_CURRENT_NORMAL);
_EVSColorHandle = nglBindParameterEXT(GL_CURRENT_COLOR);
if (!_EVSPositionHandle || !_EVSNormalHandle || !_EVSColorHandle)
{
nlwarning("Unable to bind input parameters for use with EXT_vertex_shader, vertex program support is disabled");
_Extensions.EXTVertexShader = false;
}
else
{
// bind texture units
for(uint k = 0; k < 8; ++k)
{
_EVSTexHandle[k] = nglBindTextureUnitParameterEXT(GL_TEXTURE0_ARB + k, GL_CURRENT_TEXTURE_COORDS);
}
// Other attributes are managed using variant pointers :
// Secondary color
// Fog Coords
// Skin Weight
// Skin palette
// This mean that they must have 4 components
// Allocate invariants. One assitionnal variant is needed for fog coordinate if fog bug is not fixed in driver version
_EVSConstantHandle = nglGenSymbolsEXT(GL_VECTOR_EXT, GL_INVARIANT_EXT, GL_FULL_RANGE_EXT, _EVSNumConstant + (_ATIFogRangeFixed ? 0 : 1));
if (_EVSConstantHandle == 0)
{
nlwarning("Unable to allocate constants for EXT_vertex_shader, vertex program support is disabled");
_Extensions.EXTVertexShader = false;
}
}
}
// Reset the vbl interval // Reset the vbl interval
setSwapVBLInterval(_Interval); setSwapVBLInterval(_Interval);
@ -1186,23 +1146,6 @@ void CDriverGL3::setupFog(float start, float end, CRGBA color)
glFogfv(GL_FOG_COLOR, _CurrentFogColor); glFogfv(GL_FOG_COLOR, _CurrentFogColor);
/** Special : with vertex program, using the extension EXT_vertex_shader, fog is emulated using 1 more constant to scale result to [0, 1]
*/
if (_Extensions.EXTVertexShader && !_Extensions.ARBVertexProgram)
{
if (!_ATIFogRangeFixed)
{
// last constant is used to store fog information (fog must be rescaled to [0, 1], because of a driver bug)
if (start != end)
{
setConstant(_EVSNumConstant, 1.f / (start - end), - end / (start - end), 0, 0);
}
else
{
setConstant(_EVSNumConstant, 0.f, 0, 0, 0);
}
}
}
_FogStart = start; _FogStart = start;
_FogEnd = end; _FogEnd = end;
} }
@ -1323,7 +1266,7 @@ bool CDriverGL3::isWaterShaderSupported() const
if(_Extensions.ARBFragmentProgram && ARBWaterShader[0] != 0) return true; if(_Extensions.ARBFragmentProgram && ARBWaterShader[0] != 0) return true;
if (!_Extensions.EXTVertexShader && !_Extensions.ARBVertexProgram) return false; // should support vertex programs if (!_Extensions.ARBVertexProgram) return false; // should support vertex programs
if (!_Extensions.NVTextureShader && !_Extensions.ATIFragmentShader && !_Extensions.ARBFragmentProgram) return false; if (!_Extensions.NVTextureShader && !_Extensions.ATIFragmentShader && !_Extensions.ARBFragmentProgram) return false;
return true; return true;
} }
@ -1389,12 +1332,12 @@ void CDriverGL3::checkForPerPixelLightingSupport()
_SupportPerPixelShaderNoSpec = (_Extensions.NVTextureEnvCombine4 || _Extensions.ATITextureEnvCombine3) _SupportPerPixelShaderNoSpec = (_Extensions.NVTextureEnvCombine4 || _Extensions.ATITextureEnvCombine3)
&& _Extensions.ARBTextureCubeMap && _Extensions.ARBTextureCubeMap
&& _Extensions.NbTextureStages >= 3 && _Extensions.NbTextureStages >= 3
&& ( _Extensions.ARBVertexProgram || _Extensions.EXTVertexShader); && ( _Extensions.ARBVertexProgram );
_SupportPerPixelShader = (_Extensions.NVTextureEnvCombine4 || _Extensions.ATITextureEnvCombine3) _SupportPerPixelShader = (_Extensions.NVTextureEnvCombine4 || _Extensions.ATITextureEnvCombine3)
&& _Extensions.ARBTextureCubeMap && _Extensions.ARBTextureCubeMap
&& _Extensions.NbTextureStages >= 2 && _Extensions.NbTextureStages >= 2
&& ( _Extensions.ARBVertexProgram || _Extensions.EXTVertexShader); && ( _Extensions.ARBVertexProgram );
} }
// *************************************************************************** // ***************************************************************************

@ -1171,9 +1171,7 @@ private:
/// Tools fct used by setupGLArrays /// Tools fct used by setupGLArrays
void setupGlArraysStd(CVertexBufferInfo &vb); void setupGlArraysStd(CVertexBufferInfo &vb);
void setupGlArraysForARBVertexProgram(CVertexBufferInfo &vb); void setupGlArraysForARBVertexProgram(CVertexBufferInfo &vb);
void setupGlArraysForEXTVertexShader(CVertexBufferInfo &vb);
void toggleGlArraysForARBVertexProgram(); void toggleGlArraysForARBVertexProgram();
void toggleGlArraysForEXTVertexShader();
/// Test/activate normalisation of normal. /// Test/activate normalisation of normal.
void enableGlNormalize(bool normalize) void enableGlNormalize(bool normalize)
@ -1291,7 +1289,6 @@ private:
/// \name Vertex program implementation /// \name Vertex program implementation
// @{ // @{
bool activeARBVertexProgram (CVertexProgram *program); bool activeARBVertexProgram (CVertexProgram *program);
bool activeEXTVertexShader (CVertexProgram *program);
//@} //@}
@ -1348,31 +1345,9 @@ private:
NLMISC::CRGBA _CurrentBlendConstantColor; NLMISC::CRGBA _CurrentBlendConstantColor;
/// \name EXTVertexShader specifics.
// @{
// Variants offset used for :
// Secondary color
// Fog Coords
// Skin Weight
// Palette Skin
// This mean that they must have 4 components
public:
enum EEVSVariants { EVSSecondaryColorVariant = 0, EVSFogCoordsVariant = 1, EVSSkinWeightVariant = 2, EVSPaletteSkinVariant = 3, EVSNumVariants };
private: private:
// Handle for standard gl arrays
GLuint _EVSPositionHandle;
GLuint _EVSNormalHandle;
GLuint _EVSColorHandle;
GLuint _EVSTexHandle[8];
// Handle of the first constant c[0]. In vertex program we have 96 constant c[0] .. c[95]
GLuint _EVSConstantHandle;
// number of constant
static const uint _EVSNumConstant;
//
bool setupEXTVertexShader(const CVPParser::TProgram &program, GLuint id, uint variants[EVSNumVariants], uint16 &usedInputRegisters);
bool setupARBVertexProgram (const CVPParser::TProgram &parsedProgram, GLuint id, bool &specularWritten); bool setupARBVertexProgram (const CVPParser::TProgram &parsedProgram, GLuint id, bool &specularWritten);
//
// @}
// init EMBM settings (set each stage to modify the next) // init EMBM settings (set each stage to modify the next)
void initEMBM(); void initEMBM();
@ -1470,17 +1445,6 @@ public:
// ARB_vertex_program specific -> must know if specular part is written // ARB_vertex_program specific -> must know if specular part is written
bool SpecularWritten; bool SpecularWritten;
/** EXTVertexShader specific
* handle of allocated variants
*/
GLuint Variants[CDriverGL3::EVSNumVariants];
/** EXTVertexShader specific
* Used input registers.
* This allow to activate only the gl arrays that are needed by a given shader.
*/
uint16 UsedVertexComponents;
// The gl id is auto created here. // The gl id is auto created here.
CVertexProgamDrvInfosGL3 (CDriverGL3 *drv, ItVtxPrgDrvInfoPtrList it); CVertexProgamDrvInfosGL3 (CDriverGL3 *drv, ItVtxPrgDrvInfoPtrList it);
}; };

@ -115,42 +115,6 @@ NEL_PFNGLVERTEXWEIGHTFEXTPROC nglVertexWeightfEXT;
NEL_PFNGLVERTEXWEIGHTFVEXTPROC nglVertexWeightfvEXT; NEL_PFNGLVERTEXWEIGHTFVEXTPROC nglVertexWeightfvEXT;
NEL_PFNGLVERTEXWEIGHTPOINTEREXTPROC nglVertexWeightPointerEXT; NEL_PFNGLVERTEXWEIGHTPOINTEREXTPROC nglVertexWeightPointerEXT;
// VertexShaderExt extension
NEL_PFNGLBEGINVERTEXSHADEREXTPROC nglBeginVertexShaderEXT;
NEL_PFNGLENDVERTEXSHADEREXTPROC nglEndVertexShaderEXT;
NEL_PFNGLBINDVERTEXSHADEREXTPROC nglBindVertexShaderEXT;
NEL_PFNGLGENVERTEXSHADERSEXTPROC nglGenVertexShadersEXT;
NEL_PFNGLDELETEVERTEXSHADEREXTPROC nglDeleteVertexShaderEXT;
NEL_PFNGLSHADEROP1EXTPROC nglShaderOp1EXT;
NEL_PFNGLSHADEROP2EXTPROC nglShaderOp2EXT;
NEL_PFNGLSHADEROP3EXTPROC nglShaderOp3EXT;
NEL_PFNGLSWIZZLEEXTPROC nglSwizzleEXT;
NEL_PFNGLWRITEMASKEXTPROC nglWriteMaskEXT;
NEL_PFNGLINSERTCOMPONENTEXTPROC nglInsertComponentEXT;
NEL_PFNGLEXTRACTCOMPONENTEXTPROC nglExtractComponentEXT;
NEL_PFNGLGENSYMBOLSEXTPROC nglGenSymbolsEXT;
NEL_PFNGLSETINVARIANTEXTPROC nglSetInvariantEXT;
NEL_PFNGLSETLOCALCONSTANTEXTPROC nglSetLocalConstantEXT;
NEL_PFNGLVARIANTPOINTEREXTPROC nglVariantPointerEXT;
NEL_PFNGLENABLEVARIANTCLIENTSTATEEXTPROC nglEnableVariantClientStateEXT;
NEL_PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC nglDisableVariantClientStateEXT;
NEL_PFNGLBINDLIGHTPARAMETEREXTPROC nglBindLightParameterEXT;
NEL_PFNGLBINDMATERIALPARAMETEREXTPROC nglBindMaterialParameterEXT;
NEL_PFNGLBINDTEXGENPARAMETEREXTPROC nglBindTexGenParameterEXT;
NEL_PFNGLBINDTEXTUREUNITPARAMETEREXTPROC nglBindTextureUnitParameterEXT;
NEL_PFNGLBINDPARAMETEREXTPROC nglBindParameterEXT;
NEL_PFNGLISVARIANTENABLEDEXTPROC nglIsVariantEnabledEXT;
NEL_PFNGLGETVARIANTBOOLEANVEXTPROC nglGetVariantBooleanvEXT;
NEL_PFNGLGETVARIANTINTEGERVEXTPROC nglGetVariantIntegervEXT;
NEL_PFNGLGETVARIANTFLOATVEXTPROC nglGetVariantFloatvEXT;
NEL_PFNGLGETVARIANTPOINTERVEXTPROC nglGetVariantPointervEXT;
NEL_PFNGLGETINVARIANTBOOLEANVEXTPROC nglGetInvariantBooleanvEXT;
NEL_PFNGLGETINVARIANTINTEGERVEXTPROC nglGetInvariantIntegervEXT;
NEL_PFNGLGETINVARIANTFLOATVEXTPROC nglGetInvariantFloatvEXT;
NEL_PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC nglGetLocalConstantBooleanvEXT;
NEL_PFNGLGETLOCALCONSTANTINTEGERVEXTPROC nglGetLocalConstantIntegervEXT;
NEL_PFNGLGETLOCALCONSTANTFLOATVEXTPROC nglGetLocalConstantFloatvEXT;
// SecondaryColor extension // SecondaryColor extension
NEL_PFNGLSECONDARYCOLOR3BEXTPROC nglSecondaryColor3bEXT; NEL_PFNGLSECONDARYCOLOR3BEXTPROC nglSecondaryColor3bEXT;
NEL_PFNGLSECONDARYCOLOR3BVEXTPROC nglSecondaryColor3bvEXT; NEL_PFNGLSECONDARYCOLOR3BVEXTPROC nglSecondaryColor3bvEXT;
@ -592,81 +556,6 @@ static bool setupARBTextureCubeMap(const char *glext)
return true; return true;
} }
// *********************************
static bool setupEXTVertexShader(const char *glext)
{
H_AUTO_OGL(setupEXTVertexShader);
CHECK_EXT("GL_EXT_vertex_shader");
CHECK_ADDRESS(NEL_PFNGLBEGINVERTEXSHADEREXTPROC, glBeginVertexShaderEXT);
CHECK_ADDRESS(NEL_PFNGLENDVERTEXSHADEREXTPROC, glEndVertexShaderEXT);
CHECK_ADDRESS(NEL_PFNGLBINDVERTEXSHADEREXTPROC, glBindVertexShaderEXT);
CHECK_ADDRESS(NEL_PFNGLGENVERTEXSHADERSEXTPROC, glGenVertexShadersEXT);
CHECK_ADDRESS(NEL_PFNGLDELETEVERTEXSHADEREXTPROC, glDeleteVertexShaderEXT);
CHECK_ADDRESS(NEL_PFNGLSHADEROP1EXTPROC, glShaderOp1EXT);
CHECK_ADDRESS(NEL_PFNGLSHADEROP2EXTPROC, glShaderOp2EXT);
CHECK_ADDRESS(NEL_PFNGLSHADEROP3EXTPROC, glShaderOp3EXT);
CHECK_ADDRESS(NEL_PFNGLSWIZZLEEXTPROC, glSwizzleEXT);
CHECK_ADDRESS(NEL_PFNGLWRITEMASKEXTPROC, glWriteMaskEXT);
CHECK_ADDRESS(NEL_PFNGLINSERTCOMPONENTEXTPROC, glInsertComponentEXT);
CHECK_ADDRESS(NEL_PFNGLEXTRACTCOMPONENTEXTPROC, glExtractComponentEXT);
CHECK_ADDRESS(NEL_PFNGLGENSYMBOLSEXTPROC, glGenSymbolsEXT);
CHECK_ADDRESS(NEL_PFNGLSETINVARIANTEXTPROC, glSetInvariantEXT);
CHECK_ADDRESS(NEL_PFNGLSETLOCALCONSTANTEXTPROC, glSetLocalConstantEXT);
CHECK_ADDRESS(NEL_PFNGLVARIANTPOINTEREXTPROC, glVariantPointerEXT);
CHECK_ADDRESS(NEL_PFNGLENABLEVARIANTCLIENTSTATEEXTPROC, glEnableVariantClientStateEXT);
CHECK_ADDRESS(NEL_PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC, glDisableVariantClientStateEXT);
CHECK_ADDRESS(NEL_PFNGLBINDLIGHTPARAMETEREXTPROC, glBindLightParameterEXT);
CHECK_ADDRESS(NEL_PFNGLBINDMATERIALPARAMETEREXTPROC, glBindMaterialParameterEXT);
CHECK_ADDRESS(NEL_PFNGLBINDTEXGENPARAMETEREXTPROC, glBindTexGenParameterEXT);
CHECK_ADDRESS(NEL_PFNGLBINDTEXTUREUNITPARAMETEREXTPROC, glBindTextureUnitParameterEXT);
CHECK_ADDRESS(NEL_PFNGLBINDPARAMETEREXTPROC, glBindParameterEXT);
CHECK_ADDRESS(NEL_PFNGLISVARIANTENABLEDEXTPROC, glIsVariantEnabledEXT);
CHECK_ADDRESS(NEL_PFNGLGETVARIANTBOOLEANVEXTPROC, glGetVariantBooleanvEXT);
CHECK_ADDRESS(NEL_PFNGLGETVARIANTINTEGERVEXTPROC, glGetVariantIntegervEXT);
CHECK_ADDRESS(NEL_PFNGLGETVARIANTFLOATVEXTPROC, glGetVariantFloatvEXT);
CHECK_ADDRESS(NEL_PFNGLGETVARIANTPOINTERVEXTPROC, glGetVariantPointervEXT);
CHECK_ADDRESS(NEL_PFNGLGETINVARIANTBOOLEANVEXTPROC, glGetInvariantBooleanvEXT);
CHECK_ADDRESS(NEL_PFNGLGETINVARIANTINTEGERVEXTPROC, glGetInvariantIntegervEXT);
CHECK_ADDRESS(NEL_PFNGLGETINVARIANTFLOATVEXTPROC, glGetInvariantFloatvEXT);
CHECK_ADDRESS(NEL_PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC, glGetLocalConstantBooleanvEXT);
CHECK_ADDRESS(NEL_PFNGLGETLOCALCONSTANTINTEGERVEXTPROC, glGetLocalConstantIntegervEXT);
CHECK_ADDRESS(NEL_PFNGLGETLOCALCONSTANTFLOATVEXTPROC, glGetLocalConstantFloatvEXT);
// we require at least 128 instructions, 15 local register (r0, r1,..,r11) + 3 temporary vector for swizzle emulation + 1 vector for indexing temp + 3 temporary scalar for LOGG, EXPP and LIT emulation, 1 address register
// we require 11 variants (4 textures + position + normal + primary color + secondary color + weight + palette skin + fog)
// we also require 2 local constants (0 and 1)
// 96 invariants (c[0], c[1] ..) + 1 invariants for fog emulation (fog coordinate must range from 0 to 1 with EXT_VERTEX_shader)
GLint numVSInst;
glGetIntegerv(GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT, &numVSInst);
if (numVSInst < 128) return false;
//
GLint numVSLocals;
glGetIntegerv(GL_MAX_VERTEX_SHADER_LOCALS_EXT, &numVSLocals);
if (numVSLocals < 4 * (12 + 4) + 1 + 3)
{
nlwarning("EXT_vertex_shader extension has not much register. Some vertex program may fail loading");
return false;
}
//
GLint numVSLocalConstants;
glGetIntegerv(GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT, &numVSLocalConstants);
if (numVSLocalConstants < 2) return false;
//
GLint numVSInvariants;
glGetIntegerv(GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT, &numVSInvariants);
if (numVSInvariants < 96 + 1) return false;
//
GLint numVSVariants;
glGetIntegerv(GL_MAX_VERTEX_SHADER_VARIANTS_EXT, &numVSVariants);
if (numVSInvariants < 4) return false;
return true;
}
// ********************************* // *********************************
static bool setupEXTSecondaryColor(const char *glext) static bool setupEXTSecondaryColor(const char *glext)
{ {
@ -1093,12 +982,10 @@ void registerGlExtensions(CGlExtensions &ext)
// Disable feature ??? // Disable feature ???
if(!ext.DisableHardwareVertexProgram) if(!ext.DisableHardwareVertexProgram)
{ {
ext.EXTVertexShader = setupEXTVertexShader(glext);
ext.ARBVertexProgram= setupARBVertexProgram(glext); ext.ARBVertexProgram= setupARBVertexProgram(glext);
} }
else else
{ {
ext.EXTVertexShader = false;
ext.ARBVertexProgram = false; ext.ARBVertexProgram = false;
} }

@ -47,7 +47,6 @@ struct CGlExtensions
bool EXTSeparateSpecularColor; bool EXTSeparateSpecularColor;
bool NVTextureEnvCombine4; bool NVTextureEnvCombine4;
bool ARBTextureCubeMap; bool ARBTextureCubeMap;
bool EXTVertexShader;
bool NVTextureShader; bool NVTextureShader;
bool NVOcclusionQuery; bool NVOcclusionQuery;
bool NVTextureRectangle; bool NVTextureRectangle;
@ -127,7 +126,6 @@ public:
EXTBlendColor= false; EXTBlendColor= false;
ATIEnvMapBumpMap = false; ATIEnvMapBumpMap = false;
ATIFragmentShader = false; ATIFragmentShader = false;
EXTVertexShader= false;
ARBFragmentProgram = false; ARBFragmentProgram = false;
ARBVertexProgram = false; ARBVertexProgram = false;
NVTextureRectangle = false; NVTextureRectangle = false;
@ -182,7 +180,6 @@ public:
result += ATIFragmentShader ? "ATIFragmentShader " : ""; result += ATIFragmentShader ? "ATIFragmentShader " : "";
result += ARBFragmentProgram ? "ARBFragmentProgram " : ""; result += ARBFragmentProgram ? "ARBFragmentProgram " : "";
result += ARBVertexProgram ? "ARBVertexProgram " : ""; result += ARBVertexProgram ? "ARBVertexProgram " : "";
result += EXTVertexShader ? "EXTVertexShader " : "";
result += "\n Misc: "; result += "\n Misc: ";
result += EXTVertexWeighting ? "EXTVertexWeighting " : ""; result += EXTVertexWeighting ? "EXTVertexWeighting " : "";
@ -308,44 +305,6 @@ extern NEL_PFNGLVERTEXWEIGHTFVEXTPROC nglVertexWeightfvEXT;
extern NEL_PFNGLVERTEXWEIGHTPOINTEREXTPROC nglVertexWeightPointerEXT; extern NEL_PFNGLVERTEXWEIGHTPOINTEREXTPROC nglVertexWeightPointerEXT;
// VertexShaderExtension.
//========================
extern NEL_PFNGLBEGINVERTEXSHADEREXTPROC nglBeginVertexShaderEXT;
extern NEL_PFNGLENDVERTEXSHADEREXTPROC nglEndVertexShaderEXT;
extern NEL_PFNGLBINDVERTEXSHADEREXTPROC nglBindVertexShaderEXT;
extern NEL_PFNGLGENVERTEXSHADERSEXTPROC nglGenVertexShadersEXT;
extern NEL_PFNGLDELETEVERTEXSHADEREXTPROC nglDeleteVertexShaderEXT;
extern NEL_PFNGLSHADEROP1EXTPROC nglShaderOp1EXT;
extern NEL_PFNGLSHADEROP2EXTPROC nglShaderOp2EXT;
extern NEL_PFNGLSHADEROP3EXTPROC nglShaderOp3EXT;
extern NEL_PFNGLSWIZZLEEXTPROC nglSwizzleEXT;
extern NEL_PFNGLWRITEMASKEXTPROC nglWriteMaskEXT;
extern NEL_PFNGLINSERTCOMPONENTEXTPROC nglInsertComponentEXT;
extern NEL_PFNGLEXTRACTCOMPONENTEXTPROC nglExtractComponentEXT;
extern NEL_PFNGLGENSYMBOLSEXTPROC nglGenSymbolsEXT;
extern NEL_PFNGLSETINVARIANTEXTPROC nglSetInvariantEXT;
extern NEL_PFNGLSETLOCALCONSTANTEXTPROC nglSetLocalConstantEXT;
extern NEL_PFNGLVARIANTPOINTEREXTPROC nglVariantPointerEXT;
extern NEL_PFNGLENABLEVARIANTCLIENTSTATEEXTPROC nglEnableVariantClientStateEXT;
extern NEL_PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC nglDisableVariantClientStateEXT;
extern NEL_PFNGLBINDLIGHTPARAMETEREXTPROC nglBindLightParameterEXT;
extern NEL_PFNGLBINDMATERIALPARAMETEREXTPROC nglBindMaterialParameterEXT;
extern NEL_PFNGLBINDTEXGENPARAMETEREXTPROC nglBindTexGenParameterEXT;
extern NEL_PFNGLBINDTEXTUREUNITPARAMETEREXTPROC nglBindTextureUnitParameterEXT;
extern NEL_PFNGLBINDPARAMETEREXTPROC nglBindParameterEXT;
extern NEL_PFNGLISVARIANTENABLEDEXTPROC nglIsVariantEnabledEXT;
extern NEL_PFNGLGETVARIANTBOOLEANVEXTPROC nglGetVariantBooleanvEXT;
extern NEL_PFNGLGETVARIANTINTEGERVEXTPROC nglGetVariantIntegervEXT;
extern NEL_PFNGLGETVARIANTFLOATVEXTPROC nglGetVariantFloatvEXT;
extern NEL_PFNGLGETVARIANTPOINTERVEXTPROC nglGetVariantPointervEXT;
extern NEL_PFNGLGETINVARIANTBOOLEANVEXTPROC nglGetInvariantBooleanvEXT;
extern NEL_PFNGLGETINVARIANTINTEGERVEXTPROC nglGetInvariantIntegervEXT;
extern NEL_PFNGLGETINVARIANTFLOATVEXTPROC nglGetInvariantFloatvEXT;
extern NEL_PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC nglGetLocalConstantBooleanvEXT;
extern NEL_PFNGLGETLOCALCONSTANTINTEGERVEXTPROC nglGetLocalConstantIntegervEXT;
extern NEL_PFNGLGETLOCALCONSTANTFLOATVEXTPROC nglGetLocalConstantFloatvEXT;
// ATI_envmap_bumpmap extension // ATI_envmap_bumpmap extension
extern PFNGLTEXBUMPPARAMETERIVATIPROC nglTexBumpParameterivATI; extern PFNGLTEXBUMPPARAMETERIVATIPROC nglTexBumpParameterivATI;

@ -91,44 +91,6 @@ typedef void (APIENTRY * NEL_PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight)
typedef void (APIENTRY * NEL_PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer); typedef void (APIENTRY * NEL_PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer);
// VertexShaderExtension (EXT)
//============================
typedef void (APIENTRY * NEL_PFNGLBEGINVERTEXSHADEREXTPROC) ( void );
typedef void (APIENTRY * NEL_PFNGLENDVERTEXSHADEREXTPROC) ( void );
typedef void (APIENTRY * NEL_PFNGLBINDVERTEXSHADEREXTPROC) ( GLuint id );
typedef GLuint (APIENTRY * NEL_PFNGLGENVERTEXSHADERSEXTPROC) ( GLuint range );
typedef void (APIENTRY * NEL_PFNGLDELETEVERTEXSHADEREXTPROC) ( GLuint id );
typedef void (APIENTRY * NEL_PFNGLSHADEROP1EXTPROC) ( GLenum op, GLuint res, GLuint arg1 );
typedef void (APIENTRY * NEL_PFNGLSHADEROP2EXTPROC) ( GLenum op, GLuint res, GLuint arg1, GLuint arg2 );
typedef void (APIENTRY * NEL_PFNGLSHADEROP3EXTPROC) ( GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3 );
typedef void (APIENTRY * NEL_PFNGLSWIZZLEEXTPROC) ( GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW );
typedef void (APIENTRY * NEL_PFNGLWRITEMASKEXTPROC) ( GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW );
typedef void (APIENTRY * NEL_PFNGLINSERTCOMPONENTEXTPROC) ( GLuint res, GLuint src, GLuint num );
typedef void (APIENTRY * NEL_PFNGLEXTRACTCOMPONENTEXTPROC) ( GLuint res, GLuint src, GLuint num );
typedef GLuint (APIENTRY * NEL_PFNGLGENSYMBOLSEXTPROC) ( GLenum datatype, GLenum storagetype, GLenum range, GLuint components ) ;
typedef void (APIENTRY * NEL_PFNGLSETINVARIANTEXTPROC) ( GLuint id, GLenum type, void *addr );
typedef void (APIENTRY * NEL_PFNGLSETLOCALCONSTANTEXTPROC) ( GLuint id, GLenum type, void *addr );
typedef void (APIENTRY * NEL_PFNGLVARIANTPOINTEREXTPROC) ( GLuint id, GLenum type, GLuint stride, void *addr );
typedef void (APIENTRY * NEL_PFNGLENABLEVARIANTCLIENTSTATEEXTPROC) ( GLuint id);
typedef void (APIENTRY * NEL_PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC) ( GLuint id);
typedef GLuint (APIENTRY * NEL_PFNGLBINDLIGHTPARAMETEREXTPROC) ( GLenum light, GLenum value);
typedef GLuint (APIENTRY * NEL_PFNGLBINDMATERIALPARAMETEREXTPROC) ( GLenum face, GLenum value);
typedef GLuint (APIENTRY * NEL_PFNGLBINDTEXGENPARAMETEREXTPROC) ( GLenum unit, GLenum coord, GLenum value);
typedef GLuint (APIENTRY * NEL_PFNGLBINDTEXTUREUNITPARAMETEREXTPROC) ( GLenum unit, GLenum value);
typedef GLuint (APIENTRY * NEL_PFNGLBINDPARAMETEREXTPROC) ( GLenum value);
typedef GLboolean (APIENTRY * NEL_PFNGLISVARIANTENABLEDEXTPROC) ( GLuint id, GLenum cap);
typedef void (APIENTRY * NEL_PFNGLGETVARIANTBOOLEANVEXTPROC) ( GLuint id, GLenum value, GLboolean *data);
typedef void (APIENTRY * NEL_PFNGLGETVARIANTINTEGERVEXTPROC) ( GLuint id, GLenum value, GLint *data);
typedef void (APIENTRY * NEL_PFNGLGETVARIANTFLOATVEXTPROC) ( GLuint id, GLenum value, GLfloat *data);
typedef void (APIENTRY * NEL_PFNGLGETVARIANTPOINTERVEXTPROC) ( GLuint id, GLenum value, void **data);
typedef void (APIENTRY * NEL_PFNGLGETINVARIANTBOOLEANVEXTPROC) ( GLuint id, GLenum value, GLboolean *data);
typedef void (APIENTRY * NEL_PFNGLGETINVARIANTINTEGERVEXTPROC) ( GLuint id, GLenum value, GLint *data);
typedef void (APIENTRY * NEL_PFNGLGETINVARIANTFLOATVEXTPROC) ( GLuint id, GLenum value, GLfloat *data);
typedef void (APIENTRY * NEL_PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC) ( GLuint id, GLenum value, GLboolean *data);
typedef void (APIENTRY * NEL_PFNGLGETLOCALCONSTANTINTEGERVEXTPROC) ( GLuint id, GLenum value, GLint *data);
typedef void (APIENTRY * NEL_PFNGLGETLOCALCONSTANTFLOATVEXTPROC) ( GLuint id, GLenum value, GLfloat *data);
// SecondaryColor extension // SecondaryColor extension
//======================== //========================
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue); typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue);

@ -2123,17 +2123,10 @@ void CDriverGL3::setupWaterPassARB(const CMaterial &mat)
* So we must add a special path for this case, where the fog coordinate is 'unscaled' again. * So we must add a special path for this case, where the fog coordinate is 'unscaled' again.
* NB : this is fixed in later drivers (from 6.14.10.6343), so check this * NB : this is fixed in later drivers (from 6.14.10.6343), so check this
*/ */
if (_Extensions.EXTVertexShader && !_ATIFogRangeFixed)
{
nglProgramEnvParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 2, 1.f, 0.f, 0.f, 0.f);
}
else
{
nglProgramEnvParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 2, - 1.f/ (_FogEnd - _FogStart), _FogEnd / (_FogEnd - _FogStart), 0.f, 0.f); nglProgramEnvParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 2, - 1.f/ (_FogEnd - _FogStart), _FogEnd / (_FogEnd - _FogStart), 0.f, 0.f);
} }
} }
} }
}
// *************************************************************************** // ***************************************************************************
/** Presetupped texture shader for water shader on NV20 /** Presetupped texture shader for water shader on NV20

@ -940,72 +940,6 @@ void CDriverGLStates3::enableVertexAttribArrayARB(uint glIndex,bool enable)
} }
} }
// ***************************************************************************
void CDriverGLStates3::enableVertexAttribArrayForEXTVertexShader(uint glIndex, bool enable, uint *variants)
{
H_AUTO_OGL(CDriverGLStates3_enableVertexAttribArrayForEXTVertexShader);
if(_VertexAttribArrayEnabled[glIndex] != enable)
{
switch(glIndex)
{
case 0: // position
enableVertexArray(enable);
break;
case 1: // skin weight
if(enable)
nglEnableVariantClientStateEXT(variants[CDriverGL3::EVSSkinWeightVariant]);
else
nglDisableVariantClientStateEXT(variants[CDriverGL3::EVSSkinWeightVariant]);
break;
case 2: // normal
enableNormalArray(enable);
break;
case 3: // color
enableColorArray(enable);
break;
case 4: // secondary color
if(enable)
nglEnableVariantClientStateEXT(variants[CDriverGL3::EVSSecondaryColorVariant]);
else
nglDisableVariantClientStateEXT(variants[CDriverGL3::EVSSecondaryColorVariant]);
break;
case 5: // fog coordinate
if(enable)
nglEnableVariantClientStateEXT(variants[CDriverGL3::EVSFogCoordsVariant]);
else
nglDisableVariantClientStateEXT(variants[CDriverGL3::EVSFogCoordsVariant]);
break;
case 6: // palette skin
if(enable)
nglEnableVariantClientStateEXT(variants[CDriverGL3::EVSPaletteSkinVariant]);
else
nglDisableVariantClientStateEXT(variants[CDriverGL3::EVSPaletteSkinVariant]);
break;
case 7: // empty
nlstop;
break;
case 8:
case 9:
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
clientActiveTextureARB(glIndex - 8);
enableTexCoordArray(enable);
break;
default:
nlstop; // invalid value
break;
}
_VertexAttribArrayEnabled[glIndex]= enable;
}
}
// *************************************************************************** // ***************************************************************************
void CDriverGLStates3::enableFog(uint enable) void CDriverGLStates3::enableFog(uint enable)
{ {

@ -168,10 +168,6 @@ public:
/** For vertexProgram. do not check if supported or not. /** For vertexProgram. do not check if supported or not.
*/ */
void enableVertexAttribArray(uint glIndex, bool enable); void enableVertexAttribArray(uint glIndex, bool enable);
/** Same as enableVertexAttribArray, but for EXTVertexShader (need variant ID)
* \param firstVariantSymbol the first variant symbol
*/
void enableVertexAttribArrayForEXTVertexShader(uint glIndex, bool enable, uint *variants);
// special version for ARB_vertex_program used with ARB_vertex_buffer or ATI_vertex_attrib_array_object // special version for ARB_vertex_program used with ARB_vertex_buffer or ATI_vertex_attrib_array_object
void enableVertexAttribArrayARB(uint glIndex, bool enable); void enableVertexAttribArrayARB(uint glIndex, bool enable);

@ -929,55 +929,6 @@ void CDriverGL3::toggleGlArraysForARBVertexProgram()
} }
} }
// ***************************************************************************
void CDriverGL3::toggleGlArraysForEXTVertexShader()
{
H_AUTO_OGL(CDriverGL3_toggleGlArraysForEXTVertexShader)
// If change of setup type, must disable olds.
//=======================
// If last was a VertexProgram setup, and now it is a standard GL array setup.
if( _LastSetupGLArrayVertexProgram && !isVertexProgramEnabled () )
{
CVertexProgram *vp = _LastSetuppedVP;
if (vp)
{
CVertexProgamDrvInfosGL3 *drvInfo = NLMISC::safe_cast<CVertexProgamDrvInfosGL3 *>((IVertexProgramDrvInfos *) vp->_DrvInfo);
if (drvInfo)
{
// Disable all VertexAttribs.
for (uint value=0; value<CVertexBuffer::NumValue; value++)
{
_DriverGLStates.enableVertexAttribArrayForEXTVertexShader(value, false, drvInfo->Variants);
}
}
}
// no more a vertex program setup.
_LastSetupGLArrayVertexProgram= false;
}
// If last was a standard GL array setup, and now it is a VertexProgram setup.
if( !_LastSetupGLArrayVertexProgram && isVertexProgramEnabled () )
{
// Disable all standards ptrs.
_DriverGLStates.enableVertexArray(false);
_DriverGLStates.enableNormalArray(false);
_DriverGLStates.enableColorArray(false);
_DriverGLStates.enableSecondaryColorArray(false);
for(uint i=0; i<inlGetNumTextStages(); i++)
{
_DriverGLStates.clientActiveTextureARB(i);
_DriverGLStates.enableTexCoordArray(false);
}
// now, vertex program setup.
_LastSetupGLArrayVertexProgram= true;
}
}
// tells for each vertex argument if it must be normalized when it is an integral type // tells for each vertex argument if it must be normalized when it is an integral type
static const GLboolean ARBVertexProgramMustNormalizeAttrib[] = static const GLboolean ARBVertexProgramMustNormalizeAttrib[] =
{ {
@ -1042,121 +993,6 @@ void CDriverGL3::setupGlArraysForARBVertexProgram(CVertexBufferInfo &vb)
} }
// ***************************************************************************
void CDriverGL3::setupGlArraysForEXTVertexShader(CVertexBufferInfo &vb)
{
H_AUTO_OGL(CDriverGL3_setupGlArraysForEXTVertexShader)
CVertexProgram *vp = _LastSetuppedVP;
if (!vp) return;
CVertexProgamDrvInfosGL3 *drvInfo = NLMISC::safe_cast<CVertexProgamDrvInfosGL3 *>((IVertexProgramDrvInfos *) vp->_DrvInfo);
if (!drvInfo) return;
uint32 flags= vb.VertexFormat;
_DriverGLStates.bindARBVertexBuffer(vb.VertexObjectId);
// For each value
for (uint value=0; value<CVertexBuffer::NumValue; value++)
{
// Flag
uint16 flag=1<<value;
// Type
CVertexBuffer::TType type=vb.Type[value];
// Index
uint glIndex=GLVertexAttribIndex[value];
// Not setuped value and used
if (flags & flag & drvInfo->UsedVertexComponents)
{
_DriverGLStates.enableVertexAttribArrayForEXTVertexShader(glIndex, true, drvInfo->Variants);
// use variant or open gl standard array
{
switch(value)
{
case CVertexBuffer::Position: // position
{
nlassert(NumCoordinatesType[type] >= 2);
glVertexPointer(NumCoordinatesType[type], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
}
break;
case CVertexBuffer::Weight: // skin weight
{
nlassert(NumCoordinatesType[type] == 4); // variant, only 4 component supported
nglVariantPointerEXT(drvInfo->Variants[CDriverGL3::EVSSkinWeightVariant], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
}
break;
case CVertexBuffer::Normal: // normal
{
nlassert(NumCoordinatesType[type] == 3); // must have 3 components for normals
glNormalPointer(GLType[type], vb.VertexSize, vb.ValuePtr[CVertexBuffer::Normal]);
}
break;
case CVertexBuffer::PrimaryColor: // color
{
nlassert(NumCoordinatesType[type] >= 3); // must have 3 or 4 components for primary color
glColorPointer(NumCoordinatesType[type], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
}
break;
case CVertexBuffer::SecondaryColor: // secondary color
{
// implemented using a variant, as not available with EXTVertexShader
nlassert(NumCoordinatesType[type] == 4); // variant, only 4 component supported
nglVariantPointerEXT(drvInfo->Variants[CDriverGL3::EVSSecondaryColorVariant], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
}
break;
case CVertexBuffer::Fog: // fog coordinate
{
// implemented using a variant
nlassert(NumCoordinatesType[type] == 4); // variant, only 4 component supported
nglVariantPointerEXT(drvInfo->Variants[CDriverGL3::EVSFogCoordsVariant], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
}
break;
case CVertexBuffer::PaletteSkin: // palette skin
{
// implemented using a variant
nlassert(NumCoordinatesType[type] == 4); // variant, only 4 component supported
nglVariantPointerEXT(drvInfo->Variants[CDriverGL3::EVSPaletteSkinVariant], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
}
break;
case CVertexBuffer::Empty: // empty
nlstop;
break;
case CVertexBuffer::TexCoord0:
case CVertexBuffer::TexCoord1:
case CVertexBuffer::TexCoord2:
case CVertexBuffer::TexCoord3:
case CVertexBuffer::TexCoord4:
case CVertexBuffer::TexCoord5:
case CVertexBuffer::TexCoord6:
case CVertexBuffer::TexCoord7:
{
_DriverGLStates.clientActiveTextureARB(value - CVertexBuffer::TexCoord0);
glTexCoordPointer(NumCoordinatesType[type], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
}
break;
default:
nlstop; // invalid value
break;
}
}
}
else
{
_DriverGLStates.enableVertexAttribArrayForEXTVertexShader(glIndex, false, drvInfo->Variants);
}
}
}
// *************************************************************************** // ***************************************************************************
void CDriverGL3::setupGlArrays(CVertexBufferInfo &vb) void CDriverGL3::setupGlArrays(CVertexBufferInfo &vb)
{ {
@ -1175,19 +1011,6 @@ void CDriverGL3::setupGlArrays(CVertexBufferInfo &vb)
setupGlArraysForARBVertexProgram(vb); setupGlArraysForARBVertexProgram(vb);
} }
} }
else if (_Extensions.EXTVertexShader)
{
toggleGlArraysForEXTVertexShader();
// Use a vertex program ?
if (!isVertexProgramEnabled ())
{
setupGlArraysStd(vb);
}
else
{
setupGlArraysForEXTVertexShader(vb);
}
}
else else
{ {
// no vertex programs // no vertex programs

Loading…
Cancel
Save